velloo 0.9.0 → 0.10.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 (111) hide show
  1. package/README.md +112 -128
  2. package/THIRD-PARTY-NOTICES.md +58 -58
  3. package/canvas/assets/InitWizard-C1CkcS7C.js +3 -0
  4. package/canvas/assets/index-CZPX0col.css +2 -0
  5. package/canvas/assets/index-D7gy-ZUv.js +49 -0
  6. package/canvas/assets/lucide-all-B49qZ9YE.js +1 -0
  7. package/canvas/assets/radix-CuVEihKE.js +41 -0
  8. package/canvas/assets/react-C1iE8mnY.js +9 -0
  9. package/canvas/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  10. package/canvas/assets/vendor-DXkvBgGY.js +58 -0
  11. package/canvas/assets/wand-sparkles-BxGgFkAt.js +1 -0
  12. package/canvas/index.html +6 -6
  13. package/{chunk-seaar5na.js → chunk-0rvdh1j3.js} +1 -1
  14. package/chunk-12pgt83m.js +8 -0
  15. package/chunk-12vc3f1h.js +3 -0
  16. package/{chunk-qvdvxqs0.js → chunk-28mhcvw2.js} +1 -1
  17. package/{chunk-ysf9388d.js → chunk-3zm7ydna.js} +1 -1
  18. package/{chunk-qn05hn7a.js → chunk-457fm9yy.js} +5 -3
  19. package/chunk-46jg9aqy.js +40 -0
  20. package/chunk-5gwh0zpn.js +3 -0
  21. package/{chunk-bsn761jv.js → chunk-5hb1e233.js} +1 -1
  22. package/{chunk-3f2p94wa.js → chunk-5ts4fvd9.js} +1 -1
  23. package/{chunk-c11n1tve.js → chunk-62amy8bj.js} +1 -1
  24. package/{chunk-ktps9v0k.js → chunk-6p8zwxxx.js} +1 -1
  25. package/{chunk-02gpgqj4.js → chunk-75gfv9g4.js} +10 -11
  26. package/chunk-84qjmqmz.js +2 -0
  27. package/{chunk-6adv9eke.js → chunk-85m9p67t.js} +2 -2
  28. package/chunk-91qesxwh.js +2 -0
  29. package/{chunk-ck3bg8rf.js → chunk-976rm76x.js} +1 -1
  30. package/chunk-99ccjbaa.js +4 -0
  31. package/{chunk-8kn6tp4b.js → chunk-9hc7m55p.js} +3 -4
  32. package/{chunk-xc6mats8.js → chunk-a7xka0bj.js} +1 -1
  33. package/chunk-ak57bgnh.js +2 -0
  34. package/chunk-bf5808x5.js +2 -0
  35. package/{chunk-00n2d68z.js → chunk-bj47gjs9.js} +1 -1
  36. package/chunk-d0m56cjx.js +2 -0
  37. package/chunk-d6a6198y.js +3 -0
  38. package/{chunk-r014f76h.js → chunk-etv7qsw7.js} +1 -1
  39. package/chunk-f2793pj6.js +85 -0
  40. package/{chunk-a5mxgvcz.js → chunk-fnv123mm.js} +1 -1
  41. package/{chunk-pjtg3wnm.js → chunk-fzevxpdz.js} +1 -1
  42. package/chunk-ghwy99py.js +68 -0
  43. package/chunk-gtt1qww8.js +2 -0
  44. package/chunk-hhkjqvww.js +1501 -0
  45. package/{chunk-fejhav0p.js → chunk-hrvqwp8z.js} +1 -1
  46. package/{chunk-6600wkmq.js → chunk-hxk0wkt3.js} +1 -1
  47. package/{chunk-f8jchnwe.js → chunk-jc95phff.js} +2 -2
  48. package/chunk-kwym0g80.js +11 -0
  49. package/chunk-kxcjme3n.js +6 -0
  50. package/{chunk-pasvz8xw.js → chunk-mkctjrrz.js} +2 -2
  51. package/{chunk-v6w8akph.js → chunk-mknhfnkn.js} +1 -1
  52. package/{chunk-yp39f93e.js → chunk-mseawt58.js} +89 -55
  53. package/{chunk-gv209d5j.js → chunk-nccfyeyy.js} +1 -1
  54. package/{chunk-tmjs6xas.js → chunk-npnxs0fy.js} +1 -1
  55. package/{chunk-x61f42fj.js → chunk-p9p2vbat.js} +2 -2
  56. package/chunk-pqc7dbhc.js +2 -0
  57. package/{chunk-tax7fxav.js → chunk-qc7c328q.js} +1 -1
  58. package/chunk-qe6pp4p6.js +72 -0
  59. package/{chunk-3jqbybmp.js → chunk-qwy0jba8.js} +1 -1
  60. package/{chunk-5tatkt2j.js → chunk-s26bgjqz.js} +1 -1
  61. package/{chunk-9kvbe53e.js → chunk-s8pqbr4n.js} +1 -1
  62. package/{chunk-p93x4pn2.js → chunk-tjy12q19.js} +1 -1
  63. package/{chunk-9b4akcfp.js → chunk-v1by80c5.js} +1 -1
  64. package/chunk-vdy4ave9.js +2 -0
  65. package/chunk-vwhee991.js +3 -0
  66. package/chunk-wf7r45wh.js +12 -0
  67. package/{chunk-bpb97rsk.js → chunk-x4jsr5et.js} +1 -1
  68. package/{chunk-z9kcdgj8.js → chunk-x9gk2n9v.js} +1 -1
  69. package/chunk-xxjevh62.js +2 -0
  70. package/{chunk-6wfvb07c.js → chunk-y2y1b3zm.js} +1 -1
  71. package/chunk-y6jq6y8t.js +2 -0
  72. package/cli.js +1 -1
  73. package/package.json +3 -3
  74. package/pkgs/helpers/src/icon-data.ts +868 -172
  75. package/pkgs/shadcn-snapshot/dist/manifest.json +348 -0
  76. package/pkgs/shadcn-snapshot/src/components/canvas-portal.tsx +3 -3
  77. package/plugins/claude/velloo/.claude-plugin/plugin.json +5 -2
  78. package/plugins/gemini/gemini-extension.json +7 -2
  79. package/canvas/assets/index-CkVteRZ9.css +0 -2
  80. package/canvas/assets/index-DFOlwAKW.js +0 -31
  81. package/canvas/assets/lucide-all-CezGNjGW.js +0 -1
  82. package/canvas/assets/radix-gmpYzWRH.js +0 -41
  83. package/canvas/assets/react-D0Ec-185.js +0 -9
  84. package/canvas/assets/rolldown-runtime-hePW80VL.js +0 -1
  85. package/canvas/assets/vendor-CKmQ-Zst.js +0 -53
  86. package/chunk-0ztxyzac.js +0 -2
  87. package/chunk-2x5rw009.js +0 -40
  88. package/chunk-640swnrm.js +0 -4
  89. package/chunk-80fjfyha.js +0 -86
  90. package/chunk-8a2agf28.js +0 -22
  91. package/chunk-as4rn21e.js +0 -2
  92. package/chunk-avewjans.js +0 -85
  93. package/chunk-cfksd3zh.js +0 -2
  94. package/chunk-cy1nmr0f.js +0 -12
  95. package/chunk-dqy6a75x.js +0 -2
  96. package/chunk-fzqt4rsz.js +0 -6
  97. package/chunk-g7pbfad5.js +0 -3
  98. package/chunk-j4rt31qb.js +0 -2
  99. package/chunk-kmsbcb3q.js +0 -3
  100. package/chunk-ktsdzzgx.js +0 -2
  101. package/chunk-kvxn1cyx.js +0 -8
  102. package/chunk-n70zfv0m.js +0 -1491
  103. package/chunk-n8pr0kc8.js +0 -2
  104. package/chunk-qewarcqf.js +0 -2
  105. package/chunk-qf1c6jxh.js +0 -3
  106. package/chunk-vbk1qhdz.js +0 -3
  107. package/chunk-w40pqmyz.js +0 -63
  108. package/chunk-x05grjd9.js +0 -2
  109. package/chunk-z3r8px3d.js +0 -6
  110. package/chunk-zexzy6zv.js +0 -2
  111. package/chunk-zjbbd87h.js +0 -2
@@ -0,0 +1,49 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lucide-all-B49qZ9YE.js","assets/rolldown-runtime-XKyaHtl9.js","assets/wand-sparkles-BxGgFkAt.js","assets/InitWizard-C1CkcS7C.js","assets/react-C1iE8mnY.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,n,r,t as i}from"./react-C1iE8mnY.js";import{C as a,D as o,E as s,S as c,T as l,_ as u,a as d,b as f,c as p,d as m,f as h,g,h as _,i as v,l as y,m as b,n as x,o as S,p as C,r as w,s as T,t as E,u as D,v as O,w as k,x as A,y as j}from"./vendor-DXkvBgGY.js";import{$ as M,A as ee,B as te,C as ne,Ct as N,D as re,E as ie,F as ae,G as oe,H as se,I as ce,J as le,K as ue,L as de,M as fe,N as pe,O as me,P as he,Q as ge,R as _e,S as ve,St as ye,T as be,U as xe,V as Se,W as Ce,X as we,Y as Te,Z as Ee,_ as De,_t as Oe,a as ke,at as Ae,b as je,bt as Me,c as Ne,ct as Pe,d as Fe,dt as Ie,et as Le,f as Re,ft as ze,g as Be,gt as Ve,h as He,ht as Ue,i as We,it as Ge,j as Ke,k as qe,l as Je,lt as Ye,m as Xe,mt as Ze,n as Qe,nt as $e,o as et,ot as tt,p as nt,pt as rt,q as it,r as at,rt as ot,s as st,st as ct,t as lt,tt as ut,u as dt,ut as ft,v as pt,vt as mt,w as ht,x as gt,xt as _t,y as vt,yt,z as bt}from"./radix-CuVEihKE.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var xt=e=>e?.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase();function St(e,t,n=[]){if(t==null)throw Error(`[lucide]: iconNode is required when icon name is used`);return{name:xt(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}var Ct=e=>{let t=``,n=!1;for(let r of e)r===`-`||r===`_`||r<=` `?n=t.length>0:(t.length===0?t+=r.toLowerCase():t+=n?r.toUpperCase():r,n=!1);return t},wt=e=>{let t=Ct(e);return t.charAt(0).toUpperCase()+t.slice(1)},Tt=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Et={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`};function Dt(e){return e!=null}function Ot(e,t={}){let n=t.attributeNames??{},r=e=>n[e]??e,i=e.size??e.width??Et.width,a=e.size??e.height??Et.height,o=e.aliases?.filter(e=>typeof e==`string`&&e.trim()!==``).map(e=>`lucide-${e}`)??[],s=[...e.name?[`lucide-${e.name}`]:[],...o],c=t.className?.split(` `).filter(Boolean)??[],l=t.includeDefaultClasses===!1?Tt(...c):Tt(`lucide`,...s,...c),u=t.absoluteStrokeWidth?Number(t.strokeWidth??Et[`stroke-width`])*Number(e.size??e.width??Et.width)/Number(t.size??t.width??Et.width):t.strokeWidth??Et[`stroke-width`];return[`svg`,{...Object.entries(Et).reduce((e,[t,n])=>(e[r(t)]=n,e),{}),...`color`in t&&t.color&&{[r(`stroke`)]:t.color},...`size`in t&&Dt(t.size)&&{[r(`width`)]:t.size,[r(`height`)]:t.size},...`width`in t&&Dt(t.width)&&{[r(`width`)]:t.width},...`height`in t&&Dt(t.height)&&{[r(`height`)]:t.height},[r(`stroke-width`)]:u,...l&&{[r(`class`)]:l},[r(`viewBox`)]:`0 0 ${i} ${a}`,...t.hasA11yProp===!1?{[r(`aria-hidden`)]:`true`}:{},...`attributes`in t&&t.attributes},e.node.map(e=>{let[n,i,a]=e,o=t.nonScalingStroke?{[r(`vector-effect`)]:`non-scaling-stroke`,...i}:i;return a?[n,o,a]:[n,o]})]}function kt(e,t={}){return Ot(e,{...t,attributeNames:{...t.attributeNames,class:`className`,"stroke-width":`strokeWidth`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`,"vector-effect":`vectorEffect`}})}var At=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},P=e(t(),1),jt=(0,P.createContext)({});function Mt({children:e,size:t,color:n,strokeWidth:r,absoluteStrokeWidth:i,nonScalingStroke:a,className:o}){let s=(0,P.useMemo)(()=>({size:t,color:n,strokeWidth:r,absoluteStrokeWidth:i,nonScalingStroke:a,className:o}),[t,n,r,i,a,o]);return(0,P.createElement)(jt.Provider,{value:s},e)}var Nt=()=>(0,P.useContext)(jt),Pt=(0,P.forwardRef)(({color:e,size:t,width:n,height:r,strokeWidth:i,absoluteStrokeWidth:a,nonScalingStroke:o,className:s=``,children:c,iconNode:l=[],icon:u={node:l,aliases:[],size:24},...d},f)=>{let{size:p=24,strokeWidth:m=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:_=`currentColor`,className:v=``}=Nt()??{},y=!!c||At(d),[b,x,S=[]]=kt(u,{color:e??_,width:n??t??p,height:r??t??p,strokeWidth:i??m,absoluteStrokeWidth:a??h,nonScalingStroke:o??g,className:Tt(v,s),hasA11yProp:y,attributes:d});return(0,P.createElement)(b,{ref:f,...x},[...S.map(([e,t])=>(0,P.createElement)(e,t)),...Array.isArray(c)?c:[c]])});function F(e,t=[],n=[]){let r=typeof e==`string`?St(e,t,n):e,i=(0,P.forwardRef)(({className:e,...t},n)=>(0,P.createElement)(Pt,{ref:n,icon:r,className:e,...t}));return r.name&&(i.displayName=wt(r.name)),i}var Ft={name:`archive-restore`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]};Ft.node;var It=F(Ft),Lt={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};Lt.node;var Rt=F(Lt),zt={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};zt.node;var Bt=F(zt),Vt={name:`arrow-left-right`,size:24,node:[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]};Vt.node;var Ht=F(Vt),Ut={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};Ut.node;var Wt=F(Ut),Gt={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Gt.node;var Kt=F(Gt),qt={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};qt.node;var Jt=F(qt),Yt={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};Yt.node;var Xt=F(Yt),Zt={name:`blend`,size:24,node:[[`circle`,{cx:`15`,cy:`9`,r:`7`,key:`1i12rt`}],[`circle`,{cx:`9`,cy:`15`,r:`7`,key:`19bs8k`}]]};Zt.node;var Qt=F(Zt),$t={name:`blocks`,size:24,node:[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]};$t.node;var en=F($t),tn={name:`bold`,size:24,node:[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]};tn.node;var nn=F(tn),rn={name:`bot`,size:24,node:[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]};rn.node;var an=F(rn),on={name:`boxes`,size:24,node:[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]};on.node;var sn=F(on),cn={name:`braces`,size:24,node:[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]],aliases:[`curly-braces`]};cn.node;var ln=F(cn),un={name:`brain`,size:24,node:[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4`,key:`5nuw1p`}],[`path`,{d:`M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294`,key:`18ldcf`}],[`path`,{d:`M17.996 5.125a4 4 0 012.526 5.77`,key:`1sdu8q`}],[`path`,{d:`M18 18a4 4 0 002-7.465`,key:`7xqqvr`}],[`path`,{d:`M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517`,key:`t46ysz`}],[`path`,{d:`M6 18a4 4 0 01-2-7.465`,key:`1y2m15`}],[`path`,{d:`M6.004 5.125a4 4 0 00-2.526 5.77`,key:`3cw1ss`}]]};un.node;var dn=F(un),fn={name:`bug`,size:24,node:[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]};fn.node;var pn=F(fn),mn={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};mn.node;var I=F(mn),hn={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};hn.node;var gn=F(hn),_n={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};_n.node;var vn=F(_n),yn={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};yn.node;var bn=F(yn),xn={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};xn.node;var Sn=F(xn),Cn={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};Cn.node;var wn=F(Cn),Tn={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};Tn.node;var En=F(Tn),Dn={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};Dn.node;var On=F(Dn),kn={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};kn.node;var An=F(kn),jn={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};jn.node;var Mn=F(jn),Nn={name:`cloud-upload`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]],aliases:[`upload-cloud`]};Nn.node;var Pn=F(Nn),Fn={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};Fn.node;var In=F(Fn),Ln={name:`coins`,size:24,node:[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]};Ln.node;var Rn=F(Ln),zn={name:`compass`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]};zn.node;var Bn=F(zn),Vn={name:`component`,size:24,node:[[`path`,{d:`M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z`,key:`1uwlt4`}],[`path`,{d:`M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z`,key:`10291m`}],[`path`,{d:`M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z`,key:`1tqoq1`}],[`path`,{d:`M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z`,key:`1x6lto`}]]};Vn.node;var Hn=F(Vn),Un={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};Un.node;var Wn=F(Un),Gn={name:`crosshair`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`22`,x2:`18`,y1:`12`,y2:`12`,key:`l9bcsi`}],[`line`,{x1:`6`,x2:`2`,y1:`12`,y2:`12`,key:`13hhkx`}],[`line`,{x1:`12`,x2:`12`,y1:`6`,y2:`2`,key:`10w3f3`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`18`,key:`15g9kq`}]]};Gn.node;var Kn=F(Gn),qn={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};qn.node;var Jn=F(qn),Yn={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Yn.node;var Xn=F(Yn),Zn={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};Zn.node;var Qn=F(Zn),$n={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};$n.node;var er=F($n),tr={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};tr.node;var nr=F(tr),rr={name:`file-pen-line`,size:24,node:[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`,key:`ukzhwg`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`,key:`1klhew`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`,key:`rxaxab`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]],aliases:[`file-signature`]};rr.node;var ir=F(rr),ar={name:`file-stack`,size:24,node:[[`path`,{d:`M11 21a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1`,key:`likhh7`}],[`path`,{d:`M16 16a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1`,key:`17ky3x`}],[`path`,{d:`M21 6a2 2 0 0 0-.586-1.414l-2-2A2 2 0 0 0 17 2h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1z`,key:`1hyeo0`}]]};ar.node;var or=F(ar),sr={name:`folder-input`,size:24,node:[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]};sr.node;var cr=F(sr),lr={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};lr.node;var ur=F(lr),dr={name:`frame`,size:24,node:[[`line`,{x1:`22`,x2:`2`,y1:`6`,y2:`6`,key:`15w7dq`}],[`line`,{x1:`22`,x2:`2`,y1:`18`,y2:`18`,key:`1ip48p`}],[`line`,{x1:`6`,x2:`6`,y1:`2`,y2:`22`,key:`a2lnyx`}],[`line`,{x1:`18`,x2:`18`,y1:`2`,y2:`22`,key:`8vb6jd`}]]};dr.node;var fr=F(dr),pr={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};pr.node;var mr=F(pr),hr={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};hr.node;var gr=F(hr),_r={name:`hand`,size:24,node:[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]};_r.node;var vr=F(_r),yr={name:`heading-1`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`m17 12 3-2v8`,key:`1hhhft`}]]};yr.node;var br=F(yr),xr={name:`heading-2`,size:24,node:[[`path`,{d:`M4 12h8`,key:`17cfdx`}],[`path`,{d:`M4 18V6`,key:`1rz3zl`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}],[`path`,{d:`M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1`,key:`9jr5yi`}]]};xr.node;var Sr=F(xr),Cr={name:`heading`,size:24,node:[[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M6 20V4`,key:`1w1bmo`}],[`path`,{d:`M18 20V4`,key:`o2hl4u`}]]};Cr.node;var wr=F(Cr),Tr={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};Tr.node;var Er=F(Tr),Dr={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};Dr.node;var Or=F(Dr),kr={name:`italic`,size:24,node:[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]};kr.node;var Ar=F(kr),jr={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};jr.node;var Mr=F(jr),Nr={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};Nr.node;var Pr=F(Nr),Fr={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};Fr.node;var Ir=F(Fr),Lr={name:`library-big`,size:24,node:[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]};Lr.node;var Rr=F(Lr),zr={name:`library`,size:24,node:[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]};zr.node;var Br=F(zr),Vr={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Vr.node;var Hr=F(Vr),Ur={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};Ur.node;var Wr=F(Ur),Gr={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};Gr.node;var Kr=F(Gr),qr={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};qr.node;var Jr=F(qr),Yr={name:`lock-open`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]],aliases:[`unlock`]};Yr.node;var Xr=F(Yr),Zr={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};Zr.node;var Qr=F(Zr),$r={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};$r.node;var ei=F($r),ti={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};ti.node;var ni=F(ti),ri={name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]};ri.node;var ii=F(ri),ai={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};ai.node;var oi=F(ai),si={name:`maximize-2`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]};si.node;var ci=F(si),li={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};li.node;var ui=F(li),di={name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]};di.node;var fi=F(di),pi={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};pi.node;var mi=F(pi),hi={name:`message-square`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]};hi.node;var gi=F(hi),_i={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};_i.node;var vi=F(_i),yi={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};yi.node;var bi=F(yi),xi={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};xi.node;var Si=F(xi),Ci={name:`mouse-pointer-2`,size:24,node:[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]};Ci.node;var wi=F(Ci),Ti={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};Ti.node;var Ei=F(Ti),Di={name:`move-vertical`,size:24,node:[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m8 18 4 4 4-4`,key:`bh5tu3`}],[`path`,{d:`m8 6 4-4 4 4`,key:`ybng9g`}]]};Di.node;var Oi=F(Di),ki={name:`navigation`,size:24,node:[[`polygon`,{points:`3 11 22 2 13 21 11 13 3 11`,key:`1ltx0t`}]]};ki.node;var Ai=F(ki),ji={name:`package`,size:24,node:[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]};ji.node;var Mi=F(ji),Ni={name:`palette`,size:24,node:[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]};Ni.node;var Pi=F(Ni),Fi={name:`panel-bottom`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]};Fi.node;var Ii=F(Fi),Li={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};Li.node;var Ri=F(Li),zi={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};zi.node;var Bi=F(zi),Vi={name:`panel-right-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]};Vi.node;var Hi=F(Vi),Ui={name:`panel-right-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]};Ui.node;var Wi=F(Ui),Gi={name:`panel-top`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Gi.node;var Ki=F(Gi),qi={name:`panels-top-left`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]],aliases:[`layout`]};qi.node;var Ji=F(qi),Yi={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};Yi.node;var Xi=F(Yi),Zi={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};Zi.node;var Qi=F(Zi),$i={name:`pen-tool`,size:24,node:[[`path`,{d:`m18 13-.654-4.736a4 4 0 00-2.756-3.266l-9.163-2.9a2 2 0 00-2.017.493l-.82.819a2 2 0 00-.492 2.017l2.9 9.163a4 4 0 003.266 2.756L13 18`,key:`93nyr4`}],[`path`,{d:`M18.648 12.352a1.205 1.205 0 011.704 0l1.296 1.296a1.205 1.205 0 010 1.704l-6.296 6.296a1.205 1.205 0 01-1.704 0l-1.296-1.296a1.205 1.205 0 010-1.704z`,key:`lnux7s`}],[`path`,{d:`m3 3 6.586 6.586`,key:`1igwcn`}],[`circle`,{cx:`11`,cy:`11`,r:`2`,key:`xmgehs`}]]};$i.node;var ea=F($i),ta={name:`pencil-ruler`,size:24,node:[[`path`,{d:`M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13`,key:`orapub`}],[`path`,{d:`m8 6 2-2`,key:`115y1s`}],[`path`,{d:`m18 16 2-2`,key:`ee94s4`}],[`path`,{d:`m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17`,key:`cfq27r`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};ta.node;var na=F(ta),ra={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};ra.node;var ia=F(ra),aa={name:`pilcrow`,size:24,node:[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]};aa.node;var oa=F(aa),sa={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};sa.node;var ca=F(sa),la={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};la.node;var ua=F(la),da={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};da.node;var fa=F(da),pa={name:`quote`,size:24,node:[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]};pa.node;var ma=F(pa),ha={name:`redo-2`,size:24,node:[[`path`,{d:`m15 14 5-5-5-5`,key:`12vg1m`}],[`path`,{d:`M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13`,key:`6uklza`}]]};ha.node;var ga=F(ha),_a={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};_a.node;var va=F(_a),ya={name:`reply`,size:24,node:[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]};ya.node;var ba=F(ya),xa={name:`rotate-ccw-clock`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]],aliases:[`history`]};xa.node;var Sa=F(xa),Ca={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Ca.node;var wa=F(Ca),Ta={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};Ta.node;var Ea=F(Ta),Da={name:`scan-search`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]};Da.node;var Oa=F(Da),ka={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};ka.node;var Aa=F(ka),ja={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};ja.node;var Ma=F(ja),Na={name:`send`,size:24,node:[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]};Na.node;var Pa=F(Na),Fa={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Fa.node;var Ia=F(Fa),La={name:`shapes`,size:24,node:[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]};La.node;var Ra=F(La),za={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};za.node;var Ba=F(za),Va={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};Va.node;var Ha=F(Va),Ua={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};Ua.node;var Wa=F(Ua),Ga={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};Ga.node;var Ka=F(Ga),qa={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};qa.node;var Ja=F(qa),Ya={name:`square-dashed`,size:24,node:[[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M21 19a2 2 0 0 1-2 2`,key:`1j7049`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h1`,key:`15o7lz`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M14 21h1`,key:`v9vybs`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v1`,key:`mxsmne`}],[`path`,{d:`M3 14v1`,key:`vnatye`}],[`path`,{d:`M21 14v1`,key:`169vum`}]],aliases:[`box-select`]};Ya.node;var Xa=F(Ya),Za={name:`square-mouse-pointer`,size:24,node:[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6`,key:`14rsvq`}]],aliases:[`inspect`]};Za.node;var Qa=F(Za),$a={name:`square-round-corner`,size:24,node:[[`path`,{d:`M21 11a8 8 0 0 0-8-8`,key:`1lxwo5`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1dv2y5`}]]};$a.node;var eo=F($a),to={name:`square-terminal`,size:24,node:[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]],aliases:[`terminal-square`]};to.node;var no=F(to),ro={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};ro.node;var io=F(ro),ao={name:`sticky-note`,size:24,node:[[`path`,{d:`M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z`,key:`1dfntj`}],[`path`,{d:`M15 3v5a1 1 0 0 0 1 1h5`,key:`6s6qgf`}]]};ao.node;var oo=F(ao),so={name:`sun-moon`,size:24,node:[[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14.837 16.385a6 6 0 1 1-7.223-7.222c.624-.147.97.66.715 1.248a4 4 0 0 0 5.26 5.259c.589-.255 1.396.09 1.248.715`,key:`xlf6rm`}],[`path`,{d:`M16 12a4 4 0 0 0-4-4`,key:`6vsxu`}],[`path`,{d:`m19 5-1.256 1.256`,key:`1yg6a6`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}]]};so.node;var co=F(so),lo={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};lo.node;var uo=F(lo),fo={name:`swatch-book`,size:24,node:[[`path`,{d:`M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z`,key:`1ldrpk`}],[`path`,{d:`M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7`,key:`11i5po`}],[`path`,{d:`M 7 17h.01`,key:`1euzgo`}],[`path`,{d:`m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8`,key:`o2gii7`}]]};fo.node;var po=F(fo),mo={name:`table`,size:24,node:[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]};mo.node;var ho=F(mo),go={name:`tablet`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]};go.node;var _o=F(go),vo={name:`text-cursor-input`,size:24,node:[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]};vo.node;var yo=F(vo),bo={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};bo.node;var L=F(bo),xo={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};xo.node;var So=F(xo),Co={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};Co.node;var wo=F(Co),To={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};To.node;var Eo=F(To),Do={name:`unlink`,size:24,node:[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]};Do.node;var Oo=F(Do),ko={name:`user-plus`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]};ko.node;var Ao=F(ko),jo={name:`user-round`,size:24,node:[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]],aliases:[`user-2`]};jo.node;var Mo=F(jo),No={name:`users`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]};No.node;var Po=F(No),Fo={name:`video`,size:24,node:[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]};Fo.node;var Io=F(Fo),Lo={name:`wifi-off`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Lo.node;var Ro=F(Lo),zo={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};zo.node;var Bo=F(zo),Vo={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Vo.node;var Ho=F(Vo),Uo=n(),Wo=!0;function Go(e){Wo=e}function Ko(){if(!Wo)throw Error(`Disconnected from the velloo daemon — edits are paused until it reconnects.`)}var qo=a().regex(/^[a-z][a-z0-9-]{0,39}$/),Jo=m([`allow-once`,`allow-session`,`allow-always`,`deny`,`abort`]),Yo=j({resume:b(),history:b(),rename:b(),interrupt:b(),followUp:m([`steer`,`queue`,`none`]),approvals:C(Jo),turnDiff:b(),delete:b()}),Xo=m([`ready`,`not-installed`,`incompatible`,`logged-out`,`error`]),Zo=j({id:qo,label:a(),status:Xo,version:a().optional(),minVersion:a().optional(),message:a().optional(),account:a().optional(),capabilities:Yo}),Qo=j({execution:m([`local`,`cloud`]),host:a(),cwd:a(),sandbox:a(),approvalMode:a(),model:a().optional(),providerVersion:a().optional()}),$o=m([`starting`,`idle`,`running`,`awaiting-approval`,`exited`,`failed`]),es=j({id:a(),provider:qo,title:a(),state:$o,stateMessage:a().optional(),providerSessionId:a().optional(),resumable:b(),environment:Qo.optional(),terminalCommand:C(a()).optional(),createdAt:a(),updatedAt:a()}),ts=m([`view`,`language`,`board`,`screen`,`frame`,`node`,`preview`,`note`,`comment`]),ns=j({boardId:a().optional(),screenId:a().optional(),frameId:a().optional(),path:a().optional(),noteId:a().optional(),threadId:a().optional(),messageId:a().optional(),theme:a().optional()}),rs=j({kind:ts,ref:ns,label:a(),detail:a().optional(),author:a().optional()}),is=m([`running`,`completed`,`failed`,`declined`]),as=_(`kind`,[j({kind:u(`user`),id:a(),text:a(),context:C(rs).optional(),attached:a().optional()}),j({kind:u(`agent-text`),id:a(),text:a(),phase:m([`commentary`,`final`]).optional()}),j({kind:u(`reasoning`),id:a(),text:a()}),j({kind:u(`command`),id:a(),command:a(),cwd:a().optional(),status:is,output:a(),outputDropped:O().int().nonnegative().optional(),exitCode:O().int().nullable().optional(),durationMs:O().nonnegative().optional()}),j({kind:u(`file-change`),id:a(),status:is,changes:C(j({path:a(),change:m([`add`,`delete`,`update`]),diff:a().optional(),diffTruncated:b().optional()}))}),j({kind:u(`tool`),id:a(),name:a(),server:a().optional(),status:is,input:a().optional(),output:a().optional()}),j({kind:u(`subagent`),id:a(),description:a(),status:is}),j({kind:u(`plan`),id:a(),steps:C(j({text:a(),status:m([`pending`,`in-progress`,`completed`])}))}),j({kind:u(`notice`),id:a(),level:m([`info`,`warning`,`error`]),text:a()})]),os=m([`running`,`completed`,`interrupted`,`failed`]),ss=j({id:a(),status:os,items:C(as),error:a().optional(),diff:a().optional(),startedAt:a(),completedAt:a().optional()}),cs=j({id:a(),question:a(),header:a().optional(),options:C(j({label:a(),description:a().optional()})),multiSelect:b().optional(),other:b().optional(),secret:b().optional()}),ls=j({id:a(),turnId:a().optional(),itemId:a().optional(),kind:m([`command`,`file-change`,`tool`,`permissions`,`question`]),title:a(),reason:a().optional(),command:a().optional(),cwd:a().optional(),tool:a().optional(),input:a().optional(),paths:C(a()).optional(),decisions:C(Jo).min(1),always:a().optional(),questions:C(cs).optional(),requestedAt:a()}),us=j({name:a().min(1),description:a().optional(),argumentHint:a().optional()}),ds=j({id:a().min(1),label:a(),description:a().optional()}),fs=j({id:a().min(1),label:a(),description:a().optional()}),ps=m([`reconnect`,`enable`,`disable`]),ms=j({commands:C(us),models:C(ds),model:a().optional(),modes:C(fs).optional(),mode:a().optional(),mcp:j({actions:C(ps)}).optional()});j({name:a(),status:m([`connected`,`starting`,`needs-auth`,`failed`,`disabled`,`unknown`]),detail:a().optional(),tools:O().int().nonnegative().optional(),velloo:b().optional()}),j({session:es,turns:C(ss),turnsDropped:O().int().nonnegative(),approvals:C(ls),queued:C(j({id:a(),text:a()})),controls:ms.optional()});var hs=`agent`,gs=_(`event`,[j({event:u(`providers`),providers:C(Zo)}),j({event:u(`session`),session:es}),j({event:u(`session-removed`),sessionId:a()}),j({event:u(`turn`),sessionId:a(),turn:ss.omit({items:!0})}),j({event:u(`item`),sessionId:a(),turnId:a(),item:as}),j({event:u(`delta`),sessionId:a(),turnId:a(),itemId:a(),field:m([`text`,`output`]),delta:a()}),j({event:u(`approval`),sessionId:a(),request:ls}),j({event:u(`approval-resolved`),sessionId:a(),approvalId:a(),decision:Jo.optional()}),j({event:u(`queue`),sessionId:a(),queued:C(j({id:a(),text:a()}))}),j({event:u(`controls`),sessionId:a(),controls:ms.nullable()})]);function _s(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.type!==`agent`||typeof t.v!=`number`)return null;let n=gs.safeParse(e);return n.success?{...n.data,type:hs,v:t.v}:null}c({text:a().max(1e5),context:C(rs).max(50).optional()}),c({provider:qo,resume:a().min(1).max(200).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/).optional()});var vs=A(a().max(2e3),C(a().max(1e4)).min(1).max(20));c({decision:Jo,answers:vs.optional()}),c({model:a().min(1).max(200)}),c({mode:a().min(1).max(100)}),c({server:a().min(1).max(200),action:ps}),c({title:a().trim().min(1).max(120)}),j({providerSessionId:a(),title:a(),updatedAt:a(),where:a().optional()});var ys=k([j({type:u(`screen-changed`),screenId:a().min(1)}),j({type:u(`board-changed`),boardId:a().min(1)}),j({type:u(`theme-changed`)}),j({type:u(`snippet-changed`),snippetId:a().min(1)}),j({type:u(`annotations-changed`),screenId:a().min(1)}),j({type:u(`notes-changed`),boardId:a().min(1)}),j({type:u(`comments-changed`),boardId:a().min(1),scope:m([`local`,`shared`])}),j({type:u(`comments-arrived`),boardId:a().min(1),threadIds:C(a()),messageIds:C(a())}),j({type:u(`config-changed`)}),j({type:u(`folder-reloaded`)}),j({type:u(`reload-error`),source:a(),message:a()}),j({type:u(`activity`)}).loose(),j({type:u(`agent`)}).loose()]);function bs(e){if(typeof e!=`string`)return null;let t;try{t=JSON.parse(e)}catch{return null}let n=ys.safeParse(t);return n.success?n.data:null}var xs=m([`public`,`private`]);j({appUrl:a().optional(),issuer:a().optional(),clientId:a().optional()}),j({ok:b().optional(),db:j({ok:b().optional()}).optional(),blob:j({ok:b().optional()}).optional()}),j({email:a(),name:a().optional(),tier:a().optional(),creditMicros:O().nullable().optional(),accountId:a().optional()});function Ss(e){return e!==`free`}function Cs(e){return e===void 0||e===`business`||e===`enterprise`}function ws(e){return Ss(e)}var Ts=j({slug:a(),url:a(),title:a(),teamId:a().nullable(),visibility:xs,passwordProtected:b(),latestVersionId:a().nullable(),lastPublishedAt:a().nullable(),context:j({boardIds:C(a()),selectionFingerprint:a().nullable(),contextKnown:b(),repo:a().nullable(),branch:a().nullable()})});j({effectiveTeamId:a().nullable(),slots:C(Ts)});var Es=j({type:m([`organization`,`team`,`account`]),id:a(),name:a().optional()});j({slug:a(),visibility:xs.optional(),passwordProtected:b().optional(),audience:C(Es).optional(),publicComments:b().optional()}),j({visibility:xs,passwordProtected:b(),audience:C(Es).optional(),publicComments:b().optional()}),j({files:O(),bytes:O(),url:a(),tier:a().optional(),history:j({retained:b(),versions:O(),pruned:O()}).optional()}),_(`type`,[j({type:u(`progress`),stage:m([`processing`,`storing`]),done:O(),total:O()}),j({type:u(`result`),status:O(),body:l()})]);var Ds=j({slug:a(),title:a().nullable(),url:a(),visibility:xs,passwordProtected:b(),canManage:b(),mine:b(),ownerEmail:a().nullable().optional(),ownerName:a().nullable().optional(),teamName:a().nullable().optional(),audience:C(Es).optional(),publicComments:b().optional(),guestCount:O().optional(),git:j({repo:a().optional(),branch:a().optional()}).nullable().optional(),published:b(),lastPublishedAt:a().nullable()});j({links:C(Ds).optional()});var Os=j({id:a(),name:a(),isDefault:b().optional(),role:a().optional(),canPublish:b().optional(),canManage:b().optional()});j({teams:C(Os)});var ks=j({id:a(),name:a().nullable(),email:a().optional(),createdAt:a(),lastSeenAt:a().nullable(),linkExpiresAt:a().nullable().optional()});j({guests:C(ks)}),j({guest:ks,delivery:j({sent:b(),reason:a().optional()}),guestUrl:a().optional()}),j({guestUrl:a()}),j({device_code:a(),user_code:a(),verification_uri:a(),verification_uri_complete:a(),expires_in:O(),interval:O()}),j({access_token:a().optional(),error:a().optional(),error_description:a().optional()}),j({token:a(),email:a()});var As=j({intent:a(),summary:a(),priceMicros:O(),output:m([`image`,`svg`]),aspects:C(a()),defaultAspect:a(),reference:m([`forbidden`,`optional`,`required`])});j({intents:C(As),maxCount:O().optional()});var js=j({kind:m([`image`,`svg`]),dataUrl:a()});j({id:a(),intent:a().optional(),chargedMicros:O(),balanceMicros:O(),assets:C(js).min(1).optional(),kind:m([`image`,`svg`]).optional(),dataUrl:a().optional()}).transform((e,t)=>{let n=e.assets??(e.dataUrl&&e.kind?[{kind:e.kind,dataUrl:e.dataUrl}]:null);return n?{id:e.id,intent:e.intent??``,assets:n,chargedMicros:e.chargedMicros,balanceMicros:e.balanceMicros}:(t.addIssue({code:`custom`,message:`no assets in the generation reply`}),o)}),j({scheme:a(),publicKey:a()}),j({signatures:C(a())});var Ms={Unreachable:!0,HttpFailure:!0,LoggedOut:!0,ProtocolViolation:!0,UploadRaceLost:!0,InsecureCloudUrl:!0,InvalidRequest:!0};function Ns(e){return typeof e==`string`&&e in Ms}var Ps=a().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,`ids are [A-Za-z0-9][A-Za-z0-9_-]{0,63}`),Fs=k([C(O().int().nonnegative()),a().regex(/^@[a-zA-Z][a-zA-Z0-9_-]*$/)]),Is=j({locator:Fs}),Ls=k([j({x:O(),y:O()}),u(`auto`)]);j({id:Ps,target:Is,position:Ls.default(`auto`),body:a(),collapsed:b().optional(),author:m([`user`,`agent`]),cloud:j({commentId:a().min(1),slug:a().min(1),author:a().optional()}).optional()});var Rs=j({frameId:Ps,screenId:Ps,locator:Fs});j({id:Ps,x:O().optional(),y:O().optional(),width:O().positive(),height:O().positive().optional(),body:a(),attachment:Rs.optional()}).refine(e=>e.attachment!==void 0||e.x!==void 0&&e.y!==void 0,{message:`A note without an attachment needs x and y`,path:[`x`]});var zs=j({prompt:a(),intent:a(),aspect:a().optional(),width:O().int().positive().optional(),height:O().int().positive().optional(),generatedAt:a(),reference:C(a()).optional(),replaces:a().optional()});j({version:u(1),generated:A(a(),zs)});function Bs(e){if(typeof e!=`string`||e.length===0)return null;let t=e.replace(/^\.?\//,``);if(!t.startsWith(`assets/`))return null;let n=t.split(/[?#]/)[0]??``;return n.length>7?n:null}var Vs=j({from:a().min(1),to:a().min(1),label:a().min(1).optional(),state:a().min(1).optional(),labelAt:O().min(0).max(1).optional()}),Hs=[`loading`,`empty`,`error`,`success`];function Us(e){if(!e.edges||e.edges.length===0)return[];let t=new Set(e.frames.map(e=>e.id));return e.edges.filter(e=>e.from!==e.to&&t.has(e.from)&&t.has(e.to))}var Ws=m([`light`,`dark`]),Gs=j({id:Ps,screen:a().min(1),x:O(),y:O(),w:O().int().positive(),h:O().int().positive(),label:a().optional(),group:a().optional(),scheme:Ws.optional(),fit:u(`content`).optional()});function Ks(e,t){return e.scheme??t}var qs=j({id:Ps,name:a().min(1),color:a().optional()});j({id:Ps,name:a().min(1),theme:a().min(1).optional(),archivedAt:a().datetime().optional(),group:a().min(1).optional(),frames:C(Gs).default([]),groups:C(qs).default([]),edges:C(Vs).optional()});var Js=k([C(O().int().nonnegative()),a().regex(/^@[a-zA-Z][a-zA-Z0-9_-]*$/)]),Ys=j({x:O(),y:O(),w:O().nonnegative(),h:O().nonnegative()}),Xs=j({ref:a().min(1).optional(),text:a().max(500).optional(),ancestorIds:C(a().min(1)).max(16).optional()}),Zs=_(`kind`,[j({kind:u(`node`),boardId:Ps,frameId:Ps,screenId:Ps,locator:Js,bounds:Ys,fingerprint:Xs.optional()}),j({kind:u(`board`),boardId:Ps,x:O(),y:O()})]),Qs=m([`owner`,`admin`,`member`,`reviewer`,`guest`]),$s=j({kind:m([`user`,`agent`,`reviewer`]),displayName:a().min(1).max(200).optional(),accountId:a().min(1).max(200).optional(),role:Qs.optional(),publisher:b().optional()}),ec=j({id:s(),author:$s,body:a().trim().max(4e3),createdAt:D(),deletedAt:D().optional()}).refine(e=>e.deletedAt!==void 0||e.body.length>0,{message:`A comment needs something to say`,path:[`body`]}),tc=_(`kind`,[j({kind:u(`local`)}),j({kind:u(`published`),slug:a().min(1),versionId:a().min(1)})]);j({id:s(),scope:m([`local`,`shared`]),folderId:a().min(1),boardId:Ps,anchor:Zs.optional(),origin:tc,status:m([`open`,`resolved`]),messages:C(ec).min(1),createdAt:D(),updatedAt:D(),resolvedAt:D().optional()});var nc=m([`boolean`,`number`,`string`,`color`,`enum`,`icon`]),rc=j({name:a().min(1),type:a().min(1),optional:b(),defaultValue:a().optional(),control:nc,enumValues:C(k([a(),O()])).optional()}).superRefine((e,t)=>{e.control!==`enum`||e.enumValues&&e.enumValues.length!==0||t.addIssue({code:`custom`,path:[`enumValues`],message:`prop "${e.name}": control "enum" requires a non-empty \`enumValues\` array`})}),ic=j({importPath:a().min(1),category:m([`ui`,`typography`]).optional(),description:a().optional(),props:C(rc),origin:m([`agent`,`manual`]).optional(),render:m([`static`,`live`]).optional(),app:a().min(1).optional(),fit:m([`aspect-video`,`content`]).optional()}),ac=j({description:a().optional(),exclude:b().optional(),proxy:a().min(1).optional(),props:C(rc).optional(),states:A(a().min(1),A(a(),l())).optional()});j({components:A(a().min(1),ac)});var oc=j({enabled:b(),contactOk:b().optional()}),sc=80;function cc(e){return e.trim()===``?`a design name can't be empty`:e===e.trim()?e===`.`||e===`..`?`"${e}" can't be a design name`:/[/\\]/.test(e)?`a design name can't contain / or \\`:/\p{Cc}/u.test(e)?`a design name can't contain control characters`:[...e].length>sc?`a design name can't be longer than ${sc} characters`:null:`a design name can't start or end with spaces`}var lc=a().superRefine((e,t)=>{let n=cc(e);n&&t.addIssue({code:`custom`,message:n})});j({$schema:a().optional(),designs:C(a().min(1)),defaultDesign:lc.optional(),feedback:oc.optional()}).refine(e=>new Set(e.designs).size===e.designs.length,{message:`designs lists the same path twice`});var uc=j({name:a().min(1),w:O().int().positive(),h:O().int().positive()}),dc=j({id:m([`shadcn-upstream`,`none`,`html`,`mui`,`antd`,`chakra`]),version:a().min(1),source:m([`binary`,`cache`,`in-repo`]),componentsPath:a().min(1)}),fc=j({componentsAlias:a().min(1).optional(),componentsDir:a().min(1).optional()}),pc=a().min(1).refine(e=>!/^(?:[\\/~]|[A-Za-z]:)/.test(e)&&!e.split(/[\\/]/).includes(`..`),{message:"must be relative to the app root, with no absolute path or `..` segment"}),mc=j({root:a().min(1),aliases:A(a().min(1),a().min(1)).optional(),preview:a().min(1).optional(),stylesheets:C(a().regex(/^(?:\/(?!\/)|https:\/\/)/)).optional(),components:j({include:C(a().min(1)).optional(),exclude:C(a().min(1)).optional()}).optional()}),hc=j({kind:m([`stylesheet`,`design-md`,`mantine`,`mui`,`library-defaults`,`preset`]),files:C(pc).min(1).optional(),library:a().min(1).optional()}),gc=j({framework:m([`tailwind`,`none`])});j({schemaVersion:u(4),toolVersion:a().min(1),name:lc,folderId:a().regex(/^[A-Za-z0-9_-]{8,64}$/).optional(),libraries:A(a().min(1),dc),defaultLibrary:a().min(1),extensions:A(a().min(1),ic).optional(),viewportPresets:C(uc).min(1),defaultScreen:a().min(1).optional(),defaultBoard:a().min(1).optional(),boardOrder:C(a().min(1)).optional(),boardGroups:C(qs).optional(),codegen:fc.optional(),styling:gc.optional(),hostApp:mc.optional(),designSystem:j({path:pc}).optional(),themeSource:hc.optional(),hostApps:A(a().min(1),mc).optional(),feedback:oc.optional()}).refine(e=>e.defaultLibrary in e.libraries,{message:"`defaultLibrary` must name an entry in `libraries`."});var _c=/^[A-Za-z0-9_-]+$/;function vc(e){return _c.test(e)}function yc(e){return e.replace(/\*\//g,``).replace(/[<>{};\\]/g,``).replace(/[\r\n]+/g,` `).trim()}function bc(e){let t=e.trim();return t===``?t:/[-_\s]/.test(t)?t.split(/[-_\s]+/).filter(e=>e!==``).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``):t.charAt(0).toUpperCase()+t.slice(1)}function xc(e){return typeof e?.$ref==`string`}function Sc(e){return typeof e?.$snippet==`string`}function Cc(e){return typeof e?.$param==`string`}function wc(e){return typeof e?.$text==`string`}function Tc(e){let t=e?.$type;return!Array.isArray(e)&&typeof t==`object`&&!!t&&typeof t.$ref==`string`}var Ec=a().min(1).max(64).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/,{message:`node id must match /^[a-zA-Z][a-zA-Z0-9_-]*$/`});function Dc(e){return e.flatMap(e=>{if(typeof e!=`string`&&typeof e!=`number`)return[e];let t=String(e);return t===``?[]:[{$text:t}]})}var Oc=j({name:a().min(1),importPath:a().min(1)});function kc(e){return/^[\w@./~-]+$/.test(e)?e.startsWith(`/`)?`must not be an absolute path`:e.split(`/`).includes(`..`)?`must not climb out of the host app with ..`:null:`has characters an import specifier can't carry`}var Ac=j({importPath:a().min(1).superRefine((e,t)=>{let n=kc(e);n&&t.addIssue({code:`custom`,message:`importPath ${n}`})}),exportName:a().regex(/^[A-Za-z_$][\w$]*$/,{message:`exportName must be an identifier or "default"`}),member:a().regex(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/,{message:`member must be a dotted identifier path like "List"`}).optional(),app:a().min(1).optional(),proxy:a().min(1).optional()}),jc=c({$type:c({$ref:a().regex(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/,{message:`a component type's $ref must be a component name like "ScrollArea"`}),$repo:Ac.optional()})});function Mc(e,t,n){if(Array.isArray(e))e.forEach((e,r)=>{Mc(e,t,[...n,r])});else if(typeof e==`object`&&e){if(Object.hasOwn(e,`$type`)){let r=jc.safeParse(e);if(!r.success)for(let e of r.error.issues)t.addIssue({code:`custom`,message:e.message,path:[...n,...e.path]})}else for(let[r,i]of Object.entries(e))Mc(i,t,[...n,r])}}var Nc=A(a(),l()).superRefine((e,t)=>{Mc(e,t,[])}),Pc=g(()=>j({$ref:a().min(1),$id:Ec.optional(),props:Nc.optional(),children:C(k([a(),O(),Bc])).transform(Dc).optional(),$emitAs:Oc.optional(),$repo:Ac.optional()}));function Fc(e){return xc(e)&&e.$repo!==void 0}function Ic(e){let t=e.member?`.${e.member}`:``;return`repo:${encodeURIComponent(e.app??``)}:${e.importPath}#${e.exportName}${t}`}var Lc=j({$snippet:a().min(1),$id:Ec.optional(),$extraClassName:a().optional(),args:Nc.optional(),$overrides:A(a().regex(/^$|^\d+(\.\d+)*$|^@[a-zA-Z][a-zA-Z0-9_-]*$/,{message:`override key must be a dotted index path like "0.2", an "@id" reference with a literal leading @ (e.g. "@row-active" to target the body node whose $id is "row-active"), or "" for the body root`}),j({props:Nc})).optional()}),Rc=j({$param:a().min(1)}),zc=c({$text:a().min(1)}),Bc=l().transform((e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))return t.addIssue({code:`custom`,message:`node must be an object with one of "$ref" (component), "$snippet" (instance), "$param" (param ref), or "$text" (text beside elements)`}),o;let n=e,r=typeof n.$ref==`string`?Pc:typeof n.$snippet==`string`?Lc:typeof n.$param==`string`?Rc:typeof n.$text==`string`?zc:null;if(!r)return t.addIssue({code:`custom`,message:Tc(n)?`a component type ({"$type": …}) is a prop value, not a node — to render one here, write {"$ref": ${JSON.stringify(n.$type.$ref)}}`:`node needs exactly one of "$ref" (component), "$snippet" (snippet instance), "$param" (param ref, snippet bodies only), or "$text" (text beside elements)`}),o;let i=r.safeParse(e);if(!i.success){for(let e of i.error.issues)t.addIssue({...e});return o}return i.data}).describe(`{"$ref":"Button","$id?":"cta","props?":{...},"children?":[Node]}, or {"$snippet":"<id>","args?":{...}}. Guide: velloo://guide/components`).meta({type:`object`,additionalProperties:!0});function Vc(e){if(!(Cc(e)||wc(e)))return e.$id}var Hc=[`velloo:param-tag`,`velloo:static`];function Uc(e){return Hc.includes(e)}function Wc(e){if(typeof e!=`object`||!e||Array.isArray(e))return{kind:`invalid`,value:e};let t=e;return Sc(t)?{kind:`snippet`,node:t}:Cc(t)?{kind:`param`,node:t}:xc(t)?t.$repo===void 0?t.$emitAs===void 0?Uc(t.$ref)?{kind:`synthetic`,node:t,ref:t.$ref}:{kind:`named`,node:t,ref:t.$ref}:{kind:`emit-as`,node:t,ref:t.$ref,emitAs:t.$emitAs}:{kind:`repo`,node:t,ref:t.$ref,repo:t.$repo}:wc(t)?{kind:`text`,node:t,text:t.$text}:{kind:`invalid`,value:e}}function Gc(e){return Wc(e).kind!==`invalid`}j({id:Ps,name:a().min(1),library:a().min(1).optional(),route:a().min(1).optional(),tree:Bc});var Kc=j({name:a().min(1),type:m([`string`,`number`,`boolean`,`node`,`icon`,`color`,`enum`]),default:l().optional(),optional:b().optional(),enum:C(a()).optional(),min:O().optional(),max:O().optional(),step:O().optional(),description:a().optional()}).superRefine((e,t)=>{if(e.type===`enum`){if(!e.enum||e.enum.length===0){t.addIssue({code:`custom`,path:[`enum`],message:`param "${e.name}": type "enum" requires a non-empty \`enum\` array`});return}e.default!==void 0&&!e.enum.includes(e.default)&&t.addIssue({code:`custom`,path:[`default`],message:`param "${e.name}": default ${JSON.stringify(e.default)} is not one of the declared enum values`});return}if(e.default===void 0||e.type===`node`)return;let n=e.type===`number`?`number`:e.type===`boolean`?`boolean`:`string`;typeof e.default!==n&&t.addIssue({code:`custom`,path:[`default`],message:`param "${e.name}": default ${JSON.stringify(e.default)} does not match declared type "${e.type}"`})});j({id:Ps,name:a().min(1),params:C(Kc),library:a().min(1).optional(),tree:Bc});function qc(e){let t=new Set,n=new Set,r=(e,t)=>{if(typeof e!=`object`||!e)return;if(Array.isArray(e)){for(let n of e)r(n,t);return}let n=e;typeof n.$param==`string`&&t.add(n.$param);for(let e of Object.values(n))r(e,t)},i=e=>{if(Array.isArray(e)){for(let t of e)i(t);return}if(typeof e!=`object`||!e)return;let n=e;typeof n.$param==`string`?t.add(n.$param):typeof n.$if==`string`?(i(n.then),i(n.else)):a(n)},a=e=>{r(e.props,n),r(e.args,n),i(e.children)};i(e.tree);for(let e of n)t.delete(e);return t}var Jc=new Map(`a.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.g.image.line.linearGradient.marker.mask.path.pattern.polygon.polyline.radialGradient.rect.stop.style.svg.switch.symbol.text.textPath.title.tspan.use.view`.split(`.`).map(e=>[e.toLowerCase(),e]));new Set(Jc.values());var Yc=k([O(),a().min(1)]),Xc=g(()=>A(a(),k([a(),O(),Xc]))),Zc=k([a().min(1),j({DEFAULT:a().min(1),foreground:a().min(1).optional()})]),Qc=j({background:a().min(1),foreground:a().min(1),primary:Zc,secondary:Zc.optional(),muted:Zc.optional(),accent:Zc.optional(),destructive:Zc.optional(),card:Zc.optional(),popover:Zc.optional(),border:a().min(1).optional(),input:a().min(1).optional(),ring:a().min(1).optional()});function $c(e,t=!1){if(!t||!e.colorsDark)return e.colors;let n={...e.colors};for(let[t,r]of Object.entries(e.colorsDark))r!==void 0&&(n[t]=r);return n}var el=A(a().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,`palette keys are lowercase kebab-case, letter first — "primary-soft", "success-500", "border-primary-300"`),a().min(1));function tl(e){return[...new Set([...Object.keys(e.palette??{}),...Object.keys(e.paletteDark??{})])].filter(e=>!/(?:^|-)\d+$/.test(e)).sort()}var nl=j({size:Yc.optional(),leading:O().positive().optional(),flow:Yc.optional(),fontBody:a().min(1).optional(),fontHeading:a().min(1).optional(),fontMono:a().min(1).optional()}),rl=j({fontFamily:A(a(),a().min(1)).optional(),googleFonts:C(a().min(1)).optional(),typesets:A(a().regex(/^[A-Za-z0-9_-]+$/),nl).optional()}).strict(),il=j({none:Yc.optional(),sm:Yc.optional(),md:Yc.optional(),lg:Yc.optional(),xl:Yc.optional(),"2xl":Yc.optional(),"3xl":Yc.optional(),full:Yc.optional()}).partial(),al=j({center:b().optional(),padding:a().min(1).optional(),maxWidth:a().min(1).optional()});j({name:a().min(1),colors:Qc,colorsDark:Qc.partial().optional(),palette:el.optional(),paletteDark:el.optional(),typography:rl,spacing:Xc,radius:il,shadows:Xc.optional(),container:al.optional(),keyframes:A(a(),A(a(),A(a(),a()))).optional(),animation:A(a(),a()).optional()});var ol=48,sl=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]*[A-Za-z0-9])?$/;function cl(e){return e.trim().replace(/\s+/g,` `)}function ll(e,t=[]){if(e===``)return`Give the theme a name.`;if(e.length>ol)return`Keep the name to ${ol} characters.`;if(!sl.test(e))return`Use letters, digits, spaces, dashes and underscores, starting and ending with a letter or digit.`;let n=e.toLowerCase();if(n==="default")return`Every design already has a "Default" theme.`;for(let e of t)if(e.toLowerCase()===n)return`A theme named "${e}" already exists.`;return null}var ul={size:`1em`,leading:1.75,flow:`1.25em`},dl=`default`;function fl(e){return vc(e)}var pl={h1:{size:2.5,leading:.63,tracking:`-0.025em`,weight:700,face:`heading`},h2:{size:2,leading:.66,tracking:`-0.025em`,weight:700,face:`heading`},h3:{size:1.5,leading:.71,tracking:`-0.02em`,weight:600,face:`heading`},h4:{size:1.25,leading:.74,tracking:`-0.02em`,weight:600,face:`heading`},h5:{size:1.125,leading:.8,tracking:`-0.015em`,weight:600,face:`heading`},h6:{size:1,leading:.8,tracking:`-0.01em`,weight:600,face:`heading`},body:{size:1,leading:1,tracking:`0em`,weight:400,face:`body`},lead:{size:1.25,leading:.91,tracking:`0em`,weight:400,face:`body`},small:{size:.875,leading:.57,tracking:`0em`,weight:500,face:`body`},caption:{size:.875,leading:.86,tracking:`0em`,weight:400,face:`body`}},ml=Object.keys(pl),hl={1:`h1`,2:`h2`,3:`h3`,4:`h4`,5:`h5`,6:`h6`},gl={default:`body`,muted:`caption`,small:`small`,lead:`lead`},_l={400:`font-normal`,500:`font-medium`,600:`font-semibold`,700:`font-bold`};Object.fromEntries(ml.map(e=>[e,`text-${e} leading-${e} tracking-${e} ${_l[pl[e].weight]}`])),Object.fromEntries(ml.map(e=>[e,{fontSize:`var(--text-${e})`,lineHeight:`var(--leading-${e})`,letterSpacing:`var(--tracking-${e})`,fontWeight:pl[e].weight}]));function vl(e){let t=Number(e??1);return Number.isFinite(t)&&t>=1&&t<=6?Math.trunc(t):1}function yl(e){return Math.round(e*1e3)/1e3}function bl(e){return typeof e==`number`?`${e}px`:yc(e)}function xl(e,t){return!e||!vc(e)?t:`var(--font-${e})`}function Sl(e){return{...e,size:e?.size??ul.size,leading:e?.leading??ul.leading,flow:e?.flow??ul.flow}}function Cl(e,t=` `,n=!1){let r=n?e??{}:Sl(e),i=[],a=(e,n)=>i.push(`${t}--typeset-${e}: ${n};`);return r.size!==void 0&&a(`size`,bl(r.size)),r.leading!==void 0&&a(`leading`,String(yl(r.leading))),r.flow!==void 0&&a(`flow`,bl(r.flow)),n&&r.fontBody===void 0||a(`font-body`,xl(r.fontBody,`inherit`)),n&&r.fontHeading===void 0||a(`font-heading`,xl(r.fontHeading,`var(--typeset-font-body)`)),n&&r.fontMono===void 0||a(`font-mono`,xl(r.fontMono,`var(--font-mono, ui-monospace, monospace)`)),i}var wl=16;function Tl(e,t=wl){if(typeof e==`number`)return e;let n=/^(-?[\d.]+)\s*(px|rem|em|%)?$/.exec(e.trim());if(!n)return t;let r=Number.parseFloat(n[1]);if(!Number.isFinite(r))return t;switch(n[2]){case`px`:case void 0:return r;case`%`:return r/100*t;default:return r*t}}function El(e,t={}){let n=Sl(e),r=t.rootPx??wl,i=Tl(n.size,r),a=t.fontFamily??{},o=n.fontHeading?a[n.fontHeading]:void 0,s=n.fontBody?a[n.fontBody]:void 0,c={};for(let e of ml){let t=pl[e],r=t.face===`heading`?o??s:s;c[e]={fontSize:yl(i*t.size),lineHeight:yl(n.leading*t.leading),letterSpacing:t.tracking,fontWeight:t.weight,...r?{fontFamily:r}:{}}}return c}j({w:O().int().positive(),h:O().int().positive()});var Dl=C(O()),Ol=a().regex(/^@[a-zA-Z][a-zA-Z0-9_-]*$/,{message:`id locator must match /^@[a-zA-Z][a-zA-Z0-9_-]*$/`}),kl=e=>f(e=>{if(typeof e==`string`){let t=e.trim();if(t.startsWith(`[`)||t.startsWith(`{`))try{return JSON.parse(t)}catch{}}return e},e),Al=e=>f(e=>typeof e==`object`&&e&&!Array.isArray(e)?[e]:e,e),jl=kl(f(e=>typeof e==`string`&&/^\d+(\.\d+)*$/.test(e)?e.split(`.`).map(Number):e,k([Dl,Ol]))).describe(`Node address: an "@id" like "@hero-cta", or an index path from the root ([0,2,1])`),Ml=jl.default([]),Nl=a().describe(`Body node: "@id" (preferred — survives restructures), a dotted index path ("0.2"), or "" for the root`),Pl=A(a(),l()),Fl=a().min(1),Il=a().min(1),Ll=a().min(1),Rl=a().min(1),zl=c({x:O().optional(),y:O().optional(),w:O().int().positive().optional(),h:O().int().positive().optional(),label:a().nullable().optional(),group:a().nullable().optional(),scheme:Ws.nullable().optional(),fit:u(`content`).nullable().optional()}),Bl=j({name:a().min(1),importPath:a().min(1)}).describe(`Mark the node a host-component facade: the canvas renders the subtree, emit_code emits <name /> from importPath instead.`),Vl=k([j({x:O(),y:O()}),u(`auto`)]),Hl={screenId:Fl,parentPath:Ml,componentRef:a().min(1),id:Ec.optional(),props:Pl.optional(),children:kl(k([C(Bc),a(),O()])).optional(),index:O().int().nonnegative().optional(),emitAs:Bl.optional(),repo:Ac.optional().describe(`Place an app component by identity (importPath + exportName [+ member]) when it isn't in list_components' repo catalog yet`)};c(Hl);var Ul=kl(k([a(),Pl,h()])).describe(`Native style channel: a className string (Tailwind), an object of properties (sx / style), or null to clear`),Wl=j({path:jl,propPatch:Pl.optional(),style:Ul.optional()}).refine(e=>e.propPatch!==void 0||e.style!==void 0,{message:`each patch needs propPatch, style, or both`}),Gl=a().max(64).optional().describe(`Opaque id of the drag this write belongs to; merges its undo steps into one`),Kl={screenId:Fl,patches:kl(Al(C(Wl).min(1))).describe(`One entry per node; length 1 for a single edit`),gesture:Gl};c(Kl);var ql={screenId:Fl,path:Ml,classes:a(),gesture:Gl};c(ql),c({screenId:Fl,path:jl});var Jl={screenId:Fl,fromPath:jl,toParent:jl,toIndex:O().int().nonnegative().optional()};c(Jl);var Yl={screenId:Fl,path:jl,id:Ec.nullable()};c(Yl);var Xl=a().trim().min(1).transform(e=>e.startsWith(`/`)?e:`/${e}`),Zl={name:a().min(1),id:a().min(1).optional(),fromScreenId:a().min(1).optional(),tree:Bc.optional(),route:Xl.optional()};c(Zl),c({screenId:Fl}),c({screenId:Fl,tree:Bc});var Ql={screenId:Fl,patch:j({name:a().min(1).optional(),route:Xl.nullable().optional()})};c(Ql);var $l={name:a().min(1).max(80),id:a().min(1).optional(),group:a().min(1).optional()};c($l);var eu={boardId:Il,patch:j({name:a().min(1).max(80).optional(),theme:a().min(1).nullable().optional(),archived:b().optional(),group:a().min(1).nullable().optional()})};c(eu),c({boardId:Il});var tu={order:C(a().min(1))};c(tu);var nu={name:a().min(1),color:a().min(1).optional()};c(nu);var ru={groupId:a().min(1),patch:j({name:a().min(1).optional(),color:a().min(1).nullable().optional()})};c(ru);var iu={groupId:a().min(1)};c(iu);var au={order:C(a().min(1))};c(au);var ou={boardId:Il,screenId:Fl,x:O().optional(),y:O().optional(),w:O().int().positive(),h:O().int().positive(),label:a().optional(),group:a().optional(),id:a().min(1).optional()};c(ou);var su=f(e=>{if(typeof e!=`object`||!e||Array.isArray(e)||`patch`in e)return e;let{frameId:t,...n}=e;return Object.keys(n).length>0?{frameId:t,patch:n}:e},j({frameId:Ll,patch:zl})),cu={boardId:Il,patches:kl(Al(C(su).min(1))).describe(`One entry per frame; length 1 for a single edit`)};c(cu),c({boardId:Il,frameId:Ll});var lu={boardId:Il,frameId:Ll,toBoardId:Il,x:O().optional(),y:O().optional()};c(lu);var uu={from:a(),to:a(),label:a().nullable().optional(),state:a().nullable().optional(),remove:b().optional()},du=c(uu);kl(Al(C(du).min(1))),c({boardId:Il,edges:kl(Al(C(c({...uu,labelAt:O().min(0).max(1).nullable().optional()})).min(1)))});var fu={name:a().min(1),id:a().min(1).optional(),params:C(Kc).default([]),tree:Bc};c(fu);var pu={snippetId:Rl,patch:j({name:a().min(1).optional(),params:C(Kc).optional(),tree:Bc.optional(),innerPatch:j({innerPath:Nl,propPatch:Pl}).optional()})};c(pu),c({snippetId:Rl});var mu={screenId:Fl,parentPath:Ml,snippetId:Rl,id:Ec.optional(),args:Pl.optional(),extraClassName:a().optional().describe(`One-off classes layered onto the snippet body's root, for this instance`),overrides:A(a(),j({props:Pl})).optional(),index:O().int().nonnegative().optional()};c(mu),c({screenId:Fl,path:jl,innerPath:Nl,propPatch:Pl});var hu={screenId:Fl,path:jl,argPatch:Pl.default({}),extraClassName:a().nullable().optional(),gesture:Gl};c(hu);var gu={screenId:Fl,path:jl,argPatch:Pl.optional(),extraClassName:a().nullable().optional(),innerPath:Nl.optional(),propPatch:Pl.optional()};c(gu);var _u={screenId:Fl,target:j({locator:jl}),body:a(),position:Vl.optional(),collapsed:b().optional()};c(_u);var vu={screenId:Fl,annotationId:a().min(1),patch:j({body:a().optional(),position:Vl.optional(),collapsed:b().nullable().optional()})};c(vu);var yu={screenId:Fl,annotationId:a().min(1)};c(yu);var bu=j({frameId:Ll,screenId:Fl,locator:jl}),xu={boardId:Il,x:O().optional(),y:O().optional(),width:O().positive().optional(),height:O().positive().optional(),body:a(),attachment:bu.optional()};j(xu).refine(e=>e.attachment!==void 0||e.x!==void 0&&e.y!==void 0,{message:`A note without an attachment needs x and y`,path:[`x`]});var Su={boardId:Il,noteId:a().min(1),patch:j({x:O().optional(),y:O().optional(),width:O().positive().optional(),height:O().positive().optional(),body:a().optional()})};c(Su);var Cu={boardId:Il,noteId:a().min(1)};c(Cu);var wu={presets:C(j({name:a().min(1),w:O().int().positive(),h:O().int().positive()}))};c(wu);var Tu={defaultBoard:a().min(1).nullable().optional(),defaultScreen:a().min(1).nullable().optional()};c(Tu);var Eu={componentsAlias:a().nullable().optional()};c(Eu);var Du={name:a()};c(Du);var Ou={enabled:b().optional(),contactOk:b().optional()};c(Ou);var ku=e=>e.kind===`AssetInUse`||Ns(e.kind);function Au(e){return e instanceof Error&&e.payload?.kind===`LoggedOut`}var ju=e=>e.join(`, `);function Mu(e){if(ku(e))return e.message;switch(e.kind){case`BadRequest`:return e.message;case`ScreenNotFound`:return`No screen "${e.screenId}".`;case`BoardNotFound`:return`No board "${e.boardId}".`;case`FrameNotFound`:return`No frame "${e.frameId}" on board "${e.boardId}".`;case`BoardGroupNotFound`:return`No board group "${e.groupId}".`;case`SnippetNotFound`:return`No snippet "${e.snippetId}".`;case`IdNotFound`:return`No node with id "${e.id}" on "${e.screenId}".`;case`AnnotationNotFound`:return`No annotation "${e.annotationId}" on "${e.screenId}".`;case`CanvasNoteNotFound`:return`No note "${e.noteId}".`;case`UnknownComponent`:return e.suggestions.length>0?`No component "${e.ref}". Did you mean ${ju(e.suggestions)}?`:`No component "${e.ref}".`;case`InvalidPath`:case`InvalidMove`:return e.reason;case`SnippetParamMismatch`:return`Snippet "${e.snippetId}": ${e.reason}`;case`SnippetCycle`:return`Snippet "${e.snippetId}" would contain itself (via ${ju(e.viaPath)}).`;case`InvalidExtensionProp`:case`ShadowedComponent`:return e.message;case`LastScreen`:return`A folder needs at least one screen.`;case`ScreenIdConflict`:return`A screen called "${e.screenId}" already exists.`;case`ScreenChangedSinceRead`:return`"${e.screenId}" changed since it was read.`;case`BoardIdConflict`:return`A board called "${e.boardId}" already exists.`;case`SnippetIdConflict`:return`A snippet called "${e.snippetId}" already exists.`;case`FrameIdConflict`:return`Board "${e.boardId}" already has a frame "${e.frameId}".`;case`ScreenIdExhausted`:case`BoardIdExhausted`:return`Ran out of unique ids based on "${e.base}".`;case`IdConflict`:return`"${e.screenId}" already has ${e.paths.length} nodes with id "${e.id}".`;case`AnnotationConflict`:return`That node already has an annotation.`;case`SnippetInUse`:return`Snippet "${e.snippetId}" is still used by ${ju([...e.screenIds,...e.snippetIds.map(e=>`snippet ${e}`)])} — remove those first.`;case`ExtensionIdConflict`:case`ExtensionNotFound`:case`ExtensionInUse`:return e.message;case`InvalidColor`:case`InvalidThemePath`:return e.reason;case`UnknownPreset`:return`No preset "${e.presetName}".`;case`BulkTokensInvalid`:return`${e.failed.length} token${e.failed.length===1?``:`s`} rejected: ${ju(e.failed.map(e=>`${e.path} (${e.reason})`))}. Nothing was saved.`;default:return`The change could not be applied.`}}function Nu(e){let t=Mu(e),n=`hint`in e&&typeof e.hint==`string`?e.hint:void 0;return n?`${t} ${n}`:t}async function Pu(e){let t=await e.json().catch(()=>void 0);if(!t||typeof t!=`object`)return;let n=t.error;if(n&&typeof n==`object`&&typeof n.kind==`string`)return n}async function Fu(e,t){let n=await Pu(e),r=Error(n?Nu(n):`${t}: ${e.status}`);return n&&(r.payload=n),r}async function Iu(e,t,n){Ko();let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(!r.ok)throw await Fu(r,n);return await r.json()}async function Lu(e,t,n){Ko();let r=await fetch(t,{method:e,...n===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}});if(!r.ok)throw await Fu(r,t);return await r.json()}function R(e,t){return Iu(`/api/mutate/${e}`,t,`mutate/${e}`)}function Ru(e,t){return Iu(`/api/theme/${e}`,t,`theme/${e}`)}function zu(e,t){return Iu(e,t,e)}async function Bu(){let e=await fetch(`/api/assets/intents`);return e.ok?(await e.json()).intents??[]:[]}function Vu(e){return zu(`/api/assets/delete`,{assetPath:e})}async function Hu(){let e=await fetch(`/api/assets`);if(!e.ok)throw Error(`assets: ${e.status}`);return(await e.json()).generated}function Uu(e){return zu(`/api/assets/generate`,e)}function Wu(e){return e.loggedIn&&e.login.state===`idle`}function Gu(e,t){return t.loggedIn&&t.verified===!1&&e?.verified!==!1}var Ku={loggedIn:!1,verified:null,login:{state:`idle`}},qu={async status(){let e=await fetch(`/api/auth/status`);return e.ok?await e.json():Ku},async login(){return zu(`/api/auth/login`,{})},async cancelLogin(){await zu(`/api/auth/login/cancel`,{})},async logout(){await zu(`/api/auth/logout`,{})}};async function z(e,t){let n=await fetch(e);if(!n.ok)throw await Fu(n,t);return await n.json()}function Ju(){return z(`/api/design`,`fetchDesign`)}function Yu(e){return z(`/api/screen/${encodeURIComponent(e)}`,`fetchScreen(${e})`)}function Xu(e){return z(`/api/board/${encodeURIComponent(e)}`,`fetchBoard(${e})`)}function Zu(e){return z(`/api/snippets/${encodeURIComponent(e)}`,`fetchSnippet(${e})`)}async function Qu(e){return(await z(`/api/annotations/${encodeURIComponent(e)}`,`fetchAnnotations(${e})`)).annotations.map(t=>({...t,screenId:e}))}async function $u(e){return(await z(`/api/notes/${encodeURIComponent(e)}`,`fetchNotes(${e})`)).notes}function ed(){return z(`/api/components`,`fetchComponents`)}function td(e){return z(`/api/theme${e&&e!=="default"?`?name=${encodeURIComponent(e)}`:``}`,`fetchTheme`)}function nd(e,t,n,r){let i=r?`&theme=${encodeURIComponent(r)}`:``;return`/api/render/${encodeURIComponent(e)}?w=${t}&h=${n}${i}`}var rd=e=>e===`signed-out`||e===`expired`;function id(e){switch(e){case`signed-out`:return`Sign in to velloo cloud to write a cloud comment.`;case`expired`:return`Your velloo-cloud session has ended — sign in again to write a cloud comment.`;case`unpublished`:return`Publish this board to write a cloud comment on it.`;default:return`This canvas cannot write cloud comments.`}}var ad={async arrivals(){return(await z(`/api/comments/arrivals`,`fetchCommentArrivals`)).arrivals},acknowledgeArrivals(e){return Lu(`POST`,`/api/comments/arrivals/ack`,{messageIds:e})},async get(e){return(await z(`/api/comments/${encodeURIComponent(e)}`,`fetchCommentThread`)).thread},async summary(){return(await z(`/api/comments/summary`,`fetchCommentSummary`)).boards},async list(e,t,n=`all`){return(await z(`/api/comments?${new URLSearchParams({boardId:e,status:t,scope:n})}`,`fetchComments`)).threads},cloudAvailability(e){return z(`/api/comments/cloud?${new URLSearchParams({boardId:e})}`,`fetchCloudComments`)},async create(e){return(await Lu(`POST`,`/api/comments`,e)).thread},async reply(e,t){return(await Lu(`POST`,`/api/comments/${encodeURIComponent(e)}/messages`,{body:t})).thread},async update(e,t){return(await Lu(`PATCH`,`/api/comments/${encodeURIComponent(e)}`,t)).thread},delete(e){return Lu(`DELETE`,`/api/comments/${encodeURIComponent(e)}`)},async deleteMessage(e,t){return(await Lu(`DELETE`,`/api/comments/${encodeURIComponent(e)}/messages/${encodeURIComponent(t)}`)).thread}};function od(){return z(`/api/config`,`fetchConfig`)}var sd={viewportPresets(e){return R(`update_viewport_presets`,{presets:e})},defaults(e){return R(`update_defaults`,e)},designName(e){return R(`update_design_name`,{name:e})},codegen(e){return R(`update_codegen`,e)},feedback(e){return R(`update_feedback`,e)}};function cd(e,t,n){return`/api/render/specimen?mode=${e}${n==="default"?``:`&theme=${encodeURIComponent(n)}`}&v=${t}`}var ld={fetch(){return z(`/api/design-language`,`designLanguage`)},saveRules(e){return zu(`/api/design-language/rules`,e)},restore(e){return zu(`/api/design-language/restore`,e)}};async function ud(e){let t=new URLSearchParams({mode:e.mode});e.scale&&e.scale!==1&&t.set(`scale`,String(e.scale));let n=`/api/export/${e.kind}/${encodeURIComponent(e.id)}.${e.format}?${t}`,r=await fetch(n);if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`export failed (${r.status})`)}fd(await r.blob(),dd(r.headers.get(`content-disposition`),`${e.id}.${e.format}`));let i=r.headers.get(`x-velloo-export-warnings`);if(!i)return[];try{return JSON.parse(decodeURIComponent(i))}catch{return[]}}function dd(e,t){return(e?/filename="([^"]+)"/.exec(e):null)?.[1]??t}function fd(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e4)}async function pd(e){return(await Lu(`POST`,`/api/feedback`,e)).message}async function md(){let e=await fetch(`/api/undo`);if(!e.ok)throw Error(`fetchHistory: ${e.status}`);return await e.json()}async function hd(){return Ko(),_d(await fetch(`/api/undo`,{method:`POST`}),`undo`)}async function gd(){return Ko(),_d(await fetch(`/api/undo/redo`,{method:`POST`}),`redo`)}async function _d(e,t){if(e.status===409){let n=await e.json().catch(()=>null);throw Error(n?.message??`Can't ${t}: it has been changed since.`)}if(!e.ok)throw Error(`${t}: ${e.status}`);return await e.json()}var B={addFrame(e){return R(`add_frame`,e)},updateFrame(e){let{boardId:t,frameId:n,patch:r}=e;return R(`update_frame`,{boardId:t,patches:[{frameId:n,patch:r}]})},removeFrame(e){return R(`remove_frame`,e)},moveFrame(e){return R(`move_frame`,e)},connectFrames(e){return R(`connect_frames`,e)},addBoard(e){return R(`add_board`,e)},updateBoard(e){return R(`update_board`,e)},removeBoard(e){return R(`remove_board`,e)},reorderBoards(e){return R(`reorder_boards`,e)},addBoardGroup(e){return R(`add_board_group`,e)},updateBoardGroup(e){return R(`update_board_group`,e)},removeBoardGroup(e){return R(`remove_board_group`,e)},reorderBoardGroups(e){return R(`reorder_board_groups`,e)},updateProps(e){let{screenId:t,path:n,propPatch:r,gesture:i}=e;return R(`update_props`,{screenId:t,patches:[{path:n,propPatch:r}],...i?{gesture:i}:{}})},applyClasses(e){return R(`apply_classes`,e)},setNodeId(e){return R(`set_node_id`,e)},removeNode(e){return R(`remove_node`,e)},updateSnippetArgs(e){return R(`update_snippet_args`,e)}},vd={add(e){return zu(`/api/notes/add`,e)},update(e){return zu(`/api/notes/update`,e)},remove(e){return zu(`/api/notes/remove`,e)}};function yd(){return z(`/api/prefs`,`fetchUserPrefs`)}function bd(e){return zu(`/api/prefs`,e)}var xd=(e,t=``)=>`/api/publish/published/${encodeURIComponent(e)}/guests${t}`,Sd={targets(){return z(`/api/publish/targets`,`publishTargets`)},status(){return z(`/api/publish/status`,`publishStatus`)},start(e){return zu(`/api/publish`,e)},async reset(){await zu(`/api/publish/reset`,{})},async published(){return(await z(`/api/publish/published`,`publishedBoards`)).boards},async unpublish(e){await Lu(`DELETE`,`/api/publish/published/${encodeURIComponent(e)}`)},guests:{async list(e){return(await z(xd(e),`guests`)).guests},invite(e,t){return zu(xd(e),t)},resend(e,t){return zu(xd(e,`/${encodeURIComponent(t)}/resend`),{})},async link(e,t){return(await zu(xd(e,`/${encodeURIComponent(t)}/link`),{})).guestUrl},async remove(e,t){await Lu(`DELETE`,xd(e,`/${encodeURIComponent(t)}`))}}};function Cd(e,t){return wd(`/api/components/status`,t,`fetchLibraryStatus`,e?{library:e}:{})}async function wd(e,t,n,r={}){return t.length===0?[]:(await z(`${e}?${[`ids=${t.map(encodeURIComponent).join(`,`)}`,...Object.entries(r).map(([e,t])=>`${e}=${encodeURIComponent(t)}`)].join(`&`)}`,n)).diagnostics}function Td(){return z(`/api/repo/components`,`fetchRepoComponents`)}function Ed(e){return wd(`/api/repo/status`,e,`fetchRepoStatus`)}function Dd(e,t={}){let n=new URLSearchParams;return n.set(`state`,String(t.state??0)),n.set(`w`,String(t.w??480)),n.set(`h`,String(t.h??200)),t.v!==void 0&&n.set(`v`,String(t.v)),t.dark&&n.set(`mode`,`dark`),`/api/render/repo/${encodeURIComponent(e)}?${n.toString()}`}function Od(e){let{importPath:t,exportName:n}=e.identity;return n==="default"?`import ${e.family} from "${t}";`:`import { ${n} } from "${t}";`}function kd(e){return z(`/api/search?q=${encodeURIComponent(e)}`,`fetchSearch`)}var Ad=null;function jd(e){return Ad=e,()=>{Ad===e&&(Ad=null)}}function Md(e={}){Ad?.(e)}var Nd={setToken(e,t,n){return Ru(`set_token`,{path:t,value:n,theme:e})},setTokens(e,t){return Ru(`set_tokens`,{entries:t,theme:e})},setRadius(e,t){return Ru(`set_radius`,{value:t,theme:e})},setRole(e,t){return Ru(`set_role`,{...t,theme:e})},removeRole(e,t){return Ru(`set_role`,{name:t,remove:!0,theme:e})},setTypeset(e,t){return Ru(`set_typeset`,{typesets:t,theme:e})},setFonts(e,t){return Ru(`set_fonts`,{fonts:t,theme:e})},startingPoints(e){return z(`/api/theme/starting-points${e==="default"?``:`?name=${encodeURIComponent(e)}`}`,`startingPoints`)},applyStartingPoint(e,t){return Ru(`apply_starting_point`,{id:t,theme:e})},addTheme(e,t){return Ru(`add_theme`,{name:e,from:t})},removeTheme(e){return Ru(`remove_theme`,{name:e})},deriveFromColor(e,t,n){return Ru(`derive_palette_from_color`,{seedColor:t,name:n??(e==="default"?void 0:e)})}};function Pd(e={}){return z(e.refresh?`/api/updates/status?refresh=1`:`/api/updates/status`,`fetchUpdateStatus`)}function Fd(){return zu(`/api/updates`,{})}function V(e){let t=e.kind??`info`,n=e.ttl??(t===`error`?6e3:3500),r=e.title??e.message,i={description:e.title?e.message:void 0,duration:n,action:e.action,...e.id?{id:e.id}:{},...e.closeButton?{closeButton:!0}:{}},a;return a=t===`success`?y.success(r,i):t===`error`?y.error(r,i):y(r,i),String(a)}function Id(e){e&&y.dismiss(e)}function H(e,t){return Au(e)?(Md(),``):V({kind:`error`,message:(e instanceof Error?e.message:typeof e==`string`?e:t)||t})}var Ld=[];function Rd(e){return e.authStatus?.loggedIn?e.authStatus.account?.accountId:void 0}function zd(e,t){return e.filter(e=>e.latestVersionId!==null&&e.context.boardIds.includes(t)).sort((e,t)=>Bd(t.lastPublishedAt)-Bd(e.lastPublishedAt)).at(0)??null}var Bd=e=>{let t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:-1/0},Vd=3e4,Hd=0,Ud=null,Wd=(e,t)=>({authStatus:null,signInPrompt:null,publishOpen:!1,publishScope:null,publishedBoardsOpen:!1,feedbackOpen:!1,guestsBoard:null,publishSlots:[],async refreshAuth(){let n=await qu.status(),r=Gu(t().authStatus,n);e({authStatus:n}),r&&V({kind:`error`,title:`velloo-cloud session ended`,message:`Publishing and cloud comments need you to sign in again.`,ttl:1e4,action:{label:`Sign in`,onClick:()=>t().openSignIn({expired:!0})}})},openSignIn(t={}){e({signInPrompt:t})},closeSignIn(){e({signInPrompt:null})},setPublishOpen(n){t().settlePublish(!1),e({publishOpen:n,publishScope:null})},setPublishedBoardsOpen(t){e({publishedBoardsOpen:t})},setFeedbackOpen(t){e({feedbackOpen:t})},openGuests(t){e({guestsBoard:t})},refreshPublishSlots({force:n=!1}={}){return t().authStatus?.loggedIn?!n&&Date.now()-Hd<Vd?Promise.resolve():(Ud&&!n||(Ud=Sd.targets().catch(()=>null).then(t=>{Hd=Date.now(),Ud=null,e({publishSlots:t?.slots??[]})})),Ud):(Hd=0,e({publishSlots:[]}),Promise.resolve())},publishBoard(n){t().settlePublish(!1),e({publishScope:{id:n.id,name:n.name},publishOpen:!0})},publishAndWait(t){return e({publishScope:{id:t.id,name:t.name},publishOpen:!0}),new Promise(e=>{Ld.push(e)})},settlePublish(e){let n=Ld;Ld=[];for(let t of n)t(e);e&&n.length===0&&t().refreshCloudComments(),e&&t().refreshPublishSlots({force:!0})}}),Gd=class{pending=new Set;generation=0;reset(){this.generation+=1,this.pending.clear()}async load(e,t,n,r){let i=[...new Set(e)].filter(e=>!(e in t)&&!this.pending.has(e));if(i.length===0)return;for(let e of i)this.pending.add(e);let a=this.generation;try{let e=await n(i);if(a!==this.generation)return;r(Object.fromEntries(i.map(t=>[t,e.get(t)??null])))}catch{}finally{if(a===this.generation)for(let e of i)this.pending.delete(e)}}};function Kd(e,t){return`${e}\u0000${t}`}function qd(e,t){return(t?e?.screens.find(e=>e.id===t):void 0)?.library??e?.defaultLibrary??``}var Jd=(e,t)=>{let n=new Gd;return{libraryStatus:{},async loadLibraryStatus(r,i){let a=new Map(i.map(e=>[Kd(r,e),e]));await n.load([...a.keys()],t().libraryStatus,async e=>{let t=await Cd(r,e.map(e=>a.get(e)));return new Map(t.map(e=>[Kd(r,e.id),e]))},t=>e(e=>({libraryStatus:{...e.libraryStatus,...t}})))},resetLibraryStatus(){n.reset(),e({libraryStatus:{}})}}},Yd=200;function Xd(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`number`||typeof t.ts!=`number`||typeof t.verb!=`string`||t.source!==`mcp`&&t.source!==`canvas`&&t.source!==`cli`||!t.target||typeof t.target!=`object`?null:e}var Zd=(e,t)=>({activityEvents:[],activityFeedOpen:!1,lastAgentActivityAt:null,activityFlash:{},frameGlow:{},boardPulse:{},recordActivity(n){if(e(e=>({activityEvents:e.activityEvents.length>=Yd?[...e.activityEvents.slice(-199),n]:[...e.activityEvents,n]})),n.source===`canvas`)return;let r=t(),i={...r.activityFlash},a={...r.frameGlow},o={...r.boardPulse},s=r.currentBoardId?r.boards[r.currentBoardId]:null,c=e=>{if(e.screenId&&e.path){let t=i[e.screenId];i[e.screenId]={nonce:(t?.nonce??0)+1,path:e.path.join(`.`)}}else if(e.screenId)for(let t of s?.frames??[])t.screen===e.screenId&&(a[t.id]=(a[t.id]??0)+1);if(e.frameId&&(a[e.frameId]=(a[e.frameId]??0)+1),e.themeName!==void 0||e.token!==void 0)for(let e of s?.frames??[])a[e.id]=(a[e.id]??0)+1;let t=new Set(e.boards??[]);if(e.boardId&&t.add(e.boardId),e.screenId)for(let n of Object.values(r.boards))n.frames.some(t=>t.screen===e.screenId)&&t.add(n.id);for(let e of t)e!==r.currentBoardId&&(o[e]=n.ts)};c(n.target);for(let e of n.ops??[])c(e.target);e({lastAgentActivityAt:Date.now(),activityFlash:i,frameGlow:a,boardPulse:o})},async backfillActivity(){try{let t=await fetch(`/api/activity`);if(!t.ok)return;let n=((await t.json()).events??[]).map(Xd).filter(e=>e!==null);e(e=>{let t=new Set(e.activityEvents.map(e=>e.id));return{activityEvents:[...n.filter(e=>!t.has(e.id)),...e.activityEvents].sort((e,t)=>e.id-t.id).slice(-200)}})}catch{}},setActivityFeedOpen(n){e({activityFeedOpen:n}),n&&t().backfillActivity()}});function U(e){return e===``?[]:e.split(`.`).map(e=>Number(e))}function Qd(e){return e.join(`.`)}function $d(e,t){return`$id`in e&&e.$id?`@${String(e.$id)}`:U(t)}function ef(e,t){if(!t)return null;let n=e[t.screenId];if(!n)return null;let r=U(t.path),i=n.tree;for(let e of r){if(!i||!(`$ref`in i))return null;let t=i.children;if(!t||e<0||e>=t.length)return null;i=t[e]}return i??null}var tf=(e,t)=>({selection:null,hover:null,reveal:null,selectionIntent:`inspect`,snippetFocus:null,selectionComputed:null,selectionAnchor:null,setSelectionComputed(n,r){t().selection?.path===n&&e({selectionComputed:r})},setSnippetFocus(n){t().snippetFocus!==n&&(e({snippetFocus:n,...t().selection?.screenId.startsWith(`snippet:`)===!0?{selection:null,hover:null}:{}}),n!==null&&(e({selection:null,hover:null}),Zu(n).then(e=>{t().snippetFocus===n&&(t().setSyntheticScreen(`snippet:${n}`,{id:`snippet:${n}`,name:e.name,tree:e.tree,...e.library?{library:e.library}:{}}),t().setSelection({screenId:`snippet:${n}`,path:``}))}).catch(()=>e({snippetFocus:null}))))},setSelection(n){t().reveal&&e({reveal:null});let r=t().selection;r===n||r!==null&&n!==null&&r.screenId===n.screenId&&r.path===n.path?n&&t().selectionIntent!==`inspect`&&e({selectionIntent:`inspect`}):e({selection:n,selectionIntent:`inspect`,selectionComputed:null,selectionAnchor:null}),n&&n.screenId!==t().currentScreenId&&!n.screenId.startsWith(`snippet:`)&&t().selectScreen(n.screenId)},revealSelection(n,r={}){let i=(t().reveal?.nonce??0)+1;t().setSelection(n),e({reveal:{...n,nonce:i},selectionIntent:r.preserveTab?`preserve-tab`:`inspect`})},setSelectionAnchor(n){let r=t().selectionAnchor;r===n||r!==null&&n!==null&&r.frameId===n.frameId&&r.instance===n.instance||e({selectionAnchor:n})},setHover(n){let r=t().hover;r!==n&&(r&&n&&r.screenId===n.screenId&&r.path===n.path||e({hover:n}))}});function nf(e){let t=e;return typeof t.$id==`string`?t.$id:typeof t.$ref==`string`?t.$ref.split(`.`).pop()??t.$ref:typeof t.$snippet==`string`?t.$snippet:typeof t.$text==`string`?`“${t.$text.slice(0,24)}”`:`Node`}var rf=(...e)=>e.filter(Boolean).join(` › `);function af(e,t){return e.label??t[e.screen]?.name??e.screen}function of(e,t){return t?e.frames.find(e=>e.screen===t):void 0}function sf({board:e}){return e?{kind:`view`,ref:{boardId:e.id},label:e.name}:null}function cf(e){return{kind:`language`,ref:{theme:e},label:e==="default"?`Design language`:`Design language · ${e}`}}function lf({board:e,screens:t,selection:n}){if(!e||!n)return null;let r=of(e,n.screenId),i=t[n.screenId];if(!r||!i)return null;if(!n.path)return uf(e,r,t);let a=ef(t,n);return a?{kind:`node`,ref:{boardId:e.id,screenId:i.id,path:n.path,frameId:r.id},label:rf(af(r,t),nf(a))}:null}function uf(e,t,n){return{kind:`frame`,ref:{boardId:e.id,frameId:t.id,screenId:t.screen},label:af(t,n)}}function df({board:e,screens:t,notes:n=[]}){if(!e)return[];let r=e.frames.map(n=>uf(e,n,t));for(let t of n){let n=t.body.replace(/[#*_`>]/g,``).replace(/\s+/g,` `).trim();n&&r.push({kind:`note`,ref:{boardId:e.id,noteId:t.id},label:`Note “${n.length>32?`${n.slice(0,31)}…`:n}”`})}return r}function ff(e,t,n){let r=e.anchor,i=t?.name??e.boardId;if(!r||r.kind===`board`)return i;let a=n[r.screenId],o=t?of(t,r.screenId):void 0,s=a&&Array.isArray(r.locator)?ef(n,{screenId:r.screenId,path:r.locator.join(`.`)}):null,c=typeof r.locator==`string`?r.locator.replace(/^@/,``):s?nf(s):void 0;return rf(i,o?af(o,n):a?.name??r.screenId,c)}function pf(e,t,n,r){let i=e.messages.find(e=>e.id===r&&!e.deletedAt)??e.messages.find(e=>!e.deletedAt);return{kind:`comment`,ref:{boardId:e.boardId,threadId:e.id,...i?{messageId:i.id}:{},...e.anchor?.kind===`node`?{screenId:e.anchor.screenId}:{}},label:ff(e,t,n),detail:(i?.body??``).replace(/\s+/g,` `).trim().slice(0,280),author:i?.author.displayName??(i?.author.kind===`agent`?`Agent`:i?.author.kind===`reviewer`?`Reviewer`:`You`)}}function mf(e,t){let{ref:n}=e,r=n.boardId?t.boards[n.boardId]:void 0;switch(e.kind){case`view`:case`board`:return n.boardId&&!t.boards[n.boardId]&&Object.keys(t.boards).length?`gone`:void 0;case`frame`:case`preview`:return r&&!r.frames.some(e=>e.id===n.frameId)?`gone`:void 0;case`screen`:return;case`node`:{if(!n.screenId||!t.screens[n.screenId])return;let r=ef(t.screens,{screenId:n.screenId,path:n.path??``});return r?e.label.split(` › `).pop()===nf(r)?void 0:`changed`:`gone`}case`comment`:{if(!n.threadId||!(n.threadId in t.threads))return;let e=t.threads[n.threadId];if(!e)return`gone`;let r=e.messages.find(e=>e.id===n.messageId);return n.messageId&&(!r||r.deletedAt)?`gone`:e.status===`resolved`?`resolved`:void 0}case`note`:case`language`:return}}var hf=e=>`/api/agent/sessions/${encodeURIComponent(e)}`,gf={providers(e=!1){return z(`/api/agent/providers${e?`?refresh=1`:``}`,`agent providers`)},history(e){return z(`/api/agent/history?provider=${encodeURIComponent(e)}`,`agent history`)},sessions(){return z(`/api/agent/sessions`,`agent sessions`)},snapshot(e){return z(hf(e),`agent session`)},start(e){return Lu(`POST`,`/api/agent/sessions`,e)},reopen(e){return Lu(`POST`,`${hf(e)}/reopen`)},prompt(e,t){return Lu(`POST`,`${hf(e)}/turns`,t)},dequeue(e,t){return Lu(`DELETE`,`${hf(e)}/queue/${encodeURIComponent(t)}`)},interrupt(e){return Lu(`POST`,`${hf(e)}/interrupt`)},answer(e,t,n,r){return Lu(`POST`,`${hf(e)}/approvals/${encodeURIComponent(t)}`,{decision:n,...r?{answers:r}:{}})},rename(e,t){return Lu(`PATCH`,hf(e),{title:t})},setModel(e,t){return Lu(`POST`,`${hf(e)}/model`,{model:t})},setMode(e,t){return Lu(`POST`,`${hf(e)}/mode`,{mode:t})},mcpServers(e){return z(`${hf(e)}/mcp`,`agent MCP servers`)},mcpAction(e,t,n){return Lu(`POST`,`${hf(e)}/mcp`,{server:t,action:n})},stop(e){return Lu(`POST`,`${hf(e)}/stop`)},remove(e,t=!1){return Lu(`DELETE`,`${hf(e)}${t?`?from=agent`:``}`)}},_f=`velloo:lastBoard`,vf=`velloo:boardView:`;function yf(){if(typeof localStorage>`u`)return null;try{return localStorage.getItem(_f)||null}catch{return null}}function bf(e){if(typeof localStorage<`u`)try{localStorage.setItem(_f,e)}catch{}}function xf(e){if(typeof localStorage>`u`)return null;try{let t=localStorage.getItem(vf+e);if(!t)return null;let n=JSON.parse(t),r=typeof n.zoom==`number`&&Number.isFinite(n.zoom)?n.zoom:null,i=n.pan&&typeof n.pan.x==`number`&&Number.isFinite(n.pan.x)?n.pan.x:null,a=n.pan&&typeof n.pan.y==`number`&&Number.isFinite(n.pan.y)?n.pan.y:null;return r===null||i===null||a===null?null:{pan:{x:i,y:a},zoom:r}}catch{return null}}function Sf(e,t){if(typeof localStorage<`u`)try{localStorage.setItem(vf+e,JSON.stringify(t))}catch{}}function Cf(){if(typeof localStorage<`u`)try{localStorage.removeItem(_f);let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n?.startsWith(vf)&&e.push(n)}for(let t of e)localStorage.removeItem(t)}catch{}}var wf={min:240,max:560,default:320};function Tf(e){return Number.isNaN(e)?wf.default:Math.min(wf.max,Math.max(wf.min,Math.round(e)))}var Ef=`velloo:appTheme`;function Df(){if(typeof localStorage>`u`)return`system`;let e=localStorage.getItem(Ef);return e===`light`||e===`dark`||e===`system`?e:`system`}var Of=`velloo:designMode`,kf=`velloo:rememberDesignMode`;function Af(e,t){if(typeof localStorage>`u`)return t;let n=localStorage.getItem(e);return n===null?t:n===`true`}function jf(){return typeof localStorage>`u`||!Af(kf,!0)?`light`:localStorage.getItem(Of)===`dark`?`dark`:`light`}var Mf=`velloo:leftPanels`,Nf=`velloo:panes`,Pf=`velloo:paneWidths`,Ff=`velloo:rememberPanels`,If=480;function Lf(e,t,n){return e-t-n>=If}var Rf=null;function zf(e,t,n){let r=e.panesExclusive&&!n;return r&&(Rf=t===`left`?`right`:`left`),t===`left`?{leftPaneCollapsed:n,rightPaneCollapsed:r||e.rightPaneCollapsed}:{leftPaneCollapsed:r||e.leftPaneCollapsed,rightPaneCollapsed:n}}function Bf(e,t){return zf(e,t,!1)}function Vf(e,t){let n=Object.fromEntries(t.map(e=>[e,!1]));if(typeof localStorage>`u`||!Af(Ff,!0))return n;try{let r=localStorage.getItem(e);if(!r)return n;let i=JSON.parse(r);for(let e of t)n[e]=i[e]===!0;return n}catch{return n}}function Hf(e,t){typeof localStorage<`u`&&Af(Ff,!0)&&localStorage.setItem(e,JSON.stringify(t))}function Uf(e,t){Hf(Nf,{...Vf(Nf,[`left`,`right`]),[e]:t})}function Wf(){let e={left:wf.default,right:wf.default};if(typeof localStorage>`u`||!Af(Ff,!0))return e;try{let t=localStorage.getItem(Pf);if(!t)return e;let n=JSON.parse(t);return{left:typeof n.left==`number`?Tf(n.left):e.left,right:typeof n.right==`number`?Tf(n.right):e.right}}catch{return e}}function Gf(e,t){typeof localStorage<`u`&&Af(Ff,!0)&&localStorage.setItem(Pf,JSON.stringify({left:e,right:t}))}function Kf(){let e=Vf(Mf,[`boards`,`tree`]),t=Vf(Nf,[`left`,`right`]),n=Wf();return{appTheme:Df(),designMode:jf(),rememberDesignMode:Af(kf,!0),rememberPanels:Af(Ff,!0),boardsCollapsed:e.boards,treeCollapsed:e.tree,leftPaneCollapsed:t.left,rightPaneCollapsed:t.right,leftPaneWidth:n.left,rightPaneWidth:n.right}}var qf=[Ef,Of,kf,Mf,Nf,Pf,Ff],Jf=(e,t)=>({...Kf(),panesExclusive:!1,settingsScope:null,searchOpen:!1,exportTarget:null,previewTarget:null,hintsSeen:null,setAppTheme(t){e({appTheme:t}),typeof localStorage<`u`&&localStorage.setItem(Ef,t)},setDesignMode(t){e({designMode:t}),typeof localStorage<`u`&&Af(kf,!0)&&localStorage.setItem(Of,t)},setRememberDesignMode(n){e({rememberDesignMode:n}),typeof localStorage<`u`&&(localStorage.setItem(kf,String(n)),n?localStorage.setItem(Of,t().designMode):localStorage.removeItem(Of))},setRememberPanels(n){if(e({rememberPanels:n}),typeof localStorage<`u`){if(localStorage.setItem(Ff,String(n)),n){let e=t();Hf(Mf,{boards:e.boardsCollapsed,tree:e.treeCollapsed}),Hf(Nf,{left:e.leftPaneCollapsed,right:e.rightPaneCollapsed}),Gf(e.leftPaneWidth,e.rightPaneWidth)}else localStorage.removeItem(Mf),localStorage.removeItem(Nf),localStorage.removeItem(Pf)}},setSettingsScope(t){e({settingsScope:t})},resetCanvasPrefs(){if(typeof localStorage<`u`)for(let e of qf)localStorage.removeItem(e);Cf();let n=t().panesExclusive;Rf=n?`left`:null,e({appTheme:`system`,designMode:`light`,rememberDesignMode:!0,rememberPanels:!0,boardsCollapsed:!1,treeCollapsed:!1,leftPaneCollapsed:n,rightPaneCollapsed:!1,leftPaneWidth:wf.default,rightPaneWidth:wf.default})},toggleBoardsCollapsed(){e(e=>{let t=!e.boardsCollapsed;return Hf(Mf,{boards:t,tree:e.treeCollapsed}),{boardsCollapsed:t}})},setSearchOpen(t){e({searchOpen:t})},setExportTarget(t){e({exportTarget:t})},setPreviewTarget(t){e({previewTarget:t})},setHintsSeen(t){e({hintsSeen:t})},toggleTreeCollapsed(){e(e=>{let t=!e.treeCollapsed;return Hf(Mf,{boards:e.boardsCollapsed,tree:t}),{treeCollapsed:t}})},setLeftPaneCollapsed(t){Uf(`left`,t),e(e=>zf(e,`left`,t))},setRightPaneCollapsed(t){Uf(`right`,t),e(e=>zf(e,`right`,t))},setLeftPaneWidth(t){e(e=>{let n=Tf(t);return Gf(n,e.rightPaneWidth),{leftPaneWidth:n}})},setRightPaneWidth(t){e(e=>{let n=Tf(t);return Gf(e.leftPaneWidth,n),{rightPaneWidth:n}})},syncPaneLayout(n){let r=t(),i=!Lf(n,r.leftPaneWidth,r.rightPaneWidth);if(i===r.panesExclusive)return;if(i){let t=!r.leftPaneCollapsed&&!r.rightPaneCollapsed;Rf=t?`left`:null,e({panesExclusive:!0,...t&&{leftPaneCollapsed:!0}});return}let a=Rf;Rf=null;let o=a===`left`?r.rightPaneCollapsed:r.leftPaneCollapsed;e(!a||o?{panesExclusive:!1}:a===`left`?{panesExclusive:!1,leftPaneCollapsed:!1}:{panesExclusive:!1,rightPaneCollapsed:!1})}}),Yf=32e3,Xf=200;function Zf(e){let{ref:t}=e;return[e.kind,t.boardId,t.screenId,t.frameId,t.path,t.noteId,t.threadId,t.messageId].join(`|`)}var Qf=()=>({turns:[],turnsDropped:0,approvals:[],queued:[]});function $f(e,t){return[t,...e.filter(e=>e.id!==t.id)].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt))}function ep(e,t,n){if(t===`text`&&e.kind!==`command`&&`text`in e)return{...e,text:e.text+n};if(t===`output`&&e.kind===`command`){let t=e.output+n;if(t.length<=Yf)return{...e,output:t};let r=t.length-Yf;return{...e,output:t.slice(r),outputDropped:(e.outputDropped??0)+r}}return e}function tp(e,t,n){let r=e.turns.findIndex(e=>e.id===t),i=n(r>=0?e.turns[r]:{id:t,status:`running`,items:[],startedAt:new Date().toISOString()}),a=r>=0?e.turns.map((e,t)=>t===r?i:e):[...e.turns,i],o=Math.max(0,a.length-Xf);return{...e,turns:o?a.slice(o):a,turnsDropped:e.turnsDropped+o}}function np(e,t){let{agentSessions:n,agentTranscripts:r}=e,i=e=>r[e]??Qf(),a=(t,n)=>({...e,agentTranscripts:{...r,[t]:n}});switch(t.event){case`providers`:return{...e,agentProviders:t.providers};case`session`:return{...e,agentSessions:$f(n,t.session)};case`session-removed`:{let{[t.sessionId]:i,...a}=r;return{...e,agentSessions:n.filter(e=>e.id!==t.sessionId),agentTranscripts:a}}case`turn`:return a(t.sessionId,tp(i(t.sessionId),t.turn.id,e=>({...e,...t.turn})));case`item`:return a(t.sessionId,tp(i(t.sessionId),t.turnId,e=>{let n=e.items.findIndex(e=>e.id===t.item.id),r=n>=0?e.items.map((e,r)=>r===n?t.item:e):t.item.kind===`user`?[t.item,...e.items]:[...e.items,t.item];return{...e,items:r}}));case`delta`:return a(t.sessionId,tp(i(t.sessionId),t.turnId,e=>({...e,items:e.items.map(e=>e.id===t.itemId?ep(e,t.field,t.delta):e)})));case`approval`:{let e=i(t.sessionId);return a(t.sessionId,{...e,approvals:[...e.approvals.filter(e=>e.id!==t.request.id),t.request]})}case`approval-resolved`:{let e=i(t.sessionId);return a(t.sessionId,{...e,approvals:e.approvals.filter(e=>e.id!==t.approvalId)})}case`queue`:return a(t.sessionId,{...i(t.sessionId),queued:t.queued});case`controls`:{let{controls:e,...n}=i(t.sessionId);return a(t.sessionId,t.controls?{...n,controls:t.controls}:n)}}}function rp(e){return{turns:e.turns,turnsDropped:e.turnsDropped,approvals:e.approvals,queued:e.queued,...e.controls?{controls:e.controls}:{}}}var ip=new Set([`starting`,`idle`,`running`,`awaiting-approval`]),ap=(e,t)=>{async function n(t){let n=await gf.snapshot(t);e(e=>({agentSessions:$f(e.agentSessions,n.session),agentTranscripts:{...e.agentTranscripts,[t]:rp(n)}}))}async function r(e,n){let r=t().agentActiveSessionId;if(r)try{await n(r)}catch(t){H(t,e)}}return{agentProviders:null,agentSessions:[],agentTranscripts:{},agentActiveSessionId:null,agentDraft:{text:``,context:[]},agentProtocolMismatch:!1,agentLoadError:null,agentCommentThreads:{},async loadAgent(){e({agentLoadError:null});try{let r=gf.sessions();r.then(({sessions:n})=>{t().agentProviders===null&&!n.some(e=>ip.has(e.state))&&e({agentSessions:n})}).catch(()=>{});let[{providers:i},{sessions:a}]=await Promise.all([gf.providers(),r]),o=t().agentActiveSessionId,s=(o&&a.some(e=>e.id===o)?o:null)??a.find(e=>ip.has(e.state))?.id??null;e({agentProviders:i,agentSessions:a,agentActiveSessionId:s}),s&&await n(s)}catch(n){n instanceof Error&&/not enabled/i.test(n.message)?e({agentProviders:[]}):t().agentProviders===null?e({agentLoadError:n instanceof Error?n.message:`Velloo didn't answer.`}):H(n,`Could not load agent sessions`)}},async refreshAgentProviders(){try{let{providers:t}=await gf.providers(!0);e({agentProviders:t})}catch(e){H(e,`Could not check the agents on this computer`)}},async selectAgentSession(t){if(e({agentActiveSessionId:t}),t)try{await n(t)}catch(e){H(e,`Could not open that session`)}},async startAgentSession(r,i){try{let{session:t}=await gf.start({provider:r,...i?{resume:i}:{}});e(e=>({agentSessions:$f(e.agentSessions,t),agentActiveSessionId:t.id})),await n(t.id)}catch(e){H(e,`Could not start the agent`),t().loadAgent()}},async reopenAgentSession(t){try{let{session:r}=await gf.reopen(t);e(e=>({agentSessions:$f(e.agentSessions,r),agentActiveSessionId:t})),await n(t)}catch(e){H(e,`Could not reopen the session`)}},async sendAgentPrompt(n){let r=t().agentActiveSessionId,i=t().agentDraft;if(!r||!i.text.trim()&&i.context.length===0)return!1;let a=i.text.trimStart().startsWith(`/`),o=a?[]:[...n?[n]:[],...i.context];e(a?{agentDraft:{text:``,context:i.context}}:{agentDraft:{text:``,context:[]}});try{return await gf.prompt(r,{text:i.text,...o.length?{context:o}:{}}),!0}catch(t){return e(e=>e.agentDraft.text||(a?e.agentDraft.context!==i.context:e.agentDraft.context.length>0)?{}:{agentDraft:i}),H(t,`Could not send to the agent`),!1}},interruptAgent:()=>r(`Could not stop the turn`,e=>gf.interrupt(e)),answerAgentApproval:(e,t,n)=>r(`Could not answer the agent`,r=>gf.answer(r,e,t,n)),dequeueAgentPrompt:e=>r(`Could not remove the queued message`,t=>gf.dequeue(t,e)),async renameAgentSession(t,n){try{let{session:r}=await gf.rename(t,n);e(e=>({agentSessions:$f(e.agentSessions,r)}))}catch(e){H(e,`Could not rename the session`)}},async stopAgentSession(e){try{await gf.stop(e)}catch(e){H(e,`Could not stop the agent`)}},async setAgentModel(n){let r=t().agentActiveSessionId;if(!r)return!1;try{let{session:t}=await gf.setModel(r,n);return e(e=>({agentSessions:$f(e.agentSessions,t)})),!0}catch(e){return H(e,`Could not switch the model`),!1}},async setAgentMode(n){let r=t().agentActiveSessionId;if(!r)return!1;try{let{session:t}=await gf.setMode(r,n);return e(e=>({agentSessions:$f(e.agentSessions,t)})),!0}catch(e){return H(e,`Could not switch the permission mode`),!1}},async loadAgentMcpServers(){let e=t().agentActiveSessionId;if(!e)return null;try{return(await gf.mcpServers(e)).servers}catch(e){return H(e,`Could not read the agent's MCP servers`),null}},async agentMcpAction(e,n){let r=t().agentActiveSessionId;if(!r)return!1;try{return await gf.mcpAction(r,e,n),!0}catch(t){return H(t,`Could not ${n} ${e}`),!1}},async removeAgentSession(n,r=!1){try{await gf.remove(n,r),t().agentActiveSessionId===n&&e({agentActiveSessionId:null})}catch(e){H(e,r?`Could not delete the session`:`Could not remove the session`)}},applyAgentFrame(t){t.v===2?e(e=>np(e,t)):e({agentProtocolMismatch:!0})},setAgentDraftText(t){e(e=>({agentDraft:{...e.agentDraft,text:t}}))},addAgentContext(t,n){e(e=>{let r=new Set(e.agentDraft.context.map(Zf)),i=t.filter(e=>!r.has(Zf(e)));return{agentDraft:{...e.agentDraft,context:[...e.agentDraft.context,...i]},...n?.reveal?{rightTab:`agent`,...Bf(e,`right`)}:{}}})},clearAgentComments(){e(e=>({agentDraft:{...e.agentDraft,context:e.agentDraft.context.filter(e=>e.kind!==`comment`)}}))},async addCommentsToAgent(n){let r=await Promise.all(n.map(async e=>({...e,thread:await ad.get(e.threadId).catch(()=>null)}))),{boards:i,screens:a}=t(),o=r.flatMap(({thread:e,messageIds:t})=>{if(!e)return[];let n=i[e.boardId],r=t?.filter(t=>e.messages.some(e=>e.id===t&&!e.deletedAt));return r?.length?r.map(t=>pf(e,n,a,t)):[pf(e,n,a)]});e(e=>({agentCommentThreads:{...e.agentCommentThreads,...Object.fromEntries(r.map(e=>[e.threadId,e.thread]))}})),o.length&&t().addAgentContext(o,{reveal:!0})},async refreshAgentCommentThreads(n){let r=n??[...new Set([...t().agentDraft.context,...Object.values(t().agentTranscripts).flatMap(e=>e.turns.flatMap(e=>e.items.flatMap(e=>e.kind===`user`?e.context??[]:[])))].filter(e=>e.kind===`comment`&&e.ref.threadId).map(e=>e.ref.threadId))].slice(-50);if(r.length===0)return;let i=await Promise.all(r.map(async e=>[e,await ad.get(e).catch(()=>null)]));e(e=>({agentCommentThreads:{...e.agentCommentThreads,...Object.fromEntries(i)}}))},removeAgentContext(t){let n=Zf(t);e(e=>({agentDraft:{...e.agentDraft,context:e.agentDraft.context.filter(e=>Zf(e)!==n)}}))}}};function op(e){let t=e().editingMarkupId;t&&(e().annotations.some(e=>e.id===t)||e().notes.some(e=>e.id===t)||e().setEditingMarkupId(null))}var sp=`draft:`,cp=240;function lp(e){return e.startsWith(sp)}var up=(e,t)=>({annotations:[],notes:[],markupVisible:!0,editingMarkupId:null,async refreshAnnotations(){let n=t().currentBoardId,r=n?t().boards[n]:null,i=r?[...new Set(r.frames.map(e=>e.screen))]:t().currentScreenId?[t().currentScreenId]:[];if(i.length===0)e({annotations:[]});else try{e({annotations:(await Promise.all(i.map(e=>Qu(e)))).flat()}),op(t)}catch{}},async refreshNotes(){let n=t().currentBoardId;if(n)try{let r=await $u(n);e(e=>({notes:[...r,...e.notes.filter(e=>lp(e.id))]})),op(t)}catch{}},createNote(n){if(!t().currentBoardId)return;t().setCursorMode(`select`);let r=`${sp}${Math.random().toString(36).slice(2,10)}`,i=`attachment`in n?{id:r,width:cp,body:``,attachment:n.attachment,resolved:n.resolved??null}:{id:r,x:n.x,y:n.y,width:n.width??cp,...n.height!==void 0&&{height:n.height},body:``};e(e=>({notes:[...e.notes,i]})),t().setMarkupVisible(!0),t().setEditingMarkupId(r)},noteOnSelection(){let e=t(),n=e.selection,r=e.currentBoardId;if(!n||!r||n.screenId.startsWith(`snippet:`))return!1;let i=ef(e.screens,n);if(!i)return!1;let a=e.boards[r]?.frames??[],o=a.find(t=>t.screen===n.screenId&&e.nodeRects[t.id]?.[n.path])??a.find(e=>e.screen===n.screenId);return o?(t().createNote({attachment:{frameId:o.id,screenId:n.screenId,locator:$d(i,n.path)},resolved:n.path===``?[]:n.path.split(`.`).map(Number)}),!0):!1},async saveDraftNote(n,r){let i=t().currentBoardId,a=t().notes.find(e=>e.id===n);if(!i||!a)return;let o={...a,...r};try{let{note:t}=await vd.add({boardId:i,body:o.body,width:o.width,...o.height!==void 0&&{height:o.height},...o.attachment?{attachment:o.attachment}:{x:o.x??0,y:o.y??0}});e(e=>({notes:e.notes.some(e=>e.id===t.id)?e.notes.filter(e=>e.id!==n):e.notes.map(e=>e.id===n?{...t,resolved:a.resolved}:e)}))}catch(e){H(e,`Could not add note`)}},updateDraftNote(t,n){e(e=>({notes:e.notes.map(e=>e.id===t?{...e,...n}:e)}))},discardDraftNote(n){e(e=>({notes:e.notes.filter(e=>e.id!==n)})),op(t)},setMarkupVisible(n){n||t().setEditingMarkupId(null),e({markupVisible:n})},setEditingMarkupId(n){let r=t().editingMarkupId;r!==n&&(e({editingMarkupId:n}),n&&!r?t().zoomForMarkupEdit():!n&&r&&t().restoreViewAfterMarkupEdit())}}),dp=.1,fp=1.05;function pp(e){return e>0?1/fp:fp}function mp(e,t=60){if(e.length===0)return null;let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o of e)o.x<n&&(n=o.x),o.y<r&&(r=o.y),o.x+o.w>i&&(i=o.x+o.w),o.y+o.h+t>a&&(a=o.y+o.h+t);return{minX:n,minY:r,maxX:i,maxY:a}}function hp(e,t,n,r=80){let i=mp(e);if(!i||t<50||n<50)return null;let a=Math.max(1,i.maxX-i.minX),o=Math.max(1,i.maxY-i.minY),s=(i.minX+i.maxX)/2,c=(i.minY+i.maxY)/2,l=(t-r*2)/a,u=(n-r*2)/o,d=Math.max(dp,Math.min(1,Math.min(l,u)));return{zoom:d,pan:{x:Math.round(t/2-s*d),y:Math.round(n/2-c*d)}}}function gp(e,t,n,r=120,i=1){if(t<50||n<50)return null;let a=(t-r*2)/Math.max(1,e.w),o=(n-r*2)/Math.max(1,e.h),s=Math.max(dp,Math.min(i,a,o)),c=e.x+e.w/2,l=e.y+e.h/2;return{zoom:s,pan:{x:Math.round(t/2-c*s),y:Math.round(n/2-l*s)}}}function _p(e,t,n,r,i=48){if(n<50||r<50)return null;let a=Math.max(1,n-i*2-t.gap-t.w),o=Math.max(dp,Math.min(1,a/Math.max(1,e.w),(r-i*2)/Math.max(1,e.h))),s=e.w*o+t.gap+t.w,c=Math.max(e.h*o,t.gap+t.h);return{zoom:o,pan:{x:Math.round((n-s)/2-e.x*o),y:Math.round((r-c)/2-e.y*o)}}}function vp(e,t,n){let r=Math.max(0,e.w-n.w),i=Math.max(0,e.h-n.h);return{x:e.x+t.x+Math.max(0,Math.min(n.x,r)),y:e.y+t.y+Math.max(0,Math.min(n.y,i)),w:n.w,h:n.h}}function yp(e,t,n,r=80,i=60){if(t<50||n<50)return null;let a=e.h+i,o=(t-r*2)/e.w,s=(n-r*2)/a,c=Math.max(dp,Math.min(1,o,s)),l=e.x+e.w/2,u=e.y+a/2;return{zoom:c,pan:{x:Math.round(t/2-l*c),y:Math.round(n/2-u*c)}}}function bp(e,t,n,r){let i=Math.max(dp,Math.min(4,r.zoom*n));if(i===r.zoom)return r;let a=(e-r.pan.x)/r.zoom,o=(t-r.pan.y)/r.zoom;return{zoom:i,pan:{x:Math.round(e-a*i),y:Math.round(t-o*i)}}}function xp(e,t){return{...e.commentStatus===`resolved`&&{commentStatus:`open`},...e.commentScope!==`all`&&e.commentScope!==t.scope&&{commentScope:`all`}}}function Sp(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e===t}function Cp(e){let t=`$ref`in e?e.$ref:`$snippet`in e?e.$snippet:void 0,n=`props`in e?e.props?.children:void 0,r=typeof n==`string`?n.trim().replace(/\s+/g,` `).slice(0,500):void 0;if(t||r)return{...t&&{ref:t},...r&&{text:r}}}function wp(e,t){return e.findIndex(e=>e.id===t.id)<0?[t,...e]:e.map(e=>e.id===t.id?t:e)}var Tp=null,Ep=!1,Dp=`This board wasn't published, so a cloud comment has nowhere to live yet. Publish it, or keep the comment local.`;async function Op(e,t){let n=e().cloudComments;if(!n||n.available)return null;if(n.reason!==`unpublished`)return id(n.reason);let r=e().boards[t];return!r||!await e().publishAndWait({id:r.id,name:r.name})?Dp:(await e().refreshCloudComments(),e().cloudComments?.available?null:Dp)}function kp(e){return e.rightTab===`agent`||e.agentSessions.some(e=>e.state!==`exited`&&e.state!==`failed`)}var Ap=(e,t)=>({commentThreads:[],commentStatus:`open`,commentScope:`all`,cloudComments:void 0,activeCommentId:null,pendingCommentAnchor:null,boardCommentCounts:{},commentArrivals:[],async loadCommentArrivals(){try{e({commentArrivals:await ad.arrivals()})}catch{}},receiveCommentArrival(t){e(e=>{let n=e.commentArrivals.find(e=>e.boardId===t.boardId);if(!n)return{commentArrivals:[...e.commentArrivals,t]};let r={boardId:t.boardId,threadIds:[...new Set([...n.threadIds,...t.threadIds])],messageIds:[...new Set([...n.messageIds,...t.messageIds])]};return{commentArrivals:e.commentArrivals.map(e=>e===n?r:e)}})},async acknowledgeCommentArrivals(t){let n=new Set(t);e(e=>({commentArrivals:e.commentArrivals.map(e=>({...e,messageIds:e.messageIds.filter(e=>!n.has(e))})).filter(e=>e.messageIds.length>0)}));try{await ad.acknowledgeArrivals(t)}catch{}},refreshCommentCounts(){return Tp?(Ep=!0,Tp):(Tp=(async()=>{do{Ep=!1;try{e({boardCommentCounts:await ad.summary()})}catch{}}while(Ep)})().finally(()=>{Tp=null}),Tp)},async refreshComments(){let n=t().currentBoardId;if(!n)e({commentThreads:[],activeCommentId:null});else try{let r=await ad.list(n,t().commentStatus,t().commentScope);e(e=>{let t=r.some(t=>t.id===e.activeCommentId);return{commentThreads:r,activeCommentId:t?e.activeCommentId:null,...!t&&e.activeCommentId?{selection:null,reveal:null,rightTab:`comments`}:{}}})}catch(e){H(e,`Could not load comments`)}},async refreshCloudComments(){let n=t().currentBoardId;if(!n)e({cloudComments:{available:!1,reason:`unsupported`}});else{e({cloudComments:void 0});try{let r=await ad.cloudAvailability(n);t().currentBoardId===n&&e({cloudComments:r})}catch{e({cloudComments:{available:!1,reason:`unsupported`}})}}},setCommentStatus(n){e({commentStatus:n}),t().refreshComments()},setCommentScope(n){e({commentScope:n}),t().refreshComments()},setActiveComment(n){n===null?e({activeCommentId:null,pendingCommentAnchor:null,selection:null,reveal:null,rightTab:`comments`}):(e(e=>({activeCommentId:n,pendingCommentAnchor:null,rightTab:`comments`,...Bf(e,`right`),markupVisible:!0})),t().locateComment(n))},locateComment(e){let n=t().commentThreads.find(t=>t.id===e);if(!n?.anchor)return;let r=n.anchor;if(r.kind===`board`){t().flyToBoardRect({x:r.x-7,y:r.y-7,w:14,h:14});return}if(n.anchorState.status===`attached`){t().locateNode(r.screenId,n.anchorState.resolvedPath.join(`.`),{frameId:r.frameId,preserveTab:!0});return}let i=t().boards[n.boardId]?.frames.find(e=>e.id===r.frameId);if(!i)return;let a=t().frameInsets[i.id]??{x:0,y:0,chromeH:0};t().flyToBoardRect(vp(i,a,r.bounds))},enterCommentMode(){t().commentOnSelection()||e(e=>({cursorMode:`comment`,hover:null,pendingCommentAnchor:null,activeCommentId:null,...kp(e)?{}:{rightTab:`comments`},markupVisible:!0}))},commentOnSelection(){let e=t(),n=e.selection,r=e.currentBoardId;if(!n||!r||n.screenId.startsWith(`snippet:`))return!1;let i=ef(e.screens,n);if(!i)return!1;let a=(e.boards[r]?.frames??[]).find(t=>t.screen===n.screenId&&e.nodeRects[t.id]?.[n.path]),o=a?e.nodeRects[a.id]?.[n.path]:void 0;if(!a||!o)return!1;let s=$d(i,n.path),c=e.pendingCommentAnchor;if(c?.kind===`node`&&c.frameId===a.id&&Sp(c.locator,s))return!0;let l=Cp(i);return t().beginComment({kind:`node`,boardId:r,frameId:a.id,screenId:n.screenId,locator:s,bounds:o,...l&&{fingerprint:l}}),!0},beginComment(t){e(e=>({pendingCommentAnchor:t,activeCommentId:null,cursorMode:`select`,...kp(e)?{}:{rightTab:`comments`},markupVisible:!0}))},clearPendingComment(){e({pendingCommentAnchor:null})},async createPendingComment(n,r=`local`){let i=t().currentBoardId,a=t().pendingCommentAnchor;if(!i||!a||!n.trim())return`There is nothing to post.`;if(r===`shared`){let e=await Op(t,i);if(e)return e;if(t().pendingCommentAnchor!==a)return null}try{let o=await ad.create({boardId:i,body:n,anchor:a,scope:r});if(kp(t()))return e(e=>({commentThreads:wp(e.commentThreads,o),pendingCommentAnchor:null})),await t().addCommentsToAgent([{threadId:o.id}]),null;let s=xp(t(),o);return e(e=>({commentThreads:wp(e.commentThreads,o),activeCommentId:o.id,pendingCommentAnchor:null,rightTab:`comments`,...Bf(e,`right`),...s})),Object.keys(s).length>0&&t().refreshComments(),null}catch(e){return H(e,`Could not create comment`),`The daemon refused the comment. Its message has the details.`}},async createBoardComment(n,r=`local`){let i=t().currentBoardId;if(!i||!n.trim())return`There is nothing to post.`;if(r===`shared`){let e=await Op(t,i);if(e)return e}try{let a=await ad.create({boardId:i,body:n,scope:r});if(kp(t()))return e(e=>({commentThreads:wp(e.commentThreads,a)})),await t().addCommentsToAgent([{threadId:a.id}]),null;let o=xp(t(),a);return e(e=>({commentThreads:wp(e.commentThreads,a),activeCommentId:a.id,pendingCommentAnchor:null,rightTab:`comments`,...o})),Object.keys(o).length>0&&t().refreshComments(),null}catch(e){return H(e,`Could not create comment`),`The daemon refused the comment. Its message has the details.`}},async replyToComment(t,n){if(n.trim())try{let r=await ad.reply(t,n);e(e=>({commentThreads:wp(e.commentThreads,r)}))}catch(e){H(e,`Could not reply`)}},async deleteCommentMessage(n,r){let i=t().commentThreads.find(e=>e.id===n);if(i?.scope===`local`&&i.messages.length===1)await t().deleteComment(n);else try{let t=await ad.deleteMessage(n,r);e(e=>({commentThreads:wp(e.commentThreads,t)}))}catch(e){H(e,`Could not delete comment`)}},async setCommentResolved(n,r){try{let i=await ad.update(n,{resolved:r});t().commentStatus===`all`||t().commentStatus===i.status?e(e=>({commentThreads:wp(e.commentThreads,i)})):e(e=>({commentThreads:e.commentThreads.filter(e=>e.id!==n),activeCommentId:e.activeCommentId===n?null:e.activeCommentId,...e.activeCommentId===n?{selection:null,reveal:null,rightTab:`comments`}:{}}))}catch(e){H(e,r?`Could not resolve comment`:`Could not reopen comment`)}},async moveCommentToCloud(n){let r=t().commentThreads.find(e=>e.id===n);if(!r)return;let i=await Op(t,r.boardId);if(i)V({kind:`error`,title:`The thread is still local`,message:i});else try{let t=await ad.update(n,{scope:`shared`});e(e=>{let r=e.commentThreads.filter(e=>e.id!==n),i=e.commentScope!==`local`;return{commentThreads:i?wp(r,t):r,activeCommentId:i?t.id:null,...i?{}:{selection:null,reveal:null,rightTab:`comments`}}})}catch(e){H(e,`Could not move the comment to the cloud`)}},async deleteComment(t){try{await ad.delete(t),e(e=>({commentThreads:e.commentThreads.filter(e=>e.id!==t),activeCommentId:e.activeCommentId===t?null:e.activeCommentId,...e.activeCommentId===t?{selection:null,reveal:null,rightTab:`comments`}:{}}))}catch(e){H(e,`Could not delete comment`)}}});function jp(e){if(e.view===`language`)return e.languageTheme;let t=e.currentBoardId;return(t?e.boards[t]?.theme:void 0)??`default`}var Mp=0,Np=(e,t)=>({design:null,folderConfig:null,screens:{},boards:{},currentBoardId:null,currentScreenId:null,screenVersion:0,screenVersions:{},renderErrors:{},components:null,componentsLoading:!1,generatedAssets:{},styleChannel:null,channelsByLibrary:{},theme:null,themeName:`default`,themeVersion:0,typesetDraft:null,fontDraft:null,history:{undo:0,redo:0},wsConnected:!1,wsEverConnected:!1,bootError:null,async refreshHistory(){try{e({history:await md()})}catch{}},async loadDesign(n){let r;try{r=await Ju()}catch(t){e({bootError:t instanceof Error?t.message:String(t)});return}e({design:r,bootError:null}),t().refreshCommentCounts();let i=e=>e&&r.boards.some(t=>t.id===e)?e:null,a=i(n?.boardId)??t().currentBoardId??i(r.defaultBoard)??i(yf())??r.boards[0]?.id??null;a&&await t().selectBoard(a);let o=n?.screenId&&r.screens.some(e=>e.id===n.screenId)?n.screenId:null;if(o&&o!==t().currentScreenId&&await t().selectScreen(o),!t().currentScreenId){let e=(r.defaultScreen&&r.screens.some(e=>e.id===r.defaultScreen)?r.defaultScreen:null)??r.screens[0]?.id??null;e&&await t().selectScreen(e)}await t().loadTheme(),await t().refreshHistory()},async refreshDesignSummary(){e({design:await Ju()})},async loadFolderConfig(){e({folderConfig:await od()})},async setBoardArchived(n,r){if(await B.updateBoard({boardId:n,patch:{archived:r}}),await t().refreshDesignSummary(),!r||t().currentBoardId!==n)return;let i=t().design?.boards[0]?.id??null;i?await t().selectBoard(i):(e({currentBoardId:null,currentScreenId:null,annotations:[],notes:[],commentThreads:[]}),t().setEditingMarkupId(null))},reorderBoardsLocal(t){e(e=>{if(!e.design)return e;let n=new Map(e.design.boards.map(e=>[e.id,e])),r=[];for(let e of t){let t=n.get(e);t&&(r.push(t),n.delete(e))}for(let t of e.design.boards)n.has(t.id)&&r.push(t);return{design:{...e.design,boards:r}}})},async loadComponents(){if(t().loadRepoCatalog(),!(t().components||t().componentsLoading)){e({componentsLoading:!0});try{let{manifest:t,styleChannel:n,channelsByLibrary:r}=await ed();e({components:t,styleChannel:n,channelsByLibrary:r})}finally{e({componentsLoading:!1})}}},async loadGeneratedAssets(){try{e({generatedAssets:await Hu()})}catch{e({generatedAssets:{}})}},async loadTheme(){let n=jp(t()),r=++Mp,i=await td(n);r===Mp&&e({theme:i,themeName:n,themeVersion:t().themeVersion+1})},async refreshTheme(){let n=jp(t());e({theme:await td(n),themeName:n,typesetDraft:null,fontDraft:null,themeVersion:t().themeVersion+1})},async syncThemeToBoard(){t().theme&&t().themeName!==jp(t())&&await t().loadTheme()},setTypesetDraft(t){e({typesetDraft:t})},setFontDraft(t){e({fontDraft:t})},async loadScreen(t){try{let n=await Yu(t);return e(e=>({screens:{...e.screens,[t]:n},screenVersion:e.screenVersion+1,screenVersions:{...e.screenVersions,[t]:(e.screenVersions[t]??0)+1}})),n}catch{return null}},async loadBoard(n){try{let r=await Xu(n);e(e=>({boards:{...e.boards,[n]:r}}));let i=new Set;for(let e of r.frames)i.add(e.screen);for(let e of i)t().screens[e]||await t().loadScreen(e);return r}catch{return null}},async refreshBoard(n){try{let r=await Xu(n);e(e=>({boards:{...e.boards,[n]:r},design:e.design?{...e.design,boards:e.design.boards.map(e=>e.id===n?{...e,name:r.name,frameCount:r.frames.length,group:r.group??null}:e)}:e.design}));let i=t().design;i&&i.boards.some(e=>e.id===n)===!!r.archivedAt&&await t().refreshDesignSummary();for(let e of r.frames)t().screens[e.screen]||await t().loadScreen(e.screen);let a=r.frames[0]?.screen;n===t().currentBoardId&&!t().currentScreenId&&a&&await t().selectScreen(a),n===t().currentBoardId&&await t().syncThemeToBoard()}catch{try{let r=await Ju();e({design:r}),r.boards.some(e=>e.id===n)||await t().pruneBoard(n)}catch{}}},async pruneBoard(n){if(e(e=>{let{[n]:t,...r}=e.boards;return{boards:r,design:e.design?{...e.design,boards:e.design.boards.filter(e=>e.id!==n)}:e.design}}),t().currentBoardId!==n)return;let r=t().design?.boards[0]?.id??null;r?await t().selectBoard(r):(e({currentBoardId:null,currentScreenId:null,annotations:[],notes:[]}),t().setEditingMarkupId(null))},pruneScreens(t){if(t.length===0)return;let n=new Set(t);e(e=>({screens:Object.fromEntries(Object.entries(e.screens).filter(([e])=>!n.has(e))),design:e.design?{...e.design,screens:e.design.screens.filter(e=>!n.has(e.id))}:e.design,...e.currentScreenId&&n.has(e.currentScreenId)?{currentScreenId:null,annotations:[]}:{}}))},async selectBoard(n){let r=t().boards[n];if(!r){let e=await t().loadBoard(n);if(!e)return;r=e}e({currentBoardId:n,notes:[],commentThreads:[],activeCommentId:null}),bf(n);let i=new Set(r.frames.map(e=>e.screen)),a=t().currentScreenId;if(r.frames.length===0)a&&(e({currentScreenId:null,annotations:[]}),t().setEditingMarkupId(null));else if(!a||!i.has(a)){let e=r.frames[0]?.screen;e&&await t().selectScreen(e)}else await t().refreshAnnotations();await t().refreshNotes(),await t().refreshComments(),await t().syncThemeToBoard()},async selectScreen(n){let r=t().screens[n];if(!r){let e=await t().loadScreen(n);if(!e)return;r=e}t().setEditingMarkupId(null),e({currentScreenId:n}),await t().refreshAnnotations()},async refreshScreen(n){try{let r=await Yu(n);e(e=>({screens:{...e.screens,[n]:r},screenVersion:e.screenVersion+1,screenVersions:{...e.screenVersions,[n]:(e.screenVersions[n]??0)+1}}));let i=t().currentBoardId,a=i?t().boards[i]:null;a?.frames.some(e=>e.screen===n)&&await t().refreshAnnotations(),a?.frames.some(e=>e.screen===n)&&await t().refreshComments()}catch{await t().loadDesign()}},reportRenderError(t,n){e(e=>e.renderErrors[t]===n?e:{renderErrors:{...e.renderErrors,[t]:n}})},setWsConnected(t){e(e=>({wsConnected:t,wsEverConnected:e.wsEverConnected||t}))},async resyncAfterReconnect(){try{await t().refreshDesignSummary(),await t().refreshTheme(),await t().refreshHistory();let e=t().currentBoardId;e&&await t().refreshBoard(e);for(let e of Object.keys(t().screens))e.startsWith(`snippet:`)||await t().refreshScreen(e);await t().refreshAnnotations(),await t().refreshNotes(),await t().refreshComments(),await t().refreshCommentCounts()}catch{}},async reloadAll(){let n=await Ju(),r=t().currentBoardId,i=t().currentScreenId;e({design:n,screens:{},boards:{},currentBoardId:r&&n.boards.some(e=>e.id===r)?r:null,currentScreenId:i&&n.screens.some(e=>e.id===i)?i:null,annotations:[],notes:[],commentThreads:[],activeCommentId:null}),t().setEditingMarkupId(null),await t().loadDesign()}}),Pp={left:{x:-1,y:0},right:{x:1,y:0},top:{x:0,y:-1},bottom:{x:0,y:1}},Fp={left:0,top:90,right:180,bottom:-90},Ip=32,Lp=220;function Rp(e,t,n){switch(t){case`left`:return{x:e.x,y:e.y+e.h*n};case`right`:return{x:e.x+e.w,y:e.y+e.h*n};case`top`:return{x:e.x+e.w*n,y:e.y-(e.head??0)};case`bottom`:return{x:e.x+e.w*n,y:e.y+e.h}}}function zp(e,t){if(e.x+e.w<=t.x)return[`right`,`left`];if(t.x+t.w<=e.x)return[`left`,`right`];if(e.y+e.h<=t.y)return[`bottom`,`top`];if(t.y+t.h<=e.y)return[`top`,`bottom`];let n=t.x+t.w/2-(e.x+e.w/2),r=t.y+t.h/2-(e.y+e.h/2);return Math.abs(n)>=Math.abs(r)?n>=0?[`right`,`left`]:[`left`,`right`]:r>=0?[`bottom`,`top`]:[`top`,`bottom`]}var Bp=e=>Math.round(e*10)/10;function Vp(e,t){let n=(e,t)=>t===`left`||t===`right`?e.y+e.h/2:e.x+e.w/2,r=t.map(t=>{let n=e.get(t.from),r=e.get(t.to);if(!n||!r)return null;let[i,a]=zp(n,r);return{from:n,to:r,leave:i,enter:a}}),i=new Map,a=(e,t,n,r)=>{let a=`${e}\u0000${t}`,o=i.get(a);o?o.push({index:n,toward:r}):i.set(a,[{index:n,toward:r}])};r.forEach((e,r)=>{if(!e)return;let i=t[r];a(i.from,e.leave,r,n(e.to,e.leave)),a(i.to,e.enter,r,n(e.from,e.enter))});let o=(e,t,n)=>{let r=[...i.get(`${e}\u0000${t}`)??[]].sort((e,t)=>e.toward-t.toward||e.index-t.index);return(r.findIndex(e=>e.index===n)+1)/(r.length+1)};return r.map((e,n)=>{if(!e)return null;let r=t[n],i=o(r.from,e.leave,n);return{...Up(Rp(e.from,e.leave,i),e.leave,Rp(e.to,e.enter,o(r.to,e.enter,n)),e.enter),lane:i<.5?-1:+(i>.5)}})}function Hp(e,t){let[n,r]=zp(e,{x:t.x,y:t.y,w:0,h:0});return Up(Rp(e,n,.5),n,t,r)}function Up(e,t,n,r){let i=Pp[t],a=Pp[r],o=Math.hypot(n.x-e.x,n.y-e.y),s=Math.max(Ip,Math.min(Lp,o*.4)),c={x:e.x+i.x*s,y:e.y+i.y*s},l={x:n.x+a.x*s,y:n.y+a.y*s};return{d:`M ${Bp(e.x)} ${Bp(e.y)} C ${Bp(c.x)} ${Bp(c.y)}, ${Bp(l.x)} ${Bp(l.y)}, ${Bp(n.x)} ${Bp(n.y)}`,start:e,end:n,c1:c,c2:l,mid:{x:Bp((e.x+3*c.x+3*l.x+n.x)/8),y:Bp((e.y+3*c.y+3*l.y+n.y)/8)},angle:Fp[r],lane:0}}function Wp(e,t,n=0){for(let r=e.length-1;r>=0;r--){let i=e[r];if(t.x>=i.x-n&&t.x<=i.x+i.w+n&&t.y>=i.y-n&&t.y<=i.y+i.h+n)return i.id}return null}var Gp=e=>[e.start,e.c1,e.c2,e.end],Kp=(e,t,n)=>({x:e.x+(t.x-e.x)*n,y:e.y+(t.y-e.y)*n});function qp([e,t,n,r],i){let a=Kp(e,t,i),o=Kp(t,n,i),s=Kp(n,r,i),c=Kp(a,o,i),l=Kp(o,s,i),u=Kp(c,l,i);return[[e,a,c,u],[u,l,s,r]]}function Jp(e,t){let[n,r]=qp(Gp(e),t),i=n[3],a=t<=0?r[0]:n[2],o=t>=1?n[3]:r[1],s=o.x-a.x,c=o.y-a.y;return{x:Bp(i.x),y:Bp(i.y),angle:s===0&&c===0?e.angle:Math.atan2(c,s)*180/Math.PI}}var Yp=48;function Xp(e,t){let n=Gp(e),r=e=>{let r=qp(n,e)[0][3];return(r.x-t.x)**2+(r.y-t.y)**2},i=0;for(let e=1;e<=Yp;e++)r(e/Yp)<r(i)&&(i=e/Yp);let a=Math.max(0,i-1/Yp),o=Math.min(1,i+1/Yp);for(let e=0;e<12;e++){let e=(o-a)/3;r(a+e)<r(o-e)?o-=e:a+=e}return(a+o)/2}function Zp(e,t,n=0){if(t.length===0)return[[0,1]];let r=Gp(e),i=e=>{let i=qp(r,e)[0][3];return t.some(e=>{let t=e.y-(e.head??0)-n;return i.x>e.x-n&&i.x<e.x+e.w+n&&i.y>t&&i.y<e.y+e.h+n})},a=(e,t)=>{let n=e,r=t;for(let e=0;e<14;e++){let e=(n+r)/2;i(e)?r=e:n=e}return n},o=[],s=i(0)?null:0;for(let e=1;e<=Yp;e++){let t=e/Yp,n=(e-1)/Yp,r=i(t);r&&s!==null?(o.push([s,a(n,t)]),s=null):!r&&s===null&&(s=a(t,n))}return s!==null&&o.push([s,1]),o}function Qp(e,t,n){if(t<=0&&n>=1)return e.d;let r=t<=0?Gp(e):qp(Gp(e),t)[1],[i,a,o,s]=n>=1?r:qp(r,(n-t)/(1-t))[0];return`M ${Bp(i.x)} ${Bp(i.y)} C ${Bp(a.x)} ${Bp(a.y)}, ${Bp(o.x)} ${Bp(o.y)}, ${Bp(s.x)} ${Bp(s.y)}`}function $p(e){if(e.some(([e,t])=>e<=.5&&t>=.5))return .5;let t;for(let n of e)(!t||n[1]-n[0]>t[1]-t[0])&&(t=n);return t?(t[0]+t[1])/2:.5}function W(...e){return v(S(e))}var em=`w-auto`,G=i(),tm=d(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function K({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?N:`span`;return(0,G.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:W(tm({variant:t}),e),...r})}var nm=e=>`calc(${e}px / var(--canvas-zoom, 1))`,rm=`scale(calc(1 / var(--canvas-zoom, 1)))`,im=7,am=7,om={loading:`text-amber-500`,empty:`text-muted-foreground`,error:`text-destructive`,success:`text-emerald-500`},sm=e=>e.state===void 0?`text-foreground/60`:om[e.state]??`text-primary`,cm=e=>`${e.from}→${e.to}`;function lm(e,t,n){return e.map(e=>{let r=t[e.id]??{x:0,y:0};return{id:e.id,x:e.x+r.x,y:e.y+r.y,w:e.w,h:e.h,head:r.y/(n||1)}})}function um(e,t,n){let r=Vp(new Map(e.map(e=>[e.id,e])),t);return t.flatMap((t,i)=>{let a=r[i];if(!a)return[];let o=Zp(a,e.filter(e=>e.id!==t.from&&e.id!==t.to),im/(n||1));return[{key:cm(t),edge:t,route:a,spans:o}]})}var dm=[[0,1]];function fm({route:e,spans:t=dm,dashed:n,firm:r=!1}){let i={strokeWidth:nm(r?2.25:1.5),...n?{strokeDasharray:`${nm(6)} ${nm(5)}`}:{}},a=t.flatMap(([e,t])=>[...e>0?[e]:[],...t<1?[t]:[]]),o=t.at(-1)?.[1]===1;return(0,G.jsxs)(G.Fragment,{children:[t.map(([t,n])=>(0,G.jsx)(`path`,{d:Qp(e,t,n),fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,style:i},t)),a.map(t=>{let n=Jp(e,t);return(0,G.jsx)(`path`,{"data-flow-cut":!0,d:`M 0 -6 L 0 6`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,style:{transform:`translate(${n.x}px, ${n.y}px) rotate(${n.angle}deg) ${rm}`}},t)}),o?(0,G.jsx)(`path`,{d:`M 0 0 L -10 -4.5 L -10 4.5 Z`,fill:`currentColor`,style:{transform:`translate(${e.end.x}px, ${e.end.y}px) rotate(${e.angle}deg) ${rm}`}}):null]})}function pm({routed:{key:e,edge:t,route:n,spans:r},near:i,onNear:a,onPick:o}){return(0,G.jsxs)(`g`,{"data-flow-edge":e,"data-flow-state":t.state??``,className:sm(t),children:[(0,G.jsx)(fm,{route:n,spans:r,dashed:t.state!==void 0,firm:i}),r.map(([r,i])=>(0,G.jsx)(`path`,{"data-flow-hit":!0,d:Qp(n,r,i),fill:`none`,stroke:`transparent`,style:{strokeWidth:nm(14),pointerEvents:`stroke`,...o?{cursor:`pointer`}:{}},onPointerEnter:()=>a(e),onPointerLeave:()=>a(null),onClick:o?()=>o(t):void 0},r))]})}function mm(e,t){let n=e*Math.PI/180;return Math.abs(Math.cos(n))>=Math.abs(Math.sin(n))?t===1?`translate(0, calc(50% + ${am}px))`:`translate(0, calc(-50% - ${am}px))`:t===-1?`translate(calc(-50% - ${am}px), 0)`:`translate(calc(50% + ${am}px), 0)`}function hm({routed:{key:e,edge:t,route:n,spans:r},at:i,bare:a=!1,near:o,forward:s=!1,onNear:c,children:l}){let u=Jp(n,i??t.labelAt??$p(r));return(0,G.jsx)(`div`,{"data-flow-label":e,"data-flow-near":o||s?``:void 0,className:`absolute opacity-70 transition-opacity data-[flow-near]:opacity-100`,style:{left:u.x,top:u.y,transform:`translate(-50%, -50%) ${rm}${a?``:` ${mm(u.angle,n.lane)}`}`},onPointerEnter:()=>c(e),onPointerLeave:()=>c(null),children:l})}var gm=`flex max-w-60 items-center rounded-full border border-border bg-background py-0.5 pr-2 pl-0.5 text-xs text-foreground shadow-xs`;function _m({edge:e}){return(0,G.jsxs)(G.Fragment,{children:[e.state===void 0?null:(0,G.jsx)(K,{variant:`outline`,className:`${sm(e)} bg-background`,children:e.state}),e.label===void 0?null:(0,G.jsx)(`span`,{className:`truncate ${e.state===void 0?`pl-0.5`:``}`,children:e.label})]})}function vm({frames:e,insets:t,zoom:n,edges:r,onPick:i,label:a,overlay:o}){let[s,c]=(0,P.useState)(null),l=um(lm(e,t,n),Us({frames:e,edges:r?[...r]:[]}),n);return l.length===0&&!o?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`svg`,{"data-flow-layer":!0,"aria-hidden":`true`,width:`1`,height:`1`,className:`pointer-events-none absolute left-0 top-0 overflow-visible`,children:[l.map(e=>(0,G.jsx)(pm,{routed:e,near:s===e.key,onNear:c,onPick:i},e.key)),o]}),l.map(e=>{let t=s===e.key;return a?(0,G.jsx)(P.Fragment,{children:a({routed:e,near:t,onNear:c})},e.key):e.edge.label===void 0&&e.edge.state===void 0?null:(0,G.jsx)(hm,{routed:e,near:t,onNear:c,children:(0,G.jsx)(`div`,{className:`${gm} pl-2`,children:(0,G.jsx)(_m,{edge:e.edge})})},e.key)})]})}var ym=(e,t)=>e!==null&&t!==null&&e.from===t.from&&e.to===t.to;function bm(e,t){return lm(t.frames.map(t=>({...t,...e.frameDrafts[t.id]})),e.frameInsets,e.canvasZoom)}var xm=(e,t)=>({frameDrafts:{},flowDraft:null,activeFlowEdge:null,setFrameDraft(t,n){e(e=>{if(n===null){if(!(t in e.frameDrafts))return e;let{[t]:n,...r}=e.frameDrafts;return{frameDrafts:r}}return{frameDrafts:{...e.frameDrafts,[t]:n}}})},setFlowDraft(t){e({flowDraft:t})},setActiveFlowEdge(t){e({activeFlowEdge:t})},async connectFrames(n){let r=t().currentBoardId;if(!r)return null;try{let i=await B.connectFrames({boardId:r,edges:n});e(e=>{let t=e.boards[r];if(!t)return e;let{edges:n,...a}=t,o=i.edges.length>0?{...a,edges:i.edges}:a;return{boards:{...e.boards,[r]:o}}}),i.readAsTransitions?.length&&V({message:`That arrow leads back into its own step, so it stays a transition — the frame it points at is already part of the step.`});let a=t().activeFlowEdge;return a&&!i.edges.some(e=>ym(e,a))&&e({activeFlowEdge:null}),i.edges}catch(e){return H(e,`Could not update the flow`),null}}}),Sm=e=>({rightTab:`agent`,nodeState:`default`,browsingFaces:!1,setRightTab(t){e({rightTab:t})},setNodeState(t){e({nodeState:t})},setBrowsingFaces(t){e({browsingFaces:t})}}),Cm=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function wm(e,t,n){let r=e.theme,i=e=>[e.colors,e.colorsDark,e.palette,e.paletteDark];return[...Cm(i(r),i(t))?[]:[`colour`],...Cm(r.typography,t.typography)?[]:[`type`],...Cm(r.radius,t.radius)?[]:[`corners`],...e.rules.intent===n.intent&&Cm(e.rules.rules,n.rules)?[]:[`rules`]]}var Tm=0,Em=(e,t)=>{let n=0,r=null,i=e=>{if(r)return r.catch(()=>{});let t=e().finally(()=>{r=null});return r=t,t},a=async()=>{t().view===`language`&&(n++,e({view:`boards`,languageBaseline:null,languageThemeIsNew:!1}),await t().loadTheme())},o=()=>{let{currentBoardId:e,boards:n}=t();return(e?n[e]?.theme:void 0)??`default`},s=async(r,i,o)=>{let s=++n;e({view:`language`,languageMode:r,languageTheme:i,languageThemeIsNew:o,languageBaseline:null,libraryItem:null,selection:null,hover:null,snippetFocus:null}),t().loadFolderConfig();let c;try{[c]=await Promise.all([ld.fetch(),t().loadTheme()])}catch(e){if(s!==n)return;throw await a().catch(()=>{}),e}if(s!==n)return;let{rules:l,frameworkRoles:u}=c,d=t().theme;e({languageRules:l,frameworkRoles:u,languageScheme:t().designMode,languageBaseline:d?{theme:d,rules:l}:null})};return{languageRules:null,languageMode:`review`,languageTheme:`default`,languageThemeIsNew:!1,languageBaseline:null,languageScheme:`light`,frameworkRoles:null,languageHandoff:null,dismissLanguageHandoff(){e({languageHandoff:null})},setLanguageScheme(t){e({languageScheme:t})},openLanguage(e=`review`,t){return s(e,t??o(),!1)},async startTheme(e){await Nd.addTheme(e,o()),await s(`guided`,e,!0)},finishLanguage(){return i(async()=>{let{languageBaseline:n,languageTheme:r,languageThemeIsNew:i,theme:o,languageRules:s,currentBoardId:c}=t(),l=n&&o&&s?wm(n,o,s):[];i&&c&&await B.updateBoard({boardId:c,patch:{theme:r}}),await a();let u=Object.values(t().boards).filter(e=>i?e.id===c:(e.theme??`default`)===r).map(e=>e.name);l.length>0&&u.length>0&&e({languageHandoff:{theme:r,areas:l,boards:u}})})},cancelLanguage(){return i(async()=>{let{languageBaseline:n,languageTheme:r,languageThemeIsNew:i}=t();if(n){let{source:t}=n.rules,{rules:a}=await ld.restore({...i?{}:{theme:n.theme,name:r},...t&&!t.writable?{}:{rules:t?{intent:n.rules.intent,rules:n.rules.rules}:null}});e({languageRules:a})}i&&(await Nd.removeTheme(r),t().loadFolderConfig()),await a()})},async refreshLanguage(){let{rules:t,frameworkRoles:n}=await ld.fetch();e(Tm===0?{languageRules:t,frameworkRoles:n}:{frameworkRoles:n})},async saveRules(n){let r=t().languageRules;r&&e({languageRules:{...r,...n}}),Tm++;try{let{rules:t}=await ld.saveRules(n);Tm===1&&e({languageRules:t})}catch(t){throw Tm===1&&e({languageRules:(await ld.fetch()).rules}),t}finally{Tm--}}}},Dm=(e,t)=>({view:`boards`,libraryItem:null,lastLibraryItem:null,editingSnippetId:null,preSnippetView:null,setView(n){let{libraryItem:r,lastLibraryItem:i}=t();e(n===`boards`?{view:n,libraryItem:null,lastLibraryItem:r}:n===`library`?{view:n,libraryItem:r??i}:{view:n}),(n===`library`||n===`snippet`)&&t().loadComponents()},openLibrary(n){e({view:`library`,libraryItem:n??null,lastLibraryItem:null}),t().loadComponents()},closeLibrary(){e(e=>({view:`boards`,libraryItem:null,lastLibraryItem:e.libraryItem}))},openSnippetEditor(n){let r=t().view;e({view:`snippet`,editingSnippetId:n,preSnippetView:r===`snippet`?t().preSnippetView:r,selection:null,hover:null,snippetFocus:null}),t().loadComponents()},closeSnippetEditor(){let n=t().preSnippetView??`boards`;e(e=>{let t={};for(let[n,r]of Object.entries(e.screens))n.startsWith(`snippet:`)||(t[n]=r);return{view:n,editingSnippetId:null,preSnippetView:null,selection:null,hover:null,screens:t}})},setSyntheticScreen(t,n){e(e=>{let r=e.screens[t];return r&&JSON.stringify(r)===JSON.stringify(n)?e:{screens:{...e.screens,[t]:n},screenVersion:e.screenVersion+1,screenVersions:{...e.screenVersions,[t]:(e.screenVersions[t]??0)+1}}})}}),Om=(e,t)=>{let n=new Gd,r=0;return{repoCatalog:null,repoCatalogLoading:!1,repoStatus:{},async loadRepoCatalog(){if(t().repoCatalog||t().repoCatalogLoading)return;e({repoCatalogLoading:!0});let n=r,i;try{i=await Td()}catch{i={entries:[],apps:[],warnings:[]}}n===r&&e({repoCatalog:i,repoCatalogLoading:!1})},async reloadRepoCatalog(){let i=t().repoCatalog!==null||t().repoCatalogLoading;r+=1,n.reset(),e({repoCatalog:null,repoCatalogLoading:!1,repoStatus:{}}),i&&await t().loadRepoCatalog()},async refreshRepoStatus(n){e(e=>{let t={...e.repoStatus};for(let e of n)delete t[e];return{repoStatus:t}}),await t().loadRepoStatus(n)},async loadRepoStatus(r){await n.load(r,t().repoStatus,async e=>new Map((await Ed(e)).map(e=>[e.id,e])),t=>e(e=>({repoStatus:{...e.repoStatus,...t}})))}}};function km(e,t){if(!e)return null;let n=Ic(t);return e.entries.find(e=>e.key===n)??null}var Am=0;function jm(){Am+=1}var Mm=null,Nm=450,Pm=280,Fm=48,Im=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2;function Lm(e,t,n,r=Nm,i){let a=++Am,o=performance.now(),s=c=>{if(a!==Am)return;let l=Math.min(1,(c-o)/r),u=Im(l);e({canvasZoom:t.zoom+(n.zoom-t.zoom)*u,pan:{x:t.pan.x+(n.pan.x-t.pan.x)*u,y:t.pan.y+(n.pan.y-t.pan.y)*u}}),l<1?requestAnimationFrame(s):i?.()};requestAnimationFrame(s)}function Rm(e){let t=e.notes.find(t=>t.id===e.editingMarkupId),n=(e.currentBoardId?e.boards[e.currentBoardId]:void 0)?.frames.find(e=>e.id===t?.attachment?.frameId);if(!t||!n)return null;let r=e.frameInsets[n.id]??{x:0,y:0},i=t.resolved&&e.nodeRects[n.id]?.[t.resolved.join(`.`)]||{x:0,y:0,w:n.w,h:n.h};return{node:{x:n.x+r.x+i.x,y:n.y+r.y+i.y,w:i.w,h:i.h},card:{w:t.width+16,h:(t.height??120)+16,gap:0}}}var zm=()=>document.querySelector(`[data-velloo-board="true"]`),Bm=320;function Vm(e,t){let n=Am,r=performance.now()+Bm,i=`${e.clientWidth}x${e.clientHeight}`,a=o=>{if(n!==Am)return;let s=`${e.clientWidth}x${e.clientHeight}`;s===i||o>=r?t():(i=s,requestAnimationFrame(a))};requestAnimationFrame(a)}var Hm=(e,t)=>({canvasZoom:.75,cursorMode:`select`,pan:{x:0,y:0},nodeRects:{},snippetRects:{},frameInsets:{},rectProbe:null,setCanvasZoom(n){jm(),t().editingMarkupId||(Mm=null),e({canvasZoom:Math.max(dp,Math.min(4,n))})},setCursorMode(t){e({cursorMode:t,hover:null})},setPan(n){jm(),t().editingMarkupId||(Mm=null),e({pan:n})},zoomAtViewportCenter(n){let r=zm();if(!r){if(n.zoom!==void 0)e({canvasZoom:Math.max(dp,Math.min(4,n.zoom))});else if(n.factor!==void 0){let r=t().canvasZoom*n.factor;e({canvasZoom:Math.max(dp,Math.min(4,r))})}return}let i={zoom:t().canvasZoom,pan:t().pan},a=n.factor??(n.zoom!==void 0&&i.zoom>0?n.zoom/i.zoom:1),o=bp(r.clientWidth/2,r.clientHeight/2,a,i);(o.zoom!==i.zoom||o.pan.x!==i.pan.x||o.pan.y!==i.pan.y)&&(jm(),t().editingMarkupId||(Mm=null),e({canvasZoom:o.zoom,pan:o.pan}))},zoomForMarkupEdit(){let n={zoom:t().canvasZoom,pan:t().pan};Mm||=n;let r=Rm(t());if(r){t().zoomForCommentDraft(r.node,r.card);return}if(Math.abs(n.zoom-1)<.02)return;let i=zm();if(!i){e({canvasZoom:1});return}let a=t().notes.find(e=>e.id===t().editingMarkupId),o=a&&!a.attachment&&a.x!==void 0&&a.y!==void 0?{x:a.x*n.zoom+n.pan.x,y:a.y*n.zoom+n.pan.y}:{x:i.clientWidth/2,y:i.clientHeight/2};Lm(e,n,{zoom:1,pan:bp(o.x,o.y,1/n.zoom,n).pan},Pm)},zoomForCommentDraft(n,r){Mm||={zoom:t().canvasZoom,pan:t().pan};let i=zm();i&&Vm(i,()=>{let a=_p(n,r,i.clientWidth,i.clientHeight,Fm);a&&Lm(e,{zoom:t().canvasZoom,pan:t().pan},a,Pm)})},restoreViewAfterMarkupEdit(){let n=Mm;if(!n)return;jm();let r={zoom:t().canvasZoom,pan:t().pan};Math.abs(r.zoom-n.zoom)<.001&&r.pan.x===n.pan.x&&r.pan.y===n.pan.y?Mm=null:Lm(e,r,n,Pm,()=>{Mm=null})},centerOnFrame(n){let r=t(),i=(r.currentBoardId?r.boards[r.currentBoardId]:null)?.frames.find(e=>e.id===n),a=zm();if(!i||!a)return;let o=yp(i,a.clientWidth,a.clientHeight);o&&e({canvasZoom:o.zoom,pan:o.pan})},flyToFrame(n){let r=t(),i=(r.currentBoardId?r.boards[r.currentBoardId]:null)?.frames.find(e=>e.id===n),a=zm();if(!i||!a)return;let o=yp(i,a.clientWidth,a.clientHeight);o&&Lm(e,{zoom:r.canvasZoom,pan:r.pan},o)},flyToBoardRect(n){let r=zm();if(!r)return;let i=t(),a=gp(n,r.clientWidth,r.clientHeight);a&&Lm(e,{zoom:i.canvasZoom,pan:i.pan},a)},async locateNode(n,r,i={}){let a=t(),o=i.hostBoards??[],s=a.currentBoardId&&(a.boards[a.currentBoardId]?.frames.some(e=>e.screen===n)||o.includes(a.currentBoardId))?a.currentBoardId:Object.values(a.boards).find(e=>e.frames.some(e=>e.screen===n))?.id??o.find(e=>a.design?.boards.some(t=>t.id===e))??null;if(s&&s!==a.currentBoardId&&await a.selectBoard(s),t().revealSelection({screenId:n,path:r},i.preserveTab?{preserveTab:!0}:void 0),typeof document>`u`)return;let c=t().currentBoardId,l=c?t().boards[c]:null,u=i.frameId?l?.frames.find(e=>e.id===i.frameId&&e.screen===n):l?.frames.find(e=>e.screen===n);if(!u)return;e(e=>{let t=e.nodeRects[u.id],n=t?{...t}:void 0;return n&&delete n[r],{rectProbe:{frameId:u.id,path:r,nonce:(e.rectProbe?.nonce??0)+1},...n?{nodeRects:{...e.nodeRects,[u.id]:n}}:{}}});let d=await new Promise(e=>{let n=Date.now()+700,i=()=>{let a=t().nodeRects[u.id]?.[r];if(a&&a.w>0)return e(a);if(Date.now()>n)return e(null);setTimeout(i,60)};setTimeout(i,90)}),f=zm();if(!f)return;let p={zoom:t().canvasZoom,pan:t().pan};if(d){let n=gp(vp(u,t().frameInsets[u.id]??{x:0,y:0,chromeH:0},d),f.clientWidth,f.clientHeight);n&&Lm(e,p,n);return}let m=yp(u,f.clientWidth,f.clientHeight);m&&Lm(e,p,m)},setNodeRects(t,n){e(e=>{let r={},i={};for(let e of n){let t={x:e.x,y:e.y,w:e.w,h:e.h};if(!e.snippet){r[e.path]=t;continue}let n=i[e.path];n?n.push(t):i[e.path]=[t]}return{nodeRects:{...e.nodeRects,[t]:r},snippetRects:{...e.snippetRects,[t]:i}}})},clearNodeRects(t){e(e=>{if(!(t in e.nodeRects)&&!(t in e.snippetRects))return e;let{[t]:n,...r}=e.nodeRects,{[t]:i,...a}=e.snippetRects;return{nodeRects:r,snippetRects:a}})},setFrameInset(t,n){e(e=>{let r=e.frameInsets[t];if(n===null){if(!r)return e;let{[t]:n,...i}=e.frameInsets;return{frameInsets:i}}return r&&r.x===n.x&&r.y===n.y&&r.chromeH===n.chromeH?e:{frameInsets:{...e.frameInsets,[t]:n}}})}}),q=T()((...e)=>({...Np(...e),...tf(...e),...Hm(...e),...Jf(...e),...Sm(...e),...Dm(...e),...Em(...e),...Om(...e),...Jd(...e),...up(...e),...xm(...e),...Zd(...e),...Wd(...e),...Ap(...e),...ap(...e)}));function Um(e){return e===`system`?typeof window>`u`?`light`:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function Wm(){let e=q(e=>e.appTheme);(0,P.useEffect)(()=>{let t=()=>{let t=Um(e);document.documentElement.classList.toggle(`dark`,t===`dark`)};if(t(),e!==`system`)return;let n=window.matchMedia?.(`(prefers-color-scheme: dark)`);if(!n)return;let r=()=>t();return n.addEventListener(`change`,r),()=>n.removeEventListener(`change`,r)},[e])}function Gm(e,t){let n=[e,t].filter(e=>!!e);return n.length>0?`${n.join(` · `)} - velloo`:`velloo`}function Km({active:e=!0}){return(0,G.jsxs)(`span`,{className:`relative flex size-2 shrink-0`,"aria-hidden":!0,children:[e?(0,G.jsx)(`span`,{className:`absolute inline-flex size-full rounded-full bg-primary opacity-75 animate-ping motion-reduce:animate-none`}):null,(0,G.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full ${e?`bg-primary`:`bg-muted-foreground/40`}`})]})}var qm=d(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function J({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?N:`button`;return(0,G.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:W(qm({variant:t,size:n,className:e})),...i})}function Jm({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`empty`,className:W(`flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance`,e),...t})}function Ym({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`empty-header`,className:W(`flex max-w-sm flex-col items-center gap-2`,e),...t})}var Xm=d(`mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0`,{variants:{variant:{default:`bg-transparent`,icon:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4`}},defaultVariants:{variant:`default`}});function Zm({className:e,variant:t=`default`,...n}){return(0,G.jsx)(`div`,{"data-slot":`empty-icon`,"data-variant":t,className:W(Xm({variant:t,className:e})),...n})}function Qm({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`empty-title`,className:W(`cn-font-heading text-sm font-medium tracking-tight`,e),...t})}function $m({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`empty-description`,className:W(`text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function eh({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`empty-content`,className:W(`flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-sm text-balance`,e),...t})}var th=1e4;function nh(){let e=q(e=>e.lastAgentActivityAt),t=q(e=>e.activityFeedOpen),n=q(e=>e.setActivityFeedOpen),[,r]=(0,P.useState)(0);(0,P.useEffect)(()=>{if(e===null)return;let t=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(t)},[e]);let i=e!==null&&Date.now()-e<th;return(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>n(!t),title:i?`An agent is editing — click for the activity feed`:`Activity feed`,className:`gap-1.5`,"data-agent-active":i?`true`:`false`,children:[(0,G.jsx)(Km,{active:i}),(0,G.jsx)(an,{size:14})]})}function rh(e){let t=Math.max(0,Math.round((Date.now()-e)/1e3));if(t<5)return`now`;if(t<60)return`${t}s ago`;let n=Math.round(t/60);if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}var ih=e=>e.replaceAll(`_`,` `);function ah(e){let t=q.getState().design,n=[];if(e.boardId){let r=t?.boards.find(t=>t.id===e.boardId);if(!r)return{crumbs:[e.boardId],navigate:null,deleted:!0};n.push(r.name)}if(e.screenId){let r=t?.screens.find(t=>t.id===e.screenId);if(!r)return{crumbs:[...n,e.screenId],navigate:null,deleted:!0};r.name,n.push(r.name)}e.path&&n.push(`node ${e.path.join(`.`)}`),e.snippetId&&n.push(`snippet ${e.snippetId}`),e.token&&n.push(e.token),e.themeName&&n.push(`theme ${e.themeName}`),e.extension&&n.push(`extension ${e.extension}`);let r=e.screenId,i=e.boardId;return!r&&!i?{crumbs:n,navigate:null,deleted:!1}:{crumbs:n,navigate:()=>{(async()=>{let n=q.getState();if(n.view!==`boards`&&n.setView(`boards`),r&&e.path){await q.getState().locateNode(r,e.path.join(`.`),{hostBoards:[...i?[i]:[],...e.boards??[]]});return}let a=e.boards??[],o=i??(r?n.currentBoardId&&(n.boards[n.currentBoardId]?.frames.some(e=>e.screen===r)||a.includes(n.currentBoardId))?n.currentBoardId:Object.values(n.boards).find(e=>e.frames.some(e=>e.screen===r))?.id??a.find(e=>t?.boards.some(t=>t.id===e))??null:null);if(o&&o!==n.currentBoardId&&await n.selectBoard(o),r&&await q.getState().selectScreen(r),!o)return;let s=q.getState().boards[o]?.frames.find(t=>e.frameId?t.id===e.frameId:r?t.screen===r:!1);s&&requestAnimationFrame(()=>q.getState().flyToFrame(s.id))})()},deleted:!1}}function oh({source:e}){return e===`mcp`?(0,G.jsx)(an,{size:12,className:`text-primary shrink-0`}):e===`canvas`?(0,G.jsx)(wi,{size:12,className:`shrink-0 opacity-60`}):(0,G.jsx)(no,{size:12,className:`shrink-0 opacity-60`})}function sh({entry:e}){let[t,n]=(0,P.useState)(!1),r=ah(e.target),i=(e.opCount??0)>1||(e.ops?.length??0)>1,a=(e.opCount??0)-(e.ops?.length??0);return(0,G.jsxs)(`li`,{className:`border-b border-border/60 last:border-b-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-2 px-3 py-2`,children:[(0,G.jsx)(oh,{source:e.source}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`button`,{type:`button`,disabled:r.navigate===null,onClick:()=>r.navigate?.(),className:`block w-full text-left text-xs ${r.navigate?`hover:underline cursor-pointer`:`cursor-default`} ${r.deleted?`opacity-50`:``}`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:ih(e.verb)}),i?(0,G.jsxs)(K,{variant:`secondary`,className:`ml-1 px-1 py-0 text-[10px]`,children:[e.opCount??e.ops?.length,` ops`]}):null,r.deleted?(0,G.jsx)(K,{variant:`secondary`,className:`ml-1 px-1 py-0 text-[10px]`,children:`deleted`}):null,(0,G.jsx)(`span`,{className:`block truncate text-muted-foreground`,children:r.crumbs.join(` › `)||`—`})]}),(0,G.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:rh(e.ts)}),e.session?(0,G.jsxs)(K,{variant:`secondary`,className:`px-1 py-0`,title:`MCP session ${e.session}`,children:[`agent·`,e.session.slice(0,4)]}):null]})]}),i?(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`mt-0.5 shrink-0 text-muted-foreground hover:text-foreground`,title:t?`Collapse ops`:`Expand ops`,children:t?(0,G.jsx)(gn,{size:12}):(0,G.jsx)(bn,{size:12})}):null]}),t&&e.ops?(0,G.jsxs)(`ul`,{className:`mb-2 ml-8 mr-3 rounded bg-muted/40 px-2 py-1`,children:[e.ops.map((e,t)=>{let n=ah(e.target);return(0,G.jsx)(`li`,{className:`truncate py-0.5 text-[11px]`,children:(0,G.jsxs)(`button`,{type:`button`,disabled:n.navigate===null,onClick:()=>n.navigate?.(),className:n.navigate?`hover:underline`:`cursor-default opacity-60`,children:[ih(e.verb),(0,G.jsx)(`span`,{className:`ml-1 text-muted-foreground`,children:n.crumbs.join(` › `)})]})},t)}),a>0?(0,G.jsxs)(`li`,{className:`py-0.5 text-[11px] text-muted-foreground`,children:[`+`,a,` more`]}):null]}):null]})}function ch(){let e=q(e=>e.activityFeedOpen),t=q(e=>e.setActivityFeedOpen),n=q(e=>e.activityEvents),[,r]=(0,P.useState)(0);if((0,P.useEffect)(()=>{if(!e)return;let t=setInterval(()=>r(e=>e+1),3e4);return()=>clearInterval(t)},[e]),!e)return null;let i=[...n].reverse();return(0,G.jsxs)(`aside`,{"data-activity-feed":`true`,className:`fixed right-3 top-14 bottom-10 z-40 flex w-72 flex-col overflow-hidden rounded-lg border bg-background/95 shadow-lg backdrop-blur`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-semibold`,children:`Agent activity`}),(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,onClick:()=>t(!1),title:`Close`,children:(0,G.jsx)(Ho,{})})]}),i.length===0?(0,G.jsx)(Jm,{className:`px-3 py-6`,children:(0,G.jsxs)(Ym,{children:[(0,G.jsx)(Zm,{variant:`icon`,children:(0,G.jsx)(an,{})}),(0,G.jsx)(Qm,{className:`text-xs`,children:`No activity yet`}),(0,G.jsx)($m,{className:`text-xs`,children:`Agent and canvas edits will appear here.`})]})}):(0,G.jsx)(`ul`,{className:`flex-1 overflow-y-auto`,children:i.map(e=>(0,G.jsx)(sh,{entry:e},e.id))})]})}var lh=[{name:`Mobile`,w:390,h:844},{name:`Tablet`,w:768,h:1024},{name:`Desktop`,w:1440,h:900}],uh=JSON.stringify(lh);function dh(){let e=q(e=>{let t=e.design?.viewportPresets;return t&&t.length>0?JSON.stringify(t):uh});return(0,P.useMemo)(()=>e===uh?lh:JSON.parse(e),[e])}function fh({...e}){return(0,G.jsx)(Pe,{"data-slot":`dialog`,...e})}function ph({...e}){return(0,G.jsx)(rt,{"data-slot":`dialog-portal`,...e})}function mh({className:e,...t}){return(0,G.jsx)(ze,{"data-slot":`dialog-overlay`,className:W(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function hh({className:e,children:t,showCloseButton:n=!0,...r}){return(0,G.jsxs)(ph,{children:[(0,G.jsx)(mh,{}),(0,G.jsxs)(ft,{"data-slot":`dialog-content`,className:W(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,G.jsx)(Ye,{"data-slot":`dialog-close`,asChild:!0,children:(0,G.jsxs)(J,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,G.jsx)(Ho,{}),(0,G.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function gh({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`dialog-header`,className:W(`flex flex-col gap-2`,e),...t})}function _h({className:e,showCloseButton:t=!1,children:n,...r}){return(0,G.jsxs)(`div`,{"data-slot":`dialog-footer`,className:W(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,G.jsx)(Ye,{asChild:!0,children:(0,G.jsx)(J,{variant:`outline`,children:`Close`})})]})}function vh({className:e,...t}){return(0,G.jsx)(Ze,{"data-slot":`dialog-title`,className:W(`cn-font-heading text-base leading-none font-medium`,e),...t})}function yh({className:e,...t}){return(0,G.jsx)(Ie,{"data-slot":`dialog-description`,className:W(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Y({className:e,...t}){return(0,G.jsx)(ae,{"data-slot":`label`,className:W(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function bh({...e}){return(0,G.jsx)(vt,{"data-slot":`select`,...e})}function xh({...e}){return(0,G.jsx)(qe,{"data-slot":`select-value`,...e})}function Sh({className:e,size:t=`default`,children:n,...r}){return(0,G.jsxs)(me,{"data-slot":`select-trigger`,"data-size":t,className:W(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,G.jsx)(gt,{asChild:!0,children:(0,G.jsx)(gn,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function Ch({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,G.jsx)(be,{children:(0,G.jsxs)(je,{"data-slot":`select-content`,"data-align-trigger":n===`item-aligned`,className:W(`cn-menu-target cn-menu-translucent relative z-50 max-h-(--radix-select-content-available-height) min-w-36 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,G.jsx)(wh,{}),(0,G.jsx)(ee,{"data-position":n,className:W(`data-[position=popper]:h-(--radix-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--radix-select-trigger-width)`,n===`popper`&&``),children:t}),(0,G.jsx)(Th,{})]})})}function X({className:e,children:t,...n}){return(0,G.jsxs)(ve,{"data-slot":`select-item`,className:W(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`,children:(0,G.jsx)(ne,{children:(0,G.jsx)(I,{className:`pointer-events-none`})})}),(0,G.jsx)(ht,{children:t})]})}function wh({className:e,...t}){return(0,G.jsx)(re,{"data-slot":`select-scroll-up-button`,className:W(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,G.jsx)(Sn,{})})}function Th({className:e,...t}){return(0,G.jsx)(ie,{"data-slot":`select-scroll-down-button`,className:W(`z-10 flex cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,G.jsx)(gn,{})})}function Eh({boardId:e,onClose:t}){let n=q(e=>e.design?.screens??[]),r=dh(),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(``);return(0,P.useEffect)(()=>{e!==null&&(a(n[0]?.id??``),s(r[r.length-1]?.name??``))},[e]),(0,G.jsx)(fh,{open:e!==null,onOpenChange:e=>!e&&t(),children:(0,G.jsxs)(hh,{className:`sm:max-w-sm`,children:[(0,G.jsxs)(gh,{children:[(0,G.jsx)(vh,{children:`Add frame`}),(0,G.jsx)(yh,{children:`Place an existing screen on this board. The frame lands next to the current ones.`})]}),n.length===0?(0,G.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No screens in this folder yet — ask your agent to design one first.`}):(0,G.jsxs)(`div`,{className:`grid gap-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(Y,{htmlFor:`add-frame-screen`,className:`text-xs`,children:`Screen`}),(0,G.jsxs)(bh,{value:i,onValueChange:a,children:[(0,G.jsx)(Sh,{id:`add-frame-screen`,className:`w-full`,children:(0,G.jsx)(xh,{placeholder:`Pick a screen`})}),(0,G.jsx)(Ch,{children:n.map(e=>(0,G.jsx)(X,{value:e.id,children:e.name},e.id))})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(Y,{htmlFor:`add-frame-size`,className:`text-xs`,children:`Size`}),(0,G.jsxs)(bh,{value:o,onValueChange:s,children:[(0,G.jsx)(Sh,{id:`add-frame-size`,className:`w-full`,children:(0,G.jsx)(xh,{placeholder:`Pick a size`})}),(0,G.jsx)(Ch,{children:r.map(e=>(0,G.jsxs)(X,{value:e.name,children:[e.name,` — `,e.w,`×`,e.h]},e.name))})]})]})]}),(0,G.jsxs)(_h,{children:[(0,G.jsx)(J,{type:`button`,variant:`outline`,onClick:t,children:`Cancel`}),(0,G.jsx)(J,{type:`button`,onClick:()=>{let n=r.find(e=>e.name===o)??r[0];e&&i&&n&&(t(),B.addFrame({boardId:e,screenId:i,w:n.w,h:n.h}).catch(e=>H(e,`Could not add frame`)))},disabled:!i||!o,children:`Add frame`})]})]})})}function Dh(e){return new Map([...e].sort((e,t)=>{let n=e.createdAt.localeCompare(t.createdAt);return n===0?e.id.localeCompare(t.id):n}).map((e,t)=>[e.id,t+1]))}var Oh=`(14px / var(--canvas-zoom, 1))`;function kh(e,t,n){return`clamp(${t}px + ${Oh}, ${e}px, ${n}px - ${Oh})`}var Ah=18;function jh(e){return`calc(-50% - ${e*Ah}px / var(--canvas-zoom, 1)) -50%`}function Mh(e){return`${e.left}|${e.top}`}function Nh(e){return t=>{t.key===`Enter`&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e())}}var Ph=/^(#{1,3}) (.*)$/,Fh=/^[-*] (.*)$/;function Ih(e){return e.split(`
3
+ `).map(e=>{let t=Ph.exec(e);if(t)return{kind:`h${t[1].length}`,inline:Bh(t[2])};let n=Fh.exec(e);return n?{kind:`li`,inline:Bh(n[1])}:{kind:`p`,inline:Bh(e)}})}function Lh(e){let t=[];for(let n of e){let e=t[t.length-1];n.kind===`li`?Array.isArray(e)?e.push(n):t.push([n]):t.push(n)}return t}function Rh(e){let t=e.trim();return/^(https?:\/\/|mailto:)/i.test(t)?t:null}var zh=/^\[([^\]\n]+)\]\(([^)\s]+)\)/;function Bh(e){let t=[],n=``,r=()=>{n&&t.push({kind:`text`,text:n}),n=``},i=0;for(;i<e.length;){let a=e.slice(i),o=zh.exec(a);if(o){let e=Rh(o[2]);if(e){r(),t.push({kind:`link`,href:e,children:Bh(o[1])}),i+=o[0].length;continue}}if(a.startsWith(`**`)){let n=e.indexOf(`**`,i+2);if(n>i+2){r(),t.push({kind:`strong`,children:Bh(e.slice(i+2,n))}),i=n+2;continue}}let s=e[i];if(s===`*`||s===`_`){let n=e.indexOf(s,i+1);if(n>i+1){r(),t.push({kind:`em`,children:Bh(e.slice(i+1,n))}),i=n+1;continue}}n+=s,i++}return r(),t}function Vh(e){let t=e=>e.map(e=>e.kind===`text`?e.text:t(e.children)).join(``);return Ih(e).map(e=>t(e.inline)).join(`
4
+ `)}var Hh=`[&_h1]:text-lg [&_h1]:font-bold [&_h1]:leading-tight [&_h1]:tracking-tight [&_h2]:text-base [&_h2]:font-semibold [&_h2]:leading-snug [&_h2]:tracking-tight [&_h3]:text-sm [&_h3]:font-semibold [&_h3]:uppercase [&_h3]:tracking-wider [&_strong]:font-semibold [&_b]:font-semibold [&_em]:italic [&_i]:italic [&_ul]:list-disc [&_ul]:pl-5 [&_li]:pl-0.5 [&_li]:marker:text-current/60 [&_a]:underline [&_a]:underline-offset-2 [&_a]:decoration-current/40 whitespace-pre-wrap break-words`;function Uh({body:e,className:t=``}){return(0,G.jsx)(`div`,{className:`${Hh} ${t}`,"data-markdown":!0,children:Lh(Ih(e)).map((e,t)=>Array.isArray(e)?(0,G.jsx)(`ul`,{children:e.map((e,t)=>(0,G.jsx)(`li`,{children:e.inline.length>0?Gh(e.inline):(0,G.jsx)(`br`,{})},t))},t):(0,G.jsx)(P.Fragment,{children:Wh(e)},t))})}function Wh(e){let t=e.inline.length>0?Gh(e.inline):(0,G.jsx)(`br`,{});switch(e.kind){case`h1`:return(0,G.jsx)(`h1`,{children:t});case`h2`:return(0,G.jsx)(`h2`,{children:t});case`h3`:return(0,G.jsx)(`h3`,{children:t});case`p`:case`li`:return(0,G.jsx)(`div`,{children:t})}}function Gh(e){return e.map((e,t)=>(0,G.jsx)(P.Fragment,{children:Kh(e)},t))}function Kh(e){if(e.kind===`text`)return e.text;let t=Gh(e.children);return e.kind===`link`?(0,G.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:t}):e.kind===`strong`?(0,G.jsx)(`strong`,{children:t}):(0,G.jsx)(`em`,{children:t})}var qh=e(r(),1),Jh=`​`,Yh=new Set([`DIV`,`P`,`H1`,`H2`,`H3`,`H4`,`H5`,`H6`,`LI`,`UL`,`OL`,`BLOCKQUOTE`,`PRE`]);function Xh(e,t){let n=e.ownerDocument,r=(e,t)=>{let r=n.createElement(e);return t.inline.length===0?r.append(n.createElement(`br`)):r.append(...Zh(n,t.inline)),r};e.replaceChildren(...Lh(Ih(t)).map(e=>{if(!Array.isArray(e))return r(e.kind===`p`?`div`:e.kind,e);let t=n.createElement(`ul`);return t.append(...e.map(e=>r(`li`,e))),t}))}function Zh(e,t){return t.map(t=>{if(t.kind===`text`)return e.createTextNode(t.text);let n=e.createElement(t.kind===`link`?`a`:t.kind);return t.kind===`link`&&n.setAttribute(`href`,t.href),n.append(...Zh(e,t.children)),n})}var Qh=e=>e.nodeType===1&&Yh.has(e.tagName);function $h(e){let t=e.tagName;return t===`LI`?`- `:t===`H1`?`# `:t===`H2`?`## `:/^H[3-6]$/.test(t)?`### `:``}function eg(e){let t=[];return tg(e,``,t,!0),t.join(`
5
+ `)}function tg(e,t,n,r=!1){let i=n.length,a=``,o=!1,s=!0,c=e=>{(o||e)&&(n.push((s?t:``)+a),s=!1),a=``,o=!1},l=[...e.childNodes];l.forEach((e,t)=>{if(Qh(e))c(!1),tg(e,$h(e),n);else if(e.nodeName===`BR`){if(t===l.length-1)return;c(!0)}else a+=ng(e,new Set),o=!0}),c(!1),!r&&n.length===i&&n.push(t)}function ng(e,t){if(e.nodeType===3)return(e.textContent??``).replaceAll(Jh,``).replaceAll(`\xA0`,` `);if(e.nodeType!==1)return``;let n=e;if(n.tagName===`BR`)return` `;let r=n.tagName===`STRONG`||n.tagName===`B`?`**`:n.tagName===`EM`||n.tagName===`I`?`*`:null,i=e=>[...n.childNodes].map(t=>ng(t,e)).join(``);if(n.tagName===`A`){let e=i(t),r=Rh(n.getAttribute(`href`)??``);return r&&e.trim()?`[${e}](${r})`:e}if(!r||t.has(r))return i(t);let a=i(new Set([...t,r])),[,o=``,s=``,c=``]=/^(\s*)([\s\S]*?)(\s*)$/.exec(a)??[];return s?`${o}${r}${s}${r}${c}`:a}function rg(e,t){let n=t;for(;n&&n.parentNode!==e;)n=n.parentNode;return n&&n.nodeType===1?n:null}function ig(e,t){if(e.tagName.toLowerCase()===t)return e;let n=e.ownerDocument.createElement(t);return n.append(...e.childNodes),n.firstChild||n.append(e.ownerDocument.createElement(`br`)),e.replaceWith(n),n}function ag(e){let t=e.ownerDocument.getSelection();if(!t||t.rangeCount===0||!t.isCollapsed)return!1;let n=t.anchorNode;if(n?.nodeType!==3||!e.contains(n))return!1;let r=n;if(r.parentNode===e){let n=t.anchorOffset,i=e.ownerDocument.createElement(`div`);r.replaceWith(i),i.append(r),vg(t,r,n)}return sg(e,t,r)||lg(e,t,r)||gg(t,r)}var og=/^(#{1,3})[  ]/;function sg(e,t,n){let r=rg(e,n);if(!r||r.tagName!==`DIV`&&r.tagName!==`P`||mg(r)!==n)return!1;let i=og.exec(n.data);if(!i)return!1;let a=t.anchorOffset-i[0].length;n.data=n.data.slice(i[0].length);let o=i[1].length;return ug(t,ig(r,`h${o}`),n,a),!0}var cg=/^[-*][ \u00A0]/;function lg(e,t,n){let r=rg(e,n);if(!r||r.tagName!==`DIV`&&r.tagName!==`P`||mg(r)!==n)return!1;let i=cg.exec(n.data);if(!i)return!1;let a=t.anchorOffset-i[0].length;n.data=n.data.slice(i[0].length);let o=r.ownerDocument.createElement(`li`);o.append(...r.childNodes);let s=r.previousElementSibling,c=r.nextElementSibling;if(s?.tagName===`UL`)s.append(o),r.remove();else if(c?.tagName===`UL`)c.prepend(o),r.remove();else{let e=r.ownerDocument.createElement(`ul`);e.append(o),r.replaceWith(e)}return ug(t,o,n,a),!0}function ug(e,t,n,r){n.data.length>0?vg(e,n,Math.max(0,r)):(n.remove(),t.firstChild||t.append(t.ownerDocument.createElement(`br`)),vg(e,t,0))}function dg(e,t){let n=t;for(;n&&n!==e;){if(n.nodeName===`LI`)return n;n=n.parentNode}return null}function fg(e){let t=e.ownerDocument,n=e.parentElement,r=t.createElement(`div`);r.append(...e.childNodes),r.firstChild||r.append(t.createElement(`br`));let i=[...n.children].slice([...n.children].indexOf(e)+1);if(e.remove(),i.length>0){let e=t.createElement(`ul`);e.append(...i),n.after(r,e)}else n.after(r);return n.children.length===0&&n.remove(),r}function pg(e){let t=e.ownerDocument,n=t.createElement(`li`);n.append(...e.childNodes),n.firstChild||n.append(t.createElement(`br`));let r=e.previousElementSibling;if(r?.tagName===`UL`)r.append(n),e.remove();else{let r=t.createElement(`ul`);r.append(n),e.replaceWith(r)}return n}function mg(e){return(e.ownerDocument?.createTreeWalker(e,4))?.nextNode()??null}var hg=[{pattern:/\[([^\]\n]+)\]\(([^)\s]+)\)/,build(e,t){let n=Rh(t[2]);if(!n)return null;let r=e.createElement(`a`);return r.setAttribute(`href`,n),r.textContent=t[1],r}},{pattern:/\*\*([^*\n]+)\*\*/,build(e,t){let n=e.createElement(`strong`);return n.textContent=t[1],n}},{pattern:/(^|[^*])\*([^*\s][^*\n]*)\*(?!\*)/,lead:e=>e[1].length,build(e,t){let n=e.createElement(`em`);return n.textContent=t[2],n}},{pattern:/(^|[^\w_])_([^_\s][^_\n]*)_(?![\w_])/,lead:e=>e[1].length,build(e,t){let n=e.createElement(`em`);return n.textContent=t[2],n}}];function gg(e,t){let n=!1,r=t,i=e.anchorOffset;for(;;){let t=_g(r.ownerDocument,r.data,i);if(!t)return n;let{start:a,end:o,el:s}=t,c=r.data.slice(o);r.data=r.data.slice(0,a);let l=r.ownerDocument.createTextNode(c||Jh);r.after(s,l),i=c?i-o:1,vg(e,l,i),r=l,n=!0}}function _g(e,t,n){let r=null;for(let i of hg){let a=new RegExp(i.pattern.source,`g`);for(let o=a.exec(t);o;o=a.exec(t)){let t=o.index+o[0].length;if(t>n)break;let a=o.index+(i.lead?.(o)??0);if(r&&a>=r.start)break;let s=i.build(e,o);if(s){r={start:a,end:t,el:s};break}}}return r}function vg(e,t,n){let r=(t.ownerDocument??t).createRange();r&&(r.setStart(t,n),r.collapse(!0),e.removeAllRanges(),e.addRange(r))}function yg({value:e,onChange:t,onBlur:n,onKeyDown:r,placeholder:i,autoFocus:a=!1,ariaLabel:o,className:s=``,dataSlot:c}){let l=(0,P.useRef)(null),u=(0,P.useRef)(null),d=(0,P.useRef)(null),[f,p]=(0,P.useState)(e.trim()===``),[m,h]=(0,P.useState)(null);(0,P.useLayoutEffect)(()=>{let t=l.current;t&&e!==d.current&&(Xh(t,e),d.current=e,p(e.trim()===``))},[e]),(0,P.useEffect)(()=>{let e=l.current;if(!a||!e)return;e.focus();let t=e.ownerDocument.getSelection();t?.selectAllChildren(e),t?.collapseToEnd()},[]),(0,P.useEffect)(()=>{let e=l.current?.ownerDocument;if(!e)return;let t=()=>{let t=l.current;if(!t||u.current?.contains(e.activeElement))return;let n=e.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;!r||r.collapsed||!t.contains(r.commonAncestorContainer)?h(null):h(r.getBoundingClientRect())};return e.addEventListener(`selectionchange`,t),()=>e.removeEventListener(`selectionchange`,t)},[]);let g=()=>{let e=l.current;if(!e)return;e.firstChild||Xh(e,``);let n=eg(e);d.current=n,p(n.trim()===``),t(n)},_=()=>{requestAnimationFrame(()=>{let e=l.current?.ownerDocument.activeElement;e&&(l.current?.contains(e)||u.current?.contains(e))||(h(null),n?.())})},v=e=>{l.current?.ownerDocument.execCommand(e),g()},y=()=>{let e=l.current,t=e?.ownerDocument.getSelection();return!e||!t||t.rangeCount===0?null:dg(e,t.anchorNode)??rg(e,t.anchorNode)};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{ref:l,role:`textbox`,"aria-multiline":`true`,"aria-label":o,contentEditable:!0,suppressContentEditableWarning:!0,tabIndex:0,"data-slot":c,"data-rich-editor":!0,"data-empty":f?`true`:void 0,"data-placeholder":i,className:`relative cursor-text whitespace-pre-wrap outline-none ${Hh} data-[empty=true]:before:pointer-events-none data-[empty=true]:before:absolute data-[empty=true]:before:text-muted-foreground data-[empty=true]:before:content-[attr(data-placeholder)] ${s}`,onInput:()=>{let e=l.current;e&&ag(e),g()},onPaste:e=>{e.preventDefault();let t=e.clipboardData.getData(`text/plain`);l.current?.ownerDocument.execCommand(`insertText`,!1,t)},onKeyDown:e=>{let t=l.current,n=t?.ownerDocument.getSelection();if(t&&n?.isCollapsed){let r=dg(t,n.anchorNode),i=r??rg(t,n.anchorNode),a=i?bg(i,n):!1;if(r&&(e.key===`Backspace`&&a||e.key===`Enter`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&(r.textContent??``).replaceAll(`​`,``)===``)){e.preventDefault();let t=fg(r);n.collapse(t,0),g();return}if(e.key===`Backspace`&&i&&/^H[1-3]$/.test(i.tagName)&&a){e.preventDefault(),n.collapse(ig(i,`div`),0),g();return}}r?.(e)},onBlur:_}),m?(0,qh.createPortal)((0,G.jsx)(xg,{ref:u,rect:m,onBold:()=>v(`bold`),onItalic:()=>v(`italic`),onHeading:e=>{let t=y();t&&(t.tagName===`LI`&&(t=fg(t)),ig(t,t.tagName===`H${e}`?`div`:`h${e}`),g())},onBullet:()=>{let e=y();e&&(e.tagName===`LI`?fg(e):pg(/^H[1-6]$/.test(e.tagName)?ig(e,`div`):e),g())},onLink:(e,t)=>{let n=l.current,r=n?.ownerDocument.getSelection();n&&r&&(n.focus(),r.removeAllRanges(),r.addRange(t),n.ownerDocument.execCommand(`createLink`,!1,e),g())},onDone:()=>l.current?.focus(),onLeave:_}),document.body):null]})}function bg(e,t){let n=e.ownerDocument.createRange();return n.selectNodeContents(e),n.setEnd(t.anchorNode,t.anchorOffset),n.toString().replaceAll(`​`,``)===``}function xg({ref:e,rect:t,onBold:n,onItalic:r,onHeading:i,onBullet:a,onLink:o,onDone:s,onLeave:c}){let[l,u]=(0,P.useState)(null),[d,f]=(0,P.useState)(`https://`),p=e=>e.preventDefault(),m=(e,t,n)=>(0,G.jsx)(`button`,{type:`button`,"aria-label":e,title:e,className:`flex size-7 items-center justify-center rounded-md text-foreground/80 hover:bg-accent hover:text-foreground`,onMouseDown:p,onClick:n,children:t});return(0,G.jsx)(`div`,{ref:e,role:`toolbar`,"aria-label":`Formatting`,"data-formatting-hud":!0,className:`fixed z-[100] flex -translate-x-1/2 -translate-y-full items-center gap-0.5 rounded-lg border border-border bg-popover p-1 shadow-lg`,style:{left:t.left+t.width/2,top:t.top-6},onPointerDown:e=>e.stopPropagation(),children:l?(0,G.jsx)(`input`,{autoFocus:!0,"aria-label":`Link address`,className:`h-7 w-56 rounded-md bg-transparent px-2 text-xs outline-none`,value:d,onChange:e=>f(e.target.value),onBlur:c,onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault();let t=Rh(d);t&&o(t,l),u(null)}else e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),u(null),s())}}):(0,G.jsxs)(G.Fragment,{children:[m(`Bold`,(0,G.jsx)(nn,{size:14}),n),m(`Italic`,(0,G.jsx)(Ar,{size:14}),r),m(`Heading 1`,(0,G.jsx)(br,{size:14}),()=>i(1)),m(`Heading 2`,(0,G.jsx)(Sr,{size:14}),()=>i(2)),m(`Bullet list`,(0,G.jsx)(Kr,{size:14}),a),m(`Link`,(0,G.jsx)(Hr,{size:14}),()=>{let e=document.getSelection();e&&e.rangeCount>0&&(f(`https://`),u(e.getRangeAt(0).cloneRange()))})]})})}var Sg=`inline-flex size-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors`,Cg=`${Sg} hover:bg-muted hover:text-foreground`,wg=`${Sg} hover:bg-destructive/10 hover:text-destructive`,Tg=`gap-px`,Eg={size:11,strokeWidth:2};function Dg({...e}){return(0,G.jsx)(Le,{"data-slot":`alert-dialog`,...e})}function Og({...e}){return(0,G.jsx)(tt,{"data-slot":`alert-dialog-portal`,...e})}function kg({className:e,...t}){return(0,G.jsx)(Ae,{"data-slot":`alert-dialog-overlay`,className:W(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Ag({className:e,size:t=`default`,...n}){return(0,G.jsxs)(Og,{children:[(0,G.jsx)(kg,{}),(0,G.jsx)(ot,{"data-slot":`alert-dialog-content`,"data-size":t,className:W(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function jg({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:W(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Mg({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:W(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Ng({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-media`,className:W(`mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6`,e),...t})}function Pg({className:e,...t}){return(0,G.jsx)(ct,{"data-slot":`alert-dialog-title`,className:W(`cn-font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Fg({className:e,...t}){return(0,G.jsx)(Ge,{"data-slot":`alert-dialog-description`,className:W(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ig({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,G.jsx)(J,{variant:t,size:n,asChild:!0,children:(0,G.jsx)(ut,{"data-slot":`alert-dialog-action`,className:W(e),...r})})}function Lg({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,G.jsx)(J,{variant:t,size:n,asChild:!0,children:(0,G.jsx)($e,{"data-slot":`alert-dialog-cancel`,className:W(e),...r})})}var Rg=d(`group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full`,{variants:{variant:{default:`*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80`,secondary:`*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]`,muted:`*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]`,tinted:`*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]`,outline:`*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30`,ghost:`border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50`,destructive:`*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30`}},defaultVariants:{variant:`default`}});function zg({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,G.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:W(Rg({variant:e}),n),...r})}function Bg({asChild:e=!1,className:t,...n}){let r=e?N:`div`;return(0,G.jsx)(r,{"data-slot":`bubble-content`,className:W(`w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50`,t),...n})}d(`absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0`,{variants:{side:{top:`top-0 -translate-y-3/4`,bottom:`bottom-0 translate-y-3/4`},align:{start:`left-3`,end:`right-3`}},defaultVariants:{side:`bottom`,align:`end`}});function Z({className:e,type:t,...n}){return(0,G.jsx)(`input`,{type:t,"data-slot":`input`,className:W(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function Vg({className:e,...t}){return(0,G.jsx)(`textarea`,{"data-slot":`textarea`,className:W(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function Hg({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:W(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var Ug=d(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function Wg({className:e,align:t=`inline-start`,...n}){return(0,G.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:W(Ug({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var Gg=d(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function Kg({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,G.jsx)(J,{type:t,"data-size":r,variant:n,className:W(Gg({size:r}),e),...i})}function qg({className:e,...t}){return(0,G.jsx)(Z,{"data-slot":`input-group-control`,className:W(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function Jg({className:e,...t}){return(0,G.jsx)(Vg,{"data-slot":`input-group-control`,className:W(`flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function Yg({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`message-group`,className:W(`flex min-w-0 flex-col gap-2`,e),...t})}function Xg({className:e,align:t=`start`,...n}){return(0,G.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:W(`group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse`,e),...n})}function Zg({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`message-content`,className:W(`flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end`,e),...t})}function Qg({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`message-header`,className:W(`flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0`,e),...t})}function $g({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`message-footer`,className:W(`flex max-w-full min-w-0 items-center px-3 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end`,e),...t})}function e_({className:e,size:t=`default`,...n}){return(0,G.jsxs)(`div`,{className:W(`group/native-select relative w-fit has-[select:disabled]:opacity-50`,e),"data-slot":`native-select-wrapper`,"data-size":t,children:[(0,G.jsx)(`select`,{"data-slot":`native-select`,"data-size":t,className:`h-8 w-full min-w-0 appearance-none rounded-lg border border-input bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,...n}),(0,G.jsx)(gn,{className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none`,"aria-hidden":`true`,"data-slot":`native-select-icon`})]})}function t_({className:e,...t}){return(0,G.jsx)(`option`,{"data-slot":`native-select-option`,className:W(`bg-[Canvas] text-[CanvasText]`,e),...t})}var n_=`min-h-16 w-full flex-1 px-2.5 py-2 text-sm`;function r_(e,t){let n=Math.max(0,Math.round((t-new Date(e).getTime())/6e4));return n<1?`now`:n<60?`${n}m`:n<1440?`${Math.floor(n/60)}h`:`${Math.floor(n/1440)}d`}var i_=3e4;function a_({iso:e,className:t}){let[n,r]=(0,P.useState)(()=>Date.now());return(0,P.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),i_);return()=>clearInterval(e)},[]),(0,G.jsx)(`time`,{dateTime:e,className:t,children:r_(e,n)})}var o_={user:`You`,agent:`Agent`,reviewer:`Reviewer`},s_={owner:`Admin`,admin:`Admin`,member:`Member`,reviewer:`Reviewer`,guest:`Guest`};function c_(e){return s_[e]}function l_(e){if(e.kind!==`agent`){if(e.publisher??(e.kind===`user`&&e.displayName!==void 0))return`publisher`;if(e.role===`guest`)return`guest`}}var u_={publisher:{label:`Publisher`,Icon:Pn},guest:{label:`Guest`,Icon:Mo}};function d_(e,t){return!t||!e.accountId?`unknown`:e.accountId===t?`mine`:`theirs`}function f_(e){return t=>{let{author:n}=t;if(n.kind===`agent`)return{align:`start`,variant:`muted`,name:o_.agent};let r={role:n.role?c_(n.role):void 0,marker:l_(n)},i=d_(n,e);return i===`mine`||i===`unknown`&&n.kind===`user`?{align:`end`,variant:`default`,name:o_.user,...r}:{align:`start`,variant:`outline`,...r}}}function p_(e){return t=>{let n=d_(t.author,e);return n===`unknown`?t.author.kind!==`reviewer`:n===`mine`}}function m_(e){return t=>t.scope===`local`||e&&t.manage!==!1}var h_=f_(void 0),g_=p_(void 0),__=`Comment deleted`;function v_({messages:e,onDelete:t,voice:n=h_,canDelete:r=g_}){return(0,G.jsx)(Yg,{className:`mt-2 gap-3`,children:e.map(e=>{let i=e.deletedAt!==void 0,a=t&&!i&&r(e),{align:o,variant:s,badge:c,name:l,role:u,marker:d}=n(e),f=d?u_[d]:void 0;return(0,G.jsx)(Xg,{align:o,children:(0,G.jsxs)(Zg,{className:`gap-1`,children:[(0,G.jsxs)(Qg,{className:`gap-1.5 px-3`,children:[(0,G.jsx)(`span`,{title:u,className:`truncate`,children:l??e.author.displayName??o_[e.author.kind]}),f?(0,G.jsx)(f.Icon,{size:11,role:`img`,"aria-label":f.label,className:`-ml-0.5 shrink-0 text-muted-foreground`,"data-author-marker":d,children:(0,G.jsx)(`title`,{children:f.label})}):null,c?(0,G.jsx)(K,{variant:`outline`,className:`px-1 py-0 text-[9px] uppercase`,children:c}):null,(0,G.jsx)(a_,{iso:e.createdAt,className:`ml-auto font-normal`}),a?(0,G.jsx)(`button`,{type:`button`,className:`-mr-1 rounded p-0.5 opacity-0 transition-opacity hover:text-destructive focus-visible:opacity-100 group-hover/message:opacity-100`,title:`Delete this comment`,"aria-label":`Delete this comment`,onClick:()=>t(e.id),children:(0,G.jsx)(L,{size:11})}):null]}),i?(0,G.jsx)(zg,{variant:`ghost`,children:(0,G.jsx)(Bg,{className:`text-xs italic text-muted-foreground`,children:__})}):(0,G.jsx)(zg,{variant:s,children:(0,G.jsx)(Bg,{children:(0,G.jsx)(Uh,{body:e.body})})})]})},e.id)})})}function y_(e){let t=e.messages.find(e=>!e.deletedAt)?.body;return t===void 0?__:Vh(t)}function b_(e,t){if(t.kind===`thread`){let t=e.anchor?`The conversation and its pin go`:`The conversation goes`;return e.scope===`shared`?`${t} for everyone on the share link, replies included, for good.`:`${t}, for good.`}return e.scope===`shared`?`Anyone who has already read it will see that something was here, but not what it said.`:e.messages.length===1?`It's the only comment on this thread, so the thread goes with it.`:`It goes for good. The rest of the thread stays.`}function x_(e){return e.anchor?e.anchor.kind===`node`?`Pinned comment`:`Board pin`:`Board-wide`}function S_({thread:e,number:t,showScope:n}){let r=e.anchorState.status===`stale`?`border-destructive/40 bg-destructive/10 text-destructive group-hover/thread:bg-destructive group-hover/thread:text-destructive-foreground`:`border-primary/30 bg-primary/10 text-primary group-hover/thread:bg-primary group-hover/thread:text-primary-foreground`;return(0,G.jsxs)(`span`,{"aria-hidden":!0,className:`flex h-6 shrink-0 items-center gap-0.5 border px-1.5 text-[11px] font-semibold tabular-nums transition-colors ${e.anchor?`rounded-full ${r}`:`rounded-md border-dashed border-border bg-muted text-muted-foreground`}`,children:[e.anchor?n&&e.scope===`shared`?(0,G.jsx)(In,{size:9}):(0,G.jsx)(fi,{size:9}):null,t]})}function C_(){return(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-border`,children:`•`})}function w_({thread:e,onOpen:t,actions:n=1}){let r=e.messages[0];if(!r)return null;let i=e.messages.length-1,a=r.author.displayName??o_[r.author.kind];return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-comment-preview":e.id,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 text-xs ${n>1?`pr-14`:`pr-7`}`,children:[(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:a}),(0,G.jsx)(a_,{iso:r.createdAt,className:`text-muted-foreground`}),e.status===`resolved`?(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`· Resolved`}):null]}),e.branch?(0,G.jsx)(T_,{branch:e.branch,className:`-mt-1 text-[11px] text-muted-foreground`}):null,r.deletedAt?(0,G.jsx)(`p`,{className:`text-[13px] italic text-muted-foreground`,children:`Deleted`}):(0,G.jsx)(Uh,{body:r.body,className:`max-h-24 overflow-hidden text-[13px] leading-relaxed text-foreground/85`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:i===0?`No replies`:i===1?`1 reply`:`${i} replies`}),t?(0,G.jsx)(`button`,{type:`button`,className:`font-medium text-foreground underline-offset-2 hover:underline`,onClick:t,children:`Open thread`}):null]})]})}function T_({branch:e,className:t}){return(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1 ${t??``}`,title:`On the link published from ${e}`,children:[(0,G.jsx)(mr,{size:11,className:`shrink-0`}),(0,G.jsx)(`span`,{className:`truncate font-mono`,children:e})]})}var E_={1:`pr-8`,2:`pr-12`,3:`pr-16`,4:`pr-20`};function D_({thread:e,number:t,onOpen:n,onLocate:r,onResolve:i,onDelete:a,onAddToAgent:o,showScope:s=!0}){let c=e.scope===`shared`,l=e.anchorState.status===`stale`,u=e.messages.length-1,d=+!!e.anchor+ +!!i+ +!!a+ +!!o,f=e.status===`resolved`;return(0,G.jsxs)(`li`,{className:`group/thread relative rounded-lg border bg-card shadow-sm transition-colors hover:bg-accent/40 ${l?`border-destructive/30`:`hover:border-primary/40`} ${e.status===`resolved`?`opacity-75`:``}`,"data-comment-row":e.id,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-2 p-2.5 text-left ${E_[d]??``}`,onClick:n,children:[(0,G.jsx)(S_,{thread:e,number:t,showScope:s}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`line-clamp-2 text-sm leading-snug ${e.status===`resolved`?`text-muted-foreground`:``}`,children:y_(e)}),(0,G.jsxs)(`span`,{className:`mt-1.5 flex flex-wrap items-center gap-x-1.5 gap-y-1 text-[11px] text-muted-foreground`,children:[s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[c?(0,G.jsx)(In,{size:11}):(0,G.jsx)(fi,{size:11}),c?`Cloud`:`Local`]}),(0,G.jsx)(C_,{})]}):null,(0,G.jsx)(`span`,{children:x_(e)}),(0,G.jsx)(C_,{}),(0,G.jsx)(a_,{iso:e.updatedAt}),u>0?(0,G.jsxs)(K,{variant:`secondary`,className:`h-4 gap-0.5 px-1.5 text-[10px] tabular-nums`,children:[(0,G.jsx)(ba,{}),u]}):null,l?(0,G.jsx)(K,{variant:`destructive`,className:`h-4 px-1.5 text-[10px]`,children:`Target changed`}):null,e.status===`resolved`?(0,G.jsxs)(K,{variant:`outline`,className:`h-4 gap-0.5 px-1.5 text-[10px]`,children:[(0,G.jsx)(I,{}),`Resolved`]}):null]}),e.branch?(0,G.jsx)(T_,{branch:e.branch,className:`mt-1 max-w-full text-[11px] text-muted-foreground`}):null]})]}),d>0?(0,G.jsxs)(`div`,{className:`absolute right-1.5 top-1.5 flex items-center ${Tg} rounded-md border bg-popover px-px py-px text-popover-foreground opacity-0 shadow-sm transition-opacity focus-within:opacity-100 group-hover/thread:opacity-100`,children:[e.anchor?(0,G.jsx)(`button`,{type:`button`,className:Cg,"aria-label":`Go to comment ${t}`,title:`Go to comment on canvas`,onClick:r,children:(0,G.jsx)(Kn,{...Eg})}):null,o?(0,G.jsx)(`button`,{type:`button`,className:Cg,"aria-label":`Add comment ${t} to the agent`,title:`Add to the agent's message`,onClick:o,children:(0,G.jsx)(an,{...Eg})}):null,i?(0,G.jsx)(`button`,{type:`button`,className:Cg,"aria-label":`${f?`Reopen`:`Resolve`} thread ${t}`,title:f?`Reopen this thread`:`Resolve this thread`,onClick:i,children:f?(0,G.jsx)(wa,{...Eg}):(0,G.jsx)(I,{...Eg})}):null,a?(0,G.jsx)(`button`,{type:`button`,className:wg,"aria-label":`Delete thread ${t}`,title:`Delete this thread`,onClick:a,children:(0,G.jsx)(L,{...Eg})}):null]}):null]})}function O_({status:e,onStatusChange:t,count:n,onAdd:r,children:i}){return(0,G.jsxs)(`div`,{className:`space-y-2 border-b px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(e_,{"aria-label":`Comment status`,size:`sm`,className:`w-auto text-xs`,value:e,onChange:e=>t(e.target.value),children:[(0,G.jsx)(t_,{value:`open`,children:`Open`}),(0,G.jsx)(t_,{value:`resolved`,children:`Resolved`}),(0,G.jsx)(t_,{value:`all`,children:`All`})]}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n}),(0,G.jsxs)(J,{variant:`outline`,size:`sm`,className:`ml-auto`,title:`Pin a new comment on the canvas`,onClick:r,children:[(0,G.jsx)(ua,{}),` Add`]})]}),i]})}function k_({status:e}){return(0,G.jsx)(Jm,{className:`h-full`,children:(0,G.jsxs)(Ym,{children:[(0,G.jsx)(Zm,{variant:`icon`,children:(0,G.jsx)(fi,{})}),(0,G.jsxs)(Qm,{children:[`No `,e===`all`?``:`${e} `,`comments on this board.`]}),(0,G.jsx)($m,{children:`Add a pin on the canvas or start a broad thread below.`})]})})}function A_({children:e}){return(0,G.jsx)(`p`,{className:`mt-1.5 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5 text-[11px] text-destructive`,"data-comment-failure":!0,role:`alert`,children:e})}function j_({draft:e,onDraftChange:t,onSubmit:n,failure:r,busy:i=!1,target:a,help:o,className:s=``}){return(0,G.jsxs)(`div`,{className:`border-t p-3 ${s}`,"data-board-comment-composer":!0,children:[(0,G.jsxs)(Hg,{children:[(0,G.jsx)(yg,{dataSlot:`input-group-control`,ariaLabel:`Start board-wide thread`,value:e,onChange:t,placeholder:`Start a broad thread about this board…`,className:n_,onKeyDown:Nh(n)}),(0,G.jsxs)(Wg,{align:`block-end`,className:`flex-wrap`,children:[a,(0,G.jsx)(Kg,{variant:`default`,className:`ml-auto`,disabled:i||!e.trim(),onClick:n,children:i?`Posting…`:r?`Try again`:`Start thread`})]})]}),r?(0,G.jsx)(A_,{children:r}):null,(0,G.jsxs)(`p`,{className:`mt-1.5 text-[11px] text-muted-foreground`,children:[`Board-wide threads have no canvas pin.`,o?(0,G.jsxs)(G.Fragment,{children:[` `,o]}):null]})]})}function M_({thread:e,showScope:t=!0,voice:n,canDelete:r,onBack:i,onRequestDelete:a,replyDraft:o,onReplyDraftChange:s,onReply:c,canReply:l=!0,replyFallback:u,busy:d=!1,onResolve:f,children:p}){let m=e.status===`open`;return(0,G.jsxs)(`div`,{className:`flex min-h-full flex-col p-3`,"data-active-comment":e.id,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(J,{variant:`ghost`,size:`sm`,onClick:i,children:`← Threads`}),(0,G.jsxs)(`span`,{className:`ml-auto flex items-center gap-1 text-[11px] text-muted-foreground`,children:[t?(0,G.jsxs)(G.Fragment,{children:[e.scope===`shared`?(0,G.jsx)(In,{size:11}):(0,G.jsx)(fi,{size:11}),e.scope===`shared`?`Cloud`:`Local`]}):null,(0,G.jsx)(`span`,{children:e.anchorState.status===`stale`?`Target changed`:e.anchor?`Pinned`:`Board-wide`})]})]}),(0,G.jsx)(v_,{messages:e.messages,voice:n,canDelete:r,onDelete:t=>a({kind:`message`,threadId:e.id,id:t})}),m&&l?(0,G.jsxs)(Hg,{className:`mt-3`,children:[(0,G.jsx)(yg,{dataSlot:`input-group-control`,ariaLabel:`Reply`,value:o,onChange:s,placeholder:`Reply…`,className:n_,onKeyDown:Nh(c)}),(0,G.jsx)(Wg,{align:`block-end`,children:(0,G.jsx)(Kg,{variant:`default`,className:`ml-auto`,disabled:d||!o.trim(),onClick:c,children:`Reply`})})]}):m?u:null,f||p?(0,G.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-2 pt-4`,children:[f?(0,G.jsx)(J,{variant:`outline`,size:`sm`,className:p?``:`col-span-2`,disabled:d,onClick:f,children:m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(I,{}),` Resolve`]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(wa,{}),` Reopen`]})}):null,p]}):null]})}function N_({thread:e,onRequestDelete:t}){return(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,className:`col-span-2 text-destructive`,onClick:()=>t({kind:`thread`,threadId:e.id}),children:[(0,G.jsx)(L,{}),` Delete thread`]})}function P_({thread:e,pending:t,onCancel:n,onConfirm:r,onResolveInstead:i}){let a=e!==null&&t!==null,o=i!==void 0&&t?.kind===`thread`&&e?.status===`open`;return(0,G.jsx)(Dg,{open:a,onOpenChange:e=>{e||n()},children:(0,G.jsxs)(Ag,{"data-comment-delete-confirm":!0,children:[(0,G.jsxs)(jg,{children:[(0,G.jsx)(Ng,{className:`text-destructive`,children:(0,G.jsx)(L,{})}),(0,G.jsx)(Pg,{children:t?.kind===`message`?`Delete comment`:`Delete thread`}),(0,G.jsx)(Fg,{children:e&&t?b_(e,t):``})]}),(0,G.jsxs)(Mg,{children:[(0,G.jsx)(Lg,{children:`Cancel`}),o?(0,G.jsxs)(Ig,{variant:`outline`,onClick:i,children:[(0,G.jsx)(I,{}),` Resolve instead`]}):null,(0,G.jsx)(Ig,{variant:`destructive`,onClick:r,children:`Delete`})]})]})})}function F_(e,t,n,r){let i=e.anchor;if(!i)return null;if(i.kind===`board`)return{left:`${i.x}px`,top:`${i.y}px`};let a=t.find(e=>e.id===i.frameId);if(!a)return null;let o=n[a.id]??{x:0,y:0},s=e.anchorState.status===`attached`?e.anchorState.resolvedPath.join(`.`):null,c=(s===null?void 0:r[a.id]?.[s])??i.bounds,l=a.x+o.x,u=a.y+o.y;return{left:kh(l+c.x+c.w,l,l+a.w),top:kh(u+c.y,u,u+a.h)}}var I_=()=>!0,L_=160;function R_({threads:e,frames:t,insets:n,nodeRects:r,activeId:i,onOpen:a,onResolve:o,onDelete:s,onAddToAgent:c,actionable:l=I_,preview:u=!1,showScope:d=!0}){let f=(0,P.useMemo)(()=>Dh(e),[e]),p=new Map,[m,h]=(0,P.useState)(null),[g,_]=(0,P.useState)(null),v=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]),(0,P.useEffect)(()=>{let t=m?e.find(e=>e.id===m):void 0;if(!u||!s||!m||!t||!l(t))return;let n=e=>{e.key!==`Delete`&&e.key!==`Backspace`||e.target?.closest(`input, textarea, [contenteditable='true']`)||(e.preventDefault(),s(m))};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[u,s,m,e,l]);let y=e=>{v.current&&clearTimeout(v.current),h(e)},b=()=>{v.current&&clearTimeout(v.current),v.current=setTimeout(()=>h(null),L_)};return(0,G.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,"data-velloo-comment-pins":!0,children:e.map(e=>{let h=F_(e,t,n,r);if(!h)return null;let v=Mh(h),x=p.get(v)??0;p.set(v,x+1);let S=e.anchorState.status===`stale`,C=i===e.id||g===e.id,w=u&&(g===e.id||m===e.id),T=l(e),E=T?o:void 0,D=T?s:void 0;return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`button`,{type:`button`,"data-comment-thread":e.id,"data-anchor-state":e.anchorState.status,"aria-expanded":u?w:void 0,className:`pointer-events-auto absolute grid h-7 min-w-7 place-items-center hover:z-10 rounded-full border px-1.5 text-[11px] font-semibold shadow-md transition-[scale] hover:scale-110 ${S?`border-destructive bg-destructive text-destructive-foreground`:C?`border-primary bg-primary text-primary-foreground ring-2 ring-primary/30`:`border-primary/40 bg-card text-foreground`}`,style:{...h,translate:jh(x),transform:`scale(calc(1 / var(--canvas-zoom, 1)))`},title:u?void 0:S?`Comment target changed`:`Open comment thread`,onPointerDown:e=>e.stopPropagation(),onMouseEnter:u?()=>y(e.id):void 0,onMouseLeave:u?b:void 0,onClick:t=>{t.stopPropagation(),u?_(t=>t===e.id?null:e.id):a(e.id)},onKeyDown:t=>{(t.key===`Delete`||t.key===`Backspace`)&&D?(t.preventDefault(),t.stopPropagation(),D(e.id)):t.key===`Escape`&&g===e.id&&(t.preventDefault(),t.stopPropagation(),_(null))},children:(0,G.jsxs)(`span`,{className:`flex items-center gap-0.5`,children:[d&&e.scope===`shared`?(0,G.jsx)(In,{size:10}):(0,G.jsx)(fi,{size:10}),f.get(e.id)]})}),w?(0,G.jsx)(`div`,{className:`pointer-events-auto absolute z-20`,style:{...h,transform:`scale(calc(1 / var(--canvas-zoom, 1)))`,transformOrigin:`top left`},onMouseEnter:()=>y(e.id),onMouseLeave:b,onPointerDown:e=>e.stopPropagation(),children:(0,G.jsxs)(`div`,{className:`relative ml-4 mt-4 w-64 rounded-lg border border-border bg-popover p-3 shadow-lg`,children:[(0,G.jsxs)(`div`,{className:`absolute right-2 top-2 flex items-center gap-0.5`,children:[c?(0,G.jsx)(`button`,{type:`button`,"aria-label":`Add to agent`,title:`Add to the agent's message`,className:`flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,onClick:t=>{t.stopPropagation(),c(e.id)},children:(0,G.jsx)(an,{size:13})}):null,E?(0,G.jsx)(`button`,{type:`button`,"aria-label":e.status===`resolved`?`Reopen thread`:`Resolve thread`,title:e.status===`resolved`?`Reopen thread`:`Resolve thread`,className:`flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground`,onClick:t=>{t.stopPropagation(),E(e.id)},children:e.status===`resolved`?(0,G.jsx)(wa,{size:13}):(0,G.jsx)(I,{size:13})}):null,D?(0,G.jsx)(`button`,{type:`button`,"aria-label":`Delete comment`,title:`Delete comment`,"data-comment-trash":!0,className:`flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive`,onClick:t=>{t.stopPropagation(),D(e.id)},children:(0,G.jsx)(L,{size:13})}):null]}),(0,G.jsx)(w_,{thread:e,onOpen:()=>a(e.id),actions:+!!E+ +!!D}),S?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:`Its target has changed.`}):null]})}):null]},e.id)})})}function z_(){let e=q(e=>e.markupVisible),t=q(e=>e.commentThreads),n=q(e=>e.activeCommentId),r=q(e=>e.currentBoardId?e.boards[e.currentBoardId]:void 0),i=q(e=>e.nodeRects),a=q(e=>e.frameInsets),o=q(e=>e.setActiveComment),s=q(e=>e.deleteComment),c=q(e=>e.setCommentResolved),l=q(e=>e.addCommentsToAgent),u=q(e=>e.authStatus?.loggedIn===!0),d=(0,P.useMemo)(()=>m_(u),[u]),[f,p]=(0,P.useState)(null);if(!e||!r)return null;let m=f?t.find(e=>e.id===f)??null:null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(R_,{threads:t,frames:r.frames,insets:a,nodeRects:i,activeId:n,onOpen:o,preview:!0,onResolve:e=>{let n=t.find(t=>t.id===e);n&&c(e,n.status===`open`)},onDelete:p,onAddToAgent:e=>void l([{threadId:e}]),actionable:d}),(0,G.jsx)(P_,{thread:m,pending:m?{kind:`thread`,threadId:m.id}:null,onCancel:()=>p(null),onConfirm:()=>{p(null),m&&s(m.id)},onResolveInstead:()=>{p(null),m&&c(m.id,!0)}})]})}function B_({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,G.jsx)(pt,{"data-slot":`separator`,decorative:n,orientation:t,className:W(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function V_({className:e,...t}){return(0,G.jsx)(`fieldset`,{"data-slot":`field-set`,className:W(`flex flex-col gap-4 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t})}function H_({className:e,variant:t=`legend`,...n}){return(0,G.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:W(`mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n})}function U_({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`field-group`,className:W(`group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var W_=d(`group/field flex w-full gap-2 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function G_({className:e,orientation:t=`vertical`,...n}){return(0,G.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:W(W_({orientation:t}),e),...n})}function K_({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`field-content`,className:W(`group/field-content flex flex-1 flex-col gap-0.5 leading-snug`,e),...t})}function q_({className:e,...t}){return(0,G.jsx)(Y,{"data-slot":`field-label`,className:W(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}function J_({className:e,...t}){return(0,G.jsx)(`p`,{"data-slot":`field-description`,className:W(`text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5`,`last:mt-0 nth-last-2:-mt-1`,`[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function Y_({className:e,children:t,errors:n,...r}){let i=(0,P.useMemo)(()=>{if(t)return t;if(!n?.length)return null;let e=[...new Map(n.map(e=>[e?.message,e])).values()];return e?.length==1?e[0]?.message:(0,G.jsx)(`ul`,{className:`ml-4 flex list-disc flex-col gap-1`,children:e.map((e,t)=>e?.message&&(0,G.jsx)(`li`,{children:e.message},t))})},[t,n]);return i?(0,G.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:W(`text-sm font-normal text-destructive`,e),...r,children:i}):null}function X_({...e}){return(0,G.jsx)(Ke,{"data-slot":`popover`,...e})}function Z_({...e}){return(0,G.jsx)(he,{"data-slot":`popover-trigger`,...e})}function Q_({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,G.jsx)(pe,{children:(0,G.jsx)(fe,{"data-slot":`popover-content`,align:t,sideOffset:n,className:W(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function $_({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`popover-header`,className:W(`flex flex-col gap-0.5 text-sm`,e),...t})}function ev({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`popover-title`,className:W(`font-medium`,e),...t})}var tv=d(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),nv=P.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function rv({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,G.jsx)(st,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:W(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,G.jsx)(nv.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function iv({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=P.useContext(nv);return(0,G.jsx)(Ne,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:W(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,tv({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}function av(e,t){let n=e.getBoundingClientRect(),r=q.getState().canvasZoom||1;return{x:(t.clientX-n.left)/r,y:(t.clientY-n.top)/r}}var ov={min:.06,max:.94};function sv(){let e=q(e=>e.markupVisible),t=q(e=>e.currentBoardId?e.boards[e.currentBoardId]:void 0),n=q(e=>e.frameInsets),r=q(e=>e.frameDrafts),i=q(e=>e.flowDraft),a=q(e=>e.screens),o=q(e=>e.canvasZoom),s=q(e=>e.setActiveFlowEdge);if(!e||!t)return null;let c=t.frames.map(e=>({...e,...r[e.id]})),l=e=>{let n=t.frames.find(t=>t.id===e);return n?.label??(n?a[n.screen]?.name:void 0)??e},u=bm({frameInsets:n,frameDrafts:r,canvasZoom:o},t),d=i?u.find(e=>e.id===i.from):void 0,f=i&&d?Wp(u.filter(e=>e.id!==i.from),i,16/(o||1)):null,p=f?u.find(e=>e.id===f):void 0;return(0,G.jsx)(vm,{frames:c,insets:n,zoom:o,edges:Us(t),onPick:e=>s({from:e.from,to:e.to}),label:({routed:e,near:t,onNear:n})=>(0,G.jsx)(cv,{routed:e,near:t,onNear:n,fromName:l(e.edge.from),toName:l(e.edge.to)}),overlay:i&&d?(0,G.jsxs)(`g`,{className:`text-primary`,children:[p?(0,G.jsx)(`rect`,{"data-flow-drop-target":f,x:p.x,y:p.y,width:p.w,height:p.h,rx:`6`,fill:`none`,stroke:`currentColor`,style:{strokeWidth:nm(2)}}):null,(0,G.jsx)(fm,{route:Hp(d,i),dashed:!0})]}):void 0})}function cv({routed:e,near:t,onNear:n,fromName:r,toName:i}){let{key:a,edge:o,route:s}=e,c={from:o.from,to:o.to},l=q(e=>ym(e.activeFlowEdge,c)),[u,d]=(0,P.useState)(null),f=q(e=>e.setActiveFlowEdge),p=q(e=>e.connectFrames),[m,h]=(0,P.useState)(o.label??``),g=(0,P.useId)();(0,P.useEffect)(()=>h(o.label??``),[o.label]);let _=()=>{let e=m.trim();e!==(o.label??``)&&p([{...c,label:e===``?null:e}])},v=o.state===void 0||Hs.includes(o.state)?[...Hs]:[...Hs,o.state],y=o.label===void 0&&o.state===void 0;return(0,G.jsx)(hm,{routed:e,at:u,bare:y,near:t,forward:l||u!==null,onNear:n,children:(0,G.jsxs)(X_,{open:l,onOpenChange:e=>{e||_(),f(e?c:null)},children:[y?(0,G.jsx)(Z_,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"data-flow-chip":a,"aria-label":`Arrow from ${r} to ${i}`,className:`block size-2.5 rounded-full border border-border bg-background shadow-xs hover:scale-150 hover:border-primary data-[state=open]:border-primary transition-transform`})}):(0,G.jsxs)(`div`,{className:`${gm} hover:border-primary has-data-[state=open]:border-primary`,children:[(0,G.jsx)(`div`,{role:`presentation`,"data-flow-grip":a,title:`Drag to slide along the arrow`,onPointerDown:e=>{if(e.button!==0)return;let t=e.currentTarget,n=t.closest(`[data-velloo-board-world]`);if(!n)return;e.preventDefault(),e.stopPropagation(),t.setPointerCapture(e.pointerId);let r=e=>Math.min(ov.max,Math.max(ov.min,Xp(s,av(n,e)))),i=e=>d(r(e)),a=()=>{t.removeEventListener(`pointermove`,i),t.removeEventListener(`pointerup`,l),t.removeEventListener(`pointercancel`,o)},o=()=>{a(),d(null)},l=e=>{a();let t=Math.round(r(e)*100)/100;d(t),p([{...c,labelAt:t}]).finally(()=>d(null))};t.addEventListener(`pointermove`,i),t.addEventListener(`pointerup`,l),t.addEventListener(`pointercancel`,o)},className:`grid h-4 w-3.5 shrink-0 cursor-grab place-items-center rounded text-muted-foreground hover:text-foreground active:cursor-grabbing`,children:(0,G.jsx)(gr,{size:12,strokeWidth:2})}),(0,G.jsx)(Z_,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,"data-flow-chip":a,"aria-label":`Arrow from ${r} to ${i}${o.label?`: ${o.label}`:``}`,className:`flex min-w-0 items-center gap-1 rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:(0,G.jsx)(_m,{edge:o})})})]}),(0,G.jsxs)(Q_,{side:`top`,className:`w-80`,updatePositionStrategy:`always`,children:[(0,G.jsx)($_,{children:(0,G.jsxs)(ev,{className:`truncate`,children:[r,` → `,i]})}),(0,G.jsxs)(U_,{className:`gap-3`,children:[(0,G.jsxs)(G_,{children:[(0,G.jsx)(q_,{htmlFor:g,children:`When`}),(0,G.jsx)(Z,{id:g,value:m,maxLength:120,placeholder:o.state===void 0?`Submit`:`Email already taken`,onChange:e=>h(e.target.value),onBlur:_,onKeyDown:e=>{e.key===`Enter`&&(_(),f(null))}})]}),(0,G.jsxs)(G_,{children:[(0,G.jsx)(q_,{children:`State of the same step`}),(0,G.jsx)(rv,{type:`single`,variant:`outline`,size:`sm`,spacing:1,className:`flex-wrap`,value:o.state??``,onValueChange:e=>void p([{...c,state:e===``?null:e}]),children:v.map(e=>(0,G.jsx)(iv,{value:e,"data-flow-state-option":e,children:e},e))}),(0,G.jsx)(J_,{children:o.state===void 0?`None — this arrow leads on to another step.`:`“${i}” is “${r}” in its ${o.state} state.`})]})]}),(0,G.jsxs)(J,{variant:`destructive`,size:`sm`,className:`self-start`,onClick:()=>void p([{...c,remove:!0}]),children:[(0,G.jsx)(L,{"data-icon":`inline-start`}),`Remove arrow`]})]})]})})}var lv=`#2563eb`,uv=`#8b5cf6`,dv=`__velloo_init`;function fv(e){try{return(e?.contentDocument?.querySelector(`meta[name="velloo-render-error"]`))?.getAttribute(`content`)||null}catch{return null}}function pv(e){let{frame:t,canvasDefault:n,boardTheme:r,screenRevision:i,themeVersion:a}=e,o=Ks(t,n);return`${nd(t.screen,t.w,t.h,r)}&mode=${o}&canvas=1&v=${i}.${a}`}function mv(e){let{screenId:t,width:n,height:r,boardTheme:i,scheme:a,canvasDefault:o,screenRevision:s,themeVersion:c}=e,l=Ks({scheme:a},o);return`${nd(t,n,r,i)}&mode=${l}&v=${s}.${c}`}function hv({open:e,title:t,description:n,confirmLabel:r,onConfirm:i,onCancel:a}){return(0,G.jsx)(Dg,{open:e,onOpenChange:e=>{e||a()},children:(0,G.jsxs)(Ag,{children:[(0,G.jsxs)(jg,{children:[(0,G.jsx)(Pg,{children:t}),(0,G.jsx)(Fg,{children:n})]}),(0,G.jsxs)(Mg,{children:[(0,G.jsx)(Lg,{children:`Cancel`}),(0,G.jsx)(Ig,{variant:`destructive`,onClick:i,children:r})]})]})})}function gv(e){let t=q(e=>e.selection),n=q(e=>e.snippetFocus),r=q(e=>e.commentThreads),i=q(e=>e.notes),a=q(e=>e.annotations),o=t?.screenId===e.screen?t.path:null,s=(0,P.useMemo)(()=>{let t=_v({commentThreads:r,notes:i,annotations:a},e.id,e.screen);return o!==null&&!t.includes(o)&&t.push(o),t},[r,i,a,e.id,e.screen,o]),c=n!==null&&t?.screenId===`snippet:${n}`?t.path:null,l=(0,P.useMemo)(()=>c===null?[]:[c],[c]),u=(0,P.useRef)(s);u.current=s;let d=(0,P.useRef)(l);return d.current=l,{anchoredPaths:s,snippetPaths:l,anchoredPathsRef:u,snippetPathsRef:d}}function _v(e,t,n){let r=new Set;for(let n of e.commentThreads)n.anchor?.kind===`node`&&n.anchor.frameId===t&&n.anchorState.status===`attached`&&r.add(n.anchorState.resolvedPath.join(`.`));for(let n of e.notes)n.attachment?.frameId===t&&n.resolved&&r.add(n.resolved.join(`.`));for(let t of e.annotations)t.screenId===n&&t.resolved&&r.add(t.resolved.join(`.`));return[...r]}function vv({frameId:e}){return q(e=>e.markupVisible&&e.cursorMode===`select`)?(0,G.jsx)(`div`,{role:`presentation`,"data-flow-handle":e,title:`Drag onto another frame to connect them`,onPointerDown:t=>{if(t.button!==0)return;let n=t.currentTarget,r=n.closest(`[data-velloo-board-world]`);if(!r)return;t.preventDefault(),t.stopPropagation(),n.setPointerCapture(t.pointerId);let i=q.getState,a=e=>av(r,e);i().setFlowDraft({from:e,...a(t)});let o=t=>i().setFlowDraft({from:e,...a(t)}),s=()=>{n.removeEventListener(`pointermove`,o),n.removeEventListener(`pointerup`,c),n.removeEventListener(`pointercancel`,s),i().setFlowDraft(null)},c=t=>{s();let n=i(),r=n.currentBoardId?n.boards[n.currentBoardId]:void 0;if(!r)return;let o=Wp(bm(n,r).filter(t=>t.id!==e),a(t),16/(n.canvasZoom||1));if(!o)return;let c={from:e,to:o};Us(r).some(e=>ym(e,c))?n.setActiveFlowEdge(c):n.connectFrames([c]).then(e=>{e&&i().setActiveFlowEdge(c)})};n.addEventListener(`pointermove`,o),n.addEventListener(`pointerup`,c),n.addEventListener(`pointercancel`,s)},className:`absolute right-0 top-1/2 size-3.5 cursor-crosshair rounded-full border-2 border-background bg-primary opacity-0 shadow-xs transition-opacity group-hover:opacity-100 hover:opacity-100`,style:{transform:`translate(50%, -50%) scale(calc(1 / var(--canvas-zoom, 1)))`}}):null}function yv({...e}){return(0,G.jsx)(ce,{"data-slot":`dropdown-menu`,...e})}function bv({...e}){return(0,G.jsx)(Te,{"data-slot":`dropdown-menu-trigger`,...e})}function xv({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,G.jsx)(se,{children:(0,G.jsx)(_e,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:W(`cn-menu-target cn-menu-translucent z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function Q({className:e,inset:t,variant:n=`default`,...r}){return(0,G.jsx)(bt,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:W(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Sv({className:e,children:t,checked:n,inset:r,...i}){return(0,G.jsxs)(de,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:W(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n===void 0?{}:{checked:n},...i,children:[(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,G.jsx)(te,{children:(0,G.jsx)(I,{})})}),t]})}function Cv({...e}){return(0,G.jsx)(xe,{"data-slot":`dropdown-menu-radio-group`,...e})}function wv({className:e,children:t,inset:n,...r}){return(0,G.jsxs)(Ce,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:W(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,G.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,G.jsx)(te,{children:(0,G.jsx)(I,{})})}),t]})}function Tv({className:e,inset:t,...n}){return(0,G.jsx)(Se,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:W(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function Ev({className:e,...t}){return(0,G.jsx)(oe,{"data-slot":`dropdown-menu-separator`,className:W(`-mx-1 my-1 h-px bg-border`,e),...t})}function Dv({...e}){return(0,G.jsx)(ue,{"data-slot":`dropdown-menu-sub`,...e})}function Ov({className:e,inset:t,children:n,...r}){return(0,G.jsxs)(le,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:W(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,G.jsx)(bn,{className:`cn-rtl-flip ml-auto`})]})}function kv({className:e,...t}){return(0,G.jsx)(se,{children:(0,G.jsx)(it,{"data-slot":`dropdown-menu-sub-content`,className:W(`cn-menu-target cn-menu-translucent z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})})}function Av(e,t,n){let r=n??null;return[{value:null,label:`Follow canvas (${t})`,ariaLabel:`Follow canvas default for ${e} (currently ${t})`,current:r===null},{value:`light`,label:`Pin to light`,ariaLabel:`Pin ${e} to light mode`,current:r===`light`},{value:`dark`,label:`Pin to dark`,ariaLabel:`Pin ${e} to dark mode`,current:r===`dark`}]}function jv(e){return e===`light`?(0,G.jsx)(uo,{}):e===`dark`?(0,G.jsx)(Si,{}):(0,G.jsx)(co,{})}function Mv({frameLabel:e,scheme:t,canvasDefault:n,onChange:r}){return(0,G.jsxs)(Dv,{children:[(0,G.jsxs)(Ov,{children:[jv(t??null),`Color scheme`]}),(0,G.jsx)(kv,{children:Av(e,n,t).map(e=>(0,G.jsxs)(Q,{"aria-label":e.ariaLabel,onSelect:()=>r(e.value),children:[jv(e.value),e.label,e.current?(0,G.jsx)(I,{className:`ml-auto`}):null]},e.label))})]})}var Nv=120,Pv=4096,Fv=190;function Iv(e){return Math.max(Nv,Math.min(Pv,Math.round(e)))}function Lv({label:e,w:t,h:n,sharedCount:r,library:i,presets:a,scheme:o,canvasDefault:s,fit:c,chromeWidth:l,onPointerDownGrip:u,onRemove:d,onExport:f,onResize:p,onPreview:m,onAddSibling:h,onSchemeChange:g,onFitChange:_,moveTargets:v,onMoveToBoard:y,onMoveToNewBoard:b}){let x=l<Fv;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 overflow-hidden text-xs text-muted-foreground`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 min-w-0`,children:[(0,G.jsx)(`div`,{onPointerDown:u,className:`shrink-0 h-4 w-4 grid place-items-center rounded cursor-grab active:cursor-grabbing text-muted-foreground hover:text-foreground hover:bg-card`,title:`Drag to move`,role:`presentation`,children:(0,G.jsx)(gr,{size:12,strokeWidth:2})}),(0,G.jsx)(`span`,{className:`font-medium truncate`,title:e,children:e}),x?null:(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 opacity-60 tabular-nums`,children:[(0,G.jsx)(Rv,{value:t,ariaLabel:`frame width`,onCommit:e=>p({w:Iv(e)})}),(0,G.jsx)(`span`,{className:`opacity-60`,children:`×`}),(0,G.jsx)(Rv,{value:n,ariaLabel:`frame height`,onCommit:e=>p({h:Iv(e)})})]}),c&&!x?(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center rounded px-1 py-0.5 text-[10px] bg-muted text-muted-foreground`,title:`Height follows the screen's content. Type a height or drag the frame's edge to set your own.`,role:`img`,"aria-label":`height fits content`,children:(0,G.jsx)(Oi,{size:10,strokeWidth:2})}):null,o&&!x?(0,G.jsx)(`span`,{className:`inline-flex shrink-0 items-center rounded px-1 py-0.5 text-[10px] bg-muted text-muted-foreground`,title:`Pinned to ${o} — this frame ignores the canvas default (${s}).`,role:`img`,"aria-label":`pinned to ${o}`,children:o===`dark`?(0,G.jsx)(Si,{size:10,strokeWidth:2}):(0,G.jsx)(uo,{size:10,strokeWidth:2})}):null,i&&!x?(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 rounded px-1 py-0.5 text-[10px] bg-muted text-muted-foreground`,title:`This screen renders against library "${i}".`,children:[(0,G.jsx)(Br,{size:10,strokeWidth:2}),i]}):null,r>1&&!x?(0,G.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 rounded px-1 py-0.5 text-[10px] bg-primary/10 text-primary`,title:`${r} frames share this screen — edits sync across all of them.`,children:[(0,G.jsx)(Hr,{size:10}),r]}):null]}),(0,G.jsx)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:`opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100 transition-opacity h-4 w-5 grid place-items-center rounded hover:bg-card text-muted-foreground hover:text-foreground`,title:`Frame actions`,children:(0,G.jsx)(Xn,{size:12})})}),(0,G.jsxs)(xv,{align:`end`,className:em,children:[(0,G.jsxs)(Q,{onSelect:m,children:[(0,G.jsx)(ci,{}),`Full-screen preview`]}),(0,G.jsx)(Mv,{frameLabel:e,scheme:o,canvasDefault:s,onChange:g}),(0,G.jsxs)(Q,{"aria-label":c?`Stop fitting height to content`:`Fit height to content`,onSelect:()=>_(!c),children:[(0,G.jsx)(Oi,{}),`Fit height to content`,c?(0,G.jsx)(I,{className:`ml-auto`}):null]}),(0,G.jsxs)(Dv,{children:[(0,G.jsxs)(Ov,{children:[(0,G.jsx)(ua,{}),`New frame of this screen`]}),(0,G.jsxs)(kv,{children:[a.map(e=>(0,G.jsxs)(Q,{onSelect:()=>h({w:e.w,h:e.h}),children:[e.name,(0,G.jsxs)(`span`,{className:`ml-auto pl-3 text-xs text-muted-foreground tabular-nums`,children:[e.w,`×`,e.h]})]},e.name)),(0,G.jsxs)(Q,{onSelect:()=>h({w:t,h:n}),children:[(0,G.jsx)(Wn,{}),`Duplicate at current size`,(0,G.jsxs)(`span`,{className:`ml-auto pl-3 text-xs text-muted-foreground tabular-nums`,children:[t,`×`,n]})]})]})]}),(0,G.jsxs)(Dv,{children:[(0,G.jsxs)(Ov,{children:[(0,G.jsx)(cr,{}),`Move to board`]}),(0,G.jsxs)(kv,{className:`max-h-[60vh] overflow-y-auto`,children:[v.map(e=>(0,G.jsxs)(Q,{onSelect:()=>y(e.id),children:[(0,G.jsx)(Pr,{}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),v.length>0?(0,G.jsx)(Ev,{}):null,(0,G.jsxs)(Q,{onSelect:b,children:[(0,G.jsx)(ur,{}),`New board…`]})]})]}),(0,G.jsxs)(Q,{onSelect:f,children:[(0,G.jsx)(Jn,{}),`Export…`]}),(0,G.jsx)(Ev,{}),(0,G.jsxs)(Q,{variant:`destructive`,onSelect:d,children:[(0,G.jsx)(L,{}),`Remove frame`]})]})]})})]})}function Rv({value:e,ariaLabel:t,onCommit:n}){let[r,i]=(0,P.useState)(String(e));return(0,P.useEffect)(()=>{i(String(e))},[e]),(0,G.jsx)(`input`,{type:`number`,value:r,min:Nv,max:Pv,step:1,"aria-label":t,onChange:e=>i(e.target.value),onBlur:()=>{let t=Number(r);Number.isFinite(t)?t!==e&&n(t):i(String(e))},onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),t.currentTarget.blur()),t.key===`Escape`&&(i(String(e)),t.currentTarget.blur())},onPointerDown:e=>e.stopPropagation(),className:`w-10 bg-transparent text-right tabular-nums outline-none hover:bg-card focus:bg-card rounded-sm px-0.5 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`})}var zv=11;function Bv({frame:e,presets:t,onPick:n}){return(0,G.jsx)(`div`,{className:`flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,children:t.map(t=>{let r=t.w===e.w&&(e.fit===`content`||t.h===e.h);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(t),title:`${t.name}: ${t.w}×${t.h}`,className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] `+(r?`border-primary bg-primary/10 text-primary`:`bg-card text-muted-foreground hover:text-foreground`),children:[Vv(t),t.name]},t.name)})})}function Vv(e){let t=e.name.toLowerCase();return t.includes(`mobile`)?(0,G.jsx)(Ka,{size:zv}):t.includes(`tablet`)?(0,G.jsx)(_o,{size:zv}):(0,G.jsx)(bi,{size:zv})}function Hv(e,t,n,r){let i=q(e=>e.selection),a=q(e=>e.snippetFocus),o=q(e=>e.hover),s=q(e=>e.reveal),c=q(e=>e.nodeState),l=q(e=>e.screenVersion),u=q(e=>e.canvasZoom),d=q(e=>e.activityFlash[t.screen]),f=q(e=>e.rectProbe),p=q(e=>e.clearNodeRects);(0,P.useEffect)(()=>{let n=e.current;n&&(i?.screenId===t.screen?n.send({type:`applyHighlight`,path:i.path}):a!==null&&i?.screenId===`snippet:${a}`?n.send({type:`applyHighlight`,path:``,snippetPath:i.path}):n.send({type:`clearHighlight`}))},[e,i,a,t.screen]),(0,P.useEffect)(()=>{e.current?.send({type:`applySnippetFocus`,snippetId:a})},[e,a]),(0,P.useEffect)(()=>{let n=e.current;n&&s&&s.screenId===t.screen&&n.send({type:`applyHighlight`,path:s.path,scroll:!0})},[e,s,t.screen]),(0,P.useEffect)(()=>{let n=e.current;if(!n||!d||d.path===null)return;n.send({type:`applyHighlight`,path:d.path});let r=setTimeout(()=>{let e=q.getState().selection;e?.screenId===t.screen?n.send({type:`applyHighlight`,path:e.path}):n.send({type:`clearHighlight`})},1100);return()=>clearTimeout(r)},[e,d,t.screen]),(0,P.useEffect)(()=>{let i=e.current;i&&f&&f.frameId===t.id&&i.send({type:`requestRects`,paths:[...new Set([f.path,...n])],snippetPaths:r,force:!0})},[e,f,t.id,n,r]),(0,P.useEffect)(()=>{let n=e.current;n&&(o?.screenId===t.screen?n.send({type:`applyHover`,path:o.path}):a!==null&&o?.screenId===`snippet:${a}`?n.send({type:`applyHover`,path:``,snippetPath:o.path}):n.send({type:`clearHover`}))},[e,o,a,t.screen]),(0,P.useEffect)(()=>{let n=e.current;if(!n)return;let r=i?.screenId===t.screen?i.path:null;n.send({type:`applyVelloState`,path:r,state:r?c:`default`})},[e,c,i,t.screen]),(0,P.useEffect)(()=>{let i=e.current;i&&(n.length===0&&r.length===0?(p(t.id),i.send({type:`requestRects`,paths:[],snippetPaths:[]})):i.send({type:`requestRects`,paths:n,snippetPaths:r}))},[e,n,r,t.id,l,p]),(0,P.useEffect)(()=>{e.current?.send({type:`setChromeScale`,scale:u})},[e,u]),(0,P.useEffect)(()=>{let n=e.current;n&&i?.screenId===t.screen&&n.send({type:`requestComputed`,path:i.path})},[e,i,t.screen,l])}function Uv(e,t){let n=(0,P.useRef)(null),r=(0,P.useRef)(null),[i,a]=(0,P.useState)(()=>({srcs:[e,null],front:0})),o=(0,P.useRef)(i);o.current=i;let s=i.front,[c,l]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{a(t=>{let n=1-t.front;if(t.srcs[t.front]===e){if(t.srcs[n]===null)return t;let e=[...t.srcs];return e[n]=null,{...t,srcs:e}}if(t.srcs[n]===e)return t;let r=[...t.srcs];return r[n]=e,{...t,srcs:r}})},[e]),{srcs:i.srcs,front:s,painted:c,frontRef:s===0?n:r,slotRefs:[n,r],settleSlot:e=>{let i=o.current;if(l(!0),e===i.front)return!0;if(i.srcs[e]===null)return!1;let s=t.current,c=(e===0?n:r).current?.contentWindow;return s&&c&&c.scrollTo(s.x,s.y),a(e===0?{srcs:[i.srcs[0],null],front:0}:{srcs:[null,i.srcs[1]],front:1}),!1}}}var Wv=[];function Gv({boardId:e,frame:t,frameLabel:n,boardTheme:r}){let i=q(e=>e.design?.boards??Wv),[a,o]=(0,P.useState)(!1),[s,c]=(0,P.useState)(null),l=(n,r)=>{B.updateFrame({boardId:e,frameId:t.id,patch:n}).catch(e=>H(e,r))},u=e=>{if(t.fit===`content`){if(e.w===t.w)return;l({w:e.w,fit:`content`},`Could not resize frame`)}else(e.w!==t.w||e.h!==t.h)&&l({w:e.w,h:e.h},`Could not resize frame`)},d=e=>l(e,`Could not resize frame`),f=e=>l({scheme:e},`Could not update frame color scheme`),p=e=>l({fit:e?`content`:null},`Could not change how the frame is sized`),m=()=>{o(!1),B.removeFrame({boardId:e,frameId:t.id}).catch(e=>H(e,`Could not remove frame`))},h=()=>{q.getState().setExportTarget({kind:`frame`,id:t.id,name:n})},g=()=>{q.getState().setPreviewTarget({screenId:t.screen,name:n,...r?{boardTheme:r}:{},...t.scheme?{scheme:t.scheme}:{},w:t.w})},_=n=>{B.addFrame({boardId:e,screenId:t.screen,w:n.w,h:n.h}).catch(e=>H(e,`Could not add frame`))},v=(0,P.useMemo)(()=>i.filter(t=>t.id!==e).map(e=>({id:e.id,name:e.name})),[i,e]),y=(e,t)=>{V({kind:`info`,message:`Moved "${n}" to "${t}"`,action:{label:`Open board`,onClick:()=>void q.getState().selectBoard(e)}})};return{onPickPreset:u,onResize:d,onSchemeChange:f,onFitChange:p,onExport:h,onPreview:g,onAddSibling:_,moveTargets:v,onMoveToBoard:n=>{let r=v.find(e=>e.id===n)?.name??n;B.moveFrame({boardId:e,frameId:t.id,toBoardId:n}).then(()=>y(n,r)).catch(e=>H(e,`Could not move frame`))},confirmRemove:a,requestRemove:()=>o(!0),cancelRemove:()=>o(!1),doRemove:m,newBoardName:s,setNewBoardName:c,submitNewBoard:async()=>{let n=s?.trim();if(n){c(null);try{let{boardId:r}=await B.addBoard({name:n});await B.moveFrame({boardId:e,frameId:t.id,toBoardId:r}),await q.getState().refreshDesignSummary(),y(r,n)}catch(e){H(e,`Could not move frame to a new board`)}}}}}var Kv=150,qv=20,Jv=class{iframe;handlers;port=null;buffered=[];ready=!1;destroyed=!1;retryTimer=null;attempts=0;constructor(e,t){this.iframe=e,this.handlers=t}attach(){this.destroyed||(this.cancelRetry(),this.port?.close(),this.port=null,this.ready=!1,this.attempts=0,this.sendInit())}sendInit(){if(this.destroyed||this.ready)return;let e=this.iframe.contentWindow;if(!e){this.scheduleRetry();return}this.attempts+=1,this.port?.close();let t=new MessageChannel;this.port=t.port1,this.port.onmessage=e=>this.handleMessage(e.data),e.postMessage({type:dv,version:1},`*`,[t.port2]),this.scheduleRetry()}scheduleRetry(){this.destroyed||this.ready||this.attempts>=qv||(this.retryTimer=setTimeout(()=>{this.retryTimer=null,!(this.ready||this.destroyed)&&this.sendInit()},Kv))}cancelRetry(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null)}handleMessage(e){if(!e||typeof e!=`object`||typeof e.type!=`string`)return;let t=e;if(t.type===`ready`){t.version!==1&&console.error(`velloo: iframe protocol mismatch — canvas v1, iframe v${t.version??`<unversioned>`}. Reload the page.`),this.ready=!0,this.cancelRetry();for(let e of this.buffered)this.port?.postMessage(e);this.buffered=[],this.handlers.onReady?.()}else if(t.type===`select`)this.handlers.onSelect?.(t.path,t.snippetPath,t.instance);else if(t.type===`hover`)this.handlers.onHover?.(t.path,t.snippetPath);else if(t.type===`enter`)this.handlers.onEnter?.(t.path,t.snippetId);else if(t.type===`exit`)this.handlers.onExit?.();else if(t.type===`key`){let{type:e,...n}=t;this.handlers.onKey?.(n)}else t.type===`nodeRects`?this.handlers.onRects?.(t.rects):t.type===`nodeComputed`?this.handlers.onComputed?.(t.computed.path,t.computed.values):t.type===`parentZoom`?this.handlers.onParentZoom?.(t.deltaY,t.clientX,t.clientY):t.type===`parentPan`?this.handlers.onParentPan?.(t.deltaX,t.deltaY):t.type===`scrollPos`&&this.handlers.onScrollPos?.(t.x,t.y)}send(e){!this.ready||!this.port?this.buffered.push(e):this.port.postMessage(e)}destroy(){this.destroyed=!0,this.cancelRetry(),this.port?.close(),this.port=null,this.buffered=[],this.ready=!1}};function Yv({boardId:e,frame:t,iframeRef:n,hasScreen:r,savedScrollRef:i,anchoredPathsRef:a,snippetPathsRef:o}){let s=(0,P.useRef)(null),c=q(e=>e.setSelection),l=q(e=>e.setHover),u=q(e=>e.setNodeRects),d=q(e=>e.setSelectionComputed),f=q(e=>e.clearNodeRects);return(0,P.useEffect)(()=>{let r=n.current;if(!r)return;let p=new Jv(r,{onSelect(n,i,a){if(n===null){c(null);return}let o=q.getState();if(o.snippetFocus!==null)i===void 0?c(null):(c({screenId:`snippet:${o.snippetFocus}`,path:i}),q.getState().setSelectionAnchor({frameId:t.id,instance:a??0}));else if(o.cursorMode===`note`){let e=ef(o.screens,{screenId:t.screen,path:n});if(!e)return;o.createNote({attachment:{frameId:t.id,screenId:t.screen,locator:$d(e,n)},resolved:n===``?[]:n.split(`.`).map(Number)})}else if(o.cursorMode===`comment`){let i={screenId:t.screen,path:n},a=ef(o.screens,i),s=Array.from(r.contentDocument?.querySelectorAll(`[data-node-path]`)??[]).find(e=>e.dataset.nodePath===n);if(!a||!s)return;let c=s.getBoundingClientRect(),l=$d(a,n),u=`$ref`in a?a.$ref:`$snippet`in a?a.$snippet:void 0,d=s.textContent?.trim().replace(/\s+/g,` `).slice(0,500);o.beginComment({kind:`node`,boardId:e,frameId:t.id,screenId:t.screen,locator:l,bounds:{x:c.x,y:c.y,w:c.width,h:c.height},...(u||d)&&{fingerprint:{...u&&{ref:u},...d&&{text:d}}}})}else c({screenId:t.screen,path:n})},onHover(e,n){let r=q.getState().snippetFocus;l(e===null?null:r===null?{screenId:t.screen,path:e}:n===void 0?null:{screenId:`snippet:${r}`,path:n})},onEnter(e,t){t!==void 0&&q.getState().setSnippetFocus(t)},onExit(){q.getState().setSnippetFocus(null)},onKey(e){window.dispatchEvent(new KeyboardEvent(`keydown`,e))},onRects(e){u(t.id,e)},onComputed(e,t){d(e,t)},onScrollPos(e,t){i.current={x:e,y:t};let n=a.current,r=o.current;(n.length>0||r.length>0)&&p.send({type:`requestRects`,paths:n,snippetPaths:r})},onReady(){let e=q.getState();if(e.snippetFocus!==null&&(p.send({type:`applySnippetFocus`,snippetId:e.snippetFocus}),e.selection?.screenId===`snippet:${e.snippetFocus}`&&p.send({type:`applyHighlight`,path:``,snippetPath:e.selection.path})),e.reveal?.screenId!==t.screen&&i.current&&p.send({type:`restoreScroll`,...i.current}),e.selection?.screenId===t.screen){let n=e.reveal?.screenId===t.screen&&e.reveal.path===e.selection.path;p.send({type:`applyHighlight`,path:e.selection.path,...n?{scroll:n}:{}})}e.hover?.screenId===t.screen&&p.send({type:`applyHover`,path:e.hover.path}),e.nodeState!=="default"&&e.selection?.screenId===t.screen&&p.send({type:`applyVelloState`,path:e.selection.path,state:e.nodeState});let n=a.current,r=o.current;(n.length>0||r.length>0)&&p.send({type:`requestRects`,paths:n,snippetPaths:r}),p.send({type:`setChromeScale`,scale:q.getState().canvasZoom}),e.selection?.screenId===t.screen&&p.send({type:`requestComputed`,path:e.selection.path})},onParentZoom(e,t,n){let i=q.getState(),a=pp(e),o=r.closest(`[data-velloo-board="true"]`);if(!o){i.zoomAtViewportCenter({factor:a});return}let s=r.getBoundingClientRect(),c=o.getBoundingClientRect(),l=r.clientWidth>0?s.width/r.clientWidth:i.canvasZoom,u=r.clientHeight>0?s.height/r.clientHeight:i.canvasZoom,d=bp(s.left-c.left+t*l,s.top-c.top+n*u,a,{zoom:i.canvasZoom,pan:i.pan});d.zoom!==i.canvasZoom&&(i.setCanvasZoom(d.zoom),i.setPan(d.pan))},onParentPan(e,t){let n=q.getState();n.setPan({x:n.pan.x-e,y:n.pan.y-t})}});return s.current=p,r.contentDocument?.readyState===`complete`&&p.attach(),()=>{p.destroy(),s.current=null,f(t.id)}},[t.id,t.screen,e,r,n,i,a,o,c,l,u,d,f]),s}var Xv=(e,t)=>t.x<e.x+e.w&&t.x+t.w>e.x&&t.y<e.y+e.h&&t.y+t.h>e.y;function Zv(e,t,n,r){let i=n,a=r,o=t.filter(t=>!Xv(e,t));for(let t=0;t<=o.length;t++){let t=o.find(t=>Xv({x:e.x,y:e.y,w:i,h:a},t));if(!t)break;let n=t.x-e.x,r=t.y-e.y,s=n>=e.w,c=r>=e.h;if(s&&(!c||n*a>=i*r))i=n;else if(c)a=r;else break}return{w:i,h:a}}function Qv(e,t,n,r){let i=n.x,a=n.y;for(let n=0;n<=t.length;n++){let n=t.find(t=>Xv({x:i,y:a,w:e.w,h:e.h},t));if(!n)return{x:i,y:a};let r=[{dx:n.x-e.w-i,dy:0},{dx:n.x+n.w-i,dy:0},{dx:0,dy:n.y-e.h-a},{dx:0,dy:n.y+n.h-a}].reduce((e,t)=>Math.abs(t.dx)+Math.abs(t.dy)<Math.abs(e.dx)+Math.abs(e.dy)?t:e);i+=r.dx,a+=r.dy}return r}var $v=44;function ey({boardId:e,frame:t,otherFrames:n}){let[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),s=q(e=>e.setFrameDraft),c=()=>{let e=q.getState().frameInsets,r=t=>e[t.id]?.chromeH??$v;return{chromeH:r(t),neighbors:n.map(e=>({x:e.x,y:e.y,w:e.w,h:e.h+r(e)}))}};return{draftPos:a,draftSize:r,startDrag:n=>{if(n.button!==0)return;n.preventDefault(),n.stopPropagation();let r=n.currentTarget;r.setPointerCapture(n.pointerId);let i=t.x,a=t.y,l=n.clientX,u=n.clientY,d=q.getState().canvasZoom||1,{chromeH:f,neighbors:p}=c(),m={w:t.w,h:t.h+f},h=e=>{let t=(e.clientX-l)/d,n=(e.clientY-u)/d;return Qv(m,p,{x:Math.round(i+t),y:Math.round(a+n)},{x:i,y:a})},g=e=>{let n=h(e);o(n),s(t.id,{...n,w:t.w,h:t.h})},_=n=>{r.removeEventListener(`pointermove`,g),r.removeEventListener(`pointerup`,_),r.removeEventListener(`pointercancel`,_);let c=h(n);o(null),s(t.id,null),(c.x!==i||c.y!==a)&&B.updateFrame({boardId:e,frameId:t.id,patch:{x:c.x,y:c.y}}).catch(e=>H(e,`Could not move frame`))};r.addEventListener(`pointermove`,g),r.addEventListener(`pointerup`,_),r.addEventListener(`pointercancel`,_)},startResize:n=>r=>{r.preventDefault(),r.stopPropagation();let a=r.currentTarget;a.setPointerCapture(r.pointerId);let o=t.w,l=t.h,u=r.clientX,d=r.clientY,f=q.getState().canvasZoom||1,{chromeH:p,neighbors:m}=c(),h={x:t.x,y:t.y,w:t.w,h:t.h+p},g=e=>{let t=(e.clientX-u)/f,r=(e.clientY-d)/f,i=n===`s`?o:Math.max(120,Math.round(o+t)),a=n===`e`?l:Math.max(120,Math.round(l+r)),s=Zv(h,m,i,a+p);return{w:s.w,h:s.h-p}},_=e=>{let n=g(e);i(n),s(t.id,{x:t.x,y:t.y,...n})},v=n=>{a.removeEventListener(`pointermove`,_),a.removeEventListener(`pointerup`,v),a.removeEventListener(`pointercancel`,v);let r=g(n);i(null),s(t.id,null),(r.w!==o||r.h!==l)&&B.updateFrame({boardId:e,frameId:t.id,patch:{w:r.w,h:r.h}}).catch(e=>H(e,`Could not resize frame`))};a.addEventListener(`pointermove`,_),a.addEventListener(`pointerup`,v),a.addEventListener(`pointercancel`,v)}}}var ty=[{family:`Inter`,category:`sans`,google:`ital,opsz,wght@0,14..32,100..900;1,14..32,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`The default for a reason — neutral, huge x-height, drawn for screens.`},{family:`Geist`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Tighter and more opinionated than Inter, with a mono twin.`},{family:`Manrope`,category:`sans`,google:`wght@200..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Semi-rounded geometric; friendly without going soft.`},{family:`DM Sans`,category:`sans`,google:`ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Low-contrast geometric that stays clean when set large.`},{family:`Plus Jakarta Sans`,category:`sans`,google:`ital,wght@0,200..800;1,200..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Geometric bones, humanist warmth; strong at both ends.`},{family:`Work Sans`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Optimised for the middle sizes where most interface text lives.`},{family:`Public Sans`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Unopinionated on purpose — a neutral civic workhorse.`},{family:`Figtree`,category:`sans`,google:`ital,wght@0,300..900;1,300..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Geometric with a little play in it; holds up small.`},{family:`Outfit`,category:`sans`,google:`wght@100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Purely geometric — strongest as a heading face.`},{family:`Sora`,category:`sans`,google:`wght@100..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Angular and technical; a display sans that isn't generic.`},{family:`Lexend`,category:`sans`,google:`wght@100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Wide apertures, tuned for reading proficiency.`},{family:`Rubik`,category:`sans`,google:`ital,wght@0,300..900;1,300..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Softened corners; warm and sturdy at any weight.`},{family:`Karla`,category:`sans`,google:`ital,wght@0,200..800;1,200..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`A grotesque with quirks — good foil for a serif display.`},{family:`Mulish`,category:`sans`,google:`ital,wght@0,200..1000;1,200..1000`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Minimal and quiet enough to disappear behind the content.`},{family:`Nunito Sans`,category:`sans`,google:`ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Rounded terminals; an approachable product voice.`},{family:`Source Sans 3`,category:`sans`,google:`ital,wght@0,200..900;1,200..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Adobe's interface workhorse; very legible small.`},{family:`IBM Plex Sans`,category:`sans`,google:`ital,wght@0,100..700;1,100..700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Engineered and faintly technical; pairs with Plex Mono.`},{family:`Barlow`,category:`sans`,google:`wght@400;500;600;700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Slightly condensed grotesque when you need the density.`},{family:`Archivo`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Built for high performance; enormous weight range.`},{family:`Epilogue`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Real personality once you get into the heavy weights.`},{family:`Onest`,category:`sans`,google:`wght@100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Contemporary neutral — a fresher take on the Inter brief.`},{family:`Instrument Sans`,category:`sans`,google:`ital,wght@0,400..700;1,400..700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Compact grotesque; sharp and very current.`},{family:`Schibsted Grotesk`,category:`sans`,google:`ital,wght@0,400..900;1,400..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Editorial grotesque, drawn for a news publisher.`},{family:`Space Grotesk`,category:`sans`,google:`wght@300..700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Techy proportions; the default startup display face.`},{family:`Albert Sans`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`,`display`],note:`Geometric revival with an elegant lowercase.`},{family:`Bricolage Grotesque`,category:`sans`,google:`opsz,wght@12..96,200..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Deliberately awkward — excellent editorial headers.`},{family:`Hanken Grotesk`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Even-toned grotesque that never draws attention.`},{family:`Be Vietnam Pro`,category:`sans`,google:`wght@400;500;600;700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`body`],note:`Crisp geometric with unusually good diacritics.`},{family:`Red Hat Display`,category:`sans`,google:`ital,wght@0,300..900;1,300..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Open and geometric; corporate without being cold.`},{family:`Source Serif 4`,category:`serif`,google:`ital,opsz,wght@0,8..60,200..900;1,8..60,200..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Screen-first serif; comfortable over long measures.`},{family:`Lora`,category:`serif`,google:`ital,wght@0,400..700;1,400..700`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Brushed curves — the safe editorial body serif.`},{family:`Crimson Pro`,category:`serif`,google:`ital,wght@0,200..900;1,200..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Old-style and book-like; low contrast survives screens.`},{family:`Newsreader`,category:`serif`,google:`ital,opsz,wght@0,6..72,200..800;1,6..72,200..800`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Made for news, so it works as body and as headline.`},{family:`Literata`,category:`serif`,google:`ital,opsz,wght@0,7..72,200..900;1,7..72,200..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Google's ebook serif; sturdy down to small sizes.`},{family:`Spectral`,category:`serif`,google:`wght@400;500;600;700`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Screen-native serif with generous built-in spacing.`},{family:`EB Garamond`,category:`serif`,google:`ital,wght@0,400..800;1,400..800`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Classic Garamond — give it size and leading to breathe.`},{family:`Libre Baskerville`,category:`serif`,google:`ital,wght@0,400..700;1,400..700`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`High contrast; set it larger than you think.`},{family:`Bitter`,category:`serif`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Contemporary slab that stays strong at small sizes.`},{family:`Merriweather`,category:`serif`,google:`ital,opsz,wght@0,18..144,300..900;1,18..144,300..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Dense and dark; built to be legible on screens.`},{family:`Petrona`,category:`serif`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Quirky text serif with a surprisingly wide range.`},{family:`Faustina`,category:`serif`,google:`ital,wght@0,300..800;1,300..800`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Compact serif that packs a lot of words per line.`},{family:`Frank Ruhl Libre`,category:`serif`,google:`wght@300..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Hebrew-rooted serif with striking heavy weights.`},{family:`Vollkorn`,category:`serif`,google:`ital,wght@0,400..900;1,400..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Warm and slightly rough — good for long-form.`},{family:`Zilla Slab`,category:`serif`,google:`wght@400;500;600;700`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Mozilla's slab: technical but warm.`},{family:`Roboto Slab`,category:`serif`,google:`wght@100..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`,`display`],note:`Neutral slab; the least surprising choice.`},{family:`Alegreya`,category:`serif`,google:`ital,wght@0,400..900;1,400..900`,fallback:`ui-serif, Georgia, serif`,roles:[`body`],note:`Calligraphic origins, designed for literature.`},{family:`Instrument Serif`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`High-contrast display serif; everywhere right now.`},{family:`Fraunces`,category:`serif`,google:`opsz,wght@9..144,100..900`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Wonky and optical-size aware; enormous personality.`},{family:`Playfair Display`,category:`serif`,google:`wght@400..900`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`High-contrast Didone — the classic luxury headline.`},{family:`DM Serif Display`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Sharp Didone; the free Playfair alternative.`},{family:`Bodoni Moda`,category:`serif`,google:`opsz,wght@6..96,400..900`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`True Didone with optical sizes; fashion-editorial.`},{family:`Abril Fatface`,category:`display`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Heavy Didone built for one-word headlines.`},{family:`Unbounded`,category:`sans`,google:`wght@200..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Geometric and loud; unmistakably brand-forward.`},{family:`Syne`,category:`sans`,google:`wght@400..800`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Deliberately odd widths — art-gallery energy.`},{family:`Anton`,category:`sans`,google:`wght@400`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Ultra-condensed poster weight, and only that.`},{family:`Bebas Neue`,category:`sans`,google:`wght@400`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`All-caps condensed; posters and scoreboards.`},{family:`Archivo Black`,category:`sans`,google:`wght@400`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`One very heavy weight that fills the line.`},{family:`Big Shoulders`,category:`display`,google:`opsz,wght@10..72,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Tall condensed; wayfinding and data-dense headers.`},{family:`Cormorant Garamond`,category:`serif`,google:`wght@300..700`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Delicate high contrast — set it big or lose it.`},{family:`Marcellus`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Roman inscriptional capitals; quietly expensive.`},{family:`Prata`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Didone with a single weight and a lot of poise.`},{family:`Gloock`,category:`serif`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Fat high-contrast serif; editorial and current.`},{family:`Yeseva One`,category:`display`,google:`wght@400`,fallback:`ui-serif, Georgia, serif`,roles:[`display`],note:`Curvy and decorative; strong at very large sizes.`},{family:`Chivo`,category:`sans`,google:`ital,wght@0,100..900;1,100..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Grotesque with heavy weights made for headlines.`},{family:`Darker Grotesque`,category:`sans`,google:`wght@300..900`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`],note:`Tall, tight and slightly strange.`},{family:`Familjen Grotesk`,category:`sans`,google:`ital,wght@0,400..700;1,400..700`,fallback:`ui-sans-serif, system-ui, sans-serif`,roles:[`display`,`body`],note:`Swedish grotesque with a distinctive g.`},{family:`Caveat`,category:`handwriting`,google:`wght@400..700`,fallback:`ui-rounded, cursive`,roles:[`display`],note:`Handwritten — annotations and margin notes.`},{family:`JetBrains Mono`,category:`mono`,google:`wght@100..800`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Tall x-height, drawn for code; the safe default.`},{family:`IBM Plex Mono`,category:`mono`,google:`wght@400;500;600;700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Pairs exactly with Plex Sans and Plex Serif.`},{family:`Space Mono`,category:`mono`,google:`wght@400;700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`,`display`],note:`Retro-technical and quirky; works as display mono.`},{family:`Fira Code`,category:`mono`,google:`wght@300..700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Programming ligatures, if you want them.`},{family:`Source Code Pro`,category:`mono`,google:`wght@200..900`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Adobe's code face; wide and unambiguous.`},{family:`Roboto Mono`,category:`mono`,google:`wght@100..700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`The neutral default nobody objects to.`},{family:`DM Mono`,category:`mono`,google:`wght@400;500`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Low contrast and geometric; unusually pretty.`},{family:`Geist Mono`,category:`mono`,google:`wght@100..900`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Geist's twin — use them together.`},{family:`Martian Mono`,category:`mono`,google:`wght@100..800`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`,`display`],note:`Wide and semi-condensed; a mono with presence.`},{family:`Azeret Mono`,category:`mono`,google:`wght@100..900`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Boxy and deliberate; good for figures and tables.`},{family:`Red Hat Mono`,category:`mono`,google:`wght@300..700`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Humanist mono that reads like prose.`},{family:`Inconsolata`,category:`mono`,google:`wght@200..900`,fallback:`ui-monospace, SFMono-Regular, monospace`,roles:[`mono`],note:`Narrow and efficient; fits more columns.`}];function ny(e){return ty.find(t=>t.family===e)}function ry(e){return`"${e.family}", ${e.fallback}`}function iy(e,t,n){let r=t.replace(/ /g,`+`);return`https://fonts.googleapis.com/css2?family=${e===!0?r:`${r}:${e}`}${n?`&text=${encodeURIComponent(n)}`:``}&display=swap`}function ay(e){return vc(e.role)?`:root {\n --font-${e.role}: ${yc(e.stack)};\n}`:``}function oy(e){return e.google?iy(e.google,e.family):null}function sy(e){let t=e.name===dl;if(!t&&!fl(e.name))return``;let n=Cl(e.typeset,` `,!t);return n.length===0?``:`${t?`:root, .typeset`:`.typeset-${e.name}`} {\n${n.join(`
6
+ `)}\n}`}function cy({slotRefs:e,front:t,screenRev:n,hasScreen:r,frontIsCurrent:i}){let a=q(e=>e.cursorMode),o=q(e=>e.typesetDraft),s=q(e=>e.fontDraft),[c,l]=e;(0,P.useEffect)(()=>{let e=e=>{let t=e?.contentDocument;if(!t?.head)return;let n=`__velloo-comment-cursor`,r=t.getElementById(n),i=a===`comment`?`cell`:a===`note`?`crosshair`:null;i?(r||(r=t.createElement(`style`),r.id=n,t.head.appendChild(r)),r.textContent=`*, *::before, *::after { cursor: ${i} !important; }`):r&&r.remove()};e(c.current),e(l.current)},[a,t,n,r]);let u=(0,P.useRef)(null);o||s?u.current={css:[o?sy(o):``,s?ay(s):``].filter(Boolean).join(`
7
+ `),fontUrl:s?oy(s):null}:i&&(u.current=null);let d=u.current,f=d?.css??``,p=d?.fontUrl??null;(0,P.useEffect)(()=>{let e=e=>{let t=e?.contentDocument;t?.head&&(ly(t,`__velloo-font-draft`,`link`,p,e=>{let t=e;t.rel=`stylesheet`,t.href=p}),ly(t,`__velloo-theme-draft`,`style`,f||null,e=>{e.textContent=f}))};e(c.current),e(l.current)},[f,p,t,n,r])}function ly(e,t,n,r,i){let a=e.getElementById(t);if(r===null){a?.remove();return}let o=a??e.createElement(n);a||(o.id=t,e.head.appendChild(o)),i(o)}var uy=198,dy=`
8
+ @keyframes velloo-loading-trace {
9
+ 0% { stroke-dashoffset: ${uy}; }
10
+ 40% { stroke-dashoffset: 0; }
11
+ 60% { stroke-dashoffset: 0; }
12
+ 100% { stroke-dashoffset: -${uy}; }
13
+ }
14
+ .velloo-loading-ring {
15
+ stroke-dasharray: ${uy};
16
+ /* backwards: amber's delay would otherwise show it fully drawn for 180ms
17
+ before the trace starts, popping on every mount. */
18
+ animation: velloo-loading-trace 1.6s ease-in-out infinite backwards;
19
+ }
20
+ .velloo-loading-ring-amber { animation-delay: 0.18s; }
21
+ @media (prefers-reduced-motion: reduce) {
22
+ .velloo-loading-ring {
23
+ animation: none;
24
+ stroke-dasharray: none;
25
+ stroke-dashoffset: 0;
26
+ }
27
+ }
28
+ `;function fy({size:e=22,className:t}){let n=`velloo-loading-weave-${(0,P.useId)().replace(/[^a-zA-Z0-9]/g,``)}`;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`style`,{href:`velloo-loading`,precedence:`default`,children:dy}),(0,G.jsxs)(`svg`,{viewBox:`0 0 120 120`,width:e,height:e,className:t,fill:`none`,"aria-hidden":`true`,focusable:`false`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.jsx)(`defs`,{children:(0,G.jsx)(`clipPath`,{id:n,children:(0,G.jsx)(`rect`,{x:`52`,y:`30`,width:`38`,height:`35`})})}),(0,G.jsx)(`rect`,{className:`velloo-loading-ring`,x:`21`,y:`21`,width:`58`,height:`58`,rx:`20`,stroke:`#FF6F4D`,strokeWidth:`11`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,G.jsx)(`rect`,{className:`velloo-loading-ring velloo-loading-ring-amber`,x:`41`,y:`41`,width:`58`,height:`58`,rx:`20`,stroke:`#FFAB1F`,strokeWidth:`11`,strokeLinejoin:`round`,strokeLinecap:`round`}),(0,G.jsx)(`rect`,{className:`velloo-loading-ring`,x:`21`,y:`21`,width:`58`,height:`58`,rx:`20`,stroke:`#FF6F4D`,strokeWidth:`11`,strokeLinejoin:`round`,strokeLinecap:`round`,clipPath:`url(#${n})`})]})]})}function py({label:e,size:t,className:n}){return(0,G.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex items-center justify-center gap-2${n?` ${n}`:``}`,children:[(0,G.jsx)(fy,{size:t}),e?(0,G.jsx)(`span`,{children:e}):(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading`})]})}function my({open:e,title:t,placeholder:n,submitLabel:r,maxLength:i,value:a,onValueChange:o,onSubmit:s,onCancel:c}){return(0,G.jsx)(fh,{open:e,onOpenChange:e=>{e||c()},children:(0,G.jsxs)(hh,{className:`sm:max-w-sm`,children:[(0,G.jsx)(gh,{children:(0,G.jsx)(vh,{children:t})}),(0,G.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),s()},children:[(0,G.jsx)(Z,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),onFocus:e=>e.currentTarget.select(),maxLength:i,placeholder:n,"aria-label":n}),(0,G.jsxs)(_h,{children:[(0,G.jsx)(J,{type:`button`,variant:`outline`,onClick:c,children:`Cancel`}),(0,G.jsx)(J,{type:`submit`,disabled:a.trim().length===0,children:r})]})]})]})})}function hy({size:e=28,label:t,counterZoom:n=!1}){return(0,G.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute inset-0 z-10 grid place-items-center rounded-md border bg-card text-xs text-muted-foreground pointer-events-none`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,style:n?{transform:`scale(calc(1 / var(--canvas-zoom, 1)))`}:void 0,children:[(0,G.jsx)(fy,{size:e}),t?(0,G.jsx)(`span`,{children:t}):(0,G.jsx)(`span`,{className:`sr-only`,children:`Loading`})]})})}var gy=(0,P.memo)(function({boardId:e,frame:t,frames:n,presets:r,sharedCount:i}){let a=(0,P.useMemo)(()=>n.filter(e=>e.id!==t.id),[n,t.id]),o=(0,P.useRef)(null),s=q(e=>e.screens[t.screen]),c=q(t=>t.boards[e]?.theme),l=q(e=>e.screenVersions[t.screen]??0),u=q(e=>e.themeVersion),d=q(e=>e.designMode),f=q(e=>e.cursorMode),p=q(e=>e.wsConnected),m=q(e=>e.canvasZoom),h=q(e=>e.setFrameInset),g=q(e=>e.reportRenderError),_=q(e=>e.frameGlow[t.id]),[v,y]=(0,P.useState)(!1),{draftPos:b,draftSize:x,startDrag:S,startResize:C}=ey({boardId:e,frame:t,otherFrames:a}),w=x?.w??t.w,T=x?.h??t.h,E=b?.x??t.x,D=b?.y??t.y,O=!!s,{anchoredPaths:k,snippetPaths:A,anchoredPathsRef:j,snippetPathsRef:M}=gv(t),ee=pv({frame:t,canvasDefault:d,...c?{boardTheme:c}:{},screenRevision:l,themeVersion:u}),te=(0,P.useRef)(ee);p&&(te.current=ee);let ne=te.current,N=(0,P.useRef)(null),{srcs:re,front:ie,painted:ae,frontRef:oe,slotRefs:se,settleSlot:ce}=Uv(ne,N);(0,P.useEffect)(()=>{let e=o.current;if(!e)return;let n=e.parentElement,r=()=>{h(t.id,{x:e.offsetLeft,y:e.offsetTop,chromeH:(n?.offsetHeight??e.offsetHeight)-e.offsetHeight})};r();let i=new ResizeObserver(r);return n&&i.observe(n),i.observe(e),()=>{i.disconnect(),h(t.id,null)}},[t.id,O,h]);let le=Yv({boardId:e,frame:t,iframeRef:oe,hasScreen:O,savedScrollRef:N,anchoredPathsRef:j,snippetPathsRef:M});Hv(le,t,k,A),cy({slotRefs:se,front:ie,screenRev:l,hasScreen:O,frontIsCurrent:re[ie]===ne}),(0,P.useEffect)(()=>{if(!_)return;y(!0);let e=setTimeout(()=>y(!1),1400);return()=>clearTimeout(e)},[_]);let ue=t.label??s?.name??t.screen,de=Gv({boardId:e,frame:t,frameLabel:ue,boardTheme:c}),fe=f===`hand`;return(0,G.jsxs)(`div`,{className:`absolute group`,style:{left:E,top:D},"data-frame-id":t.id,"data-group-id":t.group??``,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`div`,{style:{width:`calc(${w}px * var(--canvas-zoom, 1))`,transform:`scale(calc(1 / var(--canvas-zoom, 1)))`,transformOrigin:`bottom left`},children:(0,G.jsx)(Lv,{label:ue,w,h:T,sharedCount:i,library:s?.library??null,presets:r,scheme:t.scheme,fit:t.fit===`content`,canvasDefault:d,chromeWidth:w*m,onPointerDownGrip:S,onRemove:de.requestRemove,onExport:de.onExport,onResize:de.onResize,onPreview:de.onPreview,onAddSibling:de.onAddSibling,onSchemeChange:de.onSchemeChange,onFitChange:de.onFitChange,moveTargets:de.moveTargets,onMoveToBoard:de.onMoveToBoard,onMoveToNewBoard:()=>de.setNewBoardName(ue)})}),s?(0,G.jsxs)(`div`,{ref:o,className:`relative`+(v?` rounded-md ring-2 ring-primary/70 shadow-[0_0_18px_2px] shadow-primary/25 transition-shadow duration-300`:``),style:{width:w,height:T},children:[[0,1].map(e=>re[e]===null?null:(0,G.jsx)(`iframe`,{ref:se[e],title:`${s.name} (${t.id})${e===ie?``:` — loading`}`,src:re[e],width:w,height:T,onLoad:()=>{g(t.screen,fv(se[e].current)),ce(e)&&le.current?.attach()},"aria-hidden":e!==ie||void 0,className:`velloo-frame-iframe absolute inset-0 rounded-md bg-white ring-1 ring-border`+(e===ie?``:` invisible`),style:{width:w,height:T,pointerEvents:e===ie&&!fe?`auto`:`none`}},e)),ae?null:(0,G.jsx)(hy,{counterZoom:!0}),(0,G.jsx)(`div`,{onPointerDown:C(`e`),className:`absolute top-0 right-0 h-full w-0.5 cursor-ew-resize opacity-0 group-hover:opacity-100 transition-opacity border-r border-dashed border-primary/40 hover:border-solid hover:border-r-2 hover:border-primary/70`,role:`presentation`}),(0,G.jsx)(`div`,{onPointerDown:C(`s`),className:`absolute bottom-0 left-0 w-full h-0.5 cursor-ns-resize opacity-0 group-hover:opacity-100 transition-opacity border-b border-dashed border-primary/40 hover:border-solid hover:border-b-2 hover:border-primary/70`,role:`presentation`}),(0,G.jsx)(`div`,{onPointerDown:C(`se`),className:`absolute bottom-0 right-0 h-2 w-2 cursor-nwse-resize opacity-0 group-hover:opacity-100 transition-opacity bg-primary/50 hover:bg-primary rounded-br`,role:`presentation`}),(0,G.jsx)(vv,{frameId:t.id})]}):(0,G.jsx)(`div`,{style:{width:w,height:T},className:`border border-dashed border-muted-foreground/30 rounded-md grid place-items-center text-xs text-muted-foreground`,children:(0,G.jsx)(py,{size:28,label:t.screen,className:`flex-col`})}),(0,G.jsx)(`div`,{style:{width:`calc(${w}px * var(--canvas-zoom, 1))`,transform:`scale(calc(1 / var(--canvas-zoom, 1)))`,transformOrigin:`top left`},children:(0,G.jsx)(Bv,{frame:t,presets:r,onPick:de.onPickPreset})})]}),(0,G.jsx)(hv,{open:de.confirmRemove,title:`Remove frame`,description:`Remove this placement of "${ue}" from the board? The underlying screen stays — only this frame is removed. You can put it back with ⌘Z.`,confirmLabel:`Remove`,onConfirm:de.doRemove,onCancel:de.cancelRemove}),(0,G.jsx)(my,{open:de.newBoardName!==null,title:`Move to a new board`,placeholder:`Board name`,submitLabel:`Create and move`,maxLength:80,value:de.newBoardName??``,onValueChange:de.setNewBoardName,onSubmit:()=>void de.submitNewBoard(),onCancel:()=>de.setNewBoardName(null)})]})});function _y(){let e=q(e=>e.components);return(0,P.useMemo)(()=>{let t=e?.find(e=>e.id===`Icon`)?.props.find(e=>e.name===`name`);return Array.isArray(t?.enumValues)?t.enumValues:[]},[e])}function vy(){let e=q(e=>e.selection),t=q(e=>e.currentBoardId?e.boards[e.currentBoardId]:void 0),n=q(e=>e.nodeRects),r=q(e=>e.snippetRects),i=q(e=>e.snippetFocus),a=q(e=>e.selectionAnchor),o=q(e=>e.frameInsets);return(0,P.useMemo)(()=>{if(!e||!t)return[];let s=i!==null&&e.screenId===`snippet:${i}`,c=[];for(let i of t.frames){let t=s?r[i.id]?.[e.path]??[]:i.screen===e.screenId?[n[i.id]?.[e.path]]:[],l=o[i.id]??{x:0,y:0,chromeH:0},u={x:i.x+l.x,y:i.y+l.y,w:i.w,h:i.h};t.forEach((e,t)=>{e&&c.push({frameId:i.id,key:`${i.id}:${t}`,x:u.x+e.x,y:u.y+e.y,w:e.w,h:e.h,anchor:s?a?a.frameId===i.id&&a.instance===t:c.length===0:!0,clip:u})})}return c},[e,t,n,r,i,a,o])}var yy=w(`oklch`),by=w(`rgb`),xy=w(`hsl`);function Sy(e,t=3){if(e===void 0||Number.isNaN(e))return 0;let n=10**t;return Math.round(e*n)/n}function Cy(e){let t=yy(e);return`oklch(${Sy(t.l)} ${Sy(t.c)} ${Sy(t.h)}${t.alpha!==void 0&&t.alpha<1?` / ${Sy(t.alpha,3)}`:``})`}function wy(e){let t=xy(e);return`hsl(${Sy(t.h??0,1)} ${Sy((t.s??0)*100,1)}% ${Sy((t.l??0)*100,1)}%${t.alpha!==void 0&&t.alpha<1?` / ${Sy(t.alpha,3)}`:``})`}function Ty(e){if(!e)return null;let t=x(e);return t?Ey(t):null}function Ey(e){let t=by(e);return{hex:E(t)??`#000000`,oklch:Cy(e),hsl:wy(e)}}function Dy(e){let t=x(e);return t?Cy(t):null}var Oy=e=>{if(!e)return null;let t=Number.parseFloat(e);return Number.isFinite(t)?Math.round(t*100)/100:null},ky={100:`light`,200:`light`,300:`light`,400:`normal`,500:`medium`,600:`semibold`,700:`bold`,800:`bold`,900:`bold`},Ay={0:`0`,1:`1`,2:`2`,4:`4`};function jy(e){return e===null?null:`${e}px`}function My(e){let t=e?.split(`,`)[0]?.trim();return t?t.replace(/^["']|["']$/g,``):null}function Ny(e){return!e||/^rgba?\([^)]*[,/]\s*0\s*\)$/.test(e.trim())?null:Ty(e)?.hex??null}function Py(e){let[t]=e;return t==null?null:e.every(e=>e===t)?t:null}function Fy(e){if(!e)return{};let t={},n=(e,n)=>{n!==null&&(t[e]=n)},r=Oy(e.fontSize);n(`font`,My(e.fontFamily)),n(`size`,r),n(`weight`,ky[e.fontWeight??``]??null);let i=Oy(e.lineHeight);n(`leading`,i!==null&&r?Math.round(i/r*100)/100:null),n(`tracking`,e.letterSpacing===`normal`?`normal`:jy(Oy(e.letterSpacing))),n(`align`,(e.textAlign===`start`?`left`:e.textAlign===`end`?`right`:null)??e.textAlign??null),n(`color`,Ny(e.color)),n(`bg`,Ny(e.backgroundColor)),n(`borderColor`,Ny(e.borderTopColor));let a=Oy(e.borderTopWidth);return n(`borderWidth`,a===null?null:Ay[a]??jy(a)),n(`rounded`,jy(Oy(e.borderTopLeftRadius))),n(`padding`,Py([Oy(e.paddingTop),Oy(e.paddingRight),Oy(e.paddingBottom),Oy(e.paddingLeft)])),n(`margin`,Py([Oy(e.marginTop),Oy(e.marginRight),Oy(e.marginBottom),Oy(e.marginLeft)])),n(`gap`,e.columnGap===`normal`?0:Oy(e.columnGap)),t}function Iy(e){return e.filter(e=>e.tier===`bar`)}var Ly=new Set([`h1`,`h2`,`h3`,`h4`,`h5`,`h6`]),Ry=new Set([`p`,`span`,`small`,`strong`,`em`,`b`,`i`,`label`,`blockquote`,`figcaption`,`li`,`dt`,`dd`]),zy=new Set([`Box`,`Card`,`CardContent`,`CardHeader`,`CardFooter`,`Container`,`Stack`,`Layer`,`Placeholder`]);function By(e){if(Sc(e))return`snippet`;if(!xc(e))return`other`;let t=e.$ref;if(t===`Image`)return`image`;if(t===`Icon`)return`icon`;if(t===`Heading`)return`heading`;if(t===`Text`)return`text`;if(t===`Box`){let t=typeof e.props?.as==`string`?e.props.as:void 0;return t&&Ly.has(t)?`heading`:t&&Ry.has(t)||typeof e.props?.children==`string`?`text`:`box`}return zy.has(t)?`box`:`other`}var Vy=[{value:`full`,label:`Fill`},{value:`fit`,label:`Hug`},{value:`fixed`,label:`Fixed`}],Hy=[{value:`light`,label:`Light`},{value:`normal`,label:`Regular`},{value:`medium`,label:`Medium`},{value:`semibold`,label:`Semibold`},{value:`bold`,label:`Bold`}],Uy=[{value:`none`,label:`Square`},{value:`sm`,label:`Small`},{value:`md`,label:`Medium`},{value:`lg`,label:`Large`},{value:`full`,label:`Round`}],Wy=[{value:`left`,label:`Left`},{value:`center`,label:`Center`},{value:`right`,label:`Right`}],Gy=[{value:`0`,label:`None`},{value:`1`,label:`Hairline`},{value:`2`,label:`Medium`},{value:`4`,label:`Thick`}],Ky=[{value:`tighter`,label:`Tighter`},{value:`tight`,label:`Tight`},{value:`normal`,label:`Normal`},{value:`wide`,label:`Wide`},{value:`wider`,label:`Wider`}];function qy(e,t){if(!t)return null;if(t.startsWith(`[`))return t.slice(1,-1);if(t.startsWith(`#`))return t;if(!e)return null;let n=t.split(`/`)[0]??t,r=e.colors,i=r[n];if(typeof i==`string`)return i;if(i&&typeof i==`object`)return i.DEFAULT??null;let a=/^(.*)-foreground$/.exec(n);if(a){let e=r[a[1]??``];if(e&&typeof e==`object`)return e.foreground??null}return e.palette?.[n]??null}function Jy(e){if(!e)return[];let t=[],n=(n,r)=>{let i=qy(e,n);t.push({value:n,label:r,...i===null?{}:{swatch:i}})};for(let[t,r]of Object.entries(e.colors))r!=null&&(n(t,Xy(t)),typeof r==`object`&&`foreground`in r&&r.foreground!==void 0&&n(`${t}-foreground`,`${Xy(t)} text`));return t}function Yy(e){let t=e?.typography?.fontFamily;return t?Object.keys(t).map(e=>({value:e,label:Xy(e)})):[]}function Xy(e){return e.charAt(0).toUpperCase()+e.slice(1).replace(/-/g,` `)}var Zy=e=>({via:`style`,key:e}),Qy={id:`width`,label:`Width`,kind:`size`,slot:Zy(`width`),tier:`pane`,width:132,choices:Vy},$y={id:`height`,label:`Height`,kind:`size`,slot:Zy(`height`),tier:`pane`,width:132,choices:Vy},eb={id:`rounded`,label:`Corners`,kind:`choice`,slot:Zy(`rounded`),tier:`pane`,width:108,choices:Uy},tb=[{id:`borderWidth`,label:`Border`,kind:`choice`,slot:Zy(`borderWidth`),tier:`bar`,width:100,choices:Gy},{id:`borderColor`,label:`Border color`,kind:`color`,slot:Zy(`borderColor`),tier:`bar`,width:132}],nb=[{id:`font`,label:`Font`,kind:`font`,slot:Zy(`fontFamily`),tier:`bar`,width:112},{id:`size`,label:`Size`,kind:`number`,slot:Zy(`fontSize`),tier:`bar`,width:84,min:8,max:200},{id:`weight`,label:`Weight`,kind:`choice`,slot:Zy(`fontWeight`),tier:`bar`,width:112,choices:Hy},{id:`align`,label:`Align`,kind:`align`,slot:Zy(`textAlign`),tier:`bar`,width:96,choices:Wy},{id:`color`,label:`Color`,kind:`color`,slot:Zy(`textColor`),tier:`bar`,width:132},{id:`leading`,label:`Line height`,kind:`ratio`,slot:Zy(`leading`),tier:`pane`,width:96,min:.75,max:3,step:.05},{id:`tracking`,label:`Letter spacing`,kind:`choice`,slot:Zy(`tracking`),tier:`pane`,width:108,choices:Ky},{id:`bg`,label:`Background`,kind:`color`,slot:Zy(`bg`),tier:`pane`,width:132},{...Qy},{...$y},{id:`padding`,label:`Padding`,kind:`number`,slot:Zy(`padding`),tier:`pane`,width:88,min:0,max:256},{...eb},...tb.map(e=>({...e,tier:`pane`}))],rb=[{id:`margin`,label:`Margin`,kind:`number`,slot:Zy(`margin`),tier:`bar`,width:88,min:0,max:256},{id:`padding`,label:`Padding`,kind:`number`,slot:Zy(`padding`),tier:`bar`,width:88,min:0,max:256},{id:`color`,label:`Text`,kind:`color`,slot:Zy(`textColor`),tier:`bar`,width:132},{id:`bg`,label:`Background`,kind:`color`,slot:Zy(`bg`),tier:`bar`,width:132},...tb,{...Qy},{...$y},{id:`gap`,label:`Gap`,kind:`number`,slot:Zy(`gap`),tier:`pane`,width:88,min:0,max:256},{...eb},{id:`align`,label:`Align`,kind:`align`,slot:Zy(`textAlign`),tier:`pane`,width:96,choices:Wy}],ib=[{id:`prompt`,label:`Prompt`,kind:`prompt`,slot:{via:`prop`,name:`src`},tier:`bar`,width:180},{...eb,tier:`bar`},{...Qy},{...$y},...tb.map(e=>({...e,tier:`pane`}))],ab=[{id:`name`,label:`Icon`,kind:`icon`,slot:{via:`prop`,name:`name`},tier:`bar`,width:148},{id:`size`,label:`Size`,kind:`number`,slot:{via:`prop`,name:`size`},tier:`bar`,width:84,min:8,max:128},{id:`color`,label:`Color`,kind:`color`,slot:Zy(`textColor`),tier:`bar`,width:132}],ob=new Set([`className`,`style`,`sx`,`asChild`,`children`,`key`,`ref`]);function sb(e){let t=[];for(let n of e?.props??[]){if(t.length>=2)break;ob.has(n.name)||n.control===`enum`&&n.enumValues?.length&&t.push({id:`prop:${n.name}`,label:Xy(n.name),kind:`choice`,slot:{via:`prop`,name:n.name},tier:`bar`,width:124,choices:n.enumValues.map(e=>({value:String(e),label:Xy(String(e))}))})}return[...t,...rb.map(e=>({...e,tier:`pane`}))]}var cb=4;function lb(e){if(!e)return[];let t=[];for(let n of e.params??[]){let e=ub(n);e&&t.push(t.length<cb?e:{...e,tier:`pane`})}return t}function ub(e){let t={via:`arg`,name:e.name},n={id:`arg:${e.name}`,label:Xy(e.name),slot:t,tier:`bar`};switch(e.type){case`number`:return{...n,kind:`number`,width:88,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step}};case`boolean`:return{...n,kind:`toggle`,width:88};case`enum`:return{...n,kind:`choice`,width:124,choices:(e.enum??[]).map(e=>({value:e,label:Xy(e)}))};case`color`:return{...n,kind:`color`,width:132};case`icon`:return{...n,kind:`icon`,width:148};case`string`:return{...n,kind:`text`,width:144};case`node`:return null}}function db({node:e,descriptor:t,snippet:n}){let r=By(e);switch(r){case`heading`:case`text`:return{role:r,controls:nb};case`box`:return{role:r,controls:rb};case`image`:return{role:r,controls:ib};case`icon`:return{role:r,controls:ab};case`snippet`:return{role:r,controls:lb(n)};case`other`:return{role:r,controls:sb(t)}}}function fb(e){return!(`$ref`in e)||e.$ref!==`Heading`?null:hl[vl(e.props?.level)]??null}var pb=new Set([`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`,`9xl`,...ml]),mb=new Set([`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`]),hb=/^\[-?[\d.]+(px|rem|em|%|ch|vw|vh)?\]$/;function gb(e,t){if(e.startsWith(`leading-`))return`leading`;if(e.startsWith(`tracking-`))return`tracking`;if(e.startsWith(`text-`)){let t=e.slice(5);return pb.has(t)||hb.test(t)?`size`:null}if(e.startsWith(`font-`)){let n=e.slice(5);return mb.has(n)?`weight`:t.has(n)||n===`sans`||n===`serif`||n===`mono`?`family`:null}return null}function _b(e){let t=e.props??{};if(e.$ref===`Heading`){let e=vl(t.level);return{role:hl[e],via:t.level===void 0?`level 1 (default)`:`level ${e}`}}if(e.$ref===`Text`){let e=String(t.variant??`default`),n=e in gl?e:`default`;return{role:gl[n],via:t.variant===void 0?`variant default`:`variant ${n}`}}return null}function vb(e,t){let n=[e],r=e;for(let e of t){if(!r||!(`$ref`in r)||(r=r.children?.[e],!r))break;n.push(r)}return n.reverse()}function yb(e,t){for(let n of vb(e,t)){if(!(`$ref`in n))continue;let e=typeof n.props?.className==`string`?n.props.className:``,t=e.split(/\s+/).find(e=>e.startsWith(`typeset-`));if(t)return{name:t.slice(8),via:`class`};if(n.$ref===`Prose`){let e=n.props?.preset;return{name:typeof e==`string`&&e?e:dl,via:`prose`}}if(e.split(/\s+/).includes(`typeset`))return{name:dl,via:`class`}}return null}function bb(e,t,n,r){if(!xc(r))return null;let i=_b(r);if(!i)return null;let a=e.typography.typesets??{},o=yb(t,n),s=a.default??{},c=o&&o.name!=="default"?a[o.name]:void 0,l={...s,...c??{}},u=e.typography.fontFamily??{},d=El(l,{fontFamily:u})[i.role],f=pl[i.role].face,p=f===`heading`?l.fontHeading??l.fontBody:l.fontBody,m=new Set(Object.keys(u)),h=typeof r.props?.className==`string`?r.props.className:``,g={},_=[];for(let e of h.split(/\s+/).filter(Boolean)){let t=e.lastIndexOf(`:`),n=gb(t===-1?e:e.slice(t+1),m);n&&(t===-1?g[n]??=e:_.push(e))}return{role:i.role,via:i.via,resolved:d,face:{slot:f,...p?{role:p}:{},...p&&u[p]?{stack:u[p]}:{}},overrides:g,responsive:_,region:o}}var xb={0:0,px:1,"0.5":2,1:4,"1.5":6,2:8,"2.5":10,3:12,"3.5":14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,56:224,64:256},Sb=Object.fromEntries(Object.entries(xb).map(([e,t])=>[t,e]));function Cb(e){if(e===void 0)return null;let t=xb[e];if(t!==void 0)return t;let n=/^\[(-?\d*\.?\d+)px\]$/.exec(e);return n?Number(n[1]):null}function wb(e){return Sb[e]??`[${e}px]`}var Tb=new Set([`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`grid`,`inline-grid`,`hidden`,`contents`,`table`,`flow-root`]),Eb=new Set([`xs`,`sm`,`base`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`8xl`,`9xl`]),Db=new Set([`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`]),Ob=new Set([`left`,`center`,`right`,`justify`,`start`,`end`]),kb=new Set([`0`,`2`,`4`,`8`]),Ab=new Set([`x`,`y`,`t`,`r`,`b`,`l`,`s`,`e`,`solid`,`dashed`,`dotted`,`double`,`hidden`,`none`,`collapse`,`separate`,`spacing`]),jb=new Set([`cover`,`contain`,`auto`,`center`,`top`,`bottom`,`left`,`right`,`repeat`,`no-repeat`,`fixed`,`local`,`scroll`,`clip`,`origin`,`blend`,`gradient`,`none`]),Mb={t:`top`,r:`right`,b:`bottom`,l:`left`};function Nb(e,t,n){if(t===``)e.top=e.right=e.bottom=e.left=n;else if(t===`x`)e.left=e.right=n;else if(t===`y`)e.top=e.bottom=n;else{let r=Mb[t];r&&(e[r]=n)}}function Pb(e){return/^\[-?\d*\.?\d+(px|rem|em|%|vh|vw|ch|ex|pt)\]$/.test(e)}function Fb(e){let t={padding:{},margin:{}},n=[],r=[];for(let i of e.split(/\s+/)){let e=i.trim();if(!e)continue;if(e.includes(`:`)||e.startsWith(`!`)){n.push(e);continue}if(Tb.has(e)){t.display=e===`hidden`?`none`:e;continue}if(e===`flex-row`||e===`flex-row-reverse`||e===`flex-col`||e===`flex-col-reverse`){t.flexDirection=e.slice(5);continue}if(e===`flex-wrap`||e===`flex-nowrap`||e===`flex-wrap-reverse`){t.flexWrap=e.slice(5);continue}let a=e.indexOf(`-`),o=a===-1?e:e.slice(0,a),s=a===-1?``:e.slice(a+1);if((o===`p`||o===`px`||o===`py`||o===`pt`||o===`pr`||o===`pb`||o===`pl`)&&s)r.push({box:`padding`,variant:o.slice(1),arg:s});else if((o===`m`||o===`mx`||o===`my`||o===`mt`||o===`mr`||o===`mb`||o===`ml`)&&s)r.push({box:`margin`,variant:o.slice(1),arg:s});else{switch(o){case`justify`:t.justify=s;continue;case`items`:t.items=s;continue;case`gap`:if(s){t.gap=s;continue}break;case`w`:if(s){t.width=s;continue}break;case`h`:if(s){t.height=s;continue}break;case`leading`:t.leading=s;continue;case`tracking`:t.tracking=s;continue;case`font`:Db.has(s)?t.fontWeight=s:t.fontFamily=s;continue;case`text`:Ob.has(s)?t.textAlign=s:Eb.has(s)||Pb(s)?t.fontSize=s:t.textColor=s;continue;case`bg`:if(jb.has(s.split(`-`)[0]??``))break;t.bg=s;continue;case`rounded`:if(s===``||!/^(t|r|b|l|tl|tr|br|bl|s|e|ss|se|ee|es)(-|$)/.test(s)){t.rounded=s;continue}break;case`border`:if(s===``){t.borderWidth=``;continue}if(kb.has(s)){t.borderWidth=s;continue}if(Ab.has(s.split(`-`)[0]??``))break;t.borderColor=s;continue}n.push(e)}}let i=e=>e===``?0:e===`x`||e===`y`?1:2;r.sort((e,t)=>i(e.variant)-i(t.variant));for(let e of r)Nb(t[e.box],e.variant,e.arg);return{model:t,extra:n}}function Ib(e,t){let{top:n,right:r,bottom:i,left:a}=t;if(n===void 0&&r===void 0&&i===void 0&&a===void 0)return[];if(n!==void 0&&n===r&&r===i&&i===a)return[`${e}-${n}`];let o=[];return n!==void 0&&n===i?o.push(`${e}y-${n}`):(n!==void 0&&o.push(`${e}t-${n}`),i!==void 0&&o.push(`${e}b-${i}`)),a!==void 0&&a===r?o.push(`${e}x-${a}`):(a!==void 0&&o.push(`${e}l-${a}`),r!==void 0&&o.push(`${e}r-${r}`)),o}function Lb({model:e,extra:t}){let n=[];return e.display&&n.push(e.display===`none`?`hidden`:e.display),e.flexDirection&&n.push(`flex-${e.flexDirection}`),e.flexWrap&&n.push(`flex-${e.flexWrap}`),e.items&&n.push(`items-${e.items}`),e.justify&&n.push(`justify-${e.justify}`),e.gap&&n.push(`gap-${e.gap}`),n.push(...Ib(`p`,e.padding)),n.push(...Ib(`m`,e.margin)),e.width&&n.push(`w-${e.width}`),e.height&&n.push(`h-${e.height}`),e.fontFamily&&n.push(`font-${e.fontFamily}`),e.fontSize&&n.push(`text-${e.fontSize}`),e.fontWeight&&n.push(`font-${e.fontWeight}`),e.leading&&n.push(`leading-${e.leading}`),e.tracking&&n.push(`tracking-${e.tracking}`),e.textAlign&&n.push(`text-${e.textAlign}`),e.textColor&&n.push(`text-${e.textColor}`),e.bg&&n.push(`bg-${e.bg}`),e.rounded!==void 0&&n.push(e.rounded===``?`rounded`:`rounded-${e.rounded}`),e.borderWidth!==void 0&&n.push(e.borderWidth===``?`border`:`border-${e.borderWidth}`),e.borderColor&&n.push(`border-${e.borderColor}`),n.push(...t),n.join(` `)}var Rb={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128},zb=Object.fromEntries(Object.entries(Rb).map(([e,t])=>[t,e]));function Bb(e){if(e===void 0)return null;let t=Rb[e];if(t!==void 0)return t;let n=/^\[(\d*\.?\d+)px\]$/.exec(e);return n?Number(n[1]):null}function Vb(e){return zb[e]??`[${e}px]`}var Hb={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2};function Ub(e){if(e===void 0)return null;let t=Hb[e];if(t!==void 0)return t;let n=/^\[(\d*\.?\d+)\]$/.exec(e);return n?Number(n[1]):null}function Wb(e){for(let[t,n]of Object.entries(Hb))if(Math.abs(n-e)<.001)return t;return`[${Number(e.toFixed(3))}]`}function Gb(e){let{top:t,right:n,bottom:r,left:i}=e;return t===void 0||t!==n||t!==r||t!==i?null:t}function Kb(e){return e===void 0?{}:{top:e,right:e,bottom:e,left:e}}function qb(e){return e===void 0?null:e===`full`||e===`screen`?`full`:e===`fit`||e===`auto`||e===`min`||e===`max`?`fit`:`fixed`}function Jb(e){if(e===void 0)return null;let t=/^\[(\d*\.?\d+)px\]$/.exec(e);return t?Number(t[1]):Cb(e)}function Yb(e){return Sc(e)?e.$extraClassName??``:xc(e)&&typeof e.props?.className==`string`?e.props.className:``}function Xb(e,t){switch(t){case`padding`:return Cb(Gb(e.padding)??void 0);case`margin`:return Cb(Gb(e.margin)??void 0);case`gap`:return Cb(e.gap);case`fontSize`:return Bb(e.fontSize);case`leading`:return Ub(e.leading);case`borderWidth`:return e.borderWidth===``?`1`:e.borderWidth??null;default:return e[t]??null}}function Zb(e,t,n){let r={...e,padding:{...e.padding},margin:{...e.margin}};if(n===null){switch(t){case`padding`:r.padding={};break;case`margin`:r.margin={};break;default:r[t]=void 0}return r}switch(t){case`padding`:r.padding=Kb(wb(Number(n)));break;case`margin`:r.margin=Kb(wb(Number(n)));break;case`gap`:r.gap=wb(Number(n));break;case`fontSize`:r.fontSize=Vb(Number(n));break;case`leading`:r.leading=Wb(Number(n));break;case`borderWidth`:r.borderWidth=String(n)===`1`?``:String(n);break;default:r[t]=String(n)}return r}var Qb=new Set([`fontFamily`,`fontSize`,`fontWeight`,`leading`,`tracking`,`textColor`,`bg`,`borderColor`,`rounded`]);function $b(e,t){let{node:n,themeValues:r,themeSource:i}=t,a=t.computed?.[e.id]??null;if(e.slot.via===`arg`){let t=ex((Sc(n)?n.args:void 0)?.[e.slot.name]);return{value:t,origin:`plain`,authored:t!==null}}if(e.slot.via===`prop`){let t=ex((xc(n)?n.props:void 0)?.[e.slot.name]);return{value:t,origin:`plain`,authored:t!==null}}let o=e.slot.key,{model:s}=Fb(Yb(n)),c=Xb(s,o),l=r?.[e.id]??null;return c===null?l===null?{value:null,origin:Qb.has(o)?`theme`:`plain`,authored:!1,computed:a}:{value:l,origin:`theme`,authored:!1,source:i}:l!==null&&l!==c?{value:c,origin:`changed`,authored:!0,themeValue:l,source:i}:{value:c,origin:l===null?`plain`:`theme`,authored:!0,...l!==null&&i!==void 0?{source:i}:{}}}function ex(e){return e==null?null:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:null}function tx(e,t,n){let r=Fb(e);return Lb({model:Zb(r.model,t,n),extra:r.extra})}var nx=new Set([`span`,`a`,`em`,`strong`,`b`,`i`,`u`,`s`,`small`,`code`,`kbd`,`samp`,`var`,`abbr`,`cite`,`mark`,`q`,`sub`,`sup`,`time`,`label`]);function rx(e,t){if(!xc(t))return e;let n=typeof t.props?.as==`string`?t.props.as:void 0;if(n===void 0||!nx.has(n))return e;let r=Fb(e);return r.model.display!==void 0&&r.model.display!==`inline`?e:Lb({model:{...r.model,display:`block`},extra:r.extra})}var ix={h1:`Heading 1`,h2:`Heading 2`,h3:`Heading 3`,h4:`Heading 4`,h5:`Heading 5`,h6:`Heading 6`,body:`Body`,lead:`Lead`,small:`Small`,caption:`Caption`},ax={100:`thin`,200:`extralight`,300:`light`,400:`normal`,500:`medium`,600:`semibold`,700:`bold`,800:`extrabold`,900:`black`},ox={values:{}},sx=[[`leading-`,`leading`],[`tracking-`,`tracking`],[`font-`,`weight`],[`text-`,`size`]];function cx({theme:e,tree:t,path:n,node:r}){let i=By(r);if(i!==`heading`&&i!==`text`||!e||!t)return ox;let a=ux(e,t,n,r);if(!a)return ox;let{facts:o,inherited:s}=a,{resolved:c,face:l}=o,u=o.region?`${ix[o.role]} · ${o.region.name}`:ix[o.role],d=s?`${u}, inherited`:u,f={font:l.role??l.slot,size:Math.round(c.fontSize*100)/100,weight:ax[c.fontWeight]??null,leading:Math.round(c.lineHeight*1e3)/1e3,tracking:c.letterSpacing};if(s){let{overrides:e}=o,t=Bb(lx(e.size,`text-`));t!==null&&(f.size=t);let n=lx(e.weight,`font-`);n!==void 0&&(f.weight=n);let r=lx(e.family,`font-`);r!==void 0&&(f.font=r);let i=Ub(lx(e.leading,`leading-`));i!==null&&(f.leading=Math.round(i*1e3)/1e3)}let p={};for(let e of o.responsive){let t=e.slice(e.indexOf(`:`)+1),n=sx.find(([e])=>t.startsWith(e));n&&(p[n[1]]=`${e} also applies at wider frames`)}return{values:f,source:d,notes:p}}function lx(e,t){return e?.startsWith(t)?e.slice(t.length):void 0}function ux(e,t,n,r){let i=bb(e,t,n,r);if(i)return{facts:i,inherited:!1};for(let r=n.length-1;r>=0;r--){let i=n.slice(0,r),a=dx(t,i);if(!a)break;let o=bb(e,t,i,a);if(o)return{facts:o,inherited:!0}}return null}function dx(e,t){let n=e;for(let e of t){if(!n||!(`$ref`in n))return null;n=n.children?.[e]}return n??null}function fx(e,t){let n=(0,P.useRef)(null),r=(0,P.useRef)(null),i=(0,P.useRef)(0),a=(0,P.useRef)(t);a.current=t,(0,P.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]);let o=(0,P.useCallback)(()=>{n.current=null;let e=r.current;r.current=null,e&&(i.current=Date.now(),a.current(e.value))},[]);return(0,P.useCallback)((t,a=!1)=>{r.current={value:t},a?n.current||=setTimeout(o,Math.max(0,e-(Date.now()-i.current))):(n.current&&clearTimeout(n.current),n.current=setTimeout(o,e))},[e,o])}var px=200;function mx({selection:e,liveClasses:t,node:n}){let r=e?`${e.screenId}:${e.path}`:``,i=(0,P.useRef)(null),a=fx(px,e=>{B.applyClasses({screenId:e.screenId,path:U(e.path),classes:e.classes,gesture:e.gesture}).catch(e=>H(e,`Could not update style`))}),o=fx(px,e=>{B.updateProps({screenId:e.screenId,path:U(e.path),propPatch:e.patch,gesture:e.gesture}).catch(e=>H(e,`Could not update prop`))}),s=fx(px,e=>{B.updateSnippetArgs({screenId:e.screenId,path:U(e.path),argPatch:e.patch,gesture:e.gesture}).catch(e=>H(e,`Could not update snippet`))});return(0,P.useCallback)((c,l,u={})=>{if(!e)return;let{screenId:d,path:f}=e,{gesture:p}=u,m=p!==void 0;if(c.slot.via===`prop`){o({screenId:d,path:f,patch:{[c.slot.name]:l},gesture:p},m);return}if(c.slot.via===`arg`){s({screenId:d,path:f,patch:{[c.slot.name]:l},gesture:p},m);return}let h=c.slot.key,g=[...(i.current?.key===r?i.current.slots:[]).filter(([e])=>e!==h),[h,typeof l==`boolean`?String(l):l]];i.current={key:r,slots:g};let _=t;for(let[e,t]of g)_=tx(_,e,typeof t==`boolean`?String(t):t);h===`textAlign`&&l!==null&&n&&(_=rx(_,n)),a({screenId:d,path:f,classes:_,gesture:p},m)},[e,r,t,n,a,o,s])}var hx=[{id:`illustration`,label:`Illustration`,hint:`Spot art, empty states, editorial`},{id:`photo`,label:`Photo`,hint:`Realistic marketing, product, hero`},{id:`graphic`,label:`Graphic`,hint:`Layouts with legible text`},{id:`texture`,label:`Texture`,hint:`Backgrounds, gradients, patterns`},{id:`icon`,label:`Icon`,hint:`One pictogram, transparent`},{id:`vector`,label:`Vector (SVG)`,hint:`Illustrative logos and spot vectors`},{id:`mark`,label:`Mark (SVG)`,hint:`Flat geometric shapes — cheapest SVG`}],gx=[`1:1`,`4:3`,`3:4`,`16:9`,`9:16`,`3:2`,`2:3`];function _x(e,t){if(!e||!t)return;let n=e/t,r,i=1/0;for(let e of gx){let[t,a]=e.split(`:`).map(Number),o=Math.abs(n-t/a);o<i&&(i=o,r=e)}return r}var vx={"1:1":`1/1`,"4:3":`4/3`,"3:4":`3/4`,"16:9":`16/9`},yx=Object.fromEntries(Object.entries(vx).map(([e,t])=>[t,e]));function bx(e,t){return e?.aspect??yx[t??``]??_x(e?.width,e?.height)??`1:1`}function xx(e){return`$${(e/1e6).toFixed(2)}`}function Sx(e,t){let n=new Map,r=(e,t)=>{n.has(e)||n.set(e,new Set),n.has(t)||n.set(t,new Set),n.get(e)?.add(t),n.get(t)?.add(e)};for(let[t,n]of Object.entries(e))n.replaces&&r(t,n.replaces);let i=new Set([t]),a=[t];for(;a.length>0;){let e=a.shift();for(let t of n.get(e)??[])i.has(t)||(i.add(t),a.push(t))}return i.delete(t),[...i].sort((t,n)=>(e[n]?.generatedAt??``).localeCompare(e[t]?.generatedAt??``))}function Cx(e){let t=Date.now()-new Date(e).getTime();if(!Number.isFinite(t)||t<0)return`just now`;let n=Math.round(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function wx({screenId:e,path:t,src:n,nodeAspect:r}){let i=q(e=>e.generatedAssets),a=q(e=>e.loadGeneratedAssets),o=Bs(n),s=o?i[o]:void 0,[c,l]=(0,P.useState)(s?.prompt??``),[u,d]=(0,P.useState)(s?.intent??`illustration`),[f,p]=(0,P.useState)(()=>bx(s,r)),[m,h]=(0,P.useState)(!1),[g,_]=(0,P.useState)([]),[v,y]=(0,P.useState)(!1),b=(0,P.useRef)(o);(0,P.useEffect)(()=>{let e=o??``,t=e?i[e]:void 0;b.current===e?t&&c===``&&(l(t.prompt),d(t.intent),p(bx(t,r))):(b.current=e,l(t?.prompt??``),d(t?.intent??`illustration`),p(bx(t,r)),y(!1))},[o,i,c,r]),(0,P.useEffect)(()=>{let e=!0;return Bu().then(t=>e&&_(t)).catch(()=>void 0),()=>{e=!1}},[]);let x=e=>g.find(t=>t.intent===e)?.priceMicros,S=hx.filter(e=>g.length===0||x(e.id)!==void 0),C=hx.find(e=>e.id===u)?.label??u,w=u===`vector`||u===`mark`,T=async()=>{let n=c.trim();if(n&&!m){h(!0);try{let i=await Uu({prompt:n,intent:u,...w?{}:{aspect:f},...o?{replaces:o}:{}}),s={src:i.url},c=!r||r in yx,l=vx[_x(i.width,i.height)??``]??(w?void 0:vx[f]);c&&l&&(s.aspect=l),b.current=i.assetPath,await B.updateProps({screenId:e,path:U(t),propPatch:s}),await a(),V({kind:`success`,title:`Image generated`,message:i.cost})}catch(e){H(e,`Could not generate the image`)}finally{h(!1)}}},E=async n=>{if(!m){h(!0);try{let a=i[n],o={src:`/${n}`},s=vx[_x(a?.width,a?.height)??``];s&&(!r||r in yx)&&(o.aspect=s),b.current=n,l(a?.prompt??``),d(a?.intent??`illustration`),y(!1),await B.updateProps({screenId:e,path:U(t),propPatch:o})}catch(e){H(e,`Could not restore that version`)}finally{h(!1)}}},D=async e=>{if(!m){h(!0);try{await Vu(e),await a(),V({kind:`success`,message:`Deleted ${e.replace(`assets/`,``)}.`})}catch(e){H(e,`Could not delete that image`)}finally{h(!1)}}};if(!o)return(0,G.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Image`}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`This image isn't in the folder's `,(0,G.jsx)(`code`,{children:`assets/`}),` store, so it has no velloo provenance. Point `,(0,G.jsx)(`code`,{children:`src`}),` at an asset to generate a replacement.`]})]});let O=!s&&!v,k=Sx(i,o);return(0,G.jsxs)(`section`,{className:`flex flex-col gap-2`,"data-testid":`image-panel`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Image`}),s?(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,"data-testid":`image-panel-badge`,children:`generated by velloo`}):(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,"data-testid":`image-panel-badge`,children:`not generated`})]}),O?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`velloo didn't generate this image, so there's no prompt to show.`}),(0,G.jsx)(J,{variant:`outline`,size:`sm`,className:`text-xs`,"data-testid":`image-panel-compose`,onClick:()=>y(!0),children:`Replace with a generated image`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Y,{htmlFor:`image-prompt`,className:`text-xs font-medium text-muted-foreground`,children:`prompt`}),(0,G.jsx)(Vg,{id:`image-prompt`,"data-testid":`image-panel-prompt`,value:c,onChange:e=>l(e.target.value),rows:4,placeholder:`Describe subject, style, lighting and mood — these models reward detail.`,className:`min-h-0 text-xs`,onKeyDown:Nh(()=>void T())}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col gap-1.5`,children:[(0,G.jsx)(Y,{htmlFor:`image-intent`,className:`text-xs font-medium text-muted-foreground`,children:`intent`}),(0,G.jsxs)(bh,{value:u,onValueChange:d,children:[(0,G.jsx)(Sh,{id:`image-intent`,size:`sm`,className:`text-xs`,children:(0,G.jsx)(xh,{children:C})}),(0,G.jsx)(Ch,{children:S.map(e=>{let t=x(e.id);return(0,G.jsx)(X,{value:e.id,className:`[&>span:last-child]:flex-1`,children:(0,G.jsxs)(`span`,{className:`flex items-center justify-between gap-4`,children:[(0,G.jsx)(`span`,{children:e.label}),t===void 0?null:(0,G.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:xx(t)})]})},e.id)})})]})]}),w?null:(0,G.jsxs)(`div`,{className:`w-24 flex flex-col gap-1.5`,children:[(0,G.jsx)(Y,{htmlFor:`image-aspect`,className:`text-xs font-medium text-muted-foreground`,children:`aspect`}),(0,G.jsxs)(bh,{value:f,onValueChange:p,children:[(0,G.jsx)(Sh,{id:`image-aspect`,size:`sm`,className:`text-xs`,children:(0,G.jsx)(xh,{})}),(0,G.jsx)(Ch,{children:gx.map(e=>(0,G.jsx)(X,{value:e,children:e},e))})]})]})]}),(0,G.jsx)(J,{size:`sm`,className:`text-xs`,"data-testid":`image-panel-generate`,disabled:m||c.trim().length===0,onClick:()=>void T(),children:m?`Generating…`:s?`Regenerate`:`Generate`}),(0,G.jsxs)(`p`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:[s?(0,G.jsxs)(G.Fragment,{children:[s.intent,` · ${Cx(s.generatedAt)}`,s.width&&s.height?` · ${s.width}×${s.height}`:null,(0,G.jsx)(`br`,{})]}):null,`Charged against your velloo-cloud credits. Each run makes a new asset and repoints this node.`]})]}),k.length>0?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 pt-1`,"data-testid":`image-panel-history`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Previous versions`}),k.map(e=>{let t=i[e];return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,"data-testid":`image-panel-version`,"data-version":e,children:[(0,G.jsx)(`img`,{src:`/${e}`,alt:``,className:`size-8 shrink-0 rounded border object-cover`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[10px] text-muted-foreground`,children:t?`${t.intent} · ${Cx(t.generatedAt)}`:`original`}),(0,G.jsx)(J,{variant:`ghost`,size:`icon`,className:`size-6`,title:`Put this version back on the node`,"data-testid":`image-panel-restore`,disabled:m,onClick:()=>void E(e),children:(0,G.jsx)(wa,{className:`size-3`})}),(0,G.jsx)(J,{variant:`ghost`,size:`icon`,className:`size-6 text-muted-foreground hover:text-destructive`,title:`Delete this version for good`,"data-testid":`image-panel-delete`,disabled:m,onClick:()=>void D(e),children:(0,G.jsx)(L,{className:`size-3`})})]},e)})]}):null]})}function Tx({delayDuration:e=0,...t}){return(0,G.jsx)(ke,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Ex({...e}){return(0,G.jsx)(lt,{"data-slot":`tooltip`,...e})}function Dx({...e}){return(0,G.jsx)(et,{"data-slot":`tooltip-trigger`,...e})}function Ox({className:e,sideOffset:t=0,children:n,...r}){return(0,G.jsx)(We,{children:(0,G.jsxs)(at,{"data-slot":`tooltip-content`,sideOffset:t,className:W(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,G.jsx)(Qe,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}var kx=w(`rgb`),Ax=w(`hsv`);function jx({h:e,s:t,v:n}){return E(kx({mode:`hsv`,h:e,s:t,v:n}))??`#000000`}function Mx(e){let t=x(e);if(!t)return null;let n=Ax(t);return{h:n.h??0,s:n.s??0,v:n.v??0}}var Nx=160,Px=Nx/2,Fx=`conic-gradient(from 90deg, ${[0,60,120,180,240,300,360].map(e=>`hsl(${e} 100% 50%)`).join(`, `)})`;function Ix({value:e,onChange:t}){let n=(0,P.useRef)(null),r=(0,P.useCallback)((r,i)=>{let a=n.current?.getBoundingClientRect();if(!a)return;let o=r-(a.left+Px),s=i-(a.top+Px),c=(Math.atan2(s,o)*180/Math.PI+360)%360,l=Math.min(1,Math.hypot(o,s)/Px);t({...e,h:c,s:l})},[t,e]),i=e.h*Math.PI/180,a=Px+Math.cos(i)*e.s*Px,o=Px+Math.sin(i)*e.s*Px,s=jx(e),c=`rgba(0,0,0,${1-Math.min(1,Math.max(0,e.v))})`;return(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,G.jsx)(`div`,{ref:n,role:`application`,"aria-label":`Hue and saturation`,className:`relative cursor-crosshair rounded-full border border-border/60`,style:{width:Nx,height:Nx,backgroundImage:`linear-gradient(${c}, ${c}), radial-gradient(circle at center, #fff 0%, rgba(255,255,255,0) 100%), ${Fx}`},onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),r(e.clientX,e.clientY)},onPointerMove:e=>{e.buttons!==0&&r(e.clientX,e.clientY)},children:(0,G.jsx)(`span`,{className:`pointer-events-none absolute size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(0,0,0,0.45)]`,style:{left:a,top:o,background:s}})}),(0,G.jsxs)(`label`,{className:`flex w-full items-center gap-2`,title:`Brightness`,children:[(0,G.jsx)(`span`,{className:`sr-only`,children:`Brightness`}),(0,G.jsx)(`input`,{type:`range`,min:0,max:1,step:.01,value:e.v,onChange:n=>t({...e,v:Number(n.target.value)}),className:`h-2 w-full cursor-pointer appearance-none rounded-full border border-border/60 [&::-webkit-slider-thumb]:size-3.5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-white [&::-webkit-slider-thumb]:bg-transparent [&::-webkit-slider-thumb]:shadow-[0_0_0_1px_rgba(0,0,0,0.45)]`,style:{backgroundImage:`linear-gradient(to right, #000, ${jx({...e,v:1})})`}})]})]})}function Lx({hex:e,onChange:t}){let[n,r]=(0,P.useState)(e);return(0,P.useEffect)(()=>r(e),[e]),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border bg-background px-2`,children:[(0,G.jsx)(`span`,{className:`size-3.5 shrink-0 rounded-full border border-border/70`,style:{background:x(n)?n:e}}),(0,G.jsx)(`input`,{value:n,spellCheck:!1,"aria-label":`Hex`,className:`h-7 min-w-0 flex-1 bg-transparent font-mono text-xs uppercase outline-none`,onChange:n=>{let i=n.target.value;r(i);let a=x(i.startsWith(`#`)?i:`#${i}`);a&&t(E(kx(a))??e)}})]})}var Rx=`modulepreload`,zx=function(e){return`/`+e},Bx={},Vx=function(e){return e.pathname.endsWith(`.css`)},Hx=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Ux=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=zx(t,n);let r=s(t),i=Vx(r);return Hx(Bx,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Rx,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Wx=null,Gx=null;function Kx(e){let t=new Map;for(let[n,r]of Object.entries(e))typeof r==`object`&&r&&typeof r.displayName==`string`&&t.set(n,r);return t}function qx(e,t){let n=t.trim();if(e&&n!==``)return e.get(n)??e.get(bc(n))}function Jx(){return Gx??=Ux(()=>import(`./lucide-all-B49qZ9YE.js`).then(e=>(Wx=Kx(e),Wx)),__vite__mapDeps([0,1,2])),Gx}function Yx(){let[e,t]=(0,P.useState)(Wx);return(0,P.useEffect)(()=>{if(e)return;let n=!0;return Jx().then(e=>{n&&t(e)}),()=>{n=!1}},[e]),e}var Xx=80;function Zx({value:e,options:t,onChange:n}){let[r,i]=(0,P.useState)(!1),a=qx(Yx(),e);return(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`grid h-8 w-8 place-items-center rounded-md border bg-background text-foreground shrink-0`,children:a?(0,G.jsx)(a,{size:16,strokeWidth:2}):(0,G.jsx)(`span`,{className:`text-xs`,children:`?`})}),(0,G.jsxs)(X_,{open:r,onOpenChange:i,children:[(0,G.jsx)(Z_,{asChild:!0,children:(0,G.jsx)(J,{variant:`outline`,size:`default`,className:`flex-1 justify-start font-normal`,children:e||(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`Pick an icon…`})})}),(0,G.jsx)(Q_,{align:`end`,className:`w-72 p-0`,children:(0,G.jsx)(Qx,{value:e,options:t,onPick:e=>{n(e),i(!1)}})})]})]})}function Qx({value:e,options:t,onPick:n}){let[r,i]=(0,P.useState)(``),a=(0,P.useRef)(null),o=Yx();(0,P.useEffect)(()=>{let e=requestAnimationFrame(()=>a.current?.focus());return()=>cancelAnimationFrame(e)},[]);let s=(0,P.useMemo)(()=>{let e=r.trim().toLowerCase();return e?t.filter(t=>t.toLowerCase().includes(e)).slice(0,Xx):t.slice(0,Xx)},[t,r]);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Z,{ref:a,type:`text`,value:r,placeholder:`Search ${t.length} icons…`,onChange:e=>i(e.target.value),className:`rounded-b-none border-0 border-b shadow-none focus-visible:ring-0`}),(0,G.jsx)(`div`,{className:`grid max-h-64 grid-cols-8 gap-1 overflow-auto scroll-stable p-2`,children:s.length===0?(0,G.jsx)(`div`,{className:`col-span-8 px-2 py-4 text-center text-xs text-muted-foreground`,children:`No matches.`}):s.map(t=>{let r=qx(o,t);return r?(0,G.jsx)(`button`,{type:`button`,title:t,onClick:()=>n(t),className:`grid h-7 w-7 place-items-center rounded-md transition-colors `+(t===e?`bg-primary text-primary-foreground`:`text-foreground hover:bg-muted`),children:(0,G.jsx)(r,{size:14,strokeWidth:2})},t):null})}),r&&s.length===Xx?(0,G.jsxs)(`div`,{className:`border-t px-3 py-1 text-[10px] text-muted-foreground`,children:[`Showing first `,Xx,`. Refine your search to see more.`]}):null]})}function $x({className:e,orientation:t=`horizontal`,...n}){return(0,G.jsx)(Je,{"data-slot":`tabs`,"data-orientation":t,className:W(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var eS=d(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function tS({className:e,variant:t=`default`,...n}){return(0,G.jsx)(dt,{"data-slot":`tabs-list`,"data-variant":t,className:W(eS({variant:t}),e),...n})}function nS({className:e,...t}){return(0,G.jsx)(Fe,{"data-slot":`tabs-trigger`,className:W(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}var rS=e=>e>0?{className:`shrink-0`,style:{width:e}}:{className:`min-w-0`};function iS({label:e,origin:t,themeValue:n,source:r,width:i,note:a,onReset:o,children:s}){let c=t===`changed`,l=[c&&n!=null?`${r??`Theme`} sets ${n}`:t===`theme`&&r?`From ${r}`:null,a].filter(Boolean).join(` — `)||null,u=(0,G.jsx)(`span`,{className:`truncate ${c?`text-foreground font-medium`:`text-muted-foreground`}`,children:e}),d=rS(i);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1 ${d.className}`,style:d.style,children:[(0,G.jsxs)(`div`,{className:`flex h-3.5 items-center gap-1 px-0.5 text-[10px] leading-none`,children:[c?(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-primary`}):null,a?(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`@`}):null,l?(0,G.jsxs)(Ex,{children:[(0,G.jsx)(Dx,{asChild:!0,children:u}),(0,G.jsx)(Ox,{side:`top`,children:l})]}):u,c&&o?(0,G.jsx)(`button`,{type:`button`,"aria-label":`Reset ${e}`,title:l??`Reset ${e}`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,onClick:o,children:(0,G.jsx)(wa,{size:9})}):null]}),s]})}var aS=`h-7 w-full rounded-md border bg-background text-xs`,oS=`—`;function sS({value:e,ghost:t,muted:n=!1,onChange:r,min:i,max:a,step:o=1,gear:s=3,suffix:c=`px`}){let[l,u]=(0,P.useState)(null),d=(0,P.useRef)(null),f=e=>{let t=e;return i!==void 0&&(t=Math.max(i,t)),a!==void 0&&(t=Math.min(a,t)),Math.round(t*1e3)/1e3},p=e=>{let t=Number.parseFloat(e);Number.isFinite(t)&&r(f(t)),u(null)},m=e??(typeof t==`number`?t:0);return(0,G.jsxs)(`div`,{className:`${aS} flex items-center overflow-hidden focus-within:ring-1 focus-within:ring-ring`,children:[(0,G.jsx)(`input`,{type:`text`,inputMode:`decimal`,value:l??(e===null?``:String(e)),placeholder:t==null?oS:String(t),className:`min-w-0 flex-1 bg-transparent px-2 tabular-nums outline-none placeholder:text-muted-foreground/60 ${n?`text-muted-foreground`:``}`,onChange:e=>u(e.target.value),onBlur:e=>p(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)p(e.target.value),e.target.blur();else if(e.key===`Escape`)u(null),e.target.blur();else if(e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let t=e.shiftKey?10:1,n=f(m+(e.key===`ArrowUp`?o:-o)*t);u(null),r(n)}}}),(0,G.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":`Drag to adjust`,className:`h-full shrink-0 cursor-ew-resize select-none border-l px-1.5 text-[9px] text-muted-foreground hover:bg-accent hover:text-foreground`,onPointerDown:e=>{e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),d.current={startX:e.clientX,startValue:m,gesture:`scrub-${e.pointerId}-${Date.now()}`}},onPointerMove:t=>{let n=d.current;if(!n)return;let i=Math.round((t.clientX-n.startX)/s);if(i===0)return;let a=f(n.startValue+i*o);a!==e&&r(a,{gesture:n.gesture})},onPointerUp:e=>{d.current=null,e.currentTarget.releasePointerCapture(e.pointerId)},children:c})]})}function cS({value:e,ghost:t,muted:n=!1,choices:r,onChange:i,placeholder:a}){return(0,G.jsxs)(bh,{value:e??``,onValueChange:i,children:[(0,G.jsx)(Sh,{className:`${aS} min-h-0 px-2 [&>span]:truncate ${n||e===null?`text-muted-foreground`:``}`,children:(0,G.jsx)(xh,{placeholder:t?lS(r,t):a??oS})}),(0,G.jsx)(Ch,{children:r.map(e=>(0,G.jsx)(X,{value:e.value,className:`text-xs`,children:e.label},e.value))})]})}function lS(e,t){return t?e.find(e=>e.value===t)?.label??t:oS}function uS({mode:e,px:t,measured:n,muted:r=!1,choices:i,onMode:a,onPx:o}){return(0,G.jsxs)(`div`,{className:`flex items-stretch gap-1`,children:[(0,G.jsx)(`div`,{className:`w-[70px] shrink-0`,children:(0,G.jsx)(cS,{value:e,muted:r,choices:i,onChange:a,placeholder:`Auto`})}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsx)(sS,{value:e===`fixed`?t:null,ghost:e===`fixed`?null:n??null,onChange:o,min:0,max:4096})})]})}function dS({value:e,ghost:t,muted:n=!1,choices:r,onChange:i}){let a=e??t??null,o=n||e===null;return(0,G.jsx)(rv,{type:`single`,value:a??``,onValueChange:e=>e&&i(e),className:`${aS} items-stretch p-0.5`,children:r.map(e=>(0,G.jsx)(iv,{value:e.value,title:e.label,className:`h-auto min-w-0 flex-1 rounded-sm text-[10px] text-muted-foreground hover:bg-accent/50 `+(o?`data-[state=on]:bg-muted data-[state=on]:text-muted-foreground`:`data-[state=on]:bg-accent data-[state=on]:text-accent-foreground`),children:e.label.charAt(0)},e.value))})}var fS=`#7c3aed`;function pS({value:e,ghost:t,muted:n=!1,choices:r,resolve:i,onChange:a}){let[o,s]=(0,P.useState)(!1),c=e??t??null,l=c?.startsWith(`[`)===!0,[u,d]=(0,P.useState)(`theme`),[f,p]=(0,P.useState)({h:265,s:.75,v:.9}),m=(0,P.useRef)(``);(0,P.useEffect)(()=>{if(!o)return;m.current=`color-${Date.now()}`,d(l?`custom`:`theme`);let e=Mx(i(c)??fS);e&&p(e)},[o,l,c,i]);let h=e=>{p(e),a(`[${jx(e)}]`,{gesture:m.current})};return(0,G.jsxs)(X_,{open:o,onOpenChange:s,children:[(0,G.jsxs)(Z_,{className:`${aS} flex items-center gap-1.5 px-1.5 hover:bg-accent/50 ${n||e===null?`text-muted-foreground`:``}`,children:[(0,G.jsx)(hS,{css:i(c),unset:c===null}),(0,G.jsx)(`span`,{className:`truncate`,children:c?lS(r,c):oS})]}),(0,G.jsxs)(Q_,{align:`start`,className:`w-64 p-0`,children:[(0,G.jsx)($x,{value:u,onValueChange:e=>d(e),children:(0,G.jsxs)(tS,{className:`w-full rounded-none border-b bg-transparent p-1.5`,children:[(0,G.jsx)(nS,{value:`theme`,className:`flex-1 text-xs capitalize`,children:`theme`}),(0,G.jsx)(nS,{value:`custom`,className:`flex-1 text-xs capitalize`,children:`custom`})]})}),u===`theme`?(0,G.jsxs)(`div`,{className:`max-h-64 overflow-y-auto p-1`,children:[r.length===0?(0,G.jsx)(Jm,{className:`p-3`,children:(0,G.jsx)($m,{className:`text-xs`,children:`This theme declares no colours.`})}):null,r.map(e=>{let t=e.swatch??i(e.value);return(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-1.5 py-1 text-left text-xs hover:bg-accent/50 ${c===e.value?`bg-accent text-accent-foreground`:``}`,onClick:()=>{a(e.value),s(!1)},children:[(0,G.jsx)(hS,{css:t}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground`,children:mS(t)})]},e.value)})]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 p-3`,children:[(0,G.jsx)(Ix,{value:f,onChange:h}),(0,G.jsx)(Lx,{hex:jx(f),onChange:e=>{let t=Mx(e);t&&h(t)}})]})]})]})}function mS(e){return e?Ty(e)?.hex.toUpperCase()??``:``}function hS({css:e,unset:t=!1}){return(0,G.jsx)(`span`,{className:`size-4 shrink-0 rounded-full border border-border/70`,style:e?{background:e}:t?void 0:{backgroundImage:`repeating-linear-gradient(45deg, var(--muted-foreground) 0 2px, transparent 2px 5px)`}})}function gS({value:e,options:t,onChange:n}){let[r,i]=(0,P.useState)(!1),a=qx(Yx(),e);return(0,G.jsxs)(X_,{open:r,onOpenChange:i,children:[(0,G.jsxs)(Z_,{className:`${aS} flex items-center gap-1.5 px-1.5 hover:bg-accent/50 ${e?``:`text-muted-foreground`}`,children:[(0,G.jsx)(`span`,{className:`grid size-4 shrink-0 place-items-center`,children:a?(0,G.jsx)(a,{size:14,strokeWidth:2}):`—`}),(0,G.jsx)(`span`,{className:`truncate`,children:e?_S(e):`Pick an icon`})]}),(0,G.jsx)(Q_,{align:`start`,className:`w-72 p-0`,children:(0,G.jsx)(Qx,{value:e,options:t,onPick:e=>{n(e),i(!1)}})})]})}function _S(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`);return t.charAt(0)+t.slice(1).toLowerCase()}function vS({value:e,onChange:t,placeholder:n}){let[r,i]=(0,P.useState)(null);return(0,G.jsx)(`input`,{type:`text`,value:r??e,placeholder:n,className:`${aS} px-2 outline-none focus:ring-1 focus:ring-ring`,onChange:e=>{i(e.target.value),t(e.target.value)},onBlur:()=>i(null)})}function yS({value:e,onChange:t}){return(0,G.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,className:`${aS} px-2 text-left ${e?``:`text-muted-foreground`}`,onClick:()=>t(!e),children:e?`On`:`Off`})}function bS({summary:e,onOpen:t}){return(0,G.jsx)(`button`,{type:`button`,className:`${aS} truncate px-2 text-left hover:bg-accent/50 ${e?``:`text-muted-foreground`}`,onClick:t,title:e??void 0,children:e??`Describe…`})}var xS=`__browse`,SS={heading:wo,text:Qi,box:io,image:Er,icon:Ra,snippet:Hn,other:Hn};function CS(){let e=q(e=>e.selection),t=q(e=>e.cursorMode),n=q(e=>e.wsConnected),r=q(e=>e.screens),i=q(e=>e.theme),a=q(e=>e.styleChannel),o=q(e=>e.channelsByLibrary),s=q(e=>e.components),c=q(e=>e.design),l=q(e=>e.openSnippetEditor),u=q(e=>e.setBrowsingFaces),d=q(e=>e.setRightTab),f=q(e=>e.setRightPaneCollapsed),p=q(e=>e.setSnippetFocus),m=q(e=>e.snippetFocus),h=vy(),g=_y(),[_,v]=(0,P.useState)(!1),y=(0,P.useMemo)(()=>ef(r,e),[r,e]),b=e?r[e.screenId]?.tree:void 0,x=(0,P.useMemo)(()=>!y||!s||!xc(y)?null:s.find(e=>e.id===y.$ref)??null,[y,s]),S=(0,P.useMemo)(()=>!y||!Sc(y)?null:c?.snippets.find(e=>e.id===y.$snippet)??null,[y,c]),C=e?r[e.screenId]?.library:void 0,w=(C?o[C]:void 0)??a,T=w===null||w.kind===`tailwind-classname`,E=(0,P.useMemo)(()=>{if(!y)return null;let e=db({node:y,descriptor:x,snippet:S}),t=T?e.controls:e.controls.filter(e=>e.slot.via!==`style`);return{...e,controls:Iy(t)}},[y,x,S,T]),D=(0,P.useMemo)(()=>!y||!e?{values:{}}:cx({theme:i,tree:b,path:U(e.path),node:y}),[i,b,e,y]),O=q(e=>e.selectionComputed),k=(0,P.useMemo)(()=>Fy(O),[O]),A=(0,P.useMemo)(()=>Jy(i),[i]),j=(0,P.useCallback)(e=>qy(i,e),[i]),M=(0,P.useMemo)(()=>[...Yy(i),{value:xS,label:`Browse fonts…`}],[i]),ee=mx({selection:e,node:y,liveClasses:y?Yb(y):``}),te=(0,P.useCallback)((e,t,n)=>{t===xS?(d(`node`),f(!1),u(!0)):ee(e,t,n)},[ee,u,d,f]);if(t!==`select`)return null;if(m!==null&&(!e||!y||!E))return(0,G.jsx)(TS,{name:c?.snippets.find(e=>e.id===m)?.name??m,onDone:()=>p(null),children:(0,G.jsx)(`span`,{className:`self-center text-xs text-muted-foreground`,children:`Pick anything inside it — every instance changes together.`})});if(!e||!y||!E||wc(y))return null;let ne=h[0]??null,N=Sc(y)?y.$snippet:null,re=SS[E.role],ie=fb(y),ae=Sc(y)?S?.name??y.$snippet:xc(y)?y.$ref:`Param`,oe=xc(y)&&typeof y.props?.src==`string`?y.props.src:null,se=e.screenId.startsWith(`snippet:`);return(0,G.jsxs)(Tx,{delayDuration:300,children:[(0,G.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-4 z-30 flex flex-col items-center gap-1.5 px-6`,children:[m===null?null:(0,G.jsx)(wS,{name:c?.snippets.find(e=>e.id===m)?.name??m,onDone:()=>p(null)}),(0,G.jsxs)(`div`,{className:`pointer-events-auto flex max-w-full items-stretch gap-2 rounded-xl border bg-card/95 p-2 shadow-xl backdrop-blur-sm ${E.role===`snippet`||se?`border-violet-400/70`:``} ${n?``:`pointer-events-none opacity-50`}`,"data-velloo-hud":!0,children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 self-center pr-1 pl-0.5`,children:[(0,G.jsx)(re,{size:14,className:E.role===`snippet`?`text-violet-500`:`text-muted-foreground`}),(0,G.jsx)(`span`,{className:`max-w-[140px] truncate text-xs font-medium`,children:ae}),se?(0,G.jsx)(K,{className:`bg-violet-500/15 px-1 py-0 text-[10px] text-violet-600 dark:text-violet-300`,children:`in snippet`}):null,ie?(0,G.jsx)(K,{variant:`secondary`,className:`px-1 py-0 text-[10px]`,children:ie}):null]}),(0,G.jsx)(B_,{orientation:`vertical`,className:`shrink-0 self-stretch`}),N===null?null:(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-center`,children:[(0,G.jsx)(J,{size:`sm`,variant:`outline`,className:`h-7 text-xs`,onClick:()=>l(N),children:`Edit snippet`}),(0,G.jsx)(J,{size:`sm`,variant:m===N?`default`:`ghost`,className:`h-7 text-xs`,onClick:()=>p(m===N?null:N),title:`Edit this snippet in place — every instance updates together`,children:m===N?`Done`:`Edit in place`}),E.controls.length>0?(0,G.jsx)(B_,{orientation:`vertical`,className:`self-stretch`}):null]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2 overflow-x-auto`,children:[E.controls.map(e=>{let t=$b(e,{node:y,themeValues:D.values,themeSource:D.source,computed:k});return(0,G.jsx)(iS,{label:e.label,origin:t.origin,themeValue:t.themeValue,source:t.source,width:e.width,note:D.notes?.[e.id],onReset:t.origin===`changed`?()=>te(e,null):void 0,children:(0,G.jsx)(ES,{spec:e,value:t,colors:A,resolveColor:j,fonts:M,iconNames:g,measured:e.slot.via===`style`&&e.slot.key===`height`?ne?.h??null:ne?.w??null,onOpenPrompt:()=>v(!0),onChange:(t,n)=>te(e,t,n)})},e.id)}),E.controls.length===0?(0,G.jsx)(`button`,{type:`button`,className:`grid h-[42px] place-items-center px-3 text-xs text-muted-foreground underline-offset-2 hover:underline`,onClick:()=>{d(`node`),f(!1)},children:`Nothing to tune here — open the panel`}):null]})]})]}),(0,G.jsx)(fh,{open:_,onOpenChange:v,children:(0,G.jsxs)(hh,{className:`max-w-lg`,children:[(0,G.jsx)(gh,{children:(0,G.jsx)(vh,{children:`Image`})}),oe===null?null:(0,G.jsx)(wx,{screenId:e.screenId,path:e.path,src:oe})]})})]})}function wS({name:e,onDone:t}){return(0,G.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2 rounded-full border border-violet-400/70 bg-card/95 py-1 pr-1 pl-3 text-xs shadow-lg backdrop-blur-sm`,children:[(0,G.jsx)(Hn,{size:12,className:`text-violet-500`}),(0,G.jsxs)(`span`,{children:[`Editing `,(0,G.jsx)(`span`,{className:`font-medium`,children:e}),` — every instance updates together`]}),(0,G.jsx)(J,{size:`sm`,variant:`ghost`,className:`h-6 rounded-full px-2 text-xs`,onClick:t,children:`Done`})]})}function TS({name:e,onDone:t,children:n}){return(0,G.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-4 z-30 flex flex-col items-center gap-1.5 px-6`,children:[(0,G.jsx)(wS,{name:e,onDone:t}),(0,G.jsx)(`div`,{className:`pointer-events-auto flex items-stretch gap-2 rounded-xl border border-violet-400/70 bg-card/95 px-3 py-2 shadow-xl backdrop-blur-sm`,"data-velloo-hud":!0,onPointerDown:e=>e.stopPropagation(),children:n})]})}function ES({spec:e,value:t,colors:n,resolveColor:r,fonts:i,iconNames:a,measured:o,onOpenPrompt:s,onChange:c}){let l=t.value===null?null:String(t.value),u=typeof t.value==`number`?t.value:null,d=t.themeValue??t.computed??null,f=d===null?null:String(d),p=!t.authored;switch(e.kind){case`number`:return(0,G.jsx)(sS,{value:u,ghost:d,muted:p,onChange:c,min:e.min,max:e.max,step:e.step??1});case`ratio`:return(0,G.jsx)(sS,{value:u,ghost:d,muted:p,onChange:c,min:e.min,max:e.max,step:e.step??.05,gear:8,suffix:`×`});case`size`:{let t=qb(l??void 0);return(0,G.jsx)(uS,{mode:t,px:Jb(l??void 0),measured:o===null?null:Math.round(o),muted:p,choices:e.choices??[],onMode:e=>c(e===`fixed`?`[${Math.round(o??100)}px]`:e),onPx:(e,t)=>c(`[${e}px]`,t)})}case`choice`:return(0,G.jsx)(cS,{value:l,ghost:f,muted:p,choices:e.choices??[],onChange:c});case`align`:return(0,G.jsx)(dS,{value:l,ghost:f,muted:p,choices:e.choices??[],onChange:c});case`color`:return(0,G.jsx)(pS,{value:l,ghost:f,muted:p,choices:n,resolve:r,onChange:c});case`font`:return(0,G.jsx)(cS,{value:l,ghost:f,muted:p,choices:i,onChange:c});case`icon`:return(0,G.jsx)(gS,{value:l??``,options:a,onChange:c});case`text`:return(0,G.jsx)(vS,{value:l??``,onChange:c});case`toggle`:return(0,G.jsx)(yS,{value:t.value===!0,onChange:c});case`prompt`:return(0,G.jsx)(bS,{summary:l,onOpen:s})}}var DS=[{id:`nw`,x:0,y:0,cursor:`nwse-resize`,sx:-1,sy:-1},{id:`n`,x:.5,y:0,cursor:`ns-resize`,sx:0,sy:-1},{id:`ne`,x:1,y:0,cursor:`nesw-resize`,sx:1,sy:-1},{id:`e`,x:1,y:.5,cursor:`ew-resize`,sx:1,sy:0},{id:`se`,x:1,y:1,cursor:`nwse-resize`,sx:1,sy:1},{id:`s`,x:.5,y:1,cursor:`ns-resize`,sx:0,sy:1},{id:`sw`,x:0,y:1,cursor:`nesw-resize`,sx:-1,sy:1},{id:`w`,x:0,y:.5,cursor:`ew-resize`,sx:-1,sy:0}],OS=7,kS=90;function AS(){let e=vy(),t=q(e=>e.selection),n=q(e=>e.screens),r=q(e=>e.canvasZoom),i=q(e=>e.cursorMode),a=q(e=>e.wsConnected),o=t?ef(n,t):null,s=(0,P.useRef)(null),[c,l]=(0,P.useState)(null),u=(0,P.useRef)([]),d=fx(kS,e=>{B.applyClasses({screenId:e.screenId,path:U(e.path),classes:e.classes,gesture:e.gesture}).catch(e=>H(e,`Could not resize`))}),f=(0,P.useRef)(()=>{});if(f.current=(e,n,r)=>{if(!t||!o)return;let i=Yb(o);e.sx!==0&&(i=tx(i,`width`,`[${Math.round(n)}px]`)),e.sy!==0&&(i=tx(i,`height`,`[${Math.round(r)}px]`)),d({screenId:t.screenId,path:t.path,classes:i,gesture:e.gesture},!0)},(0,P.useEffect)(()=>{let e=e=>{let t=s.current;if(!t)return;let n=(e.clientX-t.startX)/t.zoom*t.sx,r=(e.clientY-t.startY)/t.zoom*t.sy,i={w:Math.max(8,t.startW+n),h:Math.max(8,t.startH+r)};l(i),f.current(t,i.w,i.h)},t=()=>{let e=s.current;e&&(s.current=null,l(t=>(t&&f.current(e,t.w,t.h),null)))};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[]),!t||!o||i!==`select`||!a)return null;e.length>0&&s.current===null&&(u.current=e);let p=s.current!==null||c!==null?u.current:e;if(p.length===0)return null;let m=`$snippet`in o?uv:lv,h=1/r;return(0,G.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,"data-velloo-selection-layer":!0,children:p.map(e=>{let t=c&&e.anchor?c.w:e.w,n=c&&e.anchor?c.h:e.h;return(0,G.jsx)(`div`,{className:`absolute overflow-hidden`,style:{left:e.clip.x,top:e.clip.y,width:e.clip.w,height:e.clip.h},children:(0,G.jsxs)(`div`,{className:`absolute`,style:{left:e.x-e.clip.x,top:e.y-e.clip.y,width:t,height:n},children:[(0,G.jsx)(`div`,{className:`absolute inset-0`,"data-velloo-selection-box":!0,style:{outline:`${2*h}px solid ${m}`,outlineOffset:-2*h}}),c&&e.anchor?(0,G.jsxs)(`div`,{className:`absolute left-1/2 whitespace-nowrap rounded px-1.5 py-0.5 text-white tabular-nums`,style:{top:n+6*h,fontSize:10*h,background:m,transform:`translateX(-50%)`},children:[Math.round(c.w),` × `,Math.round(c.h)]}):null,e.anchor?DS.map(i=>(0,G.jsx)(`button`,{type:`button`,"aria-label":`Resize ${i.id}`,className:`pointer-events-auto absolute rounded-none`,style:{left:i.x*t,top:i.y*n,width:OS*h,height:OS*h,marginLeft:-7/2*h,marginTop:-7/2*h,background:m,cursor:i.cursor},onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId),s.current={startX:t.clientX,startY:t.clientY,startW:e.w,startH:e.h,sx:i.sx,sy:i.sy,zoom:r,gesture:`resize-${t.pointerId}-${Date.now()}`},l({w:e.w,h:e.h})}},i.id)):null]})},e.key)})})}var jS={x:0,y:20};function MS(e,t,n,r){let i={free:[],attached:[]};for(let a of e){let e=a.attachment&&t.find(e=>e.id===a.attachment?.frameId);if(!e){i.free.push({note:a,card:{x:a.x??0,y:a.y??0}});continue}let o=r[e.id]??jS,s=e.x+o.x,c=e.y+o.y,l=NS(a),u=a.resolved?n[e.id]?.[a.resolved.join(`.`)]:void 0,d={x:s+(u?u.x+u.w:e.w),y:c+(u?u.y:0)};i.attached.push({note:a,marker:d,frame:{left:s,top:c,right:s+e.w,bottom:c+e.h},stale:l})}return i}function NS(e){return e.attachment!==void 0&&e.resolved===null}var PS=`text-[13px] leading-relaxed text-muted-foreground [&_a]:text-foreground [&_h1]:text-foreground [&_h2]:text-foreground [&_h3]:text-foreground [&_strong]:text-foreground [&_b]:text-foreground`,FS=`absolute flex flex-col gap-2 rounded-r-md border-l-2 border-foreground/15 py-1 pl-4 pr-3`,IS=`absolute left-4 top-4 flex flex-col rounded-md border bg-card px-3 py-2.5 shadow-lg`;function LS({body:e,emptyHint:t}){return e?(0,G.jsx)(Uh,{body:e,className:PS}):(0,G.jsx)(`span`,{className:`text-[13px] text-muted-foreground/60`,children:t??`Empty note`})}function RS({children:e}){let t=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let e=t.current;if(!e)return;let n=t=>{t.ctrlKey||t.metaKey||e.scrollHeight>e.clientHeight+1&&t.stopPropagation()};return e.addEventListener(`wheel`,n),()=>e.removeEventListener(`wheel`,n)},[]),(0,G.jsx)(`div`,{ref:t,className:`min-h-0 flex-1 overflow-y-auto`,"data-note-scroll":!0,children:e})}var zS=160;function BS(e=!1){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(e),a=(0,P.useRef)(null);return(0,P.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),{hovered:t,held:r,setHeld:i,enter(){a.current&&clearTimeout(a.current),n(!0)},leave(){a.current&&clearTimeout(a.current),a.current=setTimeout(()=>n(!1),zS)}}}function VS({position:e,pileIndex:t,stale:n,open:r,held:i,onEnter:a,onLeave:o,onToggle:s,onDoubleClick:c,onKeyDown:l}){return(0,G.jsx)(`button`,{type:`button`,"aria-label":r?`Note`:`Show note`,"aria-expanded":r,"data-note-marker":!0,"data-stop-pan":!0,className:`absolute z-10 flex size-7 items-center justify-center rounded-full shadow-md transition-[scale] hover:z-20 hover:scale-110 ${n?`border border-dashed border-destructive bg-card text-destructive`:i?`bg-primary-foreground text-primary ring-2 ring-primary`:`bg-primary text-primary-foreground ring-1 ring-primary-foreground/20`}`,style:{...e,translate:jh(t),transform:`scale(calc(1 / var(--canvas-zoom, 1)))`},title:n?`Note — its node is gone`:void 0,onMouseEnter:a,onMouseLeave:o,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),s()},onDoubleClick:e=>{c&&(e.stopPropagation(),c())},onKeyDown:l,children:(0,G.jsx)(oo,{size:13})})}function HS({position:e,onEnter:t,onLeave:n,children:r}){return(0,G.jsx)(`div`,{className:`absolute z-30`,"data-stop-pan":!0,style:{...e,transform:`scale(calc(1 / var(--canvas-zoom, 1)))`,transformOrigin:`top left`},onMouseEnter:t,onMouseLeave:n,children:r})}function US(e,t,n,r,i=[]){let{free:a,attached:o}=MS(e,t,r,n),s=new Map;for(let e of i){let i=F_(e,t,n,r);i&&s.set(Mh(i),(s.get(Mh(i))??0)+1)}return{free:a.map(({note:e,card:t})=>({note:e,at:t})),attached:o.map(({note:e,marker:t,frame:n,stale:r})=>{let i={left:kh(t.x,n.left,n.right),top:kh(t.y,n.top,n.bottom)},a=Mh(i),o=s.get(a)??0;return s.set(a,o+1),{note:e,position:i,pileIndex:o,stale:r}})}}function WS(){let e=q(e=>e.notes),t=q(e=>e.markupVisible),n=q(e=>e.currentBoardId),r=q(e=>n?e.boards[n]:null),i=q(e=>e.nodeRects),a=q(e=>e.frameInsets),o=q(e=>e.commentThreads);if(!t||e.length===0)return null;let{free:s,attached:c}=US(e,r?.frames??[],a,i,o);return(0,G.jsxs)(G.Fragment,{children:[s.map(({note:e,at:t})=>(0,G.jsx)(QS,{note:e,pos:t},e.id)),c.map(({note:e,position:t,pileIndex:n,stale:r})=>(0,G.jsx)($S,{note:e,position:t,pileIndex:n,stale:r},e.id))]})}var GS=120,KS=32;function qS(e){let t=q(e=>e.editingMarkupId),n=q(e=>e.setEditingMarkupId),r=q(e=>e.currentBoardId),i=t===e.id,[a,o]=(0,P.useState)(e.body),s=(0,P.useRef)(!1);(0,P.useEffect)(()=>{o(e.body),s.current=!1},[e.body]);let c=async t=>{if(lp(e.id))q.getState().updateDraftNote(e.id,t);else if(r)try{await vd.update({boardId:r,noteId:e.id,patch:t})}catch(e){H(e,`Could not update note`)}},l=async()=>{if(q.getState().editingMarkupId===e.id&&n(null),lp(e.id))q.getState().discardDraftNote(e.id);else if(r)try{await vd.remove({boardId:r,noteId:e.id})}catch(e){H(e,`Could not remove note`)}};return{isEditing:i,text:a,setText:o,update:c,remove:l,startEditing:()=>{s.current=!1,n(e.id)},saveAndExit:async()=>{if(!s.current){if(s.current=!0,q.getState().editingMarkupId===e.id&&n(null),!a.trim())await l();else if(lp(e.id))await q.getState().saveDraftNote(e.id,{body:a});else if(a!==e.body&&r)try{await vd.update({boardId:r,noteId:e.id,patch:{body:a}})}catch(e){H(e,`Could not update note`)}}},cancelAndExit:()=>{s.current||(s.current=!0,o(e.body),n(null),lp(e.id)&&q.getState().discardDraftNote(e.id))}}}function JS({editing:e}){return(0,G.jsx)(`div`,{onPointerDown:e=>e.stopPropagation(),children:(0,G.jsx)(yg,{autoFocus:!0,ariaLabel:`Note`,value:e.text,onChange:e.setText,onBlur:()=>void e.saveAndExit(),placeholder:`Write a note…`,className:`min-h-[1.5em] ${PS}`,onKeyDown:t=>{(t.key===`Escape`||t.key===`Enter`&&(t.metaKey||t.ctrlKey))&&(t.preventDefault(),t.stopPropagation(),e.saveAndExit())}})})}function YS({onRemove:e}){return(0,G.jsx)(`button`,{type:`button`,"aria-label":`Delete note`,title:`Delete note`,"data-note-trash":!0,className:`absolute right-1 top-1 hidden size-6 items-center justify-center rounded-md border border-border bg-card text-muted-foreground shadow-sm hover:text-destructive group-hover/note:flex`,onPointerDown:e=>e.stopPropagation(),onClick:t=>{t.stopPropagation(),e()},children:(0,G.jsx)(L,{size:13})})}function XS({size:e,scale:t,onResize:n,onCommit:r}){let i=(0,P.useRef)(null),a=(0,P.useRef)(null),o=(o,s)=>(0,G.jsx)(`div`,{"aria-hidden":`true`,"data-note-resize":o,className:`absolute size-2.5 rounded-[2px] border border-primary bg-card ${s}`,onMouseDown:e=>e.preventDefault(),onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId),i.current={x:t.clientX,y:t.clientY,...e()}},onPointerMove:e=>{let r=i.current;if(!r)return;let s=t()||1,c={w:o===`y`?r.w:Math.max(GS,r.w+(e.clientX-r.x)/s),h:o===`x`?r.h:Math.max(KS,r.h+(e.clientY-r.y)/s)};a.current=c,n(c)},onPointerUp:e=>{e.currentTarget.releasePointerCapture(e.pointerId),i.current=null,a.current&&r(a.current),a.current=null}});return(0,G.jsxs)(G.Fragment,{children:[o(`x`,`-right-[5px] top-1/2 -translate-y-1/2 cursor-ew-resize`),o(`y`,`-bottom-[5px] left-1/2 -translate-x-1/2 cursor-ns-resize`),o(`xy`,`-bottom-[5px] -right-[5px] cursor-nwse-resize`)]})}function ZS(e){let[t,n]=(0,P.useState)(null);return(0,P.useEffect)(()=>{n(null)},[e.width,e.height]),[t,n]}function QS({note:e,pos:t}){let n=qS(e),r=(0,P.useRef)(null),i=(0,P.useRef)(null),[a,o]=ZS(e),s=()=>q.getState().canvasZoom||1,c=e=>{n.isEditing||e.button!==0||(e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),i.current={ox:t.x,oy:t.y,sx:e.clientX/s(),sy:e.clientY/s()})},l=e=>{let t=i.current;t&&(e.currentTarget.style.left=`${t.ox+e.clientX/s()-t.sx}px`,e.currentTarget.style.top=`${t.oy+e.clientY/s()-t.sy}px`)},u=async e=>{let t=i.current;if(!t)return;e.currentTarget.releasePointerCapture(e.pointerId),i.current=null;let r=e.clientX/s()-t.sx,a=e.clientY/s()-t.sy;Math.abs(r)<1&&Math.abs(a)<1||await n.update({x:t.ox+r,y:t.oy+a})};return(0,G.jsxs)(`div`,{ref:r,className:`group/note ${FS} outline-none ${n.isEditing?`bg-card/80 outline-1 outline-offset-4 outline-primary`:`hover:bg-foreground/[0.03] focus:outline-1 focus:outline-offset-4 focus:outline-primary`}`,style:{left:t.x,top:t.y,width:a?.w??e.width,height:a?.h??e.height},"data-note-id":e.id,onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerCancel:u,onDoubleClick:e=>{e.stopPropagation(),n.startEditing()},onKeyDown:e=>{n.isEditing||(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),n.remove()):e.key===`Enter`&&(e.preventDefault(),n.startEditing()))},tabIndex:0,children:[(0,G.jsx)(RS,{children:n.isEditing?(0,G.jsx)(JS,{editing:n}):(0,G.jsx)(LS,{body:e.body,emptyHint:`Empty note — double-click to edit`})}),n.isEditing?(0,G.jsx)(XS,{size:()=>({w:r.current?.offsetWidth??e.width,h:r.current?.offsetHeight??e.height??KS}),scale:s,onResize:o,onCommit:e=>void n.update({width:e.w,height:e.h})}):(0,G.jsx)(YS,{onRemove:()=>void n.remove()})]})}function $S({note:e,position:t,pileIndex:n,stale:r}){let i=qS(e),a=BS(lp(e.id)),o=(0,P.useRef)(null),[s,c]=ZS(e),l=a.held,u=a.setHeld,d=a.hovered||l||i.isEditing,f=e=>{i.isEditing||(e.key===`Delete`||e.key===`Backspace`?(e.preventDefault(),i.remove()):e.key===`Enter`?(e.preventDefault(),u(!0),i.startEditing()):e.key===`Escape`&&l&&(e.preventDefault(),e.stopPropagation(),u(!1)))};return(0,G.jsxs)(`div`,{"data-note-id":e.id,"data-note-attached":`true`,className:`contents`,children:[(0,G.jsx)(VS,{position:t,pileIndex:n,stale:r,open:d,held:l||i.isEditing,onEnter:a.enter,onLeave:a.leave,onToggle:()=>u(e=>!e),onDoubleClick:()=>{u(!0),i.startEditing()},onKeyDown:f}),d?(0,G.jsx)(HS,{position:t,onEnter:a.enter,onLeave:a.leave,children:(0,G.jsxs)(`div`,{ref:o,className:`group/note ${IS} ${i.isEditing?`border-primary`:`border-border`}`,style:{width:s?.w??e.width,height:s?.h??e.height},"data-note-card":!0,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>{e.stopPropagation(),u(!0),i.startEditing()},onKeyDown:f,children:[(0,G.jsx)(RS,{children:(0,G.jsxs)(`div`,{className:`border-l-2 border-foreground/15 pl-3 pr-6`,children:[i.isEditing?(0,G.jsx)(JS,{editing:i}):(0,G.jsx)(LS,{body:e.body,emptyHint:`Empty note — double-click to edit`}),r?(0,G.jsx)(`div`,{className:`mt-1 text-[11px] uppercase tracking-wide text-destructive/80`,children:`Its node is gone`}):null]})}),i.isEditing?(0,G.jsx)(XS,{size:()=>({w:o.current?.offsetWidth??e.width,h:o.current?.offsetHeight??e.height??KS}),scale:()=>1,onResize:c,onCommit:e=>void i.update({width:e.w,height:e.h})}):(0,G.jsx)(YS,{onRemove:()=>void i.remove()})]})}):null]})}var eC=`Local comments stay on this machine. Cloud comments live on the published board, where reviewers can see and answer them.`;function tC({scope:e,onChange:t}){return(0,G.jsxs)(rv,{type:`single`,size:`sm`,variant:`outline`,value:e,onValueChange:e=>e&&t(e),className:`w-full`,"aria-label":`Comment scope`,children:[(0,G.jsx)(iv,{value:`all`,className:`text-[11px]`,children:`All`}),(0,G.jsxs)(iv,{value:`local`,className:`text-[11px]`,children:[(0,G.jsx)(fi,{}),` Local`]}),(0,G.jsxs)(iv,{value:`shared`,className:`text-[11px]`,children:[(0,G.jsx)(In,{}),` Cloud`]})]})}function nC({scope:e,onChange:t,cloud:n,className:r=``}){let i=q(e=>e.openSignIn),a=n===void 0,o=n?.available===!1?n.reason:null,s=o===`unpublished`,c=!!o&&!s;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 ${r}`,"data-comment-target-picker":!0,children:[(0,G.jsxs)(rv,{type:`single`,size:`sm`,variant:`outline`,spacing:0,value:e,onValueChange:e=>e&&t(e),className:`w-full`,"aria-label":`Comment target`,children:[(0,G.jsxs)(iv,{value:`local`,className:`flex-1 text-xs`,title:eC,children:[(0,G.jsx)(fi,{}),` Local`]}),(0,G.jsxs)(iv,{value:`shared`,className:`flex-1 text-xs`,disabled:a||c,title:o&&!s?id(o):s?`This board has no published link yet — posting will publish it first.`:n?.available?`Post to the published board at ${n.url}`:`Checking this board's published link…`,children:[(0,G.jsx)(In,{}),` Cloud`,s?(0,G.jsx)(So,{className:`text-amber-600 dark:text-amber-500`,"data-needs-publish":!0}):null]})]}),e===`shared`&&s?(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`This board isn't published yet. Posting opens the publish flow first.`}):null,o&&rd(o)?(0,G.jsx)(J,{variant:`ghost`,size:`sm`,className:`self-start text-[11px]`,onClick:()=>i({action:`post comments to the published board`,expired:o===`expired`}),children:`Sign in to write cloud comments`}):null]})}var rC=14;function iC(e,t,n){if(e.kind===`board`)return{x:e.x,y:e.y,w:0,h:0};let r=t.find(t=>t.id===e.frameId);return r?vp(r,n[r.id]??{x:0,y:0},e.bounds):null}function aC({anchor:e,frames:t,insets:n,onCancel:r,onSubmit:i,target:a,blocked:o,onFrame:s}){let[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(null),[f,p]=(0,P.useState)(!1),m=(0,P.useRef)(null),h=(0,P.useRef)(s);h.current=s,(0,P.useEffect)(()=>{l(``),d(null)},[e]);let g=iC(e,t,n);if((0,P.useEffect)(()=>{let e=m.current;if(e&&g)return h.current?.(g,{w:e.offsetWidth,h:e.offsetHeight,gap:rC})},[e]),!g)return null;let _=()=>{c.trim()&&!f&&(d(null),p(!0),i(c).then(d).finally(()=>p(!1)))};return(0,G.jsxs)(`div`,{ref:m,className:`absolute z-30 rounded-lg border bg-card p-3 shadow-xl ${a?`w-96`:`w-80`}`,style:{left:g.x+g.w,top:g.y,transform:`scale(calc(1 / var(--canvas-zoom, 1))) translate(${rC}px, ${rC}px)`,transformOrigin:`top left`},"data-inline-comment-composer":!0,onPointerDown:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 text-xs font-medium`,children:[(0,G.jsx)(oi,{size:13}),e.kind===`node`?`Pinned comment`:`Pinned board location`,(0,G.jsx)(`button`,{type:`button`,className:`ml-auto text-muted-foreground hover:text-foreground`,"aria-label":`Cancel comment`,onClick:r,children:(0,G.jsx)(Ho,{size:13})})]}),o??(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(yg,{autoFocus:!0,ariaLabel:`New pinned comment`,value:c,onChange:l,placeholder:`What should change?`,className:`min-h-20 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 dark:bg-input/30`,onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),r()):Nh(_)(e)}}),u?(0,G.jsx)(A_,{children:u}):null,(0,G.jsxs)(`div`,{className:`mt-2 flex items-end gap-2`,children:[a?(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:a}):null,(0,G.jsx)(J,{size:`sm`,className:`ml-auto`,disabled:f||!c.trim(),onClick:_,children:f?`Posting…`:u?`Try again`:`Add comment`})]})]})]})}function oC(){let e=q(e=>e.pendingCommentAnchor),t=q(e=>e.currentBoardId?e.boards[e.currentBoardId]:void 0),n=q(e=>e.frameInsets),r=q(e=>e.cloudComments),i=q(e=>e.clearPendingComment),a=q(e=>e.createPendingComment),o=q(e=>e.zoomForCommentDraft),s=q(e=>e.restoreViewAfterMarkupEdit),[c,l]=(0,P.useState)(`local`);return!e||!t?null:(0,G.jsx)(aC,{anchor:e,frames:t.frames,insets:n,onCancel:i,onSubmit:e=>a(e,c),target:(0,G.jsx)(nC,{scope:c,onChange:l,cloud:r}),onFrame:(e,t)=>(o(e,t),s)})}function sC({board:e}){let t=q(e=>e.setCanvasZoom),n=q(e=>e.setPan),r=q(e=>e.cursorMode),i=dh(),[a,o]=(0,P.useState)(!1),[s,c]=(0,P.useState)(null),l=(0,P.useRef)(null),u=(0,P.useRef)(null),d=(0,P.useMemo)(()=>{let t=800,n=600;for(let r of e.frames)r.x+r.w>t&&(t=r.x+r.w),r.y+r.h>n&&(n=r.y+r.h);return{w:t+600,h:n+400}},[e.frames]),f=(0,P.useMemo)(()=>{let t={};for(let n of e.frames)t[n.screen]=(t[n.screen]??0)+1;return t},[e.frames]),p=(0,P.useRef)(null);(0,P.useEffect)(()=>{let r=l.current;if(!r||p.current===e.id)return;let i=xf(e.id);if(i){t(i.zoom),n(i.pan),p.current=e.id;return}if(e.frames.length===0){p.current=e.id;return}let a=()=>{let i=hp(e.frames,r.clientWidth,r.clientHeight);return i?(t(i.zoom),n(i.pan),p.current=e.id,!0):!1};if(a())return;let o=null,s=requestAnimationFrame(()=>{a()||(o=new ResizeObserver(()=>{a()&&o?.disconnect()}),o.observe(r))});return()=>{cancelAnimationFrame(s),o?.disconnect()}},[e.id,e.frames,t,n]),(0,P.useEffect)(()=>{let e=l.current;if(!e)return;let t=t=>{let n=q.getState();if(t.metaKey||t.ctrlKey){t.preventDefault();let r=e.getBoundingClientRect(),i=bp(t.clientX-r.left,t.clientY-r.top,pp(t.deltaY),{zoom:n.canvasZoom,pan:n.pan});n.setCanvasZoom(i.zoom),n.setPan(i.pan)}else t.preventDefault(),n.setPan({x:n.pan.x-t.deltaX,y:n.pan.y-t.deltaY})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let m=(e,t)=>{let n=l.current;if(!n)return{x:0,y:0};let{canvasZoom:r,pan:i}=q.getState(),a=n.getBoundingClientRect();return{x:(e-a.left-i.x)/r,y:(t-a.top-i.y)/r}},h=t=>{if(t.button!==0)return;if(r===`hand`){t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),u.current={startX:t.clientX,startY:t.clientY,startPan:{...q.getState().pan}},o(!0);return}let n=t.target===t.currentTarget||!!t.target.dataset?.vellooBoardWorld;if(r===`note`&&n){let e=m(t.clientX,t.clientY);t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),c({x0:e.x,y0:e.y,x1:e.x,y1:e.y})}else if(r===`comment`&&n){let n=m(t.clientX,t.clientY);t.preventDefault(),q.getState().beginComment({kind:`board`,boardId:e.id,...n})}else n&&q.getState().setSelection(null)},g=e=>{if(s){let t=m(e.clientX,e.clientY);c({...s,x1:t.x,y1:t.y});return}let t=u.current;t&&n({x:t.startPan.x+(e.clientX-t.startX),y:t.startPan.y+(e.clientY-t.startY)})},_=e=>{if(s)c(null),q.getState().createNote(dC(s,q.getState().canvasZoom));else if(u.current){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}u.current=null,o(!1)}};return(0,P.useEffect)(()=>{let e=()=>{u.current=null,o(!1)};return window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`blur`,e)}},[]),(0,P.useEffect)(()=>{r!==`hand`&&(u.current=null,o(!1))},[r]),(0,G.jsxs)(`div`,{ref:l,"data-velloo-board":`true`,className:`flex-1 min-h-0 min-w-0 overflow-clip bg-muted/30 relative`,onPointerDown:h,onPointerMove:g,onPointerUp:_,onPointerCancel:_,style:{cursor:r===`hand`?a?`grabbing`:`grab`:r===`note`?`crosshair`:r===`comment`?`cell`:`default`},children:[(0,G.jsxs)(cC,{boardId:e.id,restoredRef:p,w:d.w,h:d.h,children:[e.frames.map(t=>(0,G.jsx)(gy,{boardId:e.id,frame:t,frames:e.frames,presets:i,sharedCount:f[t.screen]??1},t.id)),(0,G.jsx)(sv,{}),(0,G.jsx)(AS,{}),(0,G.jsx)(WS,{}),s?(0,G.jsx)(fC,{rect:s}):null,(0,G.jsx)(oC,{}),(0,G.jsx)(z_,{})]}),(0,G.jsx)(CS,{})]})}function cC({boardId:e,restoredRef:t,w:n,h:r,children:i}){let a=q(e=>e.canvasZoom),o=q(e=>e.pan);return(0,P.useEffect)(()=>{if(t.current!==e)return;let n=setTimeout(()=>Sf(e,{pan:o,zoom:a}),150);return()=>clearTimeout(n)},[e,o,a,t]),(0,G.jsx)(`div`,{"data-velloo-board-world":`true`,className:`relative origin-top-left`,style:{width:n,height:r,transform:`translate(${o.x}px, ${o.y}px) scale(${a})`,"--canvas-zoom":a},children:i})}var lC=4,uC={w:120,h:32};function dC(e,t){let n=Math.min(e.x0,e.x1),r=Math.min(e.y0,e.y1),i=Math.abs(e.x1-e.x0),a=Math.abs(e.y1-e.y0),o=lC/(t||1);return i<o&&a<o?{x:e.x0,y:e.y0}:{x:n,y:r,width:Math.max(uC.w,i),height:Math.max(uC.h,a)}}function fC({rect:e}){let t=Math.min(e.x0,e.x1),n=Math.min(e.y0,e.y1),r=Math.abs(e.x1-e.x0),i=Math.abs(e.y1-e.y0);return(0,G.jsx)(`div`,{"aria-hidden":`true`,"data-note-drag-preview":!0,className:`pointer-events-none absolute rounded-sm border border-dashed border-primary bg-primary/5`,style:{left:t,top:n,width:r,height:i}})}function pC({className:e,size:t=`default`,...n}){return(0,G.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:W(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function mC({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-header`,className:W(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)`,e),...t})}function hC({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-title`,className:W(`cn-font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function gC({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-description`,className:W(`text-sm text-muted-foreground`,e),...t})}function _C({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-content`,className:W(`px-(--card-spacing)`,e),...t})}function vC({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`card-footer`,className:W(`flex items-center rounded-b-xl border-t bg-muted/50 p-(--card-spacing)`,e),...t})}var yC=`Use Velloo to propose this app's design language, for me to review on the canvas:
29
+ 1. Match the app's theme and fonts (the velloo-setup skill covers how).
30
+ 2. Call set_design_language with the intent in a sentence or two and the Do's and Don'ts you can point to evidence for in the code.
31
+ Tell me what you could not determine instead of guessing.`,bC=e=>`velloo:languageSet:id:${e}`;function xC(e){return!e||typeof localStorage>`u`?!1:localStorage.getItem(bC(e))===`true`}function SC(e){e&&typeof localStorage<`u`&&localStorage.setItem(bC(e),`true`)}var CC=`Use Velloo to design a first screen for this app, following the design language already set on this design (get_theme, and the rules in the document it names).`;async function wC(e){try{await navigator.clipboard.writeText(e),V({kind:`success`,message:`Prompt copied — paste it to your coding agent.`})}catch{V({kind:`info`,message:`Copy failed — select the prompt text instead.`})}}function TC({onNewBoard:e}){let t=q(e=>e.openLanguage),n=q(e=>e.languageRules),r=q(e=>e.design?.folderId),i=!!n?.source,a=i||xC(r),o=(0,P.useRef)(null);(0,P.useEffect)(()=>{n!==null&&(o.current===!1&&i&&t(`review`).catch(e=>H(e,`Could not open the proposal`)),o.current=i)},[n,i,t]);let s=e=>void t(e).catch(e=>H(e,`Could not open the design language`));return a?(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto grid place-items-center p-10`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-xl flex flex-col gap-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Your design language is set`}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Every design here follows it. Start a board, or have your agent design a first screen with it.`})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(J,{size:`sm`,onClick:e,children:[(0,G.jsx)(ua,{}),`New board`]}),(0,G.jsxs)(J,{variant:`outline`,size:`sm`,onClick:()=>void wC(CC),children:[(0,G.jsx)(Wn,{}),`Copy a prompt for a first screen`]}),(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>s(`review`),children:[(0,G.jsx)(po,{}),`Review the design language`]})]})]})}):(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto grid place-items-center p-10`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-3xl flex flex-col gap-6`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Start with a design language`}),(0,G.jsx)(`p`,{className:`max-w-xl text-sm text-muted-foreground`,children:`Colour, type, shape and a few rules in plain words — set once, shown on this design's real components, and followed by every design after it.`})]}),(0,G.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,G.jsxs)(pC,{children:[(0,G.jsxs)(mC,{children:[(0,G.jsx)(Oa,{className:`size-5 text-primary`}),(0,G.jsx)(hC,{children:`Read it from my app`}),(0,G.jsx)(gC,{children:`Your coding agent reads the app's styles, fonts and components and proposes a language. You review it here.`})]}),(0,G.jsxs)(_C,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap rounded-md bg-muted/60 p-3 text-xs leading-relaxed font-mono`,children:yC}),(0,G.jsxs)(J,{variant:`outline`,size:`sm`,onClick:()=>void wC(yC),children:[(0,G.jsx)(Wn,{}),`Copy prompt for your agent`]}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This page opens the proposal on its own when it lands.`})]})]}),(0,G.jsxs)(pC,{children:[(0,G.jsxs)(mC,{children:[(0,G.jsx)(po,{className:`size-5 text-primary`}),(0,G.jsx)(hC,{children:`Define it here`}),(0,G.jsx)(gC,{children:`No app to match, or you want a new direction. Four short steps — colour, type, shape, rules — on live components. No agent needed.`})]}),(0,G.jsx)(_C,{children:(0,G.jsx)(J,{size:`sm`,onClick:()=>s(`guided`),children:`Start`})})]})]}),(0,G.jsx)(`div`,{children:(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:e,children:[(0,G.jsx)(ua,{}),`Or start with an empty board`]})})]})})}function EC(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`}function DC({theme:e,areas:t,boards:n}){let r=e==="default";return[r?`The design language of this Velloo design just changed (${EC(t)}). Bring every board that uses the default theme in line with it:`:`The "${e}" theme of this Velloo design just changed (${EC(t)}). Bring the boards that use it in line with it — ${EC(n)}:`,`1. Read it first: get_theme${r?``:` { theme: "${e}" }`}, and the rules in the document it names (designSystem.path).`,`2. Go board by board. Screenshot each screen in light and dark, and fix what no longer follows the language — colours, faces or corner radii set by hand instead of through the theme, and anything that breaks a rule.`,`3. Leave the theme and the rules as they are; they are the source of truth now.`,`4. Tell me, board by board, what you changed and what you left alone.`].join(`
32
+ `)}function OC(){let e=q(e=>e.languageHandoff),t=q(e=>e.dismissLanguageHandoff);if(!e)return null;let n=DC(e),r=e.boards.length,i=async()=>{try{await navigator.clipboard.writeText(n),V({kind:`success`,message:`Prompt copied — paste it to your coding agent.`})}catch{V({kind:`info`,message:`Copy failed — select the prompt text instead.`})}};return(0,G.jsx)(fh,{open:!0,onOpenChange:e=>{e||t()},children:(0,G.jsxs)(hh,{"data-testid":`language-handoff`,className:`sm:max-w-lg`,children:[(0,G.jsxs)(gh,{children:[(0,G.jsx)(vh,{children:`Bring your boards in line`}),(0,G.jsxs)(yh,{children:[`The change to `,EC(e.areas),` is already on`,` `,r===1?`the board`:`the ${r} boards`,` that use`,r===1?`s`:``,` `,e.theme==="default"?`this theme`:e.theme,`, wherever a design reads the theme. What the theme cannot reach — a colour, face or corner set by hand, or a layout that now breaks a rule — needs your agent to go and look.`]})]}),(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap rounded-md bg-muted/60 p-3 text-xs leading-relaxed font-mono`,children:n}),(0,G.jsxs)(_h,{children:[(0,G.jsx)(J,{variant:`ghost`,onClick:t,children:`Not now`}),(0,G.jsxs)(J,{onClick:()=>void i(),children:[(0,G.jsx)(Wn,{}),`Copy prompt for your agent`]})]})]})})}function kC(e){return e==="default"?`Default`:e}var AC=new Set;function jC(e,t,n=e){if(!t||AC.has(e))return;AC.add(e);let r=document.createElement(`link`);r.rel=`stylesheet`,r.href=iy(t,e,n),document.head.appendChild(r)}var MC=[{id:`suited`,label:`Suited`},{id:`all`,label:`All`},{id:`sans`,label:`Sans`},{id:`serif`,label:`Serif`},{id:`mono`,label:`Mono`}];function NC(e){return/^(mono|code)/.test(e)?`mono`:/(display|heading|title|wordmark|marquee|hero)/.test(e)?`display`:`body`}function PC(e,t){let n=e.roles.indexOf(t);return n===-1?e.roles.length+1:n}function FC({role:e,current:t,onPick:n,onBack:r}){let[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(`suited`),c=q(e=>e.setFontDraft),l=NC(e);(0,P.useEffect)(()=>()=>c(null),[c]);let u=(0,P.useMemo)(()=>{let e=i.trim().toLowerCase(),t=[...ty.filter(t=>e&&t.family.toLowerCase().includes(e)?!0:o===`suited`?t.roles.includes(l):o===`all`||t.category===o)].sort((e,t)=>PC(e,l)-PC(t,l));return e?t.filter(t=>`${t.family} ${t.note} ${t.category}`.toLowerCase().includes(e)):t},[i,o,l]),d=t=>{c({role:e,family:t.family,stack:ry(t),...t.google?{google:t.google}:{}})};return(0,G.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-b p-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back to theme`,className:`size-6 shrink-0 grid place-items-center rounded-md text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,G.jsx)(Wt,{size:14})}),(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Face for `,(0,G.jsx)(`span`,{className:`font-mono text-foreground`,children:e})]})]}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Ma,{size:13,className:`pointer-events-none absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground/60`}),(0,G.jsx)(Z,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:`Search ${ty.length} families`,spellCheck:!1,"aria-label":`Search families`,className:`h-7 pl-7 text-xs`})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-md bg-muted p-0.5`,children:MC.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>s(e.id),"aria-pressed":o===e.id,className:`flex-1 h-6 rounded-[5px] text-[11px] cursor-pointer `+(o===e.id?`bg-background font-medium text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e.label},e.id))})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto scroll-stable`,children:u.length===0?(0,G.jsxs)(`p`,{className:`p-4 text-xs text-muted-foreground`,children:[i.trim()?`No family here matches "${i.trim()}".`:`Nothing in this filter.`,o===`suited`?` Try All.`:``]}):u.map(e=>(0,G.jsx)(IC,{font:e,picked:e.family===t,onPreview:()=>d(e),onPick:()=>n(e)},e.family))})]})}function IC({font:e,picked:t,onPreview:n,onPick:r}){let i=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let t=i.current;if(!t)return;let n=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&(jC(e.family,e.google),n.disconnect())},{rootMargin:`200px`});return n.observe(t),()=>n.disconnect()},[e]),(0,G.jsxs)(`button`,{ref:i,type:`button`,onClick:r,onMouseEnter:n,onFocus:n,className:`flex w-full items-center gap-2 border-b px-3 py-2 text-left hover:bg-accent/50 focus-visible:bg-accent/50 outline-none cursor-pointer`,children:[(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`span`,{className:`block truncate text-[15px] leading-tight text-foreground`,style:{fontFamily:ry(e)},children:e.family}),(0,G.jsx)(`span`,{className:`mt-0.5 block truncate text-[10px] text-muted-foreground/80`,children:e.note})]}),t?(0,G.jsx)(I,{size:13,className:`shrink-0 text-primary`}):null]})}var LC=[{role:`display`,hint:`display`},{role:`serif`,hint:`body`},{role:`sans`,hint:`body`},{role:`mono`,hint:`mono`}],RC=/^[a-z][a-z0-9-]*$/;function zC(e){return/^\s*(?:"([^"]+)"|'([^']+)'|([^,]+))/.exec(e)?.slice(1).find(Boolean)?.trim()??e}var BC=/^(-|ui-|system-ui$|sans-serif$|serif$|monospace$|cursive$)/;function VC({theme:e,onBrowse:t}){let n=e.typography.fontFamily??{},r=Object.keys(n).sort(),[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(null),u=q(e=>e.refreshTheme),d=q(e=>e.themeName);(0,P.useEffect)(()=>{for(let e of Object.values(n)){let t=ny(zC(e));t&&jC(t.family,t.google)}},[n]);let f=e=>{Nd.setFonts(d,[e]).catch(e=>{H(e,`Could not update the font role`),u()})},p=o.trim(),m=RC.test(p)&&!r.includes(p),h=e=>{a(!1),t(e)};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.length===0?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No faces declared yet.`}):r.map(e=>{let r=n[e],i=zC(r),a=ny(i),o=BC.test(i);return(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(e),title:r,className:`min-w-0 flex-1 flex items-baseline gap-2 rounded-md border border-input bg-background px-2 py-1.5 text-left hover:bg-accent/50 cursor-pointer`,children:[(0,G.jsx)(`span`,{className:`w-14 shrink-0 truncate font-mono text-[10px] text-muted-foreground`,children:e}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs `+(o?`text-muted-foreground`:`text-foreground`),style:a?{fontFamily:r}:void 0,children:o?`System default`:i})]}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>l(e),title:`Remove the ${e} face`,"aria-label":`Remove the ${e} face`,className:`size-6 shrink-0 grid place-items-center rounded-md text-muted-foreground/60 hover:text-destructive cursor-pointer`,children:(0,G.jsx)(L,{size:11})})]},e)}),i?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Z,{autoFocus:!0,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&h(p),e.key===`Escape`&&a(!1)},placeholder:`Role name`,spellCheck:!1,"aria-label":`New role name`,className:`h-7 flex-1 font-mono text-xs`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>h(p),disabled:!m,"aria-label":`Choose a face`,className:`size-7 shrink-0 grid place-items-center rounded-md border border-input bg-background text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,G.jsx)(I,{size:13})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(!1),"aria-label":`Cancel`,className:`size-7 shrink-0 grid place-items-center rounded-md text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,G.jsx)(Ho,{size:13})})]}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:LC.filter(e=>!r.includes(e.role)).map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>s(e.role),className:`rounded-full border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground hover:text-foreground cursor-pointer`,children:e.role},e.role))}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80`,children:p.length>0&&!m?r.includes(p)?`"${p}" is already declared`:`Lowercase letters, digits and dashes — it becomes a utility name`:`Becomes --font-${p||`role`} and the font-${p||`role`} class`})]}):(0,G.jsxs)(`button`,{type:`button`,onClick:()=>{s(``),a(!0)},className:`flex items-center justify-center gap-1 rounded-md border border-dashed py-1.5 text-[11px] text-muted-foreground hover:text-foreground cursor-pointer`,children:[(0,G.jsx)(ua,{size:12}),` Add a face`]})]}),(0,G.jsx)(Dg,{open:c!==null,onOpenChange:e=>!e&&l(null),children:(0,G.jsxs)(Ag,{children:[(0,G.jsxs)(jg,{children:[(0,G.jsx)(Pg,{children:`Remove the "${c}" face`}),(0,G.jsx)(Fg,{children:`Anything using the font-${c} class falls back to the inherited face. A typeset still pointing at this role will block the removal.`})]}),(0,G.jsxs)(Mg,{children:[(0,G.jsx)(Lg,{children:`Cancel`}),(0,G.jsx)(Ig,{variant:`destructive`,onClick:()=>{let e=c;l(null),e&&f({role:e,remove:!0})},children:`Remove`})]})]})})]})}function HC(e,t){return{role:e,family:t.family,fallback:t.fallback,...t.google?{google:t.google}:{}}}function UC({className:e,...t}){return(0,G.jsx)(`div`,{role:`list`,"data-slot":`item-group`,className:W(`group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2`,e),...t})}function WC({className:e,...t}){return(0,G.jsx)(B_,{"data-slot":`item-separator`,orientation:`horizontal`,className:W(`my-2`,e),...t})}var GC=d(`group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted`,{variants:{variant:{default:`border-transparent`,outline:`border-border`,muted:`border-transparent bg-muted/50`},size:{default:`gap-2.5 px-3 py-2.5`,sm:`gap-2.5 px-3 py-2.5`,xs:`gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0`}},defaultVariants:{variant:`default`,size:`default`}});function KC({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?N:`div`;return(0,G.jsx)(a,{"data-slot":`item`,"data-variant":t,"data-size":n,className:W(GC({variant:t,size:n,className:e})),...i})}var qC=d(`flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none`,{variants:{variant:{default:`bg-transparent`,icon:`[&_svg:not([class*='size-'])]:size-4`,image:`size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover`}},defaultVariants:{variant:`default`}});function JC({className:e,variant:t=`default`,...n}){return(0,G.jsx)(`div`,{"data-slot":`item-media`,"data-variant":t,className:W(qC({variant:t,className:e})),...n})}function YC({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`item-content`,className:W(`flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none`,e),...t})}function XC({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`item-title`,className:W(`line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4`,e),...t})}function ZC({className:e,...t}){return(0,G.jsx)(`p`,{"data-slot":`item-description`,className:W(`line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary`,e),...t})}function QC({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`item-actions`,className:W(`flex items-center gap-2`,e),...t})}function $C({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`item-footer`,className:W(`flex basis-full items-center justify-between gap-2`,e),...t})}var ew=d(`group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function tw({className:e,variant:t,...n}){return(0,G.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:W(ew({variant:t}),e),...n})}function nw({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-title`,className:W(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function rw({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-description`,className:W(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function iw({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-action`,className:W(`absolute top-2 right-2`,e),...t})}var aw=[{kind:`do`,label:`Do`,placeholder:`One primary action per view`},{kind:`dont`,label:`Don't`,placeholder:`Shadows on flat surfaces`}];function ow({state:e}){let t=q(e=>e.saveRules),n=e.source!==null&&!e.source.writable,[r,i]=(0,P.useState)(e.intent);(0,P.useEffect)(()=>{i(e.intent)},[e.intent]);let a=n=>{t({intent:n.intent??e.intent,rules:n.rules??e.rules}).catch(e=>H(e,`Could not save the rules`))};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-5 p-4`,children:[n&&e.source?(0,G.jsxs)(tw,{children:[(0,G.jsxs)(nw,{children:[`Read from `,e.source.path]}),(0,G.jsx)(rw,{children:`This design follows the repo's own design system document, so its rules are edited in that file. Changes show up here as soon as it is saved.`})]}):null,(0,G.jsxs)(G_,{children:[(0,G.jsx)(q_,{htmlFor:`language-intent`,children:`Intent`}),(0,G.jsx)(Vg,{id:`language-intent`,value:r,readOnly:n,rows:3,placeholder:`What this design is going for, in a sentence or two.`,onChange:e=>i(e.target.value),onBlur:()=>{!n&&r.trim()!==e.intent&&a({intent:r.trim()})}})]}),aw.map(({kind:t,label:r,placeholder:i})=>(0,G.jsx)(sw,{kind:t,label:r,placeholder:i,rules:e.rules,readOnly:n,onChange:e=>a({rules:e})},t)),n?null:(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Saved to guidance.md in this design. Your agent reads it before composing, and a review quotes each rule word for word.`})]})}function sw({kind:e,label:t,placeholder:n,rules:r,readOnly:i,onChange:a}){let[o,s]=(0,P.useState)(``),c=r.filter(t=>t.kind===e),l=`language-rule-${e}`,u=()=>{let t=o.trim();t!==``&&(s(``),a([...r,{kind:e,text:t}]))};return(0,G.jsxs)(G_,{children:[(0,G.jsx)(q_,{htmlFor:l,children:t}),c.length>0?(0,G.jsx)(UC,{className:`gap-1.5`,children:c.map(t=>(0,G.jsxs)(KC,{variant:`outline`,size:`xs`,children:[(0,G.jsx)(JC,{children:e===`do`?(0,G.jsx)(I,{className:`size-3.5 text-primary`}):(0,G.jsx)(Ho,{className:`size-3.5 text-destructive`})}),(0,G.jsx)(YC,{children:(0,G.jsx)(XC,{className:`text-xs font-normal leading-snug`,children:t.text})}),i?null:(0,G.jsx)(QC,{children:(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,"aria-label":`Remove rule: ${t.text}`,onClick:()=>a(r.filter(e=>e!==t)),children:(0,G.jsx)(L,{})})})]},t.text))}):i?(0,G.jsx)(J_,{className:`text-xs`,children:`None stated.`}):null,i?null:(0,G.jsxs)(Hg,{children:[(0,G.jsx)(qg,{id:l,value:o,placeholder:c.length===0?`e.g. ${n}`:`Add another`,className:`text-xs`,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())}}),(0,G.jsx)(Wg,{align:`inline-end`,children:(0,G.jsx)(Kg,{size:`icon-xs`,"aria-label":`Add a ${t} rule`,disabled:o.trim()===``,onClick:u,children:(0,G.jsx)(ua,{})})})]})]})}var cw=16;function lw(e){if(typeof e==`number`)return e;if(e===void 0)return null;let t=/^(-?\d*\.?\d+)(px|rem)?$/.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]===`rem`?n*cw:n}function uw(e){return`${Number((e/cw).toFixed(4))}rem`}var dw=[{px:0,label:`Sharp`},{px:4,label:`Subtle`},{px:8,label:`Soft`},{px:12,label:`Round`},{px:20,label:`Pill`}];function fw(e){return dw.find(t=>t.px===e)?.label??`Custom`}function pw({className:e,defaultValue:t,value:n,min:r=0,max:i=100,tone:a=`primary`,"aria-label":o,...s}){let c=a===`muted`,l=P.useMemo(()=>Array.isArray(n)?n:Array.isArray(t)?t:[r,i],[n,t,r,i]);return(0,G.jsxs)(Xe,{"data-slot":`slider`,...t===void 0?{}:{defaultValue:t},...n===void 0?{}:{value:n},min:r,max:i,className:W(`relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col`,e),...s,children:[(0,G.jsx)(De,{"data-slot":`slider-track`,className:`relative grow overflow-hidden rounded-full bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1`,children:(0,G.jsx)(He,{"data-slot":`slider-range`,className:W(`absolute select-none data-horizontal:h-full data-vertical:w-full`,c?`bg-muted-foreground/30`:`bg-primary`)})}),Array.from({length:l.length},(e,t)=>(0,G.jsx)(Be,{"data-slot":`slider-thumb`,"aria-label":o,className:W(c&&`border-muted-foreground/40 bg-muted`,`relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50`)},t))]})}var mw=24;function hw({theme:e}){let t=q(e=>e.themeName),n=e.radius.md??e.radius.lg??e.radius.sm,r=lw(n),[i,a]=(0,P.useState)(r??8);(0,P.useEffect)(()=>{r!==null&&a(r)},[r]);let o=e=>{a(e),Nd.setRadius(t,uw(e)).catch(e=>H(e,`Could not set the corner radius`))};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,G.jsxs)(G_,{children:[(0,G.jsx)(q_,{children:`Corners`}),(0,G.jsx)(rv,{type:`single`,variant:`outline`,size:`sm`,className:`w-full`,value:String(i),onValueChange:e=>{e!==``&&o(Number(e))},children:dw.map(e=>(0,G.jsx)(iv,{value:String(e.px),className:`flex-1 text-xs`,children:e.label},e.px))})]}),(0,G.jsxs)(G_,{children:[(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,G.jsx)(q_,{children:`Radius`}),(0,G.jsxs)(`span`,{className:`font-mono text-xs tabular-nums`,children:[i,`px`]})]}),(0,G.jsx)(pw,{"aria-label":`Corner radius`,value:[Math.min(i,mw)],min:0,max:mw,step:1,onValueChange:([e])=>a(e),onValueCommit:([e])=>o(e)}),(0,G.jsx)(J_,{className:`text-xs`,children:r===null&&n!==void 0?`The theme's radius is ${String(n)}, which this control can't show. Moving it replaces that value.`:`The large corner. Small and medium step down from it, extra large steps up.`})]})]})}var gw={AAA:`text-emerald-600 dark:text-emerald-400`,AA:`text-emerald-600 dark:text-emerald-400`,AAlarge:`text-amber-600 dark:text-amber-400`,Fail:`text-rose-600 dark:text-rose-400`},_w={AAA:`AAA`,AA:`AA`,AAlarge:`AA·lg`,Fail:`FAIL`};function vw({bumpKey:e}){let[t,n]=(0,P.useState)(null),r=q(e=>e.themeName);if((0,P.useEffect)(()=>{let e=!0,t=r==="default"?``:`?name=${encodeURIComponent(r)}`;return fetch(`/api/theme/contrast${t}`).then(e=>e.ok?e.json():Promise.reject(Error(`${e.status}`))).then(t=>{e&&n(t.results)}).catch(()=>{e&&n([])}),()=>{e=!1}},[e,r]),!t)return null;if(t.length===0)return(0,G.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Contrast: no parseable pairs.`});let i=t.filter(e=>e.tier===`Fail`),a=`${t.length-i.length}/${t.length} pass WCAG AA`;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:`Contrast`}),(0,G.jsx)(`span`,{className:`tabular-nums `+(i.length===0?`text-emerald-600 dark:text-emerald-400`:`text-rose-600 dark:text-rose-400`),children:a})]}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-1`,children:t.map(e=>(0,G.jsxs)(`li`,{className:`flex items-center justify-between gap-2 rounded-md border bg-background px-1.5 py-1 text-[10px]`,children:[(0,G.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.label}),(0,G.jsxs)(`span`,{className:`shrink-0 tabular-nums ${gw[e.tier]}`,children:[e.ratio.toFixed(2),`:1 `,_w[e.tier]]})]},e.label))})]})}function yw({id:e,label:t,value:n,onChange:r,fallback:i,placeholder:a,title:o,children:s}){let[c,l]=(0,P.useState)(!1),u=(0,P.useRef)(null),d=n.trim()||i||``;return(0,G.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,G.jsxs)(X_,{open:c,onOpenChange:l,children:[(0,G.jsx)(Z_,{asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,className:`h-7 w-7 rounded-md border shrink-0 cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,style:{background:d||`transparent`},title:o,"aria-label":`Edit ${t}`})}),(0,G.jsx)(Q_,{align:`start`,className:`w-72`,onOpenAutoFocus:e=>{document.activeElement===u.current&&e.preventDefault()},onInteractOutside:e=>{e.target===u.current&&e.preventDefault()},children:(0,G.jsx)(Sw,{currentValue:d||`#000000`,onCommit:r})})]}),(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col gap-1`,children:[(0,G.jsx)(Y,{htmlFor:e,className:`text-xs text-muted-foreground truncate`,children:t}),(0,G.jsx)(Z,{ref:u,id:e,type:`text`,value:n,placeholder:a,onChange:e=>r(e.target.value),onFocus:()=>l(!0),spellCheck:!1,className:`text-xs font-mono`})]}),s]})}var bw=250;function xw({label:e,tokenPath:t,value:n,write:r,children:i}){let[a,o]=(0,P.useState)(n),s=(0,P.useRef)(null),c=q(e=>e.themeName);return(0,P.useEffect)(()=>{o(n)},[n]),(0,P.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,G.jsx)(yw,{id:`token-${t}`,label:e,value:a,onChange:e=>{o(e),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{let n=Dy(e)??e;(r?r(n):Nd.setToken(c,t,n)).catch(e=>H(e,`Could not set color token`))},bw)},title:`${t} — click to edit`,children:i})}function Sw({currentValue:e,onCommit:t}){let n=Ty(e)??{hex:`#000000`,oklch:`oklch(0 0 0)`,hsl:`hsl(0 0% 0%)`},[r,i]=(0,P.useState)(n.hex),[a,o]=(0,P.useState)(n.oklch),[s,c]=(0,P.useState)(n.hsl),[l,u]=(0,P.useState)(()=>Mx(n.hex)??{h:0,s:0,v:0}),d=(0,P.useRef)(n.oklch);(0,P.useEffect)(()=>{if(e===d.current)return;let t=Ty(e);if(!t||t.oklch===d.current)return;d.current=t.oklch,i(t.hex),o(t.oklch),c(t.hsl);let n=Mx(t.hex);n&&u(n)},[e]);let f=(e,n)=>{let r=Ty(e);if(!r)n===`hex`&&i(e),n===`oklch`&&o(e),n===`hsl`&&c(e);else{if(i(r.hex),o(r.oklch),c(r.hsl),n!==`wheel`){let e=Mx(r.hex);e&&u(e)}d.current=r.oklch,t(r.oklch)}};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(Ix,{value:l,onChange:e=>{u(e),f(jx(e),`wheel`)}}),(0,G.jsx)(Cw,{label:`HEX`,value:r,onChange:e=>f(e,`hex`)}),(0,G.jsx)(Cw,{label:`OKLCH`,value:a,onChange:e=>f(e,`oklch`)}),(0,G.jsx)(Cw,{label:`HSL`,value:s,onChange:e=>f(e,`hsl`)})]})}function Cw({label:e,value:t,onChange:n}){let r=`velloo-color-${e.toLowerCase()}`;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,G.jsx)(`label`,{htmlFor:r,className:`w-12 text-muted-foreground uppercase tracking-wider`,children:e}),(0,G.jsx)(Z,{id:r,type:`text`,value:t,onChange:e=>n(e.target.value),spellCheck:!1,className:`flex-1 font-mono text-xs`})]})}var ww=[{key:`background`,label:`Background`,pair:!1},{key:`foreground`,label:`Foreground`,pair:!1},{key:`primary`,label:`Primary`,pair:!0},{key:`secondary`,label:`Secondary`,pair:!0},{key:`muted`,label:`Muted`,pair:!0},{key:`accent`,label:`Accent`,pair:!0},{key:`destructive`,label:`Destructive`,pair:!0},{key:`card`,label:`Card`,pair:!0},{key:`popover`,label:`Popover`,pair:!0},{key:`border`,label:`Border`,pair:!1},{key:`input`,label:`Input`,pair:!1},{key:`ring`,label:`Ring`,pair:!1}];function Tw(e){return typeof e==`string`?e:e&&typeof e==`object`?e.DEFAULT:``}function Ew(e){return e&&typeof e==`object`&&e.foreground?e.foreground:null}function Dw({theme:e,scheme:t=`light`,only:n}){let r=q(e=>e.themeName),i=t===`dark`,a=$c(e,i),o=i?`colorsDark`:`colors`;return(0,G.jsx)(`div`,{className:`flex flex-col gap-3`,children:ww.filter(e=>!n||n.has(e.key)).map(t=>{let n=a[t.key],s=Tw(n);if(!s)return null;let c=Ew(n),l=t.pair&&typeof n==`object`,u=i&&l&&typeof e.colorsDark?.[t.key]!=`object`,d=e=>u?n=>Nd.setTokens(r,[{path:`${o}.${t.key}.DEFAULT`,value:e===`DEFAULT`?n:s},...e===`foreground`||c?[{path:`${o}.${t.key}.foreground`,value:e===`foreground`?n:c}]:[]]):void 0;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(xw,{label:t.label,tokenPath:l?`${o}.${t.key}.DEFAULT`:`${o}.${t.key}`,value:s,write:d(`DEFAULT`)}),l&&c?(0,G.jsx)(`div`,{className:`pl-9`,children:(0,G.jsx)(xw,{label:`${t.label} fg`,tokenPath:`${o}.${t.key}.foreground`,value:c,write:d(`foreground`)})}):null]},t.key)})})}function Ow(){let[e,t]=(0,P.useState)(``),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(null),o=q(e=>e.themeName),s=q(e=>Tw(e.theme?.colors.primary));return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(yw,{id:`theme-seed`,label:`derive palette from color`,value:e,onChange:t,fallback:s,placeholder:`#7c3aed or oklch(...)`,children:(0,G.jsx)(J,{variant:`outline`,size:`sm`,onClick:async()=>{if(e.trim()){r(!0),a(null);try{await Nd.deriveFromColor(o,e.trim()),a(`palette derived from ${e.trim()}`)}catch(e){a(`derive failed: ${e.message}`)}finally{r(!1)}}},disabled:n||!e.trim(),children:n?`…`:`Apply`})}),i?(0,G.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:i}):null]})}function kw(e,t){let n=t===void 0?void 0:String(t),r=[[`—`,`—`],...e];return n!==void 0&&!e.some(([e])=>e===n)&&r.push([n,n]),r}function Aw({title:e,defaultOpen:t=!0,children:n}){let[r,i]=(0,P.useState)(t);return(0,G.jsxs)(`section`,{className:`border-b last:border-b-0`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`w-full flex items-center justify-between px-3 py-2.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground hover:text-foreground`,children:[e,(0,G.jsx)(gn,{className:`size-3 transition-transform ${r?``:`-rotate-90`}`})]}),r?(0,G.jsx)(`div`,{className:`px-3 pb-3 flex flex-col gap-2.5`,children:n}):null]})}function $({label:e,children:t}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 min-h-7`,children:[(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0`,children:e}),t]})}function jw({value:e,onChange:t,options:n,className:r}){return(0,G.jsx)(rv,{type:`single`,size:`sm`,value:e??``,onValueChange:e=>t(e||void 0),className:r,children:n.map(e=>(0,G.jsx)(iv,{value:e.value,title:e.title??e.label??e.value,className:`h-7 min-w-7 px-2 text-[11px]`,children:e.icon??e.label??e.value},e.value))})}function Mw({value:e,onChange:t,unit:n,units:r,onUnitChange:i,placeholder:a,className:o}){return(0,G.jsxs)(`div`,{className:`inline-flex items-center h-7 rounded-md border border-input bg-background overflow-hidden ${o??`w-20`}`,children:[(0,G.jsx)(`input`,{value:e,placeholder:a,spellCheck:!1,onChange:e=>t(e.target.value),className:`min-w-0 flex-1 bg-transparent px-2 text-xs tabular-nums outline-none`}),r&&i?(0,G.jsx)(`select`,{value:n??r[0],onChange:e=>i(e.target.value),className:`self-stretch border-l border-input bg-muted/50 px-1 text-[10px] text-muted-foreground outline-none`,children:r.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))}):n?(0,G.jsx)(`span`,{className:`self-stretch flex items-center border-l border-input px-1.5 text-[10px] text-muted-foreground`,children:n}):null]})}function Nw({value:e,onChange:t,options:n,className:r,label:i}){return(0,G.jsx)(`select`,{value:e,"aria-label":i,onChange:e=>t(e.target.value),className:`h-7 rounded-md border border-input bg-background px-2 text-xs text-foreground outline-none ${r??`min-w-[7rem]`}`,children:n.map(([e,t])=>(0,G.jsx)(`option`,{value:e,children:t??e},e))})}function Pw(e){let t=/^\[(.+)\]$/.exec(e)?.[1]??e;return/^#([0-9a-f]{3,8})$/i.test(t)||/^(rgb|hsl|oklch|var)\(/i.test(t)?t:null}function Fw({value:e,onChange:t,placeholder:n}){let r=Pw(e);return(0,G.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-1.5 h-7 pl-1.5 pr-2 rounded-md border border-input bg-background`,children:[(0,G.jsx)(`span`,{className:`size-4 shrink-0 rounded-[3px] border border-border bg-[repeating-conic-gradient(#0000_0deg_90deg,#8884_90deg_180deg)]`,style:r?{background:r}:void 0}),(0,G.jsx)(`input`,{value:e,placeholder:n,spellCheck:!1,onChange:e=>t(e.target.value),className:`min-w-0 flex-1 bg-transparent text-xs outline-none`})]})}function Iw({code:e}){return(0,G.jsx)(`pre`,{className:`rounded-md border bg-muted/50 p-2.5 font-mono text-[10.5px] leading-[1.6] text-muted-foreground whitespace-pre-wrap break-words`,children:e})}function Lw({padding:e,margin:t,contentLabel:n,onPadding:r,onMargin:i}){let a=(e,t,n)=>(0,G.jsx)(`input`,{value:e,spellCheck:!1,onChange:e=>t(e.target.value),className:`w-9 rounded border border-transparent bg-transparent text-center text-[10px] tabular-nums text-foreground outline-none focus:border-ring hover:bg-background/60`},n);return(0,G.jsxs)(`div`,{className:`relative rounded-md border border-dashed bg-muted/40 px-2 pb-1 pt-4 text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:`absolute left-2 top-1 text-[8px] font-medium uppercase tracking-wide text-muted-foreground/80`,children:`margin`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:a(t.top,e=>i(`top`,e),`mt`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a(t.left,e=>i(`left`,e),`ml`),(0,G.jsxs)(`div`,{className:`relative flex-1 rounded border bg-accent/40 px-2 pb-1 pt-4`,children:[(0,G.jsx)(`span`,{className:`absolute left-1.5 top-0.5 text-[8px] font-medium uppercase tracking-wide text-muted-foreground/80`,children:`padding`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:a(e.top,e=>r(`top`,e),`pt`)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[a(e.left,e=>r(`left`,e),`pl`),(0,G.jsx)(`div`,{className:`flex h-9 flex-1 items-center justify-center rounded border bg-background text-[10px] text-muted-foreground`,children:n}),a(e.right,e=>r(`right`,e),`pr`)]}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:a(e.bottom,e=>r(`bottom`,e),`pb`)})]}),a(t.right,e=>i(`right`,e),`mr`)]}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:a(t.bottom,e=>i(`bottom`,e),`mb`)})]})}function Rw({placeholder:e,value:t,onChange:n,onSubmit:r}){return(0,G.jsx)(`input`,{value:t,placeholder:e,spellCheck:!1,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&r()},className:`h-7 w-full rounded-md border border-dashed border-input bg-background px-2 text-[11px] text-foreground outline-none placeholder:text-muted-foreground focus:border-ring`})}var zw=[`h1`,`h3`,`body`,`caption`],Bw=26;function Vw({scale:e,rootPx:t}){let n=Math.max(...zw.map(t=>e[t].fontSize)),r=Math.min(1,Bw/n);return(0,G.jsxs)(`div`,{className:`rounded-md border bg-background px-2.5 py-2`,children:[(0,G.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Resolved ladder`}),(0,G.jsx)(`span`,{className:`ml-auto font-mono text-[10px] text-muted-foreground/70`,children:`at ${t}px base`})]}),zw.map((t,n)=>{let i=e[t];return(0,G.jsxs)(`div`,{className:`flex items-baseline gap-3 py-1.5${n===zw.length-1?``:` border-b`}`,children:[(0,G.jsx)(`span`,{className:`w-12 shrink-0 font-mono text-[10px] text-muted-foreground`,children:t}),(0,G.jsx)(`span`,{className:`truncate text-foreground`,style:{fontSize:i.fontSize*r,lineHeight:1,letterSpacing:i.letterSpacing,fontWeight:i.fontWeight,...i.fontFamily?{fontFamily:i.fontFamily}:{}},children:`Aa`}),(0,G.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/80`,children:`${i.fontSize} / ${i.lineHeight.toFixed(2)}`})]},t)})]})}function Hw({label:e,value:t,min:n,max:r,step:i,display:a,authored:o,onClear:s,hint:c,onPreview:l,onCommit:u}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 self-center rounded-full `+(o?`bg-primary`:`border border-muted-foreground/40`)}),(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),o?null:(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-muted-foreground/60`,children:`inherited`}),o&&s?(0,G.jsx)(`button`,{type:`button`,onClick:s,title:`Clear ${e} — inherit it from the default typeset again`,"aria-label":`Clear ${e}`,className:`ml-auto text-muted-foreground/60 hover:text-foreground cursor-pointer`,children:(0,G.jsx)(wa,{size:11})}):null,(0,G.jsx)(`span`,{className:(o&&s?``:`ml-auto `)+`font-mono text-xs tabular-nums `+(o?`text-foreground`:`text-muted-foreground/60`),children:a})]}),(0,G.jsx)(pw,{"aria-label":e,tone:o?`primary`:`muted`,value:[t],min:n,max:r,step:i,onValueChange:([e])=>l(e),onValueCommit:([e])=>u(e)}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80`,children:c})]})}function Uw({names:e,selected:t,onSelect:n,onAdd:r,onRename:i,onRemove:a}){let[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(!1),f=t===dl,p=()=>{l(``),s(`add`)},m=()=>{l(t),s(`rename`)},h=o===`rename`?e.filter(e=>e!==t):e,g=c.trim(),_=g.length>0&&fl(g)&&!h.includes(g),v=()=>{_&&(o===`add`?r(g):i(t,g),s(null))};return o?(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(Z,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v(),e.key===`Escape`&&s(null)},placeholder:o===`add`?`New preset name`:`Rename preset`,spellCheck:!1,className:`h-7 flex-1 text-xs font-mono`,"aria-label":o===`add`?`New preset name`:`Rename preset`}),(0,G.jsx)(`button`,{type:`button`,onClick:v,disabled:!_,"aria-label":`Confirm`,className:`size-7 shrink-0 grid place-items-center rounded-md border border-input bg-background text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,G.jsx)(I,{size:13})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>s(null),"aria-label":`Cancel`,className:`size-7 shrink-0 grid place-items-center rounded-md text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,G.jsx)(Ho,{size:13})})]}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80`,children:g.length>0&&!_?h.includes(g)?`"${g}" already exists`:`Letters, digits, dash and underscore only — it becomes a class name`:`Becomes .typeset-${g||`name`}`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`div`,{className:`flex-1 min-w-0 flex items-center gap-0.5 p-0.5 rounded-md bg-muted overflow-x-auto`,children:e.map(e=>(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e),"aria-pressed":e===t,className:`flex-1 min-w-14 h-6 px-2 grid place-items-center rounded-[5px] text-[11px] truncate cursor-pointer `+(e===t?`bg-background font-medium text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,G.jsx)(`button`,{type:`button`,onClick:p,title:`New preset`,"aria-label":`New preset`,className:`size-7 shrink-0 grid place-items-center rounded-md border border-input bg-background text-muted-foreground hover:text-foreground cursor-pointer`,children:(0,G.jsx)(ua,{size:13})})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`font-mono text-[10px] text-muted-foreground/80 truncate`,children:f?`:root — styles every screen`:`.typeset-${t}`}),f?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{type:`button`,onClick:m,title:`Rename ${t}`,"aria-label":`Rename ${t}`,className:`ml-auto text-muted-foreground/60 hover:text-foreground cursor-pointer`,children:(0,G.jsx)(ia,{size:11})}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>d(!0),title:`Delete ${t}`,"aria-label":`Delete ${t}`,className:`text-muted-foreground/60 hover:text-destructive cursor-pointer`,children:(0,G.jsx)(L,{size:11})})]})]})]}),(0,G.jsx)(Dg,{open:u,onOpenChange:d,children:(0,G.jsxs)(Ag,{children:[(0,G.jsxs)(jg,{children:[(0,G.jsx)(Pg,{children:`Delete the "${t}" typeset`}),(0,G.jsx)(Fg,{children:`Any region still carrying .typeset-${t} keeps the class but falls back to the default typeset's rhythm.`})]}),(0,G.jsxs)(Mg,{children:[(0,G.jsx)(Lg,{children:`Cancel`}),(0,G.jsx)(Ig,{variant:`destructive`,onClick:()=>{d(!1),a(t)},children:`Delete`})]})]})})]})}var Ww={min:12,max:24,step:.5},Gw={min:1,max:2.2,step:.05},Kw={min:.4,max:2.5,step:.05},qw=`__none`,Jw=[{field:`fontBody`,label:`Body`},{field:`fontHeading`,label:`Heading`},{field:`fontMono`,label:`Mono`}];function Yw(e){return[dl,...Object.keys(e).filter(e=>e!==dl).sort()]}function Xw({theme:e,baselineOnly:t=!1}){let n=e.typography.typesets??{},r=Yw(n),[i,a]=(0,P.useState)(dl),o=q(e=>e.setTypesetDraft),s=q(e=>e.typesetDraft),c=q(e=>e.refreshTheme),l=q(e=>e.themeName),u=r.includes(i)?i:dl;(0,P.useEffect)(()=>()=>o(null),[o]);let d=n[u]??{},f=s?.name===u?s.typeset:d,p=u===dl,m=n.default??{},h=Sl(p?f:{...m,...f}),g=Object.keys(e.typography.fontFamily??{}).sort(),_=Tl(h.size),v=El(h,{fontFamily:e.typography.fontFamily??{}}),y=e=>{o({name:u,typeset:{...f,...e}})},b=(e,t)=>{Nd.setTypeset(l,[e]).then(()=>t?.()).catch(e=>{H(e,`Could not update the typeset`),c()})},x=e=>b({name:u,...e});return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[t?null:(0,G.jsx)(Uw,{names:r,selected:u,onSelect:e=>{o(null),a(e)},onAdd:e=>b({name:e},()=>a(e)),onRename:(e,t)=>b({name:e,renameTo:t},()=>a(t)),onRemove:e=>b({name:e,remove:!0},()=>a(dl))}),(0,G.jsx)(Hw,{label:`Size`,value:_,...Ww,display:f.size===void 0?String(h.size):Qw(f.size),authored:f.size!==void 0,onClear:f.size===void 0?void 0:()=>x({size:null}),hint:f.size===void 0?`1em follows the container — drag to pin it`:`pinned; clear to follow the container again`,onPreview:e=>y({size:`${e}px`}),onCommit:e=>x({size:`${e}px`})}),(0,G.jsx)(Hw,{label:`Leading`,value:h.leading,...Gw,display:h.leading.toFixed(2),authored:f.leading!==void 0,onClear:f.leading===void 0?void 0:()=>x({leading:null}),hint:`body line-height — the whole ladder scales with it`,onPreview:e=>y({leading:e}),onCommit:e=>x({leading:e})}),(0,G.jsx)(Hw,{label:`Flow`,value:Tl(h.flow)/16,...Kw,display:Qw(h.flow),authored:f.flow!==void 0,onClear:f.flow===void 0?void 0:()=>x({flow:null}),hint:`space between blocks, and the air above a heading`,onPreview:e=>y({flow:`${$w(e)}em`}),onCommit:e=>x({flow:`${$w(e)}em`})}),(0,G.jsx)(B_,{}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Jw.map(({field:e,label:t})=>(0,G.jsx)(Zw,{label:t,roles:g,value:f[e],inherited:p?void 0:m[e],onChange:t=>x({[e]:t})},e)),(0,G.jsx)(`p`,{className:`text-[10px] leading-relaxed text-muted-foreground/80`,children:`Roles, not stacks — they point at the fonts you declared, so swapping a face updates every typeset that names it.`})]}),(0,G.jsx)(B_,{}),(0,G.jsx)(Vw,{scale:v,rootPx:_})]})}function Zw({label:e,roles:t,value:n,inherited:r,onChange:i}){return(0,G.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full `+(n===void 0?`border border-muted-foreground/40`:`bg-primary`)}),(0,G.jsx)(`span`,{className:`w-14 shrink-0 text-xs text-muted-foreground`,children:e}),(0,G.jsx)(Nw,{value:n??qw,onChange:e=>i(e===qw?null:e),options:[[qw,r?`${r} (inherited)`:`—`],...t.map(e=>[e,e])],className:`flex-1 min-w-0`})]})}function Qw(e){return typeof e==`number`?`${e}px`:e}function $w(e){return Math.round(e*100)/100}function eT({...e}){return(0,G.jsx)(Me,{"data-slot":`collapsible`,...e})}function tT({...e}){return(0,G.jsx)(ye,{"data-slot":`collapsible-trigger`,...e})}function nT({...e}){return(0,G.jsx)(_t,{"data-slot":`collapsible-content`,...e})}var rT={"shadcn-upstream":`shadcn`,mui:`Material UI`,antd:`Ant Design`,chakra:`Chakra UI`,none:`No library`,html:`HTML + htmx`};function iT(e){return rT[e]??e}function aT(e){return/^\d{4}\./.test(e)?`snapshot ${e}`:`v${e}`}function oT(e,t){switch(e){case`in-repo`:return{text:`your repo`,title:`Components render from your app. Velloo's bundled snapshot (${t}) covers only the files it can't compile.`};case`binary`:return{text:`bundled`,title:`Components ship inside the velloo binary.`};case`cache`:return{text:`cached`,title:`Components were downloaded into ~/.velloo.`};default:return{text:e}}}function sT(e){return e.source!==`in-repo`}function cT(e,t){if(!t)return!0;let n=e.id.toLowerCase();return n!=="default"&&n!==e.providerId.toLowerCase()&&n!==iT(e.providerId).toLowerCase()}function lT(e){return[...e.libraries].sort((t,n)=>Number(n.id===e.defaultLibrary)-Number(t.id===e.defaultLibrary))}function uT(e){return new Set(e.map(e=>e.styleLabel)).size>1}function dT(e){return e.libraries.find(t=>t.id===e.defaultLibrary)?.styleLabel??(e.styling===`none`?`Inline styles`:`Tailwind classes`)}function fT(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function pT({theme:e,scheme:t,onSchemeChange:n}){let r=q(e=>e.themeName),i=q(e=>e.frameworkRoles),a=q(e=>iT(e.design?.providerId??``)),[o,s]=(0,P.useState)(``),c=t===`dark`,l=i?new Set(i):null,u=l?new Set(ww.map(e=>e.key).filter(e=>!l.has(e))):null,d=tl(e),f=e.colors.primary,p=typeof f==`string`?f:f.DEFAULT,m=()=>{let e=fT(o);e!==``&&(s(``),Nd.setRole(r,{name:e,light:p,dark:p}).catch(e=>H(e,`Could not add the role`)))};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(rv,{type:`single`,variant:`outline`,size:`sm`,className:`w-full`,value:t,onValueChange:e=>{(e===`light`||e===`dark`)&&n(e)},children:[(0,G.jsx)(iv,{value:`light`,className:`flex-1 text-xs`,children:`Light`}),(0,G.jsx)(iv,{value:`dark`,className:`flex-1 text-xs`,children:`Dark`})]}),c&&!e.colorsDark?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This theme has no dark palette yet, so dark shows the light colours. Change one and it becomes the first dark colour — or pick a starting point above to get a whole palette.`}):null,l?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(G_,{children:[(0,G.jsxs)(q_,{children:[`Used by `,a,`'s components`]}),(0,G.jsx)(Dw,{theme:e,scheme:t,only:l})]}),u&&u.size>0?(0,G.jsxs)(G_,{children:[(0,G.jsx)(q_,{children:`For your own designs`}),(0,G.jsxs)(J_,{className:`text-xs`,children:[a,` has no place for these, but a design can still use them.`]}),(0,G.jsx)(Dw,{theme:e,scheme:t,only:u})]}):null]}):(0,G.jsx)(Dw,{theme:e,scheme:t}),(0,G.jsxs)(G_,{children:[(0,G.jsx)(q_,{htmlFor:`language-custom-role`,children:`Custom roles`}),d.map(t=>{let n=e.palette?.[t],i=(c?e.paletteDark?.[t]:n)??n??``;return(0,G.jsx)(xw,{label:t,tokenPath:`${c?`paletteDark`:`palette`}.${t}`,value:i,children:(0,G.jsx)(J,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove the ${t} role`,onClick:()=>void Nd.removeRole(r,t).catch(e=>H(e,`Could not remove the role`)),children:(0,G.jsx)(L,{})})},t)}),(0,G.jsxs)(Hg,{children:[(0,G.jsx)(qg,{id:`language-custom-role`,value:o,placeholder:d.length===0?`e.g. success, tertiary`:`Add another`,className:`text-xs`,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),m())}}),(0,G.jsx)(Wg,{align:`inline-end`,children:(0,G.jsx)(Kg,{size:`icon-xs`,"aria-label":`Add custom role`,disabled:fT(o)===``,onClick:m,children:(0,G.jsx)(ua,{})})})]}),(0,G.jsx)(J_,{className:`text-xs`,children:`A role of your own gets a light and a dark colour — switch above to set each. Designs use it by name; the library's components do not know it.`})]})]})}function mT(){let e=q(e=>e.themeName),t=q(e=>e.themeVersion),[n,r]=(0,P.useState)([]),[i,a]=(0,P.useState)(null);(0,P.useEffect)(()=>{let t=!0;return Nd.startingPoints(e).then(e=>{t&&(r(e.startingPoints),a(e.active))}).catch(()=>{}),()=>{t=!1}},[e,t]);let o=t=>{Nd.applyStartingPoint(e,t).catch(e=>H(e,`Could not apply the starting point`))};return n.length===0?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:n.map(e=>(0,G.jsx)(KC,{asChild:!0,size:`xs`,variant:`outline`,className:`cursor-pointer flex-nowrap text-left hover:bg-muted/50 aria-pressed:border-primary aria-pressed:bg-muted/50`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":i===e.id,title:e.note,onClick:()=>o(e.id),children:[(0,G.jsx)(JC,{children:(0,G.jsx)(`span`,{"aria-hidden":!0,className:`block size-8 border border-black/10`,style:{background:e.primary,borderRadius:e.radius}})}),(0,G.jsxs)(YC,{className:`min-w-0 gap-0`,children:[(0,G.jsx)(XC,{className:`text-xs`,children:e.name}),(0,G.jsx)(ZC,{className:`truncate text-[10px]`,children:e.note})]})]})},e.id))}),(0,G.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:`A place to begin, not a framework: each sets a colour, faces and corners, and derives the rest of the palette in light and dark. Change anything afterwards.`})]})}function hT(){let e=q(e=>e.themeName),t=q(e=>e.themeVersion),[n,r]=(0,P.useState)(0);return(0,P.useEffect)(()=>{let t=!0,n=e==="default"?``:`?name=${encodeURIComponent(e)}`;return fetch(`/api/theme/contrast${n}`).then(e=>e.ok?e.json():Promise.reject(Error(`${e.status}`))).then(e=>{t&&r(e.results.filter(e=>e.tier===`Fail`).length)}).catch(()=>{t&&r(0)}),()=>{t=!1}},[e,t]),n}function gT({theme:e,startFirst:t=!1,scheme:n,onSchemeChange:r}){let i=q(e=>e.themeVersion),a=hT();return(0,G.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(V_,{children:[(0,G.jsx)(H_,{variant:`label`,children:`Start from a direction`}),(0,G.jsx)(mT,{})]}),(0,G.jsxs)(V_,{children:[(0,G.jsx)(H_,{variant:`label`,children:`Or from one colour`}),(0,G.jsx)(Ow,{})]})]}):null,(0,G.jsxs)(V_,{children:[(0,G.jsx)(H_,{variant:`label`,children:`Roles`}),(0,G.jsx)(pT,{theme:e,scheme:n,onSchemeChange:r})]}),t?null:(0,G.jsxs)(eT,{children:[(0,G.jsx)(tT,{asChild:!0,children:(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,className:`group w-full justify-start`,children:[`Start over from a direction or a colour`,(0,G.jsx)(gn,{className:`ml-auto transition-transform group-data-[state=open]:rotate-180`})]})}),(0,G.jsxs)(nT,{className:`flex flex-col gap-4 pt-2`,children:[(0,G.jsx)(mT,{}),(0,G.jsx)(Ow,{})]})]}),(0,G.jsxs)(eT,{children:[(0,G.jsx)(tT,{asChild:!0,children:(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,className:`group w-full justify-start`,children:[`Contrast`,(0,G.jsx)(`span`,{className:a>0?`text-xs text-destructive`:`text-xs text-muted-foreground`,children:a>0?`${a} failing`:`all pairs pass`}),(0,G.jsx)(gn,{className:`ml-auto transition-transform group-data-[state=open]:rotate-180`})]})}),(0,G.jsx)(nT,{className:`pt-2`,children:(0,G.jsx)(vw,{bumpKey:i})})]})]})}function _T({theme:e,onBrowse:t,baselineOnly:n=!1}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,G.jsxs)(V_,{children:[(0,G.jsx)(H_,{variant:`label`,children:`Faces`}),(0,G.jsx)(VC,{theme:e,onBrowse:t})]}),(0,G.jsxs)(V_,{children:[(0,G.jsx)(H_,{variant:`label`,children:`Rhythm`}),(0,G.jsx)(Xw,{theme:e,baselineOnly:n})]})]})}var vT=[{id:`colour`,label:`Colour`,icon:Pi,ask:`Pick a direction or a colour of your own to start from, then change any role.`},{id:`type`,label:`Type`,icon:wo,ask:`Choose the faces and the rhythm. The specimen's ladder follows as you go.`},{id:`shape`,label:`Shape`,icon:eo,ask:`How round the corners are, everywhere.`},{id:`rules`,label:`Rules`,icon:Wr,ask:`A few rules in plain words. Optional — but they are what your agent and reviews are held to.`}];function yT(e,t){let n=e.typography.fontFamily?.[t??`sans`];return n?zC(n):`System`}async function bT(){try{await navigator.clipboard.writeText(yC),V({kind:`success`,message:`Prompt copied — paste it to your coding agent.`})}catch{V({kind:`info`,message:`Copy failed — ask your agent to propose a design language.`})}}function xT(){let e=q(e=>e.theme),t=q(e=>e.themeName),n=q(e=>e.languageRules),r=q(e=>e.languageMode),i=q(e=>e.languageBaseline),a=q(e=>e.languageThemeIsNew),o=q(e=>e.folderConfig?.themes.length??1),s=q(e=>e.design?.folderId),c=q(e=>e.refreshTheme),l=q(e=>e.finishLanguage),u=q(e=>e.cancelLanguage),d=q(e=>e.wsConnected),f=q(e=>e.languageScheme),p=q(e=>e.setLanguageScheme),[m,h]=(0,P.useState)(`colour`),[g,_]=(0,P.useState)(0),[v,y]=(0,P.useState)(!1),[b,x]=(0,P.useState)(null),S=hT();if(!e||!n||!i)return(0,G.jsx)(`aside`,{className:`w-[360px] shrink-0 border-r bg-card grid place-items-center`,children:(0,G.jsx)(py,{size:24,label:`Opening the design language…`,className:`flex-col`})});if(b!==null){let n=e.typography.fontFamily?.[b];return(0,G.jsx)(`aside`,{className:`w-[360px] shrink-0 border-r bg-card flex flex-col min-h-0`,children:(0,G.jsx)(FC,{role:b,current:n?zC(n):void 0,onBack:()=>x(null),onPick:e=>{x(null),Nd.setFonts(t,[HC(b,e)]).catch(e=>{H(e,`Could not set the face`),c()})}})})}let C=JSON.stringify(e)!==JSON.stringify(i.theme)||n.intent!==i.rules.intent||JSON.stringify(n.rules)!==JSON.stringify(i.rules.rules),w=()=>{t==="default"&&SC(s),l().catch(e=>H(e,`Could not close`))},T=()=>{y(!1),u().catch(e=>H(e,`Could not undo the changes`))},E=vT.findIndex(e=>e.id===m),D=vT[E]??vT[0],O=vT[E+1],k=e=>{let t=vT[e];t&&(h(t.id),_(t=>Math.max(t,e)))},A=e.typography.typesets?.default,j=lw(e.radius.md??e.radius.lg??e.radius.sm),M=n.rules.filter(e=>e.kind===`do`).length,ee={colour:S>0?`${S} text ${S===1?`pair fails`:`pairs fail`} contrast`:`Every text pair passes contrast`,type:`${yT(e,A?.fontHeading??A?.fontBody)} · ${yT(e,A?.fontBody)}`,shape:j===null?`Custom radius`:`${fw(j)} · ${j}px corners`,rules:n.rules.length===0?`None stated`:`${M} do · ${n.rules.length-M} don't`};return(0,G.jsxs)(`aside`,{"data-language-stage":r,className:`w-[360px] shrink-0 border-r bg-card flex flex-col min-h-0`,inert:!d,children:[(0,G.jsxs)(`header`,{className:`flex items-start gap-2.5 border-b p-3`,children:[(0,G.jsx)(`div`,{className:`size-8 grid place-items-center rounded-lg bg-primary/10 text-primary shrink-0`,children:(0,G.jsx)(po,{className:`size-4`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm font-medium`,children:`Design language`}),t!=="default"||o>1?(0,G.jsx)(K,{variant:`secondary`,className:`my-0.5 max-w-full`,"data-language-theme":t,children:(0,G.jsx)(`span`,{className:`truncate`,children:kC(t)})}):null,(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:a?`A new theme. Done puts this board on it; Cancel discards it.`:t==="default"&&o<=1?`Changes show at once, on every board. Cancel puts them back.`:`Changes show at once, on the boards that use this theme. Cancel puts them back.`})]}),(0,G.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>{C?y(!0):a?T():l()},children:`Cancel`}),r===`review`?(0,G.jsx)(J,{size:`sm`,onClick:w,children:`Done`}):null]}),r===`guided`?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-b p-3`,children:[(0,G.jsx)($x,{value:m,onValueChange:e=>h(e),children:(0,G.jsx)(tS,{className:`h-8 w-full`,children:vT.map((e,t)=>(0,G.jsx)(nS,{value:e.id,disabled:t>g,className:`text-xs`,children:e.label},e.id))})}),(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[(0,G.jsxs)(`span`,{className:`font-medium text-foreground`,children:[`Step `,E+1,` of `,vT.length,`.`]}),` `,D?.ask]})]}):(0,G.jsx)(`nav`,{"aria-label":`Design language`,className:`flex flex-col gap-0.5 border-b p-2`,children:vT.map(({id:e,label:t,icon:n})=>(0,G.jsx)(KC,{asChild:!0,size:`xs`,variant:m===e?`muted`:`default`,className:`cursor-pointer text-left hover:bg-muted/50`,children:(0,G.jsxs)(`button`,{type:`button`,"aria-current":m===e?`page`:void 0,onClick:()=>h(e),children:[(0,G.jsx)(JC,{children:(0,G.jsx)(n,{className:m===e?`size-4 text-primary`:`size-4 text-muted-foreground`})}),(0,G.jsxs)(YC,{className:`gap-0`,children:[(0,G.jsx)(XC,{className:`text-[13px]`,children:t}),(0,G.jsx)(ZC,{className:`text-[11px]`,children:ee[e]})]}),e===`colour`&&S>0?(0,G.jsx)(QC,{children:(0,G.jsx)(So,{className:`size-3.5 text-destructive`,"aria-label":`Needs attention`})}):null]})},e))}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto scroll-stable`,children:m===`colour`?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(gT,{theme:e,startFirst:r===`guided`,scheme:f,onSchemeChange:p})}):m===`type`?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(_T,{theme:e,onBrowse:x,baselineOnly:!0})}):m===`shape`?(0,G.jsx)(`div`,{className:`p-4`,children:(0,G.jsx)(hw,{theme:e})}):(0,G.jsxs)(G.Fragment,{children:[t==="default"&&o<=1?null:(0,G.jsx)(`p`,{className:`border-b bg-muted/40 px-4 py-2 text-xs text-muted-foreground`,children:`Rules belong to the whole design: every theme is held to the same ones.`}),(0,G.jsx)(ow,{state:n})]})}),r===`guided`?(0,G.jsxs)(`footer`,{className:`flex items-center justify-between gap-2 border-t p-2`,children:[(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,disabled:E===0,onClick:()=>k(E-1),children:[(0,G.jsx)(Wt,{}),`Back`]}),O?(0,G.jsxs)(J,{size:`sm`,onClick:()=>k(E+1),children:[`Next: `,O.label,(0,G.jsx)(Kt,{})]}):(0,G.jsx)(J,{size:`sm`,onClick:w,children:`Done`})]}):t==="default"?(0,G.jsx)(`footer`,{className:`flex items-center gap-2 border-t p-2`,children:(0,G.jsxs)(J,{variant:`ghost`,size:`xs`,onClick:()=>void bT(),children:[(0,G.jsx)(Wn,{}),`Copy a prompt to have your agent propose one`]})}):null,(0,G.jsx)(hv,{open:v,title:a?`Discard ${t}?`:`Discard these changes?`,description:a?`The new theme is removed, and the rules go back to how they were.`:`The theme and the rules go back to how they were when you opened the design language.`,confirmLabel:`Discard`,onConfirm:T,onCancel:()=>y(!1)})]})}var ST=1120,CT=320;function wT(){let e=q(e=>e.languageScheme),t=q(e=>e.setLanguageScheme),n=q(e=>!!e.theme?.colorsDark),r=q(e=>e.languageBaseline!==null),[i,a]=(0,P.useState)(!1),o=i?`both`:e;return(0,G.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 border-b bg-card px-4 py-2`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Specimen`}),(0,G.jsx)(`span`,{className:`min-w-0 truncate text-xs text-muted-foreground`,children:`This design's own components, drawn with the language as it stands. Read-only.`}),(0,G.jsxs)(rv,{type:`single`,variant:`outline`,size:`sm`,className:`ml-auto`,value:o,onValueChange:e=>{e===`both`?a(!0):(e===`light`||e===`dark`)&&(a(!1),t(e))},children:[(0,G.jsx)(iv,{value:`light`,className:`text-xs`,children:`Light`}),(0,G.jsx)(iv,{value:`dark`,className:`text-xs`,children:`Dark`}),(0,G.jsx)(iv,{value:`both`,className:`text-xs`,children:`Both`})]})]}),!n&&o!==`light`?(0,G.jsx)(`p`,{className:`border-b bg-muted/40 px-4 py-1.5 text-xs text-muted-foreground`,children:`This theme has no dark palette yet, so dark renders as light. A starting point or a seed colour gives it one.`}):null,(0,G.jsx)(`div`,{className:`flex-1 min-h-0 flex gap-4 overflow-x-auto p-4`,children:r?(i?[`light`,`dark`]:[e]).map(e=>(0,G.jsx)(TT,{scheme:e},e)):(0,G.jsx)(`div`,{className:`relative flex-1 rounded-md bg-white ring-1 ring-border`,style:{minWidth:CT},children:(0,G.jsx)(hy,{})})})]})}function TT({scheme:e}){let t=q(e=>e.themeVersion),n=cd(e,t,q(e=>e.languageTheme)),r=(0,P.useRef)(null),{srcs:i,front:a,painted:o,slotRefs:s,settleSlot:c}=Uv(n,r);cy({slotRefs:s,front:a,screenRev:t,hasScreen:!0,frontIsCurrent:i[a]===n});let l=(0,P.useRef)(null),[u,d]=(0,P.useState)({w:ST,h:800});(0,P.useEffect)(()=>{let e=l.current;if(!e)return;let t=()=>d({w:e.clientWidth,h:e.clientHeight});t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let f=Math.max(u.w,CT),p=Math.min(1,f/ST);return(0,G.jsxs)(`div`,{ref:l,"data-specimen":e,className:`relative flex-1 overflow-hidden rounded-md bg-white ring-1 ring-border`,style:{minWidth:CT},children:[[0,1].map(t=>i[t]===null?null:(0,G.jsx)(`iframe`,{ref:s[t],title:`Specimen, ${e}${t===a?``:` — loading`}`,src:i[t],"aria-hidden":t!==a||void 0,onLoad:()=>{let e=s[t].current?.contentWindow;e?.addEventListener(`scroll`,()=>{r.current={x:e.scrollX,y:e.scrollY}}),c(t)},className:`absolute left-0 top-0 origin-top-left border-0${t===a?``:` invisible`}`,style:{width:f/p,height:u.h/p,transform:p===1?void 0:`scale(${p})`}},t)),o?null:(0,G.jsx)(hy,{})]})}function ET({title:e,hint:t,icon:n,action:r,size:i=`page`}){let a=i===`panel`;return(0,G.jsxs)(Jm,{className:a?`flex-1 p-6`:`flex-1 p-12`,children:[(0,G.jsxs)(Ym,{children:[n?(0,G.jsx)(Zm,{variant:`icon`,children:(0,G.jsx)(n,{})}):null,(0,G.jsx)(Qm,{className:a?`text-xs`:`text-base`,children:e}),t?(0,G.jsx)($m,{className:a?`text-xs`:void 0,children:t}):null]}),r?(0,G.jsx)(eh,{children:r}):null]})}function DT(e,t){return z(`/api/preflight?${new URLSearchParams({kind:e,id:t})}`,`preflightExportTarget`).then(e=>e.failures)}function OT(e){return z(`/api/preflight?${new URLSearchParams(e.length>0?{boards:e.join(`,`)}:{})}`,`preflightBoards`).then(e=>e.failures)}function kT(e){return e.componentId===null?`${e.screenName}: ${e.reason}`:`${e.screenName} — ${e.componentId}: ${e.reason}`}function AT({failures:e,verb:t,onCancel:n,onConfirm:r}){let i=e?.length??0,a=new Set(e?.map(e=>e.screenId)).size;return(0,G.jsx)(Dg,{open:e!==null,onOpenChange:e=>!e&&n(),children:(0,G.jsxs)(Ag,{children:[(0,G.jsxs)(jg,{children:[(0,G.jsxs)(Pg,{children:[i===1?`A component`:`${i} components`,` failed to render`]}),(0,G.jsxs)(Fg,{children:[`On `,a===1?`1 screen`:`${a} screens`,`. Each one appears as a placeholder box in the output, not as the component — whoever opens it will see the error, not the design.`]})]}),(0,G.jsx)(`ul`,{className:`max-h-48 overflow-y-auto scroll-stable rounded-md border bg-muted/30 p-2 text-xs font-mono`,children:e?.map(e=>(0,G.jsx)(`li`,{className:`py-0.5`,children:kT(e)},`${e.screenId}:${e.componentId}`))}),(0,G.jsxs)(Mg,{children:[(0,G.jsx)(Lg,{children:`Cancel`}),(0,G.jsxs)(Ig,{onClick:r,children:[t,` anyway`]})]})]})})}function jT(){let e=q(e=>e.exportTarget),t=q(e=>e.setExportTarget),[n,r]=(0,P.useState)(`png`),[i,a]=(0,P.useState)(`light`),[o,s]=(0,P.useState)(`1`),[c,l]=(0,P.useState)(!1),[u,d]=(0,P.useState)(null);(0,P.useEffect)(()=>{e&&(r(`png`),a(`light`),s(`1`),l(!1),d(null))},[e]);let f=e?.kind===`frame`&&n===`png`,p=i===`compare`&&!f?`light`:i,m=async()=>{if(e)try{let r=await ud({kind:e.kind,id:e.id,format:n,mode:p,...n===`png`?{scale:Number(o)}:{}});for(let e of r)V({kind:`info`,message:e});t(null)}catch(e){H(e,`Export failed`),l(!1)}},h=async()=>{if(!e||c)return;l(!0);let t=await DT(e.kind,e.id).catch(()=>[]);t.length>0?d(t):await m()};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(AT,{failures:u,verb:`Export`,onCancel:()=>{d(null),l(!1)},onConfirm:()=>{d(null),m()}}),(0,G.jsx)(fh,{open:e!==null,onOpenChange:e=>!e&&t(null),children:(0,G.jsxs)(hh,{className:`sm:max-w-sm`,children:[(0,G.jsxs)(gh,{children:[(0,G.jsxs)(vh,{children:[`Export `,e?.kind===`board`?`board`:`frame`]}),(0,G.jsx)(yh,{className:`truncate`,children:e?.name})]}),(0,G.jsxs)(`div`,{className:`grid gap-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`export-format`,children:`Format`}),(0,G.jsxs)(bh,{value:n,onValueChange:e=>{r(e),e!==`png`&&i===`compare`&&a(`light`)},children:[(0,G.jsx)(Sh,{id:`export-format`,children:(0,G.jsx)(xh,{})}),(0,G.jsxs)(Ch,{children:[(0,G.jsx)(X,{value:`png`,children:`PNG image`}),(0,G.jsx)(X,{value:`pdf`,children:e?.kind===`board`?`PDF deck (one frame per page)`:`PDF (single page)`}),(0,G.jsx)(X,{value:`html`,children:`Standalone HTML (self-contained)`})]})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`export-mode`,children:`Mode`}),(0,G.jsxs)(bh,{value:p,onValueChange:e=>a(e),children:[(0,G.jsx)(Sh,{id:`export-mode`,children:(0,G.jsx)(xh,{})}),(0,G.jsxs)(Ch,{children:[(0,G.jsx)(X,{value:`light`,children:`Light`}),(0,G.jsx)(X,{value:`dark`,children:`Dark`}),f?(0,G.jsx)(X,{value:`compare`,children:`Compare (light | dark)`}):null]})]})]}),n===`png`?(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`export-scale`,children:`Scale`}),(0,G.jsxs)(bh,{value:o,onValueChange:e=>s(e),children:[(0,G.jsx)(Sh,{id:`export-scale`,children:(0,G.jsx)(xh,{})}),(0,G.jsxs)(Ch,{children:[(0,G.jsx)(X,{value:`1`,children:`1× (CSS pixels)`}),(0,G.jsx)(X,{value:`2`,children:`2× (retina)`})]})]})]}):null]}),(0,G.jsxs)(_h,{children:[(0,G.jsx)(J,{variant:`outline`,onClick:()=>t(null),disabled:c,children:`Cancel`}),(0,G.jsxs)(J,{onClick:()=>void h(),disabled:c,children:[(0,G.jsx)(Jn,{}),c?`Exporting…`:`Export`]})]})]})})]})}function MT({className:e,...t}){return(0,G.jsx)(Jr,{"data-slot":`spinner`,role:`status`,"aria-label":`Loading`,className:W(`size-4 animate-spin`,e),...t})}function NT({className:e,size:t=`default`,...n}){return(0,G.jsx)(Re,{"data-slot":`switch`,"data-size":t,className:W(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,G.jsx)(nt,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var PT=6e3,FT={bug:`What happened, and what did you expect instead? Steps to reproduce help most.`,feedback:`What's working, what isn't, what you wish velloo did…`};function IT(){let e=q(e=>e.feedbackOpen),t=q(e=>e.setFeedbackOpen),n=q(e=>e.authStatus),r=q(e=>e.openSignIn),i=q(e=>e.signInPrompt),a=(0,P.useRef)(!1),[o,s]=(0,P.useState)(`bug`),[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(!0),[f,p]=(0,P.useState)(!1),m=(0,P.useId)(),h=(0,P.useId)();(0,P.useEffect)(()=>{e&&q.getState().refreshAuth()},[e]),(0,P.useEffect)(()=>{let{feedbackOpen:e,setFeedbackOpen:t}=q.getState();i&&e?(a.current=!0,t(!1)):!i&&a.current&&(a.current=!1,t(!0))},[i]);let g=!!n?.loggedIn&&n?.verified===!1,_=!!n?.loggedIn&&!g,v=n?.account?.email,y=c.trim(),b=_&&y.length>0&&!f,x=async()=>{if(b){p(!0);try{V({kind:`success`,message:await pd({kind:o,body:y,anonymous:u})}),l(``),t(!1)}catch(e){H(e,o===`bug`?`Could not send the bug report`:`Could not send feedback`)}finally{p(!1)}}};return(0,G.jsx)(fh,{open:e,onOpenChange:e=>!f&&t(e),children:(0,G.jsxs)(hh,{className:`sm:max-w-md`,"data-testid":`feedback-dialog`,children:[(0,G.jsxs)(gh,{children:[(0,G.jsx)(vh,{children:`Report a bug or send feedback`}),(0,G.jsx)(yh,{children:`Goes straight to the velloo team. Leave out anything confidential — nothing from your designs is attached.`})]}),_?null:(0,G.jsxs)(tw,{"data-testid":`feedback-sign-in`,children:[(0,G.jsx)(ei,{}),(0,G.jsx)(nw,{children:g?`Sign in again to send`:`Sign in to send`}),(0,G.jsxs)(rw,{children:[(0,G.jsx)(`p`,{children:`Feedback needs a velloo cloud account — even anonymous feedback, which is vouched for by your sign-in without naming you.`}),(0,G.jsx)(J,{size:`sm`,variant:`outline`,className:`mt-2`,onClick:()=>r({action:`send your feedback`,...g&&{expired:!0}}),children:g?`Sign in again…`:`Sign in to velloo cloud…`})]})]}),(0,G.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),x()},children:[(0,G.jsxs)(U_,{className:`gap-4`,children:[(0,G.jsxs)(rv,{type:`single`,variant:`outline`,size:`sm`,spacing:0,value:o,onValueChange:e=>e&&s(e),className:`w-full`,"aria-label":`What are you sending?`,children:[(0,G.jsxs)(iv,{value:`bug`,className:`flex-1`,"data-testid":`feedback-kind-bug`,children:[(0,G.jsx)(pn,{}),` Bug`]}),(0,G.jsxs)(iv,{value:`feedback`,className:`flex-1`,"data-testid":`feedback-kind-feedback`,children:[(0,G.jsx)(gi,{}),` Feedback`]})]}),(0,G.jsxs)(G_,{children:[(0,G.jsx)(q_,{htmlFor:m,className:`sr-only`,children:o===`bug`?`Describe the bug`:`Your feedback`}),(0,G.jsx)(Vg,{id:m,value:c,onChange:e=>l(e.target.value),maxLength:PT,placeholder:FT[o],className:`min-h-32`,autoFocus:!0}),(0,G.jsxs)(J_,{className:`text-right text-[11px] tabular-nums`,children:[c.length.toLocaleString(),` / `,PT.toLocaleString()]})]}),(0,G.jsxs)(G_,{orientation:`horizontal`,children:[(0,G.jsxs)(K_,{children:[(0,G.jsx)(q_,{htmlFor:h,children:`Send anonymously`}),(0,G.jsx)(J_,{"data-testid":`feedback-anonymous-help`,children:u?`Anonymous feedback can't be linked to your account, so we can't reply to it.`:`Sent from your account${v?` (${v})`:``}, so we can follow up with you.`})]}),(0,G.jsx)(NT,{id:h,checked:u,onCheckedChange:d,"data-testid":`feedback-anonymous`})]})]}),(0,G.jsxs)(_h,{children:[(0,G.jsx)(J,{type:`button`,variant:`outline`,disabled:f,onClick:()=>t(!1),children:`Cancel`}),(0,G.jsxs)(J,{type:`submit`,disabled:!b,"data-testid":`feedback-send`,children:[f?(0,G.jsx)(MT,{}):null,f?`Sending…`:`Send`]})]})]})]})})}var LT=10;function RT(e){if(!e)return`date unknown`;let t=Date.parse(e);if(!Number.isFinite(t))return`date unknown`;let n=Math.floor((Date.now()-t)/864e5);return n<=0?`today`:n===1?`yesterday`:n<30?`${n} days ago`:new Date(t).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function zT(e){if(!e)return null;try{return new URL(`/boards`,e).href}catch{return null}}function BT(e){return e.passwordProtected?{icon:Ha,text:`Password protected`}:e.visibility===`private`?{icon:Qr,text:e.onlyTeam?`Only ${e.onlyTeam}`:`Your organization`}:{icon:Xr,text:`Anyone with the link`}}function VT(){let e=q(e=>e.publishedBoardsOpen),t=q(e=>e.setPublishedBoardsOpen),n=q(e=>e.openGuests),r=zT(q(e=>e.authStatus?.appUrl)),[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1);(0,P.useEffect)(()=>{if(!e)return;a(null);let n=!1;return(async()=>{try{let e=await Sd.published();n||a(e)}catch(e){if(n)return;H(e,`Could not read your published boards`),t(!1)}})(),()=>{n=!0}},[e,t]);let u=async e=>{l(!0);try{await Sd.unpublish(e.slug),a(t=>t?.filter(t=>t.slug!==e.slug)??null),q.getState().refreshPublishSlots({force:!0}),V({kind:`success`,message:`Unpublished ${e.title||e.slug} — the link no longer resolves.`}),s(null)}catch(e){H(e,`Could not unpublish that board`)}finally{l(!1)}},d=i?.slice(0,LT)??[];return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(fh,{open:e,onOpenChange:e=>!e&&t(!1),children:(0,G.jsxs)(hh,{className:`sm:max-w-lg`,children:[(0,G.jsxs)(gh,{children:[(0,G.jsx)(vh,{children:`Published boards`}),(0,G.jsx)(yh,{children:`Live links on velloo-cloud, newest first. Taking one down stops it resolving and frees the board slot it holds.`})]}),i===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-muted-foreground`,children:[(0,G.jsx)(fy,{size:16}),`Reading velloo-cloud…`]}):d.length===0?(0,G.jsx)(ET,{size:`panel`,icon:or,title:`Nothing published yet`,hint:`Publish a board from its menu in the sidebar to get a share link.`}):(0,G.jsx)(`ul`,{className:`-mx-1 max-h-[22rem] overflow-y-auto px-1`,"data-testid":`published-boards-list`,children:d.map(e=>{let r=BT(e);return(0,G.jsx)(`li`,{children:(0,G.jsxs)(KC,{variant:`outline`,size:`sm`,className:`mb-1.5`,children:[(0,G.jsxs)(YC,{className:`min-w-0`,children:[(0,G.jsxs)(XC,{className:`max-w-full`,children:[(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`truncate text-inherit no-underline hover:underline`,children:e.title||e.slug}),(0,G.jsx)(Qn,{size:12,className:`shrink-0 text-muted-foreground`})]}),(0,G.jsxs)(ZC,{className:`flex items-center gap-1.5 text-xs`,children:[(0,G.jsx)(r.icon,{size:11,className:`shrink-0`}),r.text,` · `,RT(e.lastPublishedAt),e.guestCount?` · ${e.guestCount} guest${e.guestCount===1?``:`s`}`:``]})]}),(0,G.jsxs)(QC,{children:[(0,G.jsx)(J,{variant:`ghost`,size:`icon-sm`,disabled:!e.canManage,title:e.canManage?`Guests…`:`Only the board's publisher and admins can invite guests`,"aria-label":`Guests on ${e.title||e.slug}`,onClick:()=>{t(!1),n({slug:e.slug,title:e.title||e.slug})},children:(0,G.jsx)(Po,{})}),(0,G.jsx)(J,{variant:`ghost`,size:`icon-sm`,disabled:!e.canManage,title:e.canManage?`Unpublish this board`:`A teammate published this — only they can take it down`,"aria-label":`Unpublish ${e.title||e.slug}`,onClick:()=>s(e),children:(0,G.jsx)(L,{className:e.canManage?`text-destructive`:void 0})})]})]})},e.slug)})}),(0,G.jsxs)(_h,{className:`sm:justify-between`,children:[r?(0,G.jsx)(J,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,G.jsxs)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,"data-testid":`published-boards-all`,children:[(0,G.jsx)(Qn,{}),i&&i.length>d.length?`See all ${i.length} on velloo-cloud`:`More details on velloo-cloud`]})}):(0,G.jsx)(`span`,{}),(0,G.jsx)(J,{variant:`outline`,onClick:()=>t(!1),children:`Close`})]})]})}),(0,G.jsx)(Dg,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,G.jsxs)(Ag,{children:[(0,G.jsxs)(jg,{children:[(0,G.jsxs)(Pg,{children:[`Unpublish “`,o?.title||o?.slug,`”?`]}),(0,G.jsx)(Fg,{children:`The share link stops resolving for everyone who has it, along with any comments left on it. Your local boards and screens are untouched, and publishing again mints a new link.`})]}),(0,G.jsxs)(Mg,{children:[(0,G.jsx)(Lg,{disabled:c,children:`Keep it`}),(0,G.jsx)(Ig,{variant:`destructive`,disabled:c,onClick:e=>{e.preventDefault(),o&&u(o)},children:c?`Unpublishing…`:`Unpublish`})]})]})})]})}var HT=[{id:`comment-scope`,title:`Local or Cloud comments`,body:`**Local** comments stay on this machine, for you and your agent.
33
+ **Cloud** comments live on the published board, where reviewers read and answer them. Nobody else sees your board until you **publish** it.`,targets:[`[data-hint="comments"]`],anchor:`corner`,side:`bottom`,when:`comments`},{id:`panes`,title:`Agent, Design and Comments`,body:`**Agent** runs Claude Code, Codex or another agent here. Select something on the board and add it to your message, so “make this bigger” knows what you mean.
34
+ **Design** edits what you select, and **Theme** sets the colours and type of the whole design.
35
+ **Comments** lists every thread on this board.`,targets:[`[data-hint="panes"]`],anchor:`corner`,side:`bottom`},{id:`board`,title:`Your board`,body:`Each frame on the board is a screen of your design. Scroll to move around, and hold [[⌘]] or [[Ctrl]] while you scroll to **zoom**.`,targets:[`[data-hint="board"]`],anchor:`inset`,side:`right`},{id:`tools`,title:`Tools`,body:`[[V]] **Select** a layer to edit it.
36
+ [[H]] **Pan** around the board.
37
+ [[T]] Drop a **note** anywhere.
38
+ [[C]] **Comment** on the design: click the button or press [[C]], then click where it goes. Your agent can read comments and make the changes.`,targets:[`[data-hint="tools"]`],anchor:`corner`,side:`bottom`},{id:`library`,title:`Boards and library`,body:`Switch **boards** here, and see the **layers** of the screen you're on. **Library** has the components your designs are built from.`,targets:[`[data-hint="library"]`],anchor:`corner`,side:`bottom`},{id:`publish`,title:`Share a link`,body:`**Publish** puts this board on a share link with a free Velloo Cloud account.
39
+ Reviewers open it in their browser and comment for free, and their comments come back here for your agent.`,targets:[`[data-hint="publish"]`],anchor:`corner`,side:`bottom`}],UT=2,WT=12,GT=28,KT=4;function qT(e,t=document){let n=t.defaultView,r=n?.innerWidth??0,i=n?.innerHeight??0;for(let n of e.targets){let e=t.querySelector(n);if(!e)continue;let a=e.getBoundingClientRect(),o=Math.min(a.right,r)-Math.max(a.left,0),s=Math.min(a.bottom,i)-Math.max(a.top,0);if(o>=WT&&s>=WT)return e}return null}function JT(e,t,n=document){let r=[];for(let i of HT){if(r.length===UT)break;if(e.includes(i.id)||i.when&&!t[i.when])continue;let a=qT(i,n);if(!a)continue;let o=a.getBoundingClientRect();r.push(i.anchor===`inset`?{hint:i,x:Math.round(o.left+GT),y:Math.round(o.top+GT)}:{hint:i,x:Math.round(o.right-KT),y:Math.round(o.top+KT)})}return r}function YT(e,t){let n=new URLSearchParams(e).get(`hints`);return n===`0`||n===`off`?`never`:n===`1`||n===`on`?`all`:t?`never`:`unseen`}var XT=`velloo:hintsSeen`;function ZT(){try{let e=JSON.parse(localStorage.getItem(XT)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function QT(e){try{localStorage.setItem(XT,JSON.stringify(e))}catch{}}async function $T(){let e=ZT();try{return[...new Set([...(await yd()).hintsSeen,...e])]}catch{return e}}async function eE(e){QT([...new Set([...ZT(),...e])]);try{await bd({dismissHints:e})}catch{}}async function tE(){QT([]);try{await bd({resetHints:!0})}catch{}}var nE=9e5,rE=`velloo:update-toasted`,iE=new Set;function aE(){for(let e of iE)e()}function oE(e){return iE.add(e),()=>iE.delete(e)}var sE={status:null,upgrading:!1};function cE(e){sE={...sE,...e},aE()}function lE(){return(0,P.useSyncExternalStore)(oE,()=>sE)}async function uE(e={}){try{cE({status:await Pd(e)})}catch{}}function dE(e){if(!e)return``;let t=/^(\S+)\s*\((?:.*·\s*)?(.+)\)$/.exec(e);return t?`${t[1]} · ${t[2]}`:e}function fE(e){if(e.available&&e.latest&&e.upgradable){try{if(localStorage.getItem(rE)===e.latest)return;localStorage.setItem(rE,e.latest)}catch{}V({kind:`info`,title:`Velloo ${dE(e.latest)} is available`,message:`You're on ${dE(e.current)}.`,ttl:1e4,action:{label:`Upgrade`,onClick:()=>void hE()}})}}var pE=!1;function mE(){if(pE)return;pE=!0;let e=async e=>{await uE(e?{refresh:!0}:{}),sE.status&&fE(sE.status)};(async()=>{await e(!1),await e(!0)})(),setInterval(()=>void e(!0),nE)}async function hE(){if(sE.upgrading)return;cE({upgrading:!0});let e=V({kind:`info`,message:`Upgrading velloo…`,ttl:6e4});try{let e=await Fd();e.upgraded?V({kind:`success`,title:`Upgraded to ${e.to}`,message:"Quit the canvas and run `velloo upgrade` to finish — it migrates this folder.",ttl:15e3}):V({kind:`success`,message:`Velloo ${e.to} is already installed.`}),await uE({refresh:!0})}catch(e){H(e,`Could not upgrade velloo.`)}finally{Id(e),cE({upgrading:!1})}}function gE({className:e,size:t=`default`,...n}){return(0,G.jsx)(ge,{"data-slot":`avatar`,"data-size":t,className:W(`group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten`,e),...n})}function _E({className:e,...t}){return(0,G.jsx)(M,{"data-slot":`avatar-fallback`,className:W(`flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs`,e),...t})}function vE(e){let t=e.name?.trim().split(/\s+/)[0];if(t)return t;let n=e.email??``;return n.split(`@`)[0]||n}function yE(e){let t=e.name?.trim().split(/\s+/).filter(Boolean)??[];return t.length>=2?`${t[0]?.[0]??``}${t[t.length-1]?.[0]??``}`.toUpperCase():(t[0]??e.email??``).slice(0,2).toUpperCase()}function bE({account:e,expired:t=!1,compact:n=!1,badge:r,className:i,...a}){return e?(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,className:W(`relative max-w-[12rem] gap-2 pl-1 pr-2.5 text-xs`,i),title:`${e.email??vE(e)} — account & settings`,...a,children:[(0,G.jsx)(gE,{"aria-hidden":`true`,className:`size-6`,children:(0,G.jsx)(_E,{className:`text-[10px] font-semibold `+(t?`bg-muted text-muted-foreground`:`bg-primary text-primary-foreground`),children:yE(e)})}),(0,G.jsx)(`span`,{className:n?`sr-only`:`truncate`,children:vE(e)}),r]}):(0,G.jsxs)(J,{variant:`outline`,size:`sm`,className:W(`relative max-w-[12rem] text-xs`,i),title:`Settings & account`,...a,children:[(0,G.jsx)(Ia,{}),(0,G.jsx)(`span`,{className:n?`sr-only`:`truncate`,children:`Settings`}),r]})}var xE={free:`Free`,team:`Team`,business:`Business`,enterprise:`Enterprise`};function SE(e){return xE[e]??e}function CE(e){return`$${(e/1e6).toFixed(2)}`}function wE(e){if(!e)return null;try{return new URL(`/billing`,e).href}catch{return null}}function TE(e){if(!e)return null;try{return new URL(`/home`,e).href}catch{return null}}function EE(e){if(!e)return`velloo-cloud`;try{return new URL(e).host}catch{return e}}function DE(){return(0,G.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`settings-update-dot`,className:`absolute -right-0.5 -top-0.5 size-2 rounded-full bg-primary ring-2 ring-background`})}function OE(){let e=q(e=>e.authStatus),t=q(e=>e.openSignIn),n=q(e=>e.setSettingsScope),r=q(e=>e.openLanguage),i=q(e=>e.setPublishedBoardsOpen),a=q(e=>e.setFeedbackOpen),o=q(e=>e.setHintsSeen),s=()=>{o([]),tE()},{status:c,upgrading:l}=lE(),u=!!(c?.available&&c.upgradable),d=()=>{q.getState().refreshAuth(),uE()};(0,P.useEffect)(d,[]);let f=e?.loggedIn??!1,p=e?.account,m=f&&e?.verified===!1,h=p?.tier?`${SE(p.tier)} plan`:null,g=p?.tier===`free`?wE(e?.appUrl):null,_=TE(e?.appUrl);return(0,G.jsxs)(yv,{onOpenChange:e=>e&&d(),children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(bE,{account:f&&p?p:null,expired:m,badge:u?(0,G.jsx)(DE,{}):null})}),(0,G.jsxs)(xv,{align:`end`,className:`w-64`,children:[(0,G.jsx)(Tv,{className:`font-normal`,children:f?(0,G.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsxs)(`span`,{className:`text-[11px] text-muted-foreground`,children:[`Signed in to `,EE(e?.cloudUrl)]}),(0,G.jsx)(`span`,{className:`truncate text-sm`,children:p?.name??p?.email??`Signed in`}),p?.name&&p.email?(0,G.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:p.email}):null,h?(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:h}):null]}):(0,G.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Not signed in`}),(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Sign in to publish boards and pull comments.`})]})}),m?(0,G.jsxs)(tw,{variant:`destructive`,className:`mb-1 gap-1.5 border-0 bg-transparent px-2 py-0`,children:[(0,G.jsx)(So,{size:12,className:`mt-px shrink-0`}),(0,G.jsx)(rw,{className:`text-[11px] text-destructive`,children:`This credential expired — sign in again.`})]}):null,f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ev,{}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-1.5 text-xs`,"data-testid":`settings-credits`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2 text-muted-foreground`,children:[(0,G.jsx)(Rn,{size:14,className:`shrink-0`}),`Credits`]}),typeof p?.creditMicros==`number`?(0,G.jsx)(`span`,{className:`font-medium tabular-nums`,children:CE(p.creditMicros)}):(0,G.jsx)(`span`,{className:`text-muted-foreground`,title:p?.creditMicros===null?`velloo-cloud couldn't read the balance just now.`:`This velloo-cloud doesn't report a credit balance.`,children:`—`})]}),g?(0,G.jsx)(Q,{asChild:!0,children:(0,G.jsxs)(`a`,{href:g,target:`_blank`,rel:`noreferrer`,className:`text-inherit no-underline`,"data-testid":`settings-upgrade`,children:[(0,G.jsx)(Ja,{className:`text-primary`}),`Upgrade plan`,(0,G.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:`Free`})]})}):null]}):null,(0,G.jsx)(Ev,{}),(0,G.jsxs)(Q,{onSelect:()=>n(`design`),children:[(0,G.jsx)(Wa,{}),`Settings…`]}),(0,G.jsxs)(Q,{onSelect:()=>void r(`review`).catch(e=>H(e,`Could not open the design language`)),children:[(0,G.jsx)(po,{}),`Design language`]}),f?(0,G.jsxs)(Q,{"data-testid":`settings-published-boards`,onSelect:()=>i(!0),children:[(0,G.jsx)(or,{}),`Published boards…`]}):null,f&&_?(0,G.jsx)(Q,{asChild:!0,children:(0,G.jsxs)(`a`,{href:_,target:`_blank`,rel:`noreferrer`,className:`text-inherit no-underline`,"data-testid":`settings-open-cloud`,children:[(0,G.jsx)(Qn,{}),`Open Velloo Cloud`]})}):null,u?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Q,{disabled:l,"data-testid":`settings-upgrade-velloo`,title:`You're on ${c?.current}`,onSelect:e=>{e.preventDefault(),hE()},children:[(0,G.jsx)(En,{className:`text-primary`}),l?`Updating velloo…`:`Update velloo`]}),(0,G.jsx)(`div`,{className:`truncate px-2 pb-1 pl-8 text-[11px] text-muted-foreground`,children:dE(c?.latest)})]}):null,(0,G.jsxs)(Q,{"data-testid":`settings-feedback`,onSelect:()=>a(!0),title:f&&!m?void 0:`Sending feedback needs a velloo cloud account — you can sign in from the dialog.`,children:[(0,G.jsx)(pn,{}),`Send feedback…`]}),(0,G.jsxs)(Q,{"data-testid":`settings-hints`,onSelect:s,children:[(0,G.jsx)(Bn,{}),`Show tips again`]}),(0,G.jsx)(Ev,{}),f&&!m?(0,G.jsxs)(Q,{onSelect:async()=>{try{await qu.logout(),await q.getState().refreshAuth(),V({kind:`success`,message:`Signed out of velloo-cloud.`})}catch(e){H(e,`Could not sign out.`)}},children:[(0,G.jsx)(ni,{}),`Log out`]}):(0,G.jsxs)(Q,{onSelect:()=>t(m?{expired:!0}:{}),children:[(0,G.jsx)(ei,{}),m?`Sign in again…`:`Sign in to velloo-cloud…`]})]})]})}var kE=e=>e.name||e.email||`this guest`;function AE(){let e=q(e=>e.guestsBoard),t=q(e=>e.openGuests),n=q(e=>ws(e.authStatus?.account?.tier)),r=q(e=>wE(e.authStatus?.appUrl)),[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(!1),[f,p]=(0,P.useState)(null),[m,h]=(0,P.useState)(null),g=e?.slug??null;(0,P.useEffect)(()=>{if(!g)return;a(null),s(``),l(``),p(null),h(null);let e=!1;return Sd.guests.list(g).then(t=>{e||a(t)}).catch(t=>{e||(H(t,`Could not read this board's guests`),a([]))}),()=>{e=!0}},[g]);let _=()=>t(null),v=e=>a(t=>[...(t??[]).filter(t=>t.id!==e.id),e]),y=(e,t)=>{v(e.guest),e.emailed||!e.guestUrl?(V({kind:`success`,message:t}),p(null)):p({who:kE(e.guest),url:e.guestUrl,note:`Email isn't available here${e.reason?` (${e.reason})`:``}, so send this link yourself.`})},b=async e=>{if(e.preventDefault(),g&&o.trim()){d(!0);try{let e=await Sd.guests.invite(g,{email:o.trim(),...c.trim()?{name:c.trim()}:{}});y(e,`Invited ${kE(e.guest)} — they'll get an email with their link.`),s(``),l(``)}catch(e){H(e,`Could not invite that guest`)}finally{d(!1)}}},x=async e=>{if(g)try{let t=await Sd.guests.resend(g,e.id);y(t,`Emailed ${kE(e)} a new link — the one they had stops working.`)}catch(e){H(e,`Could not resend that guest's link`)}},S=async e=>{if(g)try{let t=await Sd.guests.link(g,e.id);p({who:kE(e),url:t,note:`The link they had before no longer works.`}),await jE(t,`New guest link copied — the one they had before no longer works.`)}catch(e){H(e,`Could not make a new link for that guest`)}},C=async e=>{if(g){h(null);try{await Sd.guests.remove(g,e.id),a(t=>t?.filter(t=>t.id!==e.id)??null),f?.who===kE(e)&&p(null),V({kind:`success`,message:`${kE(e)} can no longer open this board.`})}catch(e){H(e,`Could not remove that guest`)}}};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(fh,{open:e!==null,onOpenChange:e=>!e&&_(),children:(0,G.jsxs)(hh,{className:`sm:max-w-md`,children:[(0,G.jsxs)(gh,{children:[(0,G.jsxs)(vh,{children:[`Guests on “`,e?.title,`”`]}),(0,G.jsx)(yh,{children:`People outside your organization who can open this board, and only this board, through a personal link. They don't need an account.`})]}),n?null:(0,G.jsxs)(tw,{role:`note`,"data-testid":`guests-upsell`,children:[(0,G.jsx)(Qr,{}),(0,G.jsx)(nw,{children:`Invite guests`}),(0,G.jsx)(rw,{className:`text-xs`,children:`Share a board with people outside your organization by email. Upgrade your plan to invite guests.`}),r&&(0,G.jsx)(iw,{children:(0,G.jsx)(J,{size:`xs`,variant:`secondary`,asChild:!0,children:(0,G.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,children:`Upgrade`})})})]}),(0,G.jsxs)(`form`,{className:`grid gap-2`,onSubmit:e=>void b(e),children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-2 sm:grid-cols-[3fr_2fr]`,children:[(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(Y,{htmlFor:`guest-email`,children:`Email`}),(0,G.jsx)(Z,{id:`guest-email`,type:`email`,autoComplete:`off`,placeholder:`name@company.com`,value:o,disabled:!n||u,onChange:e=>s(e.target.value)})]}),(0,G.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,G.jsx)(Y,{htmlFor:`guest-name`,children:`Name (optional)`}),(0,G.jsx)(Z,{id:`guest-name`,autoComplete:`off`,value:c,disabled:!n||u,onChange:e=>l(e.target.value)})]})]}),(0,G.jsxs)(J,{type:`submit`,size:`sm`,className:`justify-self-start`,disabled:!n||u||!o.trim(),children:[(0,G.jsx)(Ao,{}),u?`Inviting…`:`Invite`]})]}),f?(0,G.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border bg-muted/40 p-2`,"data-testid":`guest-handover`,children:[(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Link for `,f.who,`. `,f.note]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Z,{readOnly:!0,value:f.url,className:`font-mono text-xs`}),(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,title:`Copy link`,"aria-label":`Copy guest link`,onClick:()=>void jE(f.url,`Guest link copied.`),children:(0,G.jsx)(Wn,{})})]})]}):null,i===null?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-4 text-sm text-muted-foreground`,children:[(0,G.jsx)(fy,{size:16}),`Reading guests…`]}):i.length===0?(0,G.jsx)(ET,{size:`panel`,icon:Po,title:`No guests yet`,hint:`Invite someone by email and they'll get a link to this board.`}):(0,G.jsx)(`ul`,{className:`-mx-1 max-h-64 overflow-y-auto px-1`,"data-testid":`guests-list`,children:i.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(KC,{variant:`outline`,size:`sm`,className:`mb-1.5`,children:[(0,G.jsxs)(YC,{className:`min-w-0`,children:[(0,G.jsx)(XC,{className:`max-w-full truncate`,children:kE(e)}),(0,G.jsxs)(ZC,{className:`truncate text-xs`,children:[e.name&&e.email?`${e.email} · `:``,e.lastSeenAt?`Last opened ${RT(e.lastSeenAt)}`:`Not opened yet`]})]}),(0,G.jsx)(QC,{children:(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(J,{variant:`ghost`,size:`icon-sm`,"aria-label":`Actions for ${kE(e)}`,children:(0,G.jsx)(Xn,{})})}),(0,G.jsxs)(xv,{align:`end`,children:[(0,G.jsxs)(Q,{disabled:!n,onSelect:()=>void S(e),title:`Makes a new link — the one they had stops working`,children:[(0,G.jsx)(Hr,{}),`Copy a new link`]}),(0,G.jsxs)(Q,{disabled:!n,onSelect:()=>void x(e),title:`Emails a new link — the one they had stops working`,children:[(0,G.jsx)(ii,{}),`Email a new link`]}),(0,G.jsx)(Ev,{}),(0,G.jsxs)(Q,{variant:`destructive`,onSelect:()=>h(e),children:[(0,G.jsx)(L,{}),`Remove`]})]})]})})]})},e.id))}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`A new link, copied or emailed, replaces the one the guest had.`}),(0,G.jsx)(_h,{children:(0,G.jsx)(J,{variant:`outline`,onClick:_,children:`Done`})})]})}),(0,G.jsx)(hv,{open:m!==null,title:`Remove ${m?kE(m):`this guest`}?`,description:`Their link stops working right away. You can invite them again later.`,confirmLabel:`Remove`,onConfirm:()=>{m&&C(m)},onCancel:()=>h(null)})]})}async function jE(e,t){try{await navigator.clipboard.writeText(e),V({kind:`success`,message:t})}catch{}}function ME({className:e,...t}){return(0,G.jsx)(`kbd`,{"data-slot":`kbd`,className:W(`pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3`,e),...t})}function NE({className:e,...t}){return(0,G.jsx)(`kbd`,{"data-slot":`kbd-group`,className:W(`inline-flex items-center gap-1`,e),...t})}var PE=400;function FE(){let e=q(e=>e.design!==null),t=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(!e||t.current)return;t.current=!0;let n=YT(window.location.search,navigator.webdriver===!0);if(n!==`never`){if(n===`all`)return q.getState().setHintsSeen([]);$T().then(e=>q.getState().setHintsSeen(e))}},[e])}function IE(){let e=q(e=>e.hintsSeen),t=q(e=>e.view===`boards`);return e&&t?(0,G.jsx)(LE,{seen:e}):null}function LE({seen:e}){let t=RE(e,{comments:q(e=>e.rightTab===`comments`||e.pendingCommentAnchor!==null||e.commentThreads.length>0)});return(0,G.jsx)(G.Fragment,{children:t.map(e=>(0,G.jsx)(BE,{placed:e},e.hint.id))})}function RE(e,t){let[n,r]=(0,P.useState)(()=>JT(e,t)),{comments:i}=t;return(0,P.useEffect)(()=>{let t=null,n=()=>{let n=JT(e,{comments:i}),a=n.map(e=>`${e.hint.id}@${e.x},${e.y}`).join(` `);a!==t&&(t=a,r(n))};n();let a=setInterval(n,PE);return window.addEventListener(`resize`,n),()=>{clearInterval(a),window.removeEventListener(`resize`,n)}},[e,i]),n}function zE(e){let t=0;return e.split(/(\*\*[^*]+\*\*|\[\[[^\]]+\]\])/).map(e=>{let n=t;return t+=e.length,e.startsWith(`**`)?(0,G.jsx)(`strong`,{className:`font-semibold text-foreground`,children:e.slice(2,-2)},n):e.startsWith(`[[`)?(0,G.jsx)(ME,{className:`border border-border bg-background text-foreground shadow-xs`,children:e.slice(2,-2)},n):(0,G.jsx)(P.Fragment,{children:e},n)})}function BE({placed:e}){let{hint:t,x:n,y:r}=e,[i,a]=(0,P.useState)(!1),o=q(e=>e.setHintsSeen),s=e=>{let t=e.map(e=>e.id),n=q.getState().hintsSeen??[];o([...new Set([...n,...t])]),eE(t)};return(0,G.jsxs)(X_,{open:i,onOpenChange:a,children:[(0,G.jsx)(Z_,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-testid":`hint-${t.id}`,"aria-label":`Tip: ${t.title}`,className:`fixed z-40 flex size-5 -translate-x-1/2 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,style:{left:n,top:r},children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inline-flex size-3.5 rounded-full bg-hint opacity-60 motion-safe:animate-ping`}),(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`relative inline-flex size-2.5 rounded-full bg-hint ring-2 ring-background`})]})}),(0,G.jsxs)(Q_,{"data-testid":`hint-card`,side:t.side,align:`start`,sideOffset:8,collisionPadding:12,className:`z-50 w-80 gap-3 border-t-2 border-t-hint p-4`,onKeyDown:e=>e.stopPropagation(),children:[(0,G.jsxs)($_,{className:`gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[0.65rem] font-semibold tracking-wider text-hint uppercase`,children:`Tip`}),(0,G.jsx)(ev,{className:`text-sm`,children:t.title}),(0,G.jsx)(`div`,{"data-slot":`popover-description`,className:`flex flex-col gap-1.5 text-[0.8rem] leading-relaxed text-muted-foreground`,children:t.body.split(`
40
+ `).map(e=>(0,G.jsx)(`p`,{children:zE(e)},e))})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(J,{variant:`ghost`,size:`sm`,className:`mr-auto px-2 text-muted-foreground`,"data-testid":`hint-hide-all`,onClick:()=>s(HT),children:`Hide all tips`}),(0,G.jsx)(J,{size:`sm`,className:`bg-hint text-hint-foreground hover:bg-hint/90`,"data-testid":`hint-got-it`,onClick:()=>s([t]),children:`Got it`})]})]})]})}var VE=[{id:`actions`,label:`Actions`},{id:`forms`,label:`Forms & Inputs`},{id:`display`,label:`Display`},{id:`feedback`,label:`Feedback`},{id:`navigation`,label:`Navigation`},{id:`overlays`,label:`Overlays`},{id:`layout`,label:`Layout`},{id:`typography`,label:`Typography`},{id:`visuals`,label:`Visuals`},{id:`chat`,label:`Chat & AI`}];function HE(e){return VE.find(t=>t.id===e)?.label??`Components`}function UE(e){return e.family===void 0||e.family===e.id}var WE=`other`;function GE(e){if(!e||e.length===0)return[];let t=new Map;for(let n of e){if(!UE(n))continue;let e=n.group??WE;t.set(e,[...t.get(e)??[],n.id])}let n=[...VE.map(e=>e.id),WE];return[...t.entries()].sort(([e],[t])=>n.indexOf(e)-n.indexOf(t)).map(([e,t])=>({id:e,label:HE(e===WE?void 0:e),components:[...t].sort((e,t)=>e.localeCompare(t))}))}function KE(e,t){let n=e?.find(e=>e.id===t);return n?HE(n.group):null}function qE(e){return e.default===void 0?null:typeof e.default==`string`?`"${e.default}"`:typeof e.default==`number`||typeof e.default==`boolean`?String(e.default):`…`}var JE={exact:`border-emerald-500/40 text-emerald-700 dark:text-emerald-400`,adapted:`border-primary/40 text-primary`,"server-rendered":`border-primary/40 text-primary`,unstyled:`border-amber-500/40 text-amber-700 dark:text-amber-400`,proxy:`border-amber-500/40 text-amber-700 dark:text-amber-400`,unchecked:`border-muted-foreground/40 text-muted-foreground`,unavailable:`border-destructive/40 text-destructive`,fallback:`border-destructive/40 text-destructive`},YE={exact:`Renders the app's real component.`,adapted:`Renders through a canvas-safe adaptation.`,"server-rendered":`Rendered on the server, not mounted in the browser.`,unstyled:`Renders without the app's styles.`,proxy:`A proxy snippet stands in for it.`,unchecked:`How this renders has not been established.`,unavailable:`Can't render in the canvas — a labelled fallback stands in.`,fallback:`A fallback stands in for it.`};function XE({diagnostic:e,className:t}){if(!e)return null;let n=e.status;if(n===`exact`&&!e.observed)return null;let r=JE[n]??`text-muted-foreground`,i=YE[n]??n;return(0,G.jsx)(K,{variant:`outline`,"data-fidelity":n,className:`px-1.5 py-0 text-[10px] font-normal ${r} ${t??``}`,title:e.note?`${i} ${e.note}`:i,children:n})}function ZE(e,t=!0){$E(e,t,q(e=>e.loadRepoStatus))}function QE(e,t,n=!0){let r=q(e=>e.loadLibraryStatus);$E(t,n,(0,P.useCallback)(t=>r(e,t),[r,e]))}function $E(e,t,n){let r=t?e.join(`,`):``;(0,P.useEffect)(()=>{if(!r)return;let e=setTimeout(()=>void n(r.split(`,`)),250);return()=>clearTimeout(e)},[r,n])}function eD({className:e,...t}){return(0,G.jsx)(`nav`,{"aria-label":`breadcrumb`,"data-slot":`breadcrumb`,className:W(e),...t})}function tD({className:e,...t}){return(0,G.jsx)(`ol`,{"data-slot":`breadcrumb-list`,className:W(`flex flex-wrap items-center gap-1.5 text-sm wrap-break-word text-muted-foreground`,e),...t})}function nD({className:e,...t}){return(0,G.jsx)(`li`,{"data-slot":`breadcrumb-item`,className:W(`inline-flex items-center gap-1`,e),...t})}function rD({asChild:e,className:t,...n}){let r=e?N:`a`;return(0,G.jsx)(r,{"data-slot":`breadcrumb-link`,className:W(`transition-colors hover:text-foreground`,t),...n})}function iD({className:e,...t}){return(0,G.jsx)(`span`,{"data-slot":`breadcrumb-page`,role:`link`,"aria-disabled":`true`,"aria-current":`page`,className:W(`font-normal text-foreground`,e),...t})}function aD({children:e,className:t,...n}){return(0,G.jsx)(`li`,{"data-slot":`breadcrumb-separator`,role:`presentation`,"aria-hidden":`true`,className:W(`[&>svg]:size-3.5`,t),...n,children:e??(0,G.jsx)(bn,{className:`cn-rtl-flip`})})}function oD({category:e,name:t}){return(0,G.jsx)(eD,{children:(0,G.jsxs)(tD,{className:`text-xs`,children:[(0,G.jsxs)(nD,{children:[(0,G.jsx)(Rr,{size:12,strokeWidth:2}),(0,G.jsx)(rD,{href:`#`,children:`Library`})]}),(0,G.jsx)(aD,{}),(0,G.jsx)(nD,{children:(0,G.jsx)(`span`,{children:e})}),(0,G.jsx)(aD,{}),(0,G.jsx)(nD,{children:(0,G.jsx)(iD,{children:t})})]})})}function sD({onClick:e}){return(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:e,className:`-ml-2 text-muted-foreground`,children:[(0,G.jsx)(Wt,{}),`Library`]})}function cD({entry:e,diagnostic:t,previewLabel:n}){let[r,i]=(0,P.useState)(!1),a=uD(e,t,n);return(0,G.jsxs)(`div`,{className:`rounded-md border border-dashed px-4 py-3 flex flex-col gap-2`,children:[(0,G.jsxs)(`p`,{className:`text-sm`,children:[`Your agent can fix this: ask it to set up the design's`,` `,(0,G.jsx)(`span`,{className:`font-medium`,children:`preview entry`}),` — the file that gives the canvas the providers and styles your app's own entry gives its components.`]}),(0,G.jsxs)(eT,{open:r,onOpenChange:i,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(tT,{asChild:!0,children:(0,G.jsxs)(J,{size:`xs`,variant:`ghost`,className:`px-1.5 -ml-1.5`,children:[(0,G.jsx)(bn,{className:`transition-transform ${r?`rotate-90`:``}`}),r?`Hide the prompt`:`See the prompt`]})}),(0,G.jsxs)(J,{size:`xs`,variant:`outline`,onClick:()=>void lD(a),children:[(0,G.jsx)(Wn,{}),`Copy prompt`]})]}),(0,G.jsx)(nT,{children:(0,G.jsx)(`pre`,{className:`mt-2 whitespace-pre-wrap rounded-md bg-muted/60 p-3 text-xs leading-relaxed font-mono`,children:a})})]})]})}async function lD(e){try{await navigator.clipboard.writeText(e),V({kind:`success`,message:`Prompt copied.`})}catch{V({kind:`info`,message:`Copy failed — select the prompt text instead.`})}}function uD(e,t,n){let r=[t.note,t.remedy].filter(Boolean).join(` `),i=(e.dataSources??[]).map(e=>e.name).join(`, `);return[`In Velloo, ${e.id} (from ${e.identity.importPath}) doesn't render on the canvas:`,`${t.status}${t.code?` (${t.code})`:``}. ${r}`.trim(),``,n?`The design's preview entry is currently: ${n}.`:`The design has no preview entry yet.`,``,...i?[`It reads its own data through ${i}, so the preview has to supply that too.`,``]:[],`Please run preview_status to see what the app's components need, then write the`,`preview entry with set_preview_entry: import the app's global stylesheet and wrap`,`children in the providers the app's own entry uses (theme, i18n, query client, …),`,`with fixtures instead of network calls. Re-run preview_status, and check`,`component_status for ${e.id} to confirm it renders.`].join(`
41
+ `)}function dD({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,G.jsx)(`table`,{"data-slot":`table`,className:W(`w-full caption-bottom text-sm`,e),...t})})}function fD({className:e,...t}){return(0,G.jsx)(`thead`,{"data-slot":`table-header`,className:W(`[&_tr]:border-b`,e),...t})}function pD({className:e,...t}){return(0,G.jsx)(`tbody`,{"data-slot":`table-body`,className:W(`[&_tr:last-child]:border-0`,e),...t})}function mD({className:e,...t}){return(0,G.jsx)(`tr`,{"data-slot":`table-row`,className:W(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function hD({className:e,...t}){return(0,G.jsx)(`th`,{"data-slot":`table-head`,className:W(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function gD({className:e,...t}){return(0,G.jsx)(`td`,{"data-slot":`table-cell`,className:W(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}var _D=`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`;async function vD(e){try{await navigator.clipboard.writeText(e),V({kind:`success`,message:`Import copied.`})}catch{V({kind:`info`,message:e})}}function yD({id:e}){let t=q(e=>e.repoCatalog),n=q(e=>e.repoStatus),r=q(e=>e.themeVersion),i=q(e=>e.designMode===`dark`),a=q(e=>e.openLibrary),o=q(e=>e.refreshRepoStatus),s=t?.entries.find(t=>t.id===e)??null,c=(0,P.useMemo)(()=>s?(t?.entries??[]).filter(e=>e.id!==s.id&&e.identity.member!==void 0&&e.identity.importPath===s.identity.importPath&&e.identity.exportName===s.identity.exportName&&e.identity.app===s.identity.app):[],[t,s]);if(ZE(s?[s.id]:[]),!t)return null;if(!s)return(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col bg-background`,children:[(0,G.jsx)(`div`,{className:`px-8 pt-4`,children:(0,G.jsx)(sD,{onClick:()=>a(null)})}),(0,G.jsx)(ET,{icon:Aa,title:`${e} isn't in the repo catalog`,hint:`The app may no longer use it, or discovery hasn't seen it yet.`})]});let l=n[s.id],u=s.source===`local`?`This app`:s.packageName??s.identity.importPath,d=Od(s),f=s.states.length>0?s.states:[null];return(0,G.jsx)(`div`,{className:`flex-1 overflow-auto bg-background`,"data-repo-detail":s.id,children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl flex flex-col`,children:[(0,G.jsxs)(`header`,{className:`sticky top-0 z-10 bg-background/85 backdrop-blur-sm border-b px-8 pt-4 pb-5`,children:[(0,G.jsx)(sD,{onClick:()=>a(null)}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(oD,{category:`Repo · ${u}`,name:s.id})}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-baseline gap-2.5 flex-wrap`,children:[(0,G.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,children:s.id}),(0,G.jsx)(K,{variant:`outline`,className:`text-[10px] font-mono uppercase tracking-wider`,children:s.source===`local`?`app`:`package`}),s.recipe?(0,G.jsx)(K,{variant:`outline`,className:`text-[10px] font-mono`,children:s.recipe}):null,(0,G.jsx)(XE,{diagnostic:l})]}),s.description?(0,G.jsx)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,children:s.description}):null,s.dataSources&&s.dataSources.length>0?(0,G.jsxs)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,"data-repo-data-sources":!0,children:[`Reads its own data through`,` `,s.dataSources.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0?`, `:``,(0,G.jsx)(`span`,{className:`font-mono text-xs`,children:e.name}),e.from?(0,G.jsxs)(`span`,{className:`text-xs`,children:[` (`,e.from,`)`]}):null]},e.name)),`, so props alone won't fill it — a preview needs that data.`]}):null,s.qualifiedBecause?(0,G.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground italic`,children:[`Placed as `,(0,G.jsx)(`span`,{className:`font-mono`,children:s.id}),`: `,s.qualifiedBecause]}):null,(0,G.jsxs)(Hg,{className:`mt-3 h-8 max-w-xl`,children:[(0,G.jsx)(qg,{readOnly:!0,value:d,"aria-label":`Import`,className:`font-mono text-xs`,onFocus:e=>e.currentTarget.select()}),(0,G.jsx)(Wg,{align:`inline-end`,children:(0,G.jsx)(Kg,{size:`icon-xs`,"aria-label":`Copy import`,title:`Copy import`,onClick:()=>void vD(d),children:(0,G.jsx)(Wn,{})})})]})]}),l&&(l.note||l.remedy)?(0,G.jsxs)(`section`,{className:`px-8 pt-6 flex flex-col gap-2 text-sm`,children:[(0,G.jsx)(`div`,{className:_D,children:`Fidelity`}),l.note?(0,G.jsx)(`p`,{children:l.note}):null,l.remedy?(0,G.jsx)(`p`,{className:`text-muted-foreground`,children:l.remedy}):null,l.status!==`exact`&&l.status!==`adapted`?(0,G.jsx)(cD,{entry:s,diagnostic:l,previewLabel:t?.apps.find(e=>e.app===s.identity.app)?.preview.label}):null]}):null,(0,G.jsxs)(`section`,{className:`px-8 py-6 flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:_D,children:`Preview`}),(0,G.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:f.map((e,t)=>(0,G.jsxs)(pC,{className:`py-0 gap-0`,children:[(0,G.jsx)(`div`,{className:`p-3`,children:(0,G.jsx)(`iframe`,{src:Dd(s.id,{state:t,w:480,h:200,v:r,dark:i}),title:`${s.id} ${e?.name??`preview`}`,loading:`lazy`,onLoad:()=>setTimeout(()=>void o([s.id]),1500),className:`block w-full h-[200px] border-0`})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-t px-3 py-1.5 text-xs`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:e?.name??`default`}),e?(0,G.jsxs)(`span`,{className:`text-muted-foreground truncate`,title:e.at,children:[e.source,e.at?` · ${e.at}`:``]}):null]})]},e?`${e.name}-${t}`:`default`))})]}),s.props.length>0?(0,G.jsxs)(`section`,{className:`px-8 pb-6 flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:_D,children:`Props`}),(0,G.jsx)(bD,{props:s.props})]}):null,c.length>0||(s.parts?.length??0)>0?(0,G.jsxs)(`section`,{className:`px-8 pb-6 flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:_D,children:`Parts`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(c.length>0?c.map(e=>e.id):(s.parts??[]).map(e=>`${s.name}.${e}`)).map(e=>(0,G.jsx)(K,{variant:`outline`,className:`font-mono text-[11px]`,children:e},e))})]}):null,s.provenance.length>0?(0,G.jsxs)(`section`,{className:`px-8 pb-10 flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:_D,children:`Used at`}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-0.5 font-mono text-xs text-muted-foreground`,children:s.provenance.map(e=>(0,G.jsx)(`li`,{children:e},e))})]}):null]})})}function bD({props:e}){let t=e.filter(e=>!e.inherited),n=e.filter(e=>e.inherited),[r,i]=(0,P.useState)(!1);return(0,G.jsxs)(pC,{className:`py-0`,children:[(0,G.jsxs)(dD,{children:[(0,G.jsx)(fD,{className:`sr-only`,children:(0,G.jsxs)(mD,{children:[(0,G.jsx)(hD,{children:`Prop`}),(0,G.jsx)(hD,{children:`Accepts`})]})}),(0,G.jsx)(pD,{children:t.map(e=>(0,G.jsx)(xD,{prop:e},e.name))})]}),n.length>0?(0,G.jsxs)(eT,{open:r,onOpenChange:i,children:[(0,G.jsxs)(tT,{className:`flex w-full items-center gap-1.5 border-t px-3 py-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(bn,{size:12,className:`transition-transform ${r?`rotate-90`:``}`}),n.length,` inherited prop`,n.length===1?``:`s`]}),(0,G.jsx)(nT,{children:(0,G.jsx)(dD,{children:(0,G.jsx)(pD,{children:n.map(e=>(0,G.jsx)(xD,{prop:e},e.name))})})})]}):null]})}function xD({prop:e}){return(0,G.jsxs)(mD,{"data-prop":e.name,children:[(0,G.jsxs)(gD,{className:`w-40 py-3 align-top`,children:[(0,G.jsx)(`div`,{className:`font-mono text-xs font-medium`,children:e.name}),(0,G.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:[e.optional?`optional`:`required`,e.slot?`slot`:null].filter(Boolean).join(` · `)})]}),(0,G.jsxs)(gD,{className:`py-3 whitespace-normal`,children:[(0,G.jsxs)(`div`,{className:`flex flex-row flex-wrap items-center gap-1`,children:[e.enumValues&&e.enumValues.length>0?e.enumValues.map(e=>(0,G.jsx)(K,{variant:`outline`,className:`font-mono text-[10px]`,children:String(e)},String(e))):(0,G.jsx)(K,{variant:`outline`,className:`font-mono text-[10px] text-muted-foreground max-w-full truncate`,title:e.type,children:e.type||e.control}),e.defaultValue?(0,G.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`default: `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.defaultValue})]}):null]}),e.description?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.description}):null,!e.serializable&&e.constraint?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-amber-700 dark:text-amber-400`,children:e.constraint}):null]})]})}function SD({item:e,snippets:t}){return e.kind===`snippet`?(0,G.jsx)(ED,{item:e,snippets:t}):e.kind===`repo`?(0,G.jsx)(yD,{id:e.id}):(0,G.jsx)(CD,{item:e})}function CD({item:e}){let t=q(e=>e.components),n=q(e=>e.themeVersion),r=q(e=>e.designMode),i=q(e=>e.openLibrary),a=q(e=>qd(e.design)),o=q(t=>t.libraryStatus[Kd(a,e.id)]);QE(a,[e.id]);let s=(0,P.useMemo)(()=>t?t.find(t=>t.id===e.id)??null:null,[t,e.id]),c=KE(t,e.id)??`Components`,l=r===`dark`?`&mode=dark`:``,u=s?.props.find(e=>e.name===`variant`&&e.enumValues),d=s?.props.find(e=>e.name===`size`&&e.enumValues),f=u?.enumValues??[],p=d?.enumValues??[],m=(t,r)=>{let i=r?.w??480,a=r?.h??180,o=t?`&props=${encodeURIComponent(JSON.stringify(t))}`:``;return`/api/render/component/${encodeURIComponent(e.id)}?w=${i}&h=${a}&v=${n}${o}${l}`};return(0,G.jsx)(`div`,{className:`flex-1 overflow-auto bg-background`,children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl flex flex-col`,children:[(0,G.jsxs)(`header`,{className:`sticky top-0 z-10 bg-background/85 backdrop-blur-sm border-b px-8 pt-4 pb-5`,children:[(0,G.jsx)(sD,{onClick:()=>i(null)}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(oD,{category:c,name:e.id})}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-baseline gap-2.5 flex-wrap`,children:[(0,G.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,children:e.id}),s?(0,G.jsx)(K,{variant:`outline`,className:`text-[10px] font-mono uppercase tracking-wider`,children:s.source}):null,(0,G.jsx)(XE,{diagnostic:o}),s?.designModeNotes?(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground italic`,children:s.designModeNotes}):null]})]}),(0,G.jsxs)(`section`,{className:`px-8 py-6 flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Preview`}),(0,G.jsx)(pC,{className:`py-0`,children:(0,G.jsx)(`div`,{className:`p-3`,children:(0,G.jsx)(`iframe`,{src:m(void 0,{w:720,h:220}),title:`${e.id} preview`,loading:`lazy`,className:`block w-full h-[220px] border-0`})})})]}),f.length>0||p.length>0?(0,G.jsxs)(`section`,{className:`px-8 pb-6 flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Variants`}),(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[f.length||1,` × `,p.length||1,` =`,` `,(f.length||1)*(p.length||1),` combinations`]})]}),(0,G.jsx)(wD,{componentId:e.id,variants:f,sizes:p,renderUrl:m})]}):null,s&&s.props.length>0?(0,G.jsxs)(`section`,{className:`px-8 pb-10 flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Props`}),(0,G.jsx)(TD,{props:s.props})]}):null]})})}function wD({componentId:e,variants:t,sizes:n,renderUrl:r}){let i=t.length>0?t:[null],a=n.length>0?n:[null];return(0,G.jsx)(pC,{className:`py-0`,children:(0,G.jsxs)(dD,{children:[(0,G.jsx)(fD,{className:`bg-muted/30`,children:(0,G.jsxs)(mD,{children:[(0,G.jsx)(hD,{className:`w-32 text-[10px] uppercase tracking-wider`,children:t.length>0?`variant`:``}),a.map((e,t)=>(0,G.jsx)(hD,{className:`text-center text-[10px] uppercase tracking-wider`,children:e??`preview`},e??`col-${t}`))]})}),(0,G.jsx)(pD,{children:i.map((t,n)=>(0,G.jsxs)(mD,{children:[(0,G.jsx)(gD,{className:`w-32 font-mono text-xs`,children:t??``}),a.map((i,a)=>{let o={};return t!==null&&(o.variant=t),i!==null&&(o.size=i),(0,G.jsx)(gD,{className:`p-3`,children:(0,G.jsx)(`iframe`,{src:r(o,{w:280,h:80}),title:`${e} ${t??``} ${i??``}`,loading:`lazy`,className:`w-full h-[80px] border-0`})},`${t??n}-${i??a}`)})]},t??`row-${n}`))})]})})}function TD({props:e}){return(0,G.jsx)(pC,{className:`py-0`,children:(0,G.jsxs)(dD,{children:[(0,G.jsx)(fD,{className:`sr-only`,children:(0,G.jsxs)(mD,{children:[(0,G.jsx)(hD,{children:`Prop`}),(0,G.jsx)(hD,{children:`Accepts`})]})}),(0,G.jsx)(pD,{children:e.map(e=>(0,G.jsxs)(mD,{children:[(0,G.jsxs)(gD,{className:`w-32 py-3 align-top`,children:[(0,G.jsx)(`div`,{className:`font-mono text-xs font-medium`,children:e.name}),e.optional?(0,G.jsx)(`div`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:`optional`}):null]}),(0,G.jsxs)(gD,{className:`flex flex-row flex-wrap items-center gap-1 py-3`,children:[e.enumValues&&e.enumValues.length>0?e.enumValues.map(e=>(0,G.jsx)(K,{variant:`outline`,className:`font-mono text-[10px]`,children:String(e)},String(e))):(0,G.jsx)(K,{variant:`outline`,className:`font-mono text-[10px] text-muted-foreground`,children:e.control}),e.defaultValue?(0,G.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`default: `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.defaultValue})]}):null]})]},e.name))})]})})}function ED({item:e,snippets:t}){let n=q(e=>e.themeVersion),r=q(e=>e.designMode),i=q(e=>e.openLibrary),a=q(e=>e.openSnippetEditor),o=t.find(t=>t.id===e.id)??null,s=r===`dark`?`&mode=dark`:``;return(0,G.jsx)(`div`,{className:`flex-1 overflow-auto bg-background`,children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl flex flex-col`,children:[(0,G.jsxs)(`header`,{className:`sticky top-0 z-10 bg-background/85 backdrop-blur-sm border-b px-8 pt-4 pb-5`,children:[(0,G.jsx)(sD,{onClick:()=>i(null)}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(oD,{category:`Snippets`,name:o?.name??e.id})}),(0,G.jsxs)(`div`,{className:`mt-2 flex items-baseline gap-2.5 flex-wrap`,children:[(0,G.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,children:o?.name??e.id}),(0,G.jsx)(K,{variant:`outline`,className:`text-[10px] font-mono uppercase tracking-wider border-primary/40 text-primary`,children:`snippet`}),o?.unused?(0,G.jsx)(K,{variant:`outline`,className:`text-[10px] uppercase tracking-wider border-amber-500/40 text-amber-600 dark:text-amber-400`,title:`No screen reaches this snippet, directly or through another snippet — nothing renders it.`,children:`unused`}):null,(0,G.jsx)(`div`,{className:`ml-auto`,children:(0,G.jsxs)(J,{size:`sm`,onClick:()=>a(e.id),children:[(0,G.jsx)(Ji,{}),`Open in canvas`]})})]}),o?(0,G.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[o.params.length,` parameter`,o.params.length===1?``:`s`]}),o.params.map(e=>(0,G.jsx)(DD,{param:e},e.name))]}):null]}),(0,G.jsxs)(`section`,{className:`px-8 py-6 flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Preview`}),(0,G.jsx)(pC,{className:`py-0`,children:(0,G.jsx)(`div`,{className:`p-3`,children:(0,G.jsx)(`iframe`,{src:`/api/render/snippet/${encodeURIComponent(e.id)}?w=720&h=260&v=${n}${s}`,title:`${e.id} preview`,loading:`lazy`,className:`block w-full h-[260px] border-0`})})})]}),o&&o.params.length>0?(0,G.jsxs)(`section`,{className:`px-8 pb-10 flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Parameters`}),(0,G.jsx)(pC,{className:`py-0`,children:(0,G.jsxs)(dD,{children:[(0,G.jsx)(fD,{className:`sr-only`,children:(0,G.jsxs)(mD,{children:[(0,G.jsx)(hD,{children:`Parameter`}),(0,G.jsx)(hD,{children:`Type`})]})}),(0,G.jsx)(pD,{children:o.params.map(e=>(0,G.jsxs)(mD,{children:[(0,G.jsxs)(gD,{className:`w-32 py-3 font-mono text-xs font-medium`,children:[`$`,e.name]}),(0,G.jsxs)(gD,{className:`flex flex-row flex-wrap items-center gap-1 py-3`,children:[(0,G.jsx)(K,{variant:`outline`,className:`font-mono text-[10px]`,children:e.type}),qE(e)===null?(0,G.jsx)(`span`,{className:`ml-2 text-xs text-amber-600 dark:text-amber-400`,children:`required`}):(0,G.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`default: `,(0,G.jsx)(`span`,{className:`font-mono`,children:qE(e)})]})]})]},e.name))})]})})]}):null]})})}function DD({param:e}){let t=qE(e);return(0,G.jsxs)(K,{variant:`outline`,className:`border-dashed font-mono text-[10px] text-muted-foreground`,title:`${e.type}${t===null?` · required`:``}`,children:[`$`,e.name,t===null?null:(0,G.jsxs)(`span`,{className:`opacity-70`,children:[` = `,t]})]})}function OD({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`skeleton`,className:W(`animate-pulse rounded-md bg-muted`,e),...t})}var kD=`\0all`,AD={Button:110,Badge:110,Heading:90,Text:80,Label:80,Input:100,Textarea:130,Switch:100,Checkbox:100,Slider:100,Progress:100,Skeleton:80,Separator:80,Divider:80,Toggle:100,Calendar:280,Icon:110,Placeholder:150,Avatar:110,Alert:140,Card:130,Tabs:110,Breadcrumb:80,Pagination:100,Accordion:150,RadioGroup:100,ToggleGroup:100,Select:100,Toaster:140,Gradient:130};function jD(e){return AD[e]??120}function MD({snippets:e}){let t=q(e=>e.components),n=q(e=>e.components===null&&e.componentsLoading),r=q(e=>e.openLibrary),i=q(e=>e.themeVersion),a=q(e=>e.designMode),[o,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(null),u=(0,P.useMemo)(()=>GE(t),[t]),d=(0,P.useMemo)(()=>{let t=[];for(let e of u)for(let n of e.components)t.push({ref:{kind:`component`,id:n},label:n,category:e.label,isSnippet:!1,previewHeight:jD(n)});for(let n of e)t.push({ref:{kind:`snippet`,id:n.id},label:n.name,category:`Snippets`,isSnippet:!0,...n.unused?{unused:!0}:{},previewHeight:150});return t},[u,e]),f=d.filter(e=>!e.isSnippet).length,p=d.filter(e=>e.isSnippet).length,m=o.trim().toLowerCase(),h=e=>!m||e.toLowerCase().includes(m),g=d.filter(e=>!(c&&e.category!==c||!h(e.label))),_=Array.from({length:3},()=>[]),v=Array.from({length:3},()=>0);for(let e of g){let t=0,n=v[0]??0;for(let e=1;e<3;e+=1){let r=v[e]??0;r<n&&(t=e,n=r)}_[t]?.push(e),v[t]=(v[t]??0)+e.previewHeight+60}let y=a===`dark`?`&mode=dark`:``;return(0,G.jsx)(`div`,{className:`flex-1 overflow-auto scroll-stable bg-background`,children:(0,G.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl flex flex-col`,children:[(0,G.jsxs)(`header`,{className:`px-8 pt-10 pb-5`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-3`,children:[(0,G.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight`,children:`Library`}),(0,G.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[n?`loading components`:`${f} components`,` ·`,` `,p,` snippets`]})]}),(0,G.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground max-w-2xl`,children:`Everything you can drop onto a board. Click a tile to see variants and props.`})]}),(0,G.jsxs)(`div`,{className:`sticky top-0 z-20 bg-background/85 backdrop-blur-sm px-8 pt-3 pb-3`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-3 mb-3`,children:(0,G.jsxs)(Hg,{className:`h-9 flex-1 max-w-md`,children:[(0,G.jsx)(Wg,{children:(0,G.jsx)(Ma,{size:14,strokeWidth:2})}),(0,G.jsx)(qg,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`Search components and snippets…`})]})}),(0,G.jsxs)(rv,{type:`single`,value:c??kD,onValueChange:e=>{e&&l(e===kD?null:e)},"aria-label":`Component shelf`,className:`flex-wrap items-center justify-start gap-2`,children:[(0,G.jsx)(PD,{value:kD,label:`All ${d.length}`}),u.map(e=>{let t=d.filter(t=>t.category===e.label).length;return t===0?null:(0,G.jsx)(PD,{value:e.label,label:`${e.label} ${t}`},e.id)}),p>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(B_,{orientation:`vertical`,className:`mx-1 h-5`}),(0,G.jsx)(PD,{value:`Snippets`,label:`Snippets ${p}`,accent:!0})]}):null]})]}),(0,G.jsxs)(`div`,{className:`px-8 pb-12 mt-5 flex flex-col gap-4`,children:[g.length>0?(0,G.jsx)(`div`,{className:`flex items-start gap-4`,children:_.map((e,t)=>{let n=`col-${t}`;return(0,G.jsx)(`div`,{className:`flex-1 flex flex-col gap-4 min-w-0`,children:e.map(e=>(0,G.jsx)(FD,{tile:e,previewMode:y,themeVersion:i,onClick:()=>r(e.ref)},`${e.ref.kind}:${e.ref.id}`))},n)})}):null,n?(0,G.jsx)(ND,{}):g.length===0?(0,G.jsx)(Jm,{className:`py-16`,children:(0,G.jsxs)(Ym,{children:[(0,G.jsx)(Zm,{variant:`icon`,children:(0,G.jsx)(Aa,{})}),(0,G.jsxs)(Qm,{children:[`No matches for "`,o,`".`]}),(0,G.jsx)($m,{children:`Try a shorter word, or clear the shelf filter above.`})]})}):null]})]})})}function ND(){return(0,G.jsx)(`div`,{className:`flex items-start gap-4`,"aria-hidden":`true`,children:[`left`,`middle`,`right`].map(e=>(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col gap-4 min-w-0`,children:[(0,G.jsx)(OD,{className:`h-[160px] w-full`}),(0,G.jsx)(OD,{className:`h-[110px] w-full`}),(0,G.jsx)(OD,{className:`h-[140px] w-full`})]},e))})}function PD({value:e,label:t,accent:n}){return(0,G.jsx)(iv,{value:e,className:`h-7 rounded-full px-3 text-xs whitespace-nowrap `+(n?`border-primary/40 bg-primary/5 text-primary hover:bg-primary/10 hover:text-primary data-[state=on]:bg-primary data-[state=on]:font-medium data-[state=on]:text-primary-foreground`:`bg-card text-muted-foreground data-[state=on]:bg-foreground data-[state=on]:font-medium data-[state=on]:text-background`),children:t})}function FD({tile:e,previewMode:t,themeVersion:n,onClick:r}){let i=e.isSnippet,a=e.ref.kind===`snippet`?`/api/render/snippet/${encodeURIComponent(e.ref.id)}?w=480&h=${e.previewHeight}&v=${n}${t}`:`/api/render/component/${encodeURIComponent(e.ref.id)}?w=480&h=${e.previewHeight}&v=${n}${t}`;return(0,G.jsx)(pC,{className:`gap-0 py-0 transition-shadow `+(i?`ring-primary/25 hover:ring-primary/60`:`hover:ring-primary/40`),children:(0,G.jsxs)(`button`,{type:`button`,onClick:r,className:`block w-full text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:[(0,G.jsxs)(`div`,{className:`relative w-full overflow-hidden bg-background`,style:{height:e.previewHeight},children:[(0,G.jsx)(OD,{className:`absolute inset-0 rounded-none`}),(0,G.jsx)(`iframe`,{src:a,title:`${e.label} preview`,loading:`lazy`,className:`absolute inset-0 w-full h-full pointer-events-none border-0`})]}),(0,G.jsxs)(vC,{className:`flex items-center justify-between gap-2 border-t px-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full shrink-0 `+(i?`bg-primary`:`bg-muted-foreground`)}),(0,G.jsx)(`span`,{className:`text-xs font-medium truncate`,children:e.label})]}),(0,G.jsx)(K,{variant:i?`secondary`:`outline`,className:`px-1.5 py-0 text-[10px] uppercase tracking-wider `+(e.unused?`text-amber-600 dark:text-amber-400`:i?`text-primary`:`text-muted-foreground`),title:e.unused?`No screen reaches this snippet — nothing renders it.`:void 0,children:e.unused?`Unused`:i?`Snippet`:e.category})]})]})})}function ID({side:e,width:t,onCommit:n,paneRef:r}){let i=(0,P.useRef)(null),a=e=>{let t=r.current;t&&(t.style.width=`${e}px`)},o=e=>{e.button===0&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),i.current={startX:e.clientX,startWidth:t,width:t},document.body.classList.add(`velloo-resizing`))},s=t=>{let n=i.current;if(!n)return;let r=e===`left`?t.clientX-n.startX:n.startX-t.clientX;n.width=Tf(n.startWidth+r),a(n.width)},c=e=>{let t=i.current;t&&(i.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),document.body.classList.remove(`velloo-resizing`),n(t.width))},l=(e,r)=>{let i=r?48:16;n(Tf(t+(e?-i:i)))},u=t=>{t.key===`ArrowLeft`?(t.preventDefault(),l(e===`left`,t.shiftKey)):t.key===`ArrowRight`?(t.preventDefault(),l(e===`right`,t.shiftKey)):(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(wf.default))},d=`Resize ${e===`left`?`sidebar`:`inspector`}`;return(0,G.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":d,"aria-valuenow":t,"aria-valuemin":wf.min,"aria-valuemax":wf.max,tabIndex:0,title:`${d} — double-click to reset`,onPointerDown:o,onPointerMove:s,onPointerUp:c,onPointerCancel:c,onDoubleClick:()=>{a(wf.default),n(wf.default)},onKeyDown:u,className:`group absolute inset-y-0 z-10 w-1.5 cursor-col-resize pointer-events-auto outline-none `+(e===`left`?`right-0`:`left-0`),children:(0,G.jsx)(`div`,{className:`h-full w-px bg-transparent transition-colors group-hover:bg-primary/60 group-focus-visible:bg-primary `+(e===`left`?`ml-auto`:`mr-auto`)})})}var LD=200;function RD({side:e,collapsed:t,width:n,onResize:r,rail:i,contentDisabled:a=!1,children:o}){let s=zD(t),c=(0,P.useRef)(null);return(0,G.jsx)(`aside`,{ref:c,"data-pane":e,"data-collapsed":t,style:{width:t?36:n},className:`relative h-full shrink-0 overflow-hidden bg-card `+(e===`left`?`border-r `:`border-l `)+(s?`transition-[width] duration-200 ease-out`:``),children:t&&!s?i:(0,G.jsxs)(G.Fragment,{children:[t?null:(0,G.jsx)(ID,{side:e,width:n,onCommit:r,paneRef:c}),(0,G.jsx)(`div`,{style:{width:t||s?n:`100%`},className:`absolute inset-y-0 flex flex-col ${e===`left`?`left-0`:`right-0`} `+(a?`opacity-50 pointer-events-none select-none`:``),"aria-disabled":a||void 0,children:o})]})})}function zD(e){let t=VD(),[n,r]=(0,P.useState)(e),[i,a]=(0,P.useState)(!1);return n!==e&&(r(e),a(!t)),(0,P.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>a(!1),LD);return()=>clearTimeout(e)},[i]),i}var BD=`(prefers-reduced-motion: reduce)`;function VD(){let[e,t]=(0,P.useState)(()=>typeof matchMedia==`function`&&matchMedia(BD).matches);return(0,P.useEffect)(()=>{if(typeof matchMedia!=`function`)return;let e=matchMedia(BD),n=()=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var HD=240,UD=4096;function WD(e){return Math.max(HD,Math.min(UD,Math.round(e)))}function GD(){let e=q(e=>e.previewTarget),t=q(e=>e.setPreviewTarget),n=q(e=>e.designMode),r=q(e=>e.themeVersion),i=q(t=>e?t.screenVersions[e.screenId]??0:0),a=dh(),[o,s]=(0,P.useState)(1200),[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(900),[f,p]=(0,P.useState)(!1),m=(0,P.useRef)(null);(0,P.useEffect)(()=>{e&&(s(WD(e.w)),l(null),p(!1))},[e]),(0,P.useEffect)(()=>{if(!e)return;let t=m.current;if(!t)return;let n=()=>d(Math.max(200,Math.round(t.clientHeight)));n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e]);let h=e=>t=>{t.preventDefault();let n=t.currentTarget;n.setPointerCapture(t.pointerId);let r=t.clientX,i=c??o,a=t=>{let n=(t.clientX-r)*(e===`e`?2:-2);return WD(i+n)},u=e=>l(a(e)),d=e=>{n.removeEventListener(`pointermove`,u),n.removeEventListener(`pointerup`,d),n.removeEventListener(`pointercancel`,d),l(null),s(a(e))};n.addEventListener(`pointermove`,u),n.addEventListener(`pointerup`,d),n.addEventListener(`pointercancel`,d)};if(!e)return null;let g=c??o,_=mv({screenId:e.screenId,width:o,height:u,...e.boardTheme?{boardTheme:e.boardTheme}:{},...e.scheme?{scheme:e.scheme}:{},canvasDefault:n,screenRevision:i,themeVersion:r});return(0,G.jsx)(fh,{open:!0,onOpenChange:e=>!e&&t(null),children:(0,G.jsxs)(hh,{className:`max-w-none sm:max-w-none w-[96vw] h-[94vh] flex flex-col gap-3 p-4 bg-card`,children:[(0,G.jsxs)(gh,{className:`flex-row items-center gap-3 space-y-0 pr-10`,children:[(0,G.jsx)(vh,{className:`text-sm truncate`,children:e.name}),(0,G.jsx)(yh,{className:`sr-only`,children:`Full-screen preview with adjustable width`}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[a.map(e=>(0,G.jsxs)(J,{variant:o===e.w&&c===null?`secondary`:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>{l(null),s(WD(e.w))},children:[e.name,` `,(0,G.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:e.w})]},e.name)),(0,G.jsx)(KD,{value:g,onCommit:e=>s(WD(e))})]})]}),(0,G.jsx)(`div`,{className:`flex-1 min-h-0 overflow-auto rounded-lg border bg-muted px-4 py-5`,children:(0,G.jsxs)(`div`,{ref:m,className:`relative mx-auto h-full group/preview`,style:{width:g,minWidth:g},children:[(0,G.jsx)(`iframe`,{title:`Preview: ${e.name}`,src:_,onLoad:()=>p(!0),className:`h-full w-full rounded-md bg-white ring-1 ring-border`,style:{pointerEvents:c===null?`auto`:`none`}}),f?null:(0,G.jsx)(hy,{size:40}),(0,G.jsx)(`div`,{onPointerDown:h(`w`),className:`absolute top-0 left-0 h-full w-1.5 -translate-x-1 cursor-ew-resize rounded opacity-0 group-hover/preview:opacity-100 transition-opacity bg-primary/40 hover:bg-primary/70`,role:`presentation`}),(0,G.jsx)(`div`,{onPointerDown:h(`e`),className:`absolute top-0 right-0 h-full w-1.5 translate-x-1 cursor-ew-resize rounded opacity-0 group-hover/preview:opacity-100 transition-opacity bg-primary/40 hover:bg-primary/70`,role:`presentation`})]})})]})})}function KD({value:e,onCommit:t}){let[n,r]=(0,P.useState)(String(e));return(0,P.useEffect)(()=>{r(String(e))},[e]),(0,G.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground tabular-nums`,children:[(0,G.jsx)(`input`,{type:`number`,value:n,min:HD,max:UD,"aria-label":`preview width`,onChange:e=>r(e.target.value),onBlur:()=>{let i=Number(n);Number.isFinite(i)?i!==e&&t(i):r(String(e))},onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),t.currentTarget.blur()),t.key===`Escape`&&(r(String(e)),t.currentTarget.blur())},className:`w-14 rounded-sm border bg-transparent px-1 py-0.5 text-right outline-none focus:bg-card [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none`}),`px`]})}function qD({className:e,...t}){return(0,G.jsx)(we,{"data-slot":`checkbox`,className:W(`peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary`,e),...t,children:(0,G.jsx)(Ee,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none [&>svg]:size-3.5`,children:(0,G.jsx)(I,{})})})}function JD(e,t){let n=new Map;for(let r of e){if(r.scope!==`shared`||r.status!==`open`||r.manage===!1||r.origin.kind!==`published`||r.origin.slug===t)continue;let e=r.origin.slug,i=n.get(e)??{slug:e,branch:r.branch??null,threadIds:[]};i.threadIds.push(r.id),n.set(e,i)}return[...n.values()]}function YD({groups:e,chosen:t,onToggle:n}){return e.length===0?null:(0,G.jsxs)(`div`,{className:`grid gap-2`,"data-publish-migrate":!0,children:[(0,G.jsx)(Y,{children:`Comments on other links`}),(0,G.jsx)(`div`,{className:`rounded-md border`,children:e.map(e=>{let r=e.threadIds.length;return(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5 text-sm hover:bg-accent/50`,children:[(0,G.jsx)(qD,{id:`publish-migrate-${e.slug}`,checked:t.includes(e.slug),onCheckedChange:t=>n(e.slug,t===!0)}),(0,G.jsxs)(Y,{htmlFor:`publish-migrate-${e.slug}`,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-1.5 font-normal`,children:[(0,G.jsxs)(`span`,{className:`shrink-0`,children:[`Bring `,r,` open comment`,r===1?``:`s`,` from`]}),e.branch?(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1 font-mono text-xs`,children:[(0,G.jsx)(mr,{size:12,className:`shrink-0`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.branch})]}):(0,G.jsxs)(`span`,{className:`truncate font-mono text-xs`,children:[`/s/`,e.slug,`/`]})]})]},e.slug)})}),(0,G.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:`Each link keeps its own conversation. Comments brought here leave the other link.`})]})}var XD={public:`Public — anyone with the link`,private:`Private — everyone in your organization`,team:e=>`Only ${e} — that team, plus your organization's owner and admins`};function ZD(e){let{boards:t,boardIds:n}=e;return(0,G.jsxs)(`div`,{className:`grid gap-4`,children:[(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`publish-title`,children:`Title`}),(0,G.jsx)(Z,{id:`publish-title`,value:e.title,onChange:t=>e.onTitleChange(t.target.value),placeholder:`Board title`})]}),t.length>0?(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{children:`Boards`}),(0,G.jsx)(`div`,{className:`max-h-40 overflow-y-auto rounded-md border`,children:t.map(t=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 py-1.5 text-sm hover:bg-accent/50`,children:[(0,G.jsx)(qD,{id:`publish-board-${t.id}`,checked:n.includes(t.id),onCheckedChange:n=>e.onToggleBoard(t.id,n===!0)}),(0,G.jsx)(Y,{htmlFor:`publish-board-${t.id}`,className:`flex-1 cursor-pointer truncate font-normal`,children:t.name}),(0,G.jsxs)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:[t.frameCount,` frame`,t.frameCount===1?``:`s`]})]},t.id))})]}):(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This folder has no boards, so every screen is published.`}),(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`publish-destination`,children:`Destination`}),(0,G.jsxs)(bh,{value:e.destinationSlug,onValueChange:e.onDestinationChange,disabled:!!e.destinationError,children:[(0,G.jsx)(Sh,{id:`publish-destination`,children:(0,G.jsx)(xh,{})}),(0,G.jsxs)(Ch,{children:[e.matchingSlots.map(e=>(0,G.jsxs)(X,{value:e.slug,children:[`Update `,e.title||`Untitled design`]},e.slug)),(0,G.jsx)(X,{value:`new`,children:`Create a new link`})]})]}),e.destinationError?(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:e.destinationError}):e.selectedSlot?(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Matches this team, board selection, and source.`}):(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Creates a separate live URL and keeps existing review links unchanged.`})]}),e.protectedShares?(0,G.jsx)(QD,{...e}):(0,G.jsx)($D,{upgradeUrl:e.upgradeUrl}),e.publicComments?(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,G.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,G.jsx)(Y,{htmlFor:`publish-public-comments`,children:`Let people outside your organization comment`}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.publicComments.keepsExisting?`They give their name to comment. Left alone, the link keeps its current setting.`:`They give their name to comment.`})]}),(0,G.jsx)(NT,{id:`publish-public-comments`,checked:e.publicComments.on,onCheckedChange:e.onPublicCommentsChange})]}):null,e.teams.length>1&&e.teamId?(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`publish-team`,children:`Team`}),(0,G.jsxs)(bh,{value:e.teamId,onValueChange:e.onTeamChange,children:[(0,G.jsx)(Sh,{id:`publish-team`,children:(0,G.jsx)(xh,{})}),(0,G.jsx)(Ch,{children:e.teams.map(e=>(0,G.jsx)(X,{value:e.id,children:e.name},e.id))})]})]}):null]})}function QD({visibility:e,onVisibilityChange:t,teamOnlyName:n,password:r,onPasswordChange:i}){let[a,o]=(0,P.useState)(!1);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`publish-visibility`,children:`Visibility`}),(0,G.jsxs)(bh,{value:e,onValueChange:e=>t(e===`private`||e===`team`?e:`public`),children:[(0,G.jsx)(Sh,{id:`publish-visibility`,children:(0,G.jsx)(xh,{})}),(0,G.jsxs)(Ch,{children:[(0,G.jsx)(X,{value:`public`,children:XD.public}),(0,G.jsx)(X,{value:`private`,children:XD.private}),n?(0,G.jsx)(X,{value:`team`,children:XD.team(n)}):null]})]})]}),(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`publish-password`,children:`Password (optional)`}),(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(Z,{id:`publish-password`,className:`pr-10`,type:a?`text`:`password`,minLength:3,autoComplete:`new-password`,placeholder:`3+ characters`,value:r,onChange:e=>i(e.target.value)}),(0,G.jsx)(J,{type:`button`,variant:`ghost`,className:`absolute right-0 top-0 h-9 w-9 p-0`,onClick:()=>o(e=>!e),title:a?`Hide password`:`Show password`,"aria-label":a?`Hide password`:`Show password`,"aria-pressed":a,children:a?(0,G.jsx)(er,{}):(0,G.jsx)(nr,{})})]}),(0,G.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Anyone with the password can view, signed in or not. Send it separately from the link.`})]})]})}function $D({upgradeUrl:e}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`publish-visibility`,children:`Visibility`}),(0,G.jsx)(Z,{id:`publish-visibility`,readOnly:!0,value:XD.public,className:`bg-muted/40 text-muted-foreground`})]}),(0,G.jsxs)(tw,{role:`note`,"data-testid":`protected-shares-upsell`,children:[(0,G.jsx)(Qr,{}),(0,G.jsx)(nw,{children:`Private and password-protected links`}),(0,G.jsx)(rw,{className:`text-xs`,children:`Share only with your organization, or behind a password. Free accounts publish public links — upgrade your plan to unlock both.`}),e&&(0,G.jsx)(iw,{children:(0,G.jsx)(J,{size:`xs`,variant:`secondary`,asChild:!0,children:(0,G.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:`Upgrade`})})})]})]})}function eO({run:e}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 py-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(fy,{size:16}),(0,G.jsx)(`span`,{children:e.message}),e.capture?(0,G.jsxs)(`span`,{className:`text-muted-foreground tabular-nums`,children:[e.capture.done,`/`,e.capture.total]}):null]}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Capturing previews takes the longest. You can close this — the publish keeps going.`}),(0,G.jsx)(aO,{messages:e.warnings})]})}function tO({run:e,upgradeUrl:t,onInviteGuests:n}){let{result:r}=e;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,G.jsx)(On,{size:15,className:`text-emerald-600 dark:text-emerald-500`}),(0,G.jsxs)(`span`,{children:[r.created?`Published.`:`Updated the existing link.`,r.migratedComments?` Brought ${r.migratedComments} comment${r.migratedComments===1?``:`s`} over.`:``]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(Z,{readOnly:!0,value:r.shareUrl,className:`font-mono text-xs`}),(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,title:`Copy link`,onClick:()=>void rO(r.shareUrl),children:(0,G.jsx)(Wn,{})}),(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,title:`Open link`,asChild:!0,children:(0,G.jsx)(`a`,{href:r.shareUrl,target:`_blank`,rel:`noreferrer`,children:(0,G.jsx)(Qn,{})})})]}),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:iO(r)}),n?(0,G.jsxs)(J,{variant:`outline`,size:`sm`,className:`self-start`,onClick:n,"data-testid":`publish-invite-guests`,children:[(0,G.jsx)(Ao,{}),`Invite guests…`]}):null,(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[r.boards,` board`,r.boards===1?``:`s`,` · `,r.screens,` screen`,r.screens===1?``:`s`,` · `,r.files,` files · `,Math.round(r.bytes/1024),` `,`KB`,r.screenshots>0?` · ${r.screenshots} previews`:``]}),(0,G.jsx)(oO,{history:r.history,upgradeUrl:t}),(0,G.jsx)(aO,{messages:e.warnings})]})}function nO({run:e,upgradeUrl:t,onSeePublished:n,onSignIn:r}){return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[e.boardLimit?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(tw,{role:`note`,"data-testid":`board-limit-notice`,children:[(0,G.jsx)(or,{}),(0,G.jsxs)(nw,{children:[`All `,e.boardLimit.limit,` board slots on the `,SE(e.boardLimit.tier),` plan are in use`]}),(0,G.jsx)(rw,{className:`text-xs`,children:`Take one of your published boards down to free a slot, or upgrade for more. Re-publishing an existing link always works — the cap only counts new boards.`})]}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(J,{size:`sm`,onClick:n,children:`See published boards`}),t&&(0,G.jsx)(J,{size:`sm`,variant:`outline`,asChild:!0,children:(0,G.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,children:`Upgrade plan`})})]})]}):(0,G.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-destructive`,children:[(0,G.jsx)(So,{size:14,className:`mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{children:e.message})]}),e.signInRequired?(0,G.jsx)(J,{onClick:r,className:`self-start`,children:`Sign in and try again…`}):null,(0,G.jsx)(aO,{messages:e.warnings})]})}async function rO(e){try{await navigator.clipboard.writeText(e),V({kind:`success`,message:`Share link copied.`})}catch{V({kind:`info`,message:e})}}function iO(e){return e.onlyTeam?e.passwordProtected?`${e.onlyTeam}, your organization's owner and admins, or anyone with the password.`:`${e.onlyTeam}, plus your organization's owner and admins.`:e.visibility===`private`?e.passwordProtected?`Your organization, or anyone with the password.`:`Anyone signed in at your organization.`:e.passwordProtected?`Anyone with the link and the password.`:`Anyone with the link.`}function aO({messages:e}){return e.length===0?null:(0,G.jsx)(`ul`,{className:`flex flex-col gap-1 rounded-md border bg-muted/40 p-2 text-[11px] text-muted-foreground`,children:e.map(e=>(0,G.jsx)(`li`,{children:e},e))})}function oO({history:e,upgradeUrl:t}){return e?!e.retained&&e.pruned>0?(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Replaced the previous version — the free plan keeps only the latest.`,t&&(0,G.jsxs)(G.Fragment,{children:[` `,(0,G.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-4`,children:`Upgrade to keep history`}),`.`]})]}):e.retained&&e.versions>1?(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.versions,` versions kept — earlier publishes stay pinnable.`]}):null:null}function sO(e,t){let n=[];e.context.contextKnown||n.push(`board context is unknown`),e.teamId!==t.teamId&&n.push(`team differs`);let r=e=>[...new Set(e)].sort();return JSON.stringify(r(e.context.boardIds))!==JSON.stringify(r(t.boardIds))&&n.push(`board selection differs`),e.context.repo===t.repo?t.repo!==null&&(!e.context.branch||!t.branch?n.push(`branch is unavailable`):e.context.branch!==t.branch&&n.push(`branch differs`)):n.push(`repository differs`),n}function cO(e,t){return e.filter(e=>sO(e,t).length===0)}function lO(e,t){return cO(e,t).sort((e,t)=>uO(t.lastPublishedAt)-uO(e.lastPublishedAt))[0]??null}var uO=e=>{let t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:-1/0},dO=700;function fO(){let e=q(e=>e.publishOpen),t=q(e=>e.setPublishOpen),n=q(e=>e.openSignIn),r=q(e=>e.setPublishedBoardsOpen),i=q(e=>e.openGuests),a=q(e=>e.settlePublish),o=q(e=>e.design),s=q(e=>e.publishScope),c=q(e=>Ss(e.authStatus?.account?.tier)),l=q(e=>Cs(e.authStatus?.account?.tier)),u=q(e=>ws(e.authStatus?.account?.tier)),d=q(e=>wE(e.authStatus?.appUrl)),[f,p]=(0,P.useState)(null),[m,h]=(0,P.useState)({state:`idle`}),[g,_]=(0,P.useState)(``),[v,y]=(0,P.useState)([]),[b,x]=(0,P.useState)(`public`),[S,C]=(0,P.useState)(``),[w,T]=(0,P.useState)(null),[E,D]=(0,P.useState)(`new`),[O,k]=(0,P.useState)(!1),[A,j]=(0,P.useState)(!1),[M,ee]=(0,P.useState)(!1),[te,ne]=(0,P.useState)(!1),[N,re]=(0,P.useState)(null),[ie,ae]=(0,P.useState)([]),[oe,se]=(0,P.useState)([]),ce=o?.boards??[],le=(0,P.useCallback)(async e=>{ne(!0);try{h(await Sd.start(e))}catch(e){H(e,`Could not start publishing`)}finally{ne(!1)}},[]);(0,P.useEffect)(()=>{if(!e)return;_(s?s.name:o?.designName?`${o.designName} designs`:``),y(s?[s.id]:[]),se([]),x(`public`),C(``),j(!1),ee(!1),T(null),D(`new`),k(!1),ne(!1),re(null);let t=!1;return(async()=>{let[e,n]=await Promise.all([Sd.targets().catch(()=>({ready:!1,teams:[],slots:[]})),Sd.status().catch(()=>({state:`idle`}))]);if(t)return;p(e),T(e.effectiveTeamId??(e.teams.find(e=>e.isDefault)??e.teams[0])?.id??null);let r=n;if(n.state===`done`||n.state===`error`){if(await Sd.reset().catch(()=>void 0),t)return;r={state:`idle`}}h(r)})(),()=>{t=!0}},[e,o?.designName,s]),(0,P.useEffect)(()=>{m.state===`done`&&a(!0)},[m.state,a]),(0,P.useEffect)(()=>{if(!e||m.state!==`running`)return;let t=setInterval(()=>{Sd.status().then(h).catch(()=>void 0)},dO);return()=>clearInterval(t)},[e,m.state]);let ue=w??f?.effectiveTeamId??null,de=(0,P.useMemo)(()=>({boardIds:v,teamId:ue,repo:f?.provenance?.repo??null,branch:f?.provenance?.branch??null}),[v,ue,f?.provenance]),fe=(0,P.useMemo)(()=>{let e=lO(f?.slots??[],de);return e?[e]:[]},[f?.slots,de]),pe=fe.find(e=>e.slug===E)??null,me=(0,P.useMemo)(()=>JD(ie,pe?.slug??null),[ie,pe]);(0,P.useEffect)(()=>{if(!e||v.length===0){ae([]);return}let t=!0;return Promise.all(v.map(e=>ad.list(e,`open`,`shared`))).then(e=>{t&&ae(e.flat())}).catch(()=>{t&&ae([])}),()=>{t=!1}},[e,v]);let he=fe[0]?.slug??`new`;(0,P.useEffect)(()=>{O||D(he)},[O,he]),(0,P.useEffect)(()=>{E!==`new`&&!fe.some(e=>e.slug===E)&&(k(!1),D(he))},[E,fe,he]);let ge=f?.teams??[],_e=c&&l&&ge.length>1?ge.find(e=>e.id===w)?.name??null:null,ve=c?b===`team`&&!_e?`private`:b:`public`,ye=c?S:``,be=ve===`public`||ye.length>=3,xe=me.filter(e=>oe.includes(e.slug)).flatMap(e=>e.threadIds),Se=()=>{let e=pe?{mode:`update`,slug:pe.slug,expectedVersionId:pe.latestVersionId}:{mode:`new`},t=be&&(!pe||M);return{boardIds:v,...g.trim()?{title:g.trim()}:{},visibility:ve===`public`?`public`:`private`,...ve===`team`?{teamOnly:!0}:{},...ye.length>=3?{password:ye}:{},...w?{teamId:w}:{},...t?{publicComments:A}:{},destination:e,...xe.length>0?{migrateThreadIds:xe}:{}}},Ce=async()=>{ne(!0);let e=await OT(v).catch(()=>[]);e.length>0?(ne(!1),re(e)):await le(Se())},we=f===null?null:f.access??(f.ready?`ready`:`signed-out`),Te=we!==null&&we!==`ready`,Ee=!Te&&m.state===`idle`?f?.blocked??null:null,De=we===`expired`,Oe=m.state===`unavailable`,ke=ce.length>0&&v.length===0,Ae=e=>{t(!1),n({action:`publish these boards`,...e.expired?{expired:!0}:{}})};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(AT,{failures:N,verb:`Publish`,onCancel:()=>re(null),onConfirm:()=>{re(null),le(Se())}}),(0,G.jsx)(fh,{open:e,onOpenChange:e=>!e&&t(!1),children:(0,G.jsxs)(hh,{className:`sm:max-w-md`,children:[(0,G.jsxs)(gh,{children:[(0,G.jsx)(vh,{children:`Publish to velloo-cloud`}),(0,G.jsx)(yh,{children:s?`Share a rendered, commentable copy of “${s.name}” by link.`:`Share a rendered, commentable copy of these boards by link.`})]}),Oe?(0,G.jsx)(`p`,{className:`py-4 text-sm text-muted-foreground`,children:`This canvas isn't running through the velloo CLI, so it has no account to publish with.`}):Te?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 py-2`,children:[(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:De?`Your velloo-cloud session has ended. Sign in again to publish these boards.`:`Publishing needs a velloo-cloud account.`}),(0,G.jsx)(J,{onClick:()=>Ae({expired:De}),className:`self-start`,children:De?`Sign in again…`:`Sign in…`})]}):Ee?(0,G.jsxs)(`p`,{className:`py-4 text-sm text-muted-foreground`,"data-testid":`publish-blocked`,children:[Ee.charAt(0).toUpperCase()+Ee.slice(1),`.`]}):m.state===`running`?(0,G.jsx)(eO,{run:m}):m.state===`done`?(0,G.jsx)(tO,{run:m,upgradeUrl:d,onInviteGuests:m.result.created&&u&&m.result.slug?()=>{t(!1),i({slug:m.result.slug,title:g.trim()||m.result.slug})}:null}):m.state===`error`?(0,G.jsx)(nO,{run:m,upgradeUrl:d,onSeePublished:()=>{t(!1),r(!0)},onSignIn:()=>Ae({expired:m.signInRequired===`expired`})}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ZD,{title:g,onTitleChange:_,boards:ce,boardIds:v,onToggleBoard:(e,t)=>y(n=>t?[...new Set([...n,e])]:n.filter(t=>t!==e)),destinationSlug:E,onDestinationChange:e=>{k(!0),D(e)},matchingSlots:fe,selectedSlot:pe,destinationError:f?.destinationError,protectedShares:c,visibility:ve,onVisibilityChange:x,teamOnlyName:_e,password:ye,onPasswordChange:C,upgradeUrl:d,teams:ge,teamId:w,onTeamChange:T,publicComments:be?{on:A,keepsExisting:!!pe&&!M}:null,onPublicCommentsChange:e=>{ee(!0),j(e)}}),(0,G.jsx)(YD,{groups:me,chosen:oe,onToggle:(e,t)=>se(n=>t?[...n,e]:n.filter(t=>t!==e))})]}),(0,G.jsxs)(_h,{children:[(0,G.jsx)(J,{variant:`outline`,onClick:()=>t(!1),children:m.state===`done`?`Done`:`Close`}),m.state===`idle`&&!Te&&!Oe&&!Ee?(0,G.jsxs)(J,{onClick:()=>void Ce(),disabled:te||ke||!!f?.destinationError,children:[(0,G.jsx)(Ba,{}),te?`Starting…`:`Publish`]}):null,m.state===`error`?(0,G.jsx)(J,{onClick:()=>h({state:`idle`}),children:`Back`}):null]})]})})]})}function pO(e){let t=q.getState();return t.boards[e]?.name??t.design?.boards.find(t=>t.id===e)?.name??e}function mO(e){let t=e.messageIds.length;return`${t} new ${t===1?`comment`:`comments`} on ${pO(e.boardId)}`}async function hO(e){let t=q.getState(),n=e.flatMap(e=>e.messageIds);await t.addCommentsToAgent([...new Set(e.flatMap(e=>e.threadIds))].map(e=>({threadId:e,messageIds:n}))),await t.acknowledgeCommentArrivals(e.flatMap(e=>e.messageIds))}function gO(e){V({kind:`info`,title:mO(e),message:`From the shared link. Hand them to the agent when you're ready.`,ttl:1e4,action:{label:`Add to agent`,onClick:()=>void hO([e])}})}function _O({title:e,onAdd:t,onDismiss:n}){return(0,G.jsxs)(tw,{className:`relative bg-background pr-9`,"data-agent-arrival":!0,children:[(0,G.jsx)(In,{size:16,"aria-hidden":!0}),(0,G.jsx)(nw,{className:`text-xs font-medium`,children:e}),(0,G.jsxs)(rw,{className:`flex flex-col items-start gap-1.5 text-[11px]`,children:[(0,G.jsx)(`span`,{children:`From the shared link`}),(0,G.jsxs)(J,{variant:`outline`,size:`xs`,className:`bg-background`,onClick:t,children:[(0,G.jsx)(ua,{size:12,"aria-hidden":!0}),`Add to agent`]})]}),(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`absolute top-1.5 right-1.5 text-muted-foreground`,onClick:n,"aria-label":`Dismiss: ${e}`,children:(0,G.jsx)(Ho,{size:12,"aria-hidden":!0})})]})}var vO={view:nr,language:Pi,board:Pr,screen:bi,frame:fr,node:Qa,preview:Er,note:oo,comment:mi},yO={changed:`Changed`,gone:`Deleted`,resolved:`Resolved`};function bO({label:e}){let t=e.split(` › `),n=t.pop();return(0,G.jsxs)(G.Fragment,{children:[t.length?`${t.join(` › `)} › `:``,(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:n})]})}function xO({card:e,variant:t,stale:n,onAdd:r,onRemove:i,onReveal:a,title:o}){let s=vO[e.kind];if(t===`suggested`)return(0,G.jsxs)(J,{variant:`outline`,size:`xs`,className:`max-w-full border-dashed bg-transparent font-normal text-muted-foreground`,onClick:r,title:o,"aria-label":`Attach ${e.kind} ${e.label}`,"data-agent-suggestion":e.kind,children:[(0,G.jsx)(ua,{size:12,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`truncate`,children:e.label.split(` › `).pop()})]});if(t===`attached`)return(0,G.jsxs)(K,{variant:`outline`,className:`h-6 max-w-full gap-1 bg-background pl-2 font-normal ${i?`pr-0.5`:`pr-2`} ${n?`opacity-60`:``}`,title:o??e.label,"data-agent-card":e.kind,children:[(0,G.jsx)(s,{size:12,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`truncate`,children:e.label.split(` › `).pop()}),n?(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`· `,yO[n]]}):null,i?(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`size-5 rounded-full text-muted-foreground`,onClick:i,"aria-label":`Remove ${e.label}`,children:(0,G.jsx)(Ho,{size:12,"aria-hidden":!0})}):null]});let c=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(JC,{variant:`icon`,children:(0,G.jsx)(s,{size:12,className:`text-muted-foreground`,"aria-hidden":!0})}),(0,G.jsx)(YC,{className:`min-w-0`,children:(0,G.jsx)(XC,{className:`text-[11px] font-normal text-muted-foreground`,children:(0,G.jsx)(`span`,{className:`truncate`,children:(0,G.jsx)(bO,{label:e.label})})})})]}),l=`w-fit max-w-full gap-1.5 bg-background px-2 py-1`;return a?(0,G.jsx)(KC,{variant:`outline`,size:`xs`,className:l,asChild:!0,children:(0,G.jsx)(`button`,{type:`button`,onClick:a,"aria-label":`Show ${e.label} on the canvas`,children:c})}):(0,G.jsx)(KC,{variant:`outline`,size:`xs`,className:l,children:c})}function SO({card:e,stale:t,status:n,action:r}){let i=e.author??`Comment`;return(0,G.jsxs)(KC,{variant:`outline`,size:`xs`,className:`bg-background ${t?`opacity-60`:``}`,"data-agent-comment":e.ref.threadId,"aria-label":`Comment by ${i}: ${e.detail??``}`,children:[(0,G.jsx)(JC,{className:`self-start`,children:(0,G.jsx)(gE,{className:`size-5`,size:`sm`,children:(0,G.jsx)(_E,{className:`text-[10px]`,children:i.charAt(0).toUpperCase()})})}),(0,G.jsxs)(YC,{className:`min-w-0 gap-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(XC,{className:`truncate text-xs`,children:i}),t?(0,G.jsx)(K,{variant:`secondary`,className:`h-4 px-1.5 text-[10px]`,children:yO[t]}):null,n]}),e.detail?(0,G.jsx)(ZC,{className:`line-clamp-2 text-xs text-foreground`,children:e.detail}):null,(0,G.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:e.label})]}),r?(0,G.jsx)(QC,{className:`self-start`,children:r}):null]})}function CO(e){let t=/^\/(\S*)$/.exec(e);return t?(t[1]??``).toLowerCase():null}function wO(e,t,n){if(!e)return[];let r=[];e.models.length>0&&r.push({name:`model`,description:n?`Switch the model (now ${n})`:`Switch the model`,velloo:`model`}),e.mcp&&r.push({name:`mcp`,description:`See the agent's MCP servers`,velloo:`mcp`});let i=new Set(r.map(e=>e.name)),a=[...r,...e.commands.filter(e=>!i.has(e.name))],o=a.filter(e=>e.name.toLowerCase().startsWith(t)),s=a.filter(e=>!e.name.toLowerCase().startsWith(t)&&e.name.toLowerCase().includes(t));return[...o,...s]}function TO({id:e,entries:t,active:n,onPick:r,onHover:i}){return(0,P.useEffect)(()=>{document.getElementById(`${e}-${n}`)?.scrollIntoView({block:`nearest`})},[e,n]),(0,G.jsx)(`div`,{id:e,role:`listbox`,"aria-label":`Commands`,className:`max-h-56 overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md`,"data-agent-slash-menu":!0,children:t.map((t,a)=>(0,G.jsxs)(`div`,{id:`${e}-${a}`,role:`option`,tabIndex:-1,"aria-selected":a===n,className:`flex cursor-default flex-col gap-0.5 rounded-sm px-2 py-1.5 text-xs ${a===n?`bg-accent text-accent-foreground`:``}`,onMouseDown:e=>e.preventDefault(),onMouseMove:()=>i(a),onClick:()=>r(t),children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[`/`,t.name]}),t.argumentHint?(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:t.argumentHint}):null,t.velloo?(0,G.jsx)(K,{variant:`outline`,className:`ml-auto h-4 px-1.5 text-[10px] font-normal`,children:`Velloo`}):null]}),t.description?(0,G.jsx)(`span`,{className:`line-clamp-2 text-[11px] text-muted-foreground`,children:t.description}):null]},t.name))})}function EO({title:e,onClose:t,actions:n,children:r,footer:i}){return(0,G.jsxs)(`section`,{"aria-label":e,className:`flex max-h-72 flex-col rounded-md border bg-popover text-popover-foreground shadow-sm`,"data-agent-control":e,onKeyDown:e=>{e.key===`Escape`&&t()},children:[(0,G.jsxs)(`header`,{className:`flex items-center gap-1 border-b px-2 py-1.5`,children:[(0,G.jsx)(`h3`,{className:`flex-1 text-xs font-medium`,children:e}),n,(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground`,"aria-label":`Close ${e}`,onClick:t,children:(0,G.jsx)(Ho,{size:12,"aria-hidden":!0})})]}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-1`,children:r}),i?(0,G.jsx)(`p`,{className:`border-t px-2 py-1.5 text-[11px] text-muted-foreground`,children:i}):null]})}function DO({controls:e,providerLabel:t,onPick:n,onClose:r}){let[i,a]=(0,P.useState)(null),o=(0,P.useRef)(null);return(0,P.useEffect)(()=>{let e=o.current?.querySelectorAll(`[role="radio"]`);(o.current?.querySelector(`[aria-checked="true"]`)??e?.[0])?.focus()},[]),(0,G.jsx)(EO,{title:`Model`,onClose:r,footer:`${t} uses it from your next message.`,children:(0,G.jsx)(`div`,{ref:o,role:`radiogroup`,"aria-label":`Model`,className:`flex flex-col`,children:e.models.map(t=>{let o=t.id===e.model;return(0,G.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":o,disabled:i!==null,className:`flex items-start gap-2 rounded-sm px-2 py-1.5 text-left text-xs outline-none hover:bg-accent focus-visible:bg-accent disabled:opacity-60`,onClick:async()=>{if(o)return r();a(t.id);let e=await n(t.id);a(null),e&&r()},children:[(0,G.jsx)(`span`,{className:`mt-0.5 flex size-3.5 shrink-0 items-center justify-center`,children:i===t.id?(0,G.jsx)(MT,{className:`size-3 motion-reduce:animate-none`}):o?(0,G.jsx)(I,{size:14,"aria-hidden":!0}):null}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{className:`font-medium`,children:t.label}),t.description?(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t.description}):null]})]},t.id)})})})}var OO={connected:{label:`Connected`,dot:`bg-emerald-500`},starting:{label:`Starting`,dot:`bg-amber-500`},"needs-auth":{label:`Needs sign-in`,dot:`bg-amber-500`},failed:{label:`Failed`,dot:`bg-destructive`},disabled:{label:`Off`,dot:`bg-muted-foreground/50`},unknown:{label:`Unknown`,dot:`bg-muted-foreground/50`}};function kO({providerLabel:e,actions:t,load:n,act:r,onClose:i}){let[a,o]=(0,P.useState)(void 0),[s,c]=(0,P.useState)(null),l=(0,P.useCallback)(async()=>o(await n()),[n]);(0,P.useEffect)(()=>{l()},[l]);let u=async(e,t)=>{c(e),await r(e,t)&&await l(),c(null)},d=a&&[...a].sort((e,t)=>Number(!!t.velloo)-Number(!!e.velloo));return(0,G.jsx)(EO,{title:`MCP servers`,onClose:i,actions:(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground`,"aria-label":`Check the servers again`,disabled:a===void 0,onClick:()=>{o(void 0),l()},children:(0,G.jsx)(Ea,{size:12,"aria-hidden":!0})}),footer:`From ${e}'s own settings, plus the one Velloo adds for this design.`,children:d===void 0?(0,G.jsx)(`div`,{className:`flex justify-center p-3`,children:(0,G.jsx)(MT,{className:`size-4 motion-reduce:animate-none`})}):d===null?(0,G.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:`Couldn't read the servers.`}):d.length===0?(0,G.jsx)(`p`,{className:`p-2 text-xs text-muted-foreground`,children:`No MCP servers.`}):(0,G.jsx)(`ul`,{className:`flex flex-col`,children:d.map(e=>{let n=OO[e.status],r=e.status===`disabled`;return(0,G.jsxs)(`li`,{className:`flex items-center gap-2 rounded-sm px-2 py-1.5 text-xs`,"data-mcp-server":e.name,children:[(0,G.jsx)(ca,{size:12,className:`shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium`,children:e.name}),e.velloo?(0,G.jsx)(K,{variant:`secondary`,className:`h-4 px-1.5 text-[10px] font-normal`,children:`This design`}):null]}),(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${n.dot}`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`shrink-0 whitespace-nowrap`,children:n.label}),e.tools&&e.status===`connected`?(0,G.jsxs)(`span`,{className:`shrink-0 whitespace-nowrap`,children:[`· `,e.tools,` `,e.tools===1?`tool`:`tools`]}):null,e.detail?(0,G.jsxs)(`span`,{className:`truncate`,children:[`· `,e.detail]}):null]})]}),s===e.name?(0,G.jsx)(MT,{className:`size-3 motion-reduce:animate-none`}):(0,G.jsxs)(G.Fragment,{children:[t.includes(`reconnect`)&&!r?(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground`,"aria-label":`Reconnect ${e.name}`,title:`Reconnect`,onClick:()=>void u(e.name,`reconnect`),children:(0,G.jsx)(Ea,{size:12,"aria-hidden":!0})}):null,t.includes(r?`enable`:`disable`)&&!e.velloo?(0,G.jsx)(NT,{size:`sm`,checked:!r,"aria-label":`${e.name} on for this session`,onCheckedChange:t=>void u(e.name,t?`enable`:`disable`)}):null]})]},e.name)})})})}function AO(e){let{cards:t,attachable:n,running:r,providerLabel:i}=e,a=new Set(t.map(Zf)),o=e.selection&&!a.has(Zf(e.selection))?e.selection:null,s=(0,P.useId)(),c=(0,P.useId)(),l=CO(e.text),[u,d]=(0,P.useState)(0),[f,p]=(0,P.useState)(!1),m=l!==null&&!f?wO(e.controls,l,e.modelLabel):[],h=m.length>0;(0,P.useEffect)(()=>{d(0),l===null&&p(!1)},[l]);let g=t=>{t.velloo?(e.onText(``),e.onControl?.(t.velloo)):e.onText(`/${t.name} `)},_=t.filter(e=>e.kind===`comment`),v=t.filter(e=>e.kind!==`comment`),y=e.text.trim().length>0||t.length>0,b=y&&!e.disabled&&!(r&&e.followUp===`none`),x=_.length?`Add instructions, or send the comments on their own`:r?e.followUp===`steer`?`Reply to steer ${i}…`:`Queue a follow-up for ${i}…`:e.controls?`Ask ${i}, or type / for commands`:`Ask ${i}…`,S=()=>{let t=e.text.trim().slice(1),n=wO(e.controls,t).find(e=>e.velloo&&e.name===t);if(e.text.trim().startsWith(`/`)&&n)return g(n);b&&e.onSend()},C=e=>{if(h&&!e.metaKey&&!e.ctrlKey){let t={ArrowDown:1,ArrowUp:-1}[e.key];if(t){e.preventDefault(),d(e=>(e+t+m.length)%m.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault();let t=m[Math.min(u,m.length-1)];t&&g(t);return}if(e.key===`Escape`){e.preventDefault(),p(!0);return}}e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),S())};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border p-3`,"data-agent-composer":!0,children:[e.queued.length>0?(0,G.jsx)(`ul`,{className:`flex flex-col gap-1`,"aria-label":`Queued messages`,children:e.queued.map(t=>(0,G.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(Mn,{size:12,className:`shrink-0`,"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[`Queued: `,t.text||`comments`]}),(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`size-5 text-muted-foreground`,onClick:()=>e.onDequeue(t.id),"aria-label":`Remove queued message ${t.text}`,children:(0,G.jsx)(Ho,{size:12,"aria-hidden":!0})})]},t.id))}):null,_.length>0?(0,G.jsxs)(`section`,{className:`flex flex-col gap-1.5`,"aria-label":`Comments attached`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,G.jsxs)(`span`,{children:[_.length,` `,_.length===1?`comment`:`comments`,` attached`]}),(0,G.jsx)(J,{variant:`ghost`,size:`xs`,className:`h-5 px-1 text-[11px] font-normal text-muted-foreground`,onClick:e.onClearComments,children:`Clear`})]}),(0,G.jsx)(`ul`,{className:`flex max-h-64 flex-col gap-1.5 overflow-y-auto`,children:_.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(SO,{card:t,stale:e.staleness(t),action:(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground`,onClick:()=>e.onRemove(t),"aria-label":`Remove the comment by ${t.author??`someone`}`,children:(0,G.jsx)(Ho,{size:12,"aria-hidden":!0})})})},`${t.ref.threadId}:${t.ref.messageId}`))})]}):null,v.length>0||o||e.view?(0,G.jsxs)(`fieldset`,{className:`flex flex-wrap items-center gap-1.5`,"aria-label":`Context`,children:[e.view?(0,G.jsx)(xO,{card:{...e.view,label:`Viewing ${e.view.label}`},variant:`attached`,title:e.view.kind===`language`?`Sent with every message, so ${i} knows you're working on the design language.`:`Sent with every message, so ${i} knows which board you mean. Add a frame or what you selected to point at something in it.`}):null,o?(0,G.jsx)(xO,{card:o,variant:`suggested`,title:`Add the selected ${o.label.split(` › `).pop()} to your message`,onAdd:()=>e.onAttach(o)}):null,v.map(t=>(0,G.jsx)(xO,{card:t,variant:`attached`,stale:e.staleness(t),onRemove:()=>e.onRemove(t),onReveal:e.onReveal?()=>e.onReveal?.(t):void 0},`a:${t.kind}:${t.label}`))]}):null,h?(0,G.jsx)(TO,{id:c,entries:m,active:Math.min(u,m.length-1),onPick:g,onHover:d}):null,(0,G.jsxs)(Hg,{children:[(0,G.jsxs)(`label`,{htmlFor:s,className:`sr-only`,children:[`Message to `,i]}),(0,G.jsx)(Jg,{id:s,className:`max-h-48 min-h-16 text-sm`,placeholder:x,value:e.text,disabled:e.disabled,onChange:t=>e.onText(t.currentTarget.value),onKeyDown:C,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":h,"aria-controls":h?c:void 0,"aria-activedescendant":h?`${c}-${Math.min(u,m.length-1)}`:void 0}),(0,G.jsxs)(Wg,{className:`gap-1`,align:`block-end`,children:[(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(Kg,{size:`icon-xs`,variant:`ghost`,"aria-label":`Attach frames from this board`,title:`Attach frames from this board`,children:(0,G.jsx)(fr,{size:14,"aria-hidden":!0})})}),(0,G.jsx)(xv,{align:`start`,className:`max-h-80 w-80 max-w-[calc(100vw-2rem)] overflow-y-auto`,children:n.length===0?(0,G.jsx)(Q,{disabled:!0,children:`Open a board to attach its frames`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Tv,{className:`text-[11px] font-medium text-muted-foreground`,children:`Attach from this board`}),n.map((t,r)=>{let i=a.has(Zf(t)),o=t.kind===`note`&&n[r-1]?.kind!==`note`;return(0,G.jsxs)(`div`,{className:`contents`,children:[o&&r>0?(0,G.jsx)(Ev,{}):null,(0,G.jsx)(Sv,{checked:i,onSelect:n=>{n.preventDefault(),i?e.onRemove(t):e.onAttach(t)},children:(0,G.jsx)(`span`,{className:`line-clamp-2`,children:t.label})})]},Zf(t))})]})})]}),e.controls?.modes?.length?(0,G.jsx)(jO,{modes:e.controls.modes,mode:e.controls.mode,fallback:e.modeFallback,providerLabel:i,onMode:t=>e.onMode?.(t)}):null,(0,G.jsx)(NE,{className:`ml-auto`,"aria-hidden":!0,title:`Enter sends · Shift+Enter for a new line`,children:(0,G.jsx)(ME,{children:`↵`})}),r&&!y?(0,G.jsxs)(Kg,{variant:`outline`,size:`xs`,onClick:e.onStop,"aria-label":`Stop the agent's turn`,children:[(0,G.jsx)(io,{size:12,"aria-hidden":!0}),`Stop`]}):(0,G.jsxs)(Kg,{variant:`default`,size:`xs`,onClick:S,disabled:!b,children:[(0,G.jsx)(Xt,{size:12,"aria-hidden":!0}),r?e.followUp===`steer`?`Steer`:`Queue`:`Send`]})]})]})]})}function jO({modes:e,mode:t,fallback:n,providerLabel:r,onMode:i}){let a=e.find(e=>e.id===t)?.label??t??n??`Mode`;return(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsxs)(Kg,{size:`xs`,variant:`ghost`,className:`min-w-0 gap-1 px-1.5 font-normal text-muted-foreground`,"aria-label":`Permission mode: ${a}. Change it`,"data-agent-mode":t,children:[(0,G.jsx)(Ha,{size:12,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`truncate`,children:a}),(0,G.jsx)(gn,{size:12,className:`opacity-60`,"aria-hidden":!0})]})}),(0,G.jsxs)(xv,{align:`start`,className:`w-72`,children:[(0,G.jsxs)(Tv,{className:`text-[11px] font-medium text-muted-foreground`,children:[`What `,r,` may do without asking`]}),(0,G.jsx)(Cv,{value:t??``,onValueChange:i,children:e.map(e=>(0,G.jsx)(wv,{value:e.id,className:`items-start`,children:(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{children:e.label}),e.description?(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.description}):null]})},e.id))})]})]})}function MO(e){let t=e.replace(/\r\n?/g,`
42
+ `).split(`
43
+ `),n=[],r=[],i=()=>{r.length&&n.push({kind:`p`,text:r.join(`
44
+ `)}),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=a.match(/^\s*```(\S*)\s*$/);if(o){i();let r=[];for(e++;e<t.length&&!/^\s*```\s*$/.test(t[e]);)r.push(t[e++]);n.push({kind:`code`,lang:o[1]??``,text:r.join(`
45
+ `)});continue}let s=a.match(/^(#{1,4})\s+(.*)$/);if(s){i(),n.push({kind:`h`,level:s[1]?.length??1,text:s[2]??``});continue}let c=a.match(/^\s*[-*+]\s+(.*)$/),l=a.match(/^\s*\d+[.)]\s+(.*)$/),u=c??l;if(u){i();let e=c?`ul`:`ol`,t=n.at(-1);t&&t.kind===e?t.items.push(u[1]??``):n.push({kind:e,items:[u[1]??``]})}else a.trim()?r.push(a):i()}return i(),n}function NO(e){let t=[],n=/`([^`]+)`|\*\*([^*]+)\*\*|\*([^*\s][^*]*)\*|\[([^\]]+)\]\(([^)\s]+)\)/g,r=0,i=0;for(let a of e.matchAll(n)){let n=a.index??0;if(n>r&&t.push(e.slice(r,n)),a[1]!==void 0)t.push((0,G.jsx)(`code`,{className:`rounded-sm bg-muted px-1 font-mono text-xs`,children:a[1]},i++));else if(a[2]!==void 0)t.push((0,G.jsx)(`strong`,{children:a[2]},i++));else if(a[3]!==void 0)t.push((0,G.jsx)(`em`,{children:a[3]},i++));else{let e=Rh(a[5]??``);t.push(e?(0,G.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`underline underline-offset-2`,children:a[4]},i++):a[4])}r=n+a[0].length}return r<e.length&&t.push(e.slice(r)),t}function PO({text:e,className:t=``}){return(0,G.jsx)(`div`,{className:`flex min-w-0 flex-col gap-2 wrap-break-word ${t}`,"data-agent-text":!0,children:MO(e).map((e,t)=>(0,G.jsx)(P.Fragment,{children:FO(e)},t))})}function FO(e){switch(e.kind){case`p`:return(0,G.jsx)(`p`,{className:`whitespace-pre-wrap`,children:NO(e.text)});case`h`:{let t=e.level<=2?`h3`:`h4`;return(0,G.jsx)(t,{className:e.level<=2?`font-semibold`:`font-medium`,children:NO(e.text)})}case`ul`:case`ol`:{let t=e.kind;return(0,G.jsx)(t,{className:`flex flex-col gap-1 pl-4 marker:text-muted-foreground ${e.kind===`ul`?`list-disc`:`list-decimal`}`,children:e.items.map((e,t)=>(0,G.jsx)(`li`,{children:NO(e)},t))})}case`code`:return(0,G.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-md bg-muted px-2 py-1.5 font-mono text-[11px] leading-relaxed`,children:(0,G.jsx)(`code`,{children:e.text})})}}var IO={codex:{path:`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`},"claude-code":{path:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`,color:`#D97757`},opencode:{path:`M22 24H2V0h20zM17 4.8H7v14.4h10z`},"github-copilot":{path:`M23.922 16.997C23.061 18.492 18.063 22.02 12 22.02 5.937 22.02.939 18.492.078 16.997A.641.641 0 0 1 0 16.741v-2.869a.883.883 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.098 10.098 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952C7.255 2.937 9.248 1.98 11.978 1.98c2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.841.841 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256Zm-11.75-5.992h-.344a4.359 4.359 0 0 1-.355.508c-.77.947-1.918 1.492-3.508 1.492-1.725 0-2.989-.359-3.782-1.259a2.137 2.137 0 0 1-.085-.104L4 11.746v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.359 4.359 0 0 1-.355-.508Zm2.328 3.25c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm-5 0c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm3.313-6.185c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z`},cursor:{path:`M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23`},"qwen-code":{path:`M23.919 14.545 20.817 9.17l1.47-2.544a.56.56 0 0 0 0-.566l-1.633-2.83a.57.57 0 0 0-.49-.283h-6.207L12.487.402a.57.57 0 0 0-.49-.284H8.732a.56.56 0 0 0-.49.284L5.139 5.775h-2.94a.56.56 0 0 0-.49.284L.077 8.887a.56.56 0 0 0 0 .567L3.18 14.83l-1.47 2.545a.56.56 0 0 0 0 .566l1.634 2.83a.57.57 0 0 0 .49.283h6.205l1.47 2.545a.57.57 0 0 0 .49.284h3.266a.57.57 0 0 0 .49-.284l3.104-5.375h2.94a.57.57 0 0 0 .49-.283l1.634-2.828a.55.55 0 0 0-.004-.568M8.733.686l1.634 2.828-1.634 2.828H21.8L20.164 9.17H7.425L5.63 6.06Zm1.306 19.801-6.205-.002 1.634-2.83h3.265L2.201 6.344h3.267q3.182 5.517 6.367 11.032zm10.124-5.66L18.53 12l-6.532 11.315-1.634-2.83c2.129-3.673 4.25-7.351 6.373-11.028h3.592l3.102 5.374z`},kimi:{path:`M21.765.351C22.998.351 24 1.353 24 2.586S22.998 4.82 21.765 4.82h-1.974c-.15 0-.26-.12-.26-.26V2.586A2.237 2.237 0 0 1 21.765.35M9.41 13.388l8.447-8.377c.16-.16.07-.471-.14-.471h-4.55s-.1.02-.14.06l-9.099 9.029c-.14.14-.35.02-.35-.21V4.81c0-.15-.1-.27-.221-.27H.22c-.12 0-.22.12-.22.27v18.57c0 .15.1.27.22.27h3.137c.12 0 .22-.12.22-.27v-3.79c0-.08.03-.16.08-.21l2.826-2.796c.07-.07.16-.08.241-.03l7.546 5.551a8.9 8.9 0 0 0 4.018 1.493c.12.01.23-.11.23-.27V19.76c0-.14-.08-.25-.19-.26a5.8 5.8 0 0 1-2.355-.942l-6.533-4.73c-.14-.09-.15-.32-.03-.441`},"mistral-vibe":{path:`M17.143 3.429v3.428h-3.429v3.429h-3.428V6.857H6.857V3.43H3.43v13.714H0v3.428h10.286v-3.428H6.857v-3.429h3.429v3.429h3.429v-3.429h3.428v3.429h-3.428v3.428H24v-3.428h-3.43V3.429z`,color:`#FA520F`},cline:{path:`m23.365 13.556-1.442-2.895V8.994c0-2.764-2.218-5.002-4.954-5.002h-2.464c.178-.367.276-.779.276-1.213A2.77 2.77 0 0 0 12.018 0a2.77 2.77 0 0 0-2.763 2.779c0 .434.098.846.276 1.213H7.067c-2.736 0-4.954 2.238-4.954 5.002v1.667L.64 13.549c-.149.29-.149.636 0 .927l1.472 2.855v1.667C2.113 21.762 4.33 24 7.067 24h9.902c2.736 0 4.954-2.238 4.954-5.002V17.33l1.44-2.865c.143-.286.143-.622.002-.91m-12.854 2.36a2.27 2.27 0 0 1-2.261 2.273 2.27 2.27 0 0 1-2.261-2.273v-4.042A2.27 2.27 0 0 1 8.249 9.6a2.267 2.267 0 0 1 2.262 2.274zm7.285 0a2.27 2.27 0 0 1-2.26 2.273 2.27 2.27 0 0 1-2.262-2.273v-4.042A2.267 2.267 0 0 1 15.535 9.6a2.267 2.267 0 0 1 2.261 2.274z`},gemini:{path:`M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81`,color:`#8E75B2`}};function LO({provider:e,size:t=16}){let n=IO[e];return n?(0,G.jsx)(`svg`,{viewBox:`0 0 24 24`,width:t,height:t,fill:n.color??`currentColor`,"aria-hidden":!0,"data-provider-logo":e,className:`shrink-0`,children:(0,G.jsx)(`path`,{d:n.path})}):(0,G.jsx)(no,{size:t,"aria-hidden":!0})}function RO(e,t){let n=t.own.trim();return e.multiSelect?n?[...t.picked,n]:t.picked:n?[n]:t.picked.slice(0,1)}function zO({request:e,providerLabel:t,onAnswer:n,onSkip:r}){let[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)({}),c=`approval-${e.id}`,l=e=>o[e.id]??{picked:[],own:``},u=(e,t)=>s(n=>({...n,[e.id]:{...l(e),...t}})),d=e.questions.every(e=>RO(e,l(e)).length>0),f=t=>{t.preventDefault(),!i&&d&&(a(!0),n(Object.fromEntries(e.questions.map(e=>[e.id,RO(e,l(e))]))))},p=()=>{i||(a(!0),r())};return(0,G.jsxs)(pC,{size:`sm`,role:`group`,"aria-labelledby":c,className:`min-h-0 shrink gap-3 bg-accent/60 ring-1 ring-primary dark:bg-accent`,"data-agent-approval":`question`,children:[(0,G.jsxs)(mC,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground`,children:(0,G.jsx)(ui,{size:14,"aria-hidden":!0})}),(0,G.jsxs)(hC,{id:c,className:`text-sm`,children:[t,` is asking`]})]}),(0,G.jsx)(_C,{className:`flex min-h-0 flex-col`,children:(0,G.jsxs)(`form`,{className:`flex min-h-0 flex-col gap-3`,onSubmit:f,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),p())},children:[(0,G.jsx)(`div`,{className:`-mx-1 flex max-h-[45vh] min-h-24 shrink flex-col gap-4 overflow-y-auto px-1 py-0.5`,children:e.questions.map(e=>(0,G.jsx)(BO,{question:e,reply:l(e),disabled:i,onChange:t=>u(e,t)},e.id))}),(0,G.jsxs)(`div`,{className:`grid shrink-0 grid-cols-2 gap-1.5`,children:[(0,G.jsxs)(J,{type:`submit`,size:`sm`,className:`justify-between`,disabled:i||!d,children:[(0,G.jsx)(`span`,{children:`Answer`}),(0,G.jsx)(ME,{className:`bg-primary-foreground/10 text-primary-foreground`,children:`↵`})]}),(0,G.jsxs)(J,{type:`button`,size:`sm`,variant:`outline`,className:`justify-between bg-background`,disabled:i,onClick:p,children:[(0,G.jsx)(`span`,{children:`Skip`}),(0,G.jsx)(ME,{children:`Esc`})]})]})]})})]})}function BO({question:e,reply:t,disabled:n,onChange:r}){let i=(0,P.useId)(),a=e.multiSelect===!0,o=t.own.trim().length>0,s=e=>{if(!a)return r({picked:[e],own:``});r({picked:t.picked.includes(e)?t.picked.filter(t=>t!==e):[...t.picked,e]})};return(0,G.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-2`,disabled:n,children:[(0,G.jsxs)(`legend`,{className:`mb-2 flex flex-col gap-1`,children:[e.header?(0,G.jsx)(K,{variant:`secondary`,className:`w-fit`,children:e.header}):null,(0,G.jsx)(`span`,{className:`text-sm leading-snug font-medium`,children:e.question}),a?(0,G.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Pick any that apply.`}):null]}),e.options.map(e=>{let n=t.picked.includes(e.label)&&(a||!o);return(0,G.jsxs)(`label`,{className:W(`relative flex cursor-pointer items-start gap-2.5 rounded-md border bg-background px-2.5 py-2 transition-colors`,`hover:border-ring has-focus-visible:ring-[3px] has-focus-visible:ring-ring/50`,n&&`border-primary ring-1 ring-primary`),children:[(0,G.jsx)(`input`,{type:a?`checkbox`:`radio`,name:i,checked:n,onChange:()=>s(e.label),className:`sr-only`}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:W(`mt-0.5 flex size-4 shrink-0 items-center justify-center border`,a?`rounded-sm`:`rounded-full`,n&&`border-primary bg-primary text-primary-foreground`),children:n?(0,G.jsx)(I,{className:`size-3`}):null}),(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{className:`text-xs font-medium leading-snug`,children:e.label}),e.description?(0,G.jsx)(`span`,{className:`text-[11px] leading-snug text-muted-foreground`,children:e.description}):null]})]},e.label)}),e.other||e.options.length===0?(0,G.jsx)(Z,{type:e.secret?`password`:`text`,"aria-label":e.options.length?`${e.question} — in your own words`:e.question,placeholder:e.options.length?`Or answer in your own words…`:`Your answer…`,value:t.own,onChange:e=>r({own:e.target.value}),className:`h-8 bg-background text-xs`,autoComplete:`off`}):null]})}var VO=`velloo`,HO=new Set([`read_velloo`,`call_velloo`,`run_velloo_plan`]),UO=/^(get_|list_|find_|inspect|screenshot|compare_to_url|emit_|render_snippet|preview_status|check_components|score_|component_status|operation_schema)/;function WO(e){return e.server===VO?HO.has(e.name)?e.input?.match(/"operation"\s*:\s*"([^"]+)"/)?.[1]??e.name:e.name:null}function GO(e){if(e.kind!==`tool`||e.server!==VO||!e.input)return null;let t=t=>e.input?.match(RegExp(`"${t}"\\s*:\\s*"([^"]+)"`))?.[1],n={},r=t(`screenId`),i=t(`boardId`),a=t(`frameId`);return r&&(n.screenId=r),i&&(n.boardId=i),a&&(n.frameId=a),r||i?n:null}function KO(e){let{boardId:t,screenId:n,frameId:r,path:i}=e.ref;return{...t?{boardId:t}:{},...n?{screenId:n}:{},...r?{frameId:r}:{},...i===void 0?{}:{path:i}}}var qO=e=>{if(e.kind!==`tool`)return!1;let t=WO(e);return t===null||e.name===`read_velloo`?!1:!UO.test(t)},JO=new Set([`command`,`file-change`,`tool`,`subagent`,`reasoning`,`plan`]);function YO(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function XO(e){let t=e.filter(e=>e.kind===`command`&&e.status!==`declined`).length,n=e.filter(e=>`status`in e&&e.status===`declined`).length,r=new Set(e.flatMap(e=>e.kind===`file-change`&&e.status!==`declined`?e.changes.map(e=>e.path):[])).size,i=e.filter(qO).length,a=e.filter(e=>e.kind===`tool`&&WO(e)!==null&&!qO(e)).length,o=e.filter(e=>e.kind===`tool`&&WO(e)===null).length,s=e.filter(e=>e.kind===`subagent`).length,c=[t&&`Ran ${YO(t,`command`)}`,r&&`edited ${YO(r,`file`)}`,i&&YO(i,`design edit`),a&&!i&&`looked at the design`,o&&`used ${YO(o,`tool`)}`,s&&YO(s,`subagent`),n&&`${n} declined`].filter(Boolean).join(` · `)||`Thought it through`;return c.charAt(0).toUpperCase()+c.slice(1)}function ZO(e,t){return t&&e.startsWith(`${t.replace(/\/$/,``)}/`)?e.slice(t.replace(/\/$/,``).length+1):QO(e)}function QO(e){return e.replace(/^\/(Users|home)\/[^/]+/,`~`)}function $O(e){let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m ${String(t%60).padStart(2,`0`)}s`}function ek(e){let t=0,n=0;for(let r of e?.split(`
46
+ `)??[])r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return{added:t,removed:n}}function tk(e,t){switch(e.kind){case`command`:return(0,G.jsxs)(G.Fragment,{children:[`Running `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.command})]});case`file-change`:return(0,G.jsxs)(G.Fragment,{children:[`Editing`,` `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.changes[0]?ZO(e.changes[0].path,t):`a file`})]});case`tool`:{let t=WO(e);return t?`Editing the design (${t})`:`Using ${e.name}`}case`subagent`:return`Subagent: ${e.description}`;case`reasoning`:return`Thinking`;default:return`Working`}}var nk=`flex flex-col gap-1.5 px-2.5 py-2 [&+&]:border-t [&+&]:border-border`;function rk({item:e}){if(e.status===`running`)return(0,G.jsx)(MT,{className:`size-3 shrink-0 motion-reduce:animate-none`,"aria-label":`Running`});if(e.status===`declined`)return(0,G.jsx)(K,{variant:`outline`,className:`h-4 px-1.5 text-[10px]`,children:`Declined`});let t=e.status===`failed`;return(0,G.jsxs)(K,{variant:t?`destructive`:`secondary`,className:`h-4 gap-0.5 px-1.5 font-mono text-[10px]`,children:[t?(0,G.jsx)(An,{size:10}):(0,G.jsx)(I,{size:10}),e.exitCode!==void 0&&e.exitCode!==null?`exit ${e.exitCode}`:t?`failed`:`done`]})}function ik({item:e}){let[t,n]=(0,P.useState)(!1),r=e.output.trimEnd().split(`
47
+ `).filter(Boolean);return(0,G.jsxs)(`div`,{className:nk,"data-agent-step":`command`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(no,{size:14,className:`shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px]`,title:e.command,children:e.command}),(0,G.jsx)(rk,{item:e})]}),r.length>0?(0,G.jsx)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,"aria-label":t?`Hide output`:`Show output`,className:`ml-[22px] flex flex-col overflow-hidden rounded-md bg-muted px-2 py-1.5 text-left font-mono text-[10.5px] leading-relaxed text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:t?(0,G.jsxs)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-all`,children:[e.outputDropped?`… ${e.outputDropped.toLocaleString()} characters earlier\n`:``,e.output]}):r.slice(-2).map((e,t)=>(0,G.jsx)(`span`,{className:`truncate`,children:e},t))}):null]})}function ak({diff:e,limit:t}){let n=e.split(`
48
+ `).filter(e=>!e.startsWith(`+++`)&&!e.startsWith(`---`)),r=t?n.filter(e=>e.startsWith(`+`)||e.startsWith(`-`)).slice(0,t):n;return(0,G.jsx)(G.Fragment,{children:r.map((e,t)=>{let n=e.startsWith(`+`),r=e.startsWith(`-`);return(0,G.jsxs)(`span`,{className:`block truncate px-2 ${n?`bg-accent text-accent-foreground`:r?`bg-muted text-muted-foreground`:`text-muted-foreground`}`,children:[n?`+ `:r?`− `:` `,e.slice(n||r||e.startsWith(` `)?1:0)]},t)})})}function ok({item:e,cwd:t}){return(0,G.jsx)(G.Fragment,{children:e.changes.map(n=>(0,G.jsx)(sk,{change:n,status:e.status,cwd:t},n.path))})}function sk({change:e,status:t,cwd:n}){let[r,i]=(0,P.useState)(!1),{added:a,removed:o}=ek(e.diff);return(0,G.jsxs)(`div`,{className:nk,"data-agent-step":`file-change`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ir,{size:14,className:`shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px]`,title:e.path,children:ZO(e.path,n)}),t===`running`?(0,G.jsx)(MT,{className:`size-3 shrink-0 motion-reduce:animate-none`}):null,t===`declined`?(0,G.jsx)(K,{variant:`outline`,className:`h-4 px-1.5 text-[10px]`,children:`Declined`}):e.change===`add`?(0,G.jsx)(K,{variant:`outline`,className:`h-4 px-1.5 text-[10px]`,children:`New`}):e.change===`delete`?(0,G.jsx)(K,{variant:`outline`,className:`h-4 px-1.5 text-[10px]`,children:`Deleted`}):null,a||o?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] tabular-nums`,children:[`+`,a]}),(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] tabular-nums text-muted-foreground`,children:[`−`,o]})]}):null]}),e.diff?(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),"aria-expanded":r,"aria-label":r?`Hide the diff of ${e.path}`:`Show the diff of ${e.path}`,className:`ml-[22px] flex flex-col overflow-hidden rounded-md border border-border text-left font-mono text-[10.5px] leading-relaxed outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:r?(0,G.jsxs)(`span`,{className:`block max-h-72 overflow-auto`,children:[(0,G.jsx)(ak,{diff:e.diff}),e.diffTruncated?(0,G.jsx)(`span`,{className:`block px-2 text-muted-foreground`,children:`… diff cut short`}):null]}):(0,G.jsx)(ak,{diff:e.diff,limit:3})}):null]})}function ck({item:e,onReveal:t}){let n=WO(e),r=GO(e),i=r?.screenId??r?.boardId;return(0,G.jsxs)(`div`,{className:nk,"data-agent-step":`tool`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n?(0,G.jsx)(ea,{size:14,className:`shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,G.jsx)(Bo,{size:14,className:`shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[11px]`,title:e.input,children:[(0,G.jsx)(`span`,{className:`font-mono`,children:n?`velloo.${n}`:e.server?`${e.server}.${e.name}`:e.name}),i?` — ${i}`:!n&&e.input&&!e.input.startsWith(`{`)?` — ${e.input}`:``]}),e.status===`running`?(0,G.jsx)(MT,{className:`size-3 shrink-0 motion-reduce:animate-none`}):null,e.status===`failed`?(0,G.jsx)(An,{size:12,className:`shrink-0 text-destructive`,"aria-label":`Failed`}):null]}),e.status===`failed`&&e.output?(0,G.jsx)(`span`,{className:`ml-[22px] line-clamp-2 text-[11px] text-muted-foreground`,children:e.output}):null,r&&t&&e.status!==`failed`?(0,G.jsxs)(J,{variant:`link`,size:`xs`,className:`ml-[22px] h-5 w-fit px-0 text-[11px] text-accent-foreground`,onClick:()=>t(r),children:[`Show on canvas`,(0,G.jsx)(Jt,{size:12})]}):null]})}function lk({item:e}){return e.kind===`subagent`?(0,G.jsx)(`div`,{className:nk,"data-agent-step":`subagent`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(an,{size:14,className:`shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px]`,children:e.description}),e.status===`running`?(0,G.jsx)(MT,{className:`size-3 shrink-0 motion-reduce:animate-none`}):null]})}):e.kind===`reasoning`?e.text.trim()?(0,G.jsx)(`div`,{className:nk,"data-agent-step":`reasoning`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(dn,{size:14,className:`mt-px shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 line-clamp-3 text-[11px] text-muted-foreground italic`,children:e.text})]})}):null:e.kind===`plan`?(0,G.jsx)(uk,{item:e}):null}function uk({item:e}){return(0,G.jsxs)(`div`,{className:nk,"data-agent-step":`plan`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium`,children:[(0,G.jsx)(Wr,{size:14,className:`shrink-0 text-muted-foreground`,"aria-hidden":!0}),`Plan`]}),(0,G.jsx)(`ul`,{className:`ml-[22px] flex flex-col gap-0.5 text-[11px]`,children:e.steps.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[e.status===`completed`?(0,G.jsx)(I,{size:12,className:`mt-0.5 shrink-0 text-muted-foreground`,"aria-label":`Done`}):e.status===`in-progress`?(0,G.jsx)(MT,{className:`mt-0.5 size-3 shrink-0 motion-reduce:animate-none`,"aria-label":`In progress`}):(0,G.jsx)(`span`,{className:`mt-1 size-2 shrink-0 rounded-full border border-muted-foreground/60`,role:`img`,"aria-label":`To do`}),(0,G.jsx)(`span`,{className:e.status===`completed`?`text-muted-foreground line-through`:``,children:e.text})]},t))})]})}function dk({item:e,onReveal:t,cwd:n}){switch(e.kind){case`command`:return(0,G.jsx)(ik,{item:e});case`file-change`:return(0,G.jsx)(ok,{item:e,cwd:n});case`tool`:return(0,G.jsx)(ck,{item:e,onReveal:t});default:return(0,G.jsx)(lk,{item:e})}}function fk({items:e,onReveal:t,cwd:n}){let[r,i]=(0,P.useState)(!1),[a,o]=(0,P.useState)(!1),s=e.filter(e=>e.kind!==`reasoning`||e.text.trim()),c=a?s:s.slice(-5),l=s.length-c.length;return(0,G.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:(0,G.jsxs)(eT,{open:r,onOpenChange:i,className:`overflow-hidden rounded-lg border border-border bg-background`,"data-agent-work":!0,children:[(0,G.jsxs)(tT,{className:`flex w-full items-start gap-2 px-2.5 py-2 text-left text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,G.jsx)(Wr,{size:14,className:`mt-px shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:XO(e)}),r?(0,G.jsx)(gn,{size:14,className:`mt-px shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,G.jsx)(bn,{size:14,className:`mt-px shrink-0 text-muted-foreground`,"aria-hidden":!0})]}),(0,G.jsxs)(nT,{className:`flex flex-col border-t border-border`,children:[l>0?(0,G.jsxs)(J,{variant:`ghost`,size:`xs`,className:`h-7 w-full justify-start rounded-none border-b border-border px-2.5 text-[11px] font-normal text-muted-foreground`,onClick:()=>o(!0),children:[`Show `,YO(l,`earlier step`)]}):null,c.map(e=>(0,G.jsx)(dk,{item:e,onReveal:t,cwd:n},e.id))]})]})})}function pk(e){let t=[];for(let n of e)if(n.kind!==`user`){if(JO.has(n.kind)){let e=t.at(-1);e?.kind===`work`?e.items.push(n):t.push({kind:`work`,items:[n]})}else n.kind===`notice`?t.push({kind:`notice`,item:n}):n.kind===`agent-text`&&n.text.trim()&&t.push({kind:`text`,item:n})}return t}function mk({item:e}){let t=e.level===`error`?wn:e.level===`warning`?So:Or;return(0,G.jsxs)(`div`,{className:`flex items-start gap-1.5 text-xs ${e.level===`error`?`text-destructive`:`text-muted-foreground`}`,role:e.level===`error`?`alert`:void 0,children:[(0,G.jsx)(t,{size:12,className:`mt-0.5 shrink-0`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`min-w-0`,children:e.text})]})}function hk({item:e,callbacks:t,sentAt:n}){let r=e.context??[],i=r.filter(e=>e.kind===`comment`),a=r.filter(e=>e.kind!==`comment`);return(0,G.jsx)(Xg,{align:`end`,"data-agent-user":!0,children:(0,G.jsxs)(Zg,{className:`gap-1.5`,children:[i.length>0?(0,G.jsx)(`div`,{className:`ml-6 flex flex-col gap-1.5 self-stretch`,children:i.map(e=>(0,G.jsx)(_k,{card:e,callbacks:t},`${e.ref.threadId}:${e.ref.messageId}`))}):null,e.text.trim()?(0,G.jsx)(zg,{variant:`secondary`,align:`end`,children:(0,G.jsx)(Bg,{className:`whitespace-pre-wrap`,children:e.text})}):null,a.map(e=>(0,G.jsx)(xO,{card:e,variant:`sent`,onReveal:t.onReveal&&(e.ref.screenId||e.ref.boardId)?()=>t.onReveal?.(KO(e)):void 0},`${e.kind}:${e.label}`)),e.attached?(0,G.jsx)(gk,{attached:e.attached}):null,i.length>0?(0,G.jsxs)($g,{className:`gap-1 font-normal`,children:[(0,G.jsx)(Pa,{size:11,"aria-hidden":!0}),(0,G.jsxs)(`span`,{children:[`Sent to agent · `,(0,G.jsx)(vk,{iso:n})]})]}):null]})})}function gk({attached:e}){let[t,n]=(0,P.useState)(!1),r=e.split(`
49
+ `).reduce((e,t)=>(t.startsWith(`- `)||e.length===0?e.push(t.replace(/^- /,``)):e[e.length-1]+=`\n${t}`,e),[]).filter(e=>e.trim());return(0,G.jsxs)(eT,{open:t,onOpenChange:n,className:`flex max-w-full flex-col items-end gap-1 self-end`,"data-agent-attached":!0,children:[(0,G.jsxs)(tT,{className:`flex items-center gap-1 rounded-md px-1 text-[11px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,G.jsx)(Mr,{size:11,"aria-hidden":!0}),`Canvas context sent to the agent`,t?(0,G.jsx)(gn,{size:11,"aria-hidden":!0}):(0,G.jsx)(bn,{size:11,"aria-hidden":!0})]}),(0,G.jsx)(nT,{className:`self-stretch`,children:(0,G.jsx)(`ul`,{className:`ml-6 flex flex-col gap-1 rounded-lg border border-dashed border-border px-2.5 py-2 text-[11px] text-muted-foreground`,children:r.map(e=>(0,G.jsx)(`li`,{className:`whitespace-pre-wrap break-words`,children:e},e))})})]})}function _k({card:e,callbacks:t}){let n=e.ref.threadId??``,r=t.commentState?.(n);return(0,G.jsx)(SO,{card:e,status:r===`resolved`?(0,G.jsx)(K,{variant:`secondary`,className:`ml-auto h-4 px-1.5 text-[10px]`,children:`Resolved`}):r===`open`&&t.onResolveComment?(0,G.jsxs)(J,{variant:`ghost`,size:`xs`,className:`ml-auto h-5 gap-1 px-1.5 text-[11px]`,onClick:()=>t.onResolveComment?.(n),"aria-label":`Resolve ${e.author??`the`} comment`,children:[(0,G.jsx)(I,{size:12}),`Resolve`]}):null})}function vk({iso:e}){let t=Date.now()-Date.parse(e),n=Math.round(t/6e4),r=n<1?`just now`:n<60?`${n}m`:n<1440?`${Math.round(n/60)}h`:`${Math.round(n/1440)}d`;return(0,G.jsx)(`time`,{dateTime:e,children:r})}function yk({turn:e,waiting:t}){if(e.status===`running`)return t?(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(Xi,{size:12,className:`shrink-0`,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:`Paused for your approval`})]}):null;let n=e.completedAt&&e.startedAt?$O(Date.parse(e.completedAt)-Date.parse(e.startedAt)):null;return e.status===`completed`?(0,G.jsxs)($g,{className:`gap-1.5 font-normal`,children:[(0,G.jsx)(I,{size:12,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:n?`Done in ${n}`:`Done`})]}):e.status===`interrupted`?(0,G.jsxs)($g,{className:`gap-1.5 font-normal`,children:[(0,G.jsx)(Xi,{size:12,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:`Stopped`})]}):(0,G.jsxs)($g,{className:`items-start gap-1.5 font-normal text-destructive`,role:`alert`,children:[(0,G.jsx)(wn,{size:12,className:`mt-0.5 shrink-0`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`whitespace-normal`,children:e.error??`This turn failed.`})]})}var bk=1200;function xk(e){let[t,n]=(0,P.useState)(!1),r=(0,P.useRef)(e);return(0,P.useEffect)(()=>{if(e===r.current)return;if(r.current=e,e===null){n(!1);return}n(!0);let t=setTimeout(()=>n(!1),bk);return()=>clearTimeout(t)},[e]),t}var Sk=(0,P.memo)(function({turn:e,provider:t,providerLabel:n,waiting:r,callbacks:i}){let a=e.items.filter(e=>e.kind===`user`),o=pk(e.items),s=e.status===`running`,c=s?e.items.findLast(e=>`status`in e&&e.status===`running`):void 0,l=s?e.items.at(-1):void 0,u=xk(l?.kind===`agent-text`?`${l.id}:${l.text.length}`:null);return(0,G.jsxs)(G.Fragment,{children:[a.map(t=>(0,G.jsx)(hk,{item:t,callbacks:i,sentAt:e.startedAt},t.id)),(0,G.jsx)(Xg,{"data-agent-turn":e.status,children:(0,G.jsxs)(Zg,{className:`gap-2.5`,children:[o.length>0?(0,G.jsxs)(Qg,{className:`gap-1.5`,children:[(0,G.jsx)(LO,{provider:t,size:12}),n]}):null,o.map((e,t)=>e.kind===`work`?(0,G.jsx)(fk,{items:e.items,onReveal:i.onReveal,cwd:i.cwd},`work-${t}`):e.kind===`notice`&&e.item.kind===`notice`?(0,G.jsx)(mk,{item:e.item},e.item.id):e.item.kind===`agent-text`?(0,G.jsx)(zg,{variant:`ghost`,children:(0,G.jsx)(Bg,{children:(0,G.jsx)(PO,{text:e.item.text})})},e.item.id):null),s&&!r&&!u?(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs text-muted-foreground`,"data-agent-working":!0,children:[(0,G.jsx)(Km,{}),(0,G.jsxs)(`span`,{className:`truncate`,children:[c?tk(c,i.cwd):`Thinking`,`…`]})]}):null,(0,G.jsx)(yk,{turn:e,waiting:r})]})})]})}),Ck={"allow-once":`Allow once`,"allow-session":`Allow for this session`,"allow-always":`Always allow`,deny:`Deny`,abort:`Deny and stop`};function wk(e,t){switch(e.kind){case`command`:return`${t} wants to run a command`;case`file-change`:return`${t} wants to change files`;case`permissions`:return`${t} wants more access`;case`question`:return`${t} has a question`;default:return e.title.trim().endsWith(`?`)?`${t} is asking`:`${t} wants to ${e.title.charAt(0).toLowerCase()}${e.title.slice(1)}`}}function Tk({request:e,providerLabel:t,onAnswer:n}){let{questions:r}=e;return r?.length&&e.decisions.includes(`allow-once`)?(0,G.jsx)(zO,{request:{...e,questions:r},providerLabel:t,onAnswer:e=>n(`allow-once`,e),onSkip:()=>n(`deny`)}):(0,G.jsx)(Ek,{request:e,providerLabel:t,onAnswer:n})}function Ek({request:e,providerLabel:t,onAnswer:n}){let[r,i]=(0,P.useState)(!1),a=t=>e.decisions.includes(t),o=e=>{!r&&a(e)&&(i(!0),n(e))},s=e=>{e.key===`Escape`&&a(`deny`)?(e.preventDefault(),o(`deny`)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&a(`allow-session`)&&(e.preventDefault(),o(`allow-session`))},c=`approval-${e.id}`,l=e.kind===`file-change`?ir:e.kind===`command`?no:Bo;return(0,G.jsxs)(pC,{size:`sm`,role:`group`,"aria-labelledby":c,onKeyDown:s,className:`gap-3 bg-accent/60 ring-1 ring-primary dark:bg-accent`,"data-agent-approval":e.kind,children:[(0,G.jsxs)(mC,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`div`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground`,children:(0,G.jsx)(l,{size:14,"aria-hidden":!0})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(hC,{id:c,className:`text-sm`,children:wk(e,t)}),e.reason?(0,G.jsx)(gC,{className:`text-xs`,children:e.reason}):null]})]}),(0,G.jsxs)(_C,{className:`flex flex-col gap-1`,children:[e.command?(0,G.jsx)(`div`,{className:`max-h-32 overflow-auto rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs break-all`,children:e.command}):null,e.paths?.length?(0,G.jsx)(`ul`,{className:`flex flex-col gap-0.5 rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[11px]`,children:e.paths.map(t=>(0,G.jsx)(`li`,{className:`truncate`,title:t,children:ZO(t,e.cwd)},t))}):null,!e.command&&e.input?(0,G.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-md border border-border bg-background px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap break-all`,children:e.input}):null,!e.command&&!e.input&&!e.paths?.length?(0,G.jsx)(`span`,{className:`text-xs`,children:e.title}):null,e.cwd?(0,G.jsxs)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,title:e.cwd,children:[`in `,(0,G.jsx)(`span`,{className:`font-mono`,children:QO(e.cwd)})]}):null]}),(0,G.jsxs)(_C,{className:`flex flex-col gap-1.5`,children:[a(`allow-once`)?(0,G.jsxs)(J,{size:`sm`,className:`w-full justify-between`,disabled:r,onClick:()=>o(`allow-once`),children:[(0,G.jsx)(`span`,{children:Ck[`allow-once`]}),(0,G.jsx)(ME,{className:`bg-primary-foreground/10 text-primary-foreground`,children:`↵`})]}):null,a(`allow-session`)?(0,G.jsxs)(J,{size:`sm`,variant:`outline`,className:`w-full justify-between bg-background`,disabled:r,onClick:()=>o(`allow-session`),children:[(0,G.jsx)(`span`,{children:Ck[`allow-session`]}),(0,G.jsxs)(NE,{children:[(0,G.jsx)(ME,{children:`⌘`}),(0,G.jsx)(ME,{children:`↵`})]})]}):null,a(`allow-always`)?(0,G.jsxs)(J,{size:`sm`,variant:`outline`,className:`h-auto w-full flex-col items-start gap-0.5 bg-background py-1.5 text-left whitespace-normal`,disabled:r,"aria-describedby":e.always?`${c}-always`:void 0,onClick:()=>o(`allow-always`),children:[(0,G.jsx)(`span`,{children:Ck[`allow-always`]}),e.always?(0,G.jsx)(`span`,{id:`${c}-always`,className:`text-[11px] font-normal text-muted-foreground`,children:e.always}):null]}):null,(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:[a(`deny`)?(0,G.jsxs)(J,{size:`sm`,variant:`outline`,className:`justify-between bg-background`,disabled:r,onClick:()=>o(`deny`),children:[(0,G.jsx)(`span`,{children:e.kind===`question`?`Skip`:Ck.deny}),(0,G.jsx)(ME,{children:`Esc`})]}):null,a(`abort`)?(0,G.jsx)(J,{size:`sm`,variant:`ghost`,className:`text-muted-foreground`,disabled:r,onClick:()=>o(`abort`),children:Ck.abort}):null]})]})]})}function Dk({provider:e,providerLabel:t,label:n,model:r,models:i,onModel:a}){let o=(0,G.jsxs)(J,{variant:`outline`,size:`xs`,className:`min-w-0 gap-1 px-1.5 font-medium disabled:opacity-100`,"aria-label":i.length>0?`${t} model: ${n}. Change it`:`${t} model: ${n}`,title:`${t} · ${n}`,disabled:i.length===0,"data-agent-model":r??n,children:[(0,G.jsx)(LO,{provider:e,size:12}),(0,G.jsx)(`span`,{className:`truncate`,children:n}),i.length>0?(0,G.jsx)(gn,{size:12,className:`shrink-0 opacity-60`,"aria-hidden":!0}):null]});return i.length===0?o:(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:o}),(0,G.jsxs)(xv,{align:`start`,className:`max-h-80 w-72 overflow-y-auto`,children:[(0,G.jsxs)(Tv,{className:`text-[11px] font-medium text-muted-foreground`,children:[t,` uses it from your next message`]}),(0,G.jsx)(Cv,{value:r??``,onValueChange:a,children:i.map(e=>(0,G.jsx)(wv,{value:e.id,className:`items-start`,children:(0,G.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,G.jsx)(`span`,{children:e.label}),e.description?(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.description}):null]})},e.id))})]})]})}var Ok=new Set([`starting`,`idle`,`running`,`awaiting-approval`]),kk=e=>Ok.has(e.state);function Ak({session:e}){let t=e=>(0,G.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${e}`,"aria-hidden":!0});switch(e.state){case`starting`:case`running`:return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,G.jsx)(Km,{}),(0,G.jsx)(`span`,{className:`truncate`,children:e.state===`starting`?`Starting…`:`Working…`})]});case`awaiting-approval`:return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-medium text-foreground`,children:[t(`bg-primary`),(0,G.jsx)(`span`,{className:`truncate`,children:`Waiting for you`})]});case`idle`:return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[t(`bg-muted-foreground/50`),(0,G.jsx)(`span`,{className:`truncate`,children:`Ready`})]});case`exited`:return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[t(`border border-muted-foreground/60`),(0,G.jsx)(`span`,{className:`truncate`,children:`Stopped`})]});case`failed`:return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-destructive`,children:[t(`bg-destructive`),(0,G.jsx)(`span`,{className:`truncate`,children:`Stopped unexpectedly`})]})}}function jk({since:e}){let[t,n]=(0,P.useState)(()=>Date.now());(0,P.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let r=Math.max(0,Math.floor((t-Date.parse(e))/1e3));return(0,G.jsxs)(`span`,{className:`ml-auto text-[11px] tabular-nums text-muted-foreground`,"aria-hidden":!0,children:[Math.floor(r/60),`:`,String(r%60).padStart(2,`0`)]})}function Mk(e){let{session:t,provider:n}=e,r=t.environment,[i,a]=(0,P.useState)(!1),[o,s]=(0,P.useState)(t.title),c=(0,P.useRef)(!1),[l,u]=(0,P.useState)(!1),d=n?.label??t.provider,f=kk(t),p=r?[r.execution===`local`?`Local`:`Cloud`,[d,r.providerVersion].filter(Boolean).join(` `),r.model,QO(r.cwd),r.sandbox,r.approvalMode===`on-request`?`asks on request`:r.approvalMode].filter(Boolean):[],m=()=>{let n=o.trim();a(!1),n&&n!==t.title&&e.onRename(n)};return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 border-b border-border px-3 py-2`,"data-agent-session-header":!0,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`-ml-1.5 shrink-0 text-muted-foreground`,"aria-label":`Back to agents`,title:`Back to agents`,onClick:e.onBack,children:(0,G.jsx)(vn,{size:16,"aria-hidden":!0})}),i?(0,G.jsx)(Z,{autoFocus:!0,"aria-label":`Session name`,onFocus:e=>e.currentTarget.select(),className:`h-8 min-w-0 flex-1 text-sm`,value:o,onChange:e=>s(e.currentTarget.value),onBlur:m,onKeyDown:e=>{e.key===`Enter`&&m(),e.key===`Escape`&&a(!1)}}):(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,className:`min-w-0 flex-1 justify-start gap-1 px-1.5 text-sm font-medium`,"aria-label":`Session: ${t.title}. Switch session`,children:[(0,G.jsx)(`span`,{className:`truncate`,children:t.title}),(0,G.jsx)(gn,{size:14,className:`shrink-0 opacity-50`,"aria-hidden":!0})]})}),(0,G.jsxs)(xv,{align:`start`,className:`w-64`,children:[(0,G.jsx)(Tv,{className:`text-[11px] font-medium text-muted-foreground`,children:`This design`}),e.sessions.map(n=>(0,G.jsx)(Sv,{checked:n.id===t.id,onSelect:()=>e.onSwitch(n.id),children:(0,G.jsx)(`span`,{className:`truncate`,children:n.title})},n.id)),(0,G.jsx)(Ev,{}),(0,G.jsxs)(Q,{onSelect:e.onNew,children:[(0,G.jsx)(ua,{size:14,"aria-hidden":!0}),`New session`]})]})]}),(0,G.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,"aria-label":`New ${d} session`,title:`New ${d} session`,onClick:e.onNewWithAgent,children:(0,G.jsx)(ua,{size:16,"aria-hidden":!0})}),(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(J,{variant:`ghost`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,"aria-label":`Session menu`,children:(0,G.jsx)(Xn,{size:16,"aria-hidden":!0})})}),(0,G.jsxs)(xv,{align:`end`,className:`w-56`,onCloseAutoFocus:e=>{c.current&&(c.current=!1,e.preventDefault(),a(!0))},children:[(0,G.jsxs)(Q,{onSelect:e.onNew,children:[(0,G.jsx)(ua,{size:14,"aria-hidden":!0}),`New session`]}),(0,G.jsxs)(Q,{onSelect:()=>{s(t.title),c.current=!0},children:[(0,G.jsx)(ia,{size:14,"aria-hidden":!0}),`Rename`]}),t.terminalCommand?(0,G.jsxs)(Q,{onSelect:e.onCopyResume,children:[(0,G.jsx)(Wn,{size:14,"aria-hidden":!0}),`Copy resume command`]}):null,(0,G.jsx)(Ev,{}),f?(0,G.jsxs)(Q,{variant:`destructive`,onSelect:e.onStop,children:[(0,G.jsx)(io,{size:14,"aria-hidden":!0}),`Stop agent`]}):(0,G.jsxs)(Q,{variant:`destructive`,onSelect:()=>u(!0),children:[(0,G.jsx)(L,{size:14,"aria-hidden":!0}),`Remove session…`]})]})]}),(0,G.jsx)(zk,{session:l?t:null,provider:n,onRemove:t=>{u(!1),e.onRemove(t)},onCancel:()=>u(!1)})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.model?(0,G.jsx)(Dk,{provider:t.provider,providerLabel:d,label:e.model.label,model:e.model.id,models:e.model.options,onModel:t=>e.onModel?.(t)}):(0,G.jsxs)(K,{variant:`outline`,className:`shrink-0 gap-1`,children:[(0,G.jsx)(LO,{provider:t.provider,size:12}),(0,G.jsx)(`span`,{children:d})]}),(0,G.jsx)(Ak,{session:t}),e.runningSince&&t.state!==`awaiting-approval`?(0,G.jsx)(jk,{since:e.runningSince}):null,!f&&t.resumable?(0,G.jsxs)(J,{variant:`outline`,size:`xs`,className:`ml-auto`,onClick:e.onReopen,children:[(0,G.jsx)(Ea,{size:12,"aria-hidden":!0}),`Reopen`]}):null]}),t.stateMessage&&!f?(0,G.jsx)(`p`,{className:`text-[11px] ${t.state===`failed`?`text-destructive`:`text-muted-foreground`}`,children:t.stateMessage}):null,r?(0,G.jsxs)(eT,{children:[(0,G.jsxs)(tT,{className:`group flex w-full min-w-0 items-center gap-1 text-left text-[11px] text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,G.jsx)(bn,{size:12,className:`shrink-0 group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`truncate`,children:p.join(` · `)})]}),(0,G.jsx)(nT,{children:(0,G.jsxs)(`dl`,{className:`mt-1.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[11px]`,children:[(0,G.jsx)(Pk,{term:`Runs`,children:r.execution===`local`?`On this computer (${r.host})`:`In the cloud`}),(0,G.jsxs)(Pk,{term:`Agent`,children:[[d,r.providerVersion].filter(Boolean).join(` `),n?.account?` · ${n.account}`:``]}),r.model?(0,G.jsx)(Pk,{term:`Model`,children:r.model}):null,(0,G.jsx)(Pk,{term:`Folder`,children:(0,G.jsx)(`span`,{className:`font-mono break-all`,children:r.cwd})}),(0,G.jsx)(Pk,{term:`Access`,children:r.sandbox}),(0,G.jsx)(Pk,{term:`Asks`,children:r.approvalMode}),(0,G.jsx)(Pk,{term:`Resumable`,children:t.resumable?`Yes — from Velloo or a terminal`:`No`}),(0,G.jsx)(Pk,{term:`Session ID`,children:(0,G.jsx)(Nk,{id:t.providerSessionId??t.id})})]})})]}):null]})}function Nk({id:e}){let[t,n]=(0,P.useState)(!1);return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`font-mono break-all select-all`,"data-agent-session-id":!0,children:e}),(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`size-5 shrink-0 text-muted-foreground`,"aria-label":t?`Session ID copied`:`Copy the session ID`,title:t?`Copied`:`Copy`,onClick:()=>void navigator.clipboard?.writeText(e).then(()=>n(!0),()=>{}),children:t?(0,G.jsx)(I,{size:12,"aria-hidden":!0}):(0,G.jsx)(Wn,{size:12,"aria-hidden":!0})})]})}function Pk({term:e,children:t}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,G.jsx)(`dd`,{className:`min-w-0`,children:t})]})}var Fk={ready:`Ready`,"not-installed":`Not installed`,incompatible:`Needs an update`,"logged-out":`Not signed in`,error:`Unavailable`};function Ik(e){let t=Math.round((Date.now()-Date.parse(e))/6e4);return t<1?`just now`:t<60?`${t}m ago`:t<1440?`${Math.round(t/60)}h ago`:t<2880?`Yesterday`:`${Math.round(t/1440)}d ago`}var Lk=[`GitHub Copilot`,`Cursor`,`Gemini CLI`,`OpenCode`];function Rk({compact:e}){return e?(0,G.jsx)(UC,{className:`gap-0 rounded-lg border border-border bg-background has-data-[size=xs]:gap-0`,role:`status`,"aria-label":`Looking for agents…`,children:[0,1,2].map(e=>(0,G.jsxs)(P.Fragment,{children:[e>0?(0,G.jsx)(WC,{className:`my-0`}):null,(0,G.jsxs)(KC,{size:`xs`,className:`rounded-none`,"aria-hidden":!0,children:[(0,G.jsx)(JC,{variant:`icon`,children:(0,G.jsx)(OD,{className:`size-3.5 rounded-sm`})}),(0,G.jsx)(YC,{children:(0,G.jsx)(OD,{className:`h-3 w-24`})}),(0,G.jsx)(QC,{children:(0,G.jsx)(OD,{className:`h-6 w-12`})})]})]},e))}):(0,G.jsx)(`div`,{className:`flex flex-col gap-2`,role:`status`,"aria-label":`Looking for agents…`,children:[0,1,2].map(e=>(0,G.jsxs)(KC,{variant:`outline`,size:`sm`,className:`bg-background`,"aria-hidden":!0,children:[(0,G.jsx)(JC,{variant:`icon`,children:(0,G.jsx)(OD,{className:`size-4 rounded-sm`})}),(0,G.jsxs)(YC,{className:`gap-1.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(OD,{className:`h-3.5 w-20`}),(0,G.jsx)(OD,{className:`h-4 w-12 rounded-full`})]}),(0,G.jsx)(OD,{className:`h-3 w-32`})]}),(0,G.jsx)($C,{children:(0,G.jsx)(OD,{className:`h-7 w-full`})})]},e))})}function zk(e){let[t,n]=(0,P.useState)(e.session);e.session&&e.session!==t&&n(e.session);let r=e.session??t,i=e.provider?.label??r?.provider??`The agent`,a=!!(e.provider?.capabilities.delete&&r?.providerSessionId);return(0,G.jsx)(Dg,{open:e.session!==null,onOpenChange:t=>!t&&e.onCancel(),children:(0,G.jsxs)(Ag,{className:`data-[size=default]:max-w-md data-[size=default]:sm:max-w-md`,"data-agent-remove-dialog":!0,children:[(0,G.jsx)(Lg,{variant:`ghost`,size:`icon-xs`,className:`absolute top-3 right-3 text-muted-foreground`,"aria-label":`Close`,children:(0,G.jsx)(Ho,{"aria-hidden":!0})}),(0,G.jsxs)(jg,{children:[(0,G.jsxs)(Pg,{className:`pr-6 break-words`,children:[`Remove "`,r?.title,`"?`]}),(0,G.jsxs)(Fg,{className:`flex flex-col gap-2 text-xs`,children:[r&&kk(r)?(0,G.jsx)(`span`,{children:`It's running, so it's stopped first.`}):null,(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`font-medium text-foreground`,children:`Archive`}),` removes it from Velloo only.`]}),a?(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`font-medium text-foreground`,children:`Delete`}),` also deletes `,i,`'s copy. This can't be undone.`]}):(0,G.jsxs)(`span`,{children:[i,` can't delete its sessions from here.`]})]})]}),(0,G.jsxs)(Mg,{children:[(0,G.jsx)(Lg,{children:`Cancel`}),(0,G.jsx)(Ig,{variant:`outline`,onClick:()=>e.onRemove(!1),children:`Archive`}),a?(0,G.jsx)(Ig,{variant:`destructive`,onClick:()=>e.onRemove(!0),children:`Delete`}):null]})]})})}var Bk=`hover:bg-foreground/10 dark:hover:bg-foreground/10`,Vk=5;function Hk(e,t){return[e.id===t?`Last used`:null,e.account,e.version?`v${e.version}`:null].filter(Boolean).join(` · `)}function Uk({status:e}){let t=e===`ready`;return(0,G.jsxs)(K,{variant:t?`secondary`:`outline`,className:`h-4 gap-1 px-1.5 text-[10px] ${t?``:`text-muted-foreground`}`,children:[(0,G.jsx)(`span`,{className:`size-1.5 rounded-full ${t?`bg-primary`:`bg-muted-foreground/60`}`,"aria-hidden":!0}),Fk[e]]})}function Wk(e){let{provider:t,compact:n}=e;return(0,G.jsxs)(J,{size:n?`xs`:`sm`,variant:t.id===e.primary?`default`:`outline`,className:n?``:`w-full`,disabled:e.starting!==null,"aria-label":n?`Start a session with ${t.label}`:void 0,onClick:()=>e.onStart(t.id),children:[e.starting===t.id?(0,G.jsx)(MT,{className:`size-3.5 motion-reduce:animate-none`}):null,n?`Start`:`Start session`]})}function Gk(e){let t=Lk.filter(t=>!e.providers.some(e=>e.label===t));return(0,G.jsxs)(UC,{className:`gap-2`,"aria-label":`Agents on this computer`,children:[e.providers.map(t=>{let n=t.status===`ready`;return(0,G.jsxs)(KC,{variant:`outline`,size:`sm`,className:`bg-background`,"data-agent-provider":t.id,children:[(0,G.jsx)(JC,{variant:`icon`,className:n?``:`opacity-50 grayscale`,children:(0,G.jsx)(LO,{provider:t.id})}),(0,G.jsxs)(YC,{className:`min-w-0`,children:[(0,G.jsxs)(XC,{className:`gap-1.5`,children:[t.label,(0,G.jsx)(Uk,{status:t.status})]}),(0,G.jsx)(ZC,{className:`text-xs`,children:n?Hk(t,e.preferred):t.message??``})]}),(0,G.jsx)($C,{children:n?(0,G.jsx)(Wk,{...e,provider:t}):(0,G.jsxs)(J,{size:`sm`,variant:`outline`,className:`w-full`,onClick:e.onCheckAgain,children:[(0,G.jsx)(Ea,{size:14,"aria-hidden":!0}),`Check again`]})})]},t.id)}),t.length>0?(0,G.jsxs)(KC,{size:`xs`,className:`text-muted-foreground`,children:[(0,G.jsx)(JC,{variant:`icon`,children:(0,G.jsx)(ca,{size:14,"aria-hidden":!0})}),(0,G.jsx)(YC,{children:(0,G.jsxs)(XC,{className:`text-xs font-normal text-muted-foreground`,children:[t.join(`, `),` and other agents that speak ACP appear here once installed`]})})]}):null]})}function Kk(e){return(0,G.jsx)(UC,{className:`gap-0 rounded-lg border border-border bg-background has-data-[size=xs]:gap-0`,"aria-label":`Agents on this computer`,children:e.providers.map((t,n)=>{let r=t.status===`ready`;return(0,G.jsxs)(P.Fragment,{children:[n>0?(0,G.jsx)(WC,{className:`my-0`}):null,(0,G.jsxs)(KC,{size:`xs`,className:`rounded-none`,"data-agent-provider":t.id,children:[(0,G.jsx)(JC,{variant:`icon`,className:r?``:`opacity-50 grayscale`,children:(0,G.jsx)(LO,{provider:t.id,size:14})}),(0,G.jsxs)(YC,{className:`min-w-0 gap-0.5`,children:[(0,G.jsxs)(XC,{className:`w-full min-w-0 gap-1.5 text-xs`,children:[(0,G.jsx)(`span`,{className:`truncate`,children:t.label}),r?t.id===e.preferred?(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] font-normal text-muted-foreground`,children:`Last used`}):null:(0,G.jsx)(Uk,{status:t.status})]}),!r&&t.message?(0,G.jsx)(ZC,{className:`text-[11px]`,children:t.message}):null]}),(0,G.jsx)(QC,{children:r?(0,G.jsx)(Wk,{...e,provider:t,compact:!0}):(0,G.jsxs)(J,{size:`xs`,variant:`ghost`,"aria-label":`Check again for ${t.label}`,onClick:e.onCheckAgain,children:[(0,G.jsx)(Ea,{"aria-hidden":!0}),`Check again`]})})]})]},t.id)})})}function qk(e){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),s=async(t,n)=>{o({id:t,action:n,order:e.recent.map(e=>e.id)});try{await(n===`reopen`?e.onReopen(t):e.onStopSession(t))}finally{o(null)}},c=e=>{let t=a?.order.indexOf(e)??-1;return t===-1?2**53-1:t},l=a?[...e.recent].sort((e,t)=>c(e.id)-c(t.id)):e.recent,u=t?l:l.slice(0,Vk),d=e.recent.length-Vk;return(0,G.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Recent sessions`,children:[(0,G.jsx)(`h3`,{className:`px-1 text-[11px] font-medium text-muted-foreground`,children:`Recent sessions`}),(0,G.jsx)(UC,{className:`gap-0 has-data-[size=xs]:gap-0`,children:u.map(t=>(0,G.jsxs)(KC,{size:`xs`,className:`px-1`,children:[(0,G.jsxs)(YC,{className:`min-w-0 gap-1`,children:[(0,G.jsx)(XC,{className:`w-full min-w-0`,children:(0,G.jsx)(`button`,{type:`button`,className:`truncate text-left text-xs outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>e.onOpen(t.id),children:t.title})}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,G.jsxs)(K,{variant:`outline`,className:`h-4 gap-1 px-1.5 text-[10px] font-normal`,children:[(0,G.jsx)(LO,{provider:t.provider,size:10}),e.providers?.find(e=>e.id===t.provider)?.label??(0,G.jsx)(`span`,{className:`sr-only`,children:t.provider})]}),(0,G.jsx)(`span`,{children:kk(t)?`Running`:Ik(t.updatedAt)}),!kk(t)&&!t.resumable?(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 whitespace-nowrap`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,children:`·`}),`Can't be reopened`]}):null]})]}),(0,G.jsxs)(QC,{className:`gap-0.5`,children:[(a?.id===t.id?a.action===`stop`:kk(t))?(0,G.jsxs)(J,{variant:`ghost`,size:`xs`,className:Bk,"aria-label":`Stop ${t.title}`,disabled:a!==null,onClick:()=>void s(t.id,`stop`),children:[a?.id===t.id?(0,G.jsx)(MT,{className:`size-3 motion-reduce:animate-none`}):(0,G.jsx)(io,{"aria-hidden":!0}),`Stop`]}):t.resumable||a?.id===t.id?(0,G.jsxs)(J,{variant:`ghost`,size:`xs`,className:Bk,disabled:a!==null,onClick:()=>void s(t.id,`reopen`),children:[a?.id===t.id?(0,G.jsx)(MT,{className:`size-3 motion-reduce:animate-none`}):null,`Reopen`]}):null,(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground ${Bk}`,"aria-label":`Remove ${t.title}`,onClick:()=>i(t),children:(0,G.jsx)(L,{"aria-hidden":!0})})]})]},t.id))}),(0,G.jsx)(zk,{session:r,provider:e.providers?.find(e=>e.id===r?.provider),onRemove:t=>{r&&e.onRemove(r.id,t),i(null)},onCancel:()=>i(null)}),d>0?(0,G.jsx)(J,{variant:`ghost`,size:`xs`,className:`self-start text-muted-foreground`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Show fewer`:`Show all ${e.recent.length}`}):null]})}function Jk(e){let[t,n]=(0,P.useState)(null),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(null),{loadHistory:s}=e;(0,P.useEffect)(()=>{if(!t)return;let e=!0;return i(null),o(null),s(t.id).then(t=>e&&i(t),t=>e&&o(t instanceof Error?t.message:String(t))),()=>{e=!1}},[t,s]);let c=e.providers.filter(e=>e.status===`ready`&&e.capabilities.history);return c.length===0?null:(0,G.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Continue a session`,children:[(0,G.jsx)(`h3`,{className:`px-1 text-[11px] font-medium text-muted-foreground`,children:`Continue from your terminal`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:c.map(t=>(0,G.jsxs)(J,{size:`xs`,variant:`outline`,disabled:e.starting!==null,onClick:()=>n(t),children:[(0,G.jsx)(Sa,{"aria-hidden":!0}),t.label,` sessions`]},t.id))}),(0,G.jsx)(fh,{open:t!==null,onOpenChange:e=>!e&&n(null),children:(0,G.jsxs)(hh,{className:`max-w-md`,children:[(0,G.jsxs)(gh,{children:[(0,G.jsxs)(vh,{children:[`Continue a `,t?.label,` session`]}),(0,G.jsxs)(yh,{children:[`Sessions `,t?.label,` ran in this project outside the canvas, from a terminal or the desktop app. The one you pick carries on here, in the folder it ran in, with what was said before.`]})]}),a?(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:a}):r===null?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,role:`status`,"aria-label":`Looking for sessions`,children:[(0,G.jsx)(OD,{className:`h-8`}),(0,G.jsx)(OD,{className:`h-8`}),(0,G.jsx)(OD,{className:`h-8`})]}):r.length===0?(0,G.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`No other `,t?.label,` sessions for this project. Sessions started outside it can't be continued here.`]}):(0,G.jsx)(UC,{className:`max-h-80 gap-0 overflow-y-auto has-data-[size=xs]:gap-0`,children:r.map(r=>(0,G.jsxs)(KC,{size:`xs`,className:`px-1`,children:[(0,G.jsxs)(YC,{className:`min-w-0 gap-0.5`,children:[(0,G.jsx)(XC,{className:`w-full min-w-0 text-xs`,children:(0,G.jsx)(`span`,{className:`truncate`,children:r.title})}),(0,G.jsxs)(ZC,{className:`truncate text-[11px]`,children:[Ik(r.updatedAt),r.where?` · ${r.where===`.`?`project root`:r.where}`:``]})]}),(0,G.jsx)(QC,{children:(0,G.jsx)(J,{size:`xs`,variant:`outline`,"aria-label":`Continue ${r.title}`,onClick:()=>{t&&(e.onResume(t.id,r.providerSessionId),n(null))},children:`Continue`})})]},r.providerSessionId))})]})})]})}function Yk(e){let t=[...e.providers??[]].sort((t,n)=>Number(n.id===e.preferred)-Number(t.id===e.preferred)),n=e.recent.length>0,r={providers:t,preferred:e.preferred,primary:t.find(e=>e.status===`ready`)?.id,starting:e.starting,onStart:e.onStart,onCheckAgain:e.onCheckAgain},i=e.providers===null?e.loadError?(0,G.jsxs)(Jm,{className:`flex-none gap-3 border border-dashed p-4`,"data-agent-load-error":!0,children:[(0,G.jsxs)(Ym,{className:`gap-1`,children:[(0,G.jsx)(Qm,{className:`text-xs`,children:`Couldn't look for agents`}),(0,G.jsx)($m,{className:`text-[11px] break-words`,children:e.loadError})]}),(0,G.jsx)(eh,{children:(0,G.jsxs)(J,{size:`sm`,variant:`outline`,onClick:e.onRetry,children:[(0,G.jsx)(Ea,{size:14,"aria-hidden":!0}),`Try again`]})})]}):(0,G.jsx)(Rk,{compact:n}):t.length===0?(0,G.jsxs)(Jm,{className:`flex-none gap-3 border border-dashed p-4`,"data-agent-none":!0,children:[(0,G.jsxs)(Ym,{className:`gap-1`,children:[(0,G.jsx)(Qm,{className:`text-xs`,children:`No agents on this computer`}),(0,G.jsxs)($m,{className:`text-[11px]`,children:[`Install Codex, Claude Code or an agent that speaks ACP (`,Lk.join(`, `),`), then check again.`]})]}),(0,G.jsx)(eh,{children:(0,G.jsxs)(J,{size:`sm`,variant:`outline`,onClick:e.onCheckAgain,children:[(0,G.jsx)(Ea,{size:14,"aria-hidden":!0}),`Check again`]})})]}):n?(0,G.jsx)(Kk,{...r}):(0,G.jsx)(Gk,{...r}),a=e.providers&&e.loadHistory&&e.onResume?(0,G.jsx)(Jk,{providers:e.providers,starting:e.starting,loadHistory:e.loadHistory,onResume:e.onResume}):null;return(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-agent-start":!0,children:[(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-3 ${n?`gap-4 py-3`:`gap-5 py-6`}`,children:n?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(qk,{...e}),(0,G.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`New session`,children:[(0,G.jsx)(`h3`,{className:`px-1 text-[11px] font-medium text-muted-foreground`,children:`New session`}),i]}),a]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Jm,{className:`flex-none gap-3 p-0`,children:(0,G.jsxs)(Ym,{className:`gap-1.5`,children:[(0,G.jsx)(Zm,{variant:`icon`,children:(0,G.jsx)(an,{size:16,"aria-hidden":!0})}),(0,G.jsx)(Qm,{className:`text-sm`,children:`Start an agent session`}),(0,G.jsx)($m,{className:`text-xs`,children:`Your coding agent works on this design and its code, beside the canvas.`})]})}),i,a]})}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 border-t border-border px-3 py-3 text-[11px] leading-snug text-muted-foreground`,children:[(0,G.jsx)(Qr,{size:12,className:`mt-0.5 shrink-0`,"aria-hidden":!0}),(0,G.jsx)(`span`,{children:`Agents run on this computer, signed in with your own accounts. Velloo never sees your credentials.`})]})]})}var Xk=48;function Zk(e,t){switch(e.state){case`running`:return`${t} is working.`;case`awaiting-approval`:return`${t} is waiting for your approval.`;case`idle`:return`${t} is ready.`;case`failed`:return`${t} stopped unexpectedly.`;case`exited`:return`${t} stopped.`;default:return``}}var Qk=e=>gf.history(e).then(e=>e.sessions);function $k(){let e=q(e=>e.agentProviders),t=q(e=>e.agentSessions),n=q(e=>e.agentActiveSessionId),r=q(e=>e.agentTranscripts),i=q(e=>e.agentDraft),a=q(e=>e.agentProtocolMismatch),o=q(e=>e.agentLoadError),s=q(e=>e.agentCommentThreads),c=q(e=>e.boards),l=q(e=>e.screens),u=q(e=>e.currentBoardId),d=q(e=>e.selection),f=q(e=>e.notes),p=q(e=>e.commentArrivals),m=q(e=>e.view===`language`?e.languageTheme:null),h=q.getState,[g,_]=(0,P.useState)(null),[v,y]=(0,P.useState)(null),b=(0,P.useCallback)(()=>q.getState().loadAgentMcpServers(),[]);(0,P.useEffect)(()=>{q.getState().agentProviders===null&&q.getState().loadAgent()},[]);let x=t.find(e=>e.id===n),S=n?r[n]:void 0,C=e?.find(e=>e.id===x?.provider),w=C?.label??x?.provider??`Agent`,T=S?.controls;(0,P.useEffect)(()=>y(null),[n]);let E=(0,P.useMemo)(()=>{let e=[...i.context,...S?.turns.flatMap(e=>e.items.flatMap(e=>e.kind===`user`?e.context??[]:[]))??[]];return[...new Set(e.filter(e=>e.kind===`comment`).map(e=>e.ref.threadId??``))].filter(Boolean).sort().join(`,`)},[i.context,S?.turns]);(0,P.useEffect)(()=>{E&&q.getState().refreshAgentCommentThreads(E.split(`,`))},[E]);let D=(0,P.useMemo)(()=>({board:u&&m===null?c[u]:void 0,screens:l,selection:d,notes:f}),[c,l,d,u,f,m]),O=(0,P.useMemo)(()=>lf(D),[D]),k=(0,P.useMemo)(()=>df(D),[D]),A=(0,P.useMemo)(()=>m===null?sf(D):cf(m),[D,m]),j=(0,P.useCallback)(e=>mf(e,{boards:c,screens:l,threads:s}),[c,l,s]),M=x?.environment?.cwd,ee=(0,P.useMemo)(()=>({cwd:M,onReveal:e=>{let t=q.getState();e.screenId?t.locateNode(e.screenId,e.path??``,{preserveTab:!0,...e.frameId?{frameId:e.frameId}:{},...e.boardId?{hostBoards:[e.boardId]}:{}}):e.boardId&&t.selectBoard(e.boardId)},onResolveComment:async e=>{await q.getState().setCommentResolved(e,!0),await q.getState().refreshAgentCommentThreads([e])},commentState:e=>{if(!(e in s))return;let t=s[e];return t?t.status===`resolved`?`resolved`:`open`:`gone`}}),[s,M]),te=(0,P.useRef)(null),ne=(0,P.useRef)(!0),N=(0,P.useRef)(n);(0,P.useEffect)(()=>{let e=te.current;N.current!==n&&(N.current=n,ne.current=!0),e&&ne.current&&(e.scrollTop=e.scrollHeight)});let re=p.length>0?(0,G.jsx)(`section`,{className:`flex flex-col gap-2 border-b border-border px-3 py-2`,"aria-label":`New comments`,children:p.map(e=>(0,G.jsx)(_O,{title:mO(e),onAdd:()=>void hO([e]),onDismiss:()=>void h().acknowledgeCommentArrivals(e.messageIds)},e.boardId))}):null;if(a)return(0,G.jsx)(`div`,{className:`p-3`,children:(0,G.jsxs)(tw,{children:[(0,G.jsx)(nw,{className:`text-xs`,children:`Velloo was updated`}),(0,G.jsxs)(rw,{className:`flex flex-col items-start gap-1.5 text-[11px]`,children:[(0,G.jsx)(`span`,{children:`Reload the canvas to keep following the agent.`}),(0,G.jsxs)(J,{variant:`outline`,size:`xs`,onClick:()=>window.location.reload(),children:[(0,G.jsx)(va,{size:12,"aria-hidden":!0}),`Reload`]})]})]})});if(!x){let n=i.context.length;return(0,G.jsxs)(G.Fragment,{children:[re,n>0?(0,G.jsxs)(`p`,{className:`border-b border-border px-3 py-2 text-[11px] text-muted-foreground`,children:[n,` `,n===1?`card is`:`cards are`,` waiting in the composer — start a session to send `,n===1?`it`:`them`,`.`]}):null,(0,G.jsx)(Yk,{providers:e,loadError:o,onRetry:()=>void h().loadAgent(),preferred:t.find(e=>e.state!==`failed`)?.provider,recent:t,starting:g,onStart:async e=>{_(e),await h().startAgentSession(e),_(null)},onCheckAgain:()=>void h().refreshAgentProviders(),onOpen:e=>void h().selectAgentSession(e),onReopen:e=>h().reopenAgentSession(e),onStopSession:e=>h().stopAgentSession(e),onRemove:(e,t)=>void h().removeAgentSession(e,t),loadHistory:Qk,onResume:async(e,t)=>{_(e),await h().startAgentSession(e,t),_(null)}})]})}let ie=kk(x),ae=T?.models.find(e=>e.id===T.model)?.label??x.environment?.model,oe=x.state===`running`||x.state===`awaiting-approval`,se=C?.capabilities.followUp??`none`,ce=oe?S?.turns.findLast(e=>e.status===`running`):void 0;return(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-agent-panel":!0,children:[(0,G.jsx)(Mk,{session:x,sessions:t,provider:C,runningSince:ce?.startedAt,onSwitch:e=>void h().selectAgentSession(e),onNew:()=>void h().selectAgentSession(null),onBack:()=>void h().selectAgentSession(null),onNewWithAgent:()=>void h().startAgentSession(x.provider),model:ie&&ae?{label:ae,id:T?.model,options:T?.models??[]}:void 0,onModel:e=>void h().setAgentModel(e),onRename:e=>void h().renameAgentSession(x.id,e),onCopyResume:()=>{let e=x.terminalCommand?.join(` `)??``,t=x.environment?.cwd,n=t?`cd ${JSON.stringify(t)} && ${e}`:e;navigator.clipboard?.writeText(n).then(()=>V({kind:`success`,message:`Copied — paste it in a terminal to continue there.`}),()=>V({kind:`error`,message:`Couldn't copy the command.`}))},onStop:()=>void h().stopAgentSession(x.id),onReopen:()=>void h().reopenAgentSession(x.id),onRemove:e=>void h().removeAgentSession(x.id,e)}),re,(0,G.jsx)(`p`,{className:`sr-only`,"aria-live":`polite`,children:Zk(x,w)}),(0,G.jsx)(`div`,{ref:te,className:`scroll-stable min-h-0 flex-1 overflow-y-auto`,onScroll:e=>{let t=e.currentTarget;ne.current=t.scrollHeight-t.scrollTop-t.clientHeight<Xk},children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 px-3 py-4`,role:`log`,"aria-live":`off`,"aria-label":`Conversation with ${w}`,children:[S&&S.turnsDropped>0?(0,G.jsxs)(`p`,{className:`text-center text-[11px] text-muted-foreground`,children:[S.turnsDropped,` earlier `,S.turnsDropped===1?`turn`:`turns`,` `,`not shown`]}):null,S?.turns.length?S.turns.map(e=>(0,G.jsx)(Sk,{turn:e,provider:x.provider,providerLabel:w,waiting:e.status===`running`&&(S.approvals.length??0)>0,callbacks:ee},e.id)):ie?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:x.state===`starting`?`Starting ${w}…`:`Ask ${w} to change the design, or attach something from the canvas below.`}):null]})}),S?.approvals.length?(0,G.jsx)(`section`,{className:`flex max-h-[60%] min-h-0 flex-col gap-2 overflow-y-auto px-3 pt-1 pb-3`,"aria-label":`Waiting for your approval`,children:S.approvals.map(e=>(0,G.jsx)(Tk,{request:e,providerLabel:w,onAnswer:(t,n)=>void h().answerAgentApproval(e.id,t,n)},e.id))}):null,ie&&v===`model`&&T?.models.length?(0,G.jsx)(`div`,{className:`px-3 pt-2`,children:(0,G.jsx)(DO,{controls:T,providerLabel:w,onPick:e=>h().setAgentModel(e),onClose:()=>y(null)})}):null,ie&&v===`mcp`&&T?.mcp?(0,G.jsx)(`div`,{className:`px-3 pt-2`,children:(0,G.jsx)(kO,{providerLabel:w,actions:T.mcp.actions,load:b,act:(e,t)=>h().agentMcpAction(e,t),onClose:()=>y(null)})}):null,ie?(0,G.jsx)(AO,{controls:T,modeFallback:x.environment?.sandbox,onMode:e=>void h().setAgentMode(e),modelLabel:ae,onControl:y,text:i.text,cards:i.context,selection:O,attachable:k,staleness:j,providerLabel:w,running:oe,followUp:se,queued:S?.queued??[],disabled:x.state===`starting`,onText:e=>h().setAgentDraftText(e),onSend:()=>{ne.current=!0,h().sendAgentPrompt(A)},onStop:()=>void h().interruptAgent(),onAttach:e=>h().addAgentContext([e]),onRemove:e=>h().removeAgentContext(e),onClearComments:()=>h().clearAgentComments(),onDequeue:e=>void h().dequeueAgentPrompt(e),onReveal:e=>ee.onReveal(KO(e)),view:A}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border p-3 text-xs text-muted-foreground`,children:[(0,G.jsx)(`span`,{children:x.resumable?`${w} isn't running. Reopen the session to continue it, or start a new one.`:`This session has ended. Start a new one to keep going.`}),(0,G.jsxs)(`div`,{className:`flex gap-1.5`,children:[x.resumable?(0,G.jsx)(J,{size:`xs`,onClick:()=>void h().reopenAgentSession(x.id),children:`Reopen`}):null,(0,G.jsx)(J,{size:`xs`,variant:`outline`,onClick:()=>void h().selectAgentSession(null),children:`New session`})]})]})]})}var eA=`Moving a thread to the cloud republishes the conversation on the published board and removes the local copy. A board with no link yet is published first.`;function tA(){let e=q(e=>e.currentBoardId),t=q(e=>e.commentThreads),n=q(e=>e.commentStatus),r=q(e=>e.commentScope),i=q(e=>e.cloudComments),a=q(e=>e.activeCommentId),o=q(e=>e.refreshComments),s=q(e=>e.refreshCloudComments),c=q(e=>e.setCommentStatus),l=q(e=>e.setCommentScope),u=q(e=>e.setActiveComment),d=q(e=>e.locateComment),f=q(e=>e.createBoardComment),p=q(e=>e.replyToComment),m=q(e=>e.setCommentResolved),h=q(e=>e.moveCommentToCloud),g=q(e=>e.deleteComment),_=q(e=>e.deleteCommentMessage),v=q(e=>e.enterCommentMode),y=q(e=>e.addCommentsToAgent),[b,x]=(0,P.useState)(``),[S,C]=(0,P.useState)(`local`),[w,T]=(0,P.useState)(null),[E,D]=(0,P.useState)(``),[O,k]=(0,P.useState)(null),A=t.find(e=>e.id===a)??null,j=(0,P.useMemo)(()=>Dh(t),[t]),M=t.filter(e=>e.status===`open`),ee=q(Rd),te=(0,P.useMemo)(()=>f_(ee),[ee]),ne=(0,P.useMemo)(()=>p_(ee),[ee]),N=q(e=>e.authStatus?.loggedIn===!0),re=(0,P.useMemo)(()=>m_(N),[N]),ie=O?t.find(e=>e.id===O.threadId)??null:null;return(0,P.useEffect)(()=>{e&&o()},[e,o]),(0,P.useEffect)(()=>{s()},[s]),(0,P.useEffect)(()=>{D(``)},[a]),(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-velloo-comments-panel":!0,children:[(0,G.jsx)(O_,{status:n,onStatusChange:c,count:t.length,onAdd:v,children:(0,G.jsx)(tC,{scope:r,onChange:l})}),(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:A?(0,G.jsxs)(M_,{thread:A,voice:te,canDelete:ne,onBack:()=>u(null),onRequestDelete:k,replyDraft:E,onReplyDraftChange:D,onReply:()=>void p(A.id,E).then(()=>D(``)),onResolve:re(A)?()=>void m(A.id,A.status===`open`):void 0,children:[(0,G.jsxs)(J,{variant:`outline`,size:`sm`,onClick:()=>void y([{threadId:A.id}]),children:[(0,G.jsx)(an,{}),`Add to agent`]}),A.scope===`local`?(0,G.jsx)(nA,{thread:A,cloud:i,onMoveToCloud:()=>void h(A.id),onRequestDelete:k}):re(A)?(0,G.jsx)(N_,{thread:A,onRequestDelete:k}):null]}):t.length>0?(0,G.jsxs)(`ul`,{className:`space-y-1.5 p-2`,children:[M.length>1?(0,G.jsx)(`li`,{className:`flex justify-end`,children:(0,G.jsxs)(J,{variant:`ghost`,size:`xs`,className:`text-muted-foreground`,onClick:()=>void y(M.map(e=>({threadId:e.id}))),children:[(0,G.jsx)(an,{}),`Add `,M.length,` open comments to agent`]})}):null,t.map(e=>(0,G.jsx)(D_,{thread:e,number:j.get(e.id)??0,onOpen:()=>u(e.id),onLocate:()=>d(e.id),onAddToAgent:()=>void y([{threadId:e.id}]),onResolve:re(e)?()=>void m(e.id,e.status===`open`):void 0,onDelete:re(e)?()=>k({kind:`thread`,threadId:e.id}):void 0},e.id))]}):(0,G.jsx)(k_,{status:n})}),A?null:(0,G.jsx)(j_,{draft:b,onDraftChange:x,onSubmit:()=>{T(null),f(b,S).then(e=>{T(e),e||x(``)})},failure:w,target:(0,G.jsx)(nC,{scope:S,onChange:C,cloud:i,className:`min-w-0 flex-1`}),help:eC}),(0,G.jsx)(P_,{thread:ie,pending:O,onCancel:()=>k(null),onConfirm:()=>{O&&(O.kind===`thread`?g(O.threadId):_(O.threadId,O.id),k(null))},onResolveInstead:()=>{O&&m(O.threadId,!0),k(null)}})]})}function nA({thread:e,cloud:t,onMoveToCloud:n,onRequestDelete:r}){let i=t?.available===!1?t.reason:null,a=!!i&&i!==`unpublished`;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(J,{variant:`outline`,size:`sm`,disabled:t===void 0||a,title:a&&i?id(i):eA,onClick:n,children:[(0,G.jsx)(In,{}),` Move to cloud`,i===`unpublished`?(0,G.jsx)(So,{className:`text-amber-600`}):null]}),(0,G.jsx)(N_,{thread:e,onRequestDelete:r})]})}function rA(e,t){let n=(0,P.useRef)(null),r=(0,P.useRef)(t);return r.current=t,(0,P.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),(0,P.useCallback)(t=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>r.current(t),e)},[e])}function iA({initialValue:e,screenId:t,path:n,debounceMs:r,required:i}){let[a,o]=(0,P.useState)(e),s=(0,P.useRef)(null);(0,P.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let c=e=>{o(e),s.current&&clearTimeout(s.current),!(i&&e===``)&&(s.current=setTimeout(()=>{let r=e===``?null:e;B.updateProps({screenId:t,path:U(n),propPatch:{children:r}}).catch(e=>H(e,`Could not update text`))},r))};return(0,G.jsxs)(`section`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(Y,{htmlFor:`prop-children`,className:`text-xs font-medium text-muted-foreground`,children:`text`}),(0,G.jsx)(Vg,{id:`prop-children`,value:a,onChange:e=>c(e.target.value),rows:2,className:`min-h-0`})]})}function aA({node:e,tree:t,path:n,theme:r,descriptor:i,snippet:a,classChannel:o,computed:s,measured:c,onChange:l}){let u=_y(),d=(0,P.useMemo)(()=>Jy(r),[r]),f=(0,P.useMemo)(()=>Yy(r),[r]),p=(0,P.useCallback)(e=>qy(r,e),[r]),m=(0,P.useMemo)(()=>db({node:e,descriptor:i,snippet:a}).controls.filter(e=>e.kind!==`prompt`&&(o||e.slot.via!==`style`)),[e,i,a,o]),h=(0,P.useMemo)(()=>cx({theme:r,tree:t,path:U(n),node:e}),[r,t,n,e]);return m.length===0?null:(0,G.jsx)(Tx,{delayDuration:300,children:(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-2.5`,children:m.map(t=>{let n=$b(t,{node:e,themeValues:h.values,themeSource:h.source,computed:s}),r=t.kind===`color`||t.kind===`size`||t.kind===`prompt`;return(0,G.jsx)(`div`,{className:r?`col-span-2`:``,children:(0,G.jsx)(iS,{label:t.label,origin:n.origin,themeValue:n.themeValue,source:n.source,width:0,note:h.notes?.[t.id],onReset:n.origin===`changed`?()=>l(t,null):void 0,children:(0,G.jsx)(ES,{spec:t,value:n,colors:d,resolveColor:p,fonts:f,iconNames:u,measured:t.slot.via===`style`&&t.slot.key===`height`?c?.h??null:c?.w??null,onOpenPrompt:()=>void 0,onChange:(e,n)=>l(t,e,n)})})},t.id)})})})}var oA=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function sA({initialValue:e,screenId:t,path:n}){let[r,i]=(0,P.useState)(e),[a,o]=(0,P.useState)(null);return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs`,children:[(0,G.jsxs)(`label`,{htmlFor:`velloo-node-id`,className:`flex items-center justify-between text-muted-foreground uppercase tracking-wider`,children:[(0,G.jsx)(`span`,{children:`Stable id`}),a?(0,G.jsx)(`span`,{className:`normal-case text-destructive`,children:a}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,G.jsx)(`span`,{className:`text-muted-foreground font-mono`,children:`@`}),(0,G.jsx)(Z,{id:`velloo-node-id`,type:`text`,inputMode:`text`,autoComplete:`off`,spellCheck:!1,value:r,placeholder:`(none)`,onChange:e=>{i(e.target.value),o(null)},onBlur:()=>{let a=r.trim();a!==e&&(a!==``&&!oA.test(a)?o(`letters/digits/_/- only, leading letter`):(o(null),B.setNodeId({screenId:t,path:U(n),id:a===``?null:a}).catch(t=>{H(t,`Could not set node id`),i(e)})))},onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),t.currentTarget.blur()):t.key===`Escape`&&(i(e),o(null),t.currentTarget.blur())},"aria-invalid":a!==null,className:`flex-1 font-mono`})]})]})}var cA=`__velloo_unset__`,lA={held:!0};function uA(e,t){let n=e.trim();if(n===``)return{held:!1,value:void 0};let r=n.startsWith(`{`)||n.startsWith(`[`),i;try{i=JSON.parse(n)}catch{return r?lA:{held:!1,value:e}}return i===null||typeof i==`string`||(t?dA(i):typeof i==`object`)?{held:!1,value:i}:r?lA:{held:!1,value:e}}function dA(e){return Gc(e)||Array.isArray(e)&&e.every(e=>typeof e==`string`||Gc(e))}function fA(e,t){if(e==null)return``;let n=t&&pA(e)?e.$text:e;if(typeof n==`string`){let e=uA(n,t);if(!e.held&&e.value===n)return n}return JSON.stringify(e)}function pA(e){return typeof e==`object`&&!!e&&Object.keys(e).length===1&&typeof e.$text==`string`}function mA(e,t,n){return e===`node`?fA(t,n):t==null?``:typeof t==`string`?t:typeof t==`number`||typeof t==`boolean`?String(t):JSON.stringify(t)}function hA(e){let{kind:t,id:n,compact:r}=e,i=e.nodesOnly??!0,[a,o]=(0,P.useState)(()=>mA(t,e.initialValue,i)),[s,c]=(0,P.useState)(!!e.initialValue),l=t===`enum`&&!(e.enumValues&&e.enumValues.length>0)||t===`icon`&&!e.iconNames?`string`:t,u=r?`flex flex-col gap-1`:`flex flex-col gap-1.5`,d=(0,G.jsx)(Y,{htmlFor:n,className:e.labelClassName??(r?`text-[10px]`:`text-xs`),children:e.label});if(l===`boolean`){let t=t=>{c(t),e.onCommit(t)};return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,title:e.title,children:[d,(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(qD,{id:n,checked:s,onCheckedChange:e=>t(!!e)}),(0,G.jsx)(`span`,{className:r?`text-[11px] text-muted-foreground`:`text-xs text-muted-foreground`,children:String(s)})]})]})}if(l===`icon`)return(0,G.jsxs)(`div`,{className:u,title:e.title,children:[d,(0,G.jsx)(Zx,{value:a,options:e.iconNames??[],onChange:t=>{o(t),e.onCommit(t)}})]});if(l===`enum`){let t=e.enumValues??[],i=typeof t[0]==`number`;return(0,G.jsxs)(`div`,{className:u,title:e.title,children:[d,(0,G.jsxs)(bh,{value:a===``?e.allowUnset?cA:``:a,onValueChange:t=>{t===cA?(o(``),e.onCommit(void 0)):(o(t),e.onCommit(i?Number(t):t))},children:[(0,G.jsx)(Sh,{id:n,size:`sm`,className:r?`text-xs`:`text-sm`,children:(0,G.jsx)(xh,{placeholder:e.placeholder??`(unset)`})}),(0,G.jsxs)(Ch,{children:[e.allowUnset?(0,G.jsx)(X,{value:cA,children:`(unset)`}):null,t.map(e=>(0,G.jsx)(X,{value:String(e),children:String(e)},String(e)))]})]})]})}if(l===`number`)return(0,G.jsxs)(`div`,{className:u,title:e.title,children:[d,(0,G.jsx)(Z,{id:n,type:`number`,value:a,min:e.min,max:e.max,step:e.step,placeholder:e.placeholder,onChange:t=>{if(o(t.target.value),t.target.value===``&&e.emptyAsUndefined){e.onCommit(void 0);return}let n=Number(t.target.value);Number.isFinite(n)&&e.onCommit(n)},className:r?`h-7 text-xs`:void 0})]});if(l===`color`){let t=t=>{o(t),e.onCommit(e.emptyAsUndefined&&t===``?void 0:t)};return(0,G.jsxs)(`div`,{className:u,title:e.title,children:[d,(0,G.jsxs)(`div`,{className:r?`flex items-center gap-1.5`:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`color`,"aria-label":`${e.name} color picker`,value:a.startsWith(`#`)?a:`#000000`,onChange:e=>t(e.target.value),className:`h-7 w-9 shrink-0 cursor-pointer rounded-md border border-input bg-transparent`}),(0,G.jsx)(Z,{id:n,type:`text`,value:a,placeholder:e.placeholder,onChange:e=>t(e.target.value),className:r?`h-7 flex-1 font-mono text-xs`:`flex-1 font-mono`})]})]})}if(l===`node`){let t=uA(a,i).held;return(0,G.jsxs)(`div`,{className:u,title:e.title,children:[d,(0,G.jsx)(Z,{id:n,value:a,"aria-invalid":t||void 0,"aria-describedby":t?`${n}-held`:void 0,placeholder:e.placeholder??(i?`Text, or a node: {"$ref":"Card"}`:`Text, or JSON`),onChange:t=>{o(t.target.value);let n=uA(t.target.value,i);n.held||e.onCommit(n.value)},className:`h-7 font-mono text-[10px]`}),t?(0,G.jsx)(`p`,{id:`${n}-held`,className:`text-[10px] text-muted-foreground`,children:i?`Not saved — not a node yet. Write a node, a list, a quoted string, or plain text.`:`Not saved — not JSON yet.`}):null]})}return(0,G.jsxs)(`div`,{className:u,title:e.title,children:[d,(0,G.jsx)(Z,{id:n,type:`text`,value:a,placeholder:e.placeholder,onChange:t=>{o(t.target.value),e.onCommit(e.emptyAsUndefined&&t.target.value===``?void 0:t.target.value)},className:r?`h-7 text-xs`:void 0})]})}function gA(e){switch(e.control){case`boolean`:case`number`:case`color`:return e.control;case`icon`:case`enum`:return e.enumValues?e.control:`string`;default:return`string`}}function _A({descriptor:e,initialValue:t,onChange:n}){let r=gA(e);return(0,G.jsx)(hA,{kind:r,id:`prop-${e.name}`,name:e.name,label:(0,G.jsxs)(G.Fragment,{children:[e.name,e.optional?null:(0,G.jsx)(`span`,{className:`text-destructive`,children:` *`})]}),labelClassName:`text-xs font-medium text-muted-foreground capitalize`,initialValue:t,onCommit:n,emptyAsUndefined:!0,allowUnset:e.optional,enumValues:e.enumValues,iconNames:r===`icon`?e.enumValues:void 0,placeholder:r===`color`?`oklch(... 0 0) or #rrggbb`:void 0})}function vA({repo:e,entry:t}){let n=q(e=>e.repoCatalog),r=q(e=>t?e.repoStatus[t.id]:void 0),i=q(e=>e.openLibrary);ZE(t?[t.id]:[]);let a=[e.exportName,e.member].filter(Boolean).join(`.`),o=t?n?.entries.find(e=>!e.identity.member&&e.identity.importPath===t.identity.importPath&&e.identity.exportName===t.identity.exportName&&e.identity.app===t.identity.app)?.id??t.id:null;return(0,G.jsxs)(`section`,{className:`flex flex-col gap-2 rounded-md border p-3`,"data-repo-block":``,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs uppercase tracking-wider text-muted-foreground`,children:[(0,G.jsx)(sn,{size:12,strokeWidth:2}),(0,G.jsx)(`span`,{className:`flex-1`,children:`App component`}),(0,G.jsx)(XE,{diagnostic:r})]}),(0,G.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs`,children:[(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:`Import`}),(0,G.jsx)(`dd`,{className:`font-mono truncate`,title:e.importPath,children:e.importPath}),(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:`Export`}),(0,G.jsx)(`dd`,{className:`font-mono truncate`,children:a}),e.app?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-muted-foreground`,children:`App`}),(0,G.jsx)(`dd`,{className:`font-mono truncate`,children:e.app})]}):null]}),r&&r.status!==`exact`&&r.note?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r.note}):null,t?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-repo-styling":``,children:t.recipe?`Styled by ${t.recipe}'s theme — Velloo theme edits reach it through the recipe.`:`Styled by the app's own CSS.`}):n?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-repo-missing":``,children:`This import is not in the catalog — it still renders from the app, but Velloo has no props or previews for it.`}):null,o?(0,G.jsxs)(J,{variant:`ghost`,size:`xs`,className:`self-start -ml-2 text-muted-foreground`,onClick:()=>i({kind:`repo`,id:o}),children:[(0,G.jsx)(Rr,{}),`Open in Library`]}):null]})}function yA({props:e,values:t,hidden:n,fieldKey:r,onChange:i}){let[a,o]=(0,P.useState)(!1),s=e.filter(e=>e.serializable&&!e.slot&&!n.has(e.name)),c=s.filter(e=>!e.inherited),l=s.filter(e=>e.inherited);if(s.length===0)return null;let u=e=>(0,G.jsx)(_A,{descriptor:e,initialValue:t?.[e.name],onChange:t=>i(e.name,t)},`${r}:${e.name}`);return(0,G.jsxs)(`section`,{className:`flex flex-col gap-3`,"data-repo-props":``,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Props`}),c.map(u),l.length>0?(0,G.jsxs)(eT,{open:a,onOpenChange:o,children:[(0,G.jsxs)(tT,{className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(bn,{size:12,className:`transition-transform ${a?`rotate-90`:``}`}),l.length,` inherited prop`,l.length===1?``:`s`]}),(0,G.jsx)(nT,{className:`mt-3 flex flex-col gap-3`,children:l.map(u)})]}):null]})}var bA=200;function xA({selection:e,node:t}){let n=q(e=>e.design)?.snippets.find(e=>e.id===t.$snippet),r=_y(),[i,a]=(0,P.useState)(null);(0,P.useEffect)(()=>{let e=!0;return Zu(t.$snippet).then(t=>{e&&a(t)}).catch(()=>void 0),()=>{e=!1}},[t.$snippet]);let o=i?.params??n?.params??[],s=i?qc(i):null,c=rA(bA,e=>{B.updateSnippetArgs({screenId:e.screenId,path:U(e.path),argPatch:{[e.name]:e.value===void 0?null:e.value}}).catch(e=>H(e,`Could not update snippet arg`))}),l=(t,n)=>c({screenId:e.screenId,path:e.path,name:t,value:n});return(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,G.jsxs)(`header`,{className:`px-4 py-3 border-b`,children:[(0,G.jsxs)(`div`,{className:`font-semibold text-sm truncate`,children:[`@`,t.$snippet]}),(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[e.screenId,` · `,e.path===``?`(root)`:e.path,` · snippet instance`]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto scroll-stable p-4 flex flex-col gap-4`,children:[n==null?(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Snippet "`,t.$snippet,`" is not in the registry — the instance is dangling.`]}):o.length===0?(0,G.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`This snippet takes no params.`}):(0,G.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Args`}),o.map(n=>(0,G.jsx)(wA,{param:n,initialValue:t.args?.[n.name],onChange:e=>l(n.name,e),nodesOnly:s?.has(n.name)??!0,lucideIconNames:r},`${e.screenId}:${e.path}:${n.name}`))]}),(0,G.jsx)(SA,{snippetId:t.$snippet,selection:e})]})]})}function SA({snippetId:e,selection:t}){let[n,r]=(0,P.useState)(null),i=q(e=>e.screenVersion),a=q(e=>e.selectScreen),o=q(e=>e.setSelection);if((0,P.useEffect)(()=>{let t=!0;return fetch(`/api/snippets/${encodeURIComponent(e)}/instances`).then(e=>e.ok?e.json():Promise.reject(Error(`${e.status}`))).then(e=>{t&&r(e.instances)}).catch(()=>{t&&r([])}),()=>{t=!1}},[e,i]),!n)return null;let s=n.filter(e=>e.hasOverride).length,c=e=>e.screenId===t.screenId&&e.path===t.path;return(0,G.jsxs)(`section`,{className:`flex flex-col gap-2 border-t pt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Instances`}),(0,G.jsxs)(`div`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:[n.length,` total · `,s,` with override`]})]}),n.length===0?(0,G.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:`Not used yet — instantiate from the Snippets panel to see this list populate.`}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:n.map(e=>{let t=e.screenId.startsWith(`snippet:`),n=t?e.screenId.slice(8):e.screenId,r=c(e);return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,disabled:t||r,onClick:async()=>{t||r||(await a(e.screenId),o({screenId:e.screenId,path:e.path}))},title:r?`This is the instance you're currently editing.`:t?`Used inside snippet "${n}" — open via Snippets list.`:`Jump to ${e.screenId} · ${e.path===``?`(root)`:e.path}`,className:r?`flex w-full items-center justify-between gap-2 rounded-md border border-primary bg-primary/10 px-1.5 py-1 text-left text-[10px] cursor-default`:`flex w-full items-center justify-between gap-2 rounded-md border bg-background px-1.5 py-1 text-left text-[10px] hover:bg-muted disabled:opacity-60`,children:[(0,G.jsxs)(`span`,{className:r?`truncate text-primary font-medium`:`truncate text-foreground`,children:[r?`● `:t?`↳ snippet: `:``,n]}),(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.path===``?`(root)`:e.path}),e.hasOverride?(0,G.jsx)(`span`,{className:`shrink-0 rounded bg-primary/10 px-1 text-primary`,children:`override`}):null]})},`${e.screenId}:${e.path}`)})})]})}function CA(e){switch(e.type){case`string`:case`boolean`:case`number`:case`icon`:case`color`:case`node`:return e.type;case`enum`:return Array.isArray(e.enum)&&e.enum.length>0?`enum`:`string`}}function wA({param:e,initialValue:t,onChange:n,lucideIconNames:r,nodesOnly:i}){let a=CA(e);return(0,G.jsx)(hA,{kind:a,id:`snip-arg-${e.name}`,name:e.name,label:e.name,labelClassName:`text-xs`,title:e.description??void 0,initialValue:t,onCommit:n,enumValues:e.enum,iconNames:r,nodesOnly:i,min:e.min,max:e.max,step:e.step??1,placeholder:a===`enum`?`(choose)`:void 0})}function TA({selection:e,node:t}){let n=q(e=>e.design),r=q(t=>t.screens[e.screenId]),i=e.screenId.slice(8),a=n?.snippets.find(e=>e.id===i)?.params??[],o=a.filter(e=>e.type===`node`),s=a.filter(e=>e.type===`boolean`);return(0,G.jsxs)(`section`,{className:`flex flex-col gap-3 border-t pt-4`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Substitutions`}),(0,G.jsx)(EA,{nodeParams:o.map(e=>e.name),onInsert:async t=>{if(!r)return;let n=structuredClone(r.tree),a=n;for(let t of U(e.path)){if(!a||!xc(a))return;a=a.children?.[t]}if(a&&xc(a)){a.children=[...a.children??[],{$param:t}];try{await R(`update_snippet`,{snippetId:i,patch:{tree:n}}),V({kind:`success`,message:`Inserted {$param: ${t}} slot`})}catch(e){H(e,`Could not insert param ref`)}}}}),(0,G.jsx)(DA,{node:t,boolParams:s.map(e=>e.name),onWrap:async(n,r)=>{let i=t.props?.[n];try{await B.updateProps({screenId:e.screenId,path:U(e.path),propPatch:{[n]:{$if:r,then:i??``,else:``}}}),V({kind:`success`,message:`${n} now branches on {$if: ${r}}`})}catch(e){H(e,`Could not add if branch`)}}})]})}function EA({nodeParams:e,onInsert:t}){return e.length===0?(0,G.jsxs)(`div`,{className:`text-[11px] text-muted-foreground leading-relaxed`,children:[(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:`+ param ref`}),` — this snippet has no`,` `,(0,G.jsx)(`code`,{className:`text-[10px] font-mono px-1 py-0.5 rounded bg-muted`,children:`node`}),` param to slot in. Ask your agent to declare one.`]}):(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(Y,{className:`text-xs`,children:`+ param ref`}),(0,G.jsxs)(bh,{value:``,onValueChange:t,children:[(0,G.jsx)(Sh,{size:`sm`,className:`text-xs`,"aria-label":`Insert a param-ref slot`,children:(0,G.jsx)(xh,{placeholder:`Insert {$param} slot as child…`})}),(0,G.jsx)(Ch,{children:e.map(e=>(0,G.jsx)(X,{value:e,children:`{$param: ${e}}`},e))})]})]})}function DA({node:e,boolParams:t,onWrap:n}){let[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(``);if(t.length===0)return(0,G.jsxs)(`div`,{className:`text-[11px] text-muted-foreground leading-relaxed`,children:[(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:`+ if branch`}),` — this snippet has no`,` `,(0,G.jsx)(`code`,{className:`text-[10px] font-mono px-1 py-0.5 rounded bg-muted`,children:`boolean`}),` param to branch on. Ask your agent to declare one.`]});let s=new Set([`className`]);e.children&&e.children.length!==0||s.add(`children`);for(let[t,n]of Object.entries(e.props??{}))t!==`asChild`&&(typeof n==`object`&&n||s.add(t));return(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,G.jsx)(Y,{className:`text-xs`,children:`+ if branch`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsxs)(bh,{value:r,onValueChange:i,children:[(0,G.jsx)(Sh,{size:`sm`,className:`flex-1 text-xs`,"aria-label":`Prop to branch`,children:(0,G.jsx)(xh,{placeholder:`prop`})}),(0,G.jsx)(Ch,{children:[...s].map(e=>(0,G.jsx)(X,{value:e,children:e},e))})]}),(0,G.jsxs)(bh,{value:a,onValueChange:o,children:[(0,G.jsx)(Sh,{size:`sm`,className:`flex-1 text-xs`,"aria-label":`Boolean param`,children:(0,G.jsx)(xh,{placeholder:`$if param`})}),(0,G.jsx)(Ch,{children:t.map(e=>(0,G.jsx)(X,{value:e,children:e},e))})]}),(0,G.jsx)(J,{size:`xs`,variant:`outline`,className:`h-7 text-xs shrink-0`,disabled:r===``||a===``,onClick:()=>{n(r,a),i(``),o(``)},children:`Wrap`})]}),(0,G.jsxs)(`div`,{className:`text-[10px] text-muted-foreground leading-relaxed`,children:[`Wraps the prop's current value in `,(0,G.jsx)(`code`,{className:`font-mono`,children:`{$if, then, else}`}),` — tune the branches in the prop field after.`]})]})}function OA(e,t,n){switch(t){case`all`:e.top=e.right=e.bottom=e.left=n;break;case`x`:e.left=e.right=n;break;case`y`:e.top=e.bottom=n;break;default:e[t]=n}}function kA(e){return e===`all`?0:e===`x`||e===`y`?1:2}function AA(e){let{top:t,right:n,bottom:r,left:i}=e,a={};return t===void 0&&n===void 0&&r===void 0&&i===void 0?a:t!==void 0&&t===n&&n===r&&r===i?(a.all=t,a):(t!==void 0&&t===r?a.y=t:(t!==void 0&&(a.top=t),r!==void 0&&(a.bottom=r)),i!==void 0&&i===n?a.x=i:(i!==void 0&&(a.left=i),n!==void 0&&(a.right=n)),a)}var jA={padding:{box:`padding`,v:`all`},paddingTop:{box:`padding`,v:`top`},paddingRight:{box:`padding`,v:`right`},paddingBottom:{box:`padding`,v:`bottom`},paddingLeft:{box:`padding`,v:`left`},margin:{box:`margin`,v:`all`},marginTop:{box:`margin`,v:`top`},marginRight:{box:`margin`,v:`right`},marginBottom:{box:`margin`,v:`bottom`},marginLeft:{box:`margin`,v:`left`}},MA=[`display`,`flexDirection`,`justifyContent`,`alignItems`,`gap`,`width`,`height`,`fontFamily`,`fontSize`,`fontWeight`,`lineHeight`,`letterSpacing`,`textAlign`,`color`,`backgroundColor`,`borderRadius`],NA=new Set(MA);function PA(e){return NA.has(e)}function FA(e){return typeof e==`string`&&e.trim().includes(` `)}function IA(e){if(typeof e==`number`)return e;if(typeof e==`string`){let t=/^(-?\d*\.?\d+)px$/.exec(e.trim());if(t)return Number(t[1])}return null}function LA(e){let t={padding:{},margin:{}},n={},r=[];for(let[i,a]of Object.entries(e??{})){let e=jA[i];e&&(typeof a==`number`||typeof a==`string`)&&!(e.v===`all`&&FA(a))?r.push({box:e.box,v:e.v,val:a}):PA(i)&&(typeof a==`number`||typeof a==`string`)?t[i]=a:n[i]=a}r.sort((e,t)=>kA(e.v)-kA(t.v));for(let e of r)OA(t[e.box],e.v,e.val);return{model:t,extra:n}}var RA={top:`Top`,right:`Right`,bottom:`Bottom`,left:`Left`};function zA(e,t,n){let{top:r,right:i,bottom:a,left:o}=t;if(r!==void 0||i!==void 0||a!==void 0||o!==void 0){if(r!==void 0&&r===i&&i===a&&a===o)n[e]=r;else for(let r of[`top`,`right`,`bottom`,`left`]){let i=t[r];i!==void 0&&(n[`${e}${RA[r]}`]=i)}}}function BA({model:e,extra:t}){let n={};for(let t of MA){let r=e[t];r!==void 0&&(n[t]=r)}return zA(`padding`,e.padding,n),zA(`margin`,e.margin,n),Object.assign(n,t),n}var VA=[[`flex`],[`block`],[`grid`],[`inline-flex`],[`none`]],HA=[{value:`row`,icon:(0,G.jsx)(Kt,{className:`size-3.5`}),title:`row`},{value:`column`,icon:(0,G.jsx)(Bt,{className:`size-3.5`}),title:`column`}],UA=[[`flex-start`,`start`],[`center`],[`flex-end`,`end`],[`space-between`,`between`],[`space-around`,`around`]],WA=[[`flex-start`,`start`],[`center`],[`flex-end`,`end`],[`stretch`]],GA=[[`400`],[`500`],[`600`],[`700`],[`300`]],KA=[{value:`left`,label:`L`},{value:`center`,label:`C`},{value:`right`,label:`R`},{value:`justify`,label:`J`}],qA=[`px`,`rem`,`em`,`%`,`vh`,`vw`,`—`],JA=e=>e===void 0?``:String(e);function YA(e){if(e===void 0)return{num:``,unit:`px`};if(typeof e==`number`)return{num:String(e),unit:`px`};let t=/^(-?\d*\.?\d+)(px|rem|em|%|vh|vw)?$/.exec(e.trim());return t?{num:t[1]??``,unit:t[2]??`—`}:{num:e,unit:`—`}}function XA(e,t){let n=e.trim();if(!n)return;let r=/^-?\d*\.?\d+$/.test(n);return t===`px`?r?Number(n):`${n}px`:t===`—`?r?Number(n):n:`${n}${t}`}function ZA(e){let t=e.trim();if(/^-?\d*\.?\d+$/.test(t))return Number(t);try{let e=JSON.parse(t);if(typeof e==`object`&&e)return e}catch{}return e}function QA({initialValue:e,prop:t,screenId:n,path:r,debounceMs:i}){let[a,o]=(0,P.useState)(()=>LA(e)),[s,c]=(0,P.useState)(``),l=rA(i,e=>{let i=BA(e);B.updateProps({screenId:n,path:U(r),propPatch:{[t]:Object.keys(i).length?i:null}}).catch(e=>H(e,`Could not update styles`))}),u=e=>{o(e),l(e)},d=a.model,f=e=>u({...a,model:{...d,...e}}),p=e=>{let t=e.trim();if(t)return/^-?\d+(\.\d+)?$/.test(t)?Number(t):t},m=(e,t,n)=>f({[e]:{...d[e],[t]:p(n)}}),h=e=>{let t=IA(e);return t===null?JA(e):String(t)},g=e=>({top:h(e.top),right:h(e.right),bottom:h(e.bottom),left:h(e.left)}),_=e=>{let{num:t,unit:n}=YA(d[e]);return(0,G.jsx)(Mw,{value:t,unit:n,units:qA,onChange:t=>f({[e]:XA(t,n)}),onUnitChange:n=>f({[e]:XA(t,n)}),className:`w-28`})},v=Object.entries(BA(a)),y=(e,t)=>u(LA({...BA(a),[e]:ZA(t)})),b=e=>{let{[e]:t,...n}=BA(a);u(LA(n))};return(0,G.jsxs)(`div`,{className:`-mx-4 -mb-4 flex flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-primary/5 px-3 py-2`,children:[(0,G.jsx)(Ht,{className:`size-3.5 text-primary`}),(0,G.jsx)(`span`,{className:`text-[11px] text-foreground`,children:`Controls ⇄ declarations — edit either side`})]}),(0,G.jsx)(Aw,{title:`Box model`,children:(0,G.jsx)(Lw,{contentLabel:`content`,padding:g(d.padding),margin:g(d.margin),onPadding:(e,t)=>m(`padding`,e,t),onMargin:(e,t)=>m(`margin`,e,t)})}),(0,G.jsxs)(Aw,{title:`Layout`,children:[(0,G.jsx)($,{label:`display`,children:(0,G.jsx)(Nw,{value:JA(d.display)||`—`,onChange:e=>f({display:e===`—`?void 0:e}),options:kw(VA,d.display)})}),(0,G.jsx)($,{label:`flexDirection`,children:(0,G.jsx)(jw,{value:JA(d.flexDirection)||void 0,onChange:e=>f({flexDirection:e}),options:HA})}),(0,G.jsx)($,{label:`justify`,children:(0,G.jsx)(Nw,{value:JA(d.justifyContent)||`—`,onChange:e=>f({justifyContent:e===`—`?void 0:e}),options:kw(UA,d.justifyContent)})}),(0,G.jsx)($,{label:`alignItems`,children:(0,G.jsx)(Nw,{value:JA(d.alignItems)||`—`,onChange:e=>f({alignItems:e===`—`?void 0:e}),options:kw(WA,d.alignItems)})}),(0,G.jsx)($,{label:`gap`,children:_(`gap`)})]}),(0,G.jsxs)(Aw,{title:`Typography`,children:[(0,G.jsx)($,{label:`fontSize`,children:_(`fontSize`)}),(0,G.jsx)($,{label:`lineHeight`,children:_(`lineHeight`)}),(0,G.jsx)($,{label:`fontWeight`,children:(0,G.jsx)(Nw,{value:JA(d.fontWeight)||`—`,onChange:e=>f({fontWeight:e===`—`?void 0:e}),options:kw(GA,d.fontWeight),className:`min-w-[5rem]`})}),(0,G.jsx)($,{label:`textAlign`,children:(0,G.jsx)(jw,{value:JA(d.textAlign)||void 0,onChange:e=>f({textAlign:e}),options:KA})}),(0,G.jsx)($,{label:`color`,children:(0,G.jsx)(Fw,{value:JA(d.color),onChange:e=>f({color:e||void 0}),placeholder:`var(--foreground)`})})]}),(0,G.jsxs)(Aw,{title:`Appearance`,children:[(0,G.jsx)($,{label:`background`,children:(0,G.jsx)(Fw,{value:JA(d.backgroundColor),onChange:e=>f({backgroundColor:e||void 0}),placeholder:`var(--card)`})}),(0,G.jsx)($,{label:`radius`,children:_(`borderRadius`)})]}),(0,G.jsxs)(Aw,{title:`Declarations (raw, synced)`,children:[v.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-28 shrink-0 truncate font-mono text-[11px] text-muted-foreground`,children:e}),(0,G.jsx)(`input`,{value:typeof t==`string`?t:typeof t==`number`?String(t):JSON.stringify(t),spellCheck:!1,onChange:t=>y(e,t.target.value),className:`min-w-0 flex-1 h-6 rounded border border-input bg-background px-1.5 font-mono text-[11px] outline-none`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>b(e),className:`text-muted-foreground hover:text-foreground`,"aria-label":`remove ${e}`,children:(0,G.jsx)(Ho,{className:`size-3`})})]},e)),v.length===0?(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`no styles`}):null,(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(ua,{className:`size-3 text-muted-foreground`}),(0,G.jsx)(Mw,{value:s,onChange:c,className:`w-full`,placeholder:`property…`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{let e=s.trim();!e||e in BA(a)||(u(LA({...BA(a),[e]:``})),c(``))},className:`text-[11px] text-muted-foreground hover:text-foreground`,children:`add`})]}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`A bare number is px (gap: 16); other units → a string ('0.875rem', '50vh'). Unitless props stay numbers (lineHeight: 1.5).`})]})]})}var $A={p:{box:`padding`,v:`all`},padding:{box:`padding`,v:`all`},px:{box:`padding`,v:`x`},py:{box:`padding`,v:`y`},pt:{box:`padding`,v:`top`},paddingTop:{box:`padding`,v:`top`},pr:{box:`padding`,v:`right`},paddingRight:{box:`padding`,v:`right`},pb:{box:`padding`,v:`bottom`},paddingBottom:{box:`padding`,v:`bottom`},pl:{box:`padding`,v:`left`},paddingLeft:{box:`padding`,v:`left`},m:{box:`margin`,v:`all`},margin:{box:`margin`,v:`all`},mx:{box:`margin`,v:`x`},my:{box:`margin`,v:`y`},mt:{box:`margin`,v:`top`},marginTop:{box:`margin`,v:`top`},mr:{box:`margin`,v:`right`},marginRight:{box:`margin`,v:`right`},mb:{box:`margin`,v:`bottom`},marginBottom:{box:`margin`,v:`bottom`},ml:{box:`margin`,v:`left`},marginLeft:{box:`margin`,v:`left`}},ej=[`display`,`flexDirection`,`justifyContent`,`alignItems`,`gap`,`width`,`height`,`fontSize`,`fontWeight`,`lineHeight`,`letterSpacing`,`textAlign`,`typography`,`color`,`bgcolor`,`boxShadow`,`borderRadius`,`fontFamily`],tj=new Set(ej);function nj(e){return tj.has(e)}var rj=8;function ij(e){if(typeof e==`number`)return e*rj;if(typeof e==`string`){let t=/^(-?\d*\.?\d+)px$/.exec(e.trim());if(t)return Number(t[1])}return null}function aj(e){return e%rj===0?e/rj:`${e}px`}function oj(e){let t={padding:{},margin:{}},n={},r=[];for(let[i,a]of Object.entries(e??{})){let e=$A[i];e&&(typeof a==`string`||typeof a==`number`)?r.push({box:e.box,v:e.v,val:a}):nj(i)&&(typeof a==`string`||typeof a==`number`)?t[i]=a:n[i]=a}r.sort((e,t)=>kA(e.v)-kA(t.v));for(let e of r)OA(t[e.box],e.v,e.val);return{model:t,extra:n}}function sj(e,t,n){let r=AA(t),i={all:e,x:`${e}x`,y:`${e}y`,top:`${e}t`,right:`${e}r`,bottom:`${e}b`,left:`${e}l`};for(let[e,t]of Object.entries(r))t!==void 0&&(n[i[e]]=t)}function cj({model:e,extra:t}){let n={};for(let t of ej){let r=e[t];r!==void 0&&(n[t]=r)}return sj(`p`,e.padding,n),sj(`m`,e.margin,n),Object.assign(n,t),n}var lj=[[`flex`],[`block`],[`grid`],[`inline-flex`],[`none`]],uj=[{value:`row`,icon:(0,G.jsx)(Kt,{className:`size-3.5`}),title:`row`},{value:`column`,icon:(0,G.jsx)(Bt,{className:`size-3.5`}),title:`column`}],dj=[[`flex-start`,`start`],[`center`],[`flex-end`,`end`],[`space-between`,`between`],[`space-around`,`around`],[`space-evenly`,`evenly`]],fj=[[`flex-start`,`start`],[`center`],[`flex-end`,`end`],[`stretch`],[`baseline`]],pj=[[`normal`],[`medium`],[`semibold`],[`bold`],[`light`]],mj=[{value:`left`,label:`L`},{value:`center`,label:`C`},{value:`right`,label:`R`},{value:`justify`,label:`J`}],hj=e=>e===void 0?``:String(e);function gj(e){let t=e.trim();if(t)return/^-?\d+(\.\d+)?$/.test(t)?Number(t):t}function _j(e){let t=ij(e);return t===null?hj(e):String(t)}function vj(e){let t=e.trim();if(t)return/^-?\d+(\.\d+)?$/.test(t)?aj(Number(t)):t}function yj({initialValue:e,prop:t,screenId:n,path:r,debounceMs:i}){let[a,o]=(0,P.useState)(()=>oj(e)),[s,c]=(0,P.useState)(``),l=rA(i,e=>{let i=cj(e);B.updateProps({screenId:n,path:U(r),propPatch:{[t]:Object.keys(i).length?i:null}}).catch(e=>H(e,`Could not update styles`))}),u=e=>{o(e),l(e)},d=a.model,f=e=>u({...a,model:{...d,...e}}),p=(e,t,n)=>f({[e]:{...d[e],[t]:vj(n)}}),m=e=>({top:_j(e.top),right:_j(e.right),bottom:_j(e.bottom),left:_j(e.left)}),h=Object.entries(a.extra),g=(e,t)=>{let n=t;try{n=JSON.parse(t)}catch{}u({...a,extra:{...a.extra,[e]:n}})},_=e=>{let{[e]:t,...n}=a.extra;u({...a,extra:n})},v=()=>{let e=s.trim();!e||e in a.extra||(u({...a,extra:{...a.extra,[e]:``}}),c(``))},y=JSON.stringify(cj(a),null,2);return(0,G.jsxs)(`div`,{className:`-mx-4 -mb-4 flex flex-col`,children:[(0,G.jsxs)(Aw,{title:`Layout`,children:[(0,G.jsx)($,{label:`display`,children:(0,G.jsx)(Nw,{value:hj(d.display)||`—`,onChange:e=>f({display:e===`—`?void 0:e}),options:kw(lj,d.display)})}),(0,G.jsx)($,{label:`flexDirection`,children:(0,G.jsx)(jw,{value:hj(d.flexDirection)||void 0,onChange:e=>f({flexDirection:e}),options:uj})}),(0,G.jsx)($,{label:`justify`,children:(0,G.jsx)(Nw,{value:hj(d.justifyContent)||`—`,onChange:e=>f({justifyContent:e===`—`?void 0:e}),options:kw(dj,d.justifyContent)})}),(0,G.jsx)($,{label:`alignItems`,children:(0,G.jsx)(Nw,{value:hj(d.alignItems)||`—`,onChange:e=>f({alignItems:e===`—`?void 0:e}),options:kw(fj,d.alignItems)})}),(0,G.jsx)($,{label:`gap`,children:(0,G.jsx)(Mw,{value:_j(d.gap),onChange:e=>f({gap:vj(e)}),unit:`px`})})]}),(0,G.jsxs)(Aw,{title:`Spacing · theme.spacing ×8`,children:[(0,G.jsx)(Lw,{contentLabel:`content`,padding:m(d.padding),margin:m(d.margin),onPadding:(e,t)=>p(`padding`,e,t),onMargin:(e,t)=>p(`margin`,e,t)}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`number → theme.spacing(n): 2 = 16px; off-grid → a px string.`})]}),(0,G.jsxs)(Aw,{title:`Typography`,children:[(0,G.jsx)($,{label:`typography`,children:(0,G.jsx)(Nw,{value:hj(d.typography)||`—`,onChange:e=>f({typography:e===`—`?void 0:e}),options:kw([[`body1`],[`body2`],[`subtitle1`],[`subtitle2`],[`h6`],[`caption`]],d.typography),className:`min-w-[6rem]`})}),(0,G.jsx)($,{label:`fontSize`,children:(0,G.jsx)(Mw,{value:hj(d.fontSize),onChange:e=>f({fontSize:gj(e)}),placeholder:`14`})}),(0,G.jsx)($,{label:`fontWeight`,children:(0,G.jsx)(Nw,{value:hj(d.fontWeight)||`—`,onChange:e=>f({fontWeight:e===`—`?void 0:e}),options:kw(pj,d.fontWeight),className:`min-w-[6rem]`})}),(0,G.jsx)($,{label:`textAlign`,children:(0,G.jsx)(jw,{value:hj(d.textAlign)||void 0,onChange:e=>f({textAlign:e}),options:mj})}),(0,G.jsx)($,{label:`color`,children:(0,G.jsx)(Fw,{value:hj(d.color),onChange:e=>f({color:e||void 0}),placeholder:`text.primary`})})]}),(0,G.jsxs)(Aw,{title:`Appearance`,children:[(0,G.jsx)($,{label:`bgcolor`,children:(0,G.jsx)(Fw,{value:hj(d.bgcolor),onChange:e=>f({bgcolor:e||void 0}),placeholder:`background.paper`})}),(0,G.jsx)($,{label:`boxShadow`,children:(0,G.jsx)(Mw,{value:hj(d.boxShadow),onChange:e=>f({boxShadow:gj(e)}),unit:`elev`})}),(0,G.jsx)($,{label:`borderRadius`,children:(0,G.jsx)(Mw,{value:hj(d.borderRadius),onChange:e=>f({borderRadius:gj(e)})})})]}),(0,G.jsxs)(Aw,{title:`Additional sx (raw)`,children:[(0,G.jsx)(`p`,{className:`text-[10px] text-muted-foreground`,children:`props the controls don't cover — pseudo-selectors, transitions, one-offs`}),h.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`w-24 shrink-0 truncate font-mono text-[11px] text-muted-foreground`,children:e}),(0,G.jsx)(`input`,{defaultValue:typeof t==`string`?t:JSON.stringify(t),spellCheck:!1,onChange:t=>g(e,t.target.value),className:`min-w-0 flex-1 h-6 rounded border border-input bg-background px-1.5 font-mono text-[11px] outline-none`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>_(e),className:`text-muted-foreground hover:text-foreground`,"aria-label":`remove ${e}`,children:(0,G.jsx)(Ho,{className:`size-3`})})]},e)),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(ua,{className:`size-3 text-muted-foreground`}),(0,G.jsx)(Rw,{placeholder:`property…`,value:s,onChange:c,onSubmit:v})]})]}),(0,G.jsx)(Aw,{title:`sx (merged)`,defaultOpen:!1,children:(0,G.jsx)(Iw,{code:y})})]})}async function bj(e,t,n){let r=e.typography.fontFamily??{},i=Object.entries(r).find(([,e])=>zC(e)===n.family);if(i)return i[0];let a=Sj(xj(n.family),r);return await Nd.setFonts(t,[HC(a,n)]),a}function xj(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``);return/^[a-z]/.test(t)?t:`font-${t}`}function Sj(e,t){if(!(e in t))return e;let n=2;for(;`${e}-${n}`in t;)n++;return`${e}-${n}`}function Cj({theme:e,tree:t,path:n,node:r}){let i=bb(e,t,n,r);if(!i)return null;let{resolved:a,overrides:o}=i;return(0,G.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Typeset`}),(0,G.jsxs)(`div`,{className:`rounded-md border bg-background`,children:[(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 border-b px-2.5 py-2`,children:[(0,G.jsx)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] font-semibold text-foreground`,children:i.role}),(0,G.jsxs)(`span`,{className:`truncate text-[10px] text-muted-foreground`,children:[`from `,i.via]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col px-2.5 py-1.5`,children:[(0,G.jsx)(Oj,{label:`Size`,value:`${a.fontSize}px`,override:o.size}),(0,G.jsx)(Oj,{label:`Leading`,value:a.lineHeight.toFixed(2),override:o.leading}),(0,G.jsx)(Oj,{label:`Tracking`,value:a.letterSpacing,override:o.tracking}),(0,G.jsx)(Oj,{label:`Weight`,value:String(a.fontWeight),override:o.weight}),(0,G.jsx)(Oj,{label:`Face`,value:Tj(i),override:o.family,mono:i.face.role!==void 0})]})]}),wj(o)?(0,G.jsx)(`p`,{className:`text-[10px] leading-snug text-amber-600 dark:text-amber-500`,children:`Every rung property is overridden here, so this node ignores the theme's ladder — a rhythm change in the Theme tab won't move it.`}):null,(0,G.jsxs)(`p`,{className:`text-[10px] leading-snug text-muted-foreground`,children:[Dj(i),` Change the rhythm or the faces in the Theme tab — it moves every node on this rung at once.`]}),i.responsive.length>0?(0,G.jsxs)(`p`,{className:`text-[10px] leading-snug text-muted-foreground/80`,children:[`Also `,(0,G.jsx)(`span`,{className:`font-mono text-foreground`,children:i.responsive.join(` `)}),` at wider breakpoints.`]}):null]})}function wj(e){return[`size`,`leading`,`tracking`,`weight`].every(t=>e[t])}function Tj(e){let{slot:t,role:n,stack:r}=e.face;if(!n)return`inherited (${t})`;let i=r?Ej(r):null;return i?`${n} → ${i}`:n}function Ej(e){return/^\s*(?:"([^"]+)"|'([^']+)'|([^,]+))/.exec(e)?.slice(1).find(Boolean)?.trim()??e}function Dj(e){let{region:t}=e;if(!t)return`Resolved against the default typeset — no typeset region wraps this node.`;let n=t.via===`prose`?`a Prose ancestor`:`a typeset class on an ancestor`;return`Resolved against the ${t.name==="default"?`default`:t.name} typeset, applied by ${n}.`}function Oj({label:e,value:t,override:n,mono:r}){return(0,G.jsxs)(`div`,{className:`flex items-baseline gap-2 py-1`,children:[(0,G.jsx)(`span`,{className:`w-16 shrink-0 text-[10px] text-muted-foreground`,children:e}),(0,G.jsx)(`span`,{title:t,className:n?`min-w-0 max-w-[45%] truncate font-mono text-[11px] text-muted-foreground/60 line-through`:`min-w-0 flex-1 truncate text-[11px] text-foreground${r?` font-mono`:``}`,children:t}),n?(0,G.jsx)(`span`,{title:`${n} overrides the ${e.toLowerCase()} this rung would set`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground`,children:n}):null]})}var kj=200,Aj=new Set([`className`,`asChild`,`children`]);function jj(){let e=q(e=>e.selection),t=q(e=>e.selectionComputed),n=vy(),r=q(e=>e.components),i=q(e=>e.repoCatalog),a=q(e=>e.screens),o=q(e=>e.styleChannel),s=q(e=>e.channelsByLibrary),c=q(e=>e.theme),l=q(e=>e.themeName),u=q(e=>e.browsingFaces),d=q(e=>e.setBrowsingFaces),f=q(e=>e.loadComponents),p=q(e=>e.loadGeneratedAssets);(0,P.useEffect)(()=>{f()},[f]),(0,P.useEffect)(()=>{p()},[p]);let m=(0,P.useMemo)(()=>ef(a,e),[a,e]),h=e?a[e.screenId]?.tree:void 0,g=(0,P.useMemo)(()=>!m||!r||!xc(m)||Fc(m)?null:r.find(e=>e.id===m.$ref)??null,[m,r]),_=(0,P.useMemo)(()=>m&&Fc(m)?km(i,m.$repo):null,[m,i]),v=q(t=>qd(t.design,e?.screenId)),y=q(e=>g?e.libraryStatus[Kd(v,g.id)]:null);QE(v,g?[g.id]:[]);let b=rA(kj,e=>{B.updateProps({screenId:e.screenId,path:U(e.path),propPatch:{[e.name]:e.value===void 0?null:e.value}}).catch(e=>H(e,`Could not update prop`))}),x=mx({selection:e,node:m,liveClasses:m?Yb(m):``}),S=Fy(t),C=n[0]??null;if(!e)return(0,G.jsx)(ET,{size:`panel`,icon:Ei,title:`Nothing selected`,hint:`Click a node in the canvas to edit its props.`});if(!m)return(0,G.jsx)(ET,{size:`panel`,icon:Oo,title:`Selection is gone`,hint:`The selected node is no longer in the tree.`});if(Sc(m))return(0,G.jsx)(xA,{selection:e,node:m});if(wc(m))return(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,G.jsxs)(`header`,{className:`px-4 py-3 border-b`,children:[(0,G.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:`Text`}),(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[e.screenId,` · `,e.path]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto scroll-stable p-4 flex flex-col gap-4`,children:[(0,G.jsx)(iA,{initialValue:m.$text,screenId:e.screenId,path:e.path,debounceMs:kj,required:!0},`${e.screenId}:${e.path}:text`),(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Text beside other elements. It has no element of its own, so it takes the type and color of the element it sits in — select that to style it.`})]})]});if(!xc(m))return(0,G.jsx)(ET,{size:`panel`,icon:ln,title:`Not editable here`,hint:`$param placeholders are only addressable inside a snippet body — open the snippet to edit.`});let w=(t,n)=>b({screenId:e.screenId,path:e.path,name:t,value:n}),T=a[e.screenId]?.library,E=(T?s[T]:void 0)??o,D=Fc(m)?m.$repo:null,O=_?.styleProps??[],k=O.includes(`sx`)?`sx`:O.includes(`style`)?`style`:null,A=D?O.includes(`className`)&&E?.kind===`tailwind-classname`:E?.kind!==`sx`&&E?.kind!==`style`,j=D?k??`className`:E?.prop??`className`,M=D?k:E?.kind,ee=M===`sx`||M===`style`,te=new Set([...Aj,j,...O,...db({node:m,descriptor:g}).controls.map(e=>e.slot.via===`prop`?e.slot.name:null).filter(e=>e!==null)]),ne=fb(m),N=`${e.screenId}:${e.path}`,re=typeof m.props?.children==`string`?m.props.children:``,ie=typeof m.props?.children==`string`||(D?(_?.acceptsChildren??!0)&&!m.children?.length:g===null),ae=typeof m.props?.src==`string`?m.props.src:null,oe=`${N}:${ae??``}`;if(u&&c){let t=h?bb(c,h,U(e.path),m):null,n=t?.overrides.family?.replace(/^font-/,``)??t?.face.role??t?.face.slot??`body`,r=c.typography.fontFamily?.[n];return(0,G.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,G.jsx)(FC,{role:n,current:r?zC(r):void 0,onBack:()=>d(!1),onPick:t=>{d(!1);let n=e;bj(c,l,t).then(e=>B.applyClasses({screenId:n.screenId,path:U(n.path),classes:tx(typeof m.props?.className==`string`?m.props.className:``,`fontFamily`,e)})).catch(e=>H(e,`Could not set the face`))}})})}return(0,G.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[(0,G.jsxs)(`header`,{className:`px-4 py-3 border-b`,children:[(0,G.jsxs)(`div`,{className:`font-semibold text-sm truncate`,children:[m.$ref,ne?(0,G.jsx)(`span`,{className:`ml-1.5 font-mono text-xs text-muted-foreground`,children:ne}):null,(0,G.jsx)(XE,{diagnostic:y,className:`ml-1.5 align-middle`})]}),(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground mt-0.5`,children:[e.screenId,` · `,e.path===``?`(root)`:e.path]})]}),(0,G.jsx)(Nj,{},N),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto scroll-stable p-4 flex flex-col gap-4`,children:[D?(0,G.jsx)(vA,{repo:D,entry:_}):null,(0,G.jsx)(sA,{initialValue:Vc(m)??``,screenId:e.screenId,path:e.path},`${N}:id`),ie?(0,G.jsx)(iA,{initialValue:re,screenId:e.screenId,path:e.path,debounceMs:kj},`${N}:children`):null,ae===null?null:(0,G.jsx)(wx,{screenId:e.screenId,path:e.path,src:ae,nodeAspect:typeof m.props?.aspect==`string`?m.props.aspect:void 0},`${N}:image`),D&&!A?null:(0,G.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Style`}),(0,G.jsx)(aA,{node:m,tree:h,path:e.path,theme:c,descriptor:g,snippet:null,classChannel:A,computed:S,measured:C,onChange:x},`${N}:style`)]}),c&&h?(0,G.jsx)(Cj,{theme:c,tree:h,path:U(e.path),node:m}):null,_?(0,G.jsx)(yA,{props:_.props,values:m.props,hidden:te,fieldKey:oe,onChange:w}):null,g&&g.props.filter(e=>!te.has(e.name)).length>0?(0,G.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`div`,{className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`Props`}),g.props.filter(e=>!te.has(e.name)).map(e=>(0,G.jsx)(_A,{descriptor:e,initialValue:m.props?.[e.name],onChange:t=>w(e.name,t)},`${oe}:${e.name}`))]}):null,e.screenId.startsWith(`snippet:`)?(0,G.jsx)(TA,{selection:e,node:m},`${N}:subs`):null,ee?(()=>{let t=m.props?.[j]&&typeof m.props[j]==`object`?m.props[j]:void 0,n=`${N}:${j}`,r={initialValue:t,prop:j,screenId:e.screenId,path:e.path,debounceMs:kj};return M===`sx`?(0,G.jsx)(yj,{...r},n):(0,G.jsx)(QA,{...r},n)})():null]})]})}var Mj=[`default`,`hover`,`focus`,`active`,`disabled`];function Nj(){let e=q(e=>e.nodeState),t=q(e=>e.setNodeState);return(0,P.useEffect)(()=>(t(`default`),()=>t(`default`)),[t]),(0,G.jsxs)(`div`,{className:`px-4 py-2 border-b flex items-center gap-2`,children:[(0,G.jsx)(Y,{htmlFor:`node-state`,className:`text-xs uppercase tracking-wider text-muted-foreground`,children:`State`}),(0,G.jsxs)(bh,{value:e,onValueChange:e=>t(e),children:[(0,G.jsx)(Sh,{id:`node-state`,size:`sm`,className:`flex-1 text-xs`,children:(0,G.jsx)(xh,{})}),(0,G.jsx)(Ch,{children:Mj.map(e=>(0,G.jsx)(X,{value:e,children:e},e))})]})]})}function Pj(e,t){return t?`${e} — ${t}`:e}function Fj({side:e,expandLabel:t,hotkey:n,onExpand:r,actions:i=[]}){return(0,G.jsxs)(`div`,{className:`flex h-full w-full flex-col items-center gap-1 py-2`,children:[(0,G.jsx)(J,{variant:`ghost`,size:`icon-sm`,onClick:r,title:Pj(t,n),"aria-label":t,"aria-expanded":!1,children:e===`left`?(0,G.jsx)(Bi,{}):(0,G.jsx)(Wi,{})}),i.length>0?(0,G.jsx)(`div`,{className:`my-1 h-px w-4 shrink-0 bg-border`}):null,i.map(e=>(0,G.jsxs)(J,{variant:`ghost`,size:`icon-sm`,onClick:e.onClick,title:e.dot?`${e.label} — ${e.dot.title}`:e.label,"aria-label":e.label,className:`relative ${e.active?`bg-accent text-accent-foreground`:`text-muted-foreground`}`,children:[e.icon,e.dot?(0,G.jsx)(`span`,{"data-rail-dot":e.label,className:`absolute right-1 top-1 size-1.5 rounded-full bg-primary`}):null]},e.label))]})}function Ij({side:e,label:t,hotkey:n,onCollapse:r}){return(0,G.jsx)(J,{variant:`ghost`,size:`icon-sm`,onClick:r,title:Pj(t,n),"aria-label":t,"aria-expanded":!0,className:`shrink-0 text-muted-foreground`,children:e===`left`?(0,G.jsx)(Ri,{}):(0,G.jsx)(Hi,{})})}function Lj({from:e,existing:t,onClose:n}){let r=q(e=>e.startTheme),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(!1),c=cl(i),l=ll(c,t),u=c===``?null:l,d=async()=>{if(!(l||o)){s(!0);try{await r(c),n()}catch(e){H(e,`Could not create the theme`),s(!1)}}};return(0,G.jsx)(fh,{open:!0,onOpenChange:e=>{!e&&!o&&n()},children:(0,G.jsx)(hh,{"data-testid":`new-theme`,className:`sm:max-w-md`,children:(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),d()},children:[(0,G.jsxs)(gh,{children:[(0,G.jsx)(vh,{children:`New theme`}),(0,G.jsxs)(yh,{children:[`It starts as a copy of `,kC(e),`. Next you choose its colour, type and shape; this board switches to it when you are done.`]})]}),(0,G.jsxs)(G_,{"data-invalid":u?!0:void 0,children:[(0,G.jsx)(q_,{htmlFor:`new-theme-name`,children:`Name`}),(0,G.jsx)(Z,{id:`new-theme-name`,autoFocus:!0,autoComplete:`off`,spellCheck:!1,value:i,placeholder:`Night`,"aria-invalid":u?!0:void 0,"aria-describedby":`new-theme-name-help`,onChange:e=>a(e.target.value)}),u?(0,G.jsx)(Y_,{id:`new-theme-name-help`,children:u}):(0,G.jsxs)(J_,{id:`new-theme-name-help`,children:[`Saved as theme/`,c||`Night`,`.json — the name your agent uses for it too.`]})]}),(0,G.jsxs)(_h,{children:[(0,G.jsx)(J,{type:`button`,variant:`ghost`,onClick:n,disabled:o,children:`Cancel`}),(0,G.jsx)(J,{type:`submit`,disabled:l!==null||o,children:`Create and define`})]})]})})})}function Rj(){let e=q(e=>e.currentBoardId),t=q(e=>e.themeName),n=q(e=>e.folderConfig),r=q(e=>e.loadFolderConfig),[i,a]=(0,P.useState)(!1);(0,P.useEffect)(()=>{r()},[r]);let o=n?.themes??[`default`],s=o.includes(t)?o:[...o,t],c=async n=>{if(e&&n!==t)try{await B.updateBoard({boardId:e,patch:{theme:n==="default"?null:n}})}catch(e){H(e,`Could not switch the theme`)}};return(0,G.jsxs)(`div`,{className:`mb-3 flex flex-col gap-1.5 rounded-md border bg-muted/40 p-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Theme`}),(0,G.jsx)(Nw,{value:t,onChange:e=>void c(e),options:s.map(e=>[e,kC(e)]),className:`ml-auto min-w-[8rem]`,label:`Theme this board uses`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(!0),disabled:!e,title:`New theme`,"aria-label":`New theme`,className:`size-7 shrink-0 grid place-items-center rounded-md border border-input bg-background text-muted-foreground hover:text-foreground disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer`,children:(0,G.jsx)(ua,{size:13})})]}),(0,G.jsx)(`span`,{className:`text-[10px] leading-snug text-muted-foreground`,children:e?t==="default"?`The theme every board uses unless it picks another. Edits here reach all of those.`:`This board uses ${t}. Edits here leave boards on other themes alone.`:`No board selected.`}),i?(0,G.jsx)(Lj,{from:t,existing:s,onClose:()=>a(!1)}):null]})}function zj({className:e,...t}){return(0,G.jsx)(Ue,{"data-slot":`accordion`,className:W(`flex w-full flex-col`,e),...t})}function Bj({className:e,...t}){return(0,G.jsx)(mt,{"data-slot":`accordion-item`,className:W(`not-last:border-b`,e),...t})}function Vj({className:e,children:t,...n}){return(0,G.jsx)(Oe,{className:`flex`,children:(0,G.jsxs)(yt,{"data-slot":`accordion-trigger`,className:W(`group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring disabled:pointer-events-none disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground`,e),...n,children:[t,(0,G.jsx)(gn,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden`}),(0,G.jsx)(Sn,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline`})]})})}function Hj({className:e,children:t,...n}){return(0,G.jsx)(Ve,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up`,...n,children:(0,G.jsx)(`div`,{className:W(`h-(--radix-accordion-content-height) pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),children:t})})}var Uj=`velloo:theme-panel:sections`,Wj=[`colour`,`type`,`shape`],Gj=[`colour`];function Kj(){if(typeof localStorage>`u`)return Gj;let e=localStorage.getItem(Uj);if(!e)return Gj;try{let t=JSON.parse(e);if(Array.isArray(t)){let e=t.filter(e=>Wj.includes(e));return e.length>0||t.length===0?e:Gj}}catch{}return Gj}function qj({theme:e}){let t=q(e=>e.themeName),n=q(e=>e.refreshTheme),r=q(e=>e.openLanguage),i=q(e=>e.designMode),a=q(e=>e.setDesignMode),[o,s]=(0,P.useState)(()=>Kj()),[c,l]=(0,P.useState)(null);if((0,P.useEffect)(()=>{typeof localStorage<`u`&&localStorage.setItem(Uj,JSON.stringify(o))},[o]),c!==null){let r=e.typography.fontFamily?.[c];return(0,G.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,G.jsx)(FC,{role:c,current:r?zC(r):void 0,onBack:()=>l(null),onPick:e=>{l(null),Nd.setFonts(t,[HC(c,e)]).catch(e=>{H(e,`Could not set the face`),n()})}})})}let u=`text-xs uppercase tracking-wider text-muted-foreground hover:no-underline`;return(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto scroll-stable p-4`,children:[(0,G.jsx)(Rj,{}),(0,G.jsxs)(J,{variant:`outline`,size:`sm`,className:`mb-3 w-full justify-start`,title:`The whole language: its rules in words, on a specimen of your components`,onClick:()=>void r(`review`).catch(e=>H(e,`Could not open`)),children:[(0,G.jsx)(po,{}),`Open the design language`]}),(0,G.jsxs)(zj,{type:`multiple`,value:o,onValueChange:e=>s(e),className:`flex flex-col gap-1`,children:[(0,G.jsxs)(Bj,{value:`colour`,children:[(0,G.jsx)(Vj,{className:u,children:`Colour`}),(0,G.jsx)(Hj,{children:(0,G.jsx)(gT,{theme:e,scheme:i,onSchemeChange:a})})]}),(0,G.jsxs)(Bj,{value:`type`,children:[(0,G.jsx)(Vj,{className:u,children:`Type`}),(0,G.jsx)(Hj,{children:(0,G.jsx)(_T,{theme:e,onBrowse:l})})]}),(0,G.jsxs)(Bj,{value:`shape`,children:[(0,G.jsx)(Vj,{className:u,children:`Shape`}),(0,G.jsx)(Hj,{children:(0,G.jsx)(hw,{theme:e})})]})]})]})}var Jj=[{value:`node`,label:`Node`,Icon:Qa},{value:`theme`,label:`Theme`,Icon:Pi}];function Yj({screenId:e}){let t=q(e=>e.rightTab),n=q(e=>e.setRightTab),r=q(e=>e.selection),i=q(e=>e.selectionIntent),a=q(e=>e.pendingCommentAnchor),o=q(e=>e.activeCommentId),s=q(e=>e.theme),c=q(e=>e.cursorMode),l=q(e=>e.wsConnected),u=q(e=>e.commentArrivals.length),d=q(e=>e.rightPaneCollapsed),f=q(e=>e.setRightPaneCollapsed),p=q(e=>e.rightPaneWidth),m=q(e=>e.setRightPaneWidth),h=(0,P.useRef)(`node`);(t===`node`||t===`theme`)&&(h.current=t);let g=t===`node`||t===`theme`?`design`:t;(0,P.useEffect)(()=>{q.getState().rightTab!==`agent`&&r&&i===`inspect`&&!a&&!o&&c!==`comment`&&n(`node`)},[r,i,a,o,c,n]);let _=c===`hand`,v=e=>{n(e),f(!1)};return(0,G.jsxs)(RD,{side:`right`,collapsed:d,width:p,onResize:m,contentDisabled:!l,rail:(0,G.jsx)(Fj,{side:`right`,expandLabel:`Expand inspector`,hotkey:`]`,onExpand:()=>f(!1),actions:[{icon:(0,G.jsx)(an,{}),label:`Agent`,active:t===`agent`,dot:u>0?{title:`New comments to hand to the agent`}:void 0,onClick:()=>v(`agent`)},{icon:(0,G.jsx)(Qa,{}),label:`Node`,active:t===`node`,onClick:()=>v(`node`)},{icon:(0,G.jsx)(Pi,{}),label:`Theme`,active:t===`theme`,onClick:()=>v(`theme`)},{icon:(0,G.jsx)(mi,{}),label:`Comments`,active:t===`comments`,onClick:()=>v(`comments`)}]}),children:[(0,G.jsxs)(`div`,{className:`border-b p-2 flex items-center gap-1`,children:[(0,G.jsx)(Ij,{side:`right`,label:`Collapse inspector`,hotkey:`]`,onCollapse:()=>f(!0)}),(0,G.jsx)($x,{value:g,onValueChange:e=>n(e===`design`?h.current:e),className:`@container min-w-0 flex-1`,children:(0,G.jsxs)(tS,{"data-hint":`panes`,className:`w-full h-8 @max-[15rem]:[&_svg]:hidden`,children:[(0,G.jsxs)(nS,{value:`agent`,className:`min-w-0 flex-auto px-1 text-xs`,children:[(0,G.jsx)(an,{}),(0,G.jsx)(`span`,{className:`truncate`,children:`Agent`}),u>0&&g!==`agent`?(0,G.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-primary`,role:`img`,"aria-label":`New comments to hand to the agent`}):null]}),(0,G.jsxs)(nS,{value:`design`,className:`min-w-0 flex-auto px-1 text-xs`,children:[(0,G.jsx)(na,{}),(0,G.jsx)(`span`,{className:`truncate`,children:`Design`})]}),(0,G.jsxs)(nS,{value:`comments`,"data-hint":`comments`,className:`min-w-0 flex-auto px-1 text-xs`,children:[(0,G.jsx)(mi,{}),(0,G.jsx)(`span`,{className:`truncate`,children:`Comments`})]})]})})]}),g===`design`?(0,G.jsx)($x,{value:t,onValueChange:e=>n(e),className:`border-b px-2`,children:(0,G.jsx)(tS,{variant:`line`,className:`w-full h-8`,"aria-label":`Design`,children:Jj.map(({value:e,label:t,Icon:n})=>(0,G.jsxs)(nS,{value:e,className:`min-w-0 flex-auto px-1 text-xs`,"aria-label":t,children:[(0,G.jsx)(n,{}),(0,G.jsx)(`span`,{className:`truncate`,children:t})]},e))})}):null,t===`agent`?(0,G.jsx)($k,{}):t===`comments`?(0,G.jsx)(tA,{}):t===`node`?_?(0,G.jsx)(Zj,{children:`Hand tool active. Drag to pan; press V or Esc to return to select.`}):e?(0,G.jsx)(jj,{}):(0,G.jsx)(Zj,{children:`No screen selected.`}):s?(0,G.jsx)(qj,{theme:s}):(0,G.jsx)(Zj,{children:(0,G.jsx)(py,{size:24,label:`Loading theme…`,className:`flex-col`})})]})}function Xj(){let e=q(e=>e.rightPaneCollapsed),t=q(e=>e.setRightPaneCollapsed),n=q(e=>e.rightPaneWidth),r=q(e=>e.setRightPaneWidth),i=q(e=>e.wsConnected);return(0,G.jsxs)(RD,{side:`right`,collapsed:e,width:n,onResize:r,contentDisabled:!i,rail:(0,G.jsx)(Fj,{side:`right`,expandLabel:`Expand the agent`,hotkey:`]`,onExpand:()=>t(!1),actions:[{icon:(0,G.jsx)(an,{}),label:`Agent`,active:!0,onClick:()=>t(!1)}]}),children:[(0,G.jsxs)(`div`,{className:`border-b p-2 flex h-12 items-center gap-2`,children:[(0,G.jsx)(Ij,{side:`right`,label:`Collapse the agent`,hotkey:`]`,onCollapse:()=>t(!0)}),(0,G.jsx)(an,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`text-xs font-medium`,children:`Agent`})]}),(0,G.jsx)($k,{})]})}function Zj({children:e}){return(0,G.jsx)(Jm,{className:`flex-1 p-6`,children:(0,G.jsx)($m,{className:`text-xs`,children:e})})}var Qj=[`all`,`boards`,`screens`,`text`];function $j(){let e=q(e=>e.searchOpen),t=q(e=>e.setSearchOpen),[n,r]=(0,P.useState)(``),[i,a]=(0,P.useState)(null),[o,s]=(0,P.useState)(`all`),[c,l]=(0,P.useState)(0),u=(0,P.useRef)(0),d=(0,P.useRef)(null);(0,P.useEffect)(()=>{e&&(r(``),a(null),s(`all`),l(0))},[e]),(0,P.useEffect)(()=>{if(!e)return;let t=n.trim();if(t===``){a(null);return}let r=setTimeout(()=>{let e=++u.current;kd(t).then(t=>{e===u.current&&(a(t),l(0))}).catch(()=>{})},120);return()=>clearTimeout(r)},[n,e]);let f=(0,P.useMemo)(()=>i?{boards:o===`all`||o===`boards`?i.boards:[],screens:o===`all`||o===`screens`?i.screens:[],text:o===`all`||o===`text`?i.text:[]}:{boards:[],screens:[],text:[]},[i,o]),p=(0,P.useMemo)(()=>[...f.boards.map(e=>({kind:`board`,hit:e})),...f.screens.map(e=>({kind:`screen`,hit:e})),...f.text.map(e=>({kind:`text`,hit:e}))],[f]),m=Math.min(c,Math.max(0,p.length-1));(0,P.useEffect)(()=>{d.current?.querySelector(`[data-result-index="${m}"]`)?.scrollIntoView({block:`nearest`})},[m]);let h=async e=>{t(!1);let n=q.getState();if(n.view!==`boards`&&n.setView(`boards`),e.kind===`board`){await n.selectBoard(e.hit.id);return}let r=e.kind===`screen`?e.hit.id:e.hit.screenId,i=e.kind===`screen`?e.hit.boards:e.hit.board?[e.hit.board]:[],a=i.some(e=>e.id===n.currentBoardId)?n.currentBoardId:i[0]?.id??null;if(a&&a!==n.currentBoardId&&await n.selectBoard(a),e.kind===`screen`?await n.selectScreen(r):q.getState().revealSelection({screenId:r,path:Qd(e.hit.path)}),!a)return;let o=q.getState().boards[a]?.frames.find(e=>e.screen===r);o&&requestAnimationFrame(()=>q.getState().centerOnFrame(o.id))},g=e=>{if(e.key===`ArrowDown`)e.preventDefault(),l(e=>Math.min(e+1,Math.max(0,p.length-1)));else if(e.key===`ArrowUp`)e.preventDefault(),l(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=p[m];t&&h(t)}else if(e.key===`Tab`){e.preventDefault();let t=e.shiftKey?Qj.length-1:1;s(e=>Qj[(Qj.indexOf(e)+t)%Qj.length]??`all`),l(0)}},_=i?.query??``,v=i?i.boards.length+i.screens.length+i.textTotal:0,y=i?{all:v,boards:i.boards.length,screens:i.screens.length,text:i.textTotal}:null,b=-1;return(0,G.jsx)(fh,{open:e,onOpenChange:t,children:(0,G.jsxs)(hh,{"aria-describedby":void 0,onKeyDown:g,className:`top-[16%] max-w-[680px] translate-y-0 gap-0 overflow-hidden p-0 [&>[data-slot=dialog-close]]:hidden`,children:[(0,G.jsx)(vh,{className:`sr-only`,children:`Search boards, screens, and text`}),(0,G.jsxs)(Hg,{className:`h-[52px] rounded-none border-0 border-b shadow-none has-[[data-slot=input-group-control]:focus-visible]:ring-0`,children:[(0,G.jsx)(Wg,{children:(0,G.jsx)(Ma,{size:17,className:`shrink-0 text-muted-foreground`})}),(0,G.jsx)(qg,{autoFocus:!0,value:n,onChange:e=>r(e.target.value),placeholder:`Search boards, screens, and text…`,className:`text-[15px]`}),(0,G.jsx)(Wg,{align:`inline-end`,children:(0,G.jsx)(ME,{children:`esc`})})]}),y?(0,G.jsx)(rv,{type:`single`,value:o,onValueChange:e=>{e&&(s(e),l(0))},"aria-label":`Result filter`,className:`justify-start gap-1.5 border-b px-3 py-2`,children:Qj.map(e=>(0,G.jsxs)(iv,{value:e,className:`rounded-full bg-muted px-2.5 text-[11px] capitalize data-[state=on]:bg-foreground data-[state=on]:font-medium data-[state=on]:text-background`,children:[e===`all`?`All`:e,` `,y[e]]},e))}):null,(0,G.jsx)(`div`,{ref:d,className:`max-h-[380px] overflow-y-auto scroll-stable pb-1.5`,children:i?p.length===0?(0,G.jsx)(Jm,{className:`p-6`,children:(0,G.jsxs)(Ym,{children:[(0,G.jsx)(Zm,{variant:`icon`,children:(0,G.jsx)(Aa,{})}),(0,G.jsxs)(Qm,{children:[`No matches for “`,_,`”.`]})]})}):(0,G.jsxs)(G.Fragment,{children:[f.boards.length>0?(0,G.jsx)(eM,{children:`Boards`}):null,f.boards.map(e=>{b+=1;let t=b;return(0,G.jsxs)(tM,{index:t,active:t===m,onPick:()=>void h({kind:`board`,hit:e}),onHover:()=>l(t),children:[e.archived?(0,G.jsx)(Rt,{size:16,className:`shrink-0 text-muted-foreground`,"aria-label":`Archived board`}):(0,G.jsx)(Ir,{size:16,className:`shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`truncate text-[13.5px] ${e.archived?`text-muted-foreground`:``}`,children:(0,G.jsx)(nM,{text:e.name,query:_})}),(0,G.jsxs)(`span`,{className:`ml-auto shrink-0 text-[11.5px] text-muted-foreground`,children:[e.archived?`Archived · `:``,e.frameCount,` frame`,e.frameCount===1?``:`s`]})]},e.id)}),f.screens.length>0?(0,G.jsx)(eM,{children:`Screens`}):null,f.screens.map(e=>{b+=1;let t=b;return(0,G.jsxs)(tM,{index:t,active:t===m,onPick:()=>void h({kind:`screen`,hit:e}),onHover:()=>l(t),children:[(0,G.jsx)(fr,{size:16,className:`shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`truncate text-[13.5px]`,children:(0,G.jsx)(nM,{text:e.name,query:_})}),(0,G.jsx)(`span`,{className:`ml-auto shrink-0 text-[11.5px] text-muted-foreground`,children:e.boards.map(e=>e.name).join(` · `)||`Not on a board`})]},e.id)}),f.text.length>0?(0,G.jsx)(eM,{children:`Text matches`}):null,f.text.map(e=>{b+=1;let t=b;return(0,G.jsx)(tM,{index:t,active:t===m,onPick:()=>void h({kind:`text`,hit:e}),onHover:()=>l(t),tall:!0,children:(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`p`,{className:`truncate text-[13px]`,children:[`“`,e.excerpt.slice(0,e.matchStart),(0,G.jsx)(`mark`,{className:`rounded-[3px] bg-primary/15 px-0.5 font-medium text-primary`,children:e.excerpt.slice(e.matchStart,e.matchEnd)}),e.excerpt.slice(e.matchEnd),`”`]}),(0,G.jsxs)(`p`,{className:`truncate text-[11px] text-muted-foreground`,children:[e.board?`${e.board.name} › `:``,e.screenName,` › `,e.ref,e.nodeId?` @${e.nodeId}`:``,e.prop===`children`?``:` · ${e.prop}`]})]})},`${e.screenId}:${e.path.join(`.`)}`)}),i.textTotal>f.text.length&&(o===`all`||o===`text`)?(0,G.jsxs)(`p`,{className:`px-4 py-1.5 text-[11.5px] text-muted-foreground`,children:[i.textTotal-f.text.length,` more text match`,i.textTotal-f.text.length===1?``:`es`,` — keep typing to narrow.`]}):null]}):(0,G.jsx)(Jm,{className:`p-6`,children:(0,G.jsxs)(Ym,{children:[(0,G.jsx)(Zm,{variant:`icon`,children:(0,G.jsx)(Ma,{})}),(0,G.jsx)($m,{children:`Type to search board names, screen names, and text inside screens.`})]})})}),(0,G.jsxs)(`div`,{className:`flex h-10 items-center gap-4 border-t px-4 text-[11px] text-muted-foreground`,children:[(0,G.jsx)(rM,{keys:`↑↓`,children:`navigate`}),(0,G.jsx)(rM,{keys:`↵`,children:`jump to match`}),(0,G.jsx)(rM,{keys:`tab`,children:`switch filter`}),i?(0,G.jsxs)(`span`,{className:`ml-auto`,children:[v,` match`,v===1?``:`es`]}):null]})]})})}function eM({children:e}){return(0,G.jsx)(`p`,{className:`px-4 pb-1 pt-2.5 text-[10.5px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e})}function tM({index:e,active:t,tall:n,onPick:r,onHover:i,children:a}){return(0,G.jsx)(`button`,{type:`button`,"data-result-index":e,onClick:r,onMouseMove:i,className:W(`mx-1.5 flex w-[calc(100%-0.75rem)] items-center gap-3 rounded-md px-2.5 text-left`,n?`py-2`:`h-10`,t&&`bg-accent`),children:a})}function nM({text:e,query:t}){let n=t?e.toLowerCase().indexOf(t.toLowerCase()):-1;return n===-1?(0,G.jsx)(G.Fragment,{children:e}):(0,G.jsxs)(G.Fragment,{children:[e.slice(0,n),(0,G.jsx)(`mark`,{className:`rounded-[3px] bg-primary/15 px-0.5 font-medium text-primary`,children:e.slice(n,n+t.length)}),e.slice(n+t.length)]})}function rM({keys:e,children:t}){return(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(NE,{children:[...e].map(e=>(0,G.jsx)(ME,{children:e},e))}),t]})}function iM({children:e,className:t}){return(0,G.jsx)(`div`,{className:W(`text-[10.5px] font-semibold uppercase tracking-wider text-muted-foreground`,t),children:e})}function aM({children:e}){return(0,G.jsx)(`div`,{className:`mt-2 divide-y divide-border/70`,children:e})}function oM({label:e,description:t,htmlFor:n,children:r}){let i=`block text-[13px] font-medium text-foreground`;return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-6 py-2.5`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[n?(0,G.jsx)(`label`,{htmlFor:n,className:i,children:e}):(0,G.jsx)(`div`,{className:i,children:e}),t?(0,G.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-snug text-muted-foreground`,children:t}):null]}),(0,G.jsx)(`div`,{className:`flex shrink-0 items-center justify-end gap-3`,children:r})]})}function sM({label:e,stacked:t,children:n}){return(0,G.jsxs)(`div`,{className:W(`flex gap-2 text-[12px]`,t?`items-start`:`items-center`),children:[(0,G.jsx)(`span`,{className:`w-[68px] shrink-0 text-muted-foreground`,children:e}),(0,G.jsx)(`span`,{className:W(`flex min-w-0 text-foreground`,t?`flex-col items-start gap-1`:`items-center gap-1.5`),children:n})]})}var cM=`__default__`;function lM({cfg:e}){let t=q(e=>e.currentBoardId),n=q(e=>e.design),r=q(e=>e.boards),i=q(e=>e.loadBoard),a=q(e=>e.setBoardArchived),o=[...n?.boards??[],...n?.archivedBoards??[]],[s,c]=(0,P.useState)(t??o[0]?.id??``),l=o.find(e=>e.id===s)??null,u=r[s]??null,d=(0,P.useId)(),f=(0,P.useId)();if((0,P.useEffect)(()=>{s&&i(s).catch(()=>{})},[s,i]),!l)return(0,G.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`This folder has no boards yet.`});let p=l.archivedAt!=null,m=new Set((u?.frames??[]).map(e=>e.screen)).size;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-border bg-muted/40 px-3 py-2.5`,children:[(0,G.jsx)(Ir,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`text-[12px] text-muted-foreground`,children:`Editing`}),(0,G.jsxs)(bh,{value:s,onValueChange:c,children:[(0,G.jsx)(Sh,{className:`ml-auto w-[300px] bg-background text-[13px]`,children:(0,G.jsx)(xh,{})}),(0,G.jsxs)(Ch,{children:[(n?.boards??[]).map(e=>(0,G.jsx)(X,{value:e.id,children:e.name},e.id)),(n?.archivedBoards??[]).map(e=>(0,G.jsxs)(X,{value:e.id,children:[e.name,` (archived)`]},e.id))]})]})]}),(0,G.jsx)(iM,{className:`mt-5`,children:`Identity`}),(0,G.jsxs)(aM,{children:[(0,G.jsx)(oM,{label:`Name`,description:`Shown in the sidebar, search, and published links.`,htmlFor:d,children:(0,G.jsx)(dM,{id:d,value:l.name,onCommit:async e=>{if(e!==l.name)try{await B.updateBoard({boardId:s,patch:{name:e}})}catch(e){H(e,`Could not rename the board`)}}})}),(0,G.jsx)(oM,{label:`Board id`,description:`The filename on disk. Fixed once created — frames and links point at it.`,children:(0,G.jsxs)(`div`,{className:`flex w-[300px] items-center gap-2 rounded-md bg-muted px-2.5 py-1.5`,children:[(0,G.jsxs)(`span`,{className:`truncate font-mono text-[12px] text-muted-foreground`,children:[`boards/`,s,`.json`]}),(0,G.jsx)(Qr,{className:`ml-auto size-3 shrink-0 text-muted-foreground`})]})})]}),(0,G.jsx)(iM,{className:`mt-5`,children:`Theme`}),(0,G.jsx)(aM,{children:(0,G.jsx)(oM,{label:`Render this board with`,description:`Every frame here re-renders on change. Screens are untouched.`,htmlFor:f,children:(0,G.jsxs)(bh,{value:u?.theme??cM,onValueChange:async e=>{try{await B.updateBoard({boardId:s,patch:{theme:e===cM?null:e}}),await i(s)}catch(e){H(e,`Could not change the board theme`)}},children:[(0,G.jsx)(Sh,{id:f,className:`w-[300px] text-[13px]`,children:(0,G.jsx)(xh,{})}),(0,G.jsxs)(Ch,{children:[(0,G.jsx)(X,{value:cM,children:`Folder default`}),e.themes.filter(e=>e!=="default").map(e=>(0,G.jsx)(X,{value:e,children:e},e))]})]})})}),(0,G.jsx)(iM,{className:`mt-5`,children:`Contents`}),(0,G.jsxs)(`div`,{className:`mt-2 grid grid-cols-3 gap-3`,children:[(0,G.jsx)(uM,{n:u?.frames.length??l.frameCount,label:`frames`}),(0,G.jsx)(uM,{n:m,label:m===1?`screen`:`screens`}),(0,G.jsx)(uM,{n:u?.groups.length??0,label:u?.groups.length===1?`group`:`groups`})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-start gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[p?(0,G.jsx)(It,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}):(0,G.jsx)(Rt,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-[13px] font-medium text-foreground`,children:p?`This board is archived`:`Archive this board`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-snug text-muted-foreground`,children:p?`It stays out of the sidebar and out of publishes until you restore it.`:`Files it out of the sidebar and out of publishes. Nothing is deleted — the file stays and you can restore it any time.`})]}),(0,G.jsx)(J,{variant:`outline`,size:`sm`,className:`ml-auto h-8 shrink-0 text-[12.5px]`,onClick:()=>{a(s,!p).catch(e=>H(e,p?`Could not restore the board`:`Could not archive it`))},children:p?`Restore`:`Archive`})]})]})}function uM({n:e,label:t}){return(0,G.jsxs)(`div`,{className:`rounded-lg bg-muted/50 px-3 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[18px] font-semibold leading-tight text-foreground`,children:e}),(0,G.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t})]})}function dM({id:e,value:t,onCommit:n}){let[r,i]=(0,P.useState)(t);return(0,P.useEffect)(()=>i(t),[t]),(0,G.jsx)(Z,{id:e,value:r,className:`h-8 w-[300px] text-[13px]`,onChange:e=>i(e.target.value),onBlur:()=>{let e=r.trim();e===``?i(t):n(e)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&i(t)}})}function fM(){let e=q(e=>e.appTheme),t=q(e=>e.setAppTheme),n=q(e=>e.designMode),r=q(e=>e.rememberDesignMode),i=q(e=>e.setRememberDesignMode),a=q(e=>e.rememberPanels),o=q(e=>e.setRememberPanels),s=q(e=>e.resetCanvasPrefs);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(iM,{children:`Appearance`}),(0,G.jsxs)(aM,{children:[(0,G.jsx)(oM,{label:`App theme`,description:`Velloo's own chrome — the toolbar, sidebar, and panels.`,children:(0,G.jsxs)(rv,{type:`single`,variant:`outline`,size:`sm`,value:e,"aria-label":`App theme`,onValueChange:e=>e&&t(e),children:[(0,G.jsxs)(iv,{value:`light`,className:`px-3 text-[12px]`,children:[(0,G.jsx)(uo,{className:`size-3.5`}),`Light`]}),(0,G.jsxs)(iv,{value:`dark`,className:`px-3 text-[12px]`,children:[(0,G.jsx)(Si,{className:`size-3.5`}),`Dark`]}),(0,G.jsxs)(iv,{value:`system`,className:`px-3 text-[12px]`,children:[(0,G.jsx)(bi,{className:`size-3.5`}),`System`]})]})}),(0,G.jsxs)(oM,{label:`Remember the design preset`,description:`Reopen the canvas in whichever preset you last used. Off means every reload starts light.`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-md border border-border bg-muted/60 px-2 py-1 text-[11.5px] text-muted-foreground`,children:[n===`dark`?(0,G.jsx)(Si,{className:`size-3.5`}):(0,G.jsx)(uo,{className:`size-3.5`}),`now: `,n]}),(0,G.jsx)(NT,{"aria-label":`Remember the design preset`,checked:r,onCheckedChange:i})]})]}),(0,G.jsx)(iM,{className:`mt-5`,children:`Layout`}),(0,G.jsx)(aM,{children:(0,G.jsx)(oM,{label:`Remember panel layout`,description:`Side pane widths and collapse, boards list, and screen tree stay as you left them.`,children:(0,G.jsx)(NT,{"aria-label":`Remember panel layout`,checked:a,onCheckedChange:o})})}),(0,G.jsxs)(`div`,{className:`mt-5 flex items-start gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,G.jsx)(wa,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-[13px] font-medium text-foreground`,children:`Reset canvas preferences`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-snug text-muted-foreground`,children:`Clears theme, panel, and last-viewed board memory for this browser. Your design is untouched.`})]}),(0,G.jsx)(J,{variant:`outline`,size:`sm`,className:`ml-auto h-8 shrink-0 text-[12.5px]`,onClick:()=>{s(),V({kind:`success`,message:`Canvas preferences reset.`})},children:`Reset`})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center gap-2 rounded-lg bg-muted/50 px-3 py-2`,children:[(0,G.jsx)(Or,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:`Signing in and credits live in the account menu, top right.`})]})]})}var pM=`__none__`;function mM(e){return e<600?Ka:e<1100?_o:bi}function hM({cfg:e}){let t=q(e=>e.design?.boards??[]),n=q(e=>e.design?.screens??[]),r=q(e=>e.loadFolderConfig),i=q(e=>e.openLanguage),a=q(e=>e.setSettingsScope),o=(0,P.useId)(),s=(0,P.useId)(),c=(0,P.useId)(),l=(0,P.useId)(),u=(0,P.useId)(),d=async(e,t)=>{try{await t(),await r()}catch(t){H(t,e),await r().catch(()=>{})}};return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(iM,{children:`Design`}),(0,G.jsxs)(aM,{children:[(0,G.jsx)(oM,{label:`Name`,description:`What velloo commands, agents and the canvas call this design. Unique in this repo.`,htmlFor:o,children:(0,G.jsx)(yM,{id:o,value:e.designName,onCommit:e=>d(`Could not rename the design`,async()=>{await sd.designName(e),V({kind:`success`,message:`Renamed to "${e}"`})})})}),(0,G.jsx)(oM,{label:`Design language`,description:`Colour, type, shape and the rules in words every board follows.`,children:(0,G.jsxs)(J,{variant:`outline`,size:`sm`,onClick:()=>{a(null),i(`review`).catch(e=>H(e,`Could not open the design language`))},children:[(0,G.jsx)(po,{}),`Open`]})})]}),(0,G.jsx)(iM,{className:`mt-5`,children:`Opens on`}),(0,G.jsxs)(aM,{children:[(0,G.jsx)(oM,{label:`Board`,description:`Pins every load to one board. Unset, the canvas reopens the board you were last on.`,htmlFor:s,children:(0,G.jsxs)(bh,{value:e.defaultBoard??pM,onValueChange:e=>d(`Could not set the default board`,()=>sd.defaults({defaultBoard:e===pM?null:e})),children:[(0,G.jsx)(Sh,{id:s,className:`w-[252px] text-[13px]`,children:(0,G.jsx)(xh,{})}),(0,G.jsxs)(Ch,{children:[(0,G.jsx)(X,{value:pM,children:`Where you left off`}),t.map(e=>(0,G.jsx)(X,{value:e.id,children:e.name},e.id))]})]})}),(0,G.jsx)(oM,{label:`Screen`,description:`Focused after load. Optional.`,htmlFor:c,children:(0,G.jsxs)(bh,{value:e.defaultScreen??pM,onValueChange:e=>d(`Could not set the default screen`,()=>sd.defaults({defaultScreen:e===pM?null:e})),children:[(0,G.jsx)(Sh,{id:c,className:`w-[252px] text-[13px]`,children:(0,G.jsx)(xh,{})}),(0,G.jsxs)(Ch,{children:[(0,G.jsx)(X,{value:pM,children:`No screen — fit the whole board`}),n.map(e=>(0,G.jsx)(X,{value:e.id,children:e.name},e.id))]})]})})]}),(0,G.jsxs)(`div`,{className:`mt-5 flex items-baseline gap-2`,children:[(0,G.jsx)(iM,{children:`Viewport presets`}),(0,G.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:`— offered when you add a frame`})]}),(0,G.jsx)(CM,{presets:e.viewportPresets,onCommit:d}),(0,G.jsx)(iM,{className:`mt-5`,children:`Code generation & feedback`}),(0,G.jsxs)(aM,{children:[(0,G.jsx)(oM,{label:`Components import alias`,description:`Prefix emit_code writes for library imports.`,htmlFor:l,children:(0,G.jsx)(bM,{id:l,value:e.componentsAlias,onCommit:e=>d(`Could not save the import alias`,()=>sd.codegen({componentsAlias:e}))})}),(0,G.jsxs)(`div`,{className:`py-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-6`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`text-[13px] font-medium text-foreground`,children:`Send product feedback`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-[11.5px] leading-snug text-muted-foreground`,children:`Gives your agent the send_feedback tool. Off keeps velloo offline. Set once per repo — every design folder here shares this answer.`})]}),(0,G.jsx)(NT,{"aria-label":`Send product feedback`,checked:e.feedback.enabled,onCheckedChange:e=>d(`Could not change the feedback setting`,()=>sd.feedback({enabled:e}))})]}),(0,G.jsxs)(`label`,{htmlFor:u,className:`mt-2 flex items-start gap-2 border-l-2 border-border pl-3`,children:[(0,G.jsx)(qD,{id:u,className:`mt-0.5 size-3.5`,checked:e.feedback.contactOk,onCheckedChange:e=>d(`Could not change the contact setting`,()=>sd.feedback({contactOk:e===!0}))}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:`block text-[12.5px] text-foreground`,children:`Velloo may contact me about what I send`}),(0,G.jsx)(`span`,{className:`block text-[11px] text-muted-foreground`,children:`Attaches your account email to each report. Unchecked, feedback goes in anonymously. Saved on this machine, not in the repo — nobody who clones it inherits your answer.`})]})]})]})]}),(0,G.jsx)(iM,{className:`mt-5`,children:`What init decided`}),(0,G.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 items-start gap-x-8 gap-y-1.5 rounded-lg bg-muted/50 px-4 py-3`,children:[(0,G.jsx)(`div`,{className:`col-span-2 min-w-0`,children:(0,G.jsx)(gM,{cfg:e})}),(0,G.jsx)(sM,{label:`Styling`,children:uT(e.libraries)?(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`per library`}):dT(e)}),(0,G.jsxs)(sM,{label:`Format`,children:[`schema v`,e.schemaVersion,` · velloo `,e.toolVersion]}),(0,G.jsx)(`div`,{className:`col-span-2 min-w-0`,children:(0,G.jsx)(sM,{label:`Cloud id`,children:e.folderId?(0,G.jsx)(vM,{id:e.folderId}):(0,G.jsx)(_M,{})})})]})]})}function gM({cfg:e}){if(e.libraries.length===0)return(0,G.jsx)(sM,{label:`Library`,children:e.defaultLibrary});let t=lT(e),n=t.length>1,r=uT(t);return(0,G.jsx)(sM,{label:`Library`,stacked:n,children:t.map(t=>{let i=oT(t.source,t.version),a=t.id===e.defaultLibrary;return(0,G.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[n&&cT(t,a)?(0,G.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:t.id}):null,(0,G.jsx)(`span`,{className:`truncate`,children:iT(t.providerId)}),sT(t)?(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:aT(t.version)}):null,(0,G.jsx)(K,{variant:`secondary`,title:i.title,className:`h-4 shrink-0 px-1.5 text-[10px] font-normal`,children:i.text}),r&&t.styleLabel?(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:t.styleLabel}):null,n&&a?(0,G.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`· default`}):null]},t.id)})})}function _M(){return(0,G.jsx)(`span`,{className:`text-muted-foreground`,children:`Not published yet`})}function vM({id:e}){let[t,n]=(0,P.useState)(!1);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`truncate font-mono text-[11px]`,children:e}),(0,G.jsx)(`button`,{type:`button`,title:`Copy folder id`,className:`shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1200)})},children:t?(0,G.jsx)(I,{className:`size-3`}):(0,G.jsx)(Wn,{className:`size-3`})})]})}function yM({id:e,value:t,onCommit:n}){let[r,i]=(0,P.useState)(t),a=(0,P.useRef)(t);return a.current=t,(0,P.useEffect)(()=>i(t),[t]),(0,G.jsx)(Z,{id:e,value:r,spellCheck:!1,className:`h-8 w-[252px] font-mono text-[12.5px]`,onChange:e=>i(e.target.value),onBlur:()=>{let e=r.trim();e===``||e===t?i(t):n(e).finally(()=>i(a.current))},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&i(t)}})}function bM({id:e,value:t,onCommit:n}){let[r,i]=(0,P.useState)(t??``);return(0,P.useEffect)(()=>i(t??``),[t]),(0,G.jsx)(Z,{id:e,value:r,placeholder:`@/components/ui`,className:`h-8 w-[252px] font-mono text-[12.5px]`,onChange:e=>i(e.target.value),onBlur:()=>{let e=r.trim();e!==(t??``)&&n(e===``?null:e)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&i(t??``)}})}var xM=0,SM=e=>({key:xM++,preset:e});function CM({presets:e,onCommit:t}){let[n,r]=(0,P.useState)(()=>e.map(SM));(0,P.useEffect)(()=>r(e.map(SM)),[e]);let i=n.map(e=>e.preset),a=e=>{r(e),t(`Could not save the viewport presets`,()=>sd.viewportPresets(e.map(e=>e.preset)))},o=(e,t)=>r(n.map(n=>n.key===e?{key:e,preset:{...n.preset,...t}}:n)),s=()=>{JSON.stringify(i)!==JSON.stringify(e)&&(i.some(e=>e.name.trim()===``||e.w<=0||e.h<=0)?(V({kind:`error`,message:`A viewport preset needs a name and a positive width and height.`}),r(e.map(SM))):a(n))};return(0,G.jsxs)(`div`,{className:`mt-2 overflow-hidden rounded-lg border border-border`,children:[n.map(({key:e,preset:t},r)=>{let i=mM(t.w);return(0,G.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-3 py-1.5 last:border-b-0`,children:[(0,G.jsx)(i,{className:`size-4 shrink-0 text-muted-foreground`}),(0,G.jsx)(Z,{value:t.name,"aria-label":`Preset ${r+1} name`,className:`h-7 w-40 text-[13px]`,onChange:t=>o(e,{name:t.target.value}),onBlur:s,onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,G.jsx)(TM,{label:`Preset ${r+1} width`,value:t.w,onChange:t=>o(e,{w:t}),onCommit:s}),(0,G.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`×`}),(0,G.jsx)(TM,{label:`Preset ${r+1} height`,value:t.h,onChange:t=>o(e,{h:t}),onCommit:s})]}),(0,G.jsx)(`button`,{type:`button`,disabled:n.length<=1,title:n.length<=1?`At least one preset is required.`:`Remove ${t.name}`,className:`shrink-0 text-muted-foreground hover:text-destructive disabled:opacity-40 disabled:hover:text-muted-foreground`,onClick:()=>a(n.filter(t=>t.key!==e)),children:(0,G.jsx)(L,{className:`size-3.5`})})]},e)}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-border px-3 py-1.5`,children:[(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,className:`h-7 gap-1.5 px-2 text-[12.5px] text-muted-foreground`,onClick:()=>a([...n,SM({name:wM(i),w:1440,h:900})]),children:[(0,G.jsx)(ua,{className:`size-3.5`}),`Add preset`]}),(0,G.jsx)(`span`,{className:`ml-auto text-[11px] text-muted-foreground`,children:`At least one preset is required.`})]})]})}function wM(e){let t=new Set(e.map(e=>e.name.toLowerCase()));if(!t.has(`new preset`))return`New preset`;for(let e=2;;e++){let n=`New preset ${e}`;if(!t.has(n.toLowerCase()))return n}}function TM({label:e,value:t,onChange:n,onCommit:r}){return(0,G.jsx)(Z,{"aria-label":e,inputMode:`numeric`,value:String(t),className:`h-7 w-[68px] text-center font-mono text-[12px]`,onChange:e=>{let t=Number.parseInt(e.target.value,10);n(Number.isFinite(t)&&t>0?t:0)},onBlur:r,onKeyDown:e=>e.key===`Enter`&&e.currentTarget.blur()})}var EM=[{id:`design`,label:`Design`,icon:na},{id:`board`,label:`Board`,icon:Ir},{id:`canvas`,label:`Canvas`,icon:Wa}],DM={design:{title:`Design`,description:`Saved to the design's config.json — visible to your agent, and committed with your repo when the design lives in it.`},board:{title:`Board`,description:`Applies to one board — its own file under boards/, committed with your repo.`},canvas:{title:`Canvas`,description:`How the editor behaves for you. Kept in this browser — never written to the folder, never shared.`}};function OM(){let e=q(e=>e.settingsScope),t=q(e=>e.setSettingsScope),n=q(e=>e.folderConfig),r=q(e=>e.loadFolderConfig),i=q(e=>e.currentBoardId),a=q(e=>e.design?.boards.find(t=>t.id===e.currentBoardId)?.name??null);(0,P.useEffect)(()=>{e!==null&&r().catch(e=>H(e,`Could not load design settings`))},[e,r]);let o=e?DM[e]:DM.design;return(0,G.jsx)(fh,{open:e!==null,onOpenChange:e=>!e&&t(null),children:(0,G.jsxs)(hh,{className:W(`flex h-[min(800px,85vh)] w-[920px] max-w-[calc(100vw-2rem)] gap-0 overflow-hidden p-0`,`sm:max-w-[920px]`),children:[(0,G.jsxs)(`nav`,{className:`flex w-[216px] shrink-0 flex-col border-r border-border bg-muted/40 p-3`,children:[(0,G.jsx)(`div`,{className:`px-2 pb-2 pt-1 text-[10.5px] font-semibold uppercase tracking-wider text-muted-foreground`,children:`Settings`}),EM.map(({id:n,label:r,icon:i})=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>t(n),className:W(`mt-0.5 flex items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-[13px] first:mt-0`,e===n?`bg-background font-medium text-foreground shadow-sm ring-1 ring-border`:`text-muted-foreground hover:bg-accent/60`),children:[(0,G.jsx)(i,{className:`size-4 shrink-0`}),r,n===`board`&&a?(0,G.jsx)(`span`,{className:`ml-auto max-w-[86px] truncate text-[10.5px] font-normal text-muted-foreground`,children:a}):null]},n)),n?(0,G.jsxs)(`div`,{className:`mt-auto rounded-md border border-dashed border-border px-2.5 py-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Design folder`}),(0,G.jsx)(`div`,{className:`mt-1 break-all font-mono text-[10.5px] leading-tight text-foreground/80`,title:n.root,children:n.root})]}):null]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,G.jsxs)(gh,{className:`gap-0 border-b border-border px-6 py-4 pr-12 text-left`,children:[(0,G.jsx)(vh,{className:`text-[15px] font-semibold leading-tight`,children:o.title}),(0,G.jsx)(yh,{className:`mt-1 text-[11.5px]`,children:o.description})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-6 pt-4`,children:e===`canvas`?(0,G.jsx)(fM,{}):n===null?(0,G.jsx)(py,{size:24,label:`Loading settings…`,className:`flex-col pt-12 text-[13px] text-muted-foreground`}):e===`board`?(0,G.jsx)(lM,{cfg:n},i??``):(0,G.jsx)(hM,{cfg:n})}),(0,G.jsxs)(`div`,{className:`flex h-12 shrink-0 items-center gap-2 border-t border-border bg-muted/30 px-6`,children:[e===`canvas`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(bi,{className:`size-3.5 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:`This browser only.`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(I,{className:`size-3.5 text-muted-foreground`}),(0,G.jsx)(`span`,{className:`text-[11.5px] text-muted-foreground`,children:`Changes save as you make them.`})]}),(0,G.jsx)(J,{size:`sm`,className:`ml-auto h-8 text-[13px]`,onClick:()=>t(null),children:`Done`})]})]})]})})}var kM=200,AM=`(prefers-reduced-motion: reduce)`;function jM({open:e,className:t=``,"aria-disabled":n,children:r}){let i=(0,P.useRef)(null),a=(0,P.useRef)(null),[o,s]=(0,P.useState)(e),[c,l]=(0,P.useState)(e),[u,d]=(0,P.useState)(!1);if(c!==e){let t=!MM();l(e),d(t),s(e||t)}return(0,P.useLayoutEffect)(()=>{let t=i.current;if(!t||(t.style.cssText=``,!u))return;let n=e?0:a.current??t.offsetHeight,r=e?t.offsetHeight:0;t.style.flex=`0 0 auto`,t.style.overflow=`hidden`,t.style.height=`${n}px`,t.offsetHeight,t.style.transition=`height ${kM}ms ease-out`,t.style.height=`${r}px`},[u,e]),(0,P.useLayoutEffect)(()=>{!u&&e&&(a.current=i.current?.offsetHeight??null)}),(0,P.useEffect)(()=>{if(!u)return;let t=setTimeout(()=>{d(!1),e||s(!1)},kM);return()=>clearTimeout(t)},[u,e]),o?(0,G.jsx)(`div`,{ref:i,className:t,"aria-disabled":n,children:r}):null}function MM(){return typeof matchMedia==`function`&&matchMedia(AM).matches}function NM(e,t){return`${e} open ${t===`shared`?`cloud`:`local`} comment${e===1?``:`s`}`}function PM({counts:e,active:t}){return!e||e.shared===0&&e.local===0?null:(0,G.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[e.shared>0?(0,G.jsxs)(K,{"data-testid":`board-comments-shared`,variant:`secondary`,title:NM(e.shared,`shared`),className:W(`h-4 gap-0.5 bg-primary/10 px-1.5 text-[10px] text-primary tabular-nums`,t&&`bg-primary-foreground text-primary`),children:[(0,G.jsx)(In,{"aria-hidden":`true`}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:e.shared}),(0,G.jsx)(`span`,{className:`sr-only`,children:NM(e.shared,`shared`)})]}):null,e.local>0?(0,G.jsxs)(K,{"data-testid":`board-comments-local`,variant:`outline`,title:NM(e.local,`local`),className:W(`h-4 gap-0.5 px-1.5 text-[10px] tabular-nums text-muted-foreground`,t&&`border-primary-foreground/50 text-primary-foreground`),children:[(0,G.jsx)(fi,{"aria-hidden":`true`}),(0,G.jsx)(`span`,{"aria-hidden":`true`,children:e.local}),(0,G.jsx)(`span`,{className:`sr-only`,children:NM(e.local,`local`)})]}):null]})}var FM=`Disconnected — board switching resumes when the daemon is back.`;function IM(){let e=q(e=>e.selectBoard),t=q(e=>e.wsConnected);return(n,r)=>{!t&&!r?V({kind:`error`,message:FM}):e(n)}}function LM({board:e,active:t,groups:n,drag:r,onRename:i,onAddFrame:a,onMoveToGroup:o,onNewGroup:s,onArchive:c,onDelete:l}){let u=q(e=>e.wsConnected),d=q(t=>!!t.boardPulse[e.id]),f=q(e=>e.publishSlots),p=q(t=>t.boardCommentCounts[e.id]),m=q(e=>e.refreshPublishSlots),h=IM(),g=zd(f,e.id);return(0,G.jsxs)(`li`,{draggable:r.draggable,onDragStart:r.onDragStart,onDragOver:r.onDragOver,onDragEnd:r.onDragEnd,className:`relative group/board rounded-md `+(r.draggable?`cursor-grab active:cursor-grabbing `:``)+(r.dragging?`opacity-50`:``),children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(e.id,t),title:!u&&!t?FM:void 0,className:`w-full text-left px-2 py-1.5 pr-8 rounded-md text-sm transition-colors `+(t?`bg-primary text-primary-foreground`:u?`hover:bg-muted text-foreground`:`text-muted-foreground cursor-not-allowed opacity-60`),children:[(0,G.jsxs)(`div`,{className:`font-medium truncate`,children:[e.name,!t&&d?(0,G.jsx)(`span`,{"data-board-pulse":e.id,title:`An agent edited this board recently`,className:`ml-1.5 inline-block h-1.5 w-1.5 rounded-full bg-primary align-middle`}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs ${t?`text-primary-foreground/80`:`text-muted-foreground`}`,children:[(0,G.jsxs)(`span`,{className:`truncate`,children:[e.frameCount,` frame`,e.frameCount===1?``:`s`]}),(0,G.jsx)(PM,{counts:p,active:t})]})]}),(0,G.jsxs)(yv,{onOpenChange:e=>e&&void m(),children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,title:`Board menu`,className:`absolute right-2 top-2 opacity-0 group-hover/board:opacity-100 data-[state=open]:opacity-100`,children:(0,G.jsx)(Xn,{})})}),(0,G.jsxs)(xv,{align:`end`,className:em,children:[(0,G.jsxs)(Q,{disabled:!u,onSelect:i,children:[(0,G.jsx)(ia,{}),`Rename board`]}),(0,G.jsxs)(Q,{disabled:!u,onSelect:a,children:[(0,G.jsx)(fr,{}),`Add frame…`]}),(0,G.jsxs)(Q,{onSelect:()=>q.getState().publishBoard({id:e.id,name:e.name}),"data-testid":`board-publish`,children:[(0,G.jsx)(Ba,{}),`Publish…`]}),g?(0,G.jsx)(Q,{asChild:!0,children:(0,G.jsxs)(`a`,{href:g.url,target:`_blank`,rel:`noreferrer`,className:`text-inherit no-underline`,title:`Published ${RT(g.lastPublishedAt)}`,"data-testid":`board-latest-publish`,children:[(0,G.jsx)(Qn,{}),`See latest publish`]})}):null,(0,G.jsxs)(Dv,{children:[(0,G.jsxs)(Ov,{disabled:!u,children:[(0,G.jsx)(cr,{}),`Move to group`]}),(0,G.jsxs)(kv,{children:[n.map(t=>(0,G.jsxs)(Q,{onSelect:()=>o(t.id),children:[(0,G.jsx)(`span`,{className:`size-2.5 rounded-[3px]`,style:{backgroundColor:t.color??`var(--muted-foreground)`}}),t.name,e.group===t.id?(0,G.jsx)(I,{className:`ml-auto`}):null]},t.id)),(0,G.jsxs)(Q,{onSelect:()=>o(null),children:[(0,G.jsx)(`span`,{className:`size-2.5 rounded-[3px] border border-dashed`}),`No group`,e.group?null:(0,G.jsx)(I,{className:`ml-auto`})]}),(0,G.jsxs)(Q,{onSelect:s,children:[(0,G.jsx)(ur,{}),`New group…`]})]})]}),(0,G.jsxs)(Q,{onSelect:()=>q.getState().setExportTarget({kind:`board`,id:e.id,name:e.name}),children:[(0,G.jsx)(Jn,{}),`Export board…`]}),(0,G.jsxs)(Q,{disabled:!u,onSelect:c,children:[(0,G.jsx)(Rt,{}),`Archive board`]}),(0,G.jsxs)(Q,{variant:`destructive`,disabled:!u,onSelect:l,children:[(0,G.jsx)(L,{}),`Delete board`]})]})]})]})}function RM(e){let t=new Date(e);return Number.isNaN(t.getTime())?`archived`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function zM({boards:e,currentBoardId:t,open:n,onToggle:r,onRestore:i,onDelete:a}){let o=q(e=>e.wsConnected),s=IM();return(0,G.jsxs)(`div`,{className:`shrink-0 border-t px-2 py-1.5`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,className:`flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-[11px] uppercase tracking-wider text-muted-foreground transition-colors hover:text-foreground`,children:[(0,G.jsx)(bn,{size:13,strokeWidth:2.5,className:`shrink-0 transition-transform duration-200 motion-reduce:transition-none `+(n?`rotate-90`:``)}),(0,G.jsx)(Rt,{size:11,strokeWidth:2,className:`shrink-0`}),` Archived`,(0,G.jsxs)(`span`,{className:`normal-case opacity-60`,children:[`(`,e.length,`)`]})]}),(0,G.jsx)(jM,{open:n,children:(0,G.jsx)(`ul`,{className:`mt-0.5 flex flex-col gap-0.5`,children:e.map(e=>{let n=e.id===t;return(0,G.jsxs)(`li`,{className:`relative group/board rounded-md`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>s(e.id,n),className:`w-full text-left px-2 py-1.5 pr-8 rounded-md text-sm transition-colors `+(n?`bg-primary text-primary-foreground`:`hover:bg-muted text-muted-foreground`),children:[(0,G.jsx)(`div`,{className:`truncate`,children:e.name}),(0,G.jsxs)(`div`,{className:`text-xs `+(n?`text-primary-foreground/80`:`text-muted-foreground/70`),children:[e.frameCount,` frame`,e.frameCount===1?``:`s`,e.archivedAt?` · ${RM(e.archivedAt)}`:``]})]}),(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,title:`Board menu`,className:`absolute right-2 top-2 opacity-0 group-hover/board:opacity-100 data-[state=open]:opacity-100`,children:(0,G.jsx)(Xn,{})})}),(0,G.jsxs)(xv,{align:`end`,className:em,children:[(0,G.jsxs)(Q,{disabled:!o,onSelect:()=>i(e),children:[(0,G.jsx)(It,{}),`Restore board`]}),(0,G.jsxs)(Q,{variant:`destructive`,disabled:!o,onSelect:()=>a(e),children:[(0,G.jsx)(L,{}),`Delete board`]})]})]})]},e.id)})})})]})}var BM=[{value:`#8b5cf6`,label:`Violet`},{value:`#0ea5e9`,label:`Sky`},{value:`#f59e0b`,label:`Amber`},{value:`#f43f5e`,label:`Rose`},{value:`#10b981`,label:`Emerald`},{value:`#6366f1`,label:`Indigo`},{value:`#ec4899`,label:`Pink`},{value:`#84cc16`,label:`Lime`}];function VM({group:e,count:t,collapsed:n,dropTarget:r,disabled:i,onToggle:a,onDragOver:o,onRename:s,onRecolor:c,onDelete:l}){return(0,G.jsxs)(`li`,{onDragOver:o,className:`group/gr relative flex items-center rounded-md pr-7 ${r?`bg-accent`:``}`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:a,"aria-expanded":!n,className:`flex min-w-0 flex-1 items-center gap-2 rounded-md px-1.5 py-1.5 text-left transition-colors hover:bg-muted`,children:[(0,G.jsx)(bn,{size:13,strokeWidth:2.5,className:`shrink-0 text-muted-foreground transition-transform duration-200 motion-reduce:transition-none `+(n?``:`rotate-90`)}),(0,G.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-[3px]`,style:{backgroundColor:e.color??`var(--muted-foreground)`}}),(0,G.jsx)(`span`,{className:`truncate text-xs font-semibold`,children:e.name}),(0,G.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:t})]}),(0,G.jsxs)(yv,{children:[(0,G.jsx)(bv,{asChild:!0,children:(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,title:`Group menu`,className:`absolute right-1 top-1.5 opacity-0 group-hover/gr:opacity-100 data-[state=open]:opacity-100`,children:(0,G.jsx)(Xn,{})})}),(0,G.jsxs)(xv,{align:`end`,className:em,children:[(0,G.jsxs)(Q,{disabled:i,onSelect:s,children:[(0,G.jsx)(ia,{}),`Rename group`]}),(0,G.jsxs)(Dv,{children:[(0,G.jsxs)(Ov,{disabled:i,children:[(0,G.jsx)(Pi,{}),`Color`]}),(0,G.jsx)(kv,{children:BM.map(({value:t,label:n})=>(0,G.jsxs)(Q,{onSelect:()=>c(t),children:[(0,G.jsx)(`span`,{className:`size-3 rounded-[3px]`,style:{backgroundColor:t}}),n,e.color===t?(0,G.jsx)(I,{className:`ml-auto`}):null]},t))})]}),(0,G.jsxs)(Q,{variant:`destructive`,disabled:i,onSelect:l,children:[(0,G.jsx)(L,{}),`Delete group`]})]})]})]})}var HM={Divider:vi,Gradient:Qt,Heading:wr,Icon:Ja,Image:Er,Layer:Mr,Placeholder:Xa,Prose:oa,SVG:Ra,Text:wo},UM={a:Hr,blockquote:ma,button:Qa,em:wo,footer:Ii,form:yo,h1:wr,h2:wr,h3:wr,h4:wr,h5:wr,h6:wr,header:Ki,img:Er,input:yo,label:wo,li:Kr,nav:Ai,ol:Kr,p:wo,small:wo,span:wo,strong:wo,svg:Ra,table:ho,textarea:yo,ul:Kr,video:Io};function WM(e,t){if(Cc(e))return{Icon:ln,tone:`text-muted-foreground`};if(Sc(e))return{Icon:en,tone:`text-violet-500`,title:`@${e.$snippet} — a snippet instance.`};if(wc(e))return{Icon:oa,tone:`text-muted-foreground`,title:`Text beside elements — it has no element of its own.`};if(Fc(e)){let{importPath:t,exportName:n,member:r,app:i}=e.$repo,a=n==="default"?`default export`:n,o=r?`${a}.${r}`:a;return{Icon:sn,tone:`text-primary`,title:`${e.$ref} — the app's own component: ${o} from ${t}${i?` (${i})`:``}.`}}let n=t?.get(e.$ref);if(t&&!n)return{Icon:So,tone:`text-destructive`,title:`${e.$ref} isn't in this screen's library — it renders as a fallback.`};if(n?.kind===`extension`)return{Icon:fa,tone:`text-primary`,title:`${e.$ref} — a custom component registered with add_extension.`};if(n&&n.source!==`velloo`)return{Icon:Hn,tone:`text-primary`,title:`${e.$ref} — a real ${n.source} component from this project's library.`};let r=HM[e.$ref];if(r)return{Icon:r,tone:`text-muted-foreground`};let i=typeof e.props?.as==`string`?e.props.as:null;return{Icon:(i?UM[i]:void 0)??io,tone:`text-muted-foreground`}}var GM=(e,t=28)=>e.length>t?`${e.slice(0,t-1)}…`:e,KM=200;function qM(e){if(Sc(e)){let t=Object.entries(e.args??{}),n=t.find(([,e])=>typeof e==`string`&&e.trim());return n?GM(n[1].trim()):t.length>0?`${t.length} args`:null}if(Cc(e))return null;if(wc(e))return GM(e.$text.trim())||null;let t=e.props;if(!t)return null;for(let e of[`children`,`label`,`placeholder`,`value`,`title`]){let n=t[e];if(typeof n==`string`&&n.trim())return GM(n.trim());if(typeof n==`number`)return String(n)}if(typeof t.className==`string`){let e=t.className.trim();if(e)return GM(`.${e.split(/\s+/)[0]}`)}return null}function JM(e){if(Sc(e))return`@${e.$snippet}`;if(Cc(e))return`\${${e.$param}}`;if(wc(e))return`text`;let t=fb(e),n=typeof e.props?.as==`string`?e.props.as:null,r=n&&n!==`div`?`${e.$ref} ${n}`:e.$ref;return t?`${r} ${t}`:r}function YM(e){return xc(e)?e.children:void 0}function XM(e){let[t,n]=(0,P.useState)(e),[r,i]=(0,P.useState)(e),[a,o]=(0,P.useState)(!1);return r!==e&&(i(e),o(!0),e&&n(!0)),(0,P.useEffect)(()=>{if(!a)return;let t=setTimeout(()=>{o(!1),e||n(!1)},KM);return()=>clearTimeout(t)},[a,e]),{mounted:t,animating:a}}function ZM({icon:e,selected:t}){let n=`shrink-0 ${t?`text-primary-foreground`:e.tone}`;return e.title?(0,G.jsx)(`span`,{role:`img`,"aria-label":e.title,title:e.title,className:`inline-flex ${n}`,children:(0,G.jsx)(e.Icon,{size:13,strokeWidth:2,"aria-hidden":!0})}):(0,G.jsx)(e.Icon,{size:13,strokeWidth:2,className:n,"aria-hidden":!0})}function QM({node:e,path:t,screenId:n,depth:r,expandedSet:i,setExpanded:a,byId:o}){let s=Qd(t),c=q(e=>e.setSelection),l=q(e=>e.setHover),u=q(e=>e.openSnippetEditor),d=q(e=>e.setSnippetFocus),f=q(e=>e.selection?.screenId===n&&e.selection.path===s),p=q(e=>e.hover?.screenId===n&&e.hover.path===s),m=(0,P.useRef)(null);(0,P.useEffect)(()=>{f&&m.current?.scrollIntoView({block:`nearest`})},[f]);let h=YM(e),g=(h?.length??0)>0,_=g?i.has(s):!1,{mounted:v,animating:y}=XM(_),b=qM(e),x=Sc(e)?e.$snippet:null,S=WM(e,o),C=[`w-full flex items-center gap-1 px-2 py-1 rounded-sm text-sm cursor-default select-none text-left group/row`,f?`bg-primary text-primary-foreground`:p?`bg-muted`:`hover:bg-muted text-foreground`].join(` `),w=()=>c({screenId:n,path:s}),T=()=>{(async()=>{try{let{removedRef:e}=await B.removeNode({screenId:n,path:t}),r=q.getState();r.selection?.screenId===n&&(r.selection.path===s||r.selection.path.startsWith(`${s}.`))&&r.setSelection(null),r.setHover(null),r.refreshHistory(),V({kind:`info`,message:`Removed ${e}`,action:{label:`Undo`,onClick:()=>{hd().catch(e=>H(e,`Undo failed`)).finally(()=>void q.getState().refreshHistory())}}})}catch(e){H(e,`Could not remove node`)}})()};return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{ref:m,className:C,style:{paddingLeft:`${.5+r*.875}rem`},children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>a(s,!_),className:`inline-flex size-5 shrink-0 items-center justify-center rounded transition-colors disabled:opacity-0 `+(f?`text-primary-foreground hover:bg-primary-foreground/20`:`text-muted-foreground hover:bg-foreground/10 hover:text-foreground`),"aria-label":_?`Collapse`:`Expand`,disabled:!g,children:(0,G.jsx)(bn,{size:15,strokeWidth:2.5,"aria-hidden":!0,className:`transition-transform duration-200 motion-reduce:transition-none `+(_?`rotate-90`:``)})}),(0,G.jsxs)(`button`,{type:`button`,onClick:w,onDoubleClick:()=>{x&&d(x)},onMouseEnter:()=>l({screenId:n,path:s}),onMouseLeave:()=>l(null),onKeyDown:e=>{e.key===`ArrowRight`&&g&&!_?(e.preventDefault(),a(s,!0)):e.key===`ArrowLeft`&&g&&_?(e.preventDefault(),a(s,!1)):e.key===`Enter`&&x&&(e.preventDefault(),d(x))},className:`flex shrink-0 items-center gap-1.5 text-left text-inherit`,title:x?`Double-click or Enter to edit ${x} in place`:void 0,children:[(0,G.jsx)(ZM,{icon:S,selected:f}),(0,G.jsx)(`span`,{className:`font-medium whitespace-nowrap`,children:JM(e)}),Vc(e)?(0,G.jsxs)(K,{variant:`outline`,className:`shrink-0 px-1 py-0 font-mono text-[10px] leading-none `+(f?`border-primary-foreground/40 text-primary-foreground`:`text-muted-foreground`),title:`Stable anchor: @${Vc(e)}`,children:[`@`,Vc(e)]}):null,b?(0,G.jsx)(`span`,{className:`whitespace-nowrap text-xs opacity-70 `+(f?`text-primary-foreground`:`text-muted-foreground`),children:b}):null]}),(0,G.jsxs)(`div`,{className:`pointer-events-none sticky right-1 z-10 ml-auto flex shrink-0 items-center ${Tg} rounded-md border bg-popover px-px text-popover-foreground opacity-0 shadow-sm transition-opacity group-hover/row:pointer-events-auto group-hover/row:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),q.getState().locateNode(n,s)},className:Cg,"aria-label":`Locate on canvas`,title:`Locate on canvas (centers and zooms to this node)`,"data-locate-node":s,children:(0,G.jsx)(Kn,{...Eg})}),x?(0,G.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),u(x)},className:Cg,"aria-label":`Open ${x} in canvas`,title:`Open ${x} in canvas`,children:(0,G.jsx)(Ji,{...Eg})}):null,r===0?null:(0,G.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),T()},className:wg,"aria-label":`Delete node`,title:`Delete this node (undoable)`,"data-remove-node":s,children:(0,G.jsx)(L,{...Eg})})]})]}),g?(0,G.jsx)(`div`,{className:`grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none `+(_?`grid-rows-[1fr]`:`grid-rows-[0fr]`),children:(0,G.jsx)(`div`,{className:_&&!y?``:`overflow-hidden`,children:v?h?.map((e,c)=>{let l=`${s===``?``:`${s}.`}${c}`;return(0,G.jsx)(QM,{node:e,path:[...t,c],screenId:n,depth:r+1,expandedSet:i,setExpanded:a,byId:o},l)}):null})}):null]})}function $M(e){let t=new Set;for(let n=0;n<e.length;n++)t.add(Qd(e.slice(0,n)));return t}function eN(e,t=[],n=new Set){n.add(Qd(t));let r=YM(e);if(r)for(let e=0;e<r.length;e++){let i=r[e];i&&eN(i,[...t,e],n)}return n}function tN({screen:e}){let t=q(e=>e.selection),n=q(e=>e.components),r=q(e=>e.loadComponents);(0,P.useEffect)(()=>{r()},[r]);let i=(0,P.useMemo)(()=>n?new Map(n.map(e=>[e.id,e])):null,[n]),[a,o]=(0,P.useState)(()=>eN(e.tree)),s=(e,t)=>{o(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},c=(0,P.useMemo)(()=>{if(t?.screenId!==e.id)return a;let n=$M(U(t.path)),r=new Set(a);for(let e of n)r.add(e);return r},[a,t,e.id]);return(0,G.jsx)(`div`,{className:`flex w-max min-w-full flex-col py-1`,children:(0,G.jsx)(QM,{node:e.tree,path:[],screenId:e.id,depth:0,expandedSet:c,setExpanded:s,byId:i})})}function nN({screens:e,currentBoardId:t,currentScreenId:n}){let r=q(e=>e.selectScreen),i=q(e=>e.cursorMode),a=q(e=>e.treeCollapsed),o=q(e=>e.toggleTreeCollapsed),s=q(e=>n?e.screens[n]??null:null),c=q(e=>e.snippetFocus),l=q(e=>e.setSnippetFocus),u=q(e=>e.snippetFocus?e.screens[`snippet:${e.snippetFocus}`]??null:null),d=u??s,f=q(e=>d?e.renderErrors[d.id]??null:null),p=q(e=>t?e.boards[t]??null:null),m=(0,P.useMemo)(()=>{if(!p)return[];let t=new Map(e.map(e=>[e.id,e])),r=new Set,i=[];for(let e of p.frames){if(r.has(e.screen))continue;r.add(e.screen);let n=t.get(e.screen);n&&i.push(n)}if(n&&!r.has(n)){let e=t.get(n);e&&i.push(e)}return i},[p,e,n]);return(0,G.jsxs)(`section`,{className:a?`shrink-0`:`flex-1 flex flex-col min-h-0`,children:[(0,G.jsxs)(`div`,{className:`px-4 py-2 flex items-center gap-2 text-xs uppercase tracking-wider text-muted-foreground border-b`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:o,className:`shrink-0 hover:text-foreground transition-colors`,"aria-expanded":!a,title:a?`Expand tree`:`Collapse tree`,children:(0,G.jsx)(bn,{size:13,strokeWidth:2.5,className:`transition-transform duration-200 motion-reduce:transition-none `+(a?``:`rotate-90`)})}),c===null?m.length>1?(0,G.jsxs)(bh,{value:n??``,onValueChange:e=>{e&&r(e)},children:[(0,G.jsx)(Sh,{size:`sm`,className:`h-6 w-auto min-w-0 max-w-full overflow-hidden px-2 text-[10px] uppercase tracking-wider`,children:(0,G.jsx)(xh,{className:`min-w-0 truncate`})}),(0,G.jsx)(Ch,{children:m.map(e=>(0,G.jsx)(X,{value:e.id,children:e.name},e.id))})]}):(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:s?.name??`No screen`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>l(null),className:`inline-flex shrink-0 items-center gap-1 normal-case tracking-normal hover:text-foreground`,title:`Back to the screen (Esc)`,children:[(0,G.jsx)(Wt,{size:13,strokeWidth:2.5,"aria-hidden":!0}),`Back`]}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-violet-500`,children:u?.name??c})]})]}),(0,G.jsx)(jM,{open:!a,className:`flex-1 overflow-auto scroll-stable py-1 `+(i===`hand`?`opacity-40 pointer-events-none select-none`:``),"aria-disabled":i===`hand`,children:d?(0,G.jsxs)(G.Fragment,{children:[f?(0,G.jsxs)(tw,{variant:`destructive`,className:`mx-2 mb-1 w-auto`,children:[(0,G.jsx)(So,{}),(0,G.jsx)(nw,{className:`text-xs`,children:f}),(0,G.jsx)(rw,{className:`text-xs`,children:`Nothing drew, so these rows have nothing to locate on the canvas. The frame says why.`})]}):null,(0,G.jsx)(tN,{screen:d},d.id)]}):(0,G.jsx)(Jm,{className:`px-4 py-2`,children:(0,G.jsx)($m,{className:`text-xs`,children:`Pick a screen above to see its tree.`})})})]})}function rN({boards:e,groups:t,enabled:n,onRefile:r}){let i=q(e=>e.reorderBoardsLocal),a=e.length>1&&n,[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(void 0),f=(0,P.useRef)(!1),p=(0,P.useMemo)(()=>{if(!c)return e;let t=new Map(e.map(e=>[e.id,e])),n=[];for(let e of c){let r=t.get(e);r&&n.push(r)}for(let t of e)c.includes(t.id)||n.push(t);return n},[c,e]),m=()=>{s(null),l(null),d(void 0)},h=(t,n)=>{f.current=!1,s(n),l(e.map(e=>e.id)),d(void 0),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,n),document.body.classList.add(`velloo-dragging`)},g=(t,n)=>{if(!o||(t.preventDefault(),t.dataTransfer.dropEffect=`move`,n===o))return;let r=e.find(e=>e.id===n);r&&d(r.group??null),l(t=>{let r=t??e.map(e=>e.id),i=r.indexOf(o),a=r.indexOf(n);if(i===-1||a===-1||i===a)return r;let s=[...r];return s.splice(i,1),s.splice(a,0,o),s})},_=()=>{document.body.classList.remove(`velloo-dragging`),!f.current&&m()};return{sections:(0,P.useMemo)(()=>{let e=e=>e.id===o&&u!==void 0?u:e.group??null,n=new Set(t.map(e=>e.id)),r=t.map(t=>({group:t,boards:p.filter(n=>e(n)===t.id)})),i=p.filter(t=>{let r=e(t);return r===null||!n.has(r)});return r.push({group:null,boards:i}),r},[t,p,o,u]),dragging:o!==null,dragGroup:u,rowDrag:e=>({draggable:a,dragging:o===e,onDragStart:t=>h(t,e),onDragOver:t=>g(t,e),onDragEnd:_}),onGroupDragOver:(e,t)=>{o&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,d(t))},onListDragOver:e=>{o&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`)},onListDrop:t=>{if(!o)return;t.preventDefault(),f.current=!0;let n=c,a=u,s=e.find(e=>e.id===o);if(m(),s&&a!==void 0&&(s.group??null)!==a&&r(s.id,a),!n)return;let l=e.map(e=>e.id);n.length===l.length&&n.every((e,t)=>e===l[t])||(i(n),B.reorderBoards({order:n}).catch(e=>{H(e,`Could not reorder boards`),q.getState().refreshDesignSummary()}))}}}var iN=`velloo:collapsedBoardGroups`;function aN(){if(typeof localStorage>`u`)return[];try{let e=localStorage.getItem(iN),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function oN(){let[e,t]=(0,P.useState)(aN),[n,r]=(0,P.useState)(null),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null);return{collapsed:e,toggle:e=>{t(t=>{let n=t.includes(e)?t.filter(t=>t!==e):[...t,e];return typeof localStorage<`u`&&localStorage.setItem(iN,JSON.stringify(n)),n})},dialog:n,name:i,setName:a,openDialog:e=>{e.mode===`create`?(a(`New group`),r({mode:`create`,...e.boardId?{boardId:e.boardId}:{}})):(a(e.group.name),r({mode:`rename`,groupId:e.group.id}))},closeDialog:()=>r(null),submitDialog:async()=>{let e=i.trim();if(!e||!n)return;let t=n;r(null);try{t.mode===`rename`?await B.updateBoardGroup({groupId:t.groupId,patch:{name:e}}):t.boardId?await B.updateBoard({boardId:t.boardId,patch:{group:e}}):await B.addBoardGroup({name:e}),await q.getState().refreshDesignSummary()}catch(e){H(e,t.mode===`rename`?`Could not rename group`:`Could not add group`)}},recolor:(e,t)=>{B.updateBoardGroup({groupId:e,patch:{color:t}}).then(()=>q.getState().refreshDesignSummary()).catch(e=>H(e,`Could not recolor group`))},pendingDelete:o,requestDelete:s,cancelDelete:()=>s(null),confirmDelete:()=>{if(!o)return;let{id:e,name:t}=o;s(null),(async()=>{try{let n=await B.removeBoardGroup({groupId:e});await q.getState().refreshDesignSummary();let r=n.ungroupedBoardIds.length;V({kind:`info`,message:r>0?`Deleted "${t}" — ${r} board${r===1?``:`s`} moved to Ungrouped`:`Deleted "${t}"`})}catch(e){H(e,`Could not delete group`)}})()}}}function sN(e,t){let n=[],r=t.removedScreenIds.length,i=t.removedSnippetIds.length;return r>0&&n.push(`${r} screen${r===1?``:`s`}`),i>0&&n.push(`${i} unused snippet${i===1?``:`s`}`),n.length===0?`Deleted "${e}"`:`Deleted "${e}" and ${n.join(` + `)}`}var cN=[],lN=[];function uN({boards:e,screens:t,currentBoardId:n,currentScreenId:r}){let i=q(e=>e.selectBoard),a=q(e=>e.wsConnected),o=q(e=>e.authStatus?.loggedIn??!1),s=q(e=>e.refreshPublishSlots),c=q(e=>e.boardsCollapsed),l=q(e=>e.treeCollapsed),u=q(e=>e.toggleBoardsCollapsed),d=q(e=>e.setBoardArchived),f=q(e=>e.design?.archivedBoards??cN),p=q(e=>e.design?.boardGroups??lN),m=oN(),[h,g]=(0,P.useState)(null),[_,v]=(0,P.useState)(null),[y,b]=(0,P.useState)(null),[x,S]=(0,P.useState)(``),C=(e,t)=>{B.updateBoard({boardId:e,patch:{group:t}}).then(()=>q.getState().refreshDesignSummary()).catch(e=>H(e,`Could not move board`))},w=()=>{S(`New board`),b({mode:`create`})},T=e=>{S(e.name),b({mode:`rename`,boardId:e.id})},E=async()=>{let e=x.trim();if(!e||!y)return;let t=y;if(b(null),t.mode===`create`)try{let t=await B.addBoard({name:e});i(t.boardId)}catch(e){H(e,`Could not create board`)}else try{await B.updateBoard({boardId:t.boardId,patch:{name:e}})}catch(e){H(e,`Could not rename board`)}},D=()=>{if(!h)return;let{id:e,name:t}=h;g(null),(async()=>{try{let n=await B.removeBoard({boardId:e});q.getState().pruneScreens(n.removedScreenIds),await q.getState().pruneBoard(e),V({kind:`info`,message:sN(t,n)})}catch(e){H(e,`Could not delete board`)}})()},[O,k]=(0,P.useState)(!1),A=f.some(e=>e.id===n);(0,P.useEffect)(()=>{A&&k(!0)},[A]),(0,P.useEffect)(()=>{o&&s()},[o,s]);let j=(e,t)=>{(async()=>{try{await d(e.id,t),V({kind:`info`,message:t?`Archived "${e.name}"`:`Restored "${e.name}"`}),t&&k(!0)}catch(e){H(e,t?`Could not archive board`:`Could not restore board`)}})()},M=rN({boards:e,groups:p,enabled:a,onRefile:C}),ee=c?`shrink-0 border-b`:l?`flex-1 flex flex-col min-h-0 border-b`:`flex flex-col min-h-0 max-h-[50%] border-b`,te=e=>(0,G.jsx)(LM,{board:e,active:e.id===n,groups:p,drag:M.rowDrag(e.id),onRename:()=>T(e),onAddFrame:()=>v(e.id),onMoveToGroup:t=>C(e.id,t),onNewGroup:()=>m.openDialog({mode:`create`,boardId:e.id}),onArchive:()=>j(e,!0),onDelete:()=>g({id:e.id,name:e.name})},e.id);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{className:ee,children:[(0,G.jsxs)(`div`,{className:`px-4 py-2 flex items-center justify-between gap-2 text-xs uppercase tracking-wider text-muted-foreground`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:u,className:`flex min-w-0 items-center gap-1.5 hover:text-foreground transition-colors`,"aria-expanded":!c,title:c?`Expand boards`:`Collapse boards`,children:[(0,G.jsx)(bn,{size:13,strokeWidth:2.5,className:`shrink-0 transition-transform duration-200 motion-reduce:transition-none `+(c?``:`rotate-90`)}),(0,G.jsx)(Pr,{size:11,strokeWidth:2,className:`shrink-0`}),` Boards`,c&&e.length>0?(0,G.jsxs)(`span`,{className:`normal-case opacity-60`,children:[`(`,e.length,`)`]}):null]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,onClick:()=>m.openDialog({mode:`create`}),disabled:!a,title:a?`New group`:`Disconnected — edits are paused.`,children:(0,G.jsx)(ur,{})}),(0,G.jsx)(J,{variant:`ghost`,size:`icon-xs`,onClick:w,disabled:!a,title:a?`New board`:`Disconnected — edits are paused.`,children:(0,G.jsx)(ua,{})})]})]}),(0,G.jsxs)(jM,{open:!c,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[e.length===0?(0,G.jsx)(Jm,{className:`gap-1 px-4 pb-2 pt-0`,children:(0,G.jsx)($m,{className:`text-sm`,children:f.length>0?`No boards — everything's archived.`:`No boards yet.`})}):(0,G.jsx)(`ul`,{className:`flex flex-1 flex-col gap-0.5 overflow-auto scroll-stable px-2 pb-2 min-h-0`,onDragOver:M.onListDragOver,onDrop:M.onListDrop,children:M.sections.map(e=>{let t=e.group;return t?(0,G.jsxs)(`li`,{children:[(0,G.jsx)(VM,{group:t,count:e.boards.length,collapsed:m.collapsed.includes(t.id),dropTarget:M.dragGroup===t.id,disabled:!a,onToggle:()=>m.toggle(t.id),onDragOver:e=>M.onGroupDragOver(e,t.id),onRename:()=>m.openDialog({mode:`rename`,group:t}),onRecolor:e=>m.recolor(t.id,e),onDelete:()=>m.requestDelete(t)}),(0,G.jsx)(jM,{open:!m.collapsed.includes(t.id),children:(0,G.jsx)(`ul`,{className:`ml-[15px] flex flex-col gap-0.5 border-l-2 pl-2`,style:{borderColor:t.color??`var(--border)`},children:e.boards.map(te)})})]},t.id):(0,G.jsxs)(P.Fragment,{children:[p.length>0&&e.boards.length>0?(0,G.jsxs)(`li`,{onDragOver:e=>M.onGroupDragOver(e,null),className:`mt-1 flex items-center gap-1.5 rounded-md px-1.5 py-1 text-[11px] uppercase tracking-wide text-muted-foreground `+(M.dragGroup===null&&M.dragging?`bg-accent`:``),children:[(0,G.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-[3px] border border-dashed`}),`Ungrouped`,(0,G.jsx)(`span`,{className:`ml-auto normal-case opacity-70`,children:e.boards.length})]}):null,e.boards.map(te)]},`__ungrouped`)})}),f.length===0?null:(0,G.jsx)(zM,{boards:f,currentBoardId:n,open:O,onToggle:()=>k(e=>!e),onRestore:e=>j(e,!1),onDelete:e=>g({id:e.id,name:e.name})})]})]}),(0,G.jsx)(nN,{screens:t,currentBoardId:n,currentScreenId:r}),(0,G.jsx)(my,{open:y!==null,title:y?.mode===`rename`?`Rename board`:`New board`,placeholder:`Board name`,submitLabel:y?.mode===`rename`?`Rename`:`Create`,maxLength:80,value:x,onValueChange:S,onSubmit:()=>void E(),onCancel:()=>b(null)}),(0,G.jsx)(my,{open:m.dialog!==null,title:m.dialog?.mode===`rename`?`Rename group`:`New group`,placeholder:`Group name`,submitLabel:m.dialog?.mode===`rename`?`Rename`:`Create`,maxLength:40,value:m.name,onValueChange:m.setName,onSubmit:()=>void m.submitDialog(),onCancel:m.closeDialog}),(0,G.jsx)(hv,{open:m.pendingDelete!==null,title:`Delete group`,description:m.pendingDelete?`Delete the group "${m.pendingDelete.name}"? Its boards aren't deleted — they move to Ungrouped.`:``,confirmLabel:`Delete group`,onConfirm:m.confirmDelete,onCancel:m.cancelDelete}),(0,G.jsx)(Eh,{boardId:_,onClose:()=>v(null)}),(0,G.jsx)(hv,{open:h!==null,title:`Delete board`,description:h?`Delete board "${h.name}"? Screens only this board places are deleted with it, along with any snippet nothing else reaches afterwards. Screens another board also places are kept.`:``,confirmLabel:`Delete`,onConfirm:D,onCancel:()=>g(null)})]})}function dN(e){let t=new Map;for(let n of e){let e=n.identity.app,r=n.packageName??n.identity.importPath,i=n.source===`local`?`local:${e??``}`:`package:${r}:${e??``}`,a=n.source===`local`?`This app`:r,o=t.get(i);o||(o={key:i,label:e?`${a} · ${e}`:a,roots:[],entries:[]},t.set(i,o)),o.entries.push(n),n.identity.member||o.roots.push(n)}for(let e of t.values()){let t=new Set(e.roots.map(e=>e.family));for(let n of e.entries)t.has(n.family)||(t.add(n.family),e.roots.push(n));e.roots.sort((e,t)=>e.id.localeCompare(t.id))}return[...t.values()].sort((e,t)=>+!e.key.startsWith(`local:`)-!t.key.startsWith(`local:`)||e.label.localeCompare(t.label))}function fN(e,t){if(!t)return e.roots;let n=new Set(e.entries.filter(e=>e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)).map(e=>e.family));return e.roots.filter(e=>n.has(e.family))}function pN({query:e}){let t=q(e=>e.repoCatalog),n=q(e=>e.loadRepoCatalog);(0,P.useEffect)(()=>{n()},[n]);let r=(0,P.useMemo)(()=>dN(t?.entries??[]),[t]);if(r.length===0)return null;let i=e.trim().toLowerCase(),a=r.map(e=>({source:e,roots:fN(e,i)})).filter(({roots:e})=>e.length>0);return a.length===0?null:(0,G.jsxs)(`div`,{"data-repo-shelves":``,children:[(0,G.jsxs)(`div`,{className:`px-4 pt-3 pb-1.5 flex items-center gap-1.5 text-[10px] uppercase tracking-wider font-semibold text-primary`,children:[(0,G.jsx)(sn,{size:11,strokeWidth:2}),(0,G.jsx)(`span`,{className:`flex-1`,children:`Repo`})]}),a.map(({source:e,roots:t})=>(0,G.jsx)(mN,{label:e.label,roots:t,forceOpen:i.length>0,defaultOpen:e.key.startsWith(`local:`)||r.length===1},e.key)),(0,G.jsx)(B_,{className:`mx-2 my-3`})]})}function mN({label:e,roots:t,forceOpen:n,defaultOpen:r}){let[i,a]=(0,P.useState)(r),o=n||i,s=q(e=>e.libraryItem),c=q(e=>e.openLibrary),l=q(e=>e.repoStatus);return ZE(t.map(e=>e.id),o),(0,G.jsxs)(eT,{open:o,onOpenChange:a,"data-repo-source":e,children:[(0,G.jsxs)(tT,{className:`w-full px-4 pt-2 pb-1 flex items-center gap-1.5 text-[10px] uppercase tracking-wider font-semibold text-muted-foreground hover:text-foreground`,children:[(0,G.jsx)(bn,{size:11,strokeWidth:2,className:`shrink-0 transition-transform ${o?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`flex-1 truncate text-left normal-case tracking-normal font-mono`,children:e}),(0,G.jsx)(K,{variant:`secondary`,className:`px-1.5 py-0 text-[10px] font-normal tabular-nums`,children:t.length})]}),(0,G.jsx)(nT,{children:(0,G.jsx)(`ul`,{className:`flex flex-col px-2 gap-0.5 pb-1`,children:t.map(e=>{let t=s?.kind===`repo`&&s.id===e.id;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,"data-repo-id":e.id,onClick:()=>c({kind:`repo`,id:e.id}),className:`w-full text-left px-2 py-1 rounded-md text-sm transition-colors flex items-center gap-2 `+(t?`bg-primary text-primary-foreground`:`hover:bg-muted`),children:[(0,G.jsx)(`span`,{className:`truncate flex-1`,children:e.id}),e.parts&&e.parts.length>0?(0,G.jsxs)(`span`,{className:`text-[10px] tabular-nums ${t?``:`text-muted-foreground`}`,title:e.parts.join(`, `),children:[`+`,e.parts.length]}):null,(0,G.jsx)(XE,{diagnostic:l[e.id]})]})},e.id)})})})]})}function hN({snippets:e}){let t=q(e=>e.components),n=q(e=>e.components===null&&e.componentsLoading),r=q(e=>e.libraryItem),i=q(e=>e.openLibrary),[a,o]=(0,P.useState)(``),{categories:s,extensions:c}=(0,P.useMemo)(()=>{if(!t)return{categories:[],extensions:[]};let e=[],n=[];for(let r of t)r.kind===`extension`?n.push({id:r.id,label:r.id}):e.push(r);return n.sort((e,t)=>e.id.localeCompare(t.id)),{categories:GE(e),extensions:n}},[t]),l=a.trim().toLowerCase(),u=e=>!l||e.toLowerCase().includes(l),d=e.filter(e=>u(e.name)||u(e.id)),f=c.filter(e=>u(e.id));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`section`,{className:`border-b p-2`,children:(0,G.jsxs)(Hg,{className:`h-7`,children:[(0,G.jsx)(Wg,{children:(0,G.jsx)(Ma,{size:12,strokeWidth:2})}),(0,G.jsx)(qg,{type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:`Search library…`})]})}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-auto scroll-stable`,children:[(0,G.jsx)(_N,{icon:(0,G.jsx)(Hn,{size:11,strokeWidth:2}),label:`Snippets`,accent:!0}),e.length===0?(0,G.jsx)(Jm,{className:`gap-2 p-4`,children:(0,G.jsxs)(Ym,{className:`gap-1`,children:[(0,G.jsx)(Zm,{variant:`icon`,className:`size-8`,children:(0,G.jsx)(Hn,{})}),(0,G.jsx)(Qm,{className:`text-xs`,children:`No snippets yet.`}),(0,G.jsxs)($m,{className:`text-xs`,children:[`Create one with `,(0,G.jsx)(ME,{children:`add_snippet`}),` in the MCP, or save a subtree from a screen.`]})]})}):d.length===0?(0,G.jsx)(vN,{query:a,noun:`snippet`}):(0,G.jsx)(`ul`,{className:`flex flex-col px-2 gap-0.5 pb-1`,children:d.map(e=>{let t=r?.kind===`snippet`&&r.id===e.id;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i({kind:`snippet`,id:e.id}),className:`w-full text-left px-2 py-1 rounded-md text-sm transition-colors flex items-center gap-2 `+(t?`bg-primary text-primary-foreground`:`hover:bg-muted`),children:[(0,G.jsx)(`span`,{className:`h-1 w-1 rounded-full shrink-0 `+(t?`bg-primary-foreground`:`bg-primary`)}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.id)})}),c.length>0?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(B_,{className:`mx-2 my-3`}),(0,G.jsx)(_N,{icon:(0,G.jsx)(Mi,{size:11,strokeWidth:2}),label:`Extensions`,count:f.length,accent:!0}),f.length===0?(0,G.jsx)(vN,{query:a,noun:`extension`}):(0,G.jsx)(`ul`,{className:`flex flex-col px-2 gap-0.5 pb-1`,children:f.map(e=>{let t=r?.kind===`component`&&r.id===e.id;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>i({kind:`component`,id:e.id}),className:`w-full text-left px-2 py-1 rounded-md text-sm transition-colors flex items-center gap-2 ${t?`bg-primary text-primary-foreground`:`hover:bg-muted`}`,title:`Custom component registered via add_extension`,children:[(0,G.jsx)(`span`,{className:`h-1 w-1 rounded-full shrink-0 ${t?`bg-primary-foreground`:`bg-primary/60`}`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.label})]})},e.id)})})]}):null,(0,G.jsx)(B_,{className:`mx-2 my-3`}),(0,G.jsx)(pN,{query:a}),n?(0,G.jsx)(gN,{}):null,s.map(e=>{let t=e.components.filter(u);return t.length===0?null:(0,G.jsxs)(`section`,{className:`pb-2`,children:[(0,G.jsx)(_N,{label:e.label,count:t.length}),(0,G.jsx)(`ul`,{className:`flex flex-col px-2 gap-0.5`,children:t.map(e=>{let t=r?.kind===`component`&&r.id===e;return(0,G.jsx)(`li`,{children:(0,G.jsx)(`button`,{type:`button`,onClick:()=>i({kind:`component`,id:e}),className:`w-full text-left px-2 py-1 rounded-md text-sm transition-colors `+(t?`bg-primary text-primary-foreground`:`hover:bg-muted`),children:e})},e)})})]},e.id)})]})]})}function gN(){return(0,G.jsx)(`div`,{className:`px-4 flex flex-col gap-2`,"aria-hidden":`true`,children:[`70%`,`45%`,`60%`,`38%`,`55%`,`48%`].map(e=>(0,G.jsx)(OD,{className:`h-3.5`,style:{width:e}},e))})}function _N({label:e,count:t,icon:n,accent:r}){return(0,G.jsxs)(`div`,{className:`px-4 pt-3 pb-1.5 flex items-center gap-1.5 text-[10px] uppercase tracking-wider font-semibold `+(r?`text-primary`:`text-muted-foreground`),children:[n,(0,G.jsx)(`span`,{className:`flex-1`,children:e}),t===void 0?null:(0,G.jsx)(K,{variant:`secondary`,className:`px-1.5 py-0 text-[10px] font-normal tabular-nums`,children:t})]})}function vN({query:e,noun:t}){return(0,G.jsx)(Jm,{className:`p-3`,children:(0,G.jsxs)($m,{className:`text-xs`,children:[`No `,t,` matches "`,e,`".`]})})}function yN({boards:e,screens:t,snippets:n,currentBoardId:r,currentScreenId:i}){let a=q(e=>e.view),o=q(e=>e.setView),s=q(e=>e.leftPaneCollapsed),c=q(e=>e.setLeftPaneCollapsed),l=q(e=>e.leftPaneWidth),u=q(e=>e.setLeftPaneWidth),d=q(e=>e.boardPulse),f=e=>{o(e),c(!1)};return(0,G.jsxs)(RD,{side:`left`,collapsed:s,width:l,onResize:u,rail:(0,G.jsx)(Fj,{side:`left`,expandLabel:`Expand sidebar`,hotkey:`[`,onExpand:()=>c(!1),actions:[{icon:(0,G.jsx)(Pr,{}),label:`Boards`,active:a===`boards`,dot:Object.keys(d).length>0?{title:`an agent edited another board`}:void 0,onClick:()=>f(`boards`)},{icon:(0,G.jsx)(Rr,{}),label:`Library`,active:a===`library`,onClick:()=>f(`library`)}]}),children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-1 p-2 border-b`,children:[(0,G.jsx)($x,{value:a,onValueChange:e=>o(e),className:`min-w-0 flex-1`,children:(0,G.jsxs)(tS,{className:`w-full h-8`,children:[(0,G.jsxs)(nS,{value:`boards`,className:`text-xs`,children:[(0,G.jsx)(Pr,{}),`Boards`]}),(0,G.jsxs)(nS,{value:`library`,"data-hint":`library`,className:`text-xs`,children:[(0,G.jsx)(Rr,{}),`Library`]})]})}),(0,G.jsx)(Ij,{side:`left`,label:`Collapse sidebar`,hotkey:`[`,onCollapse:()=>c(!0)})]}),a===`boards`?(0,G.jsx)(uN,{boards:e,screens:t,currentBoardId:r,currentScreenId:i}):(0,G.jsx)(hN,{snippets:n})]})}var bN=1500;function xN(e){let t=e.action??`use velloo-cloud`;return e.expired?{title:`Sign in again to continue`,description:`Your velloo-cloud session has ended, so velloo can't ${t} until you sign back in.`}:e.action?{title:`Sign in to continue`,description:`Signing in to velloo-cloud lets velloo ${t}.`}:{title:`Sign in to velloo-cloud`,description:`Publishing boards and pulling share-link comments need an account.`}}function SN(){let e=q(e=>e.signInPrompt),t=q(e=>e.closeSignIn),n=q(e=>e.refreshAuth),r=e!==null,i=(0,P.useRef)({});e&&(i.current=e);let a=xN(i.current),[o,s]=(0,P.useState)({state:`idle`}),[c,l]=(0,P.useState)(!1),u=(0,P.useRef)(null),d=(0,P.useCallback)(()=>{u.current?.();let e=!0,r,i=()=>{e=!1,r&&clearInterval(r)};u.current=i;let a=e=>{i(),n(),V({kind:`success`,message:e.account?.email?`Signed in as ${e.account.email}.`:`Signed in to velloo-cloud.`}),t()};(async()=>{l(!0);let t;try{t=await qu.login()}catch(t){if(!e)return;l(!1),s({state:`error`,message:t instanceof Error?t.message:`Could not start sign-in.`});return}e&&(l(!1),s(t.login),Wu(t)?a(t):t.login.state===`pending`&&(r=setInterval(()=>{qu.status().then(t=>{e&&(Wu(t)?a(t):(s(t.login),t.login.state!==`pending`&&i()))})},bN)))})()},[n,t]);(0,P.useEffect)(()=>{if(!r)u.current?.(),u.current=null,s({state:`idle`}),l(!1);else return d(),()=>{u.current?.(),u.current=null}},[r,d]);let f=()=>{t(),o.state===`pending`&&qu.cancelLogin().catch(()=>void 0)};return(0,G.jsx)(fh,{open:r,onOpenChange:e=>!e&&f(),children:(0,G.jsxs)(hh,{className:`sm:max-w-md`,children:[(0,G.jsxs)(gh,{children:[(0,G.jsx)(vh,{children:a.title}),(0,G.jsx)(yh,{children:a.description})]}),c||o.state===`idle`?(0,G.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-sm text-muted-foreground`,children:[(0,G.jsx)(MT,{className:`size-3.5`}),`Starting sign-in…`]}):null,o.state===`pending`?(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 py-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-2 rounded-md border bg-muted/40 py-4`,children:[(0,G.jsx)(`span`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground`,children:`Your code`}),(0,G.jsx)(`span`,{className:`font-mono text-2xl tracking-[0.2em] tabular-nums`,children:o.userCode})]}),(0,G.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`A browser tab should have opened. Enter the code there to finish signing in — this dialog closes itself once it lands.`}),(0,G.jsxs)(`a`,{href:o.verificationUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-sm underline underline-offset-4`,children:[(0,G.jsx)(Qn,{size:13}),`Open the sign-in page`]})]}):null,o.state===`error`?(0,G.jsxs)(`div`,{className:`flex items-start gap-2 py-2 text-sm text-destructive`,children:[(0,G.jsx)(So,{size:14,className:`mt-0.5 shrink-0`}),(0,G.jsx)(`span`,{children:o.message})]}):null,(0,G.jsxs)(_h,{children:[(0,G.jsx)(J,{variant:`outline`,onClick:f,children:o.state===`pending`?`Cancel`:`Close`}),o.state===`error`?(0,G.jsx)(J,{onClick:d,children:`Try again`}):null]})]})})}function CN({snippet:e}){return(0,G.jsxs)(`section`,{className:`border-b flex flex-col gap-1 px-3 pt-3 pb-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:`Params`}),(0,G.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,title:`A param is a contract with every instance of this snippet across every screen. Changing one here could only ever change this side of it, so a removed param left each caller passing an arg that no longer resolved — breaking screens you weren't looking at. Ask your agent: update_snippet moves the declaration and the call sites in one pass.`,children:`read-only`})]}),e.params.length===0?(0,G.jsx)(`div`,{className:`text-[11px] text-muted-foreground mt-1`,children:`No params.`}):(0,G.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.params.map(e=>(0,G.jsx)(`li`,{className:`rounded-md border bg-background`,children:(0,G.jsx)(wN,{param:e})},e.name))})]})}function wN({param:e}){let t=qE(e);return(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-1`,children:[(0,G.jsxs)(`span`,{className:`font-mono text-[11px] truncate`,children:[`$`,e.name]}),(0,G.jsx)(K,{variant:`outline`,className:`text-[9px] font-mono shrink-0`,children:e.type}),t?(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground truncate`,children:[`= `,t]}):(0,G.jsx)(`span`,{className:`text-[10px] text-amber-600 dark:text-amber-400`,children:`required`}),e.description?(0,G.jsxs)(`span`,{className:`text-[10px] text-muted-foreground truncate`,title:e.description,children:[`· `,e.description]}):null]})}var TN={name:`Snippet`,w:480,h:360};function EN({snippetId:e,snippetMeta:t,presets:n}){let r=q(e=>e.closeSnippetEditor),i=q(e=>e.themeVersion),a=q(e=>e.designMode),o=q(t=>t.screenVersions[`snippet:${e}`]??0),s=q(e=>e.refreshDesignSummary),c=q(e=>e.setSelection),l=q(e=>e.setHover),u=q(e=>e.setNodeRects),d=q(e=>e.reportRenderError),f=q(e=>e.clearNodeRects),p=q(e=>e.selection),m=q(e=>e.hover),h=q(e=>e.nodeState),g=q(e=>e.setSyntheticScreen),_=q(e=>e.loadComponents),v=`snippet:${e}`,y=q(e=>e.screens[v]??null);(0,P.useEffect)(()=>{_()},[_]);let[b,x]=(0,P.useState)(null),[S,C]=(0,P.useState)(!0),[w,T]=(0,P.useState)(!1);(0,P.useEffect)(()=>{let t=!0;return C(!0),T(!1),Zu(e).then(e=>{t&&(x(e),C(!1),g(v,{id:v,name:e.name,tree:e.tree,...e.library?{library:e.library}:{}}))}).catch(()=>{t&&C(!1)}),()=>{t=!1}},[e,g,v]);let E=n.find(e=>e.name.toLowerCase().includes(`desktop`))??n[0]??TN,[D,O]=(0,P.useState)(E),k=a===`dark`?`&mode=dark`:``,A=`/api/render/snippet-body/${encodeURIComponent(e)}?w=${D.w}&h=${D.h}&v=${i}.${o}${k}`,j=(0,P.useRef)(null),M=(0,P.useRef)(null),ee=(0,P.useRef)(null),te=`snippet-view-${e}`;(0,P.useEffect)(()=>{let e=j.current;if(!e)return;let t=new Jv(e,{onSelect(e){c(e===null?null:{screenId:v,path:e})},onHover(e){l(e===null?null:{screenId:v,path:e})},onReady(){let e=q.getState();e.selection?.screenId===v&&t.send({type:`applyHighlight`,path:e.selection.path}),e.hover?.screenId===v&&t.send({type:`applyHover`,path:e.hover.path})},onRects(e){u(te,e)},onParentPan(e,t){let n=M.current;n&&(n.scrollLeft+=e,n.scrollTop+=t)}});ee.current=t;let n=()=>{d(v,fv(e)),t.attach()};return e.addEventListener(`load`,n),e.contentDocument?.readyState===`complete`&&n(),()=>{e.removeEventListener(`load`,n),t.destroy(),ee.current=null,f(te)}},[S,v,te,c,l,u,f,d]),(0,P.useEffect)(()=>{let e=ee.current;e&&(p?.screenId===v?e.send({type:`applyHighlight`,path:p.path}):e.send({type:`clearHighlight`}))},[p,v]),(0,P.useEffect)(()=>{let e=ee.current;e&&(m?.screenId===v?e.send({type:`applyHover`,path:m.path}):e.send({type:`clearHover`}))},[m,v]),(0,P.useEffect)(()=>{let e=ee.current;if(!e)return;let t=p?.screenId===v?p.path:null;e.send({type:`applyVelloState`,path:t,state:t?h:`default`})},[h,p,v]);let ne=async t=>{try{await R(`update_snippet`,{snippetId:e,patch:{name:t}}),s()}catch(e){H(e,`Could not update snippet`)}};if(S)return(0,G.jsx)(`div`,{className:`flex-1 grid place-items-center text-sm text-muted-foreground`,children:(0,G.jsx)(py,{size:32,label:`Loading snippet…`,className:`flex-col`})});if(!b)return(0,G.jsxs)(`div`,{className:`flex-1 grid place-items-center text-sm text-muted-foreground gap-2`,children:[(0,G.jsxs)(`div`,{children:[`Snippet "`,e,`" not found.`]}),(0,G.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:r,children:[(0,G.jsx)(Wt,{}),` Back`]})]});let N=p?.screenId===v,re={...b,name:t?.name??b.name,params:t?.params??b.params};return(0,G.jsxs)(`div`,{className:`flex-1 flex min-h-0`,children:[(0,G.jsxs)(`aside`,{className:`flex h-full w-72 shrink-0 flex-col border-r bg-card`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b`,children:[(0,G.jsxs)(J,{variant:`ghost`,size:`xs`,onClick:r,className:`-ml-1`,children:[(0,G.jsx)(Wt,{size:12}),`Back`]}),(0,G.jsx)(K,{variant:`outline`,className:`ml-auto text-[10px] font-mono`,children:`snippet`})]}),(0,G.jsx)(ON,{snippet:re,onPatchName:ne}),(0,G.jsx)(CN,{snippet:re}),(0,G.jsxs)(`div`,{className:`border-t flex-1 overflow-y-auto scroll-stable`,children:[(0,G.jsx)(DN,{children:`Body`}),y?(0,G.jsx)(tN,{screen:y},y.id):(0,G.jsx)(`div`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`No body to display.`})]})]}),(0,G.jsxs)(`main`,{className:`flex-1 flex flex-col min-w-0 bg-background`,children:[(0,G.jsx)(kN,{presets:n,viewport:D,setViewport:O,snippet:re}),(0,G.jsx)(`div`,{ref:M,className:`flex-1 overflow-auto scroll-stable bg-muted/30`,children:(0,G.jsx)(`div`,{className:`min-w-fit min-h-full flex items-center justify-center p-8`,children:(0,G.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`relative rounded-md border bg-white shadow-sm overflow-hidden shrink-0`,style:{width:D.w,height:D.h},children:[(0,G.jsx)(`iframe`,{ref:j,title:`${b.name} preview`,src:A,onLoad:()=>T(!0),className:`block border-0`,style:{width:D.w,height:D.h}}),w?null:(0,G.jsx)(hy,{})]}),(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground tabular-nums`,children:[D.w,` × `,D.h]})]})})})]}),(0,G.jsx)(`aside`,{className:`w-80 shrink-0 border-l bg-card flex flex-col overflow-hidden`,children:N?(0,G.jsx)(jj,{}):(0,G.jsx)(Jm,{className:`flex-1 p-6`,children:(0,G.jsxs)(Ym,{children:[(0,G.jsx)(Zm,{variant:`icon`,children:(0,G.jsx)(Ei,{})}),(0,G.jsx)(Qm,{className:`text-xs`,children:`Nothing selected`}),(0,G.jsx)($m,{className:`text-xs`,children:`Click a node in the snippet preview to edit.`})]})})})]})}function DN({children:e}){return(0,G.jsx)(`div`,{className:`px-3 pt-3 pb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-medium`,children:e})}function ON({snippet:e,onPatchName:t}){let[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(e.name),o=(0,P.useRef)(null);(0,P.useEffect)(()=>{a(e.name)},[e.name]),(0,P.useEffect)(()=>{n&&o.current?.focus()},[n]);let s=()=>{let n=i.trim();r(!1),n&&n!==e.name?t(n):a(e.name)};return(0,G.jsxs)(`div`,{className:`px-3 py-2 border-b`,children:[n?(0,G.jsx)(Z,{ref:o,value:i,onChange:e=>a(e.target.value),onBlur:s,onKeyDown:t=>{t.key===`Enter`&&s(),t.key===`Escape`&&(r(!1),a(e.name))},className:`h-7`}):(0,G.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`w-full text-left font-semibold text-sm flex items-center gap-1.5 hover:text-primary group truncate`,title:`Rename snippet`,children:[(0,G.jsx)(Ja,{size:11,className:`text-muted-foreground shrink-0`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name}),(0,G.jsx)(ia,{size:10,className:`opacity-0 group-hover:opacity-50 transition-opacity shrink-0`})]}),(0,G.jsxs)(`div`,{className:`mt-0.5 text-[10px] font-mono text-muted-foreground truncate`,children:[`@`,e.id]})]})}function kN({snippet:e,presets:t,viewport:n,setViewport:r}){return(0,G.jsxs)(`header`,{className:`border-b bg-card/40 backdrop-blur-sm px-6 py-2.5 flex items-center gap-3`,children:[(0,G.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Preview · `,(0,G.jsx)(`span`,{className:`font-medium text-foreground`,children:e.name})]}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsxs)(bh,{value:n.name,onValueChange:e=>{let n=t.find(t=>t.name===e);n&&r(n)},children:[(0,G.jsx)(Sh,{size:`sm`,className:`text-xs w-44`,children:(0,G.jsx)(xh,{})}),(0,G.jsx)(Ch,{children:t.map(e=>(0,G.jsxs)(X,{value:e.name,children:[e.name,` · `,e.w,`×`,e.h]},e.name))})]})]})}function AN({className:e,size:t=24}){return(0,G.jsxs)(`svg`,{viewBox:`0 0 120 120`,width:t,height:t,className:e,role:`img`,"aria-label":`Velloo`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.jsx)(`title`,{children:`Velloo`}),(0,G.jsx)(`defs`,{children:(0,G.jsx)(`clipPath`,{id:`velloo-weave`,children:(0,G.jsx)(`rect`,{x:`52`,y:`30`,width:`38`,height:`35`})})}),(0,G.jsx)(`rect`,{x:`21`,y:`21`,width:`58`,height:`58`,rx:`20`,stroke:`#FF6F4D`,strokeWidth:`11`,strokeLinejoin:`round`}),(0,G.jsx)(`rect`,{x:`41`,y:`41`,width:`58`,height:`58`,rx:`20`,stroke:`#FFAB1F`,strokeWidth:`11`,strokeLinejoin:`round`}),(0,G.jsx)(`rect`,{x:`21`,y:`21`,width:`58`,height:`58`,rx:`20`,stroke:`#FF6F4D`,strokeWidth:`11`,strokeLinejoin:`round`,clipPath:`url(#velloo-weave)`})]})}function jN({className:e,fontSize:t=26}){let n=Math.round(t*.57),r=Math.max(1,Math.round(t*.022)),i=Math.round(t*1.55);return(0,G.jsxs)(`span`,{className:e,style:{display:`inline-flex`,alignItems:`center`,gap:Math.round(i*.28)},children:[(0,G.jsx)(AN,{size:i}),(0,G.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`baseline`,fontFamily:`"Poppins", ui-sans-serif, system-ui, sans-serif`,fontWeight:700,fontSize:t,letterSpacing:`-0.06em`,lineHeight:1},children:[`vell`,(0,G.jsx)(`span`,{style:{width:n,height:n,borderRadius:9999,background:`#FFAB1F`,marginLeft:r,display:`inline-block`}}),(0,G.jsx)(`span`,{style:{width:n,height:n,borderRadius:9999,background:`#FF6F4D`,marginLeft:r,display:`inline-block`}})]})]})}var MN=d(`group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg!`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg!`}},defaultVariants:{orientation:`horizontal`}});function NN({className:e,orientation:t,...n}){return(0,G.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:W(MN({orientation:t}),e),...n})}function PN({label:e,hotkey:t,children:n}){return(0,G.jsxs)(Ex,{children:[(0,G.jsx)(Dx,{asChild:!0,children:n}),(0,G.jsx)(Ox,{children:(0,G.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e,t?(0,G.jsx)(ME,{className:`border-border/40 bg-background/10 text-current opacity-80`,children:t}):null]})})]})}function FN(){let e=q(e=>e.design),t=q(e=>e.currentScreenId),n=q(e=>e.view),r=q(e=>e.languageTheme),i=q(e=>e.libraryItem),a=q(e=>e.theme),o=q(e=>e.canvasZoom),s=q(e=>e.zoomAtViewportCenter),c=q(e=>e.cursorMode),l=q(e=>e.setCursorMode),u=q(e=>e.enterCommentMode),d=q(e=>e.history),f=q(e=>e.refreshHistory),p=q(e=>e.designMode),m=q(e=>e.setDesignMode),h=q(e=>e.setPublishOpen),g=q(e=>e.publishBoard),_=q(e=>e.view===`boards`&&!e.editingSnippetId&&e.currentBoardId?e.boards[e.currentBoardId]:void 0),v=()=>_?g({id:_.id,name:_.name}):h(!0),y=e?.screens.find(e=>e.id===t),b=n===`library`?[`Library`,...i?[i.id]:[]]:n===`language`?[`Design language`,...r==="default"?[]:[r]]:y?[y.name]:[],x=[...e?.designName?[e.designName]:[],...b],S=p===`dark`,C=!!a?.colorsDark,w=()=>{C?m(S?`light`:`dark`):H("This theme has no dark palette. Add `colorsDark` in theme/default.json.",`Theme has no dark palette`)},T=()=>{s({zoom:1})},E=()=>{hd().catch(e=>H(e,`Undo failed`)).finally(()=>f())},D=()=>{gd().catch(e=>H(e,`Redo failed`)).finally(()=>f())},O=[{value:`select`,icon:(0,G.jsx)(wi,{size:14,strokeWidth:2}),label:`Select`,hotkey:`V`},{value:`hand`,icon:(0,G.jsx)(vr,{size:14,strokeWidth:2}),label:`Pan canvas`,hotkey:`H`},{value:`note`,icon:(0,G.jsx)(oo,{size:14,strokeWidth:2}),label:`Drop a free note`,hotkey:`T`},{value:`comment`,icon:(0,G.jsx)(mi,{size:14,strokeWidth:2}),label:`Comment on the design`,hotkey:`C`}];return(0,G.jsx)(Tx,{delayDuration:200,children:(0,G.jsxs)(`header`,{className:`h-11 shrink-0 border-b bg-card flex items-center gap-3 px-4 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,G.jsx)(jN,{fontSize:15}),x.length>0?(0,G.jsx)(eD,{children:(0,G.jsx)(tD,{className:`gap-1.5 text-sm sm:gap-1.5`,children:x.map((e,t)=>(0,G.jsxs)(P.Fragment,{children:[(0,G.jsx)(aD,{className:`[&>svg]:size-3`}),(0,G.jsx)(nD,{children:t===x.length-1?(0,G.jsx)(iD,{className:`truncate`,children:e}):(0,G.jsx)(`span`,{className:`truncate`,children:e})})]},t))})}):null]}),(0,G.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,G.jsx)(nh,{}),(0,G.jsx)(IN,{}),(0,G.jsx)(B_,{orientation:`vertical`,className:`mx-1 h-5`}),(0,G.jsx)(rv,{type:`single`,variant:`outline`,size:`sm`,spacing:0,"data-hint":`tools`,value:c,onValueChange:e=>{e&&(e===`comment`?u():l(e))},children:O.map(e=>(0,G.jsx)(PN,{label:e.label,hotkey:e.hotkey,children:(0,G.jsx)(iv,{value:e.value,"aria-label":e.label,"aria-pressed":c===e.value,"data-state":c===e.value?`on`:`off`,className:c===e.value?`bg-accent text-accent-foreground hover:bg-accent hover:text-accent-foreground`:void 0,children:e.icon})},e.value))}),(0,G.jsx)(LN,{}),(0,G.jsx)(PN,{label:S?`Design theme: dark — show designs in light (pinned frames keep theirs)`:`Design theme: light — show designs in dark (pinned frames keep theirs)`,children:(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,onClick:w,"aria-label":S?`Show designs in light`:`Show designs in dark`,children:S?(0,G.jsx)(uo,{}):(0,G.jsx)(Si,{})})}),(0,G.jsxs)(NN,{className:`ml-2`,children:[(0,G.jsx)(PN,{label:`Undo${d.undo>0?` — ${d.undo} step${d.undo===1?``:`s`}`:``}`,hotkey:`⌘Z`,children:(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,onClick:E,disabled:d.undo===0,children:(0,G.jsx)(Eo,{})})}),(0,G.jsx)(PN,{label:`Redo${d.redo>0?` — ${d.redo} step${d.redo===1?``:`s`}`:``}`,hotkey:`⌘⇧Z`,children:(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,onClick:D,disabled:d.redo===0,children:(0,G.jsx)(ga,{})})})]}),(0,G.jsx)(B_,{orientation:`vertical`,className:`mx-1 h-5`}),(0,G.jsxs)(NN,{children:[(0,G.jsx)(PN,{label:`Zoom out`,hotkey:`−`,children:(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,onClick:()=>s({factor:1/1.1}),children:(0,G.jsx)(vi,{})})}),(0,G.jsx)(PN,{label:`Reset zoom`,hotkey:`0`,children:(0,G.jsxs)(J,{variant:`outline`,size:`sm`,onClick:T,className:`min-w-[3rem] tabular-nums text-muted-foreground`,children:[Math.round(o*100),`%`]})}),(0,G.jsx)(PN,{label:`Zoom in`,hotkey:`+`,children:(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,onClick:()=>s({factor:1.1}),children:(0,G.jsx)(ua,{})})})]}),(0,G.jsx)(B_,{orientation:`vertical`,className:`mx-1 h-5`}),(0,G.jsx)(PN,{label:`Publish this board as a share link`,children:(0,G.jsxs)(J,{variant:`outline`,size:`sm`,"data-hint":`publish`,onClick:v,children:[(0,G.jsx)(Ba,{}),(0,G.jsx)(`span`,{children:`Publish`})]})}),(0,G.jsx)(OE,{})]})]})})}function IN(){let e=q(e=>e.setSearchOpen);return(0,G.jsx)(PN,{label:`Search boards, screens & text`,hotkey:`⌘K`,children:(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,onClick:()=>e(!0),children:(0,G.jsx)(Ma,{})})})}function LN(){let e=q(e=>e.markupVisible),t=q(e=>e.setMarkupVisible);return(0,G.jsx)(PN,{label:e?`Hide notes + comments`:`Show notes + comments`,children:(0,G.jsx)(J,{variant:`outline`,size:`icon-sm`,onClick:()=>t(!e),children:e?(0,G.jsx)(nr,{}):(0,G.jsx)(er,{})})})}function RN(e){return e===`system`?typeof window>`u`?`light`:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function zN(e){let t=RN(q(e=>e.appTheme));return(0,G.jsx)(p,{theme:t,className:`toaster group`,style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`},...e})}function BN(){let e=e=>{e.ctrlKey&&e.preventDefault()},t=e=>e.preventDefault();window.addEventListener(`wheel`,e,{passive:!1});for(let e of VN)document.addEventListener(e,t);return()=>{window.removeEventListener(`wheel`,e);for(let e of VN)document.removeEventListener(e,t)}}var VN=[`gesturestart`,`gesturechange`];function HN(){let e=new URLSearchParams(window.location.search),t=e.get(`view`),n=t===`library`||t===`snippet`||t===`language`?t:`boards`,r=e.get(`item`),i=null;if(n===`library`&&r){let[e,...t]=r.split(`:`);(e===`component`||e===`snippet`||e===`repo`)&&t.length>0&&(i={kind:e,id:t.join(`:`)})}let a=e.get(`board`),o=e.get(`screen`),s=e.get(`sel`),c=o&&s!==null?{screenId:o,path:s}:null,l=n===`snippet`?e.get(`snippet`):null,u=e.get(`pane`)===`agent`?`agent`:null;return{view:n,libraryItem:i,boardId:a,screenId:o,selection:c,snippetId:l,pane:u}}function UN(e,t,n,r,i,a,o){let s=new URL(window.location.href);s.searchParams.delete(`view`),s.searchParams.delete(`item`),s.searchParams.delete(`board`),s.searchParams.delete(`screen`),s.searchParams.delete(`sel`),s.searchParams.delete(`snippet`),s.searchParams.delete(`pane`),e===`snippet`&&a?(s.searchParams.set(`view`,`snippet`),s.searchParams.set(`snippet`,a)):e===`library`?(s.searchParams.set(`view`,`library`),t&&s.searchParams.set(`item`,`${t.kind}:${t.id}`)):e===`language`?s.searchParams.set(`view`,`language`):(n&&s.searchParams.set(`board`,n),r&&s.searchParams.set(`screen`,r),i&&s.searchParams.set(`sel`,i.path)),o?window.history.pushState({},``,s.toString()):window.history.replaceState({},``,s.toString())}function WN(e){let t=q.getState();return e.view===t.view&&e.view===`boards`&&(!e.boardId||e.boardId===t.currentBoardId)&&(!e.screenId||e.screenId===t.currentScreenId)}function GN(e){return e?`${e.kind}:${e.id}`:``}function KN(){let e=q(e=>e.view),t=q(e=>e.libraryItem),n=q(e=>e.currentBoardId),r=q(e=>e.currentScreenId),i=q(e=>e.selection),a=q(e=>e.editingSnippetId),o=(0,P.useRef)(void 0),s=(0,P.useRef)(void 0),c=(0,P.useRef)(void 0),l=(0,P.useRef)(!1);(0,P.useEffect)(()=>{if(l.current){l.current=!1,o.current=n,s.current=e,c.current=GN(t);return}let u=o.current,d=s.current,f=c.current,p=GN(t),m=e===`boards`&&!!(u&&n&&u!==n),h=d!==void 0&&d!==e,g=e===`library`&&f!==void 0&&f!==p;o.current=n,s.current=e,c.current=p,UN(e,t,n,r,i,a,m||h||g)},[e,t,n,r,i,a]),(0,P.useEffect)(()=>{let e=e=>{let t=q.getState(),n=[];e.view===t.view?e.view===`library`?t.openLibrary(e.libraryItem):e.view===`snippet`&&e.snippetId&&t.openSnippetEditor(e.snippetId):e.view===`snippet`&&e.snippetId?t.openSnippetEditor(e.snippetId):e.view===`library`?t.openLibrary(e.libraryItem):e.view===`language`?n.push(t.openLanguage().catch(e=>H(e,`Could not open the design language`))):t.editingSnippetId?t.closeSnippetEditor():t.closeLibrary(),e.view===`boards`&&(e.boardId&&e.boardId!==t.currentBoardId&&n.push(t.selectBoard(e.boardId)),e.screenId&&e.screenId!==t.currentScreenId&&n.push(t.selectScreen(e.screenId))),Promise.all(n).then(()=>{e.view===`boards`&&t.setSelection(e.selection)})},t=()=>{let t=HN();l.current=!0,q.getState().view!==`language`||t.view===`language`?e(t):(async()=>{try{await q.getState().cancelLanguage()}catch(e){H(e,`Could not undo the changes`);return}q.getState().view!==`language`&&(WN(t)||(l.current=!0),e(t))})()};return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[])}var qN=new Set([`set_design_language`,`import_theme`,`set_token`,`set_tokens`,`set_fonts`,`set_typeset`,`set_radius`,`set_custom_role`,`custom_css`,`apply_preset`,`apply_starting_point`,`derive_palette_from_color`]),JN=`design-language-changed`;function YN(e){return qN.has(e.verb)||(e.ops??[]).some(e=>qN.has(e.verb))}function XN(){let{agentSessions:e,agentActiveSessionId:t,agentProviders:n}=q.getState(),r=e.find(e=>e.id===t);return n?.find(e=>e.id===r?.provider)?.label??`Your agent`}function ZN(e){if(e.source!==`mcp`||!YN(e)||q.getState().view===`language`)return;let t=e.verb===`set_design_language`;V({id:JN,title:`${XN()} ${t?`proposed design rules`:`changed the design language`}`,message:`Review the theme and rules on a specimen of your components.`,ttl:1/0,closeButton:!0,action:{label:`Review`,onClick:()=>void q.getState().openLanguage(`review`).catch(e=>H(e,`Could not open the design language`))}})}function QN(e){let t=q.getState();!t.currentBoardId&&t.design?.boards.some(t=>t.id===e)&&t.selectBoard(e)}function $N(){let e=null,t=!1,n=250;function r(){if(t)return;let i=`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`;e=new WebSocket(i),e.onopen=()=>{n=250,Go(!0);let e=q.getState(),t=e.wsEverConnected&&!e.wsConnected;e.setWsConnected(!0),e.loadCommentArrivals(),e.design===null?e.bootError!==null&&e.loadDesign():t&&(e.resyncAfterReconnect(),e.agentProviders!==null&&e.loadAgent())},e.onmessage=e=>{let t=bs(e.data);if(!t)return;if(t.type===`activity`){let e=Xd(t);e&&(q.getState().recordActivity(e),ZN(e));return}if(t.type===`comments-arrived`){let e={boardId:t.boardId,threadIds:t.threadIds,messageIds:t.messageIds};q.getState().receiveCommentArrival(e),gO(e);return}if(t.type===`agent`){let e=_s(t);e&&q.getState().applyAgentFrame(e);return}let{currentScreenId:n,currentBoardId:r,refreshScreen:i,refreshBoard:a,refreshDesignSummary:o,refreshHistory:s,refreshTheme:c,refreshAnnotations:l,refreshNotes:u,refreshComments:d,screens:f,boards:p}=q.getState();if(s(),t.type===`screen-changed`)t.screenId in f?i(t.screenId):o();else if(t.type===`board-changed`)t.boardId in p?a(t.boardId):o().then(()=>QN(t.boardId));else if(t.type===`theme-changed`)c(),q.getState().refreshLanguage().catch(()=>{});else if(t.type===`snippet-changed`){o(),n&&i(n);let e=q.getState();(e.editingSnippetId===t.snippetId||e.snippetFocus===t.snippetId)&&(async()=>{try{let e=await Zu(t.snippetId);q.getState().setSyntheticScreen(`snippet:${t.snippetId}`,{id:`snippet:${t.snippetId}`,name:e.name,tree:e.tree,...e.library?{library:e.library}:{}})}catch{}})()}else if(t.type===`annotations-changed`){let e=r?p[r]:null;(e?.frames.some(e=>e.screen===t.screenId)||!e&&t.screenId===n)&&l()}else t.type===`notes-changed`?t.boardId===r&&u():t.type===`comments-changed`?(t.boardId===r&&d(),q.getState().refreshCommentCounts()):t.type===`config-changed`?(o(),q.getState().folderConfig&&q.getState().loadFolderConfig(),q.getState().reloadRepoCatalog(),q.getState().resetLibraryStatus()):t.type===`folder-reloaded`?(q.getState().reloadAll(),q.getState().reloadRepoCatalog(),q.getState().resetLibraryStatus()):t.type===`reload-error`&&V({kind:`error`,title:`File change not applied`,message:`${t.source}: ${t.message}`,ttl:8e3})},e.onclose=()=>{Go(!1),q.getState().setWsConnected(!1),!t&&(setTimeout(r,n),n=Math.min(n*2,5e3))},e.onerror=()=>{e?.close()}}return r(),()=>{t=!0,e?.close()}}var eP=6e4;function tP(){(0,P.useEffect)(()=>{let e=jd(e=>q.getState().openSignIn(e)),t=()=>void q.getState().refreshAuth();t();let n=setInterval(t,eP),r=()=>{document.visibilityState===`visible`&&t()};return document.addEventListener(`visibilitychange`,r),()=>{e(),clearInterval(n),document.removeEventListener(`visibilitychange`,r)}},[])}function nP(){(0,P.useEffect)(()=>{let e=()=>q.getState().syncPaneLayout(window.innerWidth);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[])}function rP(){let e=q(e=>e.design),t=q(e=>e.bootError),n=q(e=>e.view),r=q(e=>e.rightPaneCollapsed),i=q(e=>e.rightPaneWidth),a=n===`boards`||n===`language`,o=r?36:i,s=q(e=>e.libraryItem),c=q(e=>e.editingSnippetId),l=q(e=>e.currentBoardId),u=q(e=>e.currentScreenId),d=q(e=>l?e.boards[l]??null:null),f=q(e=>e.loadDesign),p=q(e=>e.setSelection),m=(0,P.useRef)(!1),h=(0,P.useRef)(null),[g,_]=(0,P.useState)(null);return(0,P.useEffect)(()=>{if(m.current)return;m.current=!0;let e=HN();return e.view===`library`?q.getState().openLibrary(e.libraryItem):e.view===`snippet`&&e.snippetId?q.getState().openSnippetEditor(e.snippetId):e.view===`language`&&q.getState().setView(`language`),e.pane===`agent`&&q.setState(e=>({rightTab:`agent`,...Bf(e,`right`)})),(async()=>{await f({boardId:e.boardId,screenId:e.screenId}),q.getState().refreshLanguage().catch(()=>{}),e.view===`boards`&&e.selection&&p(e.selection),e.view===`language`&&await q.getState().openLanguage().catch(e=>H(e,`Could not open the design language`))})(),$N()},[f,p]),KN(),Wm(),tP(),nP(),FE(),(0,P.useEffect)(mE,[]),(0,P.useEffect)(BN,[]),(0,P.useEffect)(()=>{document.title=Gm(e?.designName,d?.name)},[e?.designName,d?.name]),(0,P.useEffect)(()=>{let e=e=>{let t=e.target,n=t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable),r=e.metaKey||e.ctrlKey,i=q.getState();if(r&&(e.key===`k`||e.key===`K`))e.preventDefault(),i.setSearchOpen(!i.searchOpen);else if(r&&(e.key===`z`||e.key===`Z`)&&!e.shiftKey){if(n)return;e.preventDefault(),hd().catch(e=>H(e,`Undo failed`)).finally(()=>i.refreshHistory())}else if(r&&(e.key===`z`||e.key===`Z`)&&e.shiftKey){if(n)return;e.preventDefault(),gd().catch(e=>H(e,`Redo failed`)).finally(()=>i.refreshHistory())}else if(!r&&!n&&(e.key===`=`||e.key===`+`))e.preventDefault(),i.zoomAtViewportCenter({factor:1.1});else if(!r&&!n&&e.key===`-`)e.preventDefault(),i.zoomAtViewportCenter({factor:1/1.1});else if(!r&&!n&&e.key===`0`)e.preventDefault(),i.zoomAtViewportCenter({zoom:1});else if(!r&&!n&&e.key===`[`)e.preventDefault(),i.setLeftPaneCollapsed(!i.leftPaneCollapsed);else if(!r&&!n&&e.key===`]`)e.preventDefault(),i.setRightPaneCollapsed(!i.rightPaneCollapsed);else if(!r&&!n&&(e.key===`v`||e.key===`V`))i.setCursorMode(`select`);else if(!r&&!n&&(e.key===`h`||e.key===`H`))i.setCursorMode(`hand`);else if(!r&&!n&&(e.key===`t`||e.key===`T`))e.preventDefault(),i.noteOnSelection()||i.setCursorMode(`note`);else if(!r&&!n&&(e.key===`c`||e.key===`C`))e.preventDefault(),i.enterCommentMode();else if(e.key===` `&&!n&&!h.current)e.preventDefault(),h.current=i.cursorMode,i.setCursorMode(`hand`);else if(e.key===`Escape`){if(i.snippetFocus){e.preventDefault(),i.setSnippetFocus(null);return}if(i.editingSnippetId){e.preventDefault(),i.closeSnippetEditor();return}i.setCursorMode(`select`),i.setEditingMarkupId(null)}},t=e=>{if(e.key===` `&&h.current){let e=h.current;h.current=null,q.getState().setCursorMode(e)}};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,t)}},[]),(0,P.useEffect)(()=>{let e=[`hand`,`note`,`comment`],t=t=>{for(let n of e)document.body.classList.toggle(`velloo-${n}`,t===n)};t(q.getState().cursorMode);let n=q.subscribe((e,n)=>{e.cursorMode!==n.cursorMode&&t(e.cursorMode)});return()=>{n();for(let t of e)document.body.classList.remove(`velloo-${t}`)}},[]),e?(0,G.jsxs)(`div`,{className:`h-full flex flex-col`,children:[(0,G.jsx)(FN,{}),(0,G.jsx)(iP,{}),(0,G.jsxs)(`div`,{className:`flex-1 flex min-h-0`,children:[n===`language`?(0,G.jsx)(xT,{}):(0,G.jsx)(yN,{boards:e.boards,screens:e.screens,snippets:e.snippets,currentBoardId:l,currentScreenId:u}),(0,G.jsx)(`main`,{"data-hint":`board`,className:`flex-1 flex flex-col min-w-0`,children:n===`snippet`&&c?(0,G.jsx)(EN,{snippetId:c,snippetMeta:e.snippets.find(e=>e.id===c)??null,presets:e.viewportPresets}):n===`library`?s?(0,G.jsx)(SD,{item:s,snippets:e.snippets}):(0,G.jsx)(MD,{snippets:e.snippets}):n===`language`?(0,G.jsx)(wT,{}):d&&d.frames.length>0?(0,G.jsx)(sC,{board:d}):d?(0,G.jsx)(ET,{title:`Board "${d.name}" is empty`,hint:`Ask your agent to design something here — it places screens on boards through the velloo MCP tools. Or place an existing screen yourself.`,action:e.screens.length>0?(0,G.jsxs)(J,{variant:`outline`,onClick:()=>_(d.id),children:[(0,G.jsx)(ua,{}),`Add frame`]}):void 0}):e.boards.length===0?(0,G.jsx)(TC,{onNewBoard:()=>{(async()=>{try{let e=await B.addBoard({name:`Main`});await q.getState().selectBoard(e.boardId)}catch(e){H(e,`Could not create board`)}})()}}):(0,G.jsx)(ET,{title:`No board selected`,hint:`Pick a board from the sidebar to see its frames.`})}),n===`boards`?(0,G.jsx)(Yj,{screenId:u}):n===`language`?(0,G.jsx)(Xj,{}):null]}),(0,G.jsx)($j,{}),(0,G.jsx)(jT,{}),(0,G.jsx)(GD,{}),(0,G.jsx)(OM,{}),(0,G.jsx)(Eh,{boardId:g,onClose:()=>_(null)}),(0,G.jsx)(IT,{}),(0,G.jsx)(SN,{}),(0,G.jsx)(fO,{}),(0,G.jsx)(VT,{}),(0,G.jsx)(AE,{}),(0,G.jsx)(OC,{}),(0,G.jsx)(ch,{}),(0,G.jsx)(IE,{}),(0,G.jsx)(zN,{offset:{right:(a?o:0)+24,bottom:24}})]}):t?(0,G.jsx)(`div`,{className:`h-full grid place-items-center p-8`,children:(0,G.jsxs)(`div`,{className:`max-w-md text-center flex flex-col items-center gap-3`,children:[(0,G.jsx)(Ro,{className:`text-muted-foreground`,size:28}),(0,G.jsx)(`div`,{className:`text-base font-medium`,children:`Can't reach the velloo daemon`}),(0,G.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[`The design server isn't answering (`,t,`). Start it with`,` `,(0,G.jsx)(`span`,{className:`font-mono`,children:`velloo run`}),` — the canvas reconnects automatically, or retry now.`]}),(0,G.jsx)(J,{variant:`outline`,onClick:()=>void q.getState().loadDesign(),children:`Retry`})]})}):(0,G.jsx)(`div`,{className:`h-full grid place-items-center`,children:(0,G.jsx)(py,{size:44})})}function iP(){let e=q(e=>e.wsConnected),t=q(e=>e.wsEverConnected);return e||!t?null:(0,G.jsxs)(`div`,{role:`status`,className:`shrink-0 flex items-center justify-center gap-2 px-4 py-1.5 text-xs font-medium bg-destructive text-destructive-foreground`,children:[(0,G.jsx)(Ro,{size:13}),`Disconnected from the velloo daemon — designs are view-only until it comes back. Reconnecting…`]})}var aP=(0,P.lazy)(()=>Ux(()=>import(`./InitWizard-C1CkcS7C.js`).then(e=>({default:e.InitWizard})),__vite__mapDeps([3,1,4,2]))),oP=document.getElementById(`root`);if(!oP)throw Error(`missing #root`);(0,Uo.createRoot)(oP).render((0,G.jsx)(P.StrictMode,{children:window.location.pathname===`/init`?(0,G.jsx)(P.Suspense,{children:(0,G.jsx)(aP,{})}):(0,G.jsx)(rP,{})}));export{Ia as $,It as $n,Ir as $t,Oo as A,On as An,Oi as At,co as B,ln as Bn,ci as Bt,Ho as C,Hn as Cn,Hi as Ct,Po as D,Pn as Dn,Pi as Dt,Io as E,In as En,Ii as Et,yo as F,vn as Fn,vi as Ft,Qa as G,Qt as Gn,Qr as Gt,io as H,an as Hn,ii as Ht,_o as I,gn as In,gi as It,Ka as J,Kt as Jn,Kr as Jt,Xa as K,Xt as Kn,Xr as Kt,ho as L,I as Ln,mi as Lt,wo as M,wn as Mn,wi as Mt,So as N,Sn as Nn,Si as Nt,Mo as O,Mn as On,Mi as Ot,L as P,bn as Pn,bi as Pt,Ra as Q,Rt as Qn,Rr as Qt,po as R,pn as Rn,fi as Rt,Wu as S,Wn as Sn,Wi as St,Ro as T,Rn as Tn,Ri as Tt,no as U,nn as Un,ni as Ut,oo as V,sn as Vn,oi as Vt,eo as W,en as Wn,ei as Wt,Ha as X,Ht as Xn,Hr as Xt,Wa as Y,Wt as Yn,Wr as Yt,Ba as Z,Bt as Zn,Br as Zt,Vg as _,er as _n,ea as _t,tw as a,wr as an,wa as at,K as b,Jn as bn,Ji as bt,K_ as c,vr as cn,va as ct,U_ as d,fr as dn,fa as dt,Pr as en,F as er,Pa as et,q_ as f,ur as fn,ua as ft,t_ as g,nr as gn,na as gt,e_ as h,ir as hn,ia as ht,MT as i,Er as in,Ea as it,Eo as j,En as jn,Ei as jt,Ao as k,An as kn,Ai as kt,J_ as l,gr as ln,ga as lt,V_ as m,or as mn,oa as mt,LO as n,Ar as nn,Mt as nr,Aa as nt,rw as o,Sr as on,Sa as ot,H_ as p,cr as pn,ca as pt,Ja as q,Jt as qn,Jr as qt,qD as r,Or as rn,Nt as rr,Oa as rt,G_ as s,br as sn,ba as st,jN as t,Mr as tn,Pt as tr,Ma as tt,Y_ as u,mr as un,ma as ut,Z as v,Qn as vn,Qi as vt,Bo as w,Bn as wn,Bi as wt,W as x,Kn as xn,Ki as xt,J as y,Xn as yn,Xi as yt,uo as z,dn as zn,ui as zt};