@asymmetric-effort/specifyjs 0.2.158 → 0.2.159
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.
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
to { opacity: 1; transform: translateY(0); }
|
|
6
6
|
}
|
|
7
7
|
`,document.head.appendChild(d),()=>{let u=document.getElementById(l);u&&u.remove()}},[]);let s=v(l=>t.dismiss(l),[t]),a=r.map(l=>o(wl,{key:l.id,item:l,onDismiss:s}));return o("div",{style:i},...a)}function $r(e={}){let t=oe(null);t.current||(t.current=yn(e));let n=t.current,r=v(()=>o(Sn,{toaster:n}),[n]);return{toast:n.toast,dismiss:n.dismiss,dismissAll:n.dismissAll,ToastContainer:r}}var kl=6,Cl=8;function Ml(e,t){let n=window.scrollX||window.pageXOffset,r=window.scrollY||window.pageYOffset,i=Cl;switch(t){case"top":return{position:"fixed",left:`${e.left+e.width/2}px`,top:`${e.top-i}px`,transform:"translate(-50%, -100%)"};case"bottom":return{position:"fixed",left:`${e.left+e.width/2}px`,top:`${e.bottom+i}px`,transform:"translateX(-50%)"};case"left":return{position:"fixed",left:`${e.left-i}px`,top:`${e.top+e.height/2}px`,transform:"translate(-100%, -50%)"};case"right":return{position:"fixed",left:`${e.right+i}px`,top:`${e.top+e.height/2}px`,transform:"translateY(-50%)"}}}function El(e){let t={position:"absolute",width:"0",height:"0",borderStyle:"solid"},n=`${kl}px`,r="transparent",i="#1f2937";switch(e){case"top":return{...t,bottom:`-${n}`,left:"50%",transform:"translateX(-50%)",borderWidth:`${n} ${n} 0 ${n}`,borderColor:`${i} ${r} ${r} ${r}`};case"bottom":return{...t,top:`-${n}`,left:"50%",transform:"translateX(-50%)",borderWidth:`0 ${n} ${n} ${n}`,borderColor:`${r} ${r} ${i} ${r}`};case"left":return{...t,right:`-${n}`,top:"50%",transform:"translateY(-50%)",borderWidth:`${n} 0 ${n} ${n}`,borderColor:`${r} ${r} ${r} ${i}`};case"right":return{...t,left:`-${n}`,top:"50%",transform:"translateY(-50%)",borderWidth:`${n} ${n} ${n} 0`,borderColor:`${r} ${i} ${r} ${r}`}}}function Tr(e){let{text:t,placement:n="top",delay:r=200,maxWidth:i="250px",children:s}=e,[a,l]=G(!1),[d,u]=G(null),h=oe(null),m=oe(null),c=`tooltip-${Math.random().toString(36).slice(2,9)}`,p=v(()=>{m.current=setTimeout(()=>{if(h.current){let b=h.current.getBoundingClientRect();u(Ml(b,n))}l(!0)},r)},[r,n]),f=v(()=>{m.current&&(clearTimeout(m.current),m.current=null),l(!1)},[]);ae(()=>()=>{m.current&&clearTimeout(m.current)},[]);let y={display:"inline-block"},x={...d??{},backgroundColor:"#1f2937",color:"#fff",fontSize:"13px",lineHeight:"1.4",padding:"6px 10px",borderRadius:"6px",maxWidth:i,zIndex:"10002",pointerEvents:"none",whiteSpace:"normal",wordWrap:"break-word"},g=[o("div",{ref:h,style:y,onMouseEnter:p,onMouseLeave:f,onFocus:p,onBlur:f,"aria-describedby":a?c:void 0},s)];return a&&d&&g.push(o("div",{id:c,style:x,role:"tooltip"},t,o("div",{style:El(n)}))),o("div",{style:{display:"inline-block",position:"relative"}},...g)}function vn(e,t,n,r,i){return q(()=>{let s=Math.max(1,(r-i*(e+1))/e);return{valueScale:d=>t===0?0:d/t*n,categoryScale:d=>i+d*(s+i),barThickness:s,maxValue:t,valueAxisLength:n,categoryAxisLength:r}},[e,t,n,r,i])}function Il(e,t,n){if(t&&t.length>0){if(n){let s=0;for(let a of t)for(let l of a.values)l.value>s&&(s=l.value);return s}let i=0;for(let s of t){let a=0;for(let l of s.values)a+=l.value;a>i&&(i=a)}return i}let r=0;for(let i of e)i.value>r&&(r=i.value);return r}function Rl(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function Pl(e){let t=new Set;for(let n of e)for(let r of n.values)t.add(r.category);return Array.from(t)}var Dr=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function zr(e,t){return t||Dr[e%Dr.length]}function Ar(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",barColor:s="#3b82f6",barGap:a=8,barRadius:l=4,showValues:d=!0,showGrid:u=!0,gridColor:h="#e5e7eb",title:m,padding:c=50,animate:p=!1,stacked:f,grouped:y=!1}=e,x=i==="vertical",g=n-c*2,b=r-c*2,S=x?b:g,D=x?g:b,z=f!==void 0&&f.length>0,M=q(()=>z?Pl(f):[],[z,f]),$=z?f.length:t.length,L=q(()=>Il(t,f,y),[t,f,y]),R=L>0?L:1,P=vn($,R,S,D,a),B=v(()=>{if(!u)return[];let O=Rl(R),U=[];for(let K=O;K<=R;K+=O){let te=P.valueScale(K);if(x){let J=c+b-te;U.push(o("line",{key:`grid-${K}`,x1:String(c),y1:String(J),x2:String(c+g),y2:String(J),stroke:h,"stroke-width":"1","stroke-dasharray":"4 2"})),U.push(o("text",{key:`grid-label-${K}`,x:String(c-6),y:String(J+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(K)))}else{let J=c+te;U.push(o("line",{key:`grid-${K}`,x1:String(J),y1:String(c),x2:String(J),y2:String(c+b),stroke:h,"stroke-width":"1","stroke-dasharray":"4 2"})),U.push(o("text",{key:`grid-label-${K}`,x:String(J),y:String(c+b+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(K)))}}return U},[u,R,P,x,c,g,b,h]),I=v(()=>{let O=[];return x?(O.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+b),stroke:"#374151","stroke-width":"1.5"})),O.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+b),x2:String(c+g),y2:String(c+b),stroke:"#374151","stroke-width":"1.5"}))):(O.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+b),x2:String(c+g),y2:String(c+b),stroke:"#374151","stroke-width":"1.5"})),O.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+b),stroke:"#374151","stroke-width":"1.5"}))),O},[x,c,g,b]),F=v(()=>{let O=[];for(let U=0;U<t.length;U++){let K=t[U],te=P.valueScale(K.value),J=P.categoryScale(U),V=K.color??s,j,Y,H=String(K.value);if(x){let Z=c+J,ee=c+b-te;j={x:String(Z),y:String(ee),width:String(P.barThickness),height:String(te),rx:String(l),ry:String(l),fill:V},Y={x:String(Z+P.barThickness/2),y:String(ee-6),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"}}else{let Z=c+J,ee=c;j={x:String(ee),y:String(Z),width:String(te),height:String(P.barThickness),rx:String(l),ry:String(l),fill:V},Y={x:String(ee+te+6),y:String(Z+P.barThickness/2+4),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#374151"}}if(p&&(j.style=x?`animation: barGrow 0.6s ease-out ${U*.05}s both`:`animation: barGrow 0.6s ease-out ${U*.05}s both`),O.push(o("rect",{key:`bar-${U}`,...j})),d&&O.push(o("text",{key:`val-${U}`,...Y},H)),x){let Z=c+J+P.barThickness/2,ee=c+b+16;O.push(o("text",{key:`cat-${U}`,x:String(Z),y:String(ee),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${Z}, ${ee})`},K.label))}else O.push(o("text",{key:`cat-${U}`,x:String(c-6),y:String(c+J+P.barThickness/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},K.label))}return O},[t,P,s,l,d,p,x,c,b]),A=v(()=>{if(!f)return[];let O=[];for(let U=0;U<f.length;U++){let K=f[U],te=P.categoryScale(U),J=0;for(let V=0;V<K.values.length;V++){let j=K.values[V],Y=P.valueScale(j.value),H=P.valueScale(J),Z=zr(V,j.color);if(x){let ee=c+te,se=c+b-H-Y;O.push(o("rect",{key:`sbar-${U}-${V}`,x:String(ee),y:String(se),width:String(P.barThickness),height:String(Y),rx:V===K.values.length-1?String(l):"0",ry:V===K.values.length-1?String(l):"0",fill:Z,...p?{style:`animation: barGrow 0.6s ease-out ${(U*K.values.length+V)*.03}s both`}:{}})),d&&Y>14&&O.push(o("text",{key:`sval-${U}-${V}`,x:String(ee+P.barThickness/2),y:String(se+Y/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#fff"},String(j.value)))}else{let ee=c+H,se=c+te;O.push(o("rect",{key:`sbar-${U}-${V}`,x:String(ee),y:String(se),width:String(Y),height:String(P.barThickness),rx:V===K.values.length-1?String(l):"0",ry:V===K.values.length-1?String(l):"0",fill:Z,...p?{style:`animation: barGrow 0.6s ease-out ${(U*K.values.length+V)*.03}s both`}:{}})),d&&Y>20&&O.push(o("text",{key:`sval-${U}-${V}`,x:String(ee+Y/2),y:String(se+P.barThickness/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#fff"},String(j.value)))}J+=j.value}if(d){let V=P.valueScale(J);x?O.push(o("text",{key:`stotal-${U}`,x:String(c+te+P.barThickness/2),y:String(c+b-V-6),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(J))):O.push(o("text",{key:`stotal-${U}`,x:String(c+V+6),y:String(c+te+P.barThickness/2+4),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(J)))}if(x){let V=c+te+P.barThickness/2,j=c+b+16;O.push(o("text",{key:`scat-${U}`,x:String(V),y:String(j),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${V}, ${j})`},K.label))}else O.push(o("text",{key:`scat-${U}`,x:String(c-6),y:String(c+te+P.barThickness/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},K.label))}return O},[f,P,l,d,p,x,c,b]),k=v(()=>{if(!f)return[];let O=M.length,U=[];for(let K=0;K<f.length;K++){let te=f[K],J=P.categoryScale(K),V=2,j=Math.max(1,(P.barThickness-V*(O-1))/O);for(let Y=0;Y<te.values.length;Y++){let H=te.values[Y],Z=M.indexOf(H.category),ee=Z*(j+V),se=P.valueScale(H.value),Q=zr(Z>=0?Z:Y,H.color);if(x){let le=c+J+ee,ce=c+b-se;U.push(o("rect",{key:`gbar-${K}-${Y}`,x:String(le),y:String(ce),width:String(j),height:String(se),rx:String(l),ry:String(l),fill:Q,...p?{style:`animation: barGrow 0.6s ease-out ${(K*O+Y)*.04}s both`}:{}})),d&&U.push(o("text",{key:`gval-${K}-${Y}`,x:String(le+j/2),y:String(ce-4),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#374151"},String(H.value)))}else{let le=c,ce=c+J+ee;U.push(o("rect",{key:`gbar-${K}-${Y}`,x:String(le),y:String(ce),width:String(se),height:String(j),rx:String(l),ry:String(l),fill:Q,...p?{style:`animation: barGrow 0.6s ease-out ${(K*O+Y)*.04}s both`}:{}})),d&&U.push(o("text",{key:`gval-${K}-${Y}`,x:String(le+se+4),y:String(ce+j/2+3),"text-anchor":"start","font-size":"9","font-family":"sans-serif",fill:"#374151"},String(H.value)))}}if(x){let Y=c+J+P.barThickness/2,H=c+b+16;U.push(o("text",{key:`gcat-${K}`,x:String(Y),y:String(H),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${Y}, ${H})`},te.label))}else U.push(o("text",{key:`gcat-${K}`,x:String(c-6),y:String(c+J+P.barThickness/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},te.label))}return U},[f,M,P,l,d,p,x,c,b]),w=v(()=>m?[o("text",{key:"title",x:String(n/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,n,c]),E=v(()=>p?[o("defs",{key:"anim-defs"},o("style",{key:"anim-style"},x?"@keyframes barGrow { from { transform: scaleY(0); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }":"@keyframes barGrow { from { transform: scaleX(0); transform-origin: left; } to { transform: scaleX(1); transform-origin: left; } }"))]:[],[p,x]),C=B(),N=I(),T=w(),W=E(),_;return z&&y?_=k():z?_=A():_=F(),o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",style:{fontFamily:"sans-serif"}},...W,...T,...C,...N,..._)}function xt(e){let{start:t,end:n,step:r}=e;if(r<=0||!isFinite(r))return[];let i=Math.ceil((n-t)/r)+1;if(i>1e6)return[];let s=[];for(let a=0;a<i;a++){let l=t+a*r;if(l>n+r*.001)break;s.push(l)}return s}function jt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],s=e(i);isFinite(s)&&n.push({input:i,output:s})}return n}function Gt(e,t,n,r){let i=!1,s=0,a=[],l=()=>{if(i)return;let d=Math.min(s+n,t.length);for(let u=s;u<d;u++){let h=t[u],m=e(h);isFinite(m)&&a.push({input:h,output:m})}if(s=d,s>=t.length){r(a,!0);return}r(a,!1),Lr(l)};return Lr(l),()=>{i=!0}}function Lr(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e(),{timeout:16}):setTimeout(e,0)}function $l(e,t){let n=e/t,r=Math.pow(10,Math.floor(Math.log10(n))),i=n/r;return(i<1.5?1:i<3?2:i<7?5:10)*r}function Br(e,t){let n=t-e;if(n<=0)return[e];let r=$l(n,8),i=Math.ceil(e/r)*r,s=[];for(let a=i;a<=t+r*.001;a+=r)s.push(Math.round(a*1e10)/1e10);return s}function Fr(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}var Pe=40,Nr=1.1,Wr=.01,_r=1e6;function Or(e){let{width:t=400,height:n=300,points:r=[],plotFunction:i,plotResolution:s=200,xStep:a,sync:l=!1,xRange:d=[-5,5],yRange:u=[-5,5],showGrid:h=!0,showAxes:m=!0,pointRadius:c=3,pointColor:p="#3b82f6",curveColor:f="#3b82f6",gridColor:y="#e2e8f0",axisColor:x="#94a3b8",onPointClick:g,onPointDoubleClick:b,onPointContextMenu:S,onPointHover:D}=e,[z,M]=G(d[0]),[$,L]=G(d[1]),[R,P]=G(u[0]),[B,I]=G(u[1]),F=oe(!1),A=oe(null),k=v(H=>Pe+(H-z)/($-z)*(t-2*Pe),[z,$,t]),w=v(H=>n-Pe-(H-R)/(B-R)*(n-2*Pe),[R,B,n]),E=v(H=>z+(H-Pe)/(t-2*Pe)*($-z),[z,$,t]),C=v(H=>R+(n-Pe-H)/(n-2*Pe)*(B-R),[R,B,n]),N=v(H=>{let Z=H;F.current=!0,A.current={mx:Z.clientX,my:Z.clientY,x0:z,x1:$,y0:R,y1:B}},[z,$,R,B]),T=v(H=>{if(!F.current||!A.current)return;let Z=H,ee=A.current,se=Z.clientX-ee.mx,Q=Z.clientY-ee.my,le=se/(t-2*Pe)*(ee.x1-ee.x0),ce=Q/(n-2*Pe)*(ee.y1-ee.y0);M(ee.x0-le),L(ee.x1-le),P(ee.y0+ce),I(ee.y1+ce)},[t,n]),W=v(()=>{F.current=!1,A.current=null},[]),_=v(H=>{let Z=H;Z.preventDefault();let ee=Z.currentTarget.getBoundingClientRect(),se=Z.clientX-ee.left,Q=Z.clientY-ee.top,le=E(se),ce=C(Q),ue=Z.deltaY>0?Nr:1/Nr,re=($-z)*ue,ge=(B-R)*ue;if(re<Wr||ge<Wr||re>_r||ge>_r)return;let me=(le-z)/($-z),ne=(ce-R)/(B-R);M(le-me*re),L(le+(1-me)*re),P(ce-ne*ge),I(ce+(1-ne)*ge)},[z,$,R,B,E,C]),O=[];if(O.push(o("rect",{x:0,y:0,width:t,height:n,fill:"white",key:"bg"})),h){let H=Br(z,$),Z=Br(R,B);for(let ee=0;ee<H.length;ee++){let se=k(H[ee]);O.push(o("line",{x1:se,y1:Pe,x2:se,y2:n-Pe,stroke:y,"stroke-width":.5,key:`gx-${ee}`})),O.push(o("text",{x:se,y:n-Pe+14,"text-anchor":"end","font-size":10,fill:x,transform:`rotate(-45, ${se}, ${n-Pe+14})`,key:`lx-${ee}`},Fr(H[ee])))}for(let ee=0;ee<Z.length;ee++){let se=w(Z[ee]);O.push(o("line",{x1:Pe,y1:se,x2:t-Pe,y2:se,stroke:y,"stroke-width":.5,key:`gy-${ee}`})),O.push(o("text",{x:Pe-6,y:se+3,"text-anchor":"end","font-size":10,fill:x,key:`ly-${ee}`},Fr(Z[ee])))}}if(m){let H=Math.max(Pe,Math.min(t-Pe,k(0))),Z=Math.max(Pe,Math.min(n-Pe,w(0)));O.push(o("line",{x1:Pe,y1:Z,x2:t-Pe,y2:Z,stroke:x,"stroke-width":1,key:"x-axis"})),O.push(o("line",{x1:H,y1:Pe,x2:H,y2:n-Pe,stroke:x,"stroke-width":1,key:"y-axis"}))}let U=q(()=>{if(!i||!l)return[];let H=a??($-z)/s,Z=xt({start:z,end:$,step:H});return jt(i,Z)},[i,z,$,a,s,l]),[K,te]=G([]),J=oe(null);ae(()=>{if(!i||l){te([]);return}let H=a??($-z)/s,Z=xt({start:z,end:$,step:H});return J.current&&J.current(),J.current=Gt(i,Z,200,ee=>{te([...ee])}),()=>{J.current&&J.current()}},[i,z,$,a,s,l]);let V=l?U:K;if(V.length>0){let H=[];for(let Z=0;Z<V.length;Z++){let ee=V[Z],se=k(ee.input),Q=w(ee.output);H.push(`${H.length===0?"M":"L"}${se},${Q}`)}O.push(o("path",{d:H.join(" "),fill:"none",stroke:f,"stroke-width":1.5,key:"curve"}))}let j=(H,Z,ee,se)=>{if(Z)return Q=>Z({x:se.x,y:se.y,index:ee,event:Q})};for(let H=0;H<r.length;H++){let Z=r[H],ee=k(Z.x),se=w(Z.y),Q={cx:ee,cy:se,r:c,fill:p,cursor:"pointer",key:`pt-${H}`};g&&(Q.onClick=j("click",g,H,Z)),b&&(Q.onDblClick=j("dblclick",b,H,Z)),S&&(Q.onContextMenu=j("contextmenu",S,H,Z)),D&&(Q.onMouseOver=j("mouseover",D,H,Z)),O.push(o("circle",Q))}let Y=o("defs",{key:"defs"},o("clipPath",{id:"plot-clip"},o("rect",{x:Pe,y:Pe,width:t-2*Pe,height:n-2*Pe})));return o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",style:"user-select: none; touch-action: none;",onMouseDown:N,onMouseMove:T,onMouseUp:W,onMouseLeave:W,onWheel:_},Y,...O)}function Yr(e,t,n){let r=0,i=0;for(let s=0;s<n;s++){let a=r*r,l=i*i;if(a+l>4)return s;i=2*r*i+t,r=a-l+e}return n}function Hr(e,t,n){if(e===t)return[0,0,0];let r=e/t;if(n==="fire")return[Math.floor(255*Math.min(1,r*3)),Math.floor(255*Math.max(0,r*3-1)),Math.floor(255*Math.max(0,r*3-2))];if(n==="ocean")return[Math.floor(255*r*.3),Math.floor(255*r*.6),Math.floor(255*(.4+r*.6))];let i=r*360%360,s=1,a=.5,l=(1-Math.abs(2*a-1))*s,d=l*(1-Math.abs(i/60%2-1)),u=a-l/2,h=0,m=0,c=0;return i<60?(h=l,m=d):i<120?(h=d,m=l):i<180?(m=l,c=d):i<240?(m=d,c=l):i<300?(h=d,c=l):(h=l,c=d),[Math.floor((h+u)*255),Math.floor((m+u)*255),Math.floor((c+u)*255)]}function Vr(e,t,n=[-2.5,1],r=[-1.25,1.25],i=80,s=Yr){let a=[];for(let l=0;l<t;l++){let d=[],u=r[1]-l/t*(r[1]-r[0]);for(let h=0;h<e;h++){let m=n[0]+h/e*(n[1]-n[0]);d.push(s(m,u,i))}a.push(d)}return a}function Ur(e){let{width:t=400,height:n=300,realRange:r=[-2.5,1],imagRange:i=[-1.25,1.25],maxIterations:s=100,colorScheme:a="classic",computeFunction:l=Yr,data:d,resolution:u=2,onPointClick:h,onPointHover:m,onPointDoubleClick:c,onPointContextMenu:p}=e;if(d){let C=d.length,N=C>0?d[0].length:0,T=N>0?t/N:1,W=C>0?n/C:1,_=[];for(let O=0;O<C;O++){let U=d[O];for(let K=0;K<N;K++){let te=U[K]??0,[J,V,j]=Hr(te,s,a);_.push(o("rect",{key:`${O}-${K}`,x:String(K*T),y:String(O*W),width:String(Math.ceil(T)),height:String(Math.ceil(W)),fill:`rgb(${J},${V},${j})`}))}}return o("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Complex plane visualization",style:{cursor:"crosshair",borderRadius:"6px",maxWidth:"100%"}},..._)}let[f,y]=G(r[0]),[x,g]=G(r[1]),[b,S]=G(i[0]),[D,z]=G(i[1]),M=oe(null),$=oe(!1),L=oe(null),R=v((C,N)=>{let T=f+C/t*(x-f),W=D-N/n*(D-b);return{re:T,im:W}},[f,x,b,D,t,n]);ae(()=>{let C=M.current;if(!C)return;let N=C.getContext("2d");if(!N)return;let T=N.createImageData(t,n),W=T.data;for(let _=0;_<n;_++)for(let O=0;O<t;O++){let{re:U,im:K}=R(O,_),te=l(U,K,s),[J,V,j]=Hr(te,s,a),Y=(_*t+O)*4;W[Y]=J,W[Y+1]=V,W[Y+2]=j,W[Y+3]=255}N.putImageData(T,0,0)},[f,x,b,D,t,n,s,a,l,R]);let P=v(C=>{let N=C.target.getBoundingClientRect(),T=C.clientX-N.left,W=C.clientY-N.top,{re:_,im:O}=R(T,W),U=l(_,O,s);return{re:_,im:O,iterations:U,event:C}},[R,l,s]),B=v(C=>{$.current=!0,L.current={x:C.clientX,y:C.clientY,rMin:f,rMax:x,iMin:b,iMax:D}},[f,x,b,D]),I=v(C=>{if(m&&m(P(C)),!$.current||!L.current)return;let N=L.current,T=C.clientX-N.x,W=C.clientY-N.y,_=(N.rMax-N.rMin)/t,O=(N.iMax-N.iMin)/n;y(N.rMin-T*_),g(N.rMax-T*_),S(N.iMin+W*O),z(N.iMax+W*O)},[t,n,m,P]),F=v(()=>{$.current=!1},[]),A=v(C=>{C.preventDefault();let N=C.deltaY>0?1.15:1/1.15,T=C.target.getBoundingClientRect(),W=C.clientX-T.left,_=C.clientY-T.top,{re:O,im:U}=R(W,_);y(O+(f-O)*N),g(O+(x-O)*N),S(U+(b-U)*N),z(U+(D-U)*N)},[R,f,x,b,D]),k=v(C=>{h&&h(P(C))},[h,P]),w=v(C=>{c&&c(P(C))},[c,P]),E=v(C=>{C.preventDefault(),p&&p(P(C))},[p,P]);return o("canvas",{ref:M,width:t,height:n,style:{cursor:"crosshair"},onMouseDown:B,onMouseMove:I,onMouseUp:F,onMouseLeave:F,onWheel:A,onClick:k,onDblClick:w,onContextMenu:E})}function jr(e,t,n){if(e===t)return[e];let r=(t-e)/(n-1),i=[];for(let s=0;s<n;s++){let a=e+r*s;i.push(Math.round(a*1e10)/1e10)}return i}function Tl(e,t,n,r){if(e.length===0)return{xScale:()=>r,yScale:()=>n-r,xTicks:[],yTicks:[],xMin:0,xMax:0,yMin:0,yMax:0};let i=1/0,s=-1/0,a=1/0,l=-1/0;for(let y of e)y.x<i&&(i=y.x),y.x>s&&(s=y.x),y.y<a&&(a=y.y),y.y>l&&(l=y.y);i===s&&(i-=1,s+=1),a===l&&(a-=1,l+=1);let d=t-r*2,u=n-r*2,h=y=>r+(y-i)/(s-i)*d,m=y=>n-r-(y-a)/(l-a)*u,c=6,p=jr(i,s,c),f=jr(a,l,c);return{xScale:h,yScale:m,xTicks:p,yTicks:f,xMin:i,xMax:s,yMin:a,yMax:l}}function wn(e,t,n,r){return q(()=>Tl(e,t,n,r),[e,t,n,r])}function Gr(e){return Number.isInteger(e)?String(e):e.toFixed(1)}function Xr(e,t,n,r,i,s,a){let l={fill:i,key:s,...a};switch(e){case"square":return o("rect",{...l,x:t-r,y:n-r,width:r*2,height:r*2});case"diamond":{let d=`${t},${n-r} ${t+r},${n} ${t},${n+r} ${t-r},${n}`;return o("polygon",{...l,points:d})}case"triangle":{let d=r*1.15,u=`${t},${n-d} ${t+r},${n+r*.6} ${t-r},${n+r*.6}`;return o("polygon",{...l,points:u})}case"triangle-down":{let d=r*1.15,u=`${t-r},${n-r*.6} ${t+r},${n-r*.6} ${t},${n+d}`;return o("polygon",{...l,points:u})}case"cross":{let d=r*.35;return o("path",{...l,fill:"none",stroke:i,"stroke-width":String(d*2),"stroke-linecap":"round",d:`M${t-r},${n-r}L${t+r},${n+r}M${t+r},${n-r}L${t-r},${n+r}`})}case"plus":{let d=r*.35;return o("path",{...l,fill:"none",stroke:i,"stroke-width":String(d*2),"stroke-linecap":"round",d:`M${t},${n-r}L${t},${n+r}M${t-r},${n}L${t+r},${n}`})}case"circle":default:return o("circle",{...l,cx:t,cy:n,r})}}function qr(e){let{data:t,width:n=600,height:r=400,lineColor:i="#3b82f6",lineWidth:s=2,pointRadius:a=4,pointColor:l="#3b82f6",pointShape:d="circle",showPoints:u=!0,showGrid:h=!0,showArea:m=!1,areaColor:c="rgba(59,130,246,0.15)",xLabel:p,yLabel:f,title:y,padding:x=50,animate:g=!1,multiLine:b}=e,S=q(()=>{let B=[...t];if(b)for(let I of b)B.push(...I.data);return B},[t,b]),D=wn(S,n,r,x),{xScale:z,yScale:M,xTicks:$,yTicks:L}=D,R=[];if(R.push(o("rect",{x:0,y:0,width:"100%",fill:"white",key:"bg"})),h){for(let B=0;B<$.length;B++){let I=z($[B]);R.push(o("line",{x1:I,y1:x,x2:I,y2:r-x,stroke:"#e5e7eb","stroke-dasharray":"4,4",key:`grid-x-${B}`}))}for(let B=0;B<L.length;B++){let I=M(L[B]);R.push(o("line",{x1:x,y1:I,x2:n-x,y2:I,stroke:"#e5e7eb","stroke-dasharray":"4,4",key:`grid-y-${B}`}))}}R.push(o("line",{x1:x,y1:r-x,x2:n-x,y2:r-x,stroke:"#374151","stroke-width":1,key:"x-axis"})),R.push(o("line",{x1:x,y1:x,x2:x,y2:r-x,stroke:"#374151","stroke-width":1,key:"y-axis"}));for(let B=0;B<$.length;B++){let I=z($[B]);R.push(o("line",{x1:I,y1:r-x,x2:I,y2:r-x+5,stroke:"#374151",key:`xtick-${B}`})),R.push(o("text",{x:I,y:r-x+18,"text-anchor":"end","font-size":11,fill:"#6b7280",transform:`rotate(-45, ${I}, ${r-x+18})`,key:`xlabel-${B}`},Gr($[B])))}for(let B=0;B<L.length;B++){let I=M(L[B]);R.push(o("line",{x1:x-5,y1:I,x2:x,y2:I,stroke:"#374151",key:`ytick-${B}`})),R.push(o("text",{x:x-10,y:I+4,"text-anchor":"end","font-size":11,fill:"#6b7280",key:`ylabel-${B}`},Gr(L[B])))}function P(B,I,F,A,k,w,E,C,N,T){if(B.length===0)return;let W=[...B].sort((U,K)=>U.x-K.x);if(A){let U=M(D.yMin),K=W.map(j=>`${z(j.x)},${M(j.y)}`).join(" "),te=z(W[0].x),J=z(W[W.length-1].x),V=`${te},${U} ${K} ${J},${U}`;R.push(o("polygon",{points:V,fill:k,key:`${T}-area`}))}let O={points:W.map(U=>`${z(U.x)},${M(U.y)}`).join(" "),fill:"none",stroke:I,"stroke-width":F,"stroke-linejoin":"round","stroke-linecap":"round",key:`${T}-line`};if(g?(O["stroke-dasharray"]="1000",O["stroke-dashoffset"]="1000",R.push(o("polyline",O,o("animate",{attributeName:"stroke-dashoffset",from:1e3,to:0,dur:"1.5s",fill:"freeze"})))):R.push(o("polyline",O)),w)for(let U=0;U<W.length;U++){let K=z(W[U].x),te=M(W[U].y),J=W[U].shape??N,V=W[U].radius??C,j=`${T}-pt-${U}`;if(g){let Y=Xr(J,K,te,V,E,j,{opacity:0});R.push(o("g",{key:`${j}-g`},Y,o("animate",{attributeName:"opacity",from:0,to:1,dur:"0.3s",begin:"1.2s",fill:"freeze"})))}else R.push(Xr(J,K,te,V,E,j))}}if(P(t,i,s,m,c,u,l,a,d,"primary"),b)for(let B=0;B<b.length;B++){let I=b[B];P(I.data,I.color,s,!1,"transparent",u,I.color,I.pointRadius??a,I.pointShape??d,`series-${B}`)}if(b&&b.length>0){let B=[],I=[{color:i,label:"Primary"},...b.map((_,O)=>({color:_.color,label:_.label??`Series ${O+1}`}))],F=x+10,A=16,k=22,w=7.2,E=14,C=6,N=n-x*2-20,T=0,W=0;for(let _=0;_<I.length;_++){let O=I[_].label.length*w,U=E+C+O;T>0&&T+U>N&&(T=0,W+=k);let K=F+T,te=x-30-W;B.push(o("rect",{x:K,y:te,width:E,height:14,fill:I[_].color,rx:2,key:`legend-rect-${_}`})),B.push(o("text",{x:K+E+C,y:te+12,"font-size":12,fill:"#374151",key:`legend-text-${_}`},I[_].label)),T+=U+A}R.push(o("g",{key:"legend"},...B))}return p&&R.push(o("text",{x:n/2,y:r-8,"text-anchor":"middle","font-size":13,fill:"#374151",key:"x-axis-label"},p)),f&&R.push(o("text",{x:14,y:r/2,"text-anchor":"middle","font-size":13,fill:"#374151",transform:`rotate(-90, 14, ${r/2})`,key:"y-axis-label"},f)),y&&R.push(o("text",{x:n/2,y:20,"text-anchor":"middle","font-size":16,"font-weight":"bold",fill:"#111827",key:"title"},y)),o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet"},...R)}function Dl(e){let t=[];for(let n=0;n<e;n++){let r=Math.round(360*n/e);t.push(`hsl(${r}, 70%, 55%)`)}return t}function zl(e,t){let n=t??Dl(e.length);return e.map((r,i)=>r.color??n[i%n.length])}function yt(e,t,n,r){return{x:e+n*Math.cos(r),y:t+n*Math.sin(r)}}function kn(e,t,n,r,i,s){let a=i-Math.PI/2,l=s-Math.PI/2,d=yt(e,t,r,a),u=yt(e,t,r,l),h=s-i>Math.PI?1:0;if(n<=0)return[`M ${e} ${t}`,`L ${d.x} ${d.y}`,`A ${r} ${r} 0 ${h} 1 ${u.x} ${u.y}`,"Z"].join(" ");let m=yt(e,t,n,l),c=yt(e,t,n,a);return[`M ${d.x} ${d.y}`,`A ${r} ${r} 0 ${h} 1 ${u.x} ${u.y}`,`L ${m.x} ${m.y}`,`A ${n} ${n} 0 ${h} 0 ${c.x} ${c.y}`,"Z"].join(" ")}function Cn(e,t){let n=t?.padAngle??0,r=zl(e,t?.colors),i=e.reduce((u,h)=>u+h.value,0);if(i<=0)return[];let s=n*e.length,a=Math.PI*2-s,l=[],d=0;for(let u=0;u<e.length;u++){let h=e[u],m=h.value/i*a,c=d+n/2,p=c+m;l.push({label:h.label,value:h.value,startAngle:c,endAngle:p,percentage:h.value/i*100,color:r[u]}),d=p+n/2}return l}function Kr(e){let{data:t,width:n=400,height:r=400,innerRadius:i=0,padAngle:s=.02,showLabels:a=!0,showValues:l=!0,showLegend:d=!0,legendPosition:u="right",title:h,centerLabel:m,colors:c,strokeColor:p="#fff",strokeWidth:f=2,textColor:y="currentColor"}=e,x=d&&u==="right"?140:0,g=h?30:0,b=d&&u==="bottom"?Math.ceil(t.length/2)*22+10:0,S=n-x,D=r-g-b,z=S/2,M=g+D/2,$=Math.min(S,D)/2-10,L=e.outerRadius??$,R=q(()=>Cn(t,{padAngle:s,colors:c}),[t,s,c]),P=[];h&&P.push(o("text",{key:"title",x:S/2,y:20,textAnchor:"middle",fontFamily:"sans-serif",fontSize:16,fontWeight:"bold",fill:y},h));for(let B=0;B<R.length;B++){let I=R[B],F=kn(z,M,i,L,I.startAngle,I.endAngle);if(P.push(o("path",{key:`slice-${B}`,d:F,fill:I.color,stroke:p,strokeWidth:f})),a||l){let A=(I.startAngle+I.endAngle)/2,k=I.percentage<5,w=k?L+14:i+(L-i)*.65,E=yt(z,M,w,A-Math.PI/2),C=k?y:"#fff",N=k?11:12,T=[];if(a&&T.push(I.label),l&&T.push(`${I.percentage.toFixed(1)}%`),k){let W=yt(z,M,L+2,A-Math.PI/2);P.push(o("line",{key:`connector-${B}`,x1:W.x,y1:W.y,x2:E.x,y2:E.y,stroke:"#999",strokeWidth:1}))}a&&P.push(o("text",{key:`label-${B}`,x:E.x,y:E.y-(l?6:0),textAnchor:"middle",fontFamily:"sans-serif",fontSize:N,fill:C,pointerEvents:"none"},I.label)),l&&P.push(o("text",{key:`value-${B}`,x:E.x,y:E.y+(a?10:0),textAnchor:"middle",fontFamily:"sans-serif",fontSize:N-1,fill:C,pointerEvents:"none"},`${I.percentage.toFixed(1)}%`))}}if(m&&i>0&&P.push(o("text",{key:"center-label",x:z,y:M,textAnchor:"middle",dominantBaseline:"central",fontFamily:"sans-serif",fontSize:14,fontWeight:"bold",fill:y},m)),d){let B=[];if(u==="right"){let I=S+10,F=g+20;for(let A=0;A<R.length;A++){let k=R[A],w=F+A*22;B.push(o("circle",{key:`legend-dot-${A}`,cx:I+6,cy:w,r:6,fill:k.color})),B.push(o("text",{key:`legend-text-${A}`,x:I+18,y:w,dominantBaseline:"central",fontFamily:"sans-serif",fontSize:12,fill:y},`${k.label} (${k.percentage.toFixed(1)}%)`))}}else{let I=r-b+10;for(let F=0;F<R.length;F++){let A=R[F],k=F%2,w=Math.floor(F/2),E=k*(n/2)+10,C=I+w*22;B.push(o("circle",{key:`legend-dot-${F}`,cx:E+6,cy:C,r:6,fill:A.color})),B.push(o("text",{key:`legend-text-${F}`,x:E+18,y:C,dominantBaseline:"central",fontFamily:"sans-serif",fontSize:12,fill:y},`${A.label} (${A.percentage.toFixed(1)}%)`))}}P.push(...B)}return o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet"},...P)}function Zr(e,t,n,r,i){return{x:n+e*Math.cos(t)*i,y:r-e*Math.sin(t)*i}}function Jr(e){let{width:t=400,height:n=400,rRange:r=[0,2],plotFunction:i,plotResolution:s=360,thetaStep:a,sync:l=!1,points:d=[],showGrid:u=!0,pointRadius:h=3,pointColor:m="#3b82f6",curveColor:c="#3b82f6",onPointClick:p,onPointDoubleClick:f,onPointContextMenu:y,onPointHover:x}=e,[g,b]=G(r[1]),[S,D]=G(0),[z,M]=G(0),[$,L]=G(null),R=t/2+S,P=n/2+z,I=Math.min(t,n)/2-30,F=I/g,A=q(()=>{let V=Math.max(1,Math.ceil(g)),j=[],Y=g/V;for(let H=1;H<=V;H++)j.push(Y*H);return j},[g]),k=q(()=>{let V=[];for(let j=0;j<360;j+=30)V.push(j*Math.PI/180);return V},[]),w=q(()=>{if(!i||!l)return[];let V=a??2*Math.PI/s,j=xt({start:0,end:2*Math.PI,step:V});return jt(i,j)},[i,s,a,l]),[E,C]=G([]),N=oe(null);ae(()=>{if(!i||l){C([]);return}let V=a??2*Math.PI/s,j=xt({start:0,end:2*Math.PI,step:V});return N.current&&N.current(),N.current=Gt(i,j,200,Y=>{C([...Y])}),()=>{N.current&&N.current()}},[i,s,a,l]);let T=l?w:E,W=q(()=>{if(T.length===0)return"";let V=[];for(let j=0;j<T.length;j++){let Y=T[j],H=Y.output;if(H<0||!isFinite(H))continue;let{x:Z,y:ee}=Zr(H,Y.input,R,P,F);V.push(`${V.length===0?"M":"L"}${Z.toFixed(2)},${ee.toFixed(2)}`)}return V.join(" ")},[T,R,P,F]),_=v(V=>{L({x:V.clientX,y:V.clientY,px:S,py:z})},[S,z]),O=v(V=>{$&&(D($.px+(V.clientX-$.x)),M($.py+(V.clientY-$.y)))},[$]),U=v(()=>{L(null)},[]),K=v(V=>{V.preventDefault();let j=V.deltaY>0?1.15:1/1.15;b(Math.max(.1,g*j))},[g]),te=v((V,j,Y)=>{if(V)return H=>V({r:j.r,theta:j.theta,index:Y,event:H})},[]),J=[];if(J.push(o("rect",{x:0,y:0,width:t,height:n,fill:"white",key:"bg"})),u){for(let V=0;V<A.length;V++){let j=A[V]*F;J.push(o("circle",{cx:R,cy:P,r:j,fill:"none",stroke:"#e5e7eb","stroke-width":1,key:`gc-${V}`})),J.push(o("text",{x:R+j+2,y:P-4,"font-size":10,fill:"#9ca3af",key:`gl-${V}`},A[V].toFixed(1)))}for(let V=0;V<k.length;V++){let j=k[V],Y=A[A.length-1]*F,H=R+Y*Math.cos(j),Z=P-Y*Math.sin(j);J.push(o("line",{x1:R,y1:P,x2:H,y2:Z,stroke:"#e5e7eb","stroke-width":1,key:`al-${V}`}));let ee=Math.round(j*180/Math.PI),se=R+(Y+14)*Math.cos(j),Q=P-(Y+14)*Math.sin(j);J.push(o("text",{x:se,y:Q+4,"text-anchor":"middle","font-size":10,fill:"#9ca3af",key:`at-${V}`},`${ee}\xB0`))}}J.push(o("line",{x1:R-I,y1:P,x2:R+I,y2:P,stroke:"#d1d5db","stroke-width":1,key:"x-axis"})),J.push(o("line",{x1:R,y1:P-I,x2:R,y2:P+I,stroke:"#d1d5db","stroke-width":1,key:"y-axis"})),W&&J.push(o("path",{d:W,fill:"none",stroke:c,"stroke-width":2,key:"curve"}));for(let V=0;V<d.length;V++){let j=d[V],{x:Y,y:H}=Zr(j.r,j.theta,R,P,F);J.push(o("circle",{cx:Y,cy:H,r:h,fill:m,key:`pt-${V}`,style:{cursor:"pointer"},onClick:te(p,j,V),onDblClick:te(f,j,V),onContextMenu:te(y,j,V),onMouseEnter:te(x,j,V)}))}return o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",style:{cursor:$?"grabbing":"grab"},onMouseDown:_,onMouseMove:O,onMouseUp:U,onMouseLeave:U,onWheel:K},...J)}function Mn(e){let t=1<<e,n=[];for(let r=0;r<t;r++){let i=[];for(let s=0;s<e;s++)i.push((r>>s&1)*2-1);n.push({coords:i})}return n}function En(e){let t=1<<e,n=[];for(let r=0;r<t;r++)for(let i=0;i<e;i++){let s=r^1<<i;s>r&&n.push({source:r,target:s})}return n}function In(e,t){let n=Qr(e),r=0;for(let i=0;i<e;i++)for(let s=i+1;s<e;s++){if(r<t.length){let a=t[r];n=Ll(n,Al(e,i,s,a))}r++}return n}function Qr(e){let t=[];for(let n=0;n<e;n++){let r=new Array(e).fill(0);r[n]=1,t.push(r)}return t}function Al(e,t,n,r){let i=Qr(e),s=Math.cos(r),a=Math.sin(r);return i[t][t]=s,i[t][n]=-a,i[n][t]=a,i[n][n]=s,i}function Ll(e,t){let n=e.length,r=[];for(let i=0;i<n;i++){let s=new Array(n).fill(0);for(let a=0;a<n;a++)for(let l=0;l<n;l++)s[a]+=e[i][l]*t[l][a];r.push(s)}return r}function Rn(e,t){let n=e.length,r=new Array(n).fill(0);for(let i=0;i<n;i++)for(let s=0;s<n;s++)r[i]+=e[i][s]*t.coords[s];return r}function Pn(e,t=0){let n=e[0]??0,r=e[1]??0,i=0;for(let s=2;s<e.length;s++)i+=e[s]??0;if(e.length>2&&(i/=e.length-2),t>0){let s=1/(1+t*(i+2));return{x:n*s,y:r*s,depth:i}}return{x:n,y:r,depth:i}}function It(e,t=[],n=.3,r=1){let i=Mn(e),s=En(e),a=In(e,t);return{vertices:i.map((d,u)=>{let h=Rn(a,d),m=Pn(h,n);return{id:u,position:d,x:m.x*r,y:m.y*r,depth:m.depth}}),edges:s,dimension:e}}function Rt(e){return e*(e-1)/2}function Xt(e,t=70,n=55){let r=[];for(let i=0;i<e;i++){let s=Math.round(360*i/e);r.push(`hsl(${s}, ${t}%, ${n}%)`)}return r}function ei(e){let t=e.dimension??4,n=e.width??600,r=e.height??600,i=e.vertexRadius??10,s=e.edgeWidth??3,a=e.edgeColor??"#111",l=e.perspective??.25,d=e.rotationSpeed??.008,u=e.showLabels??!1,h=e.backgroundColor??"transparent",m=e.scale??Math.min(n,r)*.3,c=Rt(t),p=1<<t,f=q(()=>e.vertexColors==="auto"||e.vertexColors===void 0?Xt(p):e.vertexColors,[p,e.vertexColors]),[y,x]=G(()=>{let C=[];for(let N=0;N<c;N++)C.push(0);return C}),[g,b]=G(!1),S=oe({x:0,y:0}),D=oe([]),z=oe(0);ae(()=>{if(d===0)return;let C=!0,N=()=>{C&&(x(T=>{let W=T.slice();for(let _=0;_<W.length;_++)W[_]=(W[_]??0)+d*(1+_*.3);return W}),z.current=requestAnimationFrame(N))};return z.current=requestAnimationFrame(N),()=>{C=!1,cancelAnimationFrame(z.current)}},[d]);let M=q(()=>It(t,y,l,m),[t,y,l,m]),$=n/2,L=r/2,R=q(()=>M.edges.map(C=>{let N=M.vertices[C.source],T=M.vertices[C.target],W=(N.depth+T.depth)/2;return{...C,avgDepth:W,sv:N,tv:T}}).sort((C,N)=>C.avgDepth-N.avgDepth),[M]),P=q(()=>M.vertices.slice().sort((C,N)=>C.depth-N.depth),[M]),B=v(C=>{let N=C;b(!0),S.current={x:N.clientX,y:N.clientY},D.current=y.slice()},[y]),I=v(C=>{if(!g)return;let N=C,T=(N.clientX-S.current.x)*.01,W=(N.clientY-S.current.y)*.01;x(()=>{let _=D.current.slice();return _.length>0&&(_[0]=(_[0]??0)+T),_.length>1&&(_[1]=(_[1]??0)+W),_})},[g]),F=v(()=>{b(!1)},[]),A=C=>{let N=(C+2)/4;return .3+.7*Math.max(0,Math.min(1,N))},k=C=>{let N=(C+2)/4;return .6+.4*Math.max(0,Math.min(1,N))},w=R.map((C,N)=>{let T=A(C.avgDepth);return o("line",{key:`e-${C.source}-${C.target}`,x1:String($+C.sv.x),y1:String(L+C.sv.y),x2:String($+C.tv.x),y2:String(L+C.tv.y),stroke:a,"stroke-width":String(s),"stroke-opacity":String(T),"stroke-linecap":"round"})}),E=P.map(C=>{let N=i*k(C.depth),T=f[C.id%f.length]??"#3b82f6",W=[o("circle",{key:`v-${C.id}-circle`,cx:String($+C.x),cy:String(L+C.y),r:String(N),fill:T,stroke:"#000","stroke-width":"1.5",style:{filter:"drop-shadow(0 1px 2px rgba(0,0,0,0.3))"}})];return u&&W.push(o("text",{key:`v-${C.id}-label`,x:String($+C.x),y:String(L+C.y+N+14),"text-anchor":"middle","font-size":"11","font-family":"monospace",fill:"#555"},C.id.toString(2).padStart(t,"0"))),W});return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",style:{backgroundColor:h,cursor:g?"grabbing":"grab",userSelect:"none"},onMouseDown:B,onMouseMove:I,onMouseUp:F,onMouseLeave:F},...w,...E.flat())}function ti(e={}){let t=e.dimension??4,n=e.rotationSpeed??.008,r=e.perspective??.25,i=e.scale??200,s=Rt(t),[a,l]=G(()=>new Array(s).fill(0));return ae(()=>{if(n===0)return;let u=!0,h=0,m=()=>{u&&(l(c=>c.map((p,f)=>p+n*(1+f*.3))),h=requestAnimationFrame(m))};return h=requestAnimationFrame(m),()=>{u=!1,cancelAnimationFrame(h)}},[n]),{data:q(()=>It(t,a,r,i),[t,a,r,i]),angles:a,setAngles:l}}function ni(e){let t=e.titlePosition??"top",n=e.legendPosition??"bottom",r=e.titleAlign??"center",i=e.legendAlign??"center",s=e.gap??"12px",a=e.contain??"layout style paint",l={display:"flex",flexDirection:Bl(t,n),gap:s,width:typeof e.width=="number"?`${e.width}px`:e.width??"auto",height:typeof e.height=="number"?`${e.height}px`:e.height??"auto",backgroundColor:e.backgroundColor??"#ffffff",border:e.border??"1px solid #e5e7eb",borderRadius:e.borderRadius??"8px",padding:e.padding??"16px",fontFamily:e.fontFamily??"inherit",contain:a,overflow:"hidden",position:"relative",boxSizing:"border-box",...e.boxShadow?{boxShadow:e.boxShadow}:{},...e.style??{}},d=e.title?o("div",{className:"viz-title",style:{fontSize:e.titleFontSize??"16px",fontWeight:e.titleFontWeight??"600",color:e.titleColor??"#1f2937",textAlign:r,flexShrink:"0"}},e.title):null,u=e.legend&&e.legend.length>0?Nl(e.legend,{align:i,fontSize:e.legendFontSize??"12px",gap:e.legendGap??16,direction:n==="left"||n==="right"?"column":"row"}):null,h=o("div",{className:"viz-content",style:{flex:"1",minWidth:"0",minHeight:"0",position:"relative",display:"flex",alignItems:"center",justifyContent:"center"}},e.children),m=Fl(d,h,u,t,n);return o("div",{className:`viz-wrapper ${e.className??""}`.trim(),style:l},...m)}function Bl(e,t){return"column"}function Fl(e,t,n,r,i){let s=[];if(r==="top"&&e&&s.push(e),i==="left"||i==="right"){let a=[];i==="left"&&n&&a.push(n),r==="left"&&e&&a.push(e),a.push(t),r==="right"&&e&&a.push(e),i==="right"&&n&&a.push(n),s.push(o("div",{style:{display:"flex",flexDirection:"row",flex:"1",gap:"12px",minHeight:"0",alignItems:"stretch"}},...a))}else if(r==="left"||r==="right"){i==="top"&&n&&s.push(n);let a=[];r==="left"&&e&&a.push(e),a.push(t),r==="right"&&e&&a.push(e),s.push(o("div",{style:{display:"flex",flexDirection:"row",flex:"1",gap:"12px",minHeight:"0",alignItems:"center"}},...a)),i==="bottom"&&n&&s.push(n)}else i==="top"&&n&&s.push(n),s.push(t),i==="bottom"&&n&&s.push(n);return r==="bottom"&&e&&s.push(e),s}function Nl(e,t){return o("div",{className:"viz-legend",style:{display:"flex",flexDirection:t.direction,flexWrap:"wrap",gap:`${t.gap}px`,justifyContent:t.align,alignItems:"center",fontSize:t.fontSize,color:"#6b7280",flexShrink:"0"}},...e.map((n,r)=>o("div",{key:`legend-${r}`,style:{display:"flex",alignItems:"center",gap:"6px"}},Wl(n),o("span",null,n.label))))}function Wl(e){let t=e.shape??"circle";return t==="line"?o("svg",{width:"20",height:"12",viewBox:"0 0 20 12"},o("line",{x1:"0",y1:"6",x2:"20",y2:"6",stroke:e.color,"stroke-width":"2","stroke-dasharray":e.dash??""})):t==="square"?o("div",{style:{width:"12px",height:"12px",backgroundColor:e.color,borderRadius:"2px",flexShrink:"0"}}):o("div",{style:{width:"10px",height:"10px",backgroundColor:e.color,borderRadius:"50%",flexShrink:"0"}})}function _l(e){if(typeof document>"u")return;let t="specifyjs-gtag";if(document.getElementById(t))return;let n=document.createElement("script");n.id=t,n.async=!0,n.src=`https://www.googletagmanager.com/gtag/js?id=${encodeURIComponent(e)}`,document.head.appendChild(n)}function Ol(){typeof window>"u"||(window.dataLayer=window.dataLayer||[],window.gtag||(window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date)))}function oi(e){let{measurementId:t,disabled:n=!1,debug:r=!1,anonymizeIp:i=!1,config:s}=e;return ae(()=>{if(n||typeof window>"u")return;_l(t),Ol();let a={...s};return i&&(a.anonymize_ip=!0),r&&(a.debug_mode=!0),window.gtag&&window.gtag("config",t,a),()=>{let l=document.getElementById("specifyjs-gtag");l&&l.remove()}},[t,n,r,i]),null}function ri(e){let{left:t,center:n,right:r,borderTop:i="1px solid var(--color-border, #e2e8f0)",background:s="var(--color-bg, transparent)",color:a="var(--color-text-muted, #64748b)",fontSize:l="13px",padding:d="24px",maxWidth:u="1200px",className:h,ariaLabel:m="Site footer"}=e;return o("footer",{className:h,role:"contentinfo","aria-label":m,style:{borderTop:i,background:s,color:a,fontSize:l,padding:d,marginTop:"48px"}},o("div",{className:"footer-inner",style:{maxWidth:u,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:"12px"}},o("div",{className:"footer-section",style:{flex:"1",textAlign:"left",minWidth:"150px"}},t??null),o("div",{className:"footer-section",style:{flex:"1",textAlign:"center",minWidth:"150px"}},n??null),o("div",{className:"footer-section",style:{flex:"1",textAlign:"right",minWidth:"150px"}},r??null)))}var ai=He({windows:[],openWindow:()=>{},closeWindow:()=>{},focusWindow:()=>{},minimizeWindow:()=>{},maximizeWindow:()=>{},restoreWindow:()=>{},moveWindow:()=>{},resizeWindow:()=>{},tileWindows:()=>{},cascadeWindows:()=>{},minimizeAll:()=>{},focusedWindowId:null,setMenuBar:()=>{},clearMenuBar:()=>{},activeMenuBar:null,signalDock:()=>{},dockSignals:new Map}),Hl={width:600,height:400},Yl={x:30,y:30},Vl={top:0,left:0,width:1920,height:1080},$n=1e3;function ii(e,t,n,r){let i=n.left+e*t.x,s=n.top+e*t.y,a=n.left+n.width-r.width,l=n.top+n.height-r.height;return a>n.left&&i>a&&(i=n.left+(i-n.left)%Math.max(1,a-n.left)),l>n.top&&s>l&&(s=n.top+(s-n.top)%Math.max(1,l-n.top)),{x:i,y:s}}function Tn(e){let t=[...e].sort((r,i)=>r.zIndex-i.zIndex),n=[];for(let r=0;r<t.length;r++)n.push({...t[r],zIndex:r+1});return n}function si(e,t){let n=null;for(let r=0;r<e.length;r++){let i=e[r];i.id!==t&&i.windowState!=="minimized"&&(n===null||i.zIndex>n.zIndex)&&(n=i)}return n}function Dn(e){let t=0;for(let n=0;n<e.length;n++)e[n].zIndex>t&&(t=e[n].zIndex);return t}function zn(e){let t=e.workspaceBounds??Vl,n=e.defaultWindowSize??Hl,r=e.cascadeOffset??Yl,[i,s]=G([]),a=v(((...B)=>{let I=B[0];s(F=>{if(F.find(W=>W.id===I.id)){let _=Dn(F)+1,O=F.map(U=>U.id===I.id?{...U,focused:!0,zIndex:_,windowState:U.windowState==="minimized"?"normal":U.windowState}:{...U,focused:!1});return _>$n&&(O=Tn(O)),O}let k=I.size??n,w=I.position??ii(F.length,r,t,k),C=Dn(F)+1,N={id:I.id,title:I.title,icon:I.icon,position:w,size:k,windowState:"normal",zIndex:C,focused:!0,appProps:I.appProps},T=F.map(W=>({...W,focused:!1}));return T.push(N),C>$n&&(T=Tn(T)),e.onWindowOpen&&e.onWindowOpen(I.id),e.onFocusChange&&e.onFocusChange(I.id),T})}),[n,r,t,e.onWindowOpen,e.onFocusChange]),l=v(((...B)=>{let I=B[0];S(F=>{if(F[I]){let A={...F};return delete A[I],A}return F}),z(F=>{if(F.has(I)){let A=new Map(F);return A.delete(I),A}return F}),s(F=>{let A=F.find(w=>w.id===I);if(!A)return F;let k=F.filter(w=>w.id!==I);if(A.focused&&k.length>0){let w=si(k,I);if(w){let E=k.map(C=>({...C,focused:C.id===w.id}));return e.onWindowClose&&e.onWindowClose(I),e.onFocusChange&&e.onFocusChange(w.id),E}}return e.onWindowClose&&e.onWindowClose(I),k.length===0&&e.onFocusChange&&e.onFocusChange(null),k})}),[e.onWindowClose,e.onFocusChange]),d=v(((...B)=>{let I=B[0];s(F=>{if(!F.find(C=>C.id===I))return F;let w=Dn(F)+1,E=F.map(C=>C.id===I?{...C,focused:!0,zIndex:w}:{...C,focused:!1});return w>$n&&(E=Tn(E)),e.onFocusChange&&e.onFocusChange(I),E})}),[e.onFocusChange]),u=v(((...B)=>{let I=B[0];s(F=>{let A=F.find(w=>w.id===I);if(!A)return F;let k=F.map(w=>w.id===I?{...w,windowState:"minimized",focused:!1}:w);if(A.focused){let w=si(k,I);w?(k=k.map(E=>({...E,focused:E.id===w.id})),e.onFocusChange&&e.onFocusChange(w.id)):e.onFocusChange&&e.onFocusChange(null)}return k})}),[e.onFocusChange]),h=v(((...B)=>{let I=B[0];s(F=>F.map(A=>A.id===I?{...A,windowState:"maximized"}:A))}),[]),m=v(((...B)=>{let I=B[0];s(F=>F.map(A=>A.id===I?{...A,windowState:"normal"}:A))}),[]),c=v(((...B)=>{let I=B[0],F=B[1];s(A=>A.map(k=>k.id===I?{...k,position:F}:k))}),[]),p=v(((...B)=>{let I=B[0],F=B[1];s(A=>A.map(k=>k.id===I?{...k,size:F}:k))}),[]),f=v(((...B)=>{s(I=>{let F=I.filter(w=>w.windowState!=="minimized");if(F.length===0)return I;let A=F.length,k=new Map;if(A===1)k.set(F[0].id,{position:{x:t.left,y:t.top},size:{width:t.width,height:t.height}});else if(A===2){let w=Math.floor(t.width/2);k.set(F[0].id,{position:{x:t.left,y:t.top},size:{width:w,height:t.height}}),k.set(F[1].id,{position:{x:t.left+w,y:t.top},size:{width:t.width-w,height:t.height}})}else if(A===3){let w=Math.floor(t.width/2),E=Math.floor(t.height/2);k.set(F[0].id,{position:{x:t.left,y:t.top},size:{width:w,height:t.height}}),k.set(F[1].id,{position:{x:t.left+w,y:t.top},size:{width:t.width-w,height:E}}),k.set(F[2].id,{position:{x:t.left+w,y:t.top+E},size:{width:t.width-w,height:t.height-E}})}else{let w=Math.ceil(Math.sqrt(A)),E=Math.ceil(A/w),C=Math.floor(t.width/w),N=Math.floor(t.height/E);for(let T=0;T<F.length;T++){let W=Math.floor(T/w),_=T%w;k.set(F[T].id,{position:{x:t.left+_*C,y:t.top+W*N},size:{width:C,height:N}})}}return I.map(w=>{let E=k.get(w.id);return E?{...w,position:E.position,size:E.size,windowState:"normal"}:w})})}),[t]),y=v(((...B)=>{s(I=>{let F=I.filter(w=>w.windowState!=="minimized");if(F.length===0)return I;let A=[...F].sort((w,E)=>w.zIndex-E.zIndex),k=new Map;for(let w=0;w<A.length;w++){let E=ii(w,r,t,A[w].size);k.set(A[w].id,{position:E,zIndex:w+1})}return I.map(w=>{let E=k.get(w.id);return E?{...w,position:E.position,zIndex:E.zIndex,windowState:"normal"}:w})})}),[r,t]),x=v(((...B)=>{s(I=>{let F=I.map(A=>({...A,windowState:"minimized",focused:!1}));return e.onFocusChange&&e.onFocusChange(null),F})}),[e.onFocusChange]),g=q(()=>{let B=i.find(I=>I.focused);return B?B.id:null},[i]),[b,S]=G({}),[D,z]=G(new Map),M=v(((...B)=>{let I=B[0],F=B[1];S(A=>({...A,[I]:F}))}),[]),$=v(((...B)=>{let I=B[0];S(F=>{let A={...F};return delete A[I],A})}),[]),L=q(()=>g&&b[g]?b[g]:null,[g,b]),R=v(((...B)=>{let I=B[0],F=B[1];z(A=>{let k=new Map(A),w=k.get(I);return k.set(I,{...w,...F}),k})}),[]),P=q(()=>({windows:i,openWindow:a,closeWindow:l,focusWindow:d,minimizeWindow:u,maximizeWindow:h,restoreWindow:m,moveWindow:c,resizeWindow:p,tileWindows:f,cascadeWindows:y,minimizeAll:x,focusedWindowId:g,setMenuBar:M,clearMenuBar:$,activeMenuBar:L,signalDock:R,dockSignals:D}),[i,a,l,d,u,h,m,c,p,f,y,x,g,M,$,L,R,D]);return o(ai.Provider,{value:P},e.children)}function Pt(){return _e(ai)}var li=He({appId:""});function nt(e){let t=q(()=>({appId:e.appId}),[e.appId]);return o(li.Provider,{value:t},e.children)}function St(){return _e(li).appId}var ci=He({publish:()=>{},subscribe:()=>()=>{},subscribeAll:()=>()=>{}});function $t(e){let t=oe([]),n=oe([]),r=v(((...l)=>{let d=l[0],u=l[1],h=l[2],m=l[3]||"",c={channel:d,from:m,to:h||null,payload:u,timestamp:Date.now()},p=t.current;for(let y=0;y<p.length;y++){let x=p[y];x.channel===d&&(c.to&&x.appId!==c.to||!c.to&&x.appId===m||x.handler(c))}let f=n.current;for(let y=0;y<f.length;y++)f[y].handler(c)}),[]),i=v(((...l)=>{let d=l[0],u=l[1],h=l[2]||"",m={channel:d,handler:u,appId:h};return t.current=[...t.current,m],()=>{t.current=t.current.filter(c=>c!==m)}}),[]),s=v(((...l)=>{let u={handler:l[0]};return n.current=[...n.current,u],()=>{n.current=n.current.filter(h=>h!==u)}}),[]),a=q(()=>({publish:r,subscribe:i,subscribeAll:s}),[r,i,s]);return o(ci.Provider,{value:a},e.children)}function ot(){let e=_e(ci),t=St(),n=v(((...i)=>{let s=i[0],a=i[1],l=i[2];e.publish(s,a,l,t)}),[e.publish,t]),r=v(((...i)=>{let s=i[0],a=i[1];return e.subscribe(s,a,t)}),[e.subscribe,t]);return q(()=>({publish:n,subscribe:r,subscribeAll:e.subscribeAll}),[n,r,e.subscribeAll])}function Tt(e,t){let n=ot(),r=oe(t);r.current=t,ae(()=>n.subscribe(e,s=>{r.current(s)}),[n,e])}var di=He({startDrag:()=>{},cancelDrag:()=>{},registerDropZone:()=>()=>{},currentDrag:null,isDragging:!1});function Dt(e){let[t,n]=G(null),[r,i]=G({x:0,y:0}),s=oe(new Map),a=oe(null),l=t!==null,d=v(((...p)=>{let f=p[0];n(f)}),[]),u=v(((...p)=>{if(a.current){let f=s.current.get(a.current);f&&f.onDragLeave&&f.onDragLeave(),a.current=null}n(null)}),[]),h=v(((...p)=>{let f=p[0],y=p[1];return s.current=new Map(s.current),s.current.set(f,y),()=>{s.current=new Map(s.current),s.current.delete(f),a.current===f&&(a.current=null)}}),[]);ae(()=>{if(!l)return;let p=x=>{let g=x;i({x:g.clientX,y:g.clientY});let b=document.elementFromPoint(g.clientX,g.clientY);if(!b)return;let S=null,D=s.current;D.forEach((M,$)=>{let L=document.querySelector(`[data-dropzone-id="${$}"]`);L&&L.contains(b)&&(S=$)});let z=a.current;if(S!==z){if(z){let M=D.get(z);M&&M.onDragLeave&&M.onDragLeave()}if(S){let M=D.get(S);M&&M.onDragEnter&&t&&M.acceptTypes.indexOf(t.type)!==-1&&M.onDragEnter(t)}a.current=S}},f=x=>{let g=a.current;if(g&&t){let b=s.current.get(g);b&&b.acceptTypes.indexOf(t.type)!==-1&&b.onDrop(t)}a.current=null,n(null)},y=x=>{x.key==="Escape"&&u()};return document.addEventListener("mousemove",p),document.addEventListener("mouseup",f),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",f),document.removeEventListener("keydown",y)}},[l,t,u]);let m=q(()=>({startDrag:d,cancelDrag:u,registerDropZone:h,currentDrag:t,isDragging:l}),[d,u,h,t,l]),c=l?o("div",{className:"drag-drop-preview",style:{position:"fixed",left:`${r.x+12}px`,top:`${r.y+12}px`,pointerEvents:"none",zIndex:"10000",opacity:"0.8",padding:"6px 10px",backgroundColor:"rgba(50, 50, 50, 0.9)",color:"#ffffff",borderRadius:"4px",fontSize:"12px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",whiteSpace:"nowrap"}},t&&t.preview?String(t.preview):`Dragging ${t?t.type:""}`):null;return o(di.Provider,{value:m},e.children,c)}function ct(){return _e(di)}function An(e,t){let n=ct(),r=St(),i=oe(t);i.current=t;let s=v(l=>{l.preventDefault(),n.startDrag({type:e,data:i.current,sourceAppId:r||""})},[n,e,r]),a=n.isDragging&&n.currentDrag!==null&&n.currentDrag.type===e;return q(()=>({onMouseDown:s,isDragging:a}),[s,a])}function zt(e){let t=ct(),[n,r]=G(!1),i=oe(e.zoneId||`zone-${Math.random().toString(36).slice(2,10)}`),s=oe(e);s.current=e,ae(()=>t.registerDropZone(i.current,{acceptTypes:s.current.acceptTypes,onDragEnter:d=>{r(!0),s.current.onDragEnter&&s.current.onDragEnter(d)},onDragLeave:()=>{r(!1),s.current.onDragLeave&&s.current.onDragLeave()},onDrop:d=>{r(!1),s.current.onDrop(d)}}),[t]);let a=t.isDragging&&t.currentDrag!==null&&e.acceptTypes.indexOf(t.currentDrag.type)!==-1;return q(()=>({isOver:n,canDrop:a,zoneId:i.current}),[n,a])}var Ul=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],jl=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ln(e){return e<10?"0"+String(e):String(e)}function Gl(e,t,n){let r=e.getHours(),i=Ln(e.getMinutes()),s=Ln(e.getSeconds());if(t==="12h"){let l=r>=12?"PM":"AM";return r=r%12,r===0&&(r=12),`${n?`${String(r)}:${i}:${s}`:`${String(r)}:${i}`} ${l}`}let a=Ln(r);return n?`${a}:${i}:${s}`:`${a}:${i}`}function Xl(e){let t=Ul[e.getDay()],n=jl[e.getMonth()],r=e.getDate();return`${t}, ${n} ${String(r)}`}function ql(e){let{label:t,onClick:n}=e,{hover:r,onMouseEnter:i,onMouseLeave:s}=Ae(),a=v(()=>{n()},[n]),l=v(d=>{let u=d;(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),n())},[n]);return o("button",{type:"button",role:"button","aria-label":t,tabIndex:0,onClick:a,onKeyDown:l,onMouseEnter:i,onMouseLeave:s,style:{display:"inline-flex",alignItems:"center",padding:"0 12px",height:"100%",border:"none",outline:"none",backgroundColor:r?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",fontWeight:"700",cursor:"pointer",transition:"background-color 0.15s"}},t)}function Kl(e){let{format:t,showSeconds:n,showDate:r}=e,[i,s]=G(new Date);ae(()=>{let u=setInterval(()=>{s(new Date)},1e3);return()=>{clearInterval(u)}},[]);let a=q(()=>Gl(i,t,n),[i,t,n]),l=q(()=>Xl(i),[i]),d=r?o("span",{style:{fontSize:"11px",opacity:"0.85"}},l):null;return o("div",{role:"timer","aria-live":"polite","aria-label":"System clock",style:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"center",gap:"6px",lineHeight:"1",padding:"0 8px"}},d,o("span",{style:{fontSize:"13px",fontWeight:"500"}},a))}function Zl(e){let{indicator:t}=e,{hover:n,onMouseEnter:r,onMouseLeave:i}=Ae(),s=v(()=>{t.onClick&&t.onClick()},[t]),a=v(l=>{let d=l;(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),t.onClick&&t.onClick())},[t]);return o("button",{type:"button",role:"button","aria-label":t.label||t.icon,tabIndex:0,onClick:s,onKeyDown:a,onMouseEnter:r,onMouseLeave:i,style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"0 4px",height:"100%",border:"none",outline:"none",backgroundColor:n?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",cursor:t.onClick?"pointer":"default",transition:"background-color 0.15s"}},o("span",{"aria-hidden":"true"},t.icon),t.label?o("span",null,t.label):null)}function Jl(e){let{item:t,onClose:n}=e,{hover:r,onMouseEnter:i,onMouseLeave:s}=Ae();if(t.divider)return o("div",{role:"separator",style:{height:"1px",backgroundColor:"var(--panel-divider, #555555)",margin:"4px 0"}});let a=v(()=>{t.onClick(),n()},[t,n]),l=v(d=>{let u=d;(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),t.onClick(),n())},[t,n]);return o("button",{type:"button",role:"menuitem",tabIndex:-1,onClick:a,onKeyDown:l,onMouseEnter:i,onMouseLeave:s,style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"6px 16px",border:"none",outline:"none",backgroundColor:r?"var(--panel-hover, rgba(255,255,255,0.15))":"transparent",color:"var(--panel-text, #ffffff)",fontFamily:"inherit",fontSize:"13px",textAlign:"left",cursor:"pointer",boxSizing:"border-box",transition:"background-color 0.1s"}},t.icon?o("span",{style:{width:"16px",textAlign:"center"},"aria-hidden":"true"},t.icon):null,o("span",null,t.label))}function Ql(e){let{user:t,menuItems:n}=e,{hover:r,onMouseEnter:i,onMouseLeave:s}=Ae(),[a,l]=G(!1),d=oe(null),u=v(()=>{l(x=>!x)},[]),h=v(()=>{l(!1)},[]),m=v(x=>{let g=x;(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),l(b=>!b)),g.key==="Escape"&&l(!1)},[]);ae(()=>{if(!a)return;let x=g=>{let b=d.current;b&&!b.contains(g.target)&&l(!1)};return document.addEventListener("click",x,!0),()=>{document.removeEventListener("click",x,!0)}},[a]);let c={width:"24px",height:"24px",borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:"12px",fontWeight:"700",backgroundColor:"rgba(255,255,255,0.2)",color:"inherit",overflow:"hidden",flexShrink:"0"},p=t.avatar?o("img",{src:t.avatar,alt:t.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):t.name.charAt(0).toUpperCase(),f=o("span",{style:c,"aria-hidden":"true"},p),y=a&&n&&n.length>0?o("div",{role:"menu","aria-label":"User menu",style:{position:"absolute",top:"100%",right:"0",marginTop:"2px",backgroundColor:"var(--panel-bg, #2c2c2c)",border:"1px solid var(--panel-divider, #555555)",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",padding:"4px 0",minWidth:"180px",zIndex:"1000"}},...n.map((x,g)=>o(Jl,{key:String(g),item:x,onClose:h}))):null;return o("div",{ref:d,style:{position:"relative",display:"inline-flex",height:"100%"}},o("button",{type:"button","aria-haspopup":"true","aria-expanded":String(a),tabIndex:0,onClick:u,onKeyDown:m,onMouseEnter:i,onMouseLeave:s,style:{display:"inline-flex",alignItems:"center",gap:"6px",padding:"0 8px",height:"100%",border:"none",outline:"none",backgroundColor:r||a?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",cursor:"pointer",transition:"background-color 0.15s"}},f,o("span",null,t.name),o("span",{"aria-hidden":"true",style:{fontSize:"10px"}},"\u25BE")),y)}function ec(e){let{menu:t}=e,{hover:n,onMouseEnter:r,onMouseLeave:i}=Ae(),[s,a]=G(!1),l=oe(null),d=v(()=>{a(c=>!c)},[]),u=v(()=>{a(!1)},[]),h=v(c=>{let p=c;(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(f=>!f)),p.key==="Escape"&&a(!1)},[]);ae(()=>{if(!s)return;let c=p=>{let f=l.current;f&&!f.contains(p.target)&&a(!1)};return document.addEventListener("click",c,!0),()=>{document.removeEventListener("click",c,!0)}},[s]);let m=s&&t.items.length>0?o("div",{role:"menu","aria-label":t.label+" menu",style:{position:"absolute",top:"100%",left:"0",marginTop:"2px",backgroundColor:"var(--panel-bg, #2c2c2c)",border:"1px solid var(--panel-divider, #555555)",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",padding:"4px 0",minWidth:"180px",zIndex:"1000"}},...t.items.map((c,p)=>c.divider?o("div",{key:"div-"+String(p),role:"separator",style:{height:"1px",backgroundColor:"var(--panel-divider, #555555)",margin:"4px 0"}}):o("button",{key:String(p),type:"button",role:"menuitem",tabIndex:-1,disabled:c.disabled??!1,onClick:()=>{c.onClick&&c.onClick(),u()},style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 16px",border:"none",outline:"none",backgroundColor:"transparent",color:c.disabled?"rgba(255,255,255,0.4)":"var(--panel-text, #ffffff)",fontFamily:"inherit",fontSize:"13px",textAlign:"left",cursor:c.disabled?"default":"pointer",boxSizing:"border-box"}},o("span",null,c.checked?"\u2713 ":"",c.label||""),c.shortcut?o("span",{style:{fontSize:"11px",opacity:"0.6",marginLeft:"16px"}},c.shortcut):null))):null;return o("div",{ref:l,className:"system-tray__app-menu",style:{position:"relative",display:"inline-flex",height:"100%"}},o("button",{type:"button","aria-haspopup":"true","aria-expanded":String(s),tabIndex:0,onClick:d,onKeyDown:h,onMouseEnter:r,onMouseLeave:i,style:{display:"inline-flex",alignItems:"center",padding:"0 10px",height:"100%",border:"none",outline:"none",backgroundColor:n||s?"rgba(255,255,255,0.15)":"transparent",color:"inherit",fontFamily:"inherit",fontSize:"13px",fontWeight:"500",cursor:"pointer",transition:"background-color 0.15s"}},t.label),m)}function Bn(e){let{activeAppName:t,activitiesButton:n,appMenuBar:r,clockFormat:i="24h",showSeconds:s=!0,showDate:a=!0,indicators:l,user:d,userMenuItems:u,height:h=28,children:m}=e,c=String(h)+"px",p=[];if(n&&p.push(o(ql,{key:"activities",label:n.label,onClick:n.onClick})),t&&p.push(o("span",{key:"appname",style:{padding:"0 12px",fontSize:"13px",fontWeight:"700",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"200px"}},t)),r&&r.menus.length>0)for(let S=0;S<r.menus.length;S++)p.push(o(ec,{key:"appmenu-"+String(S),menu:r.menus[S]}));let f=o("div",{style:{display:"flex",alignItems:"center",height:"100%",flex:"1",minWidth:"0"}},...p),y=[];y.push(o(Kl,{key:"clock",format:i,showSeconds:s,showDate:a})),m&&y.push(m);let x=o("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"}},...y),g=[];if(l&&l.length>0){let S=l.map(D=>o(Zl,{key:D.id,indicator:D}));g.push(o("div",{key:"indicators",style:{display:"flex",alignItems:"center",gap:"8px",height:"100%"}},...S))}d&&g.push(o(Ql,{key:"user",user:d,menuItems:u}));let b=o("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",height:"100%",flex:"1",gap:"4px"}},...g);return o("div",{role:"menubar","aria-label":"System panel","data-theme":"dark",style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",height:c,backgroundColor:"var(--panel-bg, #2c2c2c)",color:"var(--panel-text, #ffffff)",fontFamily:"inherit",fontSize:"13px",boxSizing:"border-box",position:"relative"}},f,x,b)}function tc(e){return e.startsWith("http")||e.startsWith("/")||e.startsWith(".")}var ui=["#3465a4","#e67e22","#2ecc71","#3498db","#e74c3c","#9b59b6","#f39c12","#1abc9c","#e91e63","#00bcd4"];function nc(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return ui[Math.abs(t)%ui.length]}function oc(e){return e>99?"99+":String(e)}function rc(e){return e.badge&&e.badge>0?`${e.label}, ${e.badge} unread`:e.label}function ic(e){switch(e){case"left":return{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"};case"right":return{right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:"8px"};case"top":return{top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:"8px"};case"bottom":return{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:"8px"};default:return{left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:"8px"}}}function sc(e,t){return t==="vertical"?e==="right"?{position:"absolute",right:"0",top:"50%",transform:"translateY(-50%)"}:{position:"absolute",left:"0",top:"50%",transform:"translateY(-50%)"}:e==="bottom"?{position:"absolute",top:"0",left:"50%",transform:"translateX(-50%)"}:{position:"absolute",bottom:"0",left:"50%",transform:"translateX(-50%)"}}function ac(e){let{item:t,iconSize:n,position:r,orientation:i,onItemClick:s,onItemContextMenu:a}=e,[l,d]=G(!1),u=t.disabled??!1,h=v(()=>{u||d(!0)},[u]),m=v(()=>{d(!1)},[]),c=v(()=>{!u&&s&&s(t.id)},[u,s,t.id]),p=v(z=>{if(!u&&a){let M=z;M.preventDefault(),a(t.id,{x:M.clientX,y:M.clientY})}},[u,a,t.id]),f=`${n}px`,y=tc(t.icon)?o("img",{src:t.icon,alt:t.label,style:{width:f,height:f,objectFit:"contain",display:"block"}}):o("span",{style:{width:f,height:f,display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.round(n*.6)}px`,fontWeight:"700",userSelect:"none",backgroundColor:nc(t.icon),color:"#ffffff",borderRadius:"8px"},"aria-hidden":"true"},t.icon),x=t.badge!=null&&t.badge>0?o("span",{style:{position:"absolute",top:"0",right:"0",backgroundColor:"var(--dock-badge-bg, #e74c3c)",color:"#ffffff",fontSize:"9px",fontWeight:"700",lineHeight:"1",minWidth:"14px",height:"14px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"7px",padding:"0 3px",pointerEvents:"none",zIndex:"2"},"aria-hidden":"true"},oc(t.badge)):null,g=t.active?o("span",{style:{...sc(r,i),width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"var(--dock-active-color, #ffffff)",pointerEvents:"none",zIndex:"2"},"aria-hidden":"true"}):null,b=t.progress!=null&&t.progress>0?o("div",{style:{position:"absolute",bottom:"2px",left:"6px",right:"6px",height:"3px",backgroundColor:"rgba(255,255,255,0.2)",borderRadius:"2px",overflow:"hidden",pointerEvents:"none",zIndex:"2"},"aria-hidden":"true"},o("div",{style:{width:`${Math.min(1,Math.max(0,t.progress))*100}%`,height:"100%",backgroundColor:"var(--dock-progress-color, #3b82f6)",borderRadius:"2px",transition:"width 200ms ease"}})):null,S=l?o("div",{role:"tooltip",style:{position:"absolute",...ic(r),padding:"4px 10px",backgroundColor:"#1f2937",color:"#ffffff",fontSize:"12px",borderRadius:"4px",whiteSpace:"nowrap",zIndex:"1000",pointerEvents:"none"}},t.label):null,D={position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"6px",border:"none",backgroundColor:"transparent",cursor:u?"default":"pointer",opacity:u?"0.4":"1",pointerEvents:u?"none":"auto",transition:"transform 100ms, background-color 100ms",borderRadius:"8px",outline:"none",...l&&!u?{transform:"scale(1.1)",backgroundColor:"rgba(255,255,255,0.15)"}:{},...t.urgent&&!u?{animation:"dock-urgent-pulse 0.6s ease-in-out infinite alternate"}:{}};return o("button",{type:"button",role:"button",style:D,"aria-label":rc(t),"aria-pressed":t.active?"true":"false","aria-disabled":u?"true":void 0,tabIndex:u?-1:0,onClick:c,onContextMenu:p,onMouseEnter:h,onMouseLeave:m,"data-dock-item-id":t.id,"data-urgent":t.urgent?"true":void 0},y,x,g,b,S)}function Fn(e){let{items:t,orientation:n="vertical",position:r="left",iconSize:i=36,autoHide:s=!1,showTrailingSeparator:a=!1,onItemClick:l,onItemContextMenu:d,children:u}=e,[h,m]=G(!s),c=oe(null),p=v(()=>{s&&(c.current!=null&&(clearTimeout(c.current),c.current=null),m(!0))},[s]),f=v(()=>{s&&(c.current=setTimeout(()=>{m(!1)},300))},[s]),y=v(D=>{let z=D,M=z.target,$=M.closest('[role="toolbar"]');if(!$)return;let L=Array.from($.querySelectorAll("button[data-dock-item-id]")),R=L.indexOf(M);if(R<0)return;let P=n==="vertical",B=P?"ArrowDown":"ArrowRight",I=P?"ArrowUp":"ArrowLeft";if(z.key===B){z.preventDefault();let F=L[R+1];F&&F.focus()}else if(z.key===I){z.preventDefault();let F=L[R-1];F&&F.focus()}else z.key==="Home"?(z.preventDefault(),L[0]?.focus()):z.key==="End"?(z.preventDefault(),L[L.length-1]?.focus()):(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),M.click())},[n]),x=n==="vertical",g={display:"flex",flexDirection:x?"column":"row",alignItems:"center",gap:"2px",padding:"4px",backgroundColor:"var(--dock-bg, rgba(0, 0, 0, 0.7))",color:"#ffffff",border:"1px solid var(--dock-border, rgba(255, 255, 255, 0.1))",borderRadius:"8px",boxSizing:"border-box",position:"relative",transition:"transform 200ms ease, opacity 200ms ease"};s&&!h&&(r==="left"?(g.transform="translateX(-100%)",g.opacity="0"):r==="right"?(g.transform="translateX(100%)",g.opacity="0"):r==="top"?(g.transform="translateY(-100%)",g.opacity="0"):r==="bottom"&&(g.transform="translateY(100%)",g.opacity="0"));let b=[];for(let D=0;D<t.length;D++){if(a&&D===t.length-1&&t.length>1){let z=x?{width:"60%",height:"1px",backgroundColor:"rgba(255,255,255,0.2)",margin:"4px auto",flexShrink:"0"}:{height:"60%",width:"1px",backgroundColor:"rgba(255,255,255,0.2)",margin:"auto 4px",flexShrink:"0"};b.push(o("div",{key:`sep-${D}`,style:z,"aria-hidden":"true",role:"separator"}))}b.push(o(ac,{key:t[D].id,item:t[D],iconSize:i,position:r,orientation:n,onItemClick:l,onItemContextMenu:d}))}let S=s&&!h?o("div",{style:{position:"absolute",...r==="left"?{left:"0",top:"0",width:"4px",height:"100%"}:{},...r==="right"?{right:"0",top:"0",width:"4px",height:"100%"}:{},...r==="top"?{top:"0",left:"0",height:"4px",width:"100%"}:{},...r==="bottom"?{bottom:"0",left:"0",height:"4px",width:"100%"}:{},zIndex:"10"},"aria-hidden":"true"}):null;return o("div",{role:"toolbar","aria-label":"Application launcher","aria-orientation":n,style:g,onMouseEnter:p,onMouseLeave:f,onKeyDown:y},S,...b,u??null)}var lc="#2c001e";function Nn(e){let{backgroundColor:t=lc,backgroundGradient:n,backgroundImage:r,backgroundImageOpacity:i=1,contextMenuItems:s,onClick:a,onDoubleClick:l,overflow:d="visible",children:u}=e,h=v(g=>{let b=g;b.target===b.currentTarget&&a&&a()},[a]),m=v(g=>{let b=g;b.target===b.currentTarget&&l&&l()},[l]),c=q(()=>{let g={position:"relative",width:"100%",height:"100%",overflow:d,cursor:"default",margin:"0",padding:"0"};return g.backgroundColor=t,n&&(g.background=n),r&&i>=1&&(g.backgroundImage=`url(${r})`,g.backgroundSize="cover",g.backgroundPosition="center"),g},[t,n,r,i]),p=q(()=>!r||i>=1?null:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",backgroundImage:`url(${r})`,backgroundSize:"cover",backgroundPosition:"center",opacity:String(i),pointerEvents:"none",zIndex:"0"},[r,i]),f={position:"relative",width:"100%",height:"100%",zIndex:"1"},y=[];p&&y.push(o("div",{className:"desktop-background__image-overlay",style:p,"aria-hidden":"true"})),y.push(o("div",{className:"desktop-background__content",style:f},u));let x=o("div",{className:"desktop-background",style:c,onClick:h,onDblClick:m,role:"application","aria-label":"Desktop workspace","data-theme":"dark"},...y);return s&&s.length>0?o(Ut,{items:s},x):x}var cc={width:200,height:150},dc={x:50,y:50},uc={width:400,height:300},Be=8,Wn=20,pc={n:"n-resize",s:"s-resize",e:"e-resize",w:"w-resize",ne:"ne-resize",nw:"nw-resize",se:"se-resize",sw:"sw-resize"};function At(e){let{id:t,title:n,icon:r,defaultPosition:i=dc,defaultSize:s=uc,minSize:a=cc,maxSize:l,resizable:d=!0,draggable:u=!0,windowState:h="normal",focused:m=!0,zIndex:c,onClose:p,onMinimize:f,onMaximize:y,onFocus:x,onMove:g,onResize:b,children:S}=e,[D,z]=G(i.x),[M,$]=G(i.y),[L,R]=G(s.width),[P,B]=G(s.height),[I,F]=G(!1),[A,k]=G(!1),[w,E]=G(null),C=oe(null),N=oe(null),T=oe(null),W=v((re,ge)=>{let me=Math.max(re,a.width),ne=Math.max(ge,a.height);return l&&(me=Math.min(me,l.width),ne=Math.min(ne,l.height)),{width:me,height:ne}},[a,l]),_=v(()=>{let re=T.current;return re&&re.parentElement?{width:re.parentElement.clientWidth,height:re.parentElement.clientHeight}:{width:window.innerWidth,height:window.innerHeight}},[]),O=v((re,ge,me,ne)=>{let de=_(),fe=Math.max(0,Math.min(re,de.width-me)),xe=Math.max(0,Math.min(ge,de.height-ne));return{x:fe,y:xe}},[_]),U=v(re=>{if(!u||h==="maximized")return;let ge=re;ge.target.closest("button")||(ge.preventDefault(),C.current={startMouseX:ge.clientX,startMouseY:ge.clientY,startPosX:D,startPosY:M},F(!0))},[u,h,D,M]),K=v(re=>{re.target.closest("button")||y&&y()},[y]);ae(()=>{if(!I)return;let re=me=>{let ne=me,de=C.current;if(!de)return;let fe=ne.clientX-de.startMouseX,xe=ne.clientY-de.startMouseY,ye=de.startPosX+fe,we=de.startPosY+xe,X=_();ye=Math.max(0,Math.min(ye,X.width-L)),we=Math.max(0,Math.min(we,X.height-P)),z(ye),$(we),ne.clientX<=Wn?E("left"):ne.clientX>=X.width-Wn?E("right"):ne.clientY<=Wn?E("top"):E(null)},ge=me=>{let ne=me;F(!1);let de=_();if(w==="left"){z(0),$(0),R(Math.floor(de.width/2)),B(de.height),E(null),g&&g({x:0,y:0}),b&&b({width:Math.floor(de.width/2),height:de.height});return}if(w==="right"){let xe=Math.floor(de.width/2);z(xe),$(0),R(xe),B(de.height),E(null),g&&g({x:xe,y:0}),b&&b({width:xe,height:de.height});return}if(w==="top"){E(null),y&&y();return}E(null);let fe=C.current;if(fe&&g){let xe=ne.clientX-fe.startMouseX,ye=ne.clientY-fe.startMouseY,we=fe.startPosX+xe,X=fe.startPosY+ye;we=Math.max(0,Math.min(we,de.width-L)),X=Math.max(0,Math.min(X,de.height-P)),g({x:we,y:X})}C.current=null};return document.addEventListener("mousemove",re),document.addEventListener("mouseup",ge),()=>{document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",ge)}},[I,w,L,P,_,g,b,y]);let te=v(re=>ge=>{if(!d||h!=="normal")return;let me=ge;me.preventDefault(),me.stopPropagation(),N.current={direction:re,startMouseX:me.clientX,startMouseY:me.clientY,startPosX:D,startPosY:M,startWidth:L,startHeight:P},k(!0)},[d,h,D,M,L,P]);ae(()=>{if(!A)return;let re=me=>{let ne=me,de=N.current;if(!de)return;let fe=ne.clientX-de.startMouseX,xe=ne.clientY-de.startMouseY,ye=de.direction,we=de.startWidth,X=de.startHeight,ie=de.startPosX,he=de.startPosY;ye.includes("e")&&(we=de.startWidth+fe),ye.includes("w")&&(we=de.startWidth-fe,ie=de.startPosX+fe),ye.includes("s")&&(X=de.startHeight+xe),ye.includes("n")&&(X=de.startHeight-xe,he=de.startPosY+xe);let be=W(we,X);ye.includes("w")&&(ie=de.startPosX+(de.startWidth-be.width)),ye.includes("n")&&(he=de.startPosY+(de.startHeight-be.height)),R(be.width),B(be.height),z(ie),$(he)},ge=()=>{k(!1),b&&b({width:L,height:P}),N.current=null};return document.addEventListener("mousemove",re),document.addEventListener("mouseup",ge),()=>{document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",ge)}},[A,L,P,W,b]),ae(()=>{if(!m||!p)return;let re=ge=>{ge.key==="Escape"&&p()};return document.addEventListener("keydown",re),()=>document.removeEventListener("keydown",re)},[m,p]);let J=v(re=>{x&&x()},[x]);if(h==="minimized")return null;let V=h==="maximized",j=q(()=>{let re={position:"absolute",display:"flex",flexDirection:"column",border:"1px solid var(--window-border, #555555)",borderRadius:V?"0":"6px",overflow:"hidden",backgroundColor:"var(--window-body-bg, #1e1e1e)",boxShadow:m?"0 8px 32px rgba(0, 0, 0, 0.4)":"0 4px 16px rgba(0, 0, 0, 0.2)",transition:V?"all 200ms ease":"box-shadow 200ms ease",outline:"none"};return V?(re.top="0",re.left="0",re.width="100%",re.height="100%"):(re.top=`${M}px`,re.left=`${D}px`,re.width=`${L}px`,re.height=`${P}px`),c!==void 0&&(re.zIndex=String(c)),I&&(re.cursor="grabbing",re.userSelect="none"),re},[V,D,M,L,P,c,m,I]),Y=q(()=>{let re={display:"flex",alignItems:"center",padding:"0 8px",height:"32px",backgroundColor:"var(--window-title-bg, #2c2c2c)",color:"var(--window-title-text, #ffffff)",userSelect:"none",flexShrink:"0",cursor:u&&!V?"grab":"default",opacity:m?"1":"0.6"};return I&&(re.cursor="grabbing"),re},[m,u,V,I]),H={flex:"1",overflow:"auto",backgroundColor:"var(--window-body-bg, #1e1e1e)"},Z={width:"14px",height:"14px",borderRadius:"50%",border:"none",cursor:"pointer",padding:"0",marginLeft:"6px",fontSize:"0",lineHeight:"0",display:"inline-flex",alignItems:"center",justifyContent:"center"},ee=[];r&&(r.startsWith("http")||r.startsWith("/")||r.startsWith("data:")?ee.push(o("img",{src:r,alt:"",style:{width:"16px",height:"16px",marginRight:"6px",flexShrink:"0"},className:"draggable-window__icon"})):ee.push(o("span",{style:{marginRight:"6px",fontSize:"14px",flexShrink:"0"},className:"draggable-window__icon"},r))),ee.push(o("span",{className:"draggable-window__title-text",style:{flex:"1",fontSize:"13px",fontWeight:"500",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},n));let se=o("div",{style:{display:"flex",alignItems:"center",flexShrink:"0"},className:"draggable-window__controls"},o("button",{type:"button","aria-label":"Minimize",className:"draggable-window__btn-minimize",style:{...Z,backgroundColor:"var(--window-button-minimize, #f39c12)"},onClick:re=>{re.stopPropagation(),f&&f()}}),o("button",{type:"button","aria-label":V?"Restore":"Maximize",className:"draggable-window__btn-maximize",style:{...Z,backgroundColor:"var(--window-button-maximize, #2ecc71)"},onClick:re=>{re.stopPropagation(),y&&y()}}),o("button",{type:"button","aria-label":"Close",className:"draggable-window__btn-close",style:{...Z,backgroundColor:"var(--window-button-close, #e74c3c)"},onClick:re=>{re.stopPropagation(),p&&p()}}));ee.push(se);let Q=[];if(d&&!V){let re=["n","s","e","w","ne","nw","se","sw"];for(let ge=0;ge<re.length;ge++){let me=re[ge],ne={position:"absolute",zIndex:"1"};me==="n"?(ne.top="0",ne.left=`${Be}px`,ne.right=`${Be}px`,ne.height=`${Be}px`):me==="s"?(ne.bottom="0",ne.left=`${Be}px`,ne.right=`${Be}px`,ne.height=`${Be}px`):me==="e"?(ne.top=`${Be}px`,ne.right="0",ne.bottom=`${Be}px`,ne.width=`${Be}px`):me==="w"?(ne.top=`${Be}px`,ne.left="0",ne.bottom=`${Be}px`,ne.width=`${Be}px`):me==="ne"?(ne.top="0",ne.right="0",ne.width=`${Be}px`,ne.height=`${Be}px`):me==="nw"?(ne.top="0",ne.left="0",ne.width=`${Be}px`,ne.height=`${Be}px`):me==="se"?(ne.bottom="0",ne.right="0",ne.width=`${Be}px`,ne.height=`${Be}px`):me==="sw"&&(ne.bottom="0",ne.left="0",ne.width=`${Be}px`,ne.height=`${Be}px`),ne.cursor=pc[me],Q.push(o("div",{className:`draggable-window__resize-handle draggable-window__resize-${me}`,style:ne,onMouseDown:te(me)}))}}let le=null;if(w){let re={position:"fixed",backgroundColor:"rgba(66, 133, 244, 0.2)",border:"2px solid rgba(66, 133, 244, 0.5)",borderRadius:"4px",zIndex:"999999",pointerEvents:"none",transition:"all 150ms ease"};w==="left"?(re.top="0",re.left="0",re.width="50%",re.height="100%"):w==="right"?(re.top="0",re.right="0",re.width="50%",re.height="100%"):w==="top"&&(re.top="0",re.left="0",re.width="100%",re.height="100%"),le=o("div",{className:"draggable-window__snap-preview",style:re})}let ce=[];for(let re=0;re<Q.length;re++)ce.push(Q[re]);ce.push(o("div",{className:"draggable-window__title-bar",style:Y,onMouseDown:U,onDblClick:K,role:"toolbar","aria-label":`${n} window controls`},...ee)),ce.push(o("div",{className:"draggable-window__body",style:H},S));let ue=[o("div",{ref:T,id:`draggable-window-${t}`,className:`draggable-window ${m?"draggable-window--focused":"draggable-window--unfocused"} draggable-window--${h}`,style:j,role:"dialog","aria-label":n,tabIndex:-1,onMouseDown:J},...ce)];return le&&ue.push(le),ue.length===1?ue[0]:o("div",{style:{display:"contents"}},...ue)}var fc=["File","Edit","View","Insert","Format","Tools","Help"],pi={File:[{label:"New",action:"new"},{label:"Open",action:"open"},{label:"Save",action:"save"},{label:"Print",action:"print"}],Edit:[{label:"Undo",action:"undo"},{label:"Redo",action:"redo"},{label:"Cut",action:"cut"},{label:"Copy",action:"copy"},{label:"Paste",action:"paste"}],View:[{label:"Zoom In",action:"zoomIn"},{label:"Zoom Out",action:"zoomOut"},{label:"Full Screen",action:"fullScreen"}],Insert:[{label:"Image",action:"insertImage"},{label:"Table",action:"insertTable"},{label:"Link",action:"insertLink"}],Format:[{label:"Bold",action:"bold"},{label:"Italic",action:"italic"},{label:"Underline",action:"underline"}],Tools:[{label:"Word Count",action:"wordCount"},{label:"Spell Check",action:"spellCheck"}],Help:[{label:"About",action:"about"},{label:"Keyboard Shortcuts",action:"shortcuts"}]},gc=[{id:"bold",label:"Bold",text:"B",shortcut:"Ctrl+B",style:{fontWeight:"700"}},{id:"italic",label:"Italic",text:"I",shortcut:"Ctrl+I",style:{fontStyle:"italic"}},{id:"underline",label:"Underline",text:"U",shortcut:"Ctrl+U",style:{textDecoration:"underline"}}],mc=[{label:"Align left",text:"\u2261",command:"justifyLeft"},{label:"Align center",text:"\u2263",command:"justifyCenter"},{label:"Align right",text:"\u2262",command:"justifyRight"}],hc=["1","2","3","4","5","6","7"],bc={1:"8",2:"10",3:"12",4:"14",5:"18",6:"24",7:"36"};function xc(){let e=[];for(let t=0;t<=20;t++){let n=t%2===0;e.push(o("div",{key:String(t),style:{position:"absolute",left:`${t/20*100}%`,bottom:"0",width:"1px",height:n?"10px":"5px",backgroundColor:"#999"}})),n&&e.push(o("span",{key:`l${t}`,style:{position:"absolute",left:`${t/20*100}%`,top:"1px",fontSize:"8px",color:"#666",transform:"translateX(-50%)"}},String(t/2)))}return e}function fi(e){return e.trim().split(/\s+/).filter(t=>t.length>0).length}function qt(e){let[t,n]=G(!1),[r,i]=G(!1),[s,a]=G(!1),[l,d]=G(-1),[u,h]=G(""),[m,c]=G(-1),[p,f]=G(0),[y,x]=G("3"),g=oe(null),b=v(()=>{document.execCommand("bold",!1),n(H=>!H),g.current&&g.current.focus()},[]),S=v(()=>{document.execCommand("italic",!1),i(H=>!H),g.current&&g.current.focus()},[]),D=v(()=>{document.execCommand("underline",!1),a(H=>!H),g.current&&g.current.focus()},[]),z={bold:b,italic:S,underline:D},M={bold:t,italic:r,underline:s},$=v(H=>{document.execCommand(H,!1),g.current&&g.current.focus()},[]),L=v(H=>{document.execCommand("fontSize",!1,H),x(H),g.current&&g.current.focus()},[]),R=v(H=>{c(Z=>Z===H?-1:H)},[]),P=v(H=>{switch(H){case"undo":document.execCommand("undo",!1);break;case"redo":document.execCommand("redo",!1);break;case"cut":document.execCommand("cut",!1);break;case"copy":document.execCommand("copy",!1);break;case"paste":document.execCommand("paste",!1);break;case"bold":document.execCommand("bold",!1);break;case"italic":document.execCommand("italic",!1);break;case"underline":document.execCommand("underline",!1);break;case"print":typeof window<"u"&&window.print&&window.print();break;case"new":g.current&&(g.current.innerHTML="",f(0));break;default:break}c(-1),g.current&&g.current.focus()},[]),B=v(()=>{if(g.current){let H=g.current.textContent??"";f(fi(H))}},[]),I=v(()=>{c(-1)},[]),F=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'"Segoe UI", Roboto, Arial, sans-serif',fontSize:"13px",color:"var(--color-text, #333)",backgroundColor:"#f0f0f0",overflow:"hidden"}),[]),A={display:"flex",alignItems:"center",height:"30px",backgroundColor:"var(--color-bg-subtle, #ffffff)",borderBottom:"1px solid var(--color-border, #d0d0d0)",padding:"0 8px",gap:"2px",flexShrink:"0",position:"relative"},k={display:"flex",alignItems:"center",height:"36px",backgroundColor:"var(--color-bg-subtle, #f8f9fa)",borderBottom:"1px solid var(--color-border, #d0d0d0)",padding:"0 12px",gap:"12px",flexShrink:"0"},w={height:"20px",backgroundColor:"#e8e8e8",borderBottom:"1px solid #ccc",position:"relative",flexShrink:"0",margin:"0 60px"},E={flex:"1",display:"flex",justifyContent:"center",alignItems:"flex-start",padding:"30px 40px",overflow:"auto",backgroundColor:"#e0e0e0",cursor:"text"},C={width:"680px",minHeight:"880px",backgroundColor:"#ffffff",boxShadow:"0 2px 12px rgba(0,0,0,0.18), 0 0 1px rgba(0,0,0,0.1)",padding:"72px 72px 96px 72px",boxSizing:"border-box",fontSize:"14px",lineHeight:"1.6",color:"#222",fontFamily:'"Times New Roman", Georgia, serif',cursor:"text",outline:"none"},N={height:"24px",backgroundColor:"var(--color-bg-subtle, #f0f0f0)",borderTop:"1px solid var(--color-border, #ccc)",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px",fontSize:"11px",color:"#666",flexShrink:"0"},T=q(()=>xc(),[]),W=e.content??"Start typing...",_=fi(W),O=p>0?p:_;function U(H){return{padding:"4px 10px",cursor:"pointer",borderRadius:"3px",fontSize:"13px",color:"var(--color-text, #333)",backgroundColor:m===H?"rgba(0,0,0,0.12)":l===H?"rgba(0,0,0,0.08)":"transparent",border:"none",lineHeight:"1",transition:"background 0.15s",position:"relative"}}let K={position:"absolute",top:"100%",left:"0",minWidth:"160px",backgroundColor:"#ffffff",border:"1px solid #d0d0d0",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"1000"},te={display:"block",width:"100%",padding:"6px 16px",fontSize:"13px",color:"#333",backgroundColor:"transparent",border:"none",textAlign:"left",cursor:"pointer",transition:"background 0.1s"};function J(H,Z){return{width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid transparent",borderRadius:"3px",cursor:"pointer",fontSize:"13px",backgroundColor:M[H]??!1?"rgba(0,0,0,0.12)":u===H?"rgba(0,0,0,0.06)":"transparent",color:"var(--color-text, #444)",transition:"background 0.15s",...Z??{}}}let V={display:"flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--color-border, #ccc)",borderRadius:"3px",fontSize:"12px",color:"var(--color-text, #444)",backgroundColor:"transparent",cursor:"default",height:"24px",gap:"4px"},j={padding:"2px 4px",border:"1px solid var(--color-border, #ccc)",borderRadius:"3px",fontSize:"12px",color:"var(--color-text, #444)",backgroundColor:"transparent",cursor:"pointer",height:"24px",outline:"none"},Y=fc.map((H,Z)=>{let ee=[H];return m===Z&&pi[H]&&ee.push(o("div",{key:"dropdown",style:K,className:"word-processor__menu-dropdown"},...pi[H].map((se,Q)=>o("button",{key:String(Q),style:te,onClick:le=>{le.stopPropagation(),P(se.action)},role:"menuitem"},se.label)))),o("button",{key:String(Z),style:U(Z),role:"menuitem","aria-label":H,onClick:()=>R(Z),onMouseEnter:()=>{d(Z)},onMouseLeave:()=>d(-1)},...ee)});return o("div",{className:`word-processor ${e.className??""}`.trim(),style:F},o("div",{className:"word-processor__menu-bar",style:A,role:"menubar"},...Y),o("div",{className:"word-processor__toolbar",style:k,role:"toolbar","aria-label":"Formatting toolbar"},o("div",{style:V,"aria-label":"Font family"},o("span",null,"Arial"),o("span",{style:{fontSize:"10px",color:"#999"}},"\u25BC")),o("div",{key:"0",style:{display:"flex",gap:"2px",borderLeft:"1px solid var(--color-border, #ccc)",paddingLeft:"10px"}},...gc.map(H=>o("button",{key:H.id,style:J(H.id,H.style),title:H.shortcut?`${H.label} (${H.shortcut})`:H.label,"aria-label":H.label,"aria-pressed":String(M[H.id]??!1),onClick:z[H.id],onMouseEnter:()=>h(H.id),onMouseLeave:()=>h("")},H.text))),o("div",{key:"1",style:{display:"flex",gap:"2px",borderLeft:"1px solid var(--color-border, #ccc)",paddingLeft:"10px",alignItems:"center"}},o("select",{style:j,"aria-label":"Font size",value:y,onChange:H=>{let Z=H.target;L(Z.value)}},...hc.map(H=>o("option",{key:H,value:H},bc[H])))),o("div",{key:"2",style:{display:"flex",gap:"2px",borderLeft:"1px solid var(--color-border, #ccc)",paddingLeft:"10px"}},...mc.map((H,Z)=>o("button",{key:String(Z),style:J(`align-${Z}`),title:H.label,"aria-label":H.label,onClick:()=>$(H.command),onMouseEnter:()=>h(`align-${Z}`),onMouseLeave:()=>h("")},H.text)))),o("div",{className:"word-processor__ruler",style:w,"aria-hidden":"true"},...T),o("main",{className:"word-processor__document-area",style:E,onClick:I},o("div",{className:"word-processor__page",style:C,contentEditable:"true",ref:g,onInput:B,suppressContentEditableWarning:!0},W)),o("div",{className:"word-processor__status-bar",style:N},o("span",null,"Page 1 of 1"),o("span",null,`${O} words`),o("span",null,"100%")))}var yc=["File","Edit","Selection","View","Go","Run","Terminal","Help"],gi={File:[{label:"New File",action:"newFile"},{label:"Open",action:"open"},{label:"Save",action:"save"},{label:"Save As",action:"saveAs"}],Edit:[{label:"Undo",action:"undo"},{label:"Redo",action:"redo"},{label:"Cut",action:"cut"},{label:"Copy",action:"copy"},{label:"Paste",action:"paste"}],View:[{label:"Command Palette",action:"commandPalette"},{label:"Explorer",action:"explorer"},{label:"Search",action:"search"}]},mi=[{name:"src",indent:0,isFolder:!0},{name:"components",indent:1,isFolder:!0,parent:"src"},{name:"App.ts",indent:2,isFolder:!1,parent:"components"},{name:"Header.ts",indent:2,isFolder:!1,parent:"components"},{name:"hooks",indent:1,isFolder:!0,parent:"src"},{name:"useAuth.ts",indent:2,isFolder:!1,parent:"hooks"},{name:"index.ts",indent:1,isFolder:!1,parent:"src"},{name:"main.ts",indent:1,isFolder:!1,parent:"src"},{name:"types.ts",indent:1,isFolder:!1,parent:"src"},{name:"package.json",indent:0,isFolder:!1},{name:"tsconfig.json",indent:0,isFolder:!1}],On={"App.ts":['import { createElement, useState } from "specifyjs";',"","interface AppProps {"," title: string;"," version?: number;","}","","export function App(props: AppProps) {"," const [count, setCount] = useState(0);",""," const increment = () => {"," setCount((prev: number) => prev + 1);"," };",""," return createElement(",' "div",',' { className: "app" },',' createElement("h1", null, props.title),',' createElement("p", null, `Count: ${count}`),'," createElement(",' "button",'," { onClick: increment },",' "Increment",'," ),"," );","}"],"Header.ts":['import { createElement } from "specifyjs";',"","interface HeaderProps {"," title: string;"," subtitle?: string;","}","","export function Header(props: HeaderProps) {"," return createElement(",' "header",',' { className: "header" },',' createElement("h1", null, props.title),'," props.subtitle",' ? createElement("p", null, props.subtitle)'," : null,"," );","}"],"useAuth.ts":['import { useState, useCallback } from "specifyjs";',"","interface AuthState {"," user: string | null;"," isLoggedIn: boolean;","}","","export function useAuth() {"," const [auth, setAuth] = useState<AuthState>({"," user: null,"," isLoggedIn: false,"," });",""," const login = useCallback((username: string) => {"," setAuth({ user: username, isLoggedIn: true });"," }, []);",""," const logout = useCallback(() => {"," setAuth({ user: null, isLoggedIn: false });"," }, []);",""," return { ...auth, login, logout };","}"],"index.ts":['export { App } from "./components/App";','export { Header } from "./components/Header";','export { useAuth } from "./hooks/useAuth";'],"main.ts":['import { createElement, createRoot } from "specifyjs";','import { App } from "./components/App";',"","const root = createRoot(",' document.getElementById("root")!',");","","root.render("," createElement(App, {",' title: "My SpecifyJS App",'," version: 1,"," }),",");"],"types.ts":["export interface User {"," id: string;"," name: string;"," email: string;",' role: "admin" | "user" | "guest";',"}","","export interface Config {"," apiUrl: string;"," debug: boolean;"," maxRetries: number;","}","","export type EventHandler<T = void> = (event: T) => void;"],"package.json":["{",' "name": "specifyjs-app",',' "version": "1.0.0",',' "scripts": {',' "dev": "vite",',' "build": "tsc && vite build",',' "preview": "vite preview"'," }","}"],"tsconfig.json":["{",' "compilerOptions": {',' "target": "ES2020",',' "module": "ESNext",',' "strict": true,',' "jsx": "preserve"'," },",' "include": ["src"]',"}"]},hi=On["App.ts"],Sc=new Set(["import","export","from","const","let","var","function","return","if","else","for","while","class","new","throw","try","catch","finally","typeof","instanceof","in","of","default","switch","case","break","continue","do","void","delete","yield","async","await"]),vc=new Set(["string","number","boolean","void","null","undefined","any","never","unknown","object","interface","type","enum"]),bi="#569cd6",wc="#ce9178",kc="#4ec9b0",Cc="#6a9955",Mc="#dcdcaa",_n="#d4d4d4",Ec="#d4d4d4",Ic="#b5cea8";function Rc(e){if(!e.trim())return[{text:"\xA0",color:_n}];let t=[],n=0;for(;n<e.length;){if(e[n]==="/"&&e[n+1]==="/"){t.push({text:e.slice(n),color:Cc});break}if(e[n]==='"'||e[n]==="'"||e[n]==="`"){let r=e[n],i=n+1;for(;i<e.length&&e[i]!==r;)e[i]==="\\"&&i++,i++;i=Math.min(i+1,e.length),t.push({text:e.slice(n,i),color:wc}),n=i;continue}if(/[0-9]/.test(e[n])&&(n===0||/[\s(,=:[\]{}+\-*/]/.test(e[n-1]))){let r=n;for(;r<e.length&&/[0-9.]/.test(e[r]);)r++;t.push({text:e.slice(n,r),color:Ic}),n=r;continue}if(/[a-zA-Z_$]/.test(e[n])){let r=n;for(;r<e.length&&/[a-zA-Z0-9_$]/.test(e[r]);)r++;let i=e.slice(n,r),s=r;for(;s<e.length&&e[s]===" ";)s++;let a=s<e.length&&e[s]==="(",l=_n;Sc.has(i)?l=bi:vc.has(i)?l=kc:a?l=Mc:(i==="true"||i==="false")&&(l=bi),t.push({text:i,color:l}),n=r;continue}if(e[n]===" "||e[n]===" "){let r=n;for(;r<e.length&&(e[r]===" "||e[r]===" ");)r++;t.push({text:e.slice(n,r),color:_n}),n=r;continue}t.push({text:e[n],color:Ec}),n++}return t}function Kt(e){let[t,n]=G("App.ts"),[r,i]=G({src:!0,components:!0,hooks:!0}),[s,a]=G(-1),[l,d]=G(hi.length),u=oe(null),h=v(Y=>{n(Y);let H=On[Y];H&&d(H.length)},[]),m=v(Y=>{i(H=>{let Z={},ee=Object.keys(H);for(let se=0;se<ee.length;se++)Z[ee[se]]=H[ee[se]];return Z[Y]=!H[Y],Z})},[]),c=v(Y=>{a(H=>H===Y?-1:Y)},[]),p=v(Y=>{switch(Y){case"undo":document.execCommand("undo",!1);break;case"redo":document.execCommand("redo",!1);break;case"cut":document.execCommand("cut",!1);break;case"copy":document.execCommand("copy",!1);break;case"paste":document.execCommand("paste",!1);break;case"newFile":u.current&&(u.current.textContent="",d(1));break;default:break}a(-1),u.current&&u.current.focus()},[]),f=v(()=>{if(u.current){let H=(u.current.textContent??"").split(`
|
|
8
|
-
`);d(Math.max(H.length,1))}},[]),y=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'"Segoe UI", Roboto, Arial, sans-serif',fontSize:"13px",color:"#cccccc",backgroundColor:"#1e1e1e",overflow:"hidden"}),[]),x={height:"30px",backgroundColor:"#323233",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",color:"#999",flexShrink:"0",borderBottom:"1px solid var(--color-border, #252526)"},g={height:"28px",backgroundColor:"#3c3c3c",display:"flex",alignItems:"center",padding:"0 8px",gap:"2px",flexShrink:"0",position:"relative"},b={padding:"3px 8px",fontSize:"12px",color:"#cccccc",cursor:"pointer",borderRadius:"3px",backgroundColor:"transparent",border:"none",position:"relative"},S={...b,backgroundColor:"rgba(255,255,255,0.1)"},D={position:"absolute",top:"100%",left:"0",minWidth:"180px",backgroundColor:"#2d2d2d",border:"1px solid #454545",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.4)",padding:"4px 0",zIndex:"1000"},z={display:"block",width:"100%",padding:"6px 16px",fontSize:"12px",color:"#cccccc",backgroundColor:"transparent",border:"none",textAlign:"left",cursor:"pointer",transition:"background 0.1s"},M={flex:"1",display:"flex",overflow:"hidden"},$={width:"220px",backgroundColor:"#252526",borderRight:"none",display:"flex",flexDirection:"column",flexShrink:"0",overflowY:"auto"},L={width:"1px",backgroundColor:"#007acc",cursor:"col-resize",flexShrink:"0",opacity:"0.4",transition:"opacity 0.2s"},R={padding:"8px 12px",fontSize:"11px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.5px",color:"#bbbbbb"},P=(Y,H,Z)=>({padding:"3px 8px",paddingLeft:`${12+Y*16}px`,fontSize:"13px",cursor:"pointer",color:H?"#cccccc":"#d4d4d4",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:"3px",margin:"0 4px",transition:"background-color 0.1s",backgroundColor:Z?"rgba(255,255,255,0.08)":"transparent"}),B={flex:"1",display:"flex",flexDirection:"column",overflow:"hidden"},I={height:"35px",backgroundColor:"#252526",display:"flex",alignItems:"center",flexShrink:"0"},F={padding:"0 16px",height:"35px",lineHeight:"35px",backgroundColor:"#1e1e1e",color:"#ffffff",fontSize:"13px",cursor:"pointer",border:"none",borderBottom:"2px solid #007acc",boxSizing:"border-box"},A={flex:"1",display:"flex",overflow:"auto",backgroundColor:"#1e1e1e",fontFamily:'"Cascadia Code", "Fira Code", "Consolas", monospace',fontSize:"13px",lineHeight:"20px"},k={padding:"8px 0",textAlign:"right",color:"#858585",userSelect:"none",minWidth:"48px",paddingRight:"12px",paddingLeft:"12px",flexShrink:"0"},w={padding:"8px 0",flex:"1",whiteSpace:"pre",overflowX:"auto",outline:"none",color:"#d4d4d4"},E={width:"60px",backgroundColor:"#1e1e1e",borderLeft:"1px solid var(--color-border, #252526)",flexShrink:"0",padding:"8px 4px",display:"flex",flexDirection:"column",gap:"2px",position:"relative"},C={height:"22px",backgroundColor:"#007acc",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",fontSize:"12px",color:"#ffffff",flexShrink:"0"},N={cursor:"pointer",padding:"0 6px",borderRadius:"3px",transition:"background-color 0.15s"},T=8,W=30,_=On[t]??hi,O=_.map((Y,H)=>{let Z=Rc(Y),ee=[],se=0;for(let Q of Z)ee.push(o("span",{key:String(se++),style:{color:Q.color}},Q.text));return o("div",{key:String(H),style:{minHeight:"20px"}},...ee)}),U=Math.max(l,_.length),K=[];for(let Y=0;Y<U;Y++)K.push(o("div",{key:String(Y)},String(Y+1)));let te=Y=>{if(!Y.parent)return!0;if(!r[Y.parent])return!1;let H=mi.find(Z=>Z.name===Y.parent&&Z.isFolder);return H?te(H):!0},J=yc.map((Y,H)=>{let Z=[Y],ee=s===H;return ee&&gi[Y]&&Z.push(o("div",{key:"dropdown",style:D,className:"ide__menu-dropdown"},...gi[Y].map((se,Q)=>o("button",{key:String(Q),style:z,onClick:le=>{le.stopPropagation(),p(se.action)},role:"menuitem"},se.label)))),o("button",{key:String(H),style:ee?S:b,role:"menuitem","aria-label":Y,onClick:()=>c(H)},...Z)}),j=mi.map((Y,H)=>{if(!te(Y))return null;let Z=!Y.isFolder&&Y.name===t,ee=Y.isFolder?r[Y.name]?"\u{1F4C2} ":"\u{1F4C1} ":"\u{1F4C4} ";return o("div",{key:String(H),style:P(Y.indent,Y.isFolder,Z),onClick:Y.isFolder?()=>m(Y.name):()=>h(Y.name)},ee,Y.name)}).filter(Y=>Y!==null);return o("div",{className:`ide ${e.className??""}`.trim(),style:y},o("div",{className:"ide__title-bar",style:x},"SpecifyJS IDE"),o("div",{className:"ide__menu-bar",style:g,role:"menubar"},...J),o("div",{style:M},o("nav",{className:"ide__sidebar",style:$,"aria-label":"File explorer"},o("div",{style:R},"Explorer"),...j),o("div",{style:L}),o("div",{style:B},o("div",{style:I},o("button",{style:F,"aria-label":t},t)),o("div",{style:A},o("div",{style:k,"aria-hidden":"true"},...K),o("code",{style:w,contentEditable:"true",ref:u,onInput:f,suppressContentEditableWarning:!0},...O))),o("div",{className:"ide__minimap",style:E,"aria-hidden":"true"},o("div",{style:{position:"absolute",top:`${T}px`,left:"0",right:"0",height:`${W}px`,backgroundColor:"rgba(100, 100, 200, 0.15)",border:"1px solid rgba(100, 100, 200, 0.3)",borderRadius:"2px",pointerEvents:"none"}}),..._.map((Y,H)=>o("div",{key:String(H),style:{height:"2px",backgroundColor:Y.trim()?"#555555":"transparent",borderRadius:"1px",width:`${Math.min(100,Y.length*2)}%`}})))),o("div",{className:"ide__status-bar",style:C},o("div",{style:{display:"flex",gap:"16px"}},o("span",{style:N},"\u2387 main"),o("span",{style:N},"0 errors"),o("span",{style:N},"0 warnings")),o("div",{style:{display:"flex",gap:"16px"}},o("span",{style:N},"Ln 1, Col 1"),o("span",{style:N},"UTF-8"),o("span",{style:N},"TypeScript"))))}var Pc=[{symbol:"AAPL",price:189.42,change:1.23,volume:523e5,spark:[186,187,188,187,189]},{symbol:"GOOGL",price:141.8,change:-.87,volume:231e5,spark:[143,142,141,142,141]},{symbol:"MSFT",price:378.91,change:2.45,volume:187e5,spark:[375,376,378,377,379]},{symbol:"AMZN",price:185.63,change:-1.12,volume:314e5,spark:[187,186,186,185,185]},{symbol:"TSLA",price:248.5,change:3.78,volume:672e5,spark:[244,245,247,246,249]},{symbol:"NVDA",price:875.3,change:12.5,volume:418e5,spark:[860,865,870,868,876]}],xi=[{price:189.4,qty:1200},{price:189.38,qty:3400},{price:189.35,qty:800},{price:189.32,qty:5600},{price:189.3,qty:2100},{price:189.28,qty:4300}],yi=[{price:189.44,qty:900},{price:189.47,qty:2200},{price:189.5,qty:1500},{price:189.53,qty:3800},{price:189.55,qty:1100},{price:189.58,qty:2700}],Si=[{symbol:"AAPL",qty:100,avgPrice:185.2,currentPrice:189.42,pnl:422},{symbol:"MSFT",qty:50,avgPrice:382.1,currentPrice:378.91,pnl:-159.5},{symbol:"NVDA",qty:25,avgPrice:850,currentPrice:875.3,pnl:632.5}],$c=[{time:"14:32:01",symbol:"AAPL",side:"BUY",qty:50,price:189.42},{time:"14:31:45",symbol:"MSFT",side:"SELL",qty:25,price:378.95},{time:"14:30:22",symbol:"TSLA",side:"BUY",qty:100,price:247.8},{time:"14:29:58",symbol:"NVDA",side:"BUY",qty:10,price:874.5},{time:"14:28:33",symbol:"GOOGL",side:"SELL",qty:75,price:142.1}],Tc=[185.2,186.1,185.8,187.5,188.2,187.9,186.5,187.8,188.4,189.1,188.6,187.2,188.5,189.8,189.2,188.9,189.5,190.1,189.4,188.8,189.6,190.3,189.9,189.42],vi=[{price:189.4,volume:1200},{price:189.35,volume:3400},{price:189.3,volume:2800},{price:189.25,volume:5100},{price:189.2,volume:4200}],wi=[{price:189.45,volume:900},{price:189.5,volume:2600},{price:189.55,volume:1800},{price:189.6,volume:4400},{price:189.65,volume:3100}],ki=["09:30","10:00","10:30","11:00","11:30","12:00"];function Dc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Lt(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function Ve(e){return e.toFixed(2)}var vt={backgroundColor:"#1a1a2e",borderRadius:"4px",padding:"12px",border:"1px solid #2a2a4a",overflow:"auto",display:"flex",flexDirection:"column"},wt={fontSize:"12px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.5px",color:"#8888aa",marginBottom:"8px",flexShrink:"0"},Zt={width:"100%",borderCollapse:"collapse",fontSize:"12px"},Ne={textAlign:"left",padding:"4px 6px",borderBottom:"1px solid #2a2a4a",color:"#8888aa",fontWeight:"600",fontSize:"11px"},We={padding:"3px 6px",borderBottom:"1px solid #16162a",color:"#ccccdd",fontSize:"12px"},Jt={cursor:"default",transition:"background-color 0.1s"};function zc(e,t){let i=Math.min(...e),a=Math.max(...e)-i||1,l=e.map((u,h)=>{let m=h/(e.length-1)*40,c=14-(u-i)/a*14;return`${m.toFixed(1)},${c.toFixed(1)}`}).join(" ");return o("svg",{viewBox:"0 0 40 14",style:{width:"40px",height:"14px",display:"inline-block",verticalAlign:"middle",marginLeft:"4px"},"aria-hidden":"true"},o("polyline",{points:l,fill:"none",stroke:t?"#00c853":"#ff1744",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))}function Ac(e,t){let u=Math.min(...e),h=Math.max(...e),m=h-u||1,c=310/(e.length-1),p=e.map((M,$)=>{let L=40+$*c,R=15+(1-(M-u)/m)*120;return{x:L,y:R}}),f=p.map(M=>`${M.x.toFixed(1)},${M.y.toFixed(1)}`).join(" "),y="M40,135 "+p.map(M=>`L${M.x.toFixed(1)},${M.y.toFixed(1)}`).join(" ")+` L${p[p.length-1].x.toFixed(1)},135 Z`,x=[];for(let M=1;M<e.length;M++){let $=e[M]>=e[M-1]?"#00c853":"#ff1744";x.push(o("line",{key:String(M),x1:String(p[M-1].x.toFixed(1)),y1:String(p[M-1].y.toFixed(1)),x2:String(p[M].x.toFixed(1)),y2:String(p[M].y.toFixed(1)),stroke:$,strokeWidth:"2",strokeLinecap:"round"}))}let g=[];for(let M=0;M<5;M++){let $=15+M/4*120,L=h-M/4*m;g.push(o("line",{key:`g${M}`,x1:String(40),y1:String($.toFixed(1)),x2:String(350),y2:String($.toFixed(1)),stroke:"#2a2a4a",strokeWidth:"0.5",strokeDasharray:"3,3"})),g.push(o("text",{key:`yl${M}`,x:String(36),y:String(($+3).toFixed(1)),fill:"#6666aa",fontSize:"8",textAnchor:"end",fontFamily:"monospace"},Ve(L)))}let b=[],S=Math.min(ki.length,e.length),D=(e.length-1)/(S-1);for(let M=0;M<S;M++){let L=40+Math.round(M*D)*c;b.push(o("text",{key:`tl${M}`,x:String(L.toFixed(1)),y:String(156),fill:"#6666aa",fontSize:"8",textAnchor:"middle",fontFamily:"monospace"},ki[M]))}let z="chartGrad";return o("div",{style:vt},o("div",{style:wt},"AAPL ",o("span",{style:{color:"#00c853",fontSize:"14px",fontWeight:"700"}},`$${Ve(t)}`),o("span",{style:{color:"#00c853",fontSize:"11px",marginLeft:"8px"}},"+1.23%")),o("svg",{viewBox:"0 0 360 160",style:{width:"100%",flex:"1",minHeight:"0"},"aria-label":"Price chart",role:"img"},o("defs",null,o("linearGradient",{id:z,x1:"0",y1:"0",x2:"0",y2:"1"},o("stop",{offset:"0%",stopColor:"#00c853",stopOpacity:"0.3"}),o("stop",{offset:"100%",stopColor:"#00c853",stopOpacity:"0.02"}))),o("path",{d:y,fill:`url(#${z})`}),...g,...b,...x,o("line",{x1:String(40),y1:String((15+(1-(t-u)/m)*120).toFixed(1)),x2:String(350),y2:String((15+(1-(t-u)/m)*120).toFixed(1)),stroke:"#00c853",strokeWidth:"0.5",strokeDasharray:"4,2",opacity:"0.6"})))}function Lc(){let e=Math.max(...xi.map(t=>t.qty),...yi.map(t=>t.qty));return o("div",{style:vt},o("div",{style:wt},"Order Book"),o("table",{style:Zt},o("thead",null,o("tr",null,o("th",{style:Ne},"Bid Price"),o("th",{style:Ne},"Qty"),o("th",{style:Ne},"Ask Price"),o("th",{style:Ne},"Qty"))),o("tbody",null,...xi.map((t,n)=>{let r=yi[n],i=t.qty/e*.25,s=(r?.qty??0)/e*.25;return o("tr",{key:String(n),style:Jt},o("td",{style:{...We,color:"#00c853",backgroundColor:`rgba(0,200,83,${i.toFixed(3)})`,fontFamily:"monospace"}},Ve(t.price)),o("td",{style:{...We,backgroundColor:`rgba(0,200,83,${(i*.5).toFixed(3)})`,fontFamily:"monospace"}},Lt(t.qty)),o("td",{style:{...We,color:"#ff1744",backgroundColor:`rgba(255,23,68,${s.toFixed(3)})`,fontFamily:"monospace"}},r?Ve(r.price):""),o("td",{style:{...We,backgroundColor:`rgba(255,23,68,${(s*.5).toFixed(3)})`,fontFamily:"monospace"}},r?Lt(r.qty):""))}))))}function Bc(e){return o("div",{style:vt},o("div",{style:wt},"Watchlist"),o("table",{style:Zt},o("thead",null,o("tr",null,o("th",{style:Ne},"Symbol"),o("th",{style:Ne},"Price"),o("th",{style:Ne},"Chg%"),o("th",{style:Ne},"Volume"))),o("tbody",null,...Pc.map((t,n)=>{let r=t.price+(n===0?e:0),i=t.change>=0;return o("tr",{key:String(n),style:Jt},o("td",{style:{...We,fontWeight:"600",color:"#ffffff"}},t.symbol,zc(t.spark,i)),o("td",{style:{...We,fontFamily:"monospace"}},Ve(r)),o("td",{style:{...We,color:i?"#00c853":"#ff1744",fontWeight:"600"}},`${i?"+":""}${Ve(t.change)}%`),o("td",{style:{...We,fontFamily:"monospace",color:"#8888aa"}},Dc(t.volume)))}))))}function Fc(){let e=Si.reduce((n,r)=>n+r.pnl,0),t=e>=0;return o("div",{style:vt},o("div",{style:wt},"Positions",o("span",{style:{marginLeft:"12px",color:t?"#00c853":"#ff1744",fontWeight:"700",fontSize:"12px"}},`${t?"+":""}$${Ve(e)}`)),o("table",{style:Zt},o("thead",null,o("tr",null,o("th",{style:Ne},"Symbol"),o("th",{style:Ne},"Qty"),o("th",{style:Ne},"Avg"),o("th",{style:Ne},"P&L"))),o("tbody",null,...Si.map((n,r)=>{let i=n.pnl>=0;return o("tr",{key:String(r),style:{...Jt,backgroundColor:i?"rgba(0,200,83,0.04)":"rgba(255,23,68,0.04)"}},o("td",{style:{...We,fontWeight:"600",color:"#ffffff"}},n.symbol),o("td",{style:{...We,fontFamily:"monospace"}},String(n.qty)),o("td",{style:{...We,fontFamily:"monospace"}},Ve(n.avgPrice)),o("td",{style:{...We,color:i?"#00c853":"#ff1744",fontWeight:"700",fontFamily:"monospace"}},`${i?"+":""}$${Ve(n.pnl)}`))}))))}function Nc(){return o("div",{style:vt},o("div",{style:wt},"Recent Trades"),o("table",{style:Zt},o("thead",null,o("tr",null,o("th",{style:Ne},"Time"),o("th",{style:Ne},"Sym"),o("th",{style:Ne},"Side"),o("th",{style:Ne},"Qty"),o("th",{style:Ne},"Price"))),o("tbody",null,...$c.map((e,t)=>{let n=e.side==="BUY";return o("tr",{key:String(t),style:Jt},o("td",{style:{...We,color:"#8888aa",fontFamily:"monospace"}},e.time),o("td",{style:{...We,fontWeight:"600",color:"#ffffff"}},e.symbol),o("td",{style:{...We,color:n?"#00c853":"#ff1744",fontWeight:"600"}},e.side),o("td",{style:{...We,fontFamily:"monospace"}},Lt(e.qty)),o("td",{style:{...We,fontFamily:"monospace"}},Ve(e.price)))}))))}function Wc(){let e=Math.max(...vi.map(n=>n.volume),...wi.map(n=>n.volume)),t="16px";return o("div",{style:vt},o("div",{style:wt},"Market Depth"),o("div",{style:{flex:"1",display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"}},...vi.map((n,r)=>o("div",{key:`b${r}`,style:{display:"flex",alignItems:"center",gap:"6px"}},o("span",{style:{width:"52px",fontSize:"11px",color:"#8888aa",textAlign:"right",fontFamily:"monospace"}},Ve(n.price)),o("div",{style:{height:t,width:`${n.volume/e*100}%`,backgroundColor:"#00c853",opacity:"0.6",borderRadius:"2px",maxWidth:"60%",transition:"width 0.3s"}}),o("span",{style:{fontSize:"11px",color:"#ccccdd",fontFamily:"monospace"}},Lt(n.volume)))),o("div",{style:{height:"1px",backgroundColor:"#2a2a4a",margin:"4px 0"}}),...wi.map((n,r)=>o("div",{key:`a${r}`,style:{display:"flex",alignItems:"center",gap:"6px"}},o("span",{style:{width:"52px",fontSize:"11px",color:"#8888aa",textAlign:"right",fontFamily:"monospace"}},Ve(n.price)),o("div",{style:{height:t,width:`${n.volume/e*100}%`,backgroundColor:"#ff1744",opacity:"0.6",borderRadius:"2px",maxWidth:"60%",transition:"width 0.3s"}}),o("span",{style:{fontSize:"11px",color:"#ccccdd",fontFamily:"monospace"}},Lt(n.volume))))))}function Qt(e){let[t,n]=G(0),[r,i]=G("--:--:--"),[s,a]=G(!0);ae(()=>{let p=setInterval(()=>{n(f=>{let y=(Math.random()-.5)*.5;return Math.round(y*100)/100})},2e3);return()=>clearInterval(p)},[]),ae(()=>{let p=()=>{let y=new Date,x=String(y.getHours()).padStart(2,"0"),g=String(y.getMinutes()).padStart(2,"0"),b=String(y.getSeconds()).padStart(2,"0");i(`${x}:${g}:${b}`)};p();let f=setInterval(p,1e3);return()=>clearInterval(f)},[]),ae(()=>{let p=setInterval(()=>{a(f=>!f)},800);return()=>clearInterval(p)},[]);let l=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'"Inter", "Segoe UI", Roboto, sans-serif',fontSize:"13px",color:"#ccccdd",backgroundColor:"#0d0d1a",overflow:"hidden"}),[]),d={height:"40px",backgroundColor:"#12122a",borderBottom:"1px solid #2a2a4a",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px",flexShrink:"0"},u={fontSize:"14px",fontWeight:"700",color:"#ffffff",letterSpacing:"0.5px",display:"flex",alignItems:"center",gap:"8px"},h={flex:"1",display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr",gap:"8px",padding:"8px",overflow:"hidden"},m=189.42+t,c={width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"#00c853",display:"inline-block",marginRight:"4px",opacity:s?"1":"0.3",transition:"opacity 0.3s"};return o("div",{className:`trading-dashboard ${e.className??""}`.trim(),style:l},o("header",{className:"trading-dashboard__header",style:d},o("span",{style:u},"SpecifyJS Trading Platform",o("span",{style:{display:"flex",alignItems:"center",fontSize:"11px",color:"#00c853",fontWeight:"600",marginLeft:"8px"}},o("span",{style:c}),"LIVE")),o("div",{style:{display:"flex",alignItems:"center",gap:"16px",fontSize:"12px"}},o("span",{style:{color:"#ffffff",fontFamily:"monospace",fontWeight:"600",fontSize:"13px"}},r),o("span",{style:{color:"#8888aa"}},"Account: SJS-28401"),o("span",{style:{color:"#00c853"}},"Balance: $124,582.30"),o("span",{style:{color:"#8888aa"}},"Status: Connected"))),o("div",{className:"trading-dashboard__grid",style:h},Ac(Tc,m),Lc(),Bc(t),Fc(),Nc(),Wc()))}function Le(e){return e.type==="card"}function ze(e){return e.type==="container"}function Ze(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Je(e){return Le(e)?e.card_id:e.container_id}var _c={low:"#22c55e",medium:"#f59e0b",high:"#f97316",critical:"#ef4444"},Hn=[{label:"Text",value:"text"},{label:"JSON",value:"json"},{label:"Task",value:"task"},{label:"Project",value:"project"}];function Oc(e){let t=e.content;return o("div",{style:{fontSize:"12px",color:"#555555",lineHeight:"1.4",overflow:"hidden",flex:"1"},"data-testid":`card-text-content-${e.card_id}`},t.text||"")}function Hc(e){let t=e.content,r=Object.entries(t).map(([i,s],a)=>o("div",{key:String(a),style:{display:"flex",gap:"4px",fontSize:"11px",lineHeight:"1.6",borderBottom:"1px solid rgba(0,0,0,0.05)",padding:"2px 0"}},o("span",{style:{fontWeight:"600",color:"#374151",minWidth:"60px"}},`${i}:`),o("span",{style:{color:"#555555"}},String(s??""))));return o("div",{style:{flex:"1",overflow:"auto"},"data-testid":`card-json-content-${e.card_id}`},...r)}function Yc(e){return o("div",{style:{fontSize:"12px",color:"#9ca3af",fontStyle:"italic",flex:"1",display:"flex",alignItems:"center",justifyContent:"center"},"data-testid":`card-task-content-${e.card_id}`},"Task card (coming soon)")}function Vc(e,t){let n=e.content;return o("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"4px 16px",borderRadius:"999px",backgroundColor:e.color||"#e0e7ff",fontSize:"13px",fontWeight:"600",color:"#1e3a5f",cursor:"pointer",flex:"1"},onDblClick:r=>{r.preventDefault(),r.stopPropagation(),t&&n.project_id&&t(n.project_id)},"data-testid":`card-project-content-${e.card_id}`},n.project_name||"Untitled Project")}function Ci(e){let{card:t,selected:n=!1,onSelect:r,onMove:i,onResize:s,onDelete:a,dispatch:l,onOpenProject:d,onCardContextMenu:u,onUpdate:h,onDragStart:m,onDragEnd:c,onAnchorDragStart:p}=e,[f,y]=G(!1),[x,g]=G(!1),[b,S]=G(null),[D,z]=G(!1),[M,$]=G(!1),[L,R]=G(!1),[P,B]=G(t.card_title||""),[I,F]=G(""),A=oe(null),k=oe(null),w=t.priority?_c[t.priority]||"#94a3b8":"transparent",E=v(X=>{let ie=X;ie.preventDefault(),ie.stopPropagation(),S({x:ie.clientX,y:ie.clientY}),z(!1),u&&u(t.card_id,{x:ie.clientX,y:ie.clientY})},[u,t.card_id]),C=v(()=>{S(null),z(!1)},[]),N=v(X=>{let ie=X,he=ie.target;if(he.dataset&&(he.dataset.role==="delete"||he.dataset.role==="resize"||he.dataset.role==="drag-handle"||he.dataset.role==="inline-edit"||he.dataset.role==="anchor"))return;ie.preventDefault(),ie.stopPropagation(),r&&r(t.card_id),A.current={x:ie.clientX,y:ie.clientY,cardX:t.position.x,cardY:t.position.y},m&&m(t.card_id),g(!0);let be=Ee=>{let Ce=Ee;if(!A.current)return;let ke=Ce.clientX-A.current.x,Ie=Ce.clientY-A.current.y;i&&i(t.card_id,{x:A.current.cardX+ke,y:A.current.cardY+Ie})},Se=()=>{A.current=null,g(!1),c&&c(t.card_id),document.removeEventListener("mousemove",be),document.removeEventListener("mouseup",Se)};document.addEventListener("mousemove",be),document.addEventListener("mouseup",Se)},[t.card_id,t.position.x,t.position.y,r,i,m,c]),T=v(X=>{let ie=X;ie.preventDefault(),ie.stopPropagation(),k.current={x:ie.clientX,y:ie.clientY,w:t.size.width,h:t.size.height};let he=Se=>{let Ee=Se;if(!k.current)return;let Ce=Ee.clientX-k.current.x,ke=Ee.clientY-k.current.y,Ie=Math.max(120,k.current.w+Ce),Te=Math.max(80,k.current.h+ke);s&&s(t.card_id,{width:Ie,height:Te})},be=()=>{k.current=null,document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",be)};document.addEventListener("mousemove",he),document.addEventListener("mouseup",be)},[t.card_id,t.size.width,t.size.height,s]),W=v(X=>{X.preventDefault(),X.stopPropagation(),a&&a(t.card_id)},[t.card_id,a]),_=v(X=>{let ie=X;ie.preventDefault(),ie.stopPropagation();let be=ie.target.dataset.anchor;if(!be||!p)return;let Se=t.position.x,Ee=t.position.y,Ce=t.size.width,ke=t.size.height,Ie=Se+Ce/2,Te=Ee+ke/2;be==="top"?(Ie=Se+Ce/2,Te=Ee):be==="right"?(Ie=Se+Ce,Te=Ee+ke/2):be==="bottom"?(Ie=Se+Ce/2,Te=Ee+ke):be==="left"&&(Ie=Se,Te=Ee+ke/2),p(t.card_id,be,{x:Ie,y:Te})},[t.card_id,t.position.x,t.position.y,t.size.width,t.size.height,p]),O=v(X=>{l&&l({type:"CHANGE_CARD_TYPE",cardId:t.card_id,newType:X}),C()},[t.card_id,l,C]),U=v(X=>{X.preventDefault(),X.stopPropagation(),B(t.card_title||""),$(!0)},[t.card_title]),K=v(()=>{$(!1),h&&P!==t.card_title&&h(t.card_id,{card_title:P})},[h,t.card_id,t.card_title,P]),te=v(X=>{let ie=X;ie.key==="Enter"?(ie.preventDefault(),K()):ie.key==="Escape"&&(ie.preventDefault(),$(!1),B(t.card_title||""))},[K,t.card_title]),J=v(X=>{let ie=X.target;B(ie.value)},[]),V=v(X=>{X.stopPropagation();let ie=t.content;F(ie.text||""),R(!0)},[t.content]),j=v(()=>{R(!1),h&&h(t.card_id,{content:{text:I}})},[h,t.card_id,I]),Y=v(X=>{let ie=X;if(ie.key==="Escape"){ie.preventDefault(),R(!1);let he=t.content;F(he.text||"")}},[t.content]),H=v(X=>{let ie=X.target;F(ie.value)},[]),Z;switch(t.card_type){case"text":L?Z=o("textarea",{"data-role":"inline-edit","data-testid":`card-desc-edit-${t.card_id}`,value:I,onInput:H,onBlur:j,onKeyDown:Y,onFocus:X=>{let ie=X.target;ie.setSelectionRange(ie.value.length,ie.value.length)},style:{fontSize:"12px",color:"#555555",lineHeight:"1.4",flex:"1",border:"1px solid #3b82f6",borderRadius:"3px",padding:"2px 4px",resize:"none",outline:"none",fontFamily:"inherit",backgroundColor:"#fff",width:"100%",boxSizing:"border-box"}}):Z=o("div",{style:{fontSize:"12px",color:"#555555",lineHeight:"1.4",overflow:"hidden",flex:"1",cursor:"text"},"data-testid":`card-text-content-${t.card_id}`,onClick:V},t.content.text||"");break;case"json":Z=Hc(t);break;case"task":Z=Yc(t);break;case"project":Z=Vc(t,d);break;default:Z=Oc(t)}let ee=t.card_type==="project",se={position:"absolute",left:`${t.position.x}px`,top:`${t.position.y}px`,width:`${t.size.width}px`,height:`${t.size.height}px`,backgroundColor:t.color||"#fef9c3",borderRadius:ee?"999px":"6px",borderLeft:`4px solid ${w}`,boxShadow:n?"0 0 0 2px #3b82f6, 0 4px 12px rgba(0,0,0,0.15)":"0 2px 8px rgba(0,0,0,0.1)",cursor:"grab",userSelect:"none",overflow:"hidden",display:"flex",flexDirection:"column",padding:"8px 10px",boxSizing:"border-box",transition:"box-shadow 150ms ease",zIndex:x?"9999":"1"},Q={fontWeight:"600",fontSize:"14px",color:"#1a1a1a",marginBottom:"4px",lineHeight:"1.3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},le={position:"absolute",top:"4px",right:"4px",width:"18px",height:"18px",borderRadius:"50%",backgroundColor:"rgba(0,0,0,0.15)",color:"#333",fontSize:"12px",lineHeight:"18px",textAlign:"center",cursor:"pointer",display:f?"block":"none",border:"none",padding:"0"},ce={position:"absolute",bottom:"0",right:"0",width:"12px",height:"12px",cursor:"nwse-resize",opacity:"0.4",background:"linear-gradient(135deg, transparent 50%, #666 50%)"},ue={position:"absolute",top:"4px",right:"24px",width:"18px",height:"18px",borderRadius:"3px",backgroundColor:"rgba(0,0,0,0.1)",color:"#333",fontSize:"10px",lineHeight:"18px",textAlign:"center",cursor:"grab",display:f?"block":"none",border:"none",padding:"0"},re=8,ge={position:"absolute",width:`${re}px`,height:`${re}px`,borderRadius:"50%",backgroundColor:"#3b82f6",border:"2px solid #fff",boxSizing:"border-box",cursor:"crosshair",display:f?"block":"none",zIndex:"10"},ne=[{anchor:"top",style:{...ge,top:`${-re/2}px`,left:"50%",marginLeft:`${-re/2}px`}},{anchor:"right",style:{...ge,top:"50%",right:`${-re/2}px`,marginTop:`${-re/2}px`}},{anchor:"bottom",style:{...ge,bottom:`${-re/2}px`,left:"50%",marginLeft:`${-re/2}px`}},{anchor:"left",style:{...ge,top:"50%",left:`${-re/2}px`,marginTop:`${-re/2}px`}}].map((X,ie)=>o("div",{key:`anchor-${X.anchor}`,style:X.style,"data-role":"anchor","data-anchor":X.anchor,"data-testid":`card-anchor-${X.anchor}-${t.card_id}`,onMouseDown:_})),de=t.assignee?o("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginTop:"4px",fontSize:"10px",color:"#555"},"data-testid":`card-assignee-${t.card_id}`},o("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:"#3b82f6",color:"#fff",fontSize:"9px",fontWeight:"700",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0"}},t.assignee.charAt(0).toUpperCase()),o("span",{},t.assignee)):null,fe=t.tags&&t.tags.length>0?o("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"}},...t.tags.map((X,ie)=>o("span",{key:String(ie),style:{fontSize:"10px",padding:"1px 4px",borderRadius:"3px",backgroundColor:"rgba(0,0,0,0.08)",color:"#444"}},X))):null,xe={padding:"6px 12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",whiteSpace:"nowrap"},ye={position:"absolute",left:"100%",top:"0",backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"120px"},we=b?o("div",{className:"card-context-menu",style:{position:"fixed",left:`${b.x}px`,top:`${b.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"10000",minWidth:"160px",fontSize:"13px",color:"#1a1a1a"},"data-testid":`card-context-menu-${t.card_id}`,role:"menu","aria-label":"Card context menu",onClick:X=>X.stopPropagation()},o("div",{style:xe,onClick:X=>{X.stopPropagation(),a&&a(t.card_id),C()},role:"menuitem","data-testid":`ctx-delete-${t.card_id}`},"Delete"),o("div",{style:{...xe,position:"relative"},onMouseEnter:()=>z(!0),role:"menuitem","aria-haspopup":"true","data-testid":`ctx-change-type-${t.card_id}`},"Change Type",o("span",{style:{marginLeft:"8px"}},"\u25B6"),D?o("div",{style:ye,role:"menu","data-testid":`ctx-type-submenu-${t.card_id}`},...Hn.map(X=>o("div",{key:X.value,style:{...xe,fontWeight:t.card_type===X.value?"700":"400"},onClick:ie=>{ie.stopPropagation(),O(X.value)},role:"menuitem","data-testid":`ctx-type-${X.value}-${t.card_id}`},X.label,t.card_type===X.value?" \u2713":""))):null)):null;return ee?o("div",{className:"board-card board-card--project",style:se,onMouseDown:N,onContextMenu:E,onMouseEnter:()=>y(!0),onMouseLeave:()=>{y(!1),C()},"data-card-id":t.card_id,"data-testid":`card-${t.card_id}`,role:"button","aria-label":`Project card: ${t.card_title}`,tabIndex:0},Z,o("div",{style:ue,"data-role":"drag-handle","data-testid":`card-drag-handle-${t.card_id}`,"aria-label":"Export drag handle",title:"Drag to export card"},"\u2630"),...ne,we):o("div",{className:"board-card",style:se,onMouseDown:N,onContextMenu:E,onMouseEnter:()=>y(!0),onMouseLeave:()=>{y(!1),C()},"data-card-id":t.card_id,"data-testid":`card-${t.card_id}`,role:"button","aria-label":`Card: ${t.card_title}`,tabIndex:0},M?o("input",{"data-role":"inline-edit","data-testid":`card-title-edit-${t.card_id}`,value:P,onInput:J,onBlur:K,onKeyDown:te,onFocus:X=>{let ie=X.target;ie.setSelectionRange(ie.value.length,ie.value.length)},style:{...Q,border:"1px solid #3b82f6",borderRadius:"3px",padding:"1px 4px",outline:"none",width:"100%",boxSizing:"border-box",backgroundColor:"#fff"}}):o("div",{style:Q,"data-testid":`card-title-${t.card_id}`,onDblClick:U},t.card_title||"Untitled"),Z,fe,de,o("div",{style:ue,"data-role":"drag-handle","data-testid":`card-drag-handle-${t.card_id}`,"aria-label":`Export drag handle for ${t.card_title}`,title:"Drag to export card"},"\u2630"),o("button",{style:le,"data-role":"delete","data-testid":`card-delete-${t.card_id}`,onClick:W,"aria-label":`Delete ${t.card_title}`,tabIndex:-1},"\xD7"),o("div",{style:ce,"data-role":"resize",onMouseDown:T,"aria-label":"Resize card"}),...ne,we)}function Mi(e){let{container:t,selected:n=!1,highlighted:r=!1,onSelect:i,onMove:s,onResize:a,onDelete:l,onDrop:d,onDragStart:u,onDragEnd:h,children:m}=e,[c,p]=G(!1),[f,y]=G(!1),[x,g]=G(!1),b=oe(null),S=oe(null),D=v(w=>{w.stopPropagation(),l&&l(t.container_id)},[t.container_id,l]),z=v(w=>{w.stopPropagation(),y(E=>!E)},[]),M=v(w=>{let E=w;E.preventDefault(),E.stopPropagation(),i&&i(t.container_id),u&&u(t.container_id),g(!0),b.current={x:E.clientX,y:E.clientY,posX:t.position.x,posY:t.position.y};let C=T=>{let W=T;if(!b.current)return;let _=W.clientX-b.current.x,O=W.clientY-b.current.y;s&&s(t.container_id,{x:b.current.posX+_,y:b.current.posY+O})},N=()=>{b.current=null,g(!1),h&&h(t.container_id),document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",N)};document.addEventListener("mousemove",C),document.addEventListener("mouseup",N)},[t.container_id,t.position.x,t.position.y,i,s,u,h]),$=v(w=>{let E=w;E.preventDefault(),E.stopPropagation(),S.current={x:E.clientX,y:E.clientY,w:t.size.width,h:t.size.height};let C=T=>{let W=T;if(!S.current)return;let _=W.clientX-S.current.x,O=W.clientY-S.current.y,U=Math.max(160,S.current.w+_),K=Math.max(120,S.current.h+O);a&&a(t.container_id,{width:U,height:K})},N=()=>{S.current=null,document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",N)};document.addEventListener("mousemove",C),document.addEventListener("mouseup",N)},[t.container_id,t.size.width,t.size.height,a]),L=v(w=>{w.preventDefault(),p(!0)},[]),R=v(()=>{p(!1)},[]),P=v(w=>{let E=w;if(E.preventDefault(),p(!1),d&&E.dataTransfer){let C=E.dataTransfer.getData("text/plain");C&&d(C,t.container_id)}},[t.container_id,d]),B=r||c,I={position:"absolute",left:`${t.position.x}px`,top:`${t.position.y}px`,width:`${t.size.width}px`,height:`${t.size.height}px`,backgroundColor:r?"#eff6ff":"#ffffff",border:r?"2px dashed #3b82f6":n?"2px solid #3b82f6":"2px solid #d1d5db",borderRadius:"8px",boxShadow:B?"0 0 0 3px rgba(59,130,246,0.3), 0 4px 16px rgba(0,0,0,0.1)":"0 2px 8px rgba(0,0,0,0.08)",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:x?"9999":"0",boxSizing:"border-box",transition:"border 150ms ease, background-color 150ms ease, box-shadow 150ms ease"},F={padding:"6px 12px",borderBottom:"1px solid #e5e7eb",backgroundColor:"#f9fafb",cursor:"grab",userSelect:"none",textAlign:"center",fontWeight:"700",fontSize:"15px",color:"#1f2937",flexShrink:"0"},A={flex:"1",overflow:"auto",position:"relative",padding:"4px"},k={position:"absolute",bottom:"0",right:"0",width:"14px",height:"14px",cursor:"nwse-resize",opacity:"0.4",background:"linear-gradient(135deg, transparent 50%, #666 50%)"};return o("div",{className:"board-container",style:I,"data-container-id":t.container_id,"data-testid":`container-${t.container_id}`,role:"group","aria-label":`Container: ${t.name}`,onDragOver:L,onDragLeave:R,onDrop:P},o("div",{className:"board-container__title",style:{...F,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseDown:M,"data-testid":`container-title-${t.container_id}`},o("span",null,t.name),o("span",{style:{display:"flex",gap:"4px"}},o("button",{style:{border:"none",backgroundColor:"transparent",cursor:"pointer",color:"#94a3b8",fontSize:"12px",padding:"0 2px",lineHeight:"1"},onClick:z,"aria-label":f?"Expand container":"Minimize container",title:f?"Expand":"Minimize"},f?"\u25B2":"\u2014"),o("button",{style:{border:"none",backgroundColor:"transparent",cursor:"pointer",color:"#94a3b8",fontSize:"14px",padding:"0 2px",lineHeight:"1"},onClick:D,"aria-label":"Delete container",title:"Delete"},"\xD7"))),f?null:o("div",{className:"board-container__contents",style:A,"data-testid":`container-contents-${t.container_id}`},m),f?null:o("div",{style:k,"data-role":"resize",onMouseDown:$,"aria-label":"Resize container"}))}function Ei(e){let t=e.position.x+e.size.width/2,n=e.position.y+e.size.height/2;return{top:{x:t,y:e.position.y},right:{x:e.position.x+e.size.width,y:n},bottom:{x:t,y:e.position.y+e.size.height},left:{x:e.position.x,y:n}}}function Uc(e,t){let n=Ei(e),r=Ei(t),i=[n.top,n.right,n.bottom,n.left],s=[r.top,r.right,r.bottom,r.left],a=1/0,l=n.right,d=r.left;for(let u=0;u<i.length;u++)for(let h=0;h<s.length;h++){let m=s[h].x-i[u].x,c=s[h].y-i[u].y,p=m*m+c*c;p<a&&(a=p,l=i[u],d=s[h])}return{from:l,to:d}}var Ii="board-card-link-arrowhead";function Ri(e){let{links:t,cards:n,selectedLinkId:r,onSelectLink:i,onLinkContextMenu:s,canvasWidth:a,canvasHeight:l}=e,d=new Map;for(let p=0;p<n.length;p++)d.set(n[p].card_id,n[p]);let u=v(p=>{i(p)},[i]),h=[];for(let p=0;p<t.length;p++){let{source:f,link:y}=t[p],x=d.get(y.target_card_id);if(!x)continue;let{from:g,to:b}=Uc(f,x),S=y.link_id===r,D=S?"#3b82f6":y.color||"#94a3b8",z=b.x-g.x,M=b.y-g.y,$=Math.sqrt(z*z+M*M),L=Math.min(40,$*.15),R=$>0?-M/$:0,P=$>0?z/$:0,B=(g.x+b.x)/2,I=(g.y+b.y)/2,F=B+R*L,A=I+P*L,k=`M ${g.x} ${g.y} Q ${F} ${A} ${b.x} ${b.y}`,w=f.card_id;h.push(o("path",{key:`hit-${y.link_id}`,d:k,fill:"none",stroke:"transparent","stroke-width":"12",style:{cursor:"pointer",pointerEvents:"stroke"},onClick:()=>u(y.link_id),onContextMenu:E=>{let C=E;C.preventDefault(),C.stopPropagation(),s&&s(y.link_id,w,{x:C.clientX,y:C.clientY})},"data-testid":`link-hit-${y.link_id}`})),h.push(o("path",{key:y.link_id,d:k,fill:"none",stroke:D,"stroke-width":S?"3":"2","pointer-events":"none","marker-end":`url(#${Ii})`,"data-testid":`link-${y.link_id}`})),y.link_name&&h.push(o("text",{key:`label-${y.link_id}`,x:String(F),y:String(A-6),"text-anchor":"middle",fill:"#64748b","font-size":"11","pointer-events":"none","data-testid":`link-label-${y.link_id}`},y.link_name))}let m={position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",overflow:"visible",zIndex:"9999"},c=o("defs",{},o("marker",{id:Ii,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse"},o("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#94a3b8"})));return o("svg",{style:m,width:String(a),height:String(l),className:"card-link-overlay","data-testid":"card-link-overlay",role:"img","aria-label":"Card links"},c,o("g",{style:{pointerEvents:"auto"}},...h))}var jc=[{value:"#fef9c3",label:"Yellow"},{value:"#fecaca",label:"Red"},{value:"#fed7aa",label:"Orange"},{value:"#bbf7d0",label:"Green"},{value:"#bfdbfe",label:"Blue"},{value:"#ddd6fe",label:"Purple"},{value:"#fbcfe8",label:"Pink"},{value:"#e5e7eb",label:"Gray"}],Yn=20,kt=5e3;function Gc(e,t){let n=new Set,r=[...e],i=null;for(;r.length>0;){let a=r.pop();if(ze(a)&&a.container_id===t){i=a;break}if(ze(a))for(let l=0;l<a.contents.length;l++)r.push(a.contents[l])}if(!i||!ze(i))return n;let s=[...i.contents];for(;s.length>0;){let a=s.pop();if(ze(a)){n.add(a.container_id);for(let l=0;l<a.contents.length;l++)s.push(a.contents[l])}}return n}function Xc(e,t,n,r){let i=new Set;if(r){i.add(r);let s=Gc(e,r);for(let a of s)i.add(a)}for(let s=0;s<e.length;s++){let a=e[s];if(ze(a)&&!i.has(a.container_id)&&t>=a.position.x&&t<=a.position.x+a.size.width&&n>=a.position.y&&n<=a.position.y+a.size.height)return a.container_id}return null}function Pi(e,t){return{x:Math.round(e.x/t)*t,y:Math.round(e.y/t)*t}}function $i(e,t,n){return{x:(e-n.panX)/n.zoom,y:(t-n.panY)/n.zoom}}function qc(e){let t=[],n=[],r=[];for(let i=e.length-1;i>=0;i--)r.push([e[i],0,0]);for(;r.length>0;){let[i,s,a]=r.pop();if(Le(i)){let l={...i,position:{x:i.position.x+s,y:i.position.y+a}};t.push(l);for(let d=0;d<i.card_link.length;d++)n.push({source:l,link:i.card_link[d]})}else if(ze(i)){let l=s+i.position.x,d=a+i.position.y+30;for(let u=i.contents.length-1;u>=0;u--)r.push([i.contents[u],l,d])}}return{cards:t,links:n}}function Vn(e){let{state:t,dispatch:n,selectedId:r=null,onSelectItem:i,gridEnabled:s=!1,searchQuery:a="",colorFilter:l=null,onOpenProject:d,onCardContextMenu:u,onUpdateItem:h}=e,{collection:m,viewport:c}=t,p=oe(null),f=oe(!1),y=oe(null),[x,g]=G(null),[b,S]=G(null),[D,z]=G(null),[M,$]=G(null),[L,R]=G(!1),[P,B]=G(!1),[I,F]=G(null),A=v(X=>{let ie=X,he=ie.target;if(he.closest(".board-card")||he.closest(".board-container"))return;let be=ie.button===1,Se=ie.button===0&&ie.shiftKey;be||Se?(ie.preventDefault(),f.current=!0,y.current={x:ie.clientX,y:ie.clientY,panX:c.panX,panY:c.panY}):ie.button===0&&i&&i(null)},[c.panX,c.panY,i]);ae(()=>{let X=he=>{if(!f.current||!y.current)return;let be=he,Se=be.clientX-y.current.x,Ee=be.clientY-y.current.y;n({type:"PAN",panX:y.current.panX+Se,panY:y.current.panY+Ee})},ie=()=>{f.current=!1,y.current=null};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",ie),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",ie)}},[n]);let k=v(X=>{let ie=X;if(!ie.ctrlKey)return;ie.preventDefault();let he=ie.deltaY>0?-.1:.1;n({type:"ZOOM",zoom:c.zoom+he})},[c.zoom,n]),w=oe(null);ae(()=>{let X=p.current;if(!X)return;let ie=Ce=>{let ke=[];for(let Ie=0;Ie<Ce.touches.length;Ie++)ke.push({x:Ce.touches[Ie].clientX,y:Ce.touches[Ie].clientY});return ke},he=(Ce,ke)=>Math.sqrt((Ce.x-ke.x)**2+(Ce.y-ke.y)**2),be=Ce=>{let ke=Ce;if(ke.touches.length===2){ke.preventDefault();let Ie=ie(ke);w.current={touches:Ie,panX:c.panX,panY:c.panY,zoom:c.zoom,dist:he(Ie[0],Ie[1])}}},Se=Ce=>{let ke=Ce;if(ke.touches.length!==2||!w.current)return;ke.preventDefault();let Ie=ie(ke),Te=w.current,Ue=(Te.touches[0].x+Te.touches[1].x)/2,Xe=(Te.touches[0].y+Te.touches[1].y)/2,ft=(Ie[0].x+Ie[1].x)/2,pe=(Ie[0].y+Ie[1].y)/2;n({type:"PAN",panX:Te.panX+(ft-Ue),panY:Te.panY+(pe-Xe)});let Me=he(Ie[0],Ie[1]);Te.dist>0&&n({type:"ZOOM",zoom:Te.zoom*(Me/Te.dist)})},Ee=()=>{w.current=null};return X.addEventListener("touchstart",be,{passive:!1}),X.addEventListener("touchmove",Se,{passive:!1}),X.addEventListener("touchend",Ee),()=>{X.removeEventListener("touchstart",be),X.removeEventListener("touchmove",Se),X.removeEventListener("touchend",Ee)}},[c.panX,c.panY,c.zoom,n]);let E=v((X,ie)=>{$({cardId:X,x:ie.x,y:ie.y}),R(!1),B(!1),u&&u(X,ie)},[u]),C=v(()=>{$(null),R(!1),B(!1)},[]);ae(()=>{if(!M)return;let X=()=>{C()};return document.addEventListener("click",X),()=>{document.removeEventListener("click",X)}},[M,C]);let N=v((X,ie,he)=>{F({linkId:X,cardId:ie,x:he.x,y:he.y}),C()},[C]),T=v(()=>{F(null)},[]);ae(()=>{if(!I)return;let X=()=>T();return document.addEventListener("click",X),()=>document.removeEventListener("click",X)},[I,T]);let W=v(X=>{i&&i(X)},[i]),_=v((X,ie)=>{let he=ie;if(s&&(he=Pi(ie,Yn)),n({type:"MOVE_ITEM",itemId:X,position:he}),J.current===X){let Se=0,Ee=0,Ce=[...m];for(;Ce.length>0;){let Ue=Ce.pop();if(Je(Ue)===X){Se=Ue.size.width,Ee=Ue.size.height;break}if(ze(Ue))for(let Xe=0;Xe<Ue.contents.length;Xe++)Ce.push(Ue.contents[Xe])}let ke=he.x+Se/2,Ie=he.y+Ee/2,Te=Xc(m,ke,Ie,X);g(Te)}},[n,s,m]),O=v((X,ie)=>{n({type:"RESIZE_ITEM",itemId:X,size:ie})},[n]),U=v(X=>{n({type:"REMOVE_ITEM",itemId:X}),i&&r===X&&i(null)},[n,r,i]),K=v((X,ie)=>{n({type:"NEST_ITEM",itemId:X,containerId:ie})},[n]),te=v(X=>{S(X),J.current=X,g(null)},[]),J=oe(null);J.current=b;let V=oe(null);V.current=x;let j=v(X=>{let ie=V.current;ie&&n({type:"NEST_ITEM",itemId:X,containerId:ie}),S(null),J.current=null,g(null)},[n]),Y=v((X,ie,he)=>{z({fromCardId:X,fromAnchor:ie,fromPos:he,currentPos:he})},[]),H=oe(null);H.current=D,ae(()=>{if(!D)return;let X=he=>{let be=he,Se=0,Ee=0;if(p.current){let ke=p.current.getBoundingClientRect();Se=ke.left,Ee=ke.top}let Ce=$i(be.clientX-Se,be.clientY-Ee,c);z(ke=>ke?{...ke,currentPos:Ce}:null)},ie=he=>{let be=he,Se=H.current;if(!Se){z(null);return}let Ee=document.elementFromPoint(be.clientX,be.clientY);if(Ee&&Ee.dataset&&Ee.dataset.role==="anchor"&&Ee.dataset.anchor){let Ce=Ee.closest("[data-card-id]");if(Ce&&Ce.dataset.cardId&&Ce.dataset.cardId!==Se.fromCardId){let ke=Ce.dataset.cardId;n({type:"ADD_LINK",cardId:Se.fromCardId,link:{link_id:Ze(),link_name:"relates to",target_card_id:ke,color:"#94a3b8",attributes:{}}})}}z(null)};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",ie),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",ie)}},[D!==null,c.panX,c.panY,c.zoom,n]);let Z=a.toLowerCase(),ee=new Set,se=[],Q=[...m];for(;Q.length>0;){let X=Q.pop();if(se.push(X),ze(X))for(let ie=0;ie<X.contents.length;ie++)Q.push(X.contents[ie])}if(Z)for(let X=0;X<se.length;X++){let ie=se[X];(Le(ie)?ie.card_title:ie.name).toLowerCase().includes(Z)||ee.add(Je(ie))}if(l)for(let X=0;X<se.length;X++){let ie=se[X];Le(ie)&&ie.color!==l&&ee.add(ie.card_id)}let{cards:le,links:ce}=qc(m);function ue(X){let ie=Je(X),he=ee.has(ie),be;if(Le(X))be=o(Ci,{key:ie,card:X,selected:ie===r,onSelect:W,onMove:_,onResize:O,onDelete:U,dispatch:n,onOpenProject:d,onCardContextMenu:E,onUpdate:h,onDragStart:te,onDragEnd:j,onAnchorDragStart:Y});else{let Se=X.contents.map(Ee=>ue(Ee));be=o(Mi,{key:ie,container:X,selected:ie===r,highlighted:x===X.container_id,onSelect:W,onMove:_,onResize:O,onDelete:U,onDrop:K,onDragStart:te,onDragEnd:j},...Se)}return he?o("div",{key:`dim-${ie}`,style:{opacity:"0.3"}},be):be}let re=m.map(X=>ue(X)),ge={flex:"1",overflow:"hidden",position:"relative",backgroundColor:"#f8fafc",cursor:"default",backgroundImage:s?"radial-gradient(circle, #d1d5db 1px, transparent 1px)":"none",backgroundSize:`${Yn}px ${Yn}px`},me={transform:`translate(${c.panX}px, ${c.panY}px) scale(${c.zoom})`,transformOrigin:"0 0",position:"relative",width:`${kt}px`,height:`${kt}px`},ne={padding:"6px 12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",whiteSpace:"nowrap",fontSize:"13px",color:"#1a1a1a"},de={position:"absolute",left:"100%",top:"0",backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"120px"},fe={height:"1px",backgroundColor:"#e5e7eb",margin:"4px 0"},xe=M?o("div",{className:"board-context-menu",style:{position:"fixed",left:`${M.x}px`,top:`${M.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"10000",minWidth:"160px",fontSize:"13px",color:"#1a1a1a"},"data-testid":`board-context-menu-${M.cardId}`,role:"menu","aria-label":"Card context menu",onClick:X=>X.stopPropagation()},o("div",{style:{...ne,position:"relative"},onMouseEnter:()=>{R(!0),B(!1)},role:"menuitem","aria-haspopup":"true","data-testid":`board-ctx-change-color-${M.cardId}`},"Change Color",o("span",{style:{marginLeft:"8px"}},"\u25B6"),L?o("div",{style:de,role:"menu","data-testid":`board-ctx-color-submenu-${M.cardId}`},...jc.map(X=>o("div",{key:X.value,style:{...ne,gap:"8px"},onClick:ie=>{ie.stopPropagation(),n({type:"UPDATE_CARD",cardId:M.cardId,updates:{color:X.value}}),C()},role:"menuitem","data-testid":`board-ctx-color-${X.label.toLowerCase()}-${M.cardId}`},o("span",{style:{display:"inline-block",width:"14px",height:"14px",borderRadius:"3px",backgroundColor:X.value,border:"1px solid #d1d5db",flexShrink:"0"}}),X.label))):null),o("div",{style:{...ne,position:"relative"},onMouseEnter:()=>{B(!0),R(!1)},role:"menuitem","aria-haspopup":"true","data-testid":`board-ctx-change-type-${M.cardId}`},"Change Type",o("span",{style:{marginLeft:"8px"}},"\u25B6"),P?o("div",{style:de,role:"menu","data-testid":`board-ctx-type-submenu-${M.cardId}`},...Hn.map(X=>o("div",{key:X.value,style:ne,onClick:ie=>{ie.stopPropagation(),n({type:"CHANGE_CARD_TYPE",cardId:M.cardId,newType:X.value}),C()},role:"menuitem","data-testid":`board-ctx-type-${X.value}-${M.cardId}`},X.label))):null),o("div",{style:fe,role:"separator"}),o("div",{style:{...ne,color:"#dc2626"},onClick:X=>{X.stopPropagation(),n({type:"REMOVE_ITEM",itemId:M.cardId}),i&&r===M.cardId&&i(null),C()},role:"menuitem","data-testid":`board-ctx-delete-${M.cardId}`},"Delete")):null,ye=["relates to","depends on","blocks","is blocked by","implements","is implemented by","extends","includes","references","duplicates","parent of","child of"],we=I?o("div",{className:"board-link-context-menu",style:{position:"fixed",left:`${I.x}px`,top:`${I.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"180px",maxHeight:"240px",overflowY:"auto",zIndex:"10001",fontSize:"13px"},onClick:X=>X.stopPropagation()},o("div",{style:{padding:"4px 14px",fontSize:"11px",color:"#94a3b8",fontWeight:"600"}},"Edge Type"),...ye.map(X=>o("button",{key:X,style:{display:"block",width:"100%",padding:"6px 14px",border:"none",backgroundColor:"transparent",textAlign:"left",cursor:"pointer",fontSize:"13px",color:"#334155",fontFamily:"inherit",boxSizing:"border-box"},onClick:()=>{n({type:"UPDATE_CARD",cardId:I.cardId,updates:{card_link:(()=>{let ie=null,he=[...m];for(;he.length>0;){let be=he.pop();if(Le(be)&&be.card_id===I.cardId){ie=be;break}if(ze(be))for(let Se of be.contents)he.push(Se)}return ie?ie.card_link.map(be=>be.link_id===I.linkId?{...be,link_name:X}:be):[]})()}}),T()},role:"menuitem"},X)),o("div",{style:{height:"1px",backgroundColor:"#e5e7eb",margin:"4px 0"}}),o("button",{style:{display:"block",width:"100%",padding:"6px 14px",border:"none",backgroundColor:"transparent",textAlign:"left",cursor:"pointer",fontSize:"13px",color:"#ef4444",fontFamily:"inherit"},onClick:()=>{n({type:"REMOVE_LINK",cardId:I.cardId,linkId:I.linkId}),T()},role:"menuitem"},"Delete Link")):null;return o("div",{ref:p,className:"board-canvas",style:ge,onMouseDown:A,onWheel:k,"data-testid":"board-canvas",role:"application","aria-label":`Board: ${t.name}`,tabIndex:0},o("div",{className:"board-canvas__inner",style:me,"data-testid":"board-canvas-inner"},o(Ri,{links:ce,cards:le,selectedLinkId:null,onSelectLink:()=>{},onLinkContextMenu:N,canvasWidth:kt,canvasHeight:kt}),D?o("svg",{style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},width:String(kt),height:String(kt),className:"link-drag-overlay","data-testid":"link-drag-overlay"},o("line",{x1:String(D.fromPos.x),y1:String(D.fromPos.y),x2:String(D.currentPos.x),y2:String(D.currentPos.y),stroke:"#3b82f6","stroke-width":"2","stroke-dasharray":"6 4","pointer-events":"none","data-testid":"link-drag-line"})):null,...re),xe,we)}function Kc(e){let t=[],n=[...e];for(;n.length>0;){let r=n.pop();if(Le(r))t.push(r);else if(ze(r))for(let i=r.contents.length-1;i>=0;i--)n.push(r.contents[i])}return t}function Ti(e,t,n,r){let i=r??40,s=Kc(e);if(s.length===0)return{panX:0,panY:0,zoom:1};let a=1/0,l=1/0,d=-1/0,u=-1/0;for(let g=0;g<s.length;g++){let b=s[g];b.position.x<a&&(a=b.position.x),b.position.y<l&&(l=b.position.y);let S=b.position.x+b.size.width,D=b.position.y+b.size.height;S>d&&(d=S),D>u&&(u=D)}let h=d-a+i*2,m=u-l+i*2,c=t/h,p=n/m,f=Math.max(.25,Math.min(4,Math.min(c,p))),y=-a*f+(t-(d-a)*f)/2,x=-l*f+(n-(u-l)*f)/2;return{panX:y,panY:x,zoom:f}}var Un=["#fef9c3","#fecaca","#fed7aa","#bbf7d0","#bfdbfe","#ddd6fe","#fbcfe8","#e5e7eb"];function Di(e){let{zoom:t,gridEnabled:n,selectedColor:r,colorFilter:i,onNewCard:s,onZoomIn:a,onZoomOut:l,onZoomReset:d,onColorSelect:u,onColorFilter:h,onGridToggle:m,onSearch:c}=e,[p,f]=G(""),y=v($=>{let L=$.target.value;f(L),c(L)},[c]),x={display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",backgroundColor:"rgba(255,255,255,0.95)",borderBottom:"1px solid #e2e8f0",fontSize:"12px",flexShrink:"0",flexWrap:"wrap"},g={padding:"4px 10px",border:"1px solid #d1d5db",borderRadius:"4px",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"12px",color:"#374151",lineHeight:"1.4"},b={...g,backgroundColor:"#3b82f6",color:"#ffffff",borderColor:"#3b82f6"},S={fontSize:"12px",color:"#64748b",minWidth:"40px",textAlign:"center",cursor:"pointer"},D={width:"1px",height:"20px",backgroundColor:"#e2e8f0",margin:"0 4px"},z={padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",fontSize:"12px",width:"120px",outline:"none"},M=Un.map($=>{let L=$===r,R=$===i,P=()=>{L&&h?h(R?null:$):u($)},B="1px solid rgba(0,0,0,0.15)";return R?B="3px solid #ef4444":L&&(B="2px solid #3b82f6"),o("button",{key:$,title:$,style:{width:"18px",height:"18px",borderRadius:"50%",backgroundColor:$,border:B,cursor:"pointer",padding:"0",flexShrink:"0",opacity:R?"1":i?"0.5":"1"},onClick:P,"aria-label":R?`Clear color filter ${$}`:`Select color ${$}`,"data-testid":`color-swatch-${$}`})});return o("div",{className:"board-toolbar",style:x,role:"toolbar","aria-label":"Board toolbar","data-testid":"board-toolbar"},o("button",{style:g,onClick:s,"data-testid":"btn-new-card","aria-label":"New card"},"+ New Card"),o("div",{style:D}),o("button",{style:g,onClick:l,"data-testid":"btn-zoom-out","aria-label":"Zoom out"},"-"),o("span",{style:S,onClick:d,"data-testid":"zoom-level",role:"status","aria-label":`Zoom ${Math.round(t*100)}%`},`${Math.round(t*100)}%`),o("button",{style:g,onClick:a,"data-testid":"btn-zoom-in","aria-label":"Zoom in"},"+"),o("div",{style:D}),...M,o("div",{style:D}),o("button",{style:n?b:g,onClick:m,"data-testid":"btn-grid-toggle","aria-label":n?"Disable grid snapping":"Enable grid snapping","aria-pressed":String(n)},"Grid"),o("div",{style:D}),o("input",{type:"text",placeholder:"Search cards...",value:p,onInput:y,style:z,"data-testid":"search-input","aria-label":"Search cards"}))}var zi=50,ut={id:Ze(),name:"Untitled",collection:[],viewport:{panX:0,panY:0,zoom:1}};function Ai(e,t){let n=null;function r(s){let a=[];for(let l=0;l<s.length;l++){let d=s[l];if(Je(d)===t){n=d;continue}if(ze(d)){let h=r(d.contents);a.push({...d,contents:h})}else a.push(d)}return a}return[r(e),n]}function dt(e,t,n){let r=[];for(let i=0;i<e.length;i++){let s=e[i];Je(s)===t?r.push(n(s)):ze(s)?r.push({...s,contents:dt(s.contents,t,n)}):r.push(s)}return r}function en(e,t,n){let r=[];for(let i=0;i<e.length;i++){let s=e[i];ze(s)&&s.container_id===t?r.push({...s,contents:[...s.contents,n]}):ze(s)?r.push({...s,contents:en(s.contents,t,n)}):r.push(s)}return r}function Li(e,t){let n=[...e];for(;n.length>0;){let r=n.pop();if(ze(r)){if(r.container_id===t)return r;for(let i=0;i<r.contents.length;i++)n.push(r.contents[i])}}return null}function Zc(e,t,n){let r=null;function i(a){let l=[];for(let d=0;d<a.length;d++){let u=a[d];if(ze(u)&&u.container_id===t){let h=[];for(let m=0;m<u.contents.length;m++){let c=u.contents[m];Je(c)===n?r=c:h.push(c)}l.push({...u,contents:h})}else ze(u)?l.push({...u,contents:i(u.contents)}):l.push(u)}return l}return[i(e),r]}function Jc(e){switch(e){case"text":return{text:""};case"json":return{};case"task":return{};case"project":return{project_id:"",project_name:""}}}function Bi(e,t){switch(t.type){case"ADD_ITEM":return t.containerId?{...e,collection:en(e.collection,t.containerId,t.item)}:{...e,collection:[...e.collection,t.item]};case"REMOVE_ITEM":{let[n]=Ai(e.collection,t.itemId);return{...e,collection:n}}case"MOVE_ITEM":return{...e,collection:dt(e.collection,t.itemId,n=>({...n,position:t.position,...Le(n)?{updatedAt:Date.now()}:{}}))};case"RESIZE_ITEM":return{...e,collection:dt(e.collection,t.itemId,n=>({...n,size:t.size,...Le(n)?{updatedAt:Date.now()}:{}}))};case"UPDATE_CARD":return{...e,collection:dt(e.collection,t.cardId,n=>Le(n)?{...n,...t.updates,updatedAt:Date.now()}:n)};case"CHANGE_CARD_TYPE":return{...e,collection:dt(e.collection,t.cardId,n=>Le(n)?{...n,card_type:t.newType,content:Jc(t.newType),updatedAt:Date.now()}:n)};case"ADD_CONTAINER":return t.parentContainerId?{...e,collection:en(e.collection,t.parentContainerId,t.container)}:{...e,collection:[...e.collection,t.container]};case"NEST_ITEM":{let n=Li(e.collection,t.containerId);if(!n)return e;let[r,i]=Ai(e.collection,t.itemId);if(!i)return e;let s={...i,position:{x:i.position.x-n.position.x,y:i.position.y-n.position.y-30}};return{...e,collection:en(r,t.containerId,s)}}case"UNNEST_ITEM":{let n=Li(e.collection,t.containerId),[r,i]=Zc(e.collection,t.containerId,t.itemId);if(!i)return e;let s=n?{...i,position:{x:i.position.x+n.position.x,y:i.position.y+n.position.y+30}}:i;return{...e,collection:[...r,s]}}case"ADD_LINK":return{...e,collection:dt(e.collection,t.cardId,n=>Le(n)?{...n,card_link:[...n.card_link,t.link],updatedAt:Date.now()}:n)};case"REMOVE_LINK":return{...e,collection:dt(e.collection,t.cardId,n=>Le(n)?{...n,card_link:n.card_link.filter(r=>r.link_id!==t.linkId),updatedAt:Date.now()}:n)};case"PAN":return{...e,viewport:{...e.viewport,panX:t.panX,panY:t.panY}};case"ZOOM":{let n=Math.max(.25,Math.min(4,t.zoom));return{...e,viewport:{...e.viewport,zoom:n}}}case"SET_BOARD":return t.state;case"RENAME_BOARD":return{...e,name:t.name};default:return e}}function Qc(e){return e.type==="PAN"||e.type==="ZOOM"}function Fi(e,t){switch(t.type){case"UNDO":{if(e.past.length===0)return e;let n=e.past[e.past.length-1];return{past:e.past.slice(0,e.past.length-1),present:n,future:[e.present,...e.future]}}case"REDO":{if(e.future.length===0)return e;let n=e.future[0],r=e.future.slice(1);return{past:[...e.past,e.present],present:n,future:r}}case"BOARD_ACTION":{let n=Bi(e.present,t.action);if(n===e.present)return e;if(Qc(t.action))return{...e,present:n};if(t.action.type==="SET_BOARD")return{past:[],present:n,future:[]};let r=[...e.past,e.present];return r.length>zi&&r.splice(0,r.length-zi),{past:r,present:n,future:[]}}default:return e}}function jn(e){let t={past:[],present:e||ut,future:[]},[n,r]=pn(Fi,t),i=v(l=>{r({type:"BOARD_ACTION",action:l})},[r]),s=v(()=>{r({type:"UNDO"})},[r]),a=v(()=>{r({type:"REDO"})},[r]);return{state:n.present,dispatch:i,undo:s,redo:a,canUndo:n.past.length>0,canRedo:n.future.length>0}}function Ni(e,t){let{state:n,dispatch:r,undo:i,redo:s,canUndo:a,canRedo:l}=jn(),d=oe(!1);ae(()=>{e&&t&&!d.current&&(d.current=!0,e.load(t).then(m=>{r({type:"SET_BOARD",state:m})}).catch(()=>{}))},[e,t,r]);let u=oe(null),h=oe(n);return h.current=n,ae(()=>{if(!(!e||!t))return u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{e.save(t,h.current).catch(()=>{}),u.current=null},500),()=>{u.current!==null&&clearTimeout(u.current)}},[e,t,n]),{state:n,dispatch:r,undo:i,redo:s,canUndo:a,canRedo:l}}var tn=class{async load(t){try{let n=localStorage.getItem("board:"+t);return n?JSON.parse(n):{...ut}}catch{return{...ut}}}async save(t,n){try{localStorage.setItem("board:"+t,JSON.stringify(n))}catch{}}};function ed(e){let t=[],n=[...e];for(;n.length>0;){let r=n.pop();if(Le(r))t.push(r);else for(let i=r.contents.length-1;i>=0;i--)n.push(r.contents[i])}return t}function Wi(e){let{collection:t,onCardDropped:n,children:r}=e,i=ot(),s=oe([]);ae(()=>{let u=ed(t),h=s.current,m=new Set(h.map(p=>p.card_id)),c=new Set(u.map(p=>p.card_id));for(let p of u)m.has(p.card_id)||i.publish("project-board",{event:"card-created",card:p});for(let p of h)c.has(p.card_id)||i.publish("project-board",{event:"card-deleted",cardId:p.card_id});for(let p of u)if(m.has(p.card_id)){let f=h.find(y=>y.card_id===p.card_id);f&&f.updatedAt!==p.updatedAt&&i.publish("project-board",{event:"card-updated",card:p})}s.current=u},[t,i]);let a=v(u=>{if(u.type==="text/plain"&&typeof u.data=="string")n(u.data,"");else if(u.type==="application/json"){let h=u.data;n(String(h.title||"Dropped Item"),String(h.description||""))}},[n]),{isOver:l}=zt({acceptTypes:["text/plain","application/json","application/project-card"],onDrop:a}),d={width:"100%",height:"100%",...l?{outline:"2px dashed #3b82f6",outlineOffset:"-2px"}:{}};return o("div",{style:d,"data-dropzone-id":"project-board-dropzone"},r)}var td=new tn;function _i(e){let t=[],n=[...e];for(;n.length>0;){let r=n.pop();if(Le(r))t.push(r);else if(ze(r))for(let i=r.contents.length-1;i>=0;i--)n.push(r.contents[i])}return t}var rt=Date.now(),nd={id:"sample-board-001",name:"Sample Project",collection:[{type:"card",card_id:"sample-1",card_type:"text",card_title:"Auth API",card_link:[{link_id:"link-1",link_name:"blocks",target_card_id:"sample-2",color:"#94a3b8",attributes:{}}],content:{text:"Design the auth flow"},position:{x:50,y:50},size:{width:180,height:120},color:"#3b82f6",priority:"high",assignee:"Alice",createdAt:rt,updatedAt:rt},{type:"card",card_id:"sample-2",card_type:"text",card_title:"Dashboard",card_link:[],content:{text:"Build the main dashboard"},position:{x:300,y:80},size:{width:180,height:120},color:"#22c55e",priority:"medium",assignee:"Bob",createdAt:rt,updatedAt:rt},{type:"card",card_id:"sample-3",card_type:"text",card_title:"Deploy",card_link:[],content:{text:"Set up CI pipeline"},position:{x:150,y:250},size:{width:180,height:120},color:"#f59e0b",priority:"low",createdAt:rt,updatedAt:rt},{type:"card",card_id:"sample-4",card_type:"text",card_title:"Docs",card_link:[],content:{text:"Write API reference"},position:{x:400,y:280},size:{width:180,height:120},color:"#a855f7",priority:"medium",assignee:"Carol",createdAt:rt,updatedAt:rt}],viewport:{panX:0,panY:0,zoom:1}};function od(e){return e.collection.length===0}function Oi(e){let t=e.boardId||"default",{state:n,dispatch:r,undo:i,redo:s,canUndo:a,canRedo:l}=Ni(td,t),[d,u]=G(Un[0]),[h,m]=G(!1),[c,p]=G(""),[f,y]=G(null),[x,g]=G(null),[b,S]=G(n.name||"Untitled"),[D,z]=G(!1),[M,$]=G(""),[L,R]=G(null),[P,B]=G(!0),[I,F]=G([{name:"relates to",weight:1},{name:"depends on",weight:2},{name:"blocks",weight:3},{name:"is blocked by",weight:3},{name:"implements",weight:2},{name:"references",weight:1}]),[A,k]=G(null),[w,E]=G(""),[C,N]=G("1"),[T,W]=G([]),_=oe(!1);ae(()=>{!_.current&&od(n)?(_.current=!0,r({type:"SET_BOARD",state:nd})):n.collection.length>0&&(_.current=!0)},[n,r]);let O=v(()=>{let pe=(-n.viewport.panX+300)/n.viewport.zoom,Me=(-n.viewport.panY+200)/n.viewport.zoom,Re=(Math.random()-.5)*300,De=(Math.random()-.5)*200,qe={type:"card",card_id:Ze(),card_type:"text",card_title:"New Card",card_link:[],content:{text:""},color:d,position:{x:Math.round(pe+Re),y:Math.round(Me+De)},size:{width:180,height:120},priority:"medium",createdAt:Date.now(),updatedAt:Date.now()};r({type:"ADD_ITEM",item:qe})},[n.viewport,d,r]),U=v(()=>{r({type:"ZOOM",zoom:n.viewport.zoom+.1})},[n.viewport.zoom,r]),K=v(()=>{r({type:"ZOOM",zoom:n.viewport.zoom-.1})},[n.viewport.zoom,r]),te=v(()=>{r({type:"ZOOM",zoom:1})},[r]),J=v(()=>{m(pe=>!pe)},[]),V=v(pe=>{p(pe)},[]),j=v(pe=>{y(pe)},[]),Y=v(pe=>{g(pe)},[]),H=v(()=>{B(pe=>!pe)},[]),Z=v(()=>{r({type:"SET_BOARD",state:ut}),y(null)},[r]),ee=v(()=>{let pe=JSON.stringify(n,null,2),Me=new Blob([pe],{type:"application/json"}),Re=URL.createObjectURL(Me),De=document.createElement("a");De.href=Re,De.download=`board-${t}.json`,De.style.display="none",document.body.appendChild(De),De.click(),document.body.removeChild(De),URL.revokeObjectURL(Re)},[n,t]),se=v(()=>{let pe=document.createElement("input");pe.type="file",pe.accept=".json,application/json",pe.style.display="none",pe.addEventListener("change",()=>{let Me=pe.files&&pe.files[0];if(!Me)return;let Re=new FileReader;Re.onload=()=>{try{let De=JSON.parse(Re.result);De&&De.collection&&De.viewport&&r({type:"SET_BOARD",state:De})}catch{}},Re.readAsText(Me)}),document.body.appendChild(pe),pe.click(),document.body.removeChild(pe)},[r]),Q=v(()=>{window.print()},[]),le=_i(n.collection),ce=v(()=>{let pe=_i(n.collection);pe.length>0&&y(pe[0].card_id)},[n.collection]),ue=v(()=>{f&&(r({type:"REMOVE_ITEM",itemId:f}),y(null))},[f,r]),re=v(()=>{if(n.collection.length===0)return;let Re=Ti(n.collection,800,600);r({type:"PAN",panX:Re.panX,panY:Re.panY}),r({type:"ZOOM",zoom:Re.zoom})},[n.collection,r]);ae(()=>{let pe={menus:[{label:"File",items:[{label:"New Board",onClick:Z},{label:"Export JSON",onClick:ee},{label:"Import JSON",onClick:se},{divider:!0},{label:"Print",onClick:Q}]},{label:"Edit",items:[{label:"Undo",shortcut:"Ctrl+Z",onClick:i,disabled:!a},{label:"Redo",shortcut:"Ctrl+Y",onClick:s,disabled:!l},{divider:!0},{label:"Select All",shortcut:"Ctrl+A",onClick:ce},{label:"Delete Selected",onClick:ue}]},{label:"View",items:[{label:"Zoom In",onClick:U},{label:"Zoom Out",onClick:K},{label:"Fit All",onClick:re},{divider:!0},{label:"Toggle Grid",onClick:J}]}]}},[Z,ee,se,Q,i,s,a,l,ce,ue,U,K,re,J]),ae(()=>{let pe=Me=>{let Re=Me;Re.ctrlKey&&Re.key==="z"?(Re.preventDefault(),i()):Re.ctrlKey&&Re.key==="y"&&(Re.preventDefault(),s())};return document.addEventListener("keydown",pe),()=>document.removeEventListener("keydown",pe)},[i,s]),ae(()=>{if(!L)return;let pe=()=>R(null),Me=setTimeout(()=>document.addEventListener("click",pe),0);return()=>{clearTimeout(Me),document.removeEventListener("click",pe)}},[L]);let ge=v(()=>{$(b),z(!0)},[b]),me=v(()=>{let pe=M.trim();pe&&(S(pe),r({type:"RENAME_BOARD",name:pe}),e.onTitleChange&&e.onTitleChange(`Project Board: ${pe}`)),z(!1)},[M,r,e.onTitleChange]),ne=v(()=>{z(!1)},[]),de=v(pe=>{$(pe.target.value)},[]),fe=v(pe=>{let Me=pe;Me.key==="Enter"&&(Me.preventDefault(),me()),Me.key==="Escape"&&(Me.preventDefault(),ne())},[me,ne]),xe={display:"flex",flexDirection:"column",width:"100%",height:"100%",backgroundColor:"#f8fafc",overflow:"hidden"},ye=v((pe,Me)=>{let Re=(-n.viewport.panX+300)/n.viewport.zoom,De=(-n.viewport.panY+200)/n.viewport.zoom,qe=(Math.random()-.5)*300,st=(Math.random()-.5)*200,Et={type:"card",card_id:Ze(),card_type:"text",card_title:pe,card_link:[],content:{text:Me},color:d,position:{x:Math.round(Re+qe),y:Math.round(De+st)},size:{width:180,height:120},priority:"medium",createdAt:Date.now(),updatedAt:Date.now()};r({type:"ADD_ITEM",item:Et})},[n.viewport,d,r]),we={display:"flex",alignItems:"center",height:"28px",backgroundColor:"#f1f5f9",borderBottom:"1px solid #e2e8f0",padding:"0 8px",fontSize:"13px",flexShrink:"0"},X={padding:"2px 10px",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:"13px",color:"#334155",borderRadius:"4px",fontFamily:"inherit"},ie=v(()=>{let pe=(-n.viewport.panX+300)/n.viewport.zoom,Me=(-n.viewport.panY+200)/n.viewport.zoom,Re=(Math.random()-.5)*300,De=(Math.random()-.5)*200;r({type:"ADD_CONTAINER",container:{type:"container",container_id:Ze(),name:"New Container",position:{x:Math.round(pe+Re),y:Math.round(Me+De)},size:{width:300,height:250},contents:[]}}),R(null)},[n.viewport,r]),he={position:"absolute",top:"100%",left:"0",marginTop:"2px",backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"180px",zIndex:"1000"},be={display:"block",width:"100%",padding:"6px 14px",border:"none",backgroundColor:"transparent",textAlign:"left",cursor:"pointer",fontSize:"13px",color:"#334155",fontFamily:"inherit",boxSizing:"border-box"},Se=o("div",{style:we,"data-testid":"app-menu-bar"},o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:X,onClick:()=>R(L==="project"?null:"project")},"Project"),L==="project"?o("div",{style:he},o("button",{style:be,onClick:()=>{ge(),R(null)}},"Rename Project..."),o("div",{style:{height:"1px",backgroundColor:"#e5e7eb",margin:"4px 0"}}),o("button",{style:be,onClick:()=>{ie()}},"New Container"),o("button",{style:be,onClick:()=>{O(),R(null)}},"New Card")):null),o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:X,onClick:()=>R(L==="graphs"?null:"graphs")},"Graphs"),L==="graphs"?o("div",{style:he},o("button",{style:be,onClick:()=>{E(""),N("1"),k("add"),R(null)}},"Add Attribute..."),o("button",{style:be,onClick:()=>{k("delete"),R(null)}},"Delete Attribute..."),o("button",{style:be,onClick:()=>{W(I.map(pe=>({...pe}))),k("edit"),R(null)}},"Edit Attributes...")):null),o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:X,onClick:()=>R(L==="settings"?null:"settings")},"Settings"),L==="settings"?o("div",{style:he},o("button",{style:be,onClick:()=>{J(),R(null)}},h?"Disable Grid Snap":"Enable Grid Snap"),o("button",{style:be,onClick:()=>{H(),R(null)}},P?"Hide Links":"Show Links")):null),o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:X,onClick:()=>R(L==="help"?null:"help")},"Help"),L==="help"?o("div",{style:he},o("button",{style:be,onClick:()=>R(null)},"About Project Board"),o("button",{style:be,onClick:()=>R(null)},"Keyboard Shortcuts")):null),o("span",{style:{marginLeft:"auto",fontSize:"12px",color:"#94a3b8"}},`Project Board: ${b}`)),Ee=D?o("div",{style:{position:"absolute",inset:"0",backgroundColor:"rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"200"},onClick:ne},o("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",boxShadow:"0 8px 24px rgba(0,0,0,0.2)",minWidth:"300px"},onClick:pe=>pe.stopPropagation(),role:"dialog","aria-label":"Rename project"},o("div",{style:{fontWeight:"600",fontSize:"14px",marginBottom:"12px",color:"#1a1a1a"}},"Rename Project"),o("input",{type:"text",value:M,onInput:de,onKeyDown:fe,autoFocus:!0,style:{width:"100%",padding:"8px 10px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},"data-testid":"rename-input"}),o("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"}},o("button",{onClick:ne,style:{padding:"6px 14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px",fontFamily:"inherit"}},"Cancel"),o("button",{onClick:me,style:{padding:"6px 14px",border:"none",borderRadius:"6px",backgroundColor:"#3b82f6",color:"#ffffff",cursor:"pointer",fontSize:"13px",fontWeight:"600",fontFamily:"inherit"},"data-testid":"rename-confirm"},"Rename")))):null,Ce={position:"absolute",inset:"0",backgroundColor:"rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"200"},ke={backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",boxShadow:"0 8px 24px rgba(0,0,0,0.2)",minWidth:"320px",maxHeight:"400px",overflow:"auto"},Ie={fontWeight:"600",fontSize:"14px",marginBottom:"12px",color:"#1a1a1a"},Te={width:"100%",padding:"8px 10px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},Ue={padding:"6px 14px",border:"none",borderRadius:"6px",backgroundColor:"#3b82f6",color:"#ffffff",cursor:"pointer",fontSize:"13px",fontWeight:"600",fontFamily:"inherit"},Xe={padding:"6px 14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px",fontFamily:"inherit"},ft=null;return A==="add"&&(ft=o("div",{style:Ce,onClick:()=>k(null)},o("div",{style:ke,onClick:pe=>pe.stopPropagation(),role:"dialog","aria-label":"Add edge attribute"},o("div",{style:Ie},"Add Edge Attribute"),o("div",{style:{marginBottom:"8px"}},o("label",{style:{fontSize:"12px",color:"#64748b",display:"block",marginBottom:"4px"}},"Name"),o("input",{type:"text",value:w,style:Te,placeholder:"e.g. depends on",onInput:pe=>E(pe.target.value)})),o("div",{style:{marginBottom:"12px"}},o("label",{style:{fontSize:"12px",color:"#64748b",display:"block",marginBottom:"4px"}},"Weight"),o("input",{type:"number",value:C,style:Te,min:"0",step:"1",onInput:pe=>N(pe.target.value)})),o("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"}},o("button",{style:Xe,onClick:()=>k(null)},"Cancel"),o("button",{style:Ue,onClick:()=>{let pe=w.trim(),Me=parseFloat(C)||1;pe&&F(Re=>[...Re,{name:pe,weight:Me}]),k(null)}},"Add"))))),A==="delete"&&(ft=o("div",{style:Ce,onClick:()=>k(null)},o("div",{style:ke,onClick:pe=>pe.stopPropagation(),role:"dialog","aria-label":"Delete edge attribute"},o("div",{style:Ie},"Delete Edge Attribute"),I.length===0?o("div",{style:{color:"#94a3b8",padding:"8px 0"}},"No attributes defined."):o("div",{style:{display:"flex",flexDirection:"column",gap:"4px"}},...I.map((pe,Me)=>o("div",{key:String(Me),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 8px",borderRadius:"4px",border:"1px solid #e5e7eb"}},o("span",{style:{fontSize:"13px"}},`${pe.name} (weight: ${pe.weight})`),o("button",{style:{border:"none",backgroundColor:"transparent",color:"#ef4444",cursor:"pointer",fontSize:"16px"},onClick:()=>F(Re=>Re.filter((De,qe)=>qe!==Me))},"\xD7")))),o("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"12px"}},o("button",{style:Xe,onClick:()=>k(null)},"Done"))))),A==="edit"&&(ft=o("div",{style:Ce,onClick:()=>k(null)},o("div",{style:{...ke,minWidth:"400px"},onClick:pe=>pe.stopPropagation(),role:"dialog","aria-label":"Edit edge attributes"},o("div",{style:Ie},"Edit Edge Attributes"),T.length===0?o("div",{style:{color:"#94a3b8",padding:"8px 0"}},"No attributes defined."):o("div",{style:{display:"flex",flexDirection:"column",gap:"6px"}},...T.map((pe,Me)=>o("div",{key:String(Me),style:{display:"flex",alignItems:"center",gap:"8px"}},o("input",{type:"text",value:pe.name,style:{...Te,flex:"1"},onInput:Re=>{let De=Re.target.value;W(qe=>qe.map((st,Et)=>Et===Me?{...st,name:De}:st))}}),o("input",{type:"number",value:String(pe.weight),min:"0",step:"1",style:{...Te,width:"80px"},onInput:Re=>{let De=parseFloat(Re.target.value)||0;W(qe=>qe.map((st,Et)=>Et===Me?{...st,weight:De}:st))}})))),o("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"}},o("button",{style:Xe,onClick:()=>k(null)},"Cancel"),o("button",{style:Ue,onClick:()=>{F(T.filter(pe=>pe.name.trim())),k(null)}},"Save"))))),o("div",{className:"project-manager-app",style:xe,"data-testid":"project-manager-app"},Se,o(Di,{zoom:n.viewport.zoom,gridEnabled:h,selectedColor:d,colorFilter:x,onNewCard:O,onZoomIn:U,onZoomOut:K,onZoomReset:te,onColorSelect:u,onColorFilter:Y,onGridToggle:J,onSearch:V}),o(Wi,{collection:n.collection,onCardDropped:ye},o(Vn,{state:n,dispatch:r,searchQuery:c,gridEnabled:h,selectedId:f,onSelectItem:j,colorFilter:x,onUpdateItem:(pe,Me)=>{r({type:"UPDATE_CARD",cardId:pe,updates:Me})},onCardContextMenu:(pe,Me)=>{}})),Ee,ft)}var rd=28,id=5e3;var Hi=0;function Yi(e){return Hi++,`${e}-${Hi}`}function sd(e){return e.replace(/\s*\(\d+\)$/,"")}function ad(e){let{toasts:t,onDismiss:n}=e;if(t.length===0)return null;let r={position:"absolute",top:"8px",right:"8px",zIndex:"9999",display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none",maxWidth:"320px"},i=t.map(s=>{let a="rgba(50, 50, 50, 0.95)",l="#555";return s.severity==="warning"?(a="rgba(60, 40, 10, 0.95)",l="#f39c12"):s.severity==="error"&&(a="rgba(60, 10, 10, 0.95)",l="#e74c3c"),o("div",{key:String(s.id),className:`unity-desktop__toast unity-desktop__toast--${s.severity}`,style:{backgroundColor:a,border:`1px solid ${l}`,borderRadius:"6px",padding:"10px 14px",color:"#ffffff",fontSize:"13px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",pointerEvents:"auto",cursor:"pointer",transition:"opacity 200ms ease"},onClick:()=>n(s.id),role:"alert","aria-live":"polite"},s.message)});return o("div",{className:"unity-desktop__toast-container",style:r,"aria-label":"Notifications"},...i)}function ld(){let e=ot(),t=oe(!1);return ae(()=>{t.current||(t.current=!0,e.publish("terminal-output",{text:"Terminal session started",pid:1}))},[e]),o("div",{style:{padding:"16px",fontSize:"12px",color:"#00ff41",height:"100%",overflow:"auto",backgroundColor:"#1a1a2e",fontFamily:"monospace"}},o("div",null,"$ whoami"),o("div",null,"operator"),o("div",null,"$ uname -a"),o("div",null,"Linux specifyjs 6.1.0 #1 SMP x86_64 GNU/Linux"),o("div",{style:{opacity:"0.6",marginTop:"8px",fontSize:"10px"}},"[Published terminal-output message]"),o("div",null,"$ _"))}function cd(){let[e,t]=G([]),n=ct();Tt("terminal-output",s=>{t(a=>[...a,`[terminal] ${s.payload.text}`])});let r=v(s=>{s.preventDefault(),n.startDrag({type:"application/file",data:{name:"readme.txt",size:1024},sourceAppId:"files",preview:"readme.txt"})},[n]);return o("div",{style:{padding:"16px",fontSize:"13px",color:"var(--color-text, #333)",height:"100%",overflow:"auto"}},o("div",{style:{fontWeight:"600",marginBottom:"12px"}},"Home"),o("div",{style:{display:"flex",flexDirection:"column",gap:"6px"}},...["\u{1F4C1} Documents","\u{1F4C1} Downloads","\u{1F4C1} Music","\u{1F4C1} Pictures","\u{1F4C1} Videos"].map(s=>o("span",{style:{cursor:"pointer"}},s)),o("span",{style:{cursor:"grab",padding:"4px 8px",border:"1px dashed #94a3b8",borderRadius:"4px",backgroundColor:"rgba(148, 163, 184, 0.1)"},onMouseDown:r,"aria-label":"Drag readme.txt"},"\u{1F4C4} readme.txt (drag me)")),e.length>0?o("div",{style:{marginTop:"12px",padding:"8px",backgroundColor:"rgba(0,0,0,0.05)",borderRadius:"4px",fontSize:"11px",fontFamily:"monospace"}},o("div",{style:{fontWeight:"600",marginBottom:"4px"}},"Messages received:"),...e.map((s,a)=>o("div",{key:String(a),style:{color:"#64748b"}},s))):null)}function dd(e,t,n){let r={padding:"16px",fontSize:"13px",color:"var(--color-text, #333)",height:"100%",overflow:"auto"};switch(sd(e)){case"Files":return o(nt,{appId:"files"},o(cd,null));case"Terminal":return o(nt,{appId:"terminal"},o(ld,null));case"Browser":return o("div",{style:r},o("div",{style:{padding:"6px 10px",backgroundColor:"#f1f5f9",borderRadius:"4px",marginBottom:"12px",fontSize:"12px",color:"#64748b"}},"https://specifyjs.asymmetric-effort.com"),o("div",{style:{textAlign:"center",padding:"32px",color:"#94a3b8"}},"Web page content area"));case"Mail":return o("div",{style:r},o("div",{style:{fontWeight:"600",marginBottom:"8px"}},"Inbox (3)"),...["Build passed \u2014 CI/CD Pipeline","PR Review: feat/unity-desktop","Weekly sync notes"].map(s=>o("div",{style:{padding:"8px",borderBottom:"1px solid #e2e8f0",cursor:"pointer"}},s)));case"Settings":return o("div",{style:r},o("div",{style:{fontWeight:"600",marginBottom:"12px"}},"System Settings"),...["Appearance","Network","Sound","Power","Users","About"].map(s=>o("div",{style:{padding:"8px 0",borderBottom:"1px solid #e2e8f0"}},s)));case"Word Processor":return o(qt,null);case"IDE":return o(Kt,null);case"Trading":return o(Qt,null);case"Project Board":return o(Oi,{boardId:t||"default",onTitleChange:n||void 0});default:return o("div",{style:r},o("div",{style:{textAlign:"center",padding:"32px",color:"#94a3b8"}},`${e} application content`))}}function ud(e){let{apps:t,user:n,onAppOpen:r,onLogout:i,theme:s="dark",children:a}=e,l=Pt(),d=l.activeMenuBar,u=l.dockSignals,h=oe(l);h.current=l;let[m,c]=G([]),[p,f]=G([]),[y,x]=G(!1),[g,b]=G(!1),[S,D]=G(null),[z,M]=G({x:0,y:0}),[$,L]=G(null),R=v(()=>{x(ne=>!ne)},[]),P=v(ne=>{f(de=>de.filter(fe=>fe.id!==ne))},[]);ae(()=>{if(p.length===0)return;let ne=p[0],de=Date.now()-ne.timestamp,fe=Math.max(0,id-de),xe=setTimeout(()=>{f(ye=>ye.filter(we=>we.id!==ne.id))},fe);return()=>clearTimeout(xe)},[p]);let B=oe(t);B.current=t;let I=oe(r);I.current=r;let F=oe({});for(let ne of m)if(!F.current[ne.id]){let de=ne.id;F.current[de]=fe=>{c(xe=>xe.map(ye=>ye.id===de?{...ye,title:fe}:ye))}}let A=v(ne=>{let fe=B.current.find(xe=>xe.id===ne);fe&&(c(xe=>{let we=xe.filter(Se=>Se.appId===ne).length+1,X=we===1?fe.label:`${fe.label} (${we})`,ie=Yi(ne),he=xe.length>0?Math.max(...xe.map(Se=>Se.zIndex))+1:1,be={id:ie,appId:fe.id,title:X,icon:fe.icon,x:60+xe.length*30,y:40+xe.length*30,width:600,height:400,zIndex:he,focused:!0,windowState:"normal"};return[...xe.map(Se=>({...Se,focused:!1})),be]}),ne==="files"&&h.current.setMenuBar("files",{menus:[{label:"File",items:[{label:"New",shortcut:"Ctrl+N",onClick:()=>{}},{label:"Open",shortcut:"Ctrl+O",onClick:()=>{}},{label:"Save",shortcut:"Ctrl+S",onClick:()=>{}}]},{label:"Edit",items:[{label:"Cut",shortcut:"Ctrl+X",onClick:()=>{}},{label:"Copy",shortcut:"Ctrl+C",onClick:()=>{}},{label:"Paste",shortcut:"Ctrl+V",onClick:()=>{}}]}]}),ne==="terminal"&&h.current.signalDock("terminal",{badge:3}),I.current&&I.current(ne))},[]),k=v(ne=>{c(de=>{if(!de.find(ye=>ye.id===ne))return de;let xe=Math.max(...de.map(ye=>ye.zIndex))+1;return de.map(ye=>ye.id===ne?{...ye,focused:!0,zIndex:xe,windowState:ye.windowState==="minimized"?"normal":ye.windowState}:{...ye,focused:!1})})},[]),w=v(ne=>{c(de=>{let fe=de.filter(X=>X.appId===ne);if(fe.length===0)return de;let ye=[...fe].sort((X,ie)=>ie.zIndex-X.zIndex)[0],we=Math.max(...de.map(X=>X.zIndex))+1;return de.map(X=>X.id===ye.id?{...X,focused:!0,zIndex:we,windowState:X.windowState==="minimized"?"normal":X.windowState}:{...X,focused:!1})}),c(de=>{if(de.filter(xe=>xe.appId===ne).length===0){let ye=B.current.find(he=>he.id===ne);if(!ye)return de;let we=Yi(ne),X=de.length>0?Math.max(...de.map(he=>he.zIndex))+1:1,ie={id:we,appId:ye.id,title:ye.label,icon:ye.icon,x:60+de.length*30,y:40+de.length*30,width:600,height:400,zIndex:X,focused:!0,windowState:"normal"};return ne==="files"&&h.current.setMenuBar("files",{menus:[{label:"File",items:[{label:"New",shortcut:"Ctrl+N",onClick:()=>{}},{label:"Open",shortcut:"Ctrl+O",onClick:()=>{}},{label:"Save",shortcut:"Ctrl+S",onClick:()=>{}}]},{label:"Edit",items:[{label:"Cut",shortcut:"Ctrl+X",onClick:()=>{}},{label:"Copy",shortcut:"Ctrl+C",onClick:()=>{}},{label:"Paste",shortcut:"Ctrl+V",onClick:()=>{}}]}]}),ne==="terminal"&&h.current.signalDock("terminal",{badge:3}),I.current&&I.current(ne),[...de.map(he=>({...he,focused:!1})),ie]}return de})},[]),E=t.map(ne=>{let de=m.some(ye=>ye.appId===ne.id),fe=u.get(ne.id),xe={id:ne.id,icon:ne.icon,label:fe?.tooltip||ne.label,active:de};return fe&&(fe.badge!=null&&(xe.badge=fe.badge>0?fe.badge:void 0),fe.progress!=null&&(xe.progress=fe.progress>0?fe.progress:void 0),fe.urgent&&(xe.urgent=!0)),xe}),C=m.find(ne=>ne.focused),N=C?C.title:void 0,T=v(()=>{b(!0)},[]),W=v(()=>{b(!1)},[]),_=v((ne,de)=>{D(ne),M(de)},[]),O=v(()=>{D(null)},[]),U=v(()=>{},[]),K=v(()=>{i&&i()},[i]),te=[];n&&(te.push({label:n.name,icon:void 0,onClick:U,divider:!1}),te.push({label:"",icon:void 0,onClick:U,divider:!0})),te.push({label:"Lock",icon:void 0,onClick:T,divider:!1}),te.push({label:"Logout",icon:void 0,onClick:K,divider:!1});let J=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'Ubuntu, "Segoe UI", sans-serif',fontSize:"13px",color:s==="dark"?"#ffffff":"#1a1a1a",overflow:"hidden",position:"relative"}),[s]),V={display:"flex",flex:"1",overflow:"hidden"},j={display:"flex",flexDirection:"column",height:"100%",backgroundColor:s==="dark"?"var(--dock-bg, rgba(0, 0, 0, 0.7))":"var(--dock-bg, rgba(200, 200, 200, 0.9))",borderRight:s==="dark"?"1px solid rgba(255, 255, 255, 0.1)":"1px solid rgba(0, 0, 0, 0.1)",flexShrink:"0"},Y={width:"100%",height:"100%",position:"relative"},H=o(Bn,{activeAppName:N,activitiesButton:{label:"Activities",onClick:R},appMenuBar:d||void 0,clockFormat:"24h",showSeconds:!0,showDate:!0,user:n?{name:n.name,avatar:n.avatar}:void 0,userMenuItems:te.length>0?te:void 0,height:rd}),Z=o(Fn,{items:E,orientation:"vertical",position:"left",iconSize:36,onItemClick:w,onItemContextMenu:_}),ee=o(ad,{toasts:p,onDismiss:P}),se=m.filter(ne=>ne.windowState!=="minimized").map(ne=>o(At,{key:ne.id,id:ne.id,title:ne.title,icon:ne.icon,defaultPosition:{x:ne.x,y:ne.y},defaultSize:{width:ne.width,height:ne.height},zIndex:ne.zIndex,focused:ne.focused,windowState:ne.windowState,onClose:()=>{c(de=>de.filter(fe=>fe.id!==ne.id))},onFocus:()=>{c(de=>{let fe=Math.max(...de.map(xe=>xe.zIndex))+1;return de.map(xe=>xe.id===ne.id?{...xe,focused:!0,zIndex:fe}:{...xe,focused:!1})})},onMinimize:()=>{c(de=>de.map(fe=>fe.id===ne.id?{...fe,windowState:"minimized"}:fe))},onMaximize:()=>{c(de=>de.map(fe=>fe.id===ne.id?{...fe,windowState:fe.windowState==="maximized"?"normal":"maximized"}:fe))}},dd(t.find(de=>de.id===ne.appId)?.label||ne.title,ne.id,F.current[ne.id]))),Q=[];a&&Q.push(a),Q.push(...se),Q.push(ee);let le=o(Nn,{backgroundColor:s==="dark"?"#2c001e":"#e8e0e4",backgroundGradient:s==="dark"?"linear-gradient(135deg, #2c001e 0%, #5e2750 50%, #2c001e 100%)":"linear-gradient(135deg, #e8e0e4 0%, #d4c4d0 50%, #e8e0e4 100%)"},o("div",{className:"unity-desktop__workspace",style:Y},...Q)),ce=y?o("div",{style:{position:"absolute",inset:"0",zIndex:"100",backgroundColor:"rgba(0, 0, 0, 0.85)",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(80px, 1fr))",gap:"24px",padding:"48px",alignContent:"start",overflowY:"auto"},onClick:R},...t.map(ne=>o("button",{key:ne.id,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",background:"none",border:"none",color:"#ffffff",cursor:"pointer",padding:"12px",borderRadius:"8px",fontSize:"12px"},onClick:de=>{de.stopPropagation(),x(!1),w(ne.id)}},o("span",{style:{fontSize:"32px",display:"block"}},ne.icon),o("span",null,ne.label)))):null,ue=g?o("div",{className:"unity-desktop__lock-overlay",style:{position:"absolute",inset:"0",zIndex:"9999",backgroundColor:"rgba(0,0,0,0.85)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"#ffffff"},onClick:W},o("div",{style:{fontSize:"64px",marginBottom:"16px"}},"\u{1F512}"),o("div",{style:{fontSize:"24px",fontWeight:"600",marginBottom:"8px"}},"Locked"),o("div",{style:{fontSize:"14px",opacity:"0.7"}},"Click to unlock")):null,re=(()=>{if(!S)return null;let ne=t.find(X=>X.id===S),de=m.filter(X=>X.appId===S),fe={padding:"6px 14px",cursor:"pointer"},xe={onMouseEnter:X=>{X.currentTarget.style.backgroundColor="#444"},onMouseLeave:X=>{X.currentTarget.style.backgroundColor="transparent"}},ye={borderBottom:"1px solid #444",margin:"4px 0"},we=[];return we.push(o("div",{key:"new",style:fe,...xe,onClick:()=>{A(S),D(null)},role:"menuitem"},"\u25CF New")),de.length>0&&(we.push(o("div",{key:"sep-1",style:ye})),de.forEach((X,ie)=>{let he=X.title;we.push(o("div",{key:`inst-${X.id}`,style:fe,...xe,onClick:()=>{k(X.id),D(null)},role:"menuitem"},he))})),we.push(o("div",{key:"sep-2",style:ye})),we.push(o("div",{key:"about",style:fe,...xe,onClick:()=>{L(S),D(null)},role:"menuitem"},"About")),o("div",{className:"unity-desktop__context-menu-backdrop",style:{position:"absolute",inset:"0",zIndex:"9000"},onClick:O},o("div",{className:"unity-desktop__context-menu",style:{position:"absolute",top:`${z.y}px`,left:`${z.x}px`,backgroundColor:"#2d2d2d",border:"1px solid #555",borderRadius:"6px",padding:"4px 0",minWidth:"160px",boxShadow:"0 4px 12px rgba(0,0,0,0.4)",zIndex:"9001",color:"#ffffff",fontSize:"13px"},onClick:X=>X.stopPropagation()},...we))})(),ge=$?t.find(ne=>ne.id===$):null,me=ge?o("div",{className:"unity-desktop__about-backdrop",style:{position:"absolute",inset:"0",zIndex:"9500",backgroundColor:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>L(null)},o("div",{style:{backgroundColor:"#2d2d2d",border:"1px solid #555",borderRadius:"8px",padding:"24px",minWidth:"280px",color:"#ffffff",textAlign:"center"},onClick:ne=>ne.stopPropagation()},o("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"}},ge.label),o("div",{style:{fontSize:"13px",marginBottom:"4px",color:"#aaa"}},"SpecifyJS Demo App"),o("div",{style:{fontSize:"13px",marginBottom:"4px",color:"#aaa"}},"MIT License"),o("div",{style:{fontSize:"13px",color:"#aaa"}},"v0.2.47"),o("button",{style:{marginTop:"16px",padding:"6px 16px",border:"1px solid #555",borderRadius:"4px",backgroundColor:"#444",color:"#fff",cursor:"pointer"},onClick:()=>L(null)},"Close"))):null;return o("div",{className:"unity-desktop",style:J,"data-theme":s},o("div",{className:"unity-desktop__top-panel",style:{flexShrink:"0",zIndex:"10"}},H),o("div",{style:V},o("div",{className:"unity-desktop__dock",style:j},Z),o("main",{className:"unity-desktop__desktop",style:{flex:"1",position:"relative",overflow:"hidden",minHeight:"0"}},le,ce)),re,me,ue)}function Vi(e){let{apps:t,user:n,onAppOpen:r,onLogout:i,theme:s="dark",children:a}=e;return o(zn,{onWindowOpen:r},o($t,null,o(Dt,null,o(ud,{apps:t,user:n,onAppOpen:r,onLogout:i,theme:s,children:a}))))}function Ui(e){let{id:t,title:n,icon:r,defaultPosition:i,defaultSize:s,minSize:a,resizable:l=!0,onClose:d,menuBar:u,onActivate:h,onDeactivate:m,children:c}=e,p=Pt(),f=q(()=>p.windows.find($=>$.id===t),[p.windows,t]);ae(()=>(u?p.setMenuBar(t,u):p.clearMenuBar(t),()=>{p.clearMenuBar(t)}),[u,t,p]);let y=oe(!1),x=f?f.focused:!1;ae(()=>{let $=y.current;y.current=x,x&&!$?h&&h():!x&&$&&m&&m()},[x,h,m]);let g=v(()=>{p.closeWindow(t),d&&d()},[p,t,d]),b=v(()=>{p.focusWindow(t)},[p,t]),S=v($=>{p.moveWindow(t,$)},[p,t]),D=v($=>{p.resizeWindow(t,$)},[p,t]),z=v(()=>{p.minimizeWindow(t)},[p,t]),M=v(()=>{f&&f.windowState==="maximized"?p.restoreWindow(t):p.maximizeWindow(t)},[p,t,f]);return f?o(nt,{appId:t},o(At,{id:t,title:n,icon:r,defaultPosition:f.position,defaultSize:f.size,minSize:a,resizable:l,windowState:f.windowState,focused:f.focused,zIndex:f.zIndex,onClose:g,onFocus:b,onMove:S,onResize:D,onMinimize:z,onMaximize:M,children:c})):(p.openWindow({id:t,title:n,icon:r,position:i,size:s}),null)}var ji={sm:{padding:"3px 10px",fontSize:"12px",borderRadius:"4px"},md:{padding:"6px 14px",fontSize:"13px",borderRadius:"6px"},lg:{padding:"8px 20px",fontSize:"15px",borderRadius:"6px"}},Gi={primary:{bg:"#3b82f6",color:"white",border:"#3b82f6"},secondary:{bg:"#f8fafc",color:"#0f172a",border:"#d1d5db"},outline:{bg:"transparent",color:"#0f172a",border:"#d1d5db"},ghost:{bg:"transparent",color:"#0f172a",border:"transparent"},danger:{bg:"#ef4444",color:"white",border:"#ef4444"}};function Xi(e){let{children:t,onClick:n,variant:r="secondary",size:i="md",disabled:s=!1,fullWidth:a=!1,type:l="button",className:d,style:u,ariaLabel:h,active:m=!1}=e,c=q(()=>{let p=ji[i]??ji.md,f=Gi[r]??Gi.secondary,y={padding:p.padding,fontSize:p.fontSize,borderRadius:p.borderRadius,border:`1px solid ${f.border}`,backgroundColor:m?"#3b82f6":f.bg,color:m?"white":f.color,cursor:s?"default":"pointer",fontFamily:"inherit",lineHeight:"1.4",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"4px",transition:"background-color 0.15s, opacity 0.15s",opacity:s?"0.5":"1"};return a&&(y.width="100%"),u&&Object.assign(y,u),y},[r,i,s,a,m,u]);return o("button",{type:l,onClick:s?void 0:n,disabled:s,className:d,style:c,"aria-label":h,"aria-pressed":m?"true":void 0},t)}var pd=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],Ct=Math.PI/180;function fd(e,t,n,r,i,s,a,l,d,u){let h=Math.cos(r*Ct),m=Math.sin(r*Ct),c=Math.cos(i*Ct),p=Math.sin(i*Ct),f=Math.cos(s*Ct),y=Math.sin(s*Ct),x=e*f-t*y,g=e*y+t*f,b=x*c-g*p,S=x*p+g*c,D=n,z=b,M=S*h-D*m,$=S*m+D*h,L=1+a*.001*$,R=l+z*u*L,P=d-M*u*L;return{sx:R,sy:P,depth:$}}function qi(e,t){let n=e.replace("#",""),r,i,s;return n.length===3?(r=parseInt(n[0]+n[0],16),i=parseInt(n[1]+n[1],16),s=parseInt(n[2]+n[2],16)):(r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16)),r=isNaN(r)?0:r,i=isNaN(i)?0:i,s=isNaN(s)?0:s,`rgba(${r},${i},${s},${t})`}function Ki(e,t){let n=e.replace("#",""),r,i,s;n.length===3?(r=parseInt(n[0]+n[0],16),i=parseInt(n[1]+n[1],16),s=parseInt(n[2]+n[2],16)):(r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16)),r=isNaN(r)?0:r,i=isNaN(i)?0:i,s=isNaN(s)?0:s;let a=d=>Math.max(0,Math.min(255,Math.round(d*t))),l=d=>a(d).toString(16).padStart(2,"0");return"#"+l(r)+l(i)+l(s)}function Zi(e){let{layers:t,width:n=700,height:r=500,perspective:i=.5,rotateX:s=35,rotateY:a=45,rotateZ:l=0,showLabels:d=!0,showAxes:u=!0,layerSpacing:h=2,colorScale:m=pd,gridColor:c="#94a3b8",title:p}=e,f=q(()=>{let A=0,k=0,w=0;for(let E=0;E<t.length;E++){let C=t[E],N=C.data.length;N>A&&(A=N);for(let T=0;T<N;T++){let W=C.data[T].length;W>k&&(k=W);for(let _=0;_<W;_++){let O=Math.abs(C.data[T][_]??0);O>w&&(w=O)}}}return{maxRows:Math.max(A,1),maxCols:Math.max(k,1),maxHeight:w>0?w:1}},[t]),y=q(()=>{let A=f.maxHeight+(t.length-1)*h+f.maxHeight,k=Math.sqrt(f.maxCols*f.maxCols+f.maxRows*f.maxRows+A*A),w=Math.min(n,r)*.75;return k>0?w/k:1},[f,t.length,h,n,r]),x=n/2,g=r/2,b=v((A,k,w)=>fd(A,k,w,s,a,l,i,x,g,y),[s,a,l,i,x,g,y]),S=v(()=>{if(!u)return[];let A=[],k=Math.max(f.maxCols,f.maxRows),w=f.maxCols/2,E=f.maxRows/2,C=b(-w,-E,0),N=b(w,-E,0);A.push(o("line",{key:"axis-x",x1:String(C.sx),y1:String(C.sy),x2:String(N.sx),y2:String(N.sy),stroke:"#374151","stroke-width":"1.5"})),A.push(o("text",{key:"axis-x-label",x:String(N.sx+8),y:String(N.sy+4),"font-size":"11","font-family":"sans-serif",fill:"#374151"},"X"));let T=b(-w,E,0);A.push(o("line",{key:"axis-y",x1:String(C.sx),y1:String(C.sy),x2:String(T.sx),y2:String(T.sy),stroke:"#374151","stroke-width":"1.5"})),A.push(o("text",{key:"axis-y-label",x:String(T.sx-12),y:String(T.sy+4),"font-size":"11","font-family":"sans-serif",fill:"#374151"},"Y"));let W=f.maxHeight+(t.length-1)*h,_=b(-w,-E,W);return A.push(o("line",{key:"axis-z",x1:String(C.sx),y1:String(C.sy),x2:String(_.sx),y2:String(_.sy),stroke:"#374151","stroke-width":"1.5"})),A.push(o("text",{key:"axis-z-label",x:String(_.sx-4),y:String(_.sy-8),"font-size":"11","font-family":"sans-serif",fill:"#374151"},"Z")),A},[u,f,t.length,h,b]),D=v(()=>{let A=[],k=f.maxCols/2,w=f.maxRows/2,E=[];for(let C=0;C<t.length;C++){let N=t[C],T=N.color??m[C%m.length],W=N.opacity??.7,_=C*h,O=N.data.length;for(let U=0;U<O-1;U++){let K=N.data[U],te=N.data[U+1],J=Math.min(K.length,te.length);for(let V=0;V<J-1;V++){let j=V-k,Y=V+1-k,H=U-w,Z=U+1-w,ee=(K[V]??0)+_,se=(K[V+1]??0)+_,Q=(te[V]??0)+_,le=(te[V+1]??0)+_,ce=b(j,H,ee),ue=b(Y,H,se),re=b(j,Z,Q),ge=b(Y,Z,le),me=(ce.depth+ue.depth+re.depth+ge.depth)/4,ne=`${ce.sx},${ce.sy} ${ue.sx},${ue.sy} ${ge.sx},${ge.sy} ${re.sx},${re.sy}`;E.push({points:ne,fill:qi(T,W),stroke:Ki(T,.7),strokeWidth:"0.5",depth:me,key:`quad-${C}-${U}-${V}`})}}if(O===1||O>0&&N.data[0].length===1)for(let U=0;U<O;U++){let K=N.data[U];for(let te=0;te<K.length;te++){let J=te-k,V=U-w,j=(K[te]??0)+_,Y=b(J,V,j),H=3,Z=`${Y.sx},${Y.sy-H} ${Y.sx+H},${Y.sy} ${Y.sx},${Y.sy+H} ${Y.sx-H},${Y.sy}`;E.push({points:Z,fill:qi(T,W),stroke:Ki(T,.7),strokeWidth:"0.5",depth:Y.depth,key:`point-${C}-${U}-${te}`})}}}E.sort((C,N)=>C.depth-N.depth);for(let C=0;C<E.length;C++){let N=E[C];A.push(o("polygon",{key:N.key,points:N.points,fill:N.fill,stroke:N.stroke,"stroke-width":N.strokeWidth,"stroke-linejoin":"round"}))}return A},[t,f,h,m,b]),z=v(()=>{let A=[],k=f.maxCols/2,w=f.maxRows/2;for(let E=0;E<=f.maxRows;E++){let C=E-w,N=b(-k,C,0),T=b(k,C,0);A.push(o("line",{key:`base-h-${E}`,x1:String(N.sx),y1:String(N.sy),x2:String(T.sx),y2:String(T.sy),stroke:c,"stroke-width":"0.3","stroke-dasharray":"2 2",opacity:"0.5"}))}for(let E=0;E<=f.maxCols;E++){let C=E-k,N=b(C,-w,0),T=b(C,w,0);A.push(o("line",{key:`base-v-${E}`,x1:String(N.sx),y1:String(N.sy),x2:String(T.sx),y2:String(T.sy),stroke:c,"stroke-width":"0.3","stroke-dasharray":"2 2",opacity:"0.5"}))}return A},[f,c,b]),M=v(()=>{if(!d)return[];let A=[],k=f.maxCols/2,w=f.maxRows/2;for(let E=0;E<t.length;E++){let C=t[E],N=E*h,T=0,W=0;for(let K=0;K<C.data.length;K++){let te=C.data[K];for(let J=0;J<te.length;J++)T+=te[J]??0,W++}let _=W>0?T/W:0,O=b(k+1,0,_+N),U=C.color??m[E%m.length];A.push(o("text",{key:`layer-label-${E}`,x:String(O.sx+8),y:String(O.sy+4),"font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:U},C.label))}return A},[d,t,f,h,m,b]),L=v(()=>p?[o("text",{key:"title",x:String(n/2),y:String(24),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,n])(),R=z(),P=S(),B=D(),I=M(),F=t.length===0?[o("text",{key:"empty-msg",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No layer data")]:[];return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"3D layer visualization",style:{fontFamily:"sans-serif",maxWidth:"100%"}},...L,...F,...R,...P,...B,...I)}function gd(e){if(typeof e=="string")return e;if(!isFinite(e)||isNaN(e))return"--";let t=e.toString().split("."),n=t[0],r=t.length>1?"."+t[1]:"",i=n.startsWith("-"),s=i?n.slice(1):n,a="";for(let l=0;l<s.length;l++)l>0&&(s.length-l)%3===0&&(a+=","),a+=s[l];return(i?"-":"")+a+r}function md(e){if(!isFinite(e)||isNaN(e))return"--";let t=Math.abs(e);return t<100&&t!==Math.floor(t)?t.toFixed(1):String(Math.round(t))}function Ji(e){let{value:t,label:n,prefix:r="",suffix:i="",trend:s,trendLabel:a,sparkline:l,width:d=280,height:u=160,valueColor:h="currentColor",trendUpColor:m="#22c55e",trendDownColor:c="#ef4444",backgroundColor:p="#ffffff"}=e,f=q(()=>gd(t),[t]),y=s!=null&&isFinite(s)&&!isNaN(s),x=l!=null&&l.length>1,g=n!=null&&n.length>0,b=y&&s>=0?m:c,S=20,D=g?u*.38:u*.45,z=Math.min(d*.15,48),M=z*.55,$=D+z*.4+8,L=g?$+22:D+z*.4+22,R=x?Math.min(u*.22,36):0,P=u-S-R,B=d-S*2,I=v(()=>[o("rect",{key:"bg",x:"0",y:"0",width:"100%",rx:"8",ry:"8",fill:p,stroke:"#e5e7eb","stroke-width":"1"})],[d,u,p]),F=v(()=>{let O=[],U=r+f+i;return O.push(o("text",{key:"value",x:String(d/2),y:String(D),"text-anchor":"middle","dominant-baseline":"central","font-size":String(z),"font-weight":"bold","font-family":"sans-serif",fill:h,"aria-label":`Value: ${U}`},r?o("tspan",{key:"prefix","font-size":String(M),"font-weight":"normal"},r):null,f,i?o("tspan",{key:"suffix","font-size":String(M),"font-weight":"normal"},i):null)),O},[d,D,z,M,f,r,i,h]),A=v(()=>g?[o("text",{key:"label",x:String(d/2),y:String($),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},n)]:[],[g,d,$,n]),k=v(()=>{if(!y)return[];let O=[],U=s,K=U>=0,te=8,J=md(U),V=(K?"+":"-")+J+(a?" "+a:""),j=d/2-40,Y=L;if(K){let H=`${j},${Y} ${j-te/2},${Y+te} ${j+te/2},${Y+te}`;O.push(o("polygon",{key:"trend-arrow",points:H,fill:b}))}else{let H=`${j},${Y+te} ${j-te/2},${Y} ${j+te/2},${Y}`;O.push(o("polygon",{key:"trend-arrow",points:H,fill:b}))}return O.push(o("text",{key:"trend-text",x:String(j+te+4),y:String(Y+te*.7),"text-anchor":"start","font-size":"12","font-family":"sans-serif",fill:b,"aria-label":`Trend: ${V}`},V)),O},[y,s,a,b,d,L]),w=v(()=>{if(!x)return[];let O=[],U=l,K=[];for(let ee of U)typeof ee=="number"&&isFinite(ee)&&!isNaN(ee)&&K.push(ee);if(K.length<2)return[];let te=1/0,J=-1/0;for(let ee of K)ee<te&&(te=ee),ee>J&&(J=ee);te===J&&(te-=1,J+=1);let V=J-te,j=B/(K.length-1),Y="";for(let ee=0;ee<K.length;ee++){let se=S+ee*j,Q=P+R-(K[ee]-te)/V*R;ee===0?Y+=`M ${se} ${Q}`:Y+=` L ${se} ${Q}`}let H=S+(K.length-1)*j,Z=Y+` L ${H} ${P+R} L ${S} ${P+R} Z`;return O.push(o("defs",{key:"spark-defs"},o("linearGradient",{key:"spark-grad",id:"sparkGrad",x1:"0",y1:"0",x2:"0",y2:"1"},o("stop",{key:"stop1",offset:"0%","stop-color":"#3b82f6","stop-opacity":"0.3"}),o("stop",{key:"stop2",offset:"100%","stop-color":"#3b82f6","stop-opacity":"0.05"})))),O.push(o("path",{key:"spark-fill",d:Z,fill:"url(#sparkGrad)"})),O.push(o("path",{key:"spark-line",d:Y,fill:"none",stroke:"#3b82f6","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})),O},[x,l,B,P,R,S]),E=I(),C=F(),N=A(),T=k(),W=w(),_=`${r}${f}${i}${g?`, ${n}`:""}`;return o("svg",{width:"100%",viewBox:`0 0 ${d} ${u}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":_,style:{fontFamily:"sans-serif"}},...E,...W,...C,...N,...T)}var nn=Math.PI/180;function hd(e,t,n,r,i,s,a,l){let d=Math.cos(r*nn),u=Math.sin(r*nn),h=Math.cos(i*nn),m=Math.sin(i*nn),c=e*h+n*m,p=-e*m+n*h,f=t*d-p*u,y=t*u+p*d;return{sx:s+c*l,sy:a-f*l,depth:y}}function Mt(e){return{x:Math.sin(e.theta)*Math.cos(e.phi),y:Math.sin(e.theta)*Math.sin(e.phi),z:Math.cos(e.theta)}}function on(e,t,n){let r=Math.sqrt(e*e+t*t+n*n);if(r<1e-10)return{theta:0,phi:0};let i=e/r,s=t/r,a=n/r,l=Math.acos(Math.max(-1,Math.min(1,a))),d=Math.atan2(s,i);return{theta:l,phi:d<0?d+2*Math.PI:d}}function it(e,t,n){let{x:r,y:i,z:s}=Mt(e),a=Math.cos(n),l=Math.sin(n),d,u,h;return t==="x"?(d=r,u=i*a-s*l,h=i*l+s*a):t==="y"?(d=r*a+s*l,u=i,h=-r*l+s*a):(d=r*a-i*l,u=r*l+i*a,h=s),on(d,u,h)}function Gn(e,t){let n=t.angle??Math.PI;switch(t.gate){case"X":return it(e,"x",Math.PI);case"Y":return it(e,"y",Math.PI);case"Z":return it(e,"z",Math.PI);case"H":{let{x:r,y:i,z:s}=Mt(e);return on(s,-i,r)}case"S":return it(e,"z",Math.PI/2);case"T":return it(e,"z",Math.PI/4);case"Rx":return it(e,"x",n);case"Ry":return it(e,"y",n);case"Rz":return it(e,"z",n)}}function Qi(e){let{state:t,gates:n,width:r=400,height:i=400,rotateY:s=-25,rotateX:a=15,zoom:l=1,interactive:d=!0,zoomable:u=!0,showVector:h=!0,showLabels:m=!0,showWireframe:c=!0,showTrail:p=!0,trailMaxPoints:f=200,trailColor:y="#ef4444",wireframeColor:x="#cbd5e1",vectorColor:g="#3b82f6",backgroundColor:b,sphereRadius:S=130,title:D,onStateChange:z}=e,[M,$]=G(t??{theta:0,phi:0}),[L,R]=G(s),[P,B]=G(a),[I,F]=G(l),A=oe([]),k=oe(!1),w=oe(null),E=oe(null);ae(()=>{t&&$(t)},[t?.theta,t?.phi]);let C=oe(0);ae(()=>{if(!n||n.length===0)return;C.current=0;let j=0,Y=()=>{C.current>=n.length||($(H=>{let Z=Gn(H,n[C.current]);return C.current++,z&&z(Z),Z}),j=requestAnimationFrame(Y))};return j=requestAnimationFrame(Y),()=>cancelAnimationFrame(j)},[n]),ae(()=>{let j=Mt(M);A.current.push(j),A.current.length>f&&A.current.splice(0,A.current.length-f)},[M.theta,M.phi]);let N=S*I,T=r/2,W=i/2,_=v((j,Y,H)=>hd(j,Y,H,P,L,T,W,N),[P,L,T,W,N]),O=v(j=>{if(!d)return;let Y=j;k.current=!0,w.current={mx:Y.clientX,my:Y.clientY,rx:P,ry:L}},[d,P,L]),U=v(j=>{if(!k.current||!w.current)return;let Y=j,H=w.current;R(H.ry+(Y.clientX-H.mx)*.5),B(H.rx-(Y.clientY-H.my)*.5)},[]),K=v(()=>{k.current=!1},[]),te=v(j=>{if(!u)return;let Y=j;Y.preventDefault(),F(H=>Math.max(.5,Math.min(3,H*(Y.deltaY>0?.95:1.05))))},[u]),J=[];if(b&&J.push(o("rect",{key:"bg",x:"0",y:"0",width:String(r),height:String(i),fill:b,rx:"6"})),D&&J.push(o("text",{key:"title",x:String(T),y:"24","text-anchor":"middle","font-size":"14","font-weight":"bold","font-family":"sans-serif",fill:"#374151"},D)),c){let Y=[];for(let ee=0;ee<=60;ee++){let se=ee/60*2*Math.PI,Q=_(Math.cos(se),Math.sin(se),0);Y.push(`${ee===0?"M":"L"}${Q.sx.toFixed(1)},${Q.sy.toFixed(1)}`)}J.push(o("path",{key:"eq",d:Y.join(" "),fill:"none",stroke:x,"stroke-width":"0.8",opacity:"0.5"}));let H=[];for(let ee=0;ee<=60;ee++){let se=ee/60*2*Math.PI,Q=_(Math.cos(se),0,Math.sin(se));H.push(`${ee===0?"M":"L"}${Q.sx.toFixed(1)},${Q.sy.toFixed(1)}`)}J.push(o("path",{key:"xz",d:H.join(" "),fill:"none",stroke:x,"stroke-width":"0.8",opacity:"0.4"}));let Z=[];for(let ee=0;ee<=60;ee++){let se=ee/60*2*Math.PI,Q=_(0,Math.cos(se),Math.sin(se));Z.push(`${ee===0?"M":"L"}${Q.sx.toFixed(1)},${Q.sy.toFixed(1)}`)}J.push(o("path",{key:"yz",d:Z.join(" "),fill:"none",stroke:x,"stroke-width":"0.8",opacity:"0.4"}))}let V=[{id:"x",dir:[1,0,0],color:"#ef4444"},{id:"y",dir:[0,1,0],color:"#22c55e"},{id:"z",dir:[0,0,1],color:"#3b82f6"}];for(let j of V){let Y=_(j.dir[0]*1.15,j.dir[1]*1.15,j.dir[2]*1.15),H=_(-j.dir[0]*1.15,-j.dir[1]*1.15,-j.dir[2]*1.15),Z=_(0,0,0);J.push(o("line",{key:`axis-${j.id}`,x1:String(H.sx),y1:String(H.sy),x2:String(Y.sx),y2:String(Y.sy),stroke:j.color,"stroke-width":"0.8",opacity:"0.4","stroke-dasharray":"3 3"}))}if(m){let j=[{text:"|0\u27E9",pos:[0,0,1.3]},{text:"|1\u27E9",pos:[0,0,-1.3]},{text:"|+\u27E9",pos:[1.3,0,0]},{text:"|-\u27E9",pos:[-1.3,0,0]},{text:"|+i\u27E9",pos:[0,1.3,0]},{text:"|-i\u27E9",pos:[0,-1.3,0]}];for(let Y of j){let H=_(Y.pos[0],Y.pos[1],Y.pos[2]);J.push(o("text",{key:`lbl-${Y.text}`,x:String(H.sx),y:String(H.sy),"text-anchor":"middle","dominant-baseline":"central","font-size":"11","font-family":"serif",fill:"#475569",style:{pointerEvents:"none"}},Y.text))}}if(p&&A.current.length>1){let j=A.current,Y=[];for(let H=0;H<j.length;H++){let Z=j[H],ee=_(Z.x,Z.y,Z.z);Y.push(`${H===0?"M":"L"}${ee.sx.toFixed(1)},${ee.sy.toFixed(1)}`)}J.push(o("path",{key:"trail",d:Y.join(" "),fill:"none",stroke:y,"stroke-width":"1.5",opacity:"0.5","stroke-linecap":"round","stroke-linejoin":"round"}))}if(h){let j=Mt(M),Y=_(0,0,0),H=_(j.x,j.y,j.z);J.push(o("line",{key:"vec-line",x1:String(Y.sx),y1:String(Y.sy),x2:String(H.sx),y2:String(H.sy),stroke:g,"stroke-width":"2.5","stroke-linecap":"round"})),J.push(o("circle",{key:"vec-point",cx:String(H.sx),cy:String(H.sy),r:"5",fill:g,stroke:"#fff","stroke-width":"1.5"}));let Z=(M.theta*180/Math.PI).toFixed(0),ee=(M.phi*180/Math.PI).toFixed(0);J.push(o("text",{key:"state-label",x:String(r-10),y:String(i-10),"text-anchor":"end","font-size":"10","font-family":"monospace",fill:"#64748b"},`\u03B8=${Z}\xB0 \u03C6=${ee}\xB0`))}return o("svg",{ref:E,width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":D??"Bloch sphere quantum state visualization",style:{fontFamily:"sans-serif",cursor:d?k.current?"grabbing":"grab":"default"},onMouseDown:d?O:void 0,onMouseMove:d?U:void 0,onMouseUp:d?K:void 0,onMouseLeave:d?K:void 0,onWheel:u?te:void 0},...J)}function bd(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];typeof r=="number"&&isFinite(r)&&!isNaN(r)&&t.push(r)}return t.sort((n,r)=>n-r),t}function Xn(e,t){if(e.length===0)return 0;if(e.length===1)return e[0];let n=t/100*(e.length-1),r=Math.floor(n),i=Math.ceil(n);if(r===i)return e[r];let s=n-r;return e[r]+s*(e[i]-e[r])}function qn(e){let t=bd(e);if(t.length===0)return null;let n=Xn(t,25),r=Xn(t,50),i=Xn(t,75),s=i-n,a=n-1.5*s,l=i+1.5*s,d=t[0];for(let p of t)if(p>=a){d=p;break}let u=t[t.length-1];for(let p=t.length-1;p>=0;p--)if(t[p]<=l){u=t[p];break}let h=0;for(let p of t)h+=p;let m=h/t.length,c=[];for(let p of t)(p<a||p>l)&&c.push(p);return{q1:n,median:r,q3:i,iqr:s,whiskerLow:d,whiskerHigh:u,mean:m,outliers:c,min:t[0],max:t[t.length-1]}}function xd(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function es(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",showOutliers:s=!0,showMean:a=!1,whiskerColor:l="#374151",boxWidth:d=.6,showGrid:u=!0,title:h,padding:m=60}=e,c=i==="vertical",p=n-m*2,f=r-m*2,y=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],x=q(()=>{let w=[];for(let E of t)w.push(qn(E.values));return w},[t]),g=q(()=>{let w=1/0,E=-1/0;for(let T of x){if(T===null)continue;let W=s&&T.outliers.length>0?Math.min(T.whiskerLow,T.outliers[0]):T.whiskerLow,_=s&&T.outliers.length>0?Math.max(T.whiskerHigh,T.outliers[T.outliers.length-1]):T.whiskerHigh;W<w&&(w=W),_>E&&(E=_)}isFinite(w)||(w=0,E=1);let C=E-w,N=C>0?C*.05:.5;return{min:w-N,max:E+N}},[x,s]),b=c?f:p,S=c?p:f,D=t.length>0?t.length:1,z=S/D,M=z*Math.min(Math.max(d,.1),.95),$=v(w=>{let E=g.max-g.min;return E===0?b/2:(w-g.min)/E*b},[g,b]),L=v(()=>{if(!u)return[];let w=[],E=g.max-g.min,C=xd(E),N=Math.ceil(g.min/C)*C;for(let T=N;T<=g.max;T+=C){let W=$(T),_=String(Math.round(T*1e3)/1e3);if(c){let O=m+f-W;w.push(o("line",{key:`grid-${T}`,x1:String(m),y1:String(O),x2:String(m+p),y2:String(O),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`glabel-${T}`,x:String(m-6),y:String(O+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},_))}else{let O=m+W;w.push(o("line",{key:`grid-${T}`,x1:String(O),y1:String(m),x2:String(O),y2:String(m+f),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`glabel-${T}`,x:String(O),y:String(m+f+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},_))}}return w},[u,g,$,c,m,p,f]),R=v(()=>{let w=[];return w.push(o("line",{key:"axis-value",x1:String(m),y1:String(c?m:m+f),x2:String(m),y2:String(m+f),stroke:"#374151","stroke-width":"1.5"})),w.push(o("line",{key:"axis-category",x1:String(m),y1:String(m+f),x2:String(m+p),y2:String(m+f),stroke:"#374151","stroke-width":"1.5"})),w},[m,p,f,c]),P=v(()=>{let w=[];for(let E=0;E<t.length;E++){let C=x[E];if(C===null)continue;let N=t[E],T=N.color??y[E%y.length],W=z*E+z/2,_=M/2;if(c){let O=m+f-$(C.q1),U=m+f-$(C.q3),K=m+f-$(C.median),te=m+f-$(C.whiskerLow),J=m+f-$(C.whiskerHigh),V=m+W;w.push(o("line",{key:`wl-${E}`,x1:String(V),y1:String(O),x2:String(V),y2:String(te),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wlc-${E}`,x1:String(V-_*.4),y1:String(te),x2:String(V+_*.4),y2:String(te),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wh-${E}`,x1:String(V),y1:String(U),x2:String(V),y2:String(J),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`whc-${E}`,x1:String(V-_*.4),y1:String(J),x2:String(V+_*.4),y2:String(J),stroke:l,"stroke-width":"1.5"}));let j=Math.min(O,U),Y=Math.abs(O-U);if(w.push(o("rect",{key:`box-${E}`,x:String(V-_),y:String(j),width:String(M),height:String(Math.max(Y,1)),fill:T,stroke:l,"stroke-width":"1.5",opacity:"0.8","aria-label":`${N.label}: Q1=${C.q1.toFixed(1)}, median=${C.median.toFixed(1)}, Q3=${C.q3.toFixed(1)}`,role:"img"})),w.push(o("line",{key:`med-${E}`,x1:String(V-_),y1:String(K),x2:String(V+_),y2:String(K),stroke:"#fff","stroke-width":"2.5"})),a){let H=m+f-$(C.mean);w.push(o("circle",{key:`mean-${E}`,cx:String(V),cy:String(H),r:"3.5",fill:"#fff",stroke:l,"stroke-width":"1.5","aria-label":`Mean: ${C.mean.toFixed(1)}`}))}if(s)for(let H=0;H<C.outliers.length;H++){let Z=m+f-$(C.outliers[H]);w.push(o("circle",{key:`out-${E}-${H}`,cx:String(V),cy:String(Z),r:"3",fill:"none",stroke:l,"stroke-width":"1.5","aria-label":`Outlier: ${C.outliers[H]}`}))}w.push(o("text",{key:`cat-${E}`,x:String(V),y:String(m+f+18),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"},N.label))}else{let O=m+$(C.q1),U=m+$(C.q3),K=m+$(C.median),te=m+$(C.whiskerLow),J=m+$(C.whiskerHigh),V=m+W;w.push(o("line",{key:`wl-${E}`,x1:String(O),y1:String(V),x2:String(te),y2:String(V),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wlc-${E}`,x1:String(te),y1:String(V-_*.4),x2:String(te),y2:String(V+_*.4),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wh-${E}`,x1:String(U),y1:String(V),x2:String(J),y2:String(V),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`whc-${E}`,x1:String(J),y1:String(V-_*.4),x2:String(J),y2:String(V+_*.4),stroke:l,"stroke-width":"1.5"}));let j=Math.min(O,U),Y=Math.abs(U-O);if(w.push(o("rect",{key:`box-${E}`,x:String(j),y:String(V-_),width:String(Math.max(Y,1)),height:String(M),fill:T,stroke:l,"stroke-width":"1.5",opacity:"0.8","aria-label":`${N.label}: Q1=${C.q1.toFixed(1)}, median=${C.median.toFixed(1)}, Q3=${C.q3.toFixed(1)}`,role:"img"})),w.push(o("line",{key:`med-${E}`,x1:String(K),y1:String(V-_),x2:String(K),y2:String(V+_),stroke:"#fff","stroke-width":"2.5"})),a){let H=m+$(C.mean);w.push(o("circle",{key:`mean-${E}`,cx:String(H),cy:String(V),r:"3.5",fill:"#fff",stroke:l,"stroke-width":"1.5","aria-label":`Mean: ${C.mean.toFixed(1)}`}))}if(s)for(let H=0;H<C.outliers.length;H++){let Z=m+$(C.outliers[H]);w.push(o("circle",{key:`out-${E}-${H}`,cx:String(Z),cy:String(V),r:"3",fill:"none",stroke:l,"stroke-width":"1.5","aria-label":`Outlier: ${C.outliers[H]}`}))}w.push(o("text",{key:`cat-${E}`,x:String(m-6),y:String(V+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},N.label))}}return w},[t,x,$,c,m,p,f,z,M,l,s,a,y]),B=v(()=>h?[o("text",{key:"title",x:String(n/2),y:String(m/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h)]:[],[h,n,m]),I=L(),F=R(),A=P(),k=B();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Box plot",style:{fontFamily:"sans-serif"}},...k,...I,...F,...A)}function ts(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function yd(e,t,n){return e<t?t:e>n?n:e}function Kn(e){return typeof e=="number"&&isFinite(e)&&!isNaN(e)}function ns(e){let{data:t=[],width:n=600,height:r=400,xLabel:i,yLabel:s,showGrid:a=!0,showAxes:l=!0,showLabels:d=!1,maxBubbleRadius:u=40,minBubbleRadius:h=4,defaultColor:m="#3b82f6",opacity:c=.7,title:p,padding:f=60}=e,y=q(()=>{let A=[];for(let k=0;k<t.length;k++){let w=t[k];Kn(w.x)&&Kn(w.y)&&Kn(w.r)&&A.push(w)}return A},[t]),x=n-f*2,g=r-f*2,b=q(()=>{if(y.length===0)return{xMin:0,xMax:1,yMin:0,yMax:1,rMin:0,rMax:1};let A=1/0,k=-1/0,w=1/0,E=-1/0,C=1/0,N=-1/0;for(let T of y)T.x<A&&(A=T.x),T.x>k&&(k=T.x),T.y<w&&(w=T.y),T.y>E&&(E=T.y),T.r<C&&(C=T.r),T.r>N&&(N=T.r);return A===k&&(A-=1,k+=1),w===E&&(w-=1,E+=1),C===N&&(C=0,N=N>0?N:1),{xMin:A,xMax:k,yMin:w,yMax:E,rMin:C,rMax:N}},[y]),S=v(A=>{let k=b.xMax-b.xMin;return f+(A-b.xMin)/k*x},[b,f,x]),D=v(A=>{let k=b.yMax-b.yMin;return f+g-(A-b.yMin)/k*g},[b,f,g]),z=v(A=>{let k=b.rMax-b.rMin;if(k===0)return(h+u)/2;let w=(A-b.rMin)/k;return h+w*(u-h)},[b,h,u]),M=v(()=>{if(!a)return[];let A=[],k=ts(b.xMax-b.xMin),w=Math.ceil(b.xMin/k)*k;for(let N=w;N<=b.xMax;N+=k){let T=S(N);A.push(o("line",{key:`grid-x-${N}`,x1:String(T),y1:String(f),x2:String(T),y2:String(f+g),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),A.push(o("text",{key:`grid-xlabel-${N}`,x:String(T),y:String(f+g+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(Math.round(N*1e3)/1e3)))}let E=ts(b.yMax-b.yMin),C=Math.ceil(b.yMin/E)*E;for(let N=C;N<=b.yMax;N+=E){let T=D(N);A.push(o("line",{key:`grid-y-${N}`,x1:String(f),y1:String(T),x2:String(f+x),y2:String(T),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),A.push(o("text",{key:`grid-ylabel-${N}`,x:String(f-6),y:String(T+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(Math.round(N*1e3)/1e3)))}return A},[a,b,S,D,f,x,g]),$=v(()=>{if(!l)return[];let A=[];return A.push(o("line",{key:"axis-y",x1:String(f),y1:String(f),x2:String(f),y2:String(f+g),stroke:"#374151","stroke-width":"1.5"})),A.push(o("line",{key:"axis-x",x1:String(f),y1:String(f+g),x2:String(f+x),y2:String(f+g),stroke:"#374151","stroke-width":"1.5"})),i&&A.push(o("text",{key:"x-label",x:String(f+x/2),y:String(f+g+40),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"#374151"},i)),s&&A.push(o("text",{key:"y-label",x:String(f-40),y:String(f+g/2),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"#374151",transform:`rotate(-90, ${f-40}, ${f+g/2})`},s)),A},[l,f,x,g,i,s]),L=v(()=>{let A=[];for(let k=0;k<y.length;k++){let w=y[k],E=S(w.x),C=D(w.y),N=yd(z(w.r),h,u),T=w.color??m;A.push(o("circle",{key:`bubble-${k}`,cx:String(E),cy:String(C),r:String(N),fill:T,opacity:String(c),stroke:T,"stroke-width":"1","stroke-opacity":"0.8","aria-label":w.label??`Bubble at (${w.x}, ${w.y}) size ${w.r}`,role:"img"})),d&&w.label&&A.push(o("text",{key:`label-${k}`,x:String(E),y:String(C-N-4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},w.label))}return A},[y,S,D,z,m,c,d,h,u]),R=v(()=>p?[o("text",{key:"title",x:String(n/2),y:String(f/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,n,f]),P=M(),B=$(),I=L(),F=R();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Bubble chart",style:{fontFamily:"sans-serif"}},...F,...P,...B,...I)}var Sd=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],vd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function wd(e){let t=e.split("-");return t.length!==3?new Date(NaN):new Date(parseInt(t[0],10),parseInt(t[1],10)-1,parseInt(t[2],10))}function os(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function rs(e){let t=e.replace("#",""),n=t.length===3?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,r=parseInt(n,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function kd(e,t,n){let r=i=>{let s=Math.max(0,Math.min(255,Math.round(i))).toString(16);return s.length===1?"0"+s:s};return`#${r(e)}${r(t)}${r(n)}`}function Cd(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=Math.min(Math.floor(n*r),r-1),s=n*r-i,a=rs(t[i]),l=rs(t[i+1]);return kd(a.r+(l.r-a.r)*s,a.g+(l.g-a.g)*s,a.b+(l.b-a.b)*s)}var Md=["#9be9a8","#40c463","#30a14e","#216e39"];function is(e){let{data:t=[],width:n=800,height:r=160,colorScale:i=Md,cellSize:s=12,cellGap:a=2,showMonthLabels:l=!0,showDayLabels:d=!0,emptyColor:u="#ebedf0",title:h}=e,{dateMap:m,startDate:c,endDate:p,maxVal:f}=q(()=>{let I=new Map,F=0,A=null,k=null;for(let C of t){let N=wd(C.date);if(isNaN(N.getTime()))continue;let T=os(N);I.set(T,(I.get(T)??0)+C.value);let W=I.get(T);W>F&&(F=W),(A===null||N<A)&&(A=N),(k===null||N>k)&&(k=N)}if(A===null||k===null){let C=new Date;A=new Date(C.getFullYear(),0,1),k=new Date(C.getFullYear(),11,31)}let w=new Date(A);w.setDate(w.getDate()-w.getDay());let E=new Date(k);return E.setDate(E.getDate()+(6-E.getDay())),{dateMap:I,startDate:w,endDate:E,maxVal:F>0?F:1}},[t]),y=d?30:0,x=l?16:0,g=h?28:0,b=y+10,S=g+x+4,D=v(()=>{let I=[],F=new Date(c),A=0;for(;F<=p;){let k=F.getDay();k===0&&F>c&&A++;let w=os(F),E=m.get(w),C=E!==void 0&&E>0?Cd(E/f,i):u,N=b+A*(s+a),T=S+k*(s+a);I.push(o("rect",{key:`day-${w}`,x:String(N),y:String(T),width:String(s),height:String(s),rx:"2",ry:"2",fill:C,"aria-label":`${w}: ${E??0}`})),F.setDate(F.getDate()+1)}return I},[c,p,m,f,i,u,s,a,b,S]),z=v(()=>{if(!l)return[];let I=[],F=new Date(c),A=0,k=-1;for(;F<=p;){let w=F.getDay();w===0&&F>c&&A++;let E=F.getMonth();if(E!==k&&w===0){k=E;let C=b+A*(s+a);I.push(o("text",{key:`month-${A}`,x:String(C),y:String(g+x-2),"font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},Sd[E]))}F.setDate(F.getDate()+1)}return I},[l,c,p,s,a,b,g,x]),M=v(()=>{if(!d)return[];let I=[],F=[1,3,5];for(let A of F){let k=S+A*(s+a)+s/2;I.push(o("text",{key:`day-label-${A}`,x:String(y),y:String(k),"text-anchor":"end","dominant-baseline":"central","font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},vd[A]))}return I},[d,s,a,S,y]),$=v(()=>h?[o("text",{key:"title",x:String(n/2),y:"18","text-anchor":"middle","font-size":"14","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},h)]:[],[h,n]);if(t.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Calendar heat map \u2014 no data"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"No data to display."));let L=$(),R=z(),P=M(),B=D();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Calendar heat map",style:{fontFamily:"sans-serif"}},...L,...R,...P,...B)}var Ed=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function Qe(e,t,n,r){let i=r-Math.PI/2;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function Id(e,t,n,r,i,s){let a=Qe(e,t,n,i),l=Qe(e,t,n,s),d=Qe(e,t,r,i),u=Qe(e,t,r,s),m=s-i>Math.PI?1:0;return[`M ${a.x} ${a.y}`,`A ${n} ${n} 0 ${m} 1 ${l.x} ${l.y}`,`L ${u.x} ${u.y}`,`A ${r} ${r} 0 ${m} 0 ${d.x} ${d.y}`,"Z"].join(" ")}function Rd(e,t,n,r,i,s,a){let l=Qe(e,t,n,r),d=Qe(e,t,n,i),u=Qe(e,t,n,s),h=Qe(e,t,n,a),m=i-r,c=a-s,p=m>Math.PI?1:0,f=c>Math.PI?1:0;return[`M ${l.x} ${l.y}`,`A ${n} ${n} 0 ${p} 1 ${d.x} ${d.y}`,`Q ${e} ${t} ${u.x} ${u.y}`,`A ${n} ${n} 0 ${f} 1 ${h.x} ${h.y}`,`Q ${e} ${t} ${l.x} ${l.y}`,"Z"].join(" ")}function Pd(e,t,n,r){let i=e.length;if(i===0)return{groups:[],chords:[]};let s=[],a=0;for(let c=0;c<i;c++){let p=0;for(let f=0;f<i;f++){let y=e[c]?.[f]??0;p+=Math.max(0,y)}s.push(p),a+=p}if(a===0){let c=(2*Math.PI-i*r)/Math.max(i,1),p=[],f=0;for(let y=0;y<i;y++)p.push({index:y,label:t[y]??`Group ${y}`,color:n[y%n.length],startAngle:f,endAngle:f+c,value:0}),f+=c+r;return{groups:p,chords:[]}}let l=2*Math.PI-i*r,d=[],u=0;for(let c=0;c<i;c++){let p=s[c]/a*l;d.push({index:c,label:t[c]??`Group ${c}`,color:n[c%n.length],startAngle:u,endAngle:u+p,value:s[c]}),u+=p+r}let h=[];for(let c=0;c<i;c++)h.push(d[c].startAngle);let m=[];for(let c=0;c<i;c++)for(let p=c;p<i;p++){let f=Math.max(0,e[c]?.[p]??0),y=c===p?0:Math.max(0,e[p]?.[c]??0);if(f===0&&y===0)continue;let x=f+y,g=s[c]>0?f/a*l:0,b=h[c],S=b+g;h[c]=S;let D=s[p]>0?f/a*l:0,z=h[p],M=z+D;if(h[p]=M,c===p){f>0&&m.push({sourceIndex:c,targetIndex:p,sourceStartAngle:b,sourceEndAngle:S,targetStartAngle:z,targetEndAngle:M,value:f,color:d[c].color});continue}let $=s[p]>0?y/a*l:0,R=h[p]+$;h[p]=R;let P=s[c]>0?y/a*l:0,I=h[c]+P;h[c]=I,(f>0||y>0)&&m.push({sourceIndex:c,targetIndex:p,sourceStartAngle:b,sourceEndAngle:Math.max(S,b+.001),targetStartAngle:z,targetEndAngle:Math.max(M,z+.001),value:x,color:d[c].color})}return{groups:d,chords:m}}function ss(e){let{matrix:t,labels:n,width:r=600,height:i=600,colors:s=Ed,padAngle:a=.05,showLabels:l=!0,showValues:d=!1,ribbonOpacity:u=.5,innerRadiusRatio:h=.9,title:m}=e;if(!t||t.length===0||!n||n.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Empty chord diagram"},o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let c=r/2,p=i/2,f=Math.min(r,i)/2-40,y=f*Math.max(.5,Math.min(.99,h)),x=f+16,g=q(()=>Pd(t,n,s,a),[t,n,s,a]),b=v(()=>{let L=[];for(let R=0;R<g.groups.length;R++){let P=g.groups[R];if(P.endAngle-P.startAngle<.001)continue;let I=Id(c,p,f,y,P.startAngle,P.endAngle);if(L.push(o("path",{key:`arc-${R}`,d:I,fill:P.color,stroke:"#fff","stroke-width":"1",role:"img","aria-label":`${P.label}: ${P.value}`})),l){let F=(P.startAngle+P.endAngle)/2,A=Qe(c,p,x,F),E=((F-Math.PI/2)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)<Math.PI,C=E?"start":"end",N=F*180/Math.PI-90;E||(N+=180);let T=d?`${P.label} (${P.value})`:P.label;L.push(o("text",{key:`label-${R}`,x:String(A.x),y:String(A.y),"text-anchor":C,"font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(${N}, ${A.x}, ${A.y})`,"dominant-baseline":"central","pointer-events":"none"},T))}}return L},[g,c,p,f,y,x,l,d]),S=v(()=>{let L=[];for(let R=0;R<g.chords.length;R++){let P=g.chords[R],B=Rd(c,p,y,P.sourceStartAngle,P.sourceEndAngle,P.targetStartAngle,P.targetEndAngle);L.push(o("path",{key:`ribbon-${R}`,d:B,fill:P.color,"fill-opacity":String(u),stroke:P.color,"stroke-width":"0.5","stroke-opacity":"0.3"}))}return L},[g,c,p,y,u]),D=v(()=>m?[o("text",{key:"title",x:String(r/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,r]),z=S(),M=b(),$=D();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Chord diagram",style:{fontFamily:"sans-serif"}},...$,...z,...M)}var $d=["#3b82f6","#22c55e","#f59e0b","#8b5cf6","#ef4444","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function Td(e){let t=[],n=0,r=[];r.push([e,0,null]);let i=0;for(;r.length>0;){let[s,a,l]=r.shift(),d=n++;i=Math.max(i,a);let u=s.children??[],h=[];for(let m=0;m<u.length;m++)h.push(n+r.length+m);t.push({id:d,node:s,depth:a,parentId:l,childIndices:h});for(let m=0;m<u.length;m++)r.push([u[m],a+1,d])}return{flatNodes:t,maxDepth:i}}function Dd(e){let t=e.length,n=new Array(t).fill(0);for(let r=t-1;r>=0;r--){let i=e[r];if(i.childIndices.length===0)n[r]=1;else{let s=0;for(let a of i.childIndices)a<t&&(s+=n[a]);n[r]=Math.max(s,1)}}return n}function zd(e,t,n,r,i,s,a,l){let{flatNodes:d,maxDepth:u}=Td(e);if(d.length===0)return[];let h=Dd(d),m=t-s*2,c=n-s*2,p=a==="horizontal",f=u+1,y=p?f>1?(m-r)/u:0:f>1?(c-i)/u:0,x=new Array(d.length),g=h[0],b=p?c:m,S=g>0?b/g:b,D=new Array(d.length);D[0]=[0,g];let z=[0],M=0;for(;M<z.length;){let $=z[M];M++;let L=d[$],[R,P]=D[$],B=(R+P)/2,I=s+L.depth*y,F=s+(B-.5)*S,A=p?I:F,k=p?F:I,w=L.node.color??l[L.depth%l.length];x[$]={id:L.id,label:L.node.label,value:L.node.value!==void 0?String(L.node.value):"",color:w,depth:L.depth,x:A,y:k,parentId:L.parentId,childCount:L.childIndices.length,subtreeLeafCount:h[$]};let E=R;for(let C of L.childIndices)if(C<d.length){let N=h[C],T=E+N;D[C]=[E,T],E=T,z.push(C)}}return x}function as(e){let{data:t,width:n=800,height:r=500,orientation:i="horizontal",nodeWidth:s=120,nodeHeight:a=40,showValues:l=!0,showConnectors:d=!0,connectorColor:u="#94a3b8",colors:h=$d,title:m,padding:c=40}=e;if(!t)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Empty decomposition tree"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let p=i==="horizontal",f=q(()=>zd(t,n,r,s,a,c,i,h),[t,n,r,s,a,c,i,h]),y=q(()=>{let M=new Map;for(let $=0;$<f.length;$++){let L=f[$];M.set(L.id,L)}return M},[f]),x=v(()=>{if(!d)return[];let M=[];for(let $=0;$<f.length;$++){let L=f[$];if(L.parentId===null)continue;let R=y.get(L.parentId);if(!R)continue;let P,B,I,F;p?(P=R.x+s,B=R.y+a/2,I=L.x,F=L.y+a/2):(P=R.x+s/2,B=R.y+a,I=L.x+s/2,F=L.y);let A=(P+I)/2,k=(B+F)/2,w;p?w=`M ${P} ${B} C ${A} ${B}, ${A} ${F}, ${I} ${F}`:w=`M ${P} ${B} C ${P} ${k}, ${I} ${k}, ${I} ${F}`,M.push(o("path",{key:`conn-${$}`,d:w,fill:"none",stroke:u,"stroke-width":"1.5","stroke-opacity":"0.7"}))}return M},[f,y,p,s,a,d,u]),g=v(()=>{let M=[];for(let $=0;$<f.length;$++){let L=f[$];M.push(o("rect",{key:`node-rect-${L.id}`,x:String(L.x),y:String(L.y),width:String(s),height:String(a),rx:"4",ry:"4",fill:L.color,stroke:"#374151","stroke-width":"1",role:"img","aria-label":L.value?`${L.label}: ${L.value}`:L.label}));let R=l&&L.value?L.y+a/2-2:L.y+a/2+4;M.push(o("text",{key:`node-label-${L.id}`,x:String(L.x+s/2),y:String(R),"text-anchor":"middle","font-size":"11","font-weight":"bold","font-family":"sans-serif",fill:"#fff","pointer-events":"none"},L.label)),l&&L.value&&M.push(o("text",{key:`node-value-${L.id}`,x:String(L.x+s/2),y:String(L.y+a/2+12),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"rgba(255,255,255,0.85)","pointer-events":"none"},L.value))}return M},[f,s,a,l]),b=v(()=>m?[o("text",{key:"title",x:String(n/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,n]),S=x(),D=g(),z=b();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Decomposition tree",style:{fontFamily:"sans-serif"}},...z,...S,...D)}var ls=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function Ad(e){return ls[e%ls.length]}function cs(e,t,n){let r=t/2,i=n/2,s=Math.min(t,n)*.3,a=e.length,l=[];for(let d=0;d<a;d++){let u=e[d],h=2*Math.PI*d/Math.max(a,1);l.push({id:u.id,label:u.label??u.id,color:u.color??Ad(d),x:u.x??r+s*Math.cos(h),y:u.y??i+s*Math.sin(h),vx:0,vy:0,fixed:u.fixed??!1,solid:u.solid??!0})}return l}function ds(e,t){let n=t*2;for(let r=0;r<e.length;r++){let i=e[r];if(i.solid)for(let s=r+1;s<e.length;s++){let a=e[s];if(!a.solid)continue;let l=a.x-i.x,d=a.y-i.y,u=l*l+d*d;if(u>=n*n||u<1e-4)continue;let h=Math.sqrt(u),m=l/h,c=d/h,p=n-h;if(i.fixed&&a.fixed)continue;i.fixed?(a.x+=m*p,a.y+=c*p):a.fixed?(i.x-=m*p,i.y-=c*p):(i.x-=m*p*.5,i.y-=c*p*.5,a.x+=m*p*.5,a.y+=c*p*.5);let f=i.vx-a.vx,y=i.vy-a.vy,x=f*m+y*c;x<=0||(i.fixed?(a.vx+=x*m,a.vy+=x*c):a.fixed?(i.vx-=x*m,i.vy-=x*c):(i.vx-=x*m,i.vy-=x*c,a.vx+=x*m,a.vy+=x*c))}}}function Ld(e,t,n,r,i,s,a,l,d=12){let u=e.length;if(u===0)return e;let h=new Map;for(let b=0;b<u;b++)h.set(e[b].id,b);let m=new Float64Array(u),c=new Float64Array(u);for(let b=0;b<u;b++){let S=e[b];for(let D=b+1;D<u;D++){let z=e[D],M=S.x-z.x,$=S.y-z.y,L=M*M+$*$;L<1&&(L=1);let R=Math.sqrt(L),P=i/L,B=M/R*P,I=$/R*P;m[b]+=B,c[b]+=I,m[D]-=B,c[D]-=I}}for(let b=0;b<t.length;b++){let S=t[b],D=h.get(S.source),z=h.get(S.target);if(D===void 0||z===void 0)continue;let M=e[D],$=e[z],L=$.x-M.x,R=$.y-M.y,P=Math.sqrt(L*L+R*R);if(P<.1)continue;let B=S.weight??1,I=P-l,F=s*I*B,A=L/P*F,k=R/P*F;m[D]+=A,c[D]+=k,m[z]-=A,c[z]-=k}let p=n/2,f=r/2,y=.001;for(let b=0;b<u;b++){let S=e[b];m[b]+=(p-S.x)*y,c[b]+=(f-S.y)*y}let x=20,g=[];for(let b=0;b<u;b++){let S=e[b];if(S.fixed){g.push({...S,vx:0,vy:0});continue}let D=(S.vx+m[b])*a,z=(S.vy+c[b])*a,M=Math.sqrt(D*D+z*z),$=10;M>$&&(D=D/M*$,z=z/M*$);let L=S.x+D,R=S.y+z;L=Math.max(x,Math.min(n-x,L)),R=Math.max(x,Math.min(r-x,R)),g.push({...S,x:L,y:R,vx:D,vy:z})}return ds(g,d),g}function Bd(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];t+=r.vx*r.vx+r.vy*r.vy}return t}function us(e){let{nodes:t,edges:n,width:r=600,height:i=400,nodeRadius:s=12,nodeStrokeWidth:a=2,solidNodes:l=!0,showLabels:d=!0,showArrows:u=!1,repulsionForce:h=300,attractionForce:m=.01,damping:c=.9,edgeLength:p=100,edgeColor:f="#94a3b8",edgeWidth:y=1.5,title:x,customForce:g,trails:b}=e;if(!t||t.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":x??"Empty force-directed graph"},x?o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},x):o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let S=oe(cs(t,r,i)),[D,z]=G(0),M=oe(!0),$=oe(!1),L=oe(n);L.current=n;let R=oe(g);R.current=g;let P=oe(null),B=oe({repulsionForce:h,attractionForce:m,damping:c,edgeLength:p,width:r,height:i,nodeRadius:s,solidNodes:l});B.current={repulsionForce:h,attractionForce:m,damping:c,edgeLength:p,width:r,height:i,nodeRadius:s,solidNodes:l};let I=oe(new Map);ae(()=>{S.current=cs(t,r,i),$.current=!1,M.current=!0,I.current=new Map,z(se=>se+1)},[t.length]),ae(()=>{let se=0,Q=()=>{if(!M.current)return;let le=B.current,ce=R.current,ue;if(ce?(ue=ce(S.current,L.current,le.width,le.height,P.current),le.solidNodes&&ds(ue,le.nodeRadius)):ue=Ld(S.current,L.current,le.width,le.height,le.repulsionForce,le.attractionForce,le.damping,le.edgeLength,le.nodeRadius),S.current=ue,b)for(let re=0;re<b.length;re++){let ge=b[re],me=ue.find(fe=>fe.id===ge.nodeId);if(!me)continue;let ne=I.current.get(ge.nodeId);ne||(ne=[],I.current.set(ge.nodeId,ne)),ne.push({x:me.x,y:me.y});let de=ge.maxPoints??200;ne.length>de&&ne.splice(0,ne.length-de)}if(!ce&&Bd(ue)<.01){$.current=!0,z(re=>re+1);return}z(re=>re+1),se=requestAnimationFrame(Q)};return se=requestAnimationFrame(Q),()=>{M.current=!1,cancelAnimationFrame(se)}},[]);let F=S.current,A=v(se=>{S.current=S.current.map(Q=>Q.id===se?{...Q,fixed:!Q.fixed,vx:0,vy:0}:Q),$.current&&($.current=!1,M.current=!0,z(Q=>Q+1))},[]),k=oe(null),w=oe(null),E=v(se=>{let Q=se,le=w.current;if(!le)return{x:Q.clientX,y:Q.clientY};let ce=le.getBoundingClientRect(),ue=r/ce.width,re=i/ce.height;return{x:(Q.clientX-ce.left)*ue,y:(Q.clientY-ce.top)*re}},[r,i]),C=oe(!1),N=v((se,Q)=>{Q.stopPropagation(),k.current=se;let le=S.current.find(ce=>ce.id===se);C.current=le?.fixed??!1,S.current=S.current.map(ce=>ce.id===se?{...ce,fixed:!0,vx:0,vy:0}:ce)},[]),T=v(se=>{let Q=E(se);if(P.current={x:Q.x,y:Q.y},!k.current)return;let le=k.current,ce=20;S.current=S.current.map(ue=>ue.id===le?{...ue,x:Math.max(ce,Math.min(r-ce,Q.x)),y:Math.max(ce,Math.min(i-ce,Q.y))}:ue),$.current&&($.current=!1,M.current=!0),z(ue=>ue+1)},[r,i,E]),W=v(()=>{let se=k.current;se&&(S.current=S.current.map(Q=>Q.id===se?{...Q,fixed:C.current}:Q)),k.current=null},[]),_=v(()=>{k.current=null,P.current=null},[]),O=q(()=>{let se=new Map;for(let Q=0;Q<F.length;Q++)se.set(F[Q].id,F[Q]);return se},[D]),U=v(()=>u?[o("defs",{key:"arrow-defs"},o("marker",{key:"arrowhead",id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:String(10+s),refY:"3.5",orient:"auto",markerUnits:"userSpaceOnUse"},o("polygon",{key:"arrow-poly",points:"0 0, 10 3.5, 0 7",fill:f})))]:[],[u,s,f]),K=v(()=>{let se=[];for(let Q=0;Q<n.length;Q++){let le=n[Q],ce=O.get(le.source),ue=O.get(le.target);if(!ce||!ue||le.weight!==void 0&&le.weight<=0)continue;let re=le.weight?Math.max(.5,Math.min(6,y*le.weight)):y,ge={key:`edge-${Q}`,x1:String(ce.x),y1:String(ce.y),x2:String(ue.x),y2:String(ue.y),stroke:le.color??f,"stroke-width":String(re),"stroke-opacity":"0.6"};u&&(ge["marker-end"]="url(#arrowhead)"),se.push(o("line",ge))}return se},[D,f,y,u]),te=v(()=>{let se=[];for(let Q=0;Q<F.length;Q++){let le=F[Q];se.push(o("circle",{key:`node-${le.id}`,cx:String(le.x),cy:String(le.y),r:String(s),fill:le.color,stroke:le.fixed?"#0f172a":"#fff","stroke-width":le.fixed?"3":String(a),style:{cursor:k.current===le.id?"grabbing":"grab"},onMouseDown:ce=>N(le.id,ce),onDblClick:()=>A(le.id),role:"button",tabIndex:0,"aria-label":`Node: ${le.label}${le.fixed?" (locked)":""} \u2014 drag to move, double-click to lock`})),d&&se.push(o("text",{key:`label-${le.id}`,x:String(le.x),y:String(le.y+s+14),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151","pointer-events":"none"},le.label))}return se},[D,s,d,A]),J=v(()=>x?[o("text",{key:"title",x:String(r/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},x)]:[],[x,r]),V=v(()=>{if(!b||b.length===0)return[];let se=[];for(let Q=0;Q<b.length;Q++){let le=b[Q],ce=I.current.get(le.nodeId);if(!ce||ce.length<2)continue;let ue=[];for(let re=0;re<ce.length;re++){let ge=ce[re];ue.push(`${re===0?"M":"L"}${ge.x.toFixed(1)},${ge.y.toFixed(1)}`)}se.push(o("path",{key:`trail-${le.nodeId}`,d:ue.join(" "),fill:"none",stroke:le.color??"#3b82f6","stroke-width":String(le.width??1),opacity:String(le.opacity??.5),"stroke-linecap":"round","stroke-linejoin":"round"}))}return se},[D,b]),j=U(),Y=V(),H=K(),Z=te(),ee=J();return o("svg",{ref:w,width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":x??"Force-directed graph \u2014 drag nodes to move, double-click to lock",style:{fontFamily:"sans-serif",cursor:k.current?"grabbing":"default"},onMouseMove:T,onMouseUp:W,onMouseLeave:_},...j,...ee,...Y,...H,...Z)}var ps=["#3b82f6","#6366f1","#8b5cf6","#a855f7","#c084fc","#d8b4fe","#e9d5ff","#f3e8ff"];function fs(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",showLabels:s=!0,showValues:a=!0,showPercentage:l=!0,gapSize:d=2,colors:u=ps,title:h}=e,m=i==="vertical",c=h?30:0,p=120,f=q(()=>{let L=0;for(let R=0;R<t.length;R++)t[R].value>L&&(L=t[R].value);return L>0?L:1},[t]),y=v(L=>f===0?0:Math.max(.05,L/f),[f]),x=v((L,R)=>R||(u[L%u.length]??ps[0]),[u]),g=v(()=>{if(t.length===0)return[];let L=[],R=40,P=n-R*2-p,B=r-c-R*2,I=d*(t.length-1),F=Math.max(1,(B-I)/t.length),A=R+P/2;for(let k=0;k<t.length;k++){let w=t[k],E=k<t.length-1?t[k+1]:null,C=x(k,w.color),N=y(w.value),T=E!==null?y(E.value):N*.6,W=P/2*N,_=P/2*T,O=c+R+k*(F+d),U=A-W,K=A+W,te=A+_,J=A-_,V=`${U},${O} ${K},${O} ${te},${O+F} ${J},${O+F}`;L.push(o("polygon",{key:`section-${k}`,points:V,fill:C,stroke:"#fff","stroke-width":"1"}));let j=R+P+12,Y=O+F/2;if(s&&L.push(o("text",{key:`label-${k}`,x:String(j),y:String(Y-(a||l?6:0)),"text-anchor":"start","font-size":"12","font-weight":"bold","font-family":"sans-serif",fill:"#374151"},w.label)),a||l){let H="";if(a&&(H=String(w.value)),l&&t.length>0){let Z=t[0].value,ee=Z>0?Math.round(w.value/Z*100):0;H+=a?` (${ee}%)`:`${ee}%`}L.push(o("text",{key:`value-${k}`,x:String(j),y:String(Y+(s?10:4)),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},H))}}return L},[t,n,r,c,d,s,a,l,x,y,p]),b=v(()=>{if(t.length===0)return[];let L=[],R=40,P=n-R*2,I=r-c-R*2-40,F=d*(t.length-1),A=Math.max(1,(P-F)/t.length),k=c+R+I/2;for(let w=0;w<t.length;w++){let E=t[w],C=w<t.length-1?t[w+1]:null,N=x(w,E.color),T=y(E.value),W=C!==null?y(C.value):T*.6,_=I/2*T,O=I/2*W,U=R+w*(A+d),K=k-_,te=k-O,J=k+O,V=k+_,j=`${U},${K} ${U+A},${te} ${U+A},${J} ${U},${V}`;L.push(o("polygon",{key:`section-${w}`,points:j,fill:N,stroke:"#fff","stroke-width":"1"}));let Y=U+A/2,H=c+R+I+14;if(s&&L.push(o("text",{key:`label-${w}`,x:String(Y),y:String(H),"text-anchor":"middle","font-size":"11","font-weight":"bold","font-family":"sans-serif",fill:"#374151"},E.label)),a||l){let Z="";if(a&&(Z=String(E.value)),l&&t.length>0){let ee=t[0].value,se=ee>0?Math.round(E.value/ee*100):0;Z+=a?` (${se}%)`:`${se}%`}L.push(o("text",{key:`value-${w}`,x:String(Y),y:String(H+14),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#6b7280"},Z))}}return L},[t,n,r,c,d,s,a,l,x,y]),S=v(()=>h?[o("text",{key:"title",x:String(n/2),y:String(20),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h)]:[],[h,n]),D=v(()=>t.length>0?[]:[o("text",{key:"empty",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,n,r]),z=S(),M=m?g():b(),$=D();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Funnel chart",style:{fontFamily:"sans-serif"}},...z,...M,...$)}var gs=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function ms(e){if(e<=0)return 1;let t=e/6,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function Fd(e,t){return t||gs[e%gs.length]}function hs(e){let{tasks:t=[],width:n=800,height:r,barHeight:i=24,barGap:s=8,showGrid:a=!0,showLabels:l=!0,showProgress:d=!1,timeUnit:u="days",title:h,padding:m=50}=e;if(t.length===0)return o("svg",{width:"100%",height:String(r??100),viewBox:`0 0 ${n} ${r??100}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Empty Gantt chart"},o("text",{x:String(n/2),y:String((r??100)/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.4"},"No tasks to display"));let c=l?120:0,p=q(()=>{let B=1/0,I=-1/0;for(let F of t){F.start<B&&(B=F.start);let A=F.start+F.duration;A>I&&(I=A)}return B===1/0&&(B=0,I=1),{min:B,max:I,range:I-B}},[t]),f=q(()=>{let B=t.slice();return B.sort((I,F)=>I.group!==F.group?(I.group??"").localeCompare(F.group??""):I.start-F.start),B},[t]),y=r??m*2+f.length*(i+s)+s+20,x=n-m-c-m,g=m+(h?20:0),b=v(B=>p.range===0?c+m:c+m+(B-p.min)/p.range*x,[p,x,c,m]),S=v(()=>{if(!a)return[];let B=[],I=ms(p.range),F=Math.ceil(p.min/I)*I,A=g+f.length*(i+s)+s;for(let k=F;k<=p.max;k+=I){let w=b(k);B.push(o("line",{key:`grid-${k}`,x1:String(w),y1:String(g),x2:String(w),y2:String(A),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"}))}return B},[a,p,g,f.length,i,s,b]),D=v(()=>{let B=[],I=ms(p.range),F=Math.ceil(p.min/I)*I,A=g-8;for(let k=F;k<=p.max;k+=I){let w=b(k);B.push(o("text",{key:`taxis-${k}`,x:String(w),y:String(A),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},String(k)))}return B.push(o("text",{key:"time-unit",x:String(n-m),y:String(A),"text-anchor":"end","font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.4","font-style":"italic"},u)),B},[p,g,b,u,n,m]),z=v(()=>{let B=[],I="";for(let F=0;F<f.length;F++){let A=f[F],k=g+F*(i+s)+s,w=b(A.start),E=Math.max(2,b(A.start+A.duration)-w),C=Fd(F,A.color);A.group&&A.group!==I&&(I=A.group,l&&B.push(o("text",{key:`group-${F}`,x:String(m),y:String(k+i/2-12),"font-size":"9","font-family":"sans-serif","font-weight":"bold",fill:"currentColor",opacity:"0.4","text-transform":"uppercase"},A.group))),B.push(o("rect",{key:`bar-${A.id}`,x:String(w),y:String(k),width:String(E),height:String(i),rx:"4",ry:"4",fill:C,role:"graphics-symbol","aria-label":`${A.label}: start ${A.start}, duration ${A.duration}`})),l&&B.push(o("text",{key:`label-${A.id}`,x:String(c+m-8),y:String(k+i/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"currentColor"},A.label.length>16?A.label.substring(0,14)+"..":A.label)),d&&E>30&&B.push(o("text",{key:`prog-${A.id}`,x:String(w+E/2),y:String(k+i/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#ffffff"},`${A.start}-${A.start+A.duration}`))}return B},[f,g,i,s,b,l,d,c,m]),M=v(()=>h?[o("text",{key:"title",x:String(n/2),y:String(m/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},h)]:[],[h,n,m]),$=S(),L=D(),R=z(),P=M();return o("svg",{width:"100%",height:String(y),viewBox:`0 0 ${n} ${y}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Gantt chart",style:{fontFamily:"sans-serif"}},...P,...$,...L,...R)}var Nd=Math.PI/180;function Wd(e){return e*Nd}function Ge(e,t,n,r){let i=Wd(r);return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function bs(e,t,n,r,i){let s=Ge(e,t,n,i),a=Ge(e,t,n,r),l=i-r,d=Math.abs(l)>180?1:0,u=l>0?1:0;return`M ${s.x} ${s.y} A ${n} ${n} 0 ${d} ${u===1?0:1} ${a.x} ${a.y}`}function _d(e,t,n){return e<t?t:e>n?n:e}function pt(e){return!isFinite(e)||isNaN(e)?"--":Math.abs(e)>=1e3?Math.round(e).toString():e===Math.floor(e)?e.toString():e.toFixed(1)}function xs(e){let{value:t,min:n=0,max:r=100,width:i=300,height:s=200,startAngle:a=-135,endAngle:l=135,arcWidth:d=20,showValue:u=!0,showMinMax:h=!0,showTicks:m=!0,tickCount:c=10,label:p,unit:f,colors:y=["#22c55e","#f59e0b","#ef4444"],needleColor:x="#374151",backgroundColor:g="#e5e7eb"}=e,b=isFinite(n)&&!isNaN(n)?n:0,S=isFinite(r)&&!isNaN(r)&&r>b?r:b+100,D=isFinite(t)&&!isNaN(t)?_d(t,b,S):b,z=(u?24:0)+(p?18:0),M=i/2,$=(s-z)*.6,L=Math.min(i/2,(s-z)*.55)-d/2-10,R=L-d,P=L-d/2,B=l-a,I=v(V=>{let j=S-b;if(j===0)return a;let Y=(V-b)/j;return a+Y*B},[b,S,a,B]),F=v(()=>{let V=bs(M,$,P,a,l);return[o("path",{key:"bg-arc",d:V,fill:"none",stroke:g,"stroke-width":String(d),"stroke-linecap":"round"})]},[M,$,P,a,l,g,d]),A=v(()=>{if(y.length===0)return[];let V=[],j=B/y.length;for(let Y=0;Y<y.length;Y++){let H=a+Y*j,Z=H+j,ee=bs(M,$,P,H,Z);V.push(o("path",{key:`seg-${Y}`,d:ee,fill:"none",stroke:y[Y],"stroke-width":String(d),"stroke-linecap":Y===0||Y===y.length-1?"round":"butt",opacity:"0.85"}))}return V},[y,B,a,M,$,P,d]),k=v(()=>{if(!m||c<=0)return[];let V=[],j=Math.max(1,Math.min(c,100));for(let Y=0;Y<=j;Y++){let H=Y/j,Z=a+H*B,ee=Y%2===0,se=ee?10:6,Q=Ge(M,$,L+4,Z),le=Ge(M,$,L+4+se,Z);if(V.push(o("line",{key:`tick-${Y}`,x1:String(Q.x),y1:String(Q.y),x2:String(le.x),y2:String(le.y),stroke:"currentColor",opacity:"0.4","stroke-width":ee?"2":"1"})),ee){let ce=b+H*(S-b),ue=Ge(M,$,L+4+se+12,Z);V.push(o("text",{key:`tick-label-${Y}`,x:String(ue.x),y:String(ue.y+3),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"currentColor",opacity:"0.55"},pt(ce)))}}return V},[m,c,a,B,M,$,L,b,S]),w=v(()=>{let V=[],j=I(D),Y=R-8,H=Ge(M,$,Y,j),Z=6,ee=j+90,se=j-90,Q=Ge(M,$,Z,ee),le=Ge(M,$,Z,se);return V.push(o("polygon",{key:"needle",points:`${H.x},${H.y} ${Q.x},${Q.y} ${le.x},${le.y}`,fill:x,stroke:"none"})),V.push(o("circle",{key:"needle-cap",cx:String(M),cy:String($),r:"8",fill:x,stroke:"#fff","stroke-width":"2"})),V},[D,I,M,$,R,x]),E=v(()=>{if(!u)return[];let V=[],j=pt(D),Y=j+(f?" "+f:""),H=$+P+20;return V.push(o("text",{key:"value-text",x:String(M),y:String(H),"text-anchor":"middle","font-size":"22","font-weight":"bold","font-family":"sans-serif",fill:"currentColor","aria-label":`Value: ${Y}`},j,f?o("tspan",{key:"unit","font-size":"14","font-weight":"normal",opacity:"0.6",fill:"currentColor"}," "+f):null)),V},[u,D,f,M,$,P]),C=v(()=>{if(!p)return[];let V=$+P+(u?40:20);return[o("text",{key:"label",x:String(M),y:String(V),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},p)]},[p,M,$,P,u]),N=v(()=>{if(!h)return[];let V=[],j=Ge(M,$,P,a),Y=Ge(M,$,P,l);return V.push(o("text",{key:"min-label",x:String(j.x-4),y:String(j.y+18),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor",opacity:"0.55"},pt(b))),V.push(o("text",{key:"max-label",x:String(Y.x+4),y:String(Y.y+18),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor",opacity:"0.55"},pt(S))),V},[h,M,$,P,a,l,b,S]),T=F(),W=A(),_=k(),O=w(),U=E(),K=C(),te=N(),J=`Gauge: ${pt(D)}${f?" "+f:""}, range ${pt(b)} to ${pt(S)}${p?", "+p:""}`;return o("svg",{width:"100%",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"meter","aria-valuenow":String(D),"aria-valuemin":String(b),"aria-valuemax":String(S),"aria-label":J,style:{fontFamily:"sans-serif"}},...T,...W,..._,...O,...U,...K,...te)}var Bt={AL:{name:"Alabama",path:"m 643,467.4 .4,-7.3 -.9,-1.2 -1.7,-.7 -2.5,-2.8 .5,-2.9 48.8,-5.1 -.7,-2.2 -1.5,-1.5 -.5,-1.4 .6,-6.3 -2.4,-5.7 .5,-2.6 .3,-3.7 2.2,-3.8 -.2,-1.1 -1.7,-1 v -3.2 l -1.8,-1.9 -2.9,-6.1 -12.9,-45.8 -45.7,4 1.3,2 -1.3,67 4.4,33.2 .9,-.5 1.3,.1 .6,.4 .8,-.1 2,-3.8 v -2.3 l 1.1,-1.1 1.4,.5 3.4,6.4 v .9 l -3.3,2.2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.3 h -3.3 l -2.2,-2.6 -2,-1.3 .7,-5.1 -.9,-1.6 .5,-5.4 1,-1.8 -.3,-2.7 -1.2,-1.3 -1.8,-.3 v -1.7 l 2.8,-5.8 5.9,-3.9 -.4,-13 .9,.4 .6,-.5 .1,-1.1 .9,-.6 1.4,1.2 .7,-.1 h 2.6 l 6.8,-2.6 .3,-1 h 1.2 l .7,-1.2 .4,.8 1.8,-.9 1.8,-1.7 .3,.5 1,-1 2.2,1.6 -.8,1.6 -1.2,1.4 .5,1.5 -1.4,1.6 .4,.9 2.3,-1.1 v -1.4 l 3.3,1.9 1.9,.7 1.9,.7 3,3.8 17,3.8 1.4,1 4,.8 .7,.5 2.8,-.2 4.9,.8 1.4,1.5 -1,1 .8,.8 3.8,.7 1.2,1.2 .1,4.4 -1.3,2.8 2,.1 1,-.8 .9,.8 -1.1,3.1 1,1.6 1.2,.3 z m -49.5,-37.3 -.5,.1 -1.5,1.6 .2,.5 1.5,-.6 v -.6 l .9,-.3 z m 1.6,-1.1 -1,.3 -.2,.7 .9,-.1 z m -1.3,-1.6 -.2,.9 h 1.7 l .6,-.4 .1,-1 z m 2.8,-3 -.3,1.9 1.2,-.5 .1,-1.4 z m 58.3,31.9 -2,.3 -.4,1.3 1.3,1.7 z"},WY:{name:"Wyoming",path:"m 355.3,143.7 -51,-5.3 -57.3,-7.9 -2,10.7 -8.5,54.8 -3.3,21.9 32.1,4.8 44.9,5.7 37.5,3.4 3.7,-44.2 z"},DC:{name:"District of Columbia",path:"m 803.5,252 -2.6,-1.8 -1,1.7 .5,.4 .4,.1 .6,.5 .3,.7 -.1,.5 .2,.5 z"}};function ys(e){let{width:t=959,height:n=593,stateColors:r={},defaultColor:i="#D0D0D0",strokeColor:s="#FFFFFF",strokeWidth:a=1,onStateClick:l,onStateHover:d,hoverColor:u="#FFD700",title:h="Map of the United States"}=e,m=q(()=>Object.keys(Bt),[]),c=v(g=>{l&&l(g)},[l]),p=v((g,b)=>{let S=b.currentTarget;S&&S.setAttribute("fill",u),d&&d(g)},[d,u]),f=v((g,b)=>{let S=b.currentTarget;if(S){let D=r[g]??i;S.setAttribute("fill",D)}d&&d(null)},[d,r,i]),y=q(()=>{let g=[];for(let b=0;b<m.length;b++){let S=m[b],D=Bt[S],z=r[S]??i,M={key:`state-${S}`,d:D.path,fill:z,stroke:s,"stroke-width":String(a),"stroke-linejoin":"round","data-state":S,role:"img","aria-label":D.name,style:{cursor:l?"pointer":"default"}};if(l){let L=S;M.onClick=()=>c(L),M.onKeyDown=R=>{(R.key==="Enter"||R.key===" ")&&c(L)},M.tabindex=0,M.role="button",M["aria-label"]=D.name}let $=S;M.onMouseOver=L=>p($,L),M.onMouseOut=L=>f($,L),g.push(o("path",M))}return g},[m,r,i,s,a,l,c,p,f]),x=o("title",{key:"map-title"},h);return o("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h,style:{fontFamily:"sans-serif"}},x,...y)}function Zn(e){let t=e.replace("#",""),n=t.length===3?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,r=parseInt(n,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function Od(e,t,n){let r=i=>{let s=Math.max(0,Math.min(255,Math.round(i))).toString(16);return s.length===1?"0"+s:s};return`#${r(e)}${r(t)}${r(n)}`}function Hd(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=Math.min(Math.floor(n*r),r-1),s=n*r-i,a=Zn(t[i]),l=Zn(t[i+1]);return Od(a.r+(l.r-a.r)*s,a.g+(l.g-a.g)*s,a.b+(l.b-a.b)*s)}function Yd(e){let{r:t,g:n,b:r}=Zn(e);return(.299*t+.587*n+.114*r)/255}var Vd=["#3b82f6","#fbbf24","#ef4444"];function Ss(e){let{data:t=[],rowLabels:n,columnLabels:r,width:i=600,height:s=400,colorScale:a=Vd,minValue:l,maxValue:d,showValues:u=!1,cellBorderColor:h="#fff",cellBorderWidth:m=1,title:c,padding:p=60}=e,f=t.length,y=q(()=>{let k=0;for(let w of t)w.length>k&&(k=w.length);return k},[t]),{minVal:x,maxVal:g}=q(()=>{let k=l??1/0,w=d??-1/0;for(let E of t)for(let C of E)l===void 0&&C<k&&(k=C),d===void 0&&C>w&&(w=C);return k===1/0&&(k=0),w===-1/0&&(w=1),k===w&&(w=k+1),{minVal:k,maxVal:w}},[t,l,d]),b=c?30:0,S=n?p:20,D=r?p:20,z=i-S-20,M=s-b-D-20,$=y>0?z/y:0,L=f>0?M/f:0,R=v(()=>{let k=[];for(let w=0;w<f;w++){let E=t[w];for(let C=0;C<y;C++){let N=C<E.length?E[C]:0,T=(N-x)/(g-x),W=Hd(T,a),_=S+C*$,O=b+20+w*L;if(k.push(o("rect",{key:`cell-${w}-${C}`,x:String(_),y:String(O),width:String($),height:String(L),fill:W,stroke:h,"stroke-width":String(m)})),u){let U=Yd(W)>.5?"#111827":"#ffffff";k.push(o("text",{key:`val-${w}-${C}`,x:String(_+$/2),y:String(O+L/2),"text-anchor":"middle","dominant-baseline":"central","font-size":String(Math.min(11,$*.3,L*.4)),"font-family":"sans-serif",fill:U},String(Math.round(N*100)/100)))}}}return k},[t,f,y,x,g,a,$,L,S,b,u,h,m]),P=v(()=>{let k=[];if(n)for(let w=0;w<f;w++){let E=w<n.length?n[w]:"",C=b+20+w*L+L/2;k.push(o("text",{key:`row-label-${w}`,x:String(S-8),y:String(C),"text-anchor":"end","dominant-baseline":"central","font-size":"11","font-family":"sans-serif",fill:"currentColor"},E))}if(r)for(let w=0;w<y;w++){let E=w<r.length?r[w]:"",C=S+w*$+$/2,N=b+20+f*L+16;k.push(o("text",{key:`col-label-${w}`,x:String(C),y:String(N),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor"},E))}return k},[n,r,f,y,$,L,S,b]),B=v(()=>c?[o("text",{key:"title",x:String(i/2),y:"22","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},c)]:[],[c,i]);if(f===0||y===0)return o("svg",{width:"100%",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":c??"Heat map \u2014 no data"},o("text",{x:String(i/2),y:String(s/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"No data to display."));let I=B(),F=R(),A=P();return o("svg",{width:"100%",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":c??"Heat map",style:{fontFamily:"sans-serif"}},...I,...F,...A)}function Ud(e,t){if(e.length===0)return[];let n=e[0],r=e[0];for(let a=1;a<e.length;a++){let l=e[a];l<n&&(n=l),l>r&&(r=l)}if(n===r)return[{min:n,max:r+1,count:e.length}];let i=(r-n)/t,s=[];for(let a=0;a<t;a++)s.push({min:n+a*i,max:n+(a+1)*i,count:0});for(let a=0;a<e.length;a++){let l=e[a],d=Math.floor((l-n)/i);d>=t&&(d=t-1),s[d].count++}return s}function jd(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function Jn(e){return Number.isInteger(e)?String(e):e.toFixed(1)}function vs(e){let{data:t=[],bins:n=10,width:r=600,height:i=400,barColor:s="#3b82f6",barGap:a=2,showGrid:l=!0,showValues:d=!0,title:u,xLabel:h,yLabel:m,padding:c=60}=e,p=Math.max(1,Math.round(n)),f=q(()=>Ud(t,p),[t,p]),y=q(()=>{let I=0;for(let F=0;F<f.length;F++)f[F].count>I&&(I=f[F].count);return I>0?I:1},[f]),x=r-c*2,g=i-c*2,b=v(()=>{if(!l)return[];let I=jd(y),F=[];for(let A=I;A<=y;A+=I){let k=c+g-A/y*g;F.push(o("line",{key:`grid-${A}`,x1:String(c),y1:String(k),x2:String(c+x),y2:String(k),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),F.push(o("text",{key:`grid-label-${A}`,x:String(c-8),y:String(k+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(A)))}return F},[l,y,c,x,g]),S=v(()=>{let I=[];return I.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+g),stroke:"#374151","stroke-width":"1.5"})),I.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+g),x2:String(c+x),y2:String(c+g),stroke:"#374151","stroke-width":"1.5"})),I},[c,x,g]),D=v(()=>{if(f.length===0)return[];let I=[],F=a*(f.length-1),A=Math.max(1,(x-F)/f.length);for(let k=0;k<f.length;k++){let w=f[k],E=w.count/y*g,C=c+k*(A+a),N=c+g-E;if(I.push(o("rect",{key:`bar-${k}`,x:String(C),y:String(N),width:String(A),height:String(E),fill:s})),d&&w.count>0&&I.push(o("text",{key:`val-${k}`,x:String(C+A/2),y:String(N-4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},String(w.count))),f.length<=15||k%2===0||k===f.length-1){let W=(f.length===1,Jn(w.min));I.push(o("text",{key:`xlabel-${k}`,x:String(C+A/2),y:String(c+g+14),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#6b7280"},W))}}if(f.length>0){let k=f[f.length-1],w=c+x;I.push(o("text",{key:"xlabel-end",x:String(w),y:String(c+g+14),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#6b7280"},Jn(k.max)))}return I},[f,y,a,s,d,c,x,g]),z=v(()=>{let I=[];return u&&I.push(o("text",{key:"title",x:String(r/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},u)),h&&I.push(o("text",{key:"x-label",x:String(c+x/2),y:String(i-8),"text-anchor":"middle","font-size":"12","font-family":"sans-serif",fill:"#374151"},h)),m&&I.push(o("text",{key:"y-label",x:String(14),y:String(c+g/2),"text-anchor":"middle","font-size":"12","font-family":"sans-serif",fill:"#374151",transform:`rotate(-90 14 ${c+g/2})`},m)),I},[u,h,m,r,i,c,x,g]),M=v(()=>t.length>0?[]:[o("text",{key:"empty",x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,r,i]),$=b(),L=S(),R=D(),P=z(),B=M();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":u??"Histogram",style:{fontFamily:"sans-serif"}},...P,...$,...L,...R,...B)}function Gd(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function ws(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",stemColor:s="#94a3b8",stemWidth:a=2,dotRadius:l=6,dotColor:d="#3b82f6",showGrid:u=!0,showValues:h=!0,title:m,padding:c=60}=e,p=i==="vertical",f=p?30:0,y=n-c*2,x=r-c*2-f,g=p?x:y,b=p?y:x,S=q(()=>{let k=0;for(let w=0;w<t.length;w++)t[w].value>k&&(k=t[w].value);return k>0?k:1},[t]),D=q(()=>t.length===0?0:b/t.length,[t.length,b]),z=v(()=>{if(!u)return[];let k=Gd(S),w=[];for(let E=k;E<=S;E+=k){let C=E/S*g;if(p){let N=c+x-C;w.push(o("line",{key:`grid-${E}`,x1:String(c),y1:String(N),x2:String(c+y),y2:String(N),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`grid-label-${E}`,x:String(c-8),y:String(N+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(E)))}else{let N=c+C;w.push(o("line",{key:`grid-${E}`,x1:String(N),y1:String(c),x2:String(N),y2:String(c+x),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`grid-label-${E}`,x:String(N),y:String(c+x+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(E)))}}return w},[u,S,p,c,y,x,g]),M=v(()=>{let k=[];return p?k.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})):k.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})),k.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+x),x2:String(c+y),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})),k},[p,c,y,x]),$=v(()=>{if(t.length===0)return[];let k=[];for(let w=0;w<t.length;w++){let E=t[w],C=E.value/S*g,N=D*w+D/2,T=E.color??d;if(p){let W=c+N,_=c+x,O=c+x-C;k.push(o("line",{key:`stem-${w}`,x1:String(W),y1:String(_),x2:String(W),y2:String(O),stroke:s,"stroke-width":String(a)})),k.push(o("circle",{key:`dot-${w}`,cx:String(W),cy:String(O),r:String(l),fill:T})),h&&k.push(o("text",{key:`val-${w}`,x:String(W),y:String(O-l-4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(E.value)));let U=W,K=c+x+16;k.push(o("text",{key:`cat-${w}`,x:String(U),y:String(K),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${U}, ${K})`},E.label))}else{let W=c+N,_=c,O=c+C;k.push(o("line",{key:`stem-${w}`,x1:String(_),y1:String(W),x2:String(O),y2:String(W),stroke:s,"stroke-width":String(a)})),k.push(o("circle",{key:`dot-${w}`,cx:String(O),cy:String(W),r:String(l),fill:T})),h&&k.push(o("text",{key:`val-${w}`,x:String(O+l+4),y:String(W+4),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(E.value))),k.push(o("text",{key:`cat-${w}`,x:String(c-8),y:String(W+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},E.label))}}return k},[t,S,D,d,l,s,a,h,p,c,y,x,g]),L=v(()=>m?[o("text",{key:"title",x:String(n/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,n,c]),R=v(()=>t.length>0?[]:[o("text",{key:"empty",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,n,r]),P=z(),B=M(),I=$(),F=L(),A=R();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Lollipop chart",style:{fontFamily:"sans-serif"}},...F,...P,...B,...I,...A)}function Qn(e){let t=e.replace("#",""),n=t.length===3?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,r=parseInt(n,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function Xd(e,t,n){let r=i=>{let s=Math.max(0,Math.min(255,Math.round(i))).toString(16);return s.length===1?"0"+s:s};return`#${r(e)}${r(t)}${r(n)}`}function qd(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=Math.min(Math.floor(n*r),r-1),s=n*r-i,a=Qn(t[i]),l=Qn(t[i+1]);return Xd(a.r+(l.r-a.r)*s,a.g+(l.g-a.g)*s,a.b+(l.b-a.b)*s)}function Kd(e){let{r:t,g:n,b:r}=Qn(e);return(.299*t+.587*n+.114*r)/255}var Zd=["#f0f9ff","#3b82f6","#1e3a8a"];function ks(e){let{data:t=[],labels:n,rowLabels:r,columnLabels:i,width:s=500,height:a=500,colorScale:l=Zd,showValues:d=!0,showDiagonal:u=!0,cellBorderColor:h="#e5e7eb",title:m,padding:c=70,symmetric:p=!1}=e,f=r??n,y=i??n,x=t.length,g=q(()=>{let T=0;for(let W of t)W.length>T&&(T=W.length);return T},[t]),b=q(()=>{if(!p||x===0)return t;let T=[],W=Math.max(x,g);for(let _=0;_<W;_++){let O=[];for(let U=0;U<W;U++){let K=t[_],te=K&&U<K.length?K[U]:0,J=t[U],V=J&&_<J.length?J[_]:0;te!==0?O.push(te):O.push(V)}T.push(O)}return T},[t,p,x,g]),S=b.length,D=q(()=>{let T=0;for(let W of b)W.length>T&&(T=W.length);return T},[b]),{minVal:z,maxVal:M}=q(()=>{let T=1/0,W=-1/0;for(let _ of b)for(let O of _)O<T&&(T=O),O>W&&(W=O);return T===1/0&&(T=0),W===-1/0&&(W=1),T===W&&(W=T+1),{minVal:T,maxVal:W}},[b]),$=m?30:0,L=f?c:20,R=y?c:20,P=s-L-20,B=a-$-R-20,I=D>0?P/D:0,F=S>0?B/S:0,A=v(()=>{let T=[];for(let W=0;W<S;W++){let _=b[W];for(let O=0;O<D;O++){let U=O<_.length?_[O]:0,K=(U-z)/(M-z),te=qd(K,l),J=L+O*I,V=$+20+W*F,j=W===O,Y=j&&u?"currentColor":h,H=j&&u?"2":"1";if(T.push(o("rect",{key:`cell-${W}-${O}`,x:String(J),y:String(V),width:String(I),height:String(F),fill:te,stroke:Y,"stroke-width":H})),d){let Z=Kd(te)>.5?"#111827":"#ffffff",ee=Math.min(12,I*.3,F*.35);T.push(o("text",{key:`val-${W}-${O}`,x:String(J+I/2),y:String(V+F/2),"text-anchor":"middle","dominant-baseline":"central","font-size":String(Math.max(8,ee)),"font-weight":j&&u?"bold":"normal","font-family":"sans-serif",fill:Z},String(Math.round(U*100)/100)))}}}return T},[b,S,D,z,M,l,I,F,L,$,d,u,h]),k=v(()=>{let T=[];if(f)for(let W=0;W<S;W++){let _=W<f.length?f[W]:"",O=$+20+W*F+F/2;T.push(o("text",{key:`row-label-${W}`,x:String(L-8),y:String(O),"text-anchor":"end","dominant-baseline":"central","font-size":"11","font-family":"sans-serif",fill:"currentColor"},_))}if(y)for(let W=0;W<D;W++){let _=W<y.length?y[W]:"",O=L+W*I+I/2,U=$+20+S*F+12;T.push(o("text",{key:`col-label-${W}`,x:String(O),y:String(U),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor"},_))}return T},[f,y,S,D,I,F,L,$]),w=v(()=>m?[o("text",{key:"title",x:String(s/2),y:"22","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},m)]:[],[m,s]);if(S===0||D===0)return o("svg",{width:"100%",viewBox:`0 0 ${s} ${a}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Matrix \u2014 no data"},o("text",{x:String(s/2),y:String(a/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"No data to display."));let E=w(),C=A(),N=k();return o("svg",{width:"100%",viewBox:`0 0 ${s} ${a}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Matrix visualization",style:{fontFamily:"sans-serif"}},...E,...C,...N)}var Jd=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function rn(e){if(!e.children||e.children.length===0)return Math.max(0,e.value??0);let t=0,n=[e];for(;n.length>0;){let r=n.pop();if(!r.children||r.children.length===0)t+=Math.max(0,r.value??0);else for(let i=r.children.length-1;i>=0;i--)n.push(r.children[i])}return t}function Qd(e){let t=0,n=[{node:e,depth:0}];for(;n.length>0;){let{node:r,depth:i}=n.pop();if(i>t&&(t=i),r.children)for(let s=r.children.length-1;s>=0;s--)n.push({node:r.children[s],depth:i+1})}return t}function eu(e,t,n,r,i,s,a){let l=[];if(rn(e)<=0)return l;let h=Qd(e)+1,m=s==="horizontal",c=m?i/h:r/h,p=[];for(p.push({node:e,depth:0,spanStart:m?t:n,spanEnd:m?t+r:n+i,colorIndex:0});p.length>0;){let f=p.shift(),{node:y,depth:x,spanStart:g,spanEnd:b,colorIndex:S}=f,D=rn(y);if(D<=0)continue;let z=b-g,M,$,L,R;if(m?(M=g,$=n+x*c,L=z,R=c):(M=t+x*c,$=g,L=c,R=z),l.push({x:M,y:$,w:L,h:R,label:y.label,value:D,color:y.color??a[S%a.length],depth:x}),y.children&&y.children.length>0){let P=g;for(let B=0;B<y.children.length;B++){let I=y.children[B],F=rn(I);if(F<=0)continue;let A=F/D*z;p.push({node:I,depth:x+1,spanStart:P,spanEnd:P+A,colorIndex:x===0?B:S}),P+=A}}}return l}function Cs(e){let{data:t,width:n=600,height:r=400,orientation:i="horizontal",showLabels:s=!0,showValues:a=!0,colors:l=Jd,borderColor:d="#ffffff",borderWidth:u=1,title:h,padding:m=10}=e,c=h?30:0,p=m,f=m+c,y=n-m*2,x=r-m*2-c;if(q(()=>rn(t),[t])<=0||y<=0||x<=0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Empty partition diagram"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data to display"));let b=q(()=>eu(t,p,f,y,x,i,l),[t,p,f,y,x,i,l]),S=[];h&&S.push(o("text",{key:"title",x:String(n/2),y:String(m+16),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h));for(let D=0;D<b.length;D++){let z=b[D];if(S.push(o("rect",{key:`cell-${D}`,x:String(z.x),y:String(z.y),width:String(Math.max(0,z.w)),height:String(Math.max(0,z.h)),fill:z.color,stroke:d,"stroke-width":String(u),role:"graphics-symbol","aria-label":`${z.label}: ${z.value}`})),s&&z.w>20&&z.h>14){let M=Math.floor(z.w/7),$=z.label.length>M?z.label.substring(0,Math.max(1,M-2))+"..":z.label;S.push(o("text",{key:`label-${D}`,x:String(z.x+z.w/2),y:String(z.y+z.h/2+(a?-2:4)),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#ffffff","pointer-events":"none"},$))}a&&z.w>30&&z.h>28&&S.push(o("text",{key:`value-${D}`,x:String(z.x+z.w/2),y:String(z.y+z.h/2+12),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"rgba(255,255,255,0.8)","pointer-events":"none"},String(z.value)))}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Partition diagram",style:{fontFamily:"sans-serif"}},...S)}function eo(e,t){let n=[];for(let r of t)n.push(String(e[r]??""));return n.join(" | ")}function Ms(e,t){let n=new Set;for(let i of e)n.add(eo(i,t));let r=Array.from(n);return r.sort(),r}function sn(e,t){if(e.length===0)return 0;switch(t){case"count":return e.length;case"sum":{let n=0;for(let r of e)n+=r;return n}case"avg":{let n=0;for(let r of e)n+=r;return n/e.length}case"min":{let n=e[0];for(let r=1;r<e.length;r++)e[r]<n&&(n=e[r]);return n}case"max":{let n=e[0];for(let r=1;r<e.length;r++)e[r]>n&&(n=e[r]);return n}}}function an(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function tu(e,t,n,r,i){let s=Ms(e,t),a=Ms(e,n),l=new Map;for(let p of e){let f=eo(p,t),y=eo(p,n),x=`${f}::${y}`;l.has(x)||l.set(x,[]);let g=l.get(x),b=0;for(let S of r){let D=p[S];if(typeof D=="number")b+=D;else if(typeof D=="string"){let z=parseFloat(D);isNaN(z)||(b+=z)}}g.push(b)}let d=new Map;for(let[p,f]of l)d.set(p,sn(f,i));let u=new Map;for(let p of s){let f=[];for(let y of a){let x=d.get(`${p}::${y}`);x!==void 0&&f.push(x)}u.set(p,sn(f,i==="count"?"sum":i))}let h=new Map;for(let p of a){let f=[];for(let y of s){let x=d.get(`${y}::${p}`);x!==void 0&&f.push(x)}h.set(p,sn(f,i==="count"?"sum":i))}let m=[];for(let p of u.values())m.push(p);let c=sn(m,i==="count"?"sum":i);return{rowKeys:s,colKeys:a,cells:d,rowTotals:u,colTotals:h,grandTotal:c}}function Es(e){let{data:t=[],rows:n=[],columns:r=[],values:i=[],aggregation:s="sum",width:a=600,height:l=400,showTotals:d=!0,title:u,headerColor:h="#3b82f6",cellPadding:m=8}=e;if(t.length===0||n.length===0&&r.length===0||i.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${a} ${l}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"table","aria-label":u??"Empty pivot table"},o("text",{x:String(a/2),y:String(l/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.4"},"No data to display"));let c=q(()=>tu(t,n,r,i,s),[t,n,r,i,s]),{rowKeys:p,colKeys:f,cells:y,rowTotals:x,colTotals:g,grandTotal:b}=c,S=u?30:0,D=f.length+(d?1:0),z=p.length+(d?1:0),M=1+D,$=1+z,L=Math.max(40,(a-m*2)/M),R=Math.max(20,Math.min(36,(l-S-m*2)/$)),P=L*M,B=R*$,I=Math.max(0,(a-P)/2),F=S+Math.max(0,(l-S-B)/2),A=[];u&&A.push(o("text",{key:"title",x:String(a/2),y:String(20),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},u)),A.push(o("rect",{key:"header-row-bg",x:String(I),y:String(F),width:String(P),height:String(R),fill:h})),A.push(o("rect",{key:"header-col-bg",x:String(I),y:String(F+R),width:String(L),height:String(R*z),fill:h,opacity:"0.85"})),A.push(o("text",{key:"corner",x:String(I+L/2),y:String(F+R/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},s.toUpperCase()));for(let k=0;k<f.length;k++){let w=I+(k+1)*L,E=Math.floor(L/7),C=f[k],N=C.length>E?C.substring(0,Math.max(1,E-2))+"..":C;A.push(o("text",{key:`ch-${k}`,x:String(w+L/2),y:String(F+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},N))}d&&A.push(o("text",{key:"ch-total",x:String(I+(f.length+1)*L+L/2),y:String(F+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},"Total"));for(let k=0;k<p.length;k++){let w=p[k],E=F+(k+1)*R;k%2===0&&A.push(o("rect",{key:`row-bg-${k}`,x:String(I+L),y:String(E),width:String(L*D),height:String(R),fill:"#f9fafb"}));let C=Math.floor(L/7),N=w.length>C?w.substring(0,Math.max(1,C-2))+"..":w;A.push(o("text",{key:`rh-${k}`,x:String(I+L/2),y:String(E+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},N));for(let T=0;T<f.length;T++){let W=f[T],_=`${w}::${W}`,O=y.get(_),U=I+(T+1)*L;A.push(o("rect",{key:`border-${k}-${T}`,x:String(U),y:String(E),width:String(L),height:String(R),fill:"none",stroke:"#e5e7eb","stroke-width":"0.5"})),A.push(o("text",{key:`cell-${k}-${T}`,x:String(U+L/2),y:String(E+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor"},O!==void 0?an(O):"-"))}if(d){let T=I+(f.length+1)*L,W=x.get(w)??0;A.push(o("rect",{key:`rt-bg-${k}`,x:String(T),y:String(E),width:String(L),height:String(R),fill:"#eff6ff"})),A.push(o("text",{key:`rt-${k}`,x:String(T+L/2),y:String(E+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#1e40af"},an(W)))}}if(d){let k=F+(p.length+1)*R;A.push(o("rect",{key:"total-row-bg",x:String(I),y:String(k),width:String(P),height:String(R),fill:"#eff6ff"})),A.push(o("text",{key:"total-label",x:String(I+L/2),y:String(k+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#1e40af"},"Total"));for(let E=0;E<f.length;E++){let C=f[E],N=g.get(C)??0,T=I+(E+1)*L;A.push(o("text",{key:`ct-${E}`,x:String(T+L/2),y:String(k+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#1e40af"},an(N)))}let w=I+(f.length+1)*L;A.push(o("text",{key:"grand-total",x:String(w+L/2),y:String(k+R/2+4),"text-anchor":"middle","font-size":"12","font-family":"sans-serif","font-weight":"bold",fill:"#1e3a8a"},an(b)))}return A.push(o("rect",{key:"outer-border",x:String(I),y:String(F),width:String(P),height:String(B),fill:"none",stroke:"#d1d5db","stroke-width":"1"})),o("svg",{width:"100%",viewBox:`0 0 ${a} ${l}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"table","aria-label":u??"Pivot table",style:{fontFamily:"sans-serif"}},...A)}function ln(e,t){return Math.PI*2*e/t-Math.PI/2}function cn(e,t,n,r){return{x:e+n*Math.cos(r),y:t+n*Math.sin(r)}}function Is(e){let{axes:t=[],series:n=[],width:r=500,height:i=500,levels:s=5,showLabels:a=!0,showValues:l=!1,showLegend:d=!0,showDots:u=!0,gridColor:h="#d1d5db",title:m}=e,c=t.length,p=m?30:0,f=d&&n.length>0?30:0,y=60,x=Math.min((r-y*2)/2,(i-y*2-p-f)/2),g=r/2,b=y+p+x,S=q(()=>{let A=[];for(let k=0;k<c;k++){let w=t[k]?.max;if(w!==void 0&&w>0){A.push(w);continue}let E=0;for(let C of n){let N=C.values[k];N!==void 0&&N>E&&(E=N)}A.push(E>0?E:1)}return A},[t,n,c]),D=v(()=>{if(c<3)return[];let A=[];for(let k=1;k<=s;k++){let w=x*k/s,E=[];for(let C=0;C<c;C++){let N=ln(C,c),T=cn(g,b,w,N);E.push(`${T.x},${T.y}`)}A.push(o("polygon",{key:`ring-${k}`,points:E.join(" "),fill:"none",stroke:h,"stroke-width":k===s?"1.5":"0.5","stroke-dasharray":k===s?"none":"3 2"}))}for(let k=0;k<c;k++){let w=ln(k,c),E=cn(g,b,x,w);A.push(o("line",{key:`spoke-${k}`,x1:String(g),y1:String(b),x2:String(E.x),y2:String(E.y),stroke:h,"stroke-width":"0.75"}))}return A},[c,s,x,g,b,h]),z=v(()=>{if(!a||c<3)return[];let A=[],k=16;for(let w=0;w<c;w++){let E=ln(w,c),C=cn(g,b,x+k,E),N="middle";C.x<g-5?N="end":C.x>g+5&&(N="start");let T=Math.abs(C.y-b)<5?"0.35em":C.y<b?"0em":"0.7em";A.push(o("text",{key:`label-${w}`,x:String(C.x),y:String(C.y),"text-anchor":N,dy:T,"font-size":"12","font-family":"sans-serif",fill:"currentColor"},t[w]?.label??`Axis ${w}`))}return A},[a,c,t,x,g,b]),M=v(()=>{if(c<3||n.length===0)return[];let A=[];for(let k=0;k<n.length;k++){let w=n[k],E=[],C=[],N=[];for(let T=0;T<c;T++){let W=w.values[T]??0,_=S[T],O=Math.min(W/_,1),U=x*O,K=ln(T,c),te=cn(g,b,U,K);E.push(`${te.x},${te.y}`),u&&C.push(o("circle",{key:`dot-${k}-${T}`,cx:String(te.x),cy:String(te.y),r:"3.5",fill:w.color,stroke:"#fff","stroke-width":"1.5"})),l&&N.push(o("text",{key:`val-${k}-${T}`,x:String(te.x),y:String(te.y-8),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:w.color},String(Math.round(W*100)/100)))}A.push(o("polygon",{key:`series-fill-${k}`,points:E.join(" "),fill:w.color,"fill-opacity":String(w.fillOpacity??.15),stroke:"none"})),A.push(o("polygon",{key:`series-line-${k}`,points:E.join(" "),fill:"none",stroke:w.color,"stroke-width":"2","stroke-linejoin":"round"}));for(let T of C)A.push(T);for(let T of N)A.push(T)}return A},[c,n,S,x,g,b,u,l]),$=v(()=>{if(!d||n.length===0)return[];let A=[],k=b+x+40,w=100,E=n.length*w,C=g-E/2;for(let N=0;N<n.length;N++){let T=n[N],W=C+N*w;A.push(o("rect",{key:`legend-swatch-${N}`,x:String(W),y:String(k),width:"12",height:"12",rx:"2",fill:T.color})),A.push(o("text",{key:`legend-text-${N}`,x:String(W+16),y:String(k+10),"font-size":"12","font-family":"sans-serif",fill:"currentColor"},T.label))}return A},[d,n,g,b,x]),L=v(()=>m?[o("text",{key:"title",x:String(r/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},m)]:[],[m,r]);if(c<3)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Radar chart \u2014 insufficient axes"},o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"Radar chart requires at least 3 axes."));let R=D(),P=z(),B=M(),I=$(),F=L();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Radar chart",style:{fontFamily:"sans-serif"}},...F,...R,...P,...B,...I)}var nu=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function ou(e,t){let n=new Map,r=new Map,i=new Map;for(let l of e)r.set(l,new Set),i.set(l,[]);for(let l of t){if(l.value<=0)continue;let d=r.get(l.target);d&&d.add(l.source);let u=i.get(l.source);u&&u.push(l.target)}let s=[];for(let l of e)r.get(l).size===0&&(n.set(l,0),s.push(l));if(s.length===0){for(let l of e)n.set(l,0);return n}let a=0;for(;a<s.length;){let l=s[a];a++;let d=n.get(l),u=i.get(l)??[];for(let h of u){let m=n.get(h),c=d+1;(m===void 0||c>m)&&n.set(h,c),s.includes(h)||s.push(h)}}for(let l of e)n.has(l)||n.set(l,0);return n}function ru(e,t,n,r,i,s,a,l){if(e.length===0)return{layoutNodes:[],layoutLinks:[]};let d=n-a*2,u=r-a*2,h=t.filter(P=>P.value>0),m=e.map(P=>P.id),c=ou(m,h),p=new Map,f=new Map;for(let P of m)p.set(P,0),f.set(P,0);for(let P of h)f.set(P.source,(f.get(P.source)??0)+P.value),p.set(P.target,(p.get(P.target)??0)+P.value);let y=0;for(let P of c.values())P>y&&(y=P);let x=new Map;for(let P=0;P<=y;P++)x.set(P,[]);for(let[P,B]of c)x.get(B).push(P);let g=new Map,b=y>0?(d-i)/y:0;for(let P=0;P<=y;P++)g.set(P,a+P*b);let S=new Map;for(let P=0;P<e.length;P++)S.set(e[P].id,e[P]);let D=[],z=new Map;for(let P=0;P<=y;P++){let B=x.get(P);if(B.length===0)continue;let I=0;for(let w of B){let E=p.get(w)??0,C=f.get(w)??0;I+=Math.max(E,C,1)}let F=u-s*(B.length-1),A=I>0?F/I:1,k=a;for(let w=0;w<B.length;w++){let E=B[w],C=S.get(E),N=p.get(E)??0,T=f.get(E)??0,W=Math.max(N,T,1),_=Math.max(4,W*A),O=e.findIndex(K=>K.id===E),U={id:E,label:C.label,color:C.color??l[O%l.length],column:P,x:g.get(P),y:k,height:_,totalIn:N,totalOut:T,totalValue:W};D.push(U),z.set(E,U),k+=_+s}}let M=new Map,$=new Map;for(let P of m)M.set(P,0),$.set(P,0);let L=[...h].sort((P,B)=>B.value-P.value),R=[];for(let P of L){let B=z.get(P.source),I=z.get(P.target);if(!B||!I)continue;let F=B.totalOut||1,A=I.totalIn||1,k=P.value/F*B.height,w=P.value/A*I.height,E=Math.max(1,(k+w)/2),C=M.get(P.source),N=$.get(P.target),T=B.y+C+k/2,W=I.y+N+w/2;M.set(P.source,C+k),$.set(P.target,N+w);let _=S.get(P.source);R.push({source:P.source,target:P.target,value:P.value,color:P.color??_?.color??B.color,sourceY:T,targetY:W,width:E})}return{layoutNodes:D,layoutLinks:R}}function Rs(e){let{nodes:t,links:n,width:r=800,height:i=500,nodeWidth:s=20,nodePadding:a=10,showLabels:l=!0,showValues:d=!1,linkOpacity:u=.4,colors:h=nu,title:m,padding:c=40}=e;if(!t||t.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Empty Sankey diagram"},o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let p=q(()=>ru(t,n,r,i,s,a,c,h),[t,n,r,i,s,a,c,h]),f=v(()=>{let D=[];for(let z=0;z<p.layoutLinks.length;z++){let M=p.layoutLinks[z],$=p.layoutNodes.find(F=>F.id===M.source),L=p.layoutNodes.find(F=>F.id===M.target);if(!$||!L)continue;let R=$.x+s,P=L.x,B=(R+P)/2,I=`M ${R} ${M.sourceY} C ${B} ${M.sourceY}, ${B} ${M.targetY}, ${P} ${M.targetY}`;D.push(o("path",{key:`link-${z}`,d:I,fill:"none",stroke:M.color,"stroke-width":String(Math.max(1,M.width)),"stroke-opacity":String(u),"stroke-linecap":"butt"})),d&&M.value>0&&D.push(o("text",{key:`link-val-${z}`,x:String(B),y:String((M.sourceY+M.targetY)/2-4),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#6b7280","pointer-events":"none"},String(M.value)))}return D},[p,s,u,d]),y=v(()=>{let D=[];for(let z=0;z<p.layoutNodes.length;z++){let M=p.layoutNodes[z];if(D.push(o("rect",{key:`node-${M.id}`,x:String(M.x),y:String(M.y),width:String(s),height:String(M.height),fill:M.color,stroke:"#374151","stroke-width":"0.5",role:"img","aria-label":`${M.label}: ${M.totalValue}`})),l){let $=p.layoutNodes.reduce((A,k)=>Math.max(A,k.column),0),L=M.column===$,R=L?M.x+s+6:M.x-6,P=L?"start":"end",B=M.column===0,I=B?M.x-6:R,F=B?"end":P;D.push(o("text",{key:`label-${M.id}`,x:String(I),y:String(M.y+M.height/2+4),"text-anchor":F,"font-size":"11","font-family":"sans-serif",fill:"#374151","pointer-events":"none"},M.label))}}return D},[p,s,l]),x=v(()=>m?[o("text",{key:"title",x:String(r/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,r,c]),g=f(),b=y(),S=x();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Sankey diagram",style:{fontFamily:"sans-serif"}},...S,...g,...b)}var iu=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],to=2*Math.PI;function Ft(e){if(!e.children||e.children.length===0)return Math.max(0,e.value??0);let t=0,n=[e];for(;n.length>0;){let r=n.pop();if(!r.children||r.children.length===0)t+=Math.max(0,r.value??0);else for(let i=r.children.length-1;i>=0;i--)n.push(r.children[i])}return t}function su(e){let t=0,n=[{node:e,depth:0}];for(;n.length>0;){let{node:r,depth:i}=n.pop();if(i>t&&(t=i),r.children)for(let s=r.children.length-1;s>=0;s--)n.push({node:r.children[s],depth:i+1})}return t}function au(e,t,n,r,i,s){let a=s-i,l=a>Math.PI?1:0,d=i-Math.PI/2,u=s-Math.PI/2,h=e+r*Math.cos(d),m=t+r*Math.sin(d),c=e+r*Math.cos(u),p=t+r*Math.sin(u),f=e+n*Math.cos(u),y=t+n*Math.sin(u),x=e+n*Math.cos(d),g=t+n*Math.sin(d);if(a>=to-.001){let b=d+Math.PI,S=e+r*Math.cos(b),D=t+r*Math.sin(b),z=e+n*Math.cos(b),M=t+n*Math.sin(b);return[`M ${h} ${m}`,`A ${r} ${r} 0 1 1 ${S} ${D}`,`A ${r} ${r} 0 1 1 ${h} ${m}`,`L ${x} ${g}`,`A ${n} ${n} 0 1 0 ${z} ${M}`,`A ${n} ${n} 0 1 0 ${x} ${g}`,"Z"].join(" ")}return[`M ${h} ${m}`,`A ${r} ${r} 0 ${l} 1 ${c} ${p}`,`L ${f} ${y}`,`A ${n} ${n} 0 ${l} 0 ${x} ${g}`,"Z"].join(" ")}function lu(e,t,n,r){let i=[],s=Ft(e);if(s<=0)return i;let a=su(e),l=a>0?(n-t)/(a+1):n-t,d=[];if(e.children&&e.children.length>0){let u=0;for(let h=0;h<e.children.length;h++){let m=e.children[h],c=Ft(m);if(c<=0)continue;let p=c/s*to;d.push({node:m,startAngle:u,endAngle:u+p,depth:0,colorIndex:h}),u+=p}}else return i.push({startAngle:0,endAngle:to,innerR:t,outerR:t+l,label:e.label,value:s,color:e.color??r[0],depth:0}),i;for(;d.length>0;){let u=d.shift(),{node:h,startAngle:m,endAngle:c,depth:p,colorIndex:f}=u,y=Ft(h);if(y<=0)continue;let x=t+p*l,g=x+l;if(i.push({startAngle:m,endAngle:c,innerR:x,outerR:g,label:h.label,value:y,color:h.color??r[f%r.length],depth:p}),h.children&&h.children.length>0){let b=m,S=c-m;for(let D=0;D<h.children.length;D++){let z=h.children[D],M=Ft(z);if(M<=0)continue;let $=M/y*S;d.push({node:z,startAngle:b,endAngle:b+$,depth:p+1,colorIndex:f}),b+=$}}}return i}function Ps(e){let{data:t,width:n=500,height:r=500,innerRadius:i=40,showLabels:s=!0,colors:a=iu,strokeColor:l="#ffffff",strokeWidth:d=1,title:u}=e,h=n/2,m=r/2,c=u?20:0,p=Math.min(h,m-c)-10;if(q(()=>Ft(t),[t])<=0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":u??"Empty sunburst chart"},o("text",{x:String(h),y:String(m),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data to display"));let y=q(()=>lu(t,i,p,a),[t,i,p,a]),x=[];u&&x.push(o("text",{key:"title",x:String(h),y:String(20),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},u));let g=m+c/2;for(let b=0;b<y.length;b++){let S=y[b],D=au(h,g,S.innerR,S.outerR,S.startAngle,S.endAngle);if(x.push(o("path",{key:`arc-${b}`,d:D,fill:S.color,stroke:l,"stroke-width":String(d),role:"graphics-symbol","aria-label":`${S.label}: ${S.value}`})),s){let z=S.endAngle-S.startAngle,M=S.startAngle+z/2-Math.PI/2,$=(S.innerR+S.outerR)/2,L=S.outerR-S.innerR,R=z*$;if(R>20&&L>14){let P=h+$*Math.cos(M),B=g+$*Math.sin(M),I=Math.floor(Math.min(R,L)/7),F=S.label.length>I?S.label.substring(0,Math.max(1,I-1))+"..":S.label;x.push(o("text",{key:`label-${b}`,x:String(P),y:String(B+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#ffffff","pointer-events":"none"},F))}}}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":u??"Sunburst chart",style:{fontFamily:"sans-serif"}},...x)}var cu=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function dn(e){if(!e.children||e.children.length===0)return Math.max(0,e.value);let t=0,n=[e];for(;n.length>0;){let r=n.pop();if(!r.children||r.children.length===0)t+=Math.max(0,r.value);else for(let i=r.children.length-1;i>=0;i--)n.push(r.children[i])}return t}function $s(e,t){if(e.length===0||t<=0)return 1/0;let n=0;for(let s of e)n+=s;if(n<=0)return 1/0;let r=n/t,i=0;for(let s of e){if(s<=0)continue;let a=s/r,l=Math.max(a/r,r/a);l>i&&(i=l)}return i}function du(e,t,n,r,i,s){let a=[],l=[],d=dn(e);if(d<=0||r<=0||i<=0)return a;let u=e.children&&e.children.length>0?e.children:[e],h=r*i,m=[];for(let c=0;c<u.length;c++){let p=u[c],f=dn(p);f<=0||m.push({label:p.label,value:f,area:f/d*h,color:p.color??s[c%s.length],node:p})}for(m.sort((c,p)=>p.area-c.area),l.push({nodes:m,rect:{x:t,y:n,w:r,h:i},depth:0});l.length>0;){let c=l.shift(),{nodes:p,rect:f,depth:y}=c;if(p.length===0)continue;let x={...f},g=0;for(;g<p.length&&x.w>0&&x.h>0;){let b=x.w>=x.h,S=b?x.h:x.w,D=[],z=[];D.push(p[g]),z.push(p[g].area),g++;let M=$s(z,S);for(;g<p.length;){let P=[...z,p[g].area],B=$s(P,S);if(B>M)break;D.push(p[g]),z.push(p[g].area),M=B,g++}let $=0;for(let P of z)$+=P;let L=S>0?$/S:0,R=0;for(let P=0;P<D.length;P++){let B=D[P],I=L>0?B.area/L:0,F,A,k,w;if(b?(F=x.x,A=x.y+R,k=L,w=I):(F=x.x+R,A=x.y,k=I,w=L),a.push({x:F,y:A,w:k,h:w,label:B.label,value:B.value,color:B.color,depth:y}),B.node.children&&B.node.children.length>0){let C=F+2,N=A+2+14,T=k-4,W=w-4-14;if(T>4&&W>4){let _=[],O=B.value,U=T*W;for(let K=0;K<B.node.children.length;K++){let te=B.node.children[K],J=dn(te);J<=0||_.push({label:te.label,value:J,area:J/O*U,color:te.color??s[(K+y+1)%s.length],node:te})}_.sort((K,te)=>te.area-K.area),l.push({nodes:_,rect:{x:C,y:N,w:T,h:W},depth:y+1})}}R+=I}b?x={x:x.x+L,y:x.y,w:x.w-L,h:x.h}:x={x:x.x,y:x.y+L,w:x.w,h:x.h-L}}}return a}function Ts(e){let{data:t,width:n=600,height:r=400,showLabels:i=!0,showValues:s=!0,colors:a=cu,borderColor:l="#ffffff",borderWidth:d=2,padding:u=2,title:h}=e,m=h?30:0,c=u,p=u+m,f=n-u*2,y=r-u*2-m;if(q(()=>dn(t),[t])<=0||f<=0||y<=0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Empty treemap"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data to display"));let g=q(()=>du(t,c,p,f,y,a),[t,c,p,f,y,a]),b=[];h&&b.push(o("text",{key:"title",x:String(n/2),y:String(u+16),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h));for(let S=0;S<g.length;S++){let D=g[S];if(b.push(o("rect",{key:`cell-${S}`,x:String(D.x),y:String(D.y),width:String(Math.max(0,D.w)),height:String(Math.max(0,D.h)),fill:D.color,stroke:l,"stroke-width":String(d),role:"graphics-symbol","aria-label":`${D.label}: ${D.value}`})),i&&D.w>20&&D.h>14){let z=Math.floor(D.w/7),M=D.label.length>z?D.label.substring(0,Math.max(1,z-2))+"..":D.label;b.push(o("text",{key:`label-${S}`,x:String(D.x+4),y:String(D.y+12),"font-size":"11","font-family":"sans-serif",fill:"#ffffff","pointer-events":"none"},M))}s&&D.w>30&&D.h>28&&b.push(o("text",{key:`value-${S}`,x:String(D.x+4),y:String(D.y+24),"font-size":"10","font-family":"sans-serif",fill:"rgba(255,255,255,0.8)","pointer-events":"none"},String(D.value)))}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Treemap chart",style:{fontFamily:"sans-serif"}},...b)}function Ds(e){let t=e.replace("#",""),n,r,i;return t.length===3?(n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16)):(n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16)),{r:isNaN(n)?0:n,g:isNaN(r)?0:r,b:isNaN(i)?0:i}}function uu(e,t,n){let r=s=>Math.max(0,Math.min(255,Math.round(s))),i=s=>r(s).toString(16).padStart(2,"0");return"#"+i(e)+i(t)+i(n)}function zs(e,t){if(t.length===0)return"#3b82f6";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=n*r,s=Math.floor(i),a=Math.min(s+1,r),l=i-s,d=Ds(t[s]),u=Ds(t[a]);return uu(d.r+(u.r-d.r)*l,d.g+(u.g-d.g)*l,d.b+(u.b-d.b)*l)}function un(e,t){if(e<=0)return 1;let n=e/t,r=Math.pow(10,Math.floor(Math.log10(n))),i=n/r;return i<=1.5?r:i<=3.5?2*r:i<=7.5?5*r:10*r}function pu(e,t,n,r,i,s,a,l,d,u){if(e&&e.length>0)return e;let h=Math.max(2,Math.min(50,r)),m=d/(h-1),c=u/(h-1);if(n){let f=[];for(let b=0;b<h;b++)for(let S=0;S<h;S++)f.push({x:i+S*m,y:a+b*c});let x=n(f,{gridSize:h,xMin:i,xMax:s,yMin:a,yMax:l}),g=[];for(let b=0;b<f.length;b++){let S=f[b],D=x[b]??{dx:0,dy:0},z=Math.sqrt(D.dx*D.dx+D.dy*D.dy);g.push({x:S.x,y:S.y,dx:D.dx,dy:D.dy,magnitude:z})}return g}if(!t)return[];let p=[];for(let f=0;f<h;f++)for(let y=0;y<h;y++){let x=i+y*m,g=a+f*c,b=t(x,g),S=Math.sqrt(b.dx*b.dx+b.dy*b.dy);p.push({x,y:g,dx:b.dx,dy:b.dy,magnitude:S})}return p}function fu(e,t,n,r,i){let{padding:s,chartWidth:a,chartHeight:l,xMin:d,xMax:u,yMin:h,yMax:m,xSpan:c,ySpan:p,showGrid:f,showAxes:y,colorByMagnitude:x,colorScale:g,arrowColor:b,arrowWidth:S,effectiveArrowScale:D,maxMagnitude:z,title:M,tickFontSize:$}=i,L=B=>s+(B-d)/c*a,R=B=>s+(m-B)/p*l;if(e.clearRect(0,0,t,n),M&&(e.save(),e.font="bold 16px sans-serif",e.fillStyle="#111827",e.textAlign="center",e.textBaseline="middle",e.fillText(M,t/2,s/2+4),e.restore()),f){e.save(),e.strokeStyle="#e5e7eb",e.lineWidth=.5,e.font=`${$}px sans-serif`,e.fillStyle="#6b7280";let B=un(c,10),I=Math.ceil(d/B)*B;for(let k=I;k<=u;k+=B){let w=L(k);e.beginPath(),e.moveTo(w,s),e.lineTo(w,s+l),e.stroke(),e.textAlign="center",e.textBaseline="top",e.fillText(String(Math.round(k*100)/100),w,s+l+4)}let F=un(p,10),A=Math.ceil(h/F)*F;for(let k=A;k<=m;k+=F){let w=R(k);e.beginPath(),e.moveTo(s,w),e.lineTo(s+a,w),e.stroke(),e.textAlign="right",e.textBaseline="middle",e.fillText(String(Math.round(k*100)/100),s-6,w)}e.restore()}if(y){if(e.save(),e.strokeStyle="#374151",e.lineWidth=S,h<=0&&m>=0){let B=R(0);e.beginPath(),e.moveTo(s,B),e.lineTo(s+a,B),e.stroke()}if(d<=0&&u>=0){let B=L(0);e.beginPath(),e.moveTo(B,s),e.lineTo(B,s+l),e.stroke()}e.strokeStyle="#d1d5db",e.lineWidth=1,e.strokeRect(s,s,a,l),e.restore()}let P=4;for(let B=0;B<r.length;B++){let I=r[B],F=I.magnitude??Math.sqrt(I.dx*I.dx+I.dy*I.dy);if(F<1e-10)continue;let A=L(I.x),k=R(I.y),w=I.dx*D,E=-I.dy*D,C=A+w,N=k+E,T;if(x){let _=F/z;T=zs(_,g)}else T=b;e.save(),e.strokeStyle=T,e.lineWidth=S,e.lineCap="round",e.beginPath(),e.moveTo(A,k),e.lineTo(C,N),e.stroke();let W=Math.sqrt(w*w+E*E);if(W>2){let _=w/W,O=E/W,U=-O,K=_,te=Math.min(P,W*.4),J=C-_*te+U*te*.5,V=N-O*te+K*te*.5,j=C-_*te-U*te*.5,Y=N-O*te-K*te*.5;e.fillStyle=T,e.beginPath(),e.moveTo(C,N),e.lineTo(J,V),e.lineTo(j,Y),e.closePath(),e.fill()}e.restore()}}function As(e){let{data:t,vectorFunction:n,width:r=600,height:i=600,gridSize:s=15,xRange:a=[-5,5],yRange:l=[-5,5],arrowScale:d=1,arrowColor:u="#3b82f6",showGrid:h=!0,showAxes:m=!0,colorByMagnitude:c=!1,colorScale:p=["#3b82f6","#8b5cf6","#ef4444"],title:f,padding:y=50,tickFontSize:x=10,arrowWidth:g=1.5,renderer:b="svg",useGPU:S=!1,computeWorker:D}=e,z=Math.max(2,Math.min(50,s)),M=r-y*2,$=i-y*2,L=a[0],R=a[1],P=l[0],B=l[1],I=R-L,F=B-P,A=q(()=>J=>y+(J-L)/I*M,[y,L,I,M]),k=q(()=>J=>y+(B-J)/F*$,[y,B,F,$]),w=q(()=>pu(t,n,D,z,L,R,P,B,I,F),[t,n,D,z,L,R,P,B,I,F]),E=q(()=>{let J=0;for(let V=0;V<w.length;V++){let j=w[V],Y=j.magnitude??Math.sqrt(j.dx*j.dx+j.dy*j.dy);Y>J&&(J=Y)}return J>0?J:1},[w]),C=q(()=>Math.min(M,$)/Math.max(z,2)/(2*E)*d,[M,$,z,E,d]);if(b==="canvas"){let J=oe(null),V=oe(0);return ae(()=>{let j=J.current;if(!j)return;let Y=j.getContext("2d");if(Y)return V.current&&cancelAnimationFrame(V.current),V.current=requestAnimationFrame(()=>{fu(Y,r,i,w,{padding:y,chartWidth:M,chartHeight:$,xMin:L,xMax:R,yMin:P,yMax:B,xSpan:I,ySpan:F,showGrid:h,showAxes:m,colorByMagnitude:c,colorScale:p,arrowColor:u,arrowWidth:g,effectiveArrowScale:C,maxMagnitude:E,title:f,tickFontSize:x})}),()=>{V.current&&cancelAnimationFrame(V.current)}},[w,r,i,y,M,$,L,R,P,B,I,F,h,m,c,p,u,g,C,E,f,x]),o("canvas",{ref:J,width:r,height:i,role:"img","aria-label":f??"Vector field plot",style:{fontFamily:"sans-serif",maxWidth:"100%"}})}let N=v(()=>{if(!h)return[];let J=[],V=un(I,10),j=Math.ceil(L/V)*V;for(let Z=j;Z<=R;Z+=V){let ee=A(Z);J.push(o("line",{key:`gridv-${Z}`,x1:String(ee),y1:String(y),x2:String(ee),y2:String(y+$),stroke:"#e5e7eb","stroke-width":"0.5"})),J.push(o("text",{key:`xtick-${Z}`,x:String(ee),y:String(y+$+16),"text-anchor":"middle","font-size":String(x),"font-family":"sans-serif",fill:"#6b7280"},String(Math.round(Z*100)/100)))}let Y=un(F,10),H=Math.ceil(P/Y)*Y;for(let Z=H;Z<=B;Z+=Y){let ee=k(Z);J.push(o("line",{key:`gridh-${Z}`,x1:String(y),y1:String(ee),x2:String(y+M),y2:String(ee),stroke:"#e5e7eb","stroke-width":"0.5"})),J.push(o("text",{key:`ytick-${Z}`,x:String(y-6),y:String(ee+4),"text-anchor":"end","font-size":String(x),"font-family":"sans-serif",fill:"#6b7280"},String(Math.round(Z*100)/100)))}return J},[h,L,R,P,B,I,F,A,k,y,M,$]),T=v(()=>{if(!m)return[];let J=[];if(P<=0&&B>=0){let V=k(0);J.push(o("line",{key:"axis-x",x1:String(y),y1:String(V),x2:String(y+M),y2:String(V),stroke:"#374151","stroke-width":String(g)}))}if(L<=0&&R>=0){let V=A(0);J.push(o("line",{key:"axis-y",x1:String(V),y1:String(y),x2:String(V),y2:String(y+$),stroke:"#374151","stroke-width":String(g)}))}return J.push(o("rect",{key:"chart-border",x:String(y),y:String(y),width:String(M),height:String($),fill:"none",stroke:"#d1d5db","stroke-width":"1"})),J},[m,L,R,P,B,A,k,y,M,$]),W=v(()=>{let J=[];for(let j=0;j<w.length;j++){let Y=w[j],H=Y.magnitude??Math.sqrt(Y.dx*Y.dx+Y.dy*Y.dy);if(H<1e-10)continue;let Z=A(Y.x),ee=k(Y.y),se=Y.dx*C,Q=-Y.dy*C,le=Z+se,ce=ee+Q,ue;if(c){let ge=H/E;ue=zs(ge,p)}else ue=u;J.push(o("line",{key:`arrow-line-${j}`,x1:String(Z),y1:String(ee),x2:String(le),y2:String(ce),stroke:ue,"stroke-width":String(g),"stroke-linecap":"round"}));let re=Math.sqrt(se*se+Q*Q);if(re>2){let ge=se/re,me=Q/re,ne=-me,de=ge,fe=Math.min(4,re*.4),xe=le-ge*fe+ne*fe*.5,ye=ce-me*fe+de*fe*.5,we=le-ge*fe-ne*fe*.5,X=ce-me*fe-de*fe*.5;J.push(o("polygon",{key:`arrow-head-${j}`,points:`${le},${ce} ${xe},${ye} ${we},${X}`,fill:ue}))}}return J},[w,A,k,C,c,E,p,u]),_=v(()=>f?[o("text",{key:"title",x:String(r/2),y:String(y/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},f)]:[],[f,r,y]),O=N(),U=T(),K=W(),te=_();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":f??"Vector field plot",style:{fontFamily:"sans-serif"}},...te,...O,...U,...K)}function gu(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e[r],s=i.type??(i.value>=0?"increase":"decrease");if(s==="total")t.push({label:i.label,value:n,type:"total",start:0,end:n});else{let a=n;n+=i.value,t.push({label:i.label,value:i.value,type:s,start:a,end:n})}}return t}function mu(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function Ls(e){let{data:t=[],width:n=600,height:r=400,increaseColor:i="#10b981",decreaseColor:s="#ef4444",totalColor:a="#3b82f6",connectorColor:l="#94a3b8",showValues:d=!0,showGrid:u=!0,showConnectors:h=!0,title:m,padding:c=60}=e,p=n-c*2,f=r-c*2,y=q(()=>gu(t),[t]),{minVal:x,maxVal:g}=q(()=>{let E=0,C=0;for(let N=0;N<y.length;N++){let T=y[N];T.start<E&&(E=T.start),T.end<E&&(E=T.end),T.start>C&&(C=T.start),T.end>C&&(C=T.end)}return E===C&&(C=E+1),{minVal:E,maxVal:C}},[y]),b=g-x,S=v(E=>c+f-(E-x)/b*f,[c,f,x,b]),D=q(()=>y.length===0?0:p/y.length,[y.length,p]),z=6,M=Math.max(1,D-z),$=v(()=>{if(!u)return[];let E=mu(b),C=[],N=Math.ceil(x/E)*E;for(let T=N;T<=g;T+=E){let W=S(T);C.push(o("line",{key:`grid-${T}`,x1:String(c),y1:String(W),x2:String(c+p),y2:String(W),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),C.push(o("text",{key:`grid-label-${T}`,x:String(c-8),y:String(W+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(T)))}return C},[u,b,x,g,S,c,p]),L=v(()=>{let E=[];E.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+f),stroke:"#374151","stroke-width":"1.5"}));let C=x<=0&&g>=0?S(0):c+f;return E.push(o("line",{key:"axis-x",x1:String(c),y1:String(C),x2:String(c+p),y2:String(C),stroke:"#374151","stroke-width":"1.5"})),E},[c,p,f,x,g,S]),R=v(()=>{if(y.length===0)return[];let E=[];for(let C=0;C<y.length;C++){let N=y[C],T=c+C*D+z/2,W=Math.max(N.start,N.end),_=Math.min(N.start,N.end),O=S(W),U=S(_),K=Math.max(0,U-O),te;if(N.type==="total"?te=a:N.type==="decrease"?te=s:te=i,E.push(o("rect",{key:`bar-${C}`,x:String(T),y:String(O),width:String(M),height:String(K),fill:te,rx:"2",ry:"2"})),d){let J=N.type==="decrease"||N.value<0?U+14:O-4,V=N.type==="total"?String(N.value):(N.value>=0?"+":"")+String(N.value);E.push(o("text",{key:`val-${C}`,x:String(T+M/2),y:String(J),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},V))}if(E.push(o("text",{key:`cat-${C}`,x:String(T+M/2),y:String(c+f+16),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},N.label)),h&&C<y.length-1){let J=y[C+1],V=S(N.end),j=c+(C+1)*D+z/2;J.type!=="total"&&E.push(o("line",{key:`conn-${C}`,x1:String(T+M),y1:String(V),x2:String(j),y2:String(V),stroke:l,"stroke-width":"1","stroke-dasharray":"3 2"}))}}return E},[y,D,M,S,i,s,a,l,d,h,c,f]),P=v(()=>m?[o("text",{key:"title",x:String(n/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,n,c]),B=v(()=>t.length>0?[]:[o("text",{key:"empty",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,n,r]),I=$(),F=L(),A=R(),k=P(),w=B();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Waterfall chart",style:{fontFamily:"sans-serif"}},...k,...I,...F,...A,...w)}var hu=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],bu=[0,-45,45,90];function xu(e,t,n,r,i){let s=t*.6,a=e.length*s,l=t,d=n*Math.PI/180,u=Math.abs(Math.cos(d)),h=Math.abs(Math.sin(d)),m=a*u+l*h,c=a*h+l*u;return{x:r-m/2,y:i-c/2,w:m,h:c}}function yu(e,t){return!(e.x+e.w<t.x||t.x+t.w<e.x||e.y+e.h<t.y||t.y+t.h<e.y)}function Su(e,t,n){return e.x>=0&&e.y>=0&&e.x+e.w<=t&&e.y+e.h<=n}function vu(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function Bs(e){let{words:t=[],width:n=600,height:r=400,minFontSize:i=10,maxFontSize:s=64,fontFamily:a="sans-serif",colors:l=hu,rotations:d=bu,padding:u=4,spiral:h="archimedean",title:m}=e,c=q(()=>{if(t.length===0)return[];let f=t.map((M,$)=>({...M,originalIndex:$})).filter(M=>M.text.length>0&&M.weight>0).sort((M,$)=>$.weight-M.weight);if(f.length===0)return[];let y=f[f.length-1].weight,g=f[0].weight-y;function b(M){if(g===0)return(i+s)/2;let $=(M-y)/g;return i+$*(s-i)}let S=[],D=n/2,z=r/2;for(let M=0;M<f.length;M++){let $=f[M],L=b($.weight),R=d[vu($.text)%d.length],P=$.color??l[M%l.length],B=!1,I=500,F=h==="archimedean"?4:5;for(let A=0;A<I;A++){let k,w;if(h==="archimedean"){let _=A*.1,O=F*_;k=O*Math.cos(_),w=O*Math.sin(_)}else{let _=Math.floor(A/4)+1,O=A%4,U=(A%4===0?0:A)*F;switch(O){case 0:k=_*F*4,w=U;break;case 1:k=-U,w=_*F*4;break;case 2:k=-_*F*4,w=-U;break;default:k=U,w=-_*F*4;break}}let E=D+k,C=z+w,N=xu($.text,L,R,E,C),T={x:N.x-u,y:N.y-u,w:N.w+u*2,h:N.h+u*2};if(!Su(T,n,r))continue;let W=!1;for(let _ of S)if(yu(T,_.bbox)){W=!0;break}if(!W){S.push({text:$.text,x:E,y:C,fontSize:L,rotation:R,color:P,bbox:T}),B=!0;break}}}return S},[t,n,r,i,s,l,d,u,h]);if(t.length===0||c.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Word cloud \u2014 no data"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":a,fill:"currentColor",opacity:"0.6"},"No words to display."));let p=[];m&&p.push(o("text",{key:"title",x:String(n/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":a,fill:"currentColor"},m));for(let f=0;f<c.length;f++){let y=c[f],x=y.rotation!==0?`translate(${y.x},${y.y}) rotate(${y.rotation})`:`translate(${y.x},${y.y})`;p.push(o("text",{key:`word-${f}`,transform:x,"text-anchor":"middle","dominant-baseline":"central","font-size":String(y.fontSize),"font-family":a,fill:y.color,"aria-label":y.text},y.text))}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Word cloud",style:{fontFamily:a}},...p)}var wu={0:"#1e293b",1:"#3b82f6"},ku="#666";function Fs(e){let{data:t=[],colorMap:n,width:r=600,height:i=600,cellGap:s=1,cellRadius:a=0,showGrid:l=!1,gridColor:d="#334155",showIndices:u=!1,backgroundColor:h="#0f172a",padding:m=10,onCellClick:c,onCellHover:p,title:f}=e,y=n??wu,x=t.length,g=q(()=>{let E=0;for(let C=0;C<t.length;C++){let N=t[C];N!==void 0&&N.length>E&&(E=N.length)}return E},[t]),b=u?20:0,S=f?24:0,D=q(()=>{let E=r-m*2-b,C=i-m*2-b-S;if(x===0||g===0)return{cellWidth:0,cellHeight:0};let N=Math.max(0,(E-s*(g-1))/g),T=Math.max(0,(C-s*(x-1))/x);return{cellWidth:N,cellHeight:T}},[r,i,m,x,g,s,b,S]),z=v(E=>{let C=y[E];return C!==void 0?C:ku},[y]),M=v(()=>o("rect",{key:"bg",x:"0",y:"0",width:String(r),height:String(i),fill:h}),[r,i,h]),$=v(()=>f?[o("text",{key:"title",x:String(r/2),y:String(m+14),"text-anchor":"middle","font-size":"14","font-weight":"bold","font-family":"sans-serif",fill:"#e2e8f0"},f)]:[],[f,r,m]),L=v(()=>{if(!l||x===0||g===0)return[];let{cellWidth:E,cellHeight:C}=D,N=m+b,T=m+b+S,W=g*E+(g-1)*s,_=x*C+(x-1)*s,O=[];for(let U=0;U<=g;U++){let K=N+U*(E+s)-s/2;O.push(o("line",{key:`vgrid-${U}`,x1:String(K),y1:String(T-s/2),x2:String(K),y2:String(T+_+s/2),stroke:d,"stroke-width":"0.5"}))}for(let U=0;U<=x;U++){let K=T+U*(C+s)-s/2;O.push(o("line",{key:`hgrid-${U}`,x1:String(N-s/2),y1:String(K),x2:String(N+W+s/2),y2:String(K),stroke:d,"stroke-width":"0.5"}))}return O},[l,x,g,D,m,b,S,s,d]),R=v(()=>{if(!u||x===0||g===0)return[];let{cellWidth:E,cellHeight:C}=D,N=m+b,T=m+b+S,W=[];for(let _=0;_<g;_++){let O=N+_*(E+s)+E/2,U=T-6;W.push(o("text",{key:`col-idx-${_}`,x:String(O),y:String(U),"text-anchor":"middle","font-size":"10","font-family":"monospace",fill:"#94a3b8"},String(_)))}for(let _=0;_<x;_++){let O=N-6,U=T+_*(C+s)+C/2+3;W.push(o("text",{key:`row-idx-${_}`,x:String(O),y:String(U),"text-anchor":"end","font-size":"10","font-family":"monospace",fill:"#94a3b8"},String(_)))}return W},[u,x,g,D,m,b,S,s]),P=v(()=>{if(x===0||g===0)return[];let{cellWidth:E,cellHeight:C}=D,N=m+b,T=m+b+S,W=[];for(let _=0;_<x;_++){let O=t[_];if(O!==void 0)for(let U=0;U<g;U++){let K=U<O.length?O[U]:0,te=N+U*(E+s),J=T+_*(C+s),V=z(K),j={key:`cell-${_}-${U}`,x:String(te),y:String(J),width:String(E),height:String(C),fill:V,rx:String(a),ry:String(a)};if(c){let Y=_,H=U,Z=K;j.onClick=()=>c(Y,H,Z),j.role="button",j.tabIndex=0}if(p){let Y=_,H=U,Z=K;j.onMouseEnter=()=>p(Y,H,Z)}W.push(o("rect",j))}}return W},[x,g,t,D,m,b,S,s,a,z,c,p]),B=M(),I=$(),F=L(),A=R(),k=P(),w=f?`${f} \u2014 ${x}x${g} discrete grid`:`${x}x${g} discrete grid`;return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":w},B,...I,...F,...A,...k)}
|
|
8
|
+
`);d(Math.max(H.length,1))}},[]),y=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'"Segoe UI", Roboto, Arial, sans-serif',fontSize:"13px",color:"#cccccc",backgroundColor:"#1e1e1e",overflow:"hidden"}),[]),x={height:"30px",backgroundColor:"#323233",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",color:"#999",flexShrink:"0",borderBottom:"1px solid var(--color-border, #252526)"},g={height:"28px",backgroundColor:"#3c3c3c",display:"flex",alignItems:"center",padding:"0 8px",gap:"2px",flexShrink:"0",position:"relative"},b={padding:"3px 8px",fontSize:"12px",color:"#cccccc",cursor:"pointer",borderRadius:"3px",backgroundColor:"transparent",border:"none",position:"relative"},S={...b,backgroundColor:"rgba(255,255,255,0.1)"},D={position:"absolute",top:"100%",left:"0",minWidth:"180px",backgroundColor:"#2d2d2d",border:"1px solid #454545",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.4)",padding:"4px 0",zIndex:"1000"},z={display:"block",width:"100%",padding:"6px 16px",fontSize:"12px",color:"#cccccc",backgroundColor:"transparent",border:"none",textAlign:"left",cursor:"pointer",transition:"background 0.1s"},M={flex:"1",display:"flex",overflow:"hidden"},$={width:"220px",backgroundColor:"#252526",borderRight:"none",display:"flex",flexDirection:"column",flexShrink:"0",overflowY:"auto"},L={width:"1px",backgroundColor:"#007acc",cursor:"col-resize",flexShrink:"0",opacity:"0.4",transition:"opacity 0.2s"},R={padding:"8px 12px",fontSize:"11px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.5px",color:"#bbbbbb"},P=(Y,H,Z)=>({padding:"3px 8px",paddingLeft:`${12+Y*16}px`,fontSize:"13px",cursor:"pointer",color:H?"#cccccc":"#d4d4d4",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",borderRadius:"3px",margin:"0 4px",transition:"background-color 0.1s",backgroundColor:Z?"rgba(255,255,255,0.08)":"transparent"}),B={flex:"1",display:"flex",flexDirection:"column",overflow:"hidden"},I={height:"35px",backgroundColor:"#252526",display:"flex",alignItems:"center",flexShrink:"0"},F={padding:"0 16px",height:"35px",lineHeight:"35px",backgroundColor:"#1e1e1e",color:"#ffffff",fontSize:"13px",cursor:"pointer",border:"none",borderBottom:"2px solid #007acc",boxSizing:"border-box"},A={flex:"1",display:"flex",overflow:"auto",backgroundColor:"#1e1e1e",fontFamily:'"Cascadia Code", "Fira Code", "Consolas", monospace',fontSize:"13px",lineHeight:"20px"},k={padding:"8px 0",textAlign:"right",color:"#858585",userSelect:"none",minWidth:"48px",paddingRight:"12px",paddingLeft:"12px",flexShrink:"0"},w={padding:"8px 0",flex:"1",whiteSpace:"pre",overflowX:"auto",outline:"none",color:"#d4d4d4"},E={width:"60px",backgroundColor:"#1e1e1e",borderLeft:"1px solid var(--color-border, #252526)",flexShrink:"0",padding:"8px 4px",display:"flex",flexDirection:"column",gap:"2px",position:"relative"},C={height:"22px",backgroundColor:"#007acc",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",fontSize:"12px",color:"#ffffff",flexShrink:"0"},N={cursor:"pointer",padding:"0 6px",borderRadius:"3px",transition:"background-color 0.15s"},T=8,W=30,_=On[t]??hi,O=_.map((Y,H)=>{let Z=Rc(Y),ee=[],se=0;for(let Q of Z)ee.push(o("span",{key:String(se++),style:{color:Q.color}},Q.text));return o("div",{key:String(H),style:{minHeight:"20px"}},...ee)}),U=Math.max(l,_.length),K=[];for(let Y=0;Y<U;Y++)K.push(o("div",{key:String(Y)},String(Y+1)));let te=Y=>{if(!Y.parent)return!0;if(!r[Y.parent])return!1;let H=mi.find(Z=>Z.name===Y.parent&&Z.isFolder);return H?te(H):!0},J=yc.map((Y,H)=>{let Z=[Y],ee=s===H;return ee&&gi[Y]&&Z.push(o("div",{key:"dropdown",style:D,className:"ide__menu-dropdown"},...gi[Y].map((se,Q)=>o("button",{key:String(Q),style:z,onClick:le=>{le.stopPropagation(),p(se.action)},role:"menuitem"},se.label)))),o("button",{key:String(H),style:ee?S:b,role:"menuitem","aria-label":Y,onClick:()=>c(H)},...Z)}),j=mi.map((Y,H)=>{if(!te(Y))return null;let Z=!Y.isFolder&&Y.name===t,ee=Y.isFolder?r[Y.name]?"\u{1F4C2} ":"\u{1F4C1} ":"\u{1F4C4} ";return o("div",{key:String(H),style:P(Y.indent,Y.isFolder,Z),onClick:Y.isFolder?()=>m(Y.name):()=>h(Y.name)},ee,Y.name)}).filter(Y=>Y!==null);return o("div",{className:`ide ${e.className??""}`.trim(),style:y},o("div",{className:"ide__title-bar",style:x},"SpecifyJS IDE"),o("div",{className:"ide__menu-bar",style:g,role:"menubar"},...J),o("div",{style:M},o("nav",{className:"ide__sidebar",style:$,"aria-label":"File explorer"},o("div",{style:R},"Explorer"),...j),o("div",{style:L}),o("div",{style:B},o("div",{style:I},o("button",{style:F,"aria-label":t},t)),o("div",{style:A},o("div",{style:k,"aria-hidden":"true"},...K),o("code",{style:w,contentEditable:"true",ref:u,onInput:f,suppressContentEditableWarning:!0},...O))),o("div",{className:"ide__minimap",style:E,"aria-hidden":"true"},o("div",{style:{position:"absolute",top:`${T}px`,left:"0",right:"0",height:`${W}px`,backgroundColor:"rgba(100, 100, 200, 0.15)",border:"1px solid rgba(100, 100, 200, 0.3)",borderRadius:"2px",pointerEvents:"none"}}),..._.map((Y,H)=>o("div",{key:String(H),style:{height:"2px",backgroundColor:Y.trim()?"#555555":"transparent",borderRadius:"1px",width:`${Math.min(100,Y.length*2)}%`}})))),o("div",{className:"ide__status-bar",style:C},o("div",{style:{display:"flex",gap:"16px"}},o("span",{style:N},"\u2387 main"),o("span",{style:N},"0 errors"),o("span",{style:N},"0 warnings")),o("div",{style:{display:"flex",gap:"16px"}},o("span",{style:N},"Ln 1, Col 1"),o("span",{style:N},"UTF-8"),o("span",{style:N},"TypeScript"))))}var Pc=[{symbol:"AAPL",price:189.42,change:1.23,volume:523e5,spark:[186,187,188,187,189]},{symbol:"GOOGL",price:141.8,change:-.87,volume:231e5,spark:[143,142,141,142,141]},{symbol:"MSFT",price:378.91,change:2.45,volume:187e5,spark:[375,376,378,377,379]},{symbol:"AMZN",price:185.63,change:-1.12,volume:314e5,spark:[187,186,186,185,185]},{symbol:"TSLA",price:248.5,change:3.78,volume:672e5,spark:[244,245,247,246,249]},{symbol:"NVDA",price:875.3,change:12.5,volume:418e5,spark:[860,865,870,868,876]}],xi=[{price:189.4,qty:1200},{price:189.38,qty:3400},{price:189.35,qty:800},{price:189.32,qty:5600},{price:189.3,qty:2100},{price:189.28,qty:4300}],yi=[{price:189.44,qty:900},{price:189.47,qty:2200},{price:189.5,qty:1500},{price:189.53,qty:3800},{price:189.55,qty:1100},{price:189.58,qty:2700}],Si=[{symbol:"AAPL",qty:100,avgPrice:185.2,currentPrice:189.42,pnl:422},{symbol:"MSFT",qty:50,avgPrice:382.1,currentPrice:378.91,pnl:-159.5},{symbol:"NVDA",qty:25,avgPrice:850,currentPrice:875.3,pnl:632.5}],$c=[{time:"14:32:01",symbol:"AAPL",side:"BUY",qty:50,price:189.42},{time:"14:31:45",symbol:"MSFT",side:"SELL",qty:25,price:378.95},{time:"14:30:22",symbol:"TSLA",side:"BUY",qty:100,price:247.8},{time:"14:29:58",symbol:"NVDA",side:"BUY",qty:10,price:874.5},{time:"14:28:33",symbol:"GOOGL",side:"SELL",qty:75,price:142.1}],Tc=[185.2,186.1,185.8,187.5,188.2,187.9,186.5,187.8,188.4,189.1,188.6,187.2,188.5,189.8,189.2,188.9,189.5,190.1,189.4,188.8,189.6,190.3,189.9,189.42],vi=[{price:189.4,volume:1200},{price:189.35,volume:3400},{price:189.3,volume:2800},{price:189.25,volume:5100},{price:189.2,volume:4200}],wi=[{price:189.45,volume:900},{price:189.5,volume:2600},{price:189.55,volume:1800},{price:189.6,volume:4400},{price:189.65,volume:3100}],ki=["09:30","10:00","10:30","11:00","11:30","12:00"];function Dc(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Lt(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function Ve(e){return e.toFixed(2)}var vt={backgroundColor:"#1a1a2e",borderRadius:"4px",padding:"12px",border:"1px solid #2a2a4a",overflow:"auto",display:"flex",flexDirection:"column"},wt={fontSize:"12px",fontWeight:"600",textTransform:"uppercase",letterSpacing:"0.5px",color:"#8888aa",marginBottom:"8px",flexShrink:"0"},Zt={width:"100%",borderCollapse:"collapse",fontSize:"12px"},Ne={textAlign:"left",padding:"4px 6px",borderBottom:"1px solid #2a2a4a",color:"#8888aa",fontWeight:"600",fontSize:"11px"},We={padding:"3px 6px",borderBottom:"1px solid #16162a",color:"#ccccdd",fontSize:"12px"},Jt={cursor:"default",transition:"background-color 0.1s"};function zc(e,t){let i=Math.min(...e),a=Math.max(...e)-i||1,l=e.map((u,h)=>{let m=h/(e.length-1)*40,c=14-(u-i)/a*14;return`${m.toFixed(1)},${c.toFixed(1)}`}).join(" ");return o("svg",{viewBox:"0 0 40 14",style:{width:"40px",height:"14px",display:"inline-block",verticalAlign:"middle",marginLeft:"4px"},"aria-hidden":"true"},o("polyline",{points:l,fill:"none",stroke:t?"#00c853":"#ff1744",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))}function Ac(e,t){let u=Math.min(...e),h=Math.max(...e),m=h-u||1,c=310/(e.length-1),p=e.map((M,$)=>{let L=40+$*c,R=15+(1-(M-u)/m)*120;return{x:L,y:R}}),f=p.map(M=>`${M.x.toFixed(1)},${M.y.toFixed(1)}`).join(" "),y="M40,135 "+p.map(M=>`L${M.x.toFixed(1)},${M.y.toFixed(1)}`).join(" ")+` L${p[p.length-1].x.toFixed(1)},135 Z`,x=[];for(let M=1;M<e.length;M++){let $=e[M]>=e[M-1]?"#00c853":"#ff1744";x.push(o("line",{key:String(M),x1:String(p[M-1].x.toFixed(1)),y1:String(p[M-1].y.toFixed(1)),x2:String(p[M].x.toFixed(1)),y2:String(p[M].y.toFixed(1)),stroke:$,strokeWidth:"2",strokeLinecap:"round"}))}let g=[];for(let M=0;M<5;M++){let $=15+M/4*120,L=h-M/4*m;g.push(o("line",{key:`g${M}`,x1:String(40),y1:String($.toFixed(1)),x2:String(350),y2:String($.toFixed(1)),stroke:"#2a2a4a",strokeWidth:"0.5",strokeDasharray:"3,3"})),g.push(o("text",{key:`yl${M}`,x:String(36),y:String(($+3).toFixed(1)),fill:"#6666aa",fontSize:"8",textAnchor:"end",fontFamily:"monospace"},Ve(L)))}let b=[],S=Math.min(ki.length,e.length),D=(e.length-1)/(S-1);for(let M=0;M<S;M++){let L=40+Math.round(M*D)*c;b.push(o("text",{key:`tl${M}`,x:String(L.toFixed(1)),y:String(156),fill:"#6666aa",fontSize:"8",textAnchor:"middle",fontFamily:"monospace"},ki[M]))}let z="chartGrad";return o("div",{style:vt},o("div",{style:wt},"AAPL ",o("span",{style:{color:"#00c853",fontSize:"14px",fontWeight:"700"}},`$${Ve(t)}`),o("span",{style:{color:"#00c853",fontSize:"11px",marginLeft:"8px"}},"+1.23%")),o("svg",{viewBox:"0 0 360 160",style:{width:"100%",flex:"1",minHeight:"0"},"aria-label":"Price chart",role:"img"},o("defs",null,o("linearGradient",{id:z,x1:"0",y1:"0",x2:"0",y2:"1"},o("stop",{offset:"0%",stopColor:"#00c853",stopOpacity:"0.3"}),o("stop",{offset:"100%",stopColor:"#00c853",stopOpacity:"0.02"}))),o("path",{d:y,fill:`url(#${z})`}),...g,...b,...x,o("line",{x1:String(40),y1:String((15+(1-(t-u)/m)*120).toFixed(1)),x2:String(350),y2:String((15+(1-(t-u)/m)*120).toFixed(1)),stroke:"#00c853",strokeWidth:"0.5",strokeDasharray:"4,2",opacity:"0.6"})))}function Lc(){let e=Math.max(...xi.map(t=>t.qty),...yi.map(t=>t.qty));return o("div",{style:vt},o("div",{style:wt},"Order Book"),o("table",{style:Zt},o("thead",null,o("tr",null,o("th",{style:Ne},"Bid Price"),o("th",{style:Ne},"Qty"),o("th",{style:Ne},"Ask Price"),o("th",{style:Ne},"Qty"))),o("tbody",null,...xi.map((t,n)=>{let r=yi[n],i=t.qty/e*.25,s=(r?.qty??0)/e*.25;return o("tr",{key:String(n),style:Jt},o("td",{style:{...We,color:"#00c853",backgroundColor:`rgba(0,200,83,${i.toFixed(3)})`,fontFamily:"monospace"}},Ve(t.price)),o("td",{style:{...We,backgroundColor:`rgba(0,200,83,${(i*.5).toFixed(3)})`,fontFamily:"monospace"}},Lt(t.qty)),o("td",{style:{...We,color:"#ff1744",backgroundColor:`rgba(255,23,68,${s.toFixed(3)})`,fontFamily:"monospace"}},r?Ve(r.price):""),o("td",{style:{...We,backgroundColor:`rgba(255,23,68,${(s*.5).toFixed(3)})`,fontFamily:"monospace"}},r?Lt(r.qty):""))}))))}function Bc(e){return o("div",{style:vt},o("div",{style:wt},"Watchlist"),o("table",{style:Zt},o("thead",null,o("tr",null,o("th",{style:Ne},"Symbol"),o("th",{style:Ne},"Price"),o("th",{style:Ne},"Chg%"),o("th",{style:Ne},"Volume"))),o("tbody",null,...Pc.map((t,n)=>{let r=t.price+(n===0?e:0),i=t.change>=0;return o("tr",{key:String(n),style:Jt},o("td",{style:{...We,fontWeight:"600",color:"#ffffff"}},t.symbol,zc(t.spark,i)),o("td",{style:{...We,fontFamily:"monospace"}},Ve(r)),o("td",{style:{...We,color:i?"#00c853":"#ff1744",fontWeight:"600"}},`${i?"+":""}${Ve(t.change)}%`),o("td",{style:{...We,fontFamily:"monospace",color:"#8888aa"}},Dc(t.volume)))}))))}function Fc(){let e=Si.reduce((n,r)=>n+r.pnl,0),t=e>=0;return o("div",{style:vt},o("div",{style:wt},"Positions",o("span",{style:{marginLeft:"12px",color:t?"#00c853":"#ff1744",fontWeight:"700",fontSize:"12px"}},`${t?"+":""}$${Ve(e)}`)),o("table",{style:Zt},o("thead",null,o("tr",null,o("th",{style:Ne},"Symbol"),o("th",{style:Ne},"Qty"),o("th",{style:Ne},"Avg"),o("th",{style:Ne},"P&L"))),o("tbody",null,...Si.map((n,r)=>{let i=n.pnl>=0;return o("tr",{key:String(r),style:{...Jt,backgroundColor:i?"rgba(0,200,83,0.04)":"rgba(255,23,68,0.04)"}},o("td",{style:{...We,fontWeight:"600",color:"#ffffff"}},n.symbol),o("td",{style:{...We,fontFamily:"monospace"}},String(n.qty)),o("td",{style:{...We,fontFamily:"monospace"}},Ve(n.avgPrice)),o("td",{style:{...We,color:i?"#00c853":"#ff1744",fontWeight:"700",fontFamily:"monospace"}},`${i?"+":""}$${Ve(n.pnl)}`))}))))}function Nc(){return o("div",{style:vt},o("div",{style:wt},"Recent Trades"),o("table",{style:Zt},o("thead",null,o("tr",null,o("th",{style:Ne},"Time"),o("th",{style:Ne},"Sym"),o("th",{style:Ne},"Side"),o("th",{style:Ne},"Qty"),o("th",{style:Ne},"Price"))),o("tbody",null,...$c.map((e,t)=>{let n=e.side==="BUY";return o("tr",{key:String(t),style:Jt},o("td",{style:{...We,color:"#8888aa",fontFamily:"monospace"}},e.time),o("td",{style:{...We,fontWeight:"600",color:"#ffffff"}},e.symbol),o("td",{style:{...We,color:n?"#00c853":"#ff1744",fontWeight:"600"}},e.side),o("td",{style:{...We,fontFamily:"monospace"}},Lt(e.qty)),o("td",{style:{...We,fontFamily:"monospace"}},Ve(e.price)))}))))}function Wc(){let e=Math.max(...vi.map(n=>n.volume),...wi.map(n=>n.volume)),t="16px";return o("div",{style:vt},o("div",{style:wt},"Market Depth"),o("div",{style:{flex:"1",display:"flex",flexDirection:"column",gap:"2px",justifyContent:"center"}},...vi.map((n,r)=>o("div",{key:`b${r}`,style:{display:"flex",alignItems:"center",gap:"6px"}},o("span",{style:{width:"52px",fontSize:"11px",color:"#8888aa",textAlign:"right",fontFamily:"monospace"}},Ve(n.price)),o("div",{style:{height:t,width:`${n.volume/e*100}%`,backgroundColor:"#00c853",opacity:"0.6",borderRadius:"2px",maxWidth:"60%",transition:"width 0.3s"}}),o("span",{style:{fontSize:"11px",color:"#ccccdd",fontFamily:"monospace"}},Lt(n.volume)))),o("div",{style:{height:"1px",backgroundColor:"#2a2a4a",margin:"4px 0"}}),...wi.map((n,r)=>o("div",{key:`a${r}`,style:{display:"flex",alignItems:"center",gap:"6px"}},o("span",{style:{width:"52px",fontSize:"11px",color:"#8888aa",textAlign:"right",fontFamily:"monospace"}},Ve(n.price)),o("div",{style:{height:t,width:`${n.volume/e*100}%`,backgroundColor:"#ff1744",opacity:"0.6",borderRadius:"2px",maxWidth:"60%",transition:"width 0.3s"}}),o("span",{style:{fontSize:"11px",color:"#ccccdd",fontFamily:"monospace"}},Lt(n.volume))))))}function Qt(e){let[t,n]=G(0),[r,i]=G("--:--:--"),[s,a]=G(!0);ae(()=>{let p=setInterval(()=>{n(f=>{let y=(Math.random()-.5)*.5;return Math.round(y*100)/100})},2e3);return()=>clearInterval(p)},[]),ae(()=>{let p=()=>{let y=new Date,x=String(y.getHours()).padStart(2,"0"),g=String(y.getMinutes()).padStart(2,"0"),b=String(y.getSeconds()).padStart(2,"0");i(`${x}:${g}:${b}`)};p();let f=setInterval(p,1e3);return()=>clearInterval(f)},[]),ae(()=>{let p=setInterval(()=>{a(f=>!f)},800);return()=>clearInterval(p)},[]);let l=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'"Inter", "Segoe UI", Roboto, sans-serif',fontSize:"13px",color:"#ccccdd",backgroundColor:"#0d0d1a",overflow:"hidden"}),[]),d={height:"40px",backgroundColor:"#12122a",borderBottom:"1px solid #2a2a4a",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 16px",flexShrink:"0"},u={fontSize:"14px",fontWeight:"700",color:"#ffffff",letterSpacing:"0.5px",display:"flex",alignItems:"center",gap:"8px"},h={flex:"1",display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr",gap:"8px",padding:"8px",overflow:"hidden"},m=189.42+t,c={width:"8px",height:"8px",borderRadius:"50%",backgroundColor:"#00c853",display:"inline-block",marginRight:"4px",opacity:s?"1":"0.3",transition:"opacity 0.3s"};return o("div",{className:`trading-dashboard ${e.className??""}`.trim(),style:l},o("header",{className:"trading-dashboard__header",style:d},o("span",{style:u},"SpecifyJS Trading Platform",o("span",{style:{display:"flex",alignItems:"center",fontSize:"11px",color:"#00c853",fontWeight:"600",marginLeft:"8px"}},o("span",{style:c}),"LIVE")),o("div",{style:{display:"flex",alignItems:"center",gap:"16px",fontSize:"12px"}},o("span",{style:{color:"#ffffff",fontFamily:"monospace",fontWeight:"600",fontSize:"13px"}},r),o("span",{style:{color:"#8888aa"}},"Account: SJS-28401"),o("span",{style:{color:"#00c853"}},"Balance: $124,582.30"),o("span",{style:{color:"#8888aa"}},"Status: Connected"))),o("div",{className:"trading-dashboard__grid",style:h},Ac(Tc,m),Lc(),Bc(t),Fc(),Nc(),Wc()))}function Le(e){return e.type==="card"}function ze(e){return e.type==="container"}function Ze(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Je(e){return Le(e)?e.card_id:e.container_id}var _c={low:"#22c55e",medium:"#f59e0b",high:"#f97316",critical:"#ef4444"},Hn=[{label:"Text",value:"text"},{label:"JSON",value:"json"},{label:"Task",value:"task"},{label:"Project",value:"project"}];function Oc(e){let t=e.content;return o("div",{style:{fontSize:"12px",color:"#555555",lineHeight:"1.4",overflow:"hidden",flex:"1"},"data-testid":`card-text-content-${e.card_id}`},t.text||"")}function Hc(e){let t=e.content,r=Object.entries(t).map(([i,s],a)=>o("div",{key:String(a),style:{display:"flex",gap:"4px",fontSize:"11px",lineHeight:"1.6",borderBottom:"1px solid rgba(0,0,0,0.05)",padding:"2px 0"}},o("span",{style:{fontWeight:"600",color:"#374151",minWidth:"60px"}},`${i}:`),o("span",{style:{color:"#555555"}},String(s??""))));return o("div",{style:{flex:"1",overflow:"auto"},"data-testid":`card-json-content-${e.card_id}`},...r)}function Yc(e){return o("div",{style:{fontSize:"12px",color:"#9ca3af",fontStyle:"italic",flex:"1",display:"flex",alignItems:"center",justifyContent:"center"},"data-testid":`card-task-content-${e.card_id}`},"Task card (coming soon)")}function Vc(e,t){let n=e.content;return o("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"4px 16px",borderRadius:"999px",backgroundColor:e.color||"#e0e7ff",fontSize:"13px",fontWeight:"600",color:"#1e3a5f",cursor:"pointer",flex:"1"},onDblClick:r=>{r.preventDefault(),r.stopPropagation(),t&&n.project_id&&t(n.project_id)},"data-testid":`card-project-content-${e.card_id}`},n.project_name||"Untitled Project")}function Ci(e){let{card:t,selected:n=!1,onSelect:r,onMove:i,onResize:s,onDelete:a,dispatch:l,onOpenProject:d,onCardContextMenu:u,onUpdate:h,onDragStart:m,onDragEnd:c,onAnchorDragStart:p}=e,[f,y]=G(!1),[x,g]=G(!1),[b,S]=G(null),[D,z]=G(!1),[M,$]=G(!1),[L,R]=G(!1),[P,B]=G(t.card_title||""),[I,F]=G(""),A=oe(null),k=oe(null),w=t.priority?_c[t.priority]||"#94a3b8":"transparent",E=v(X=>{let ie=X;ie.preventDefault(),ie.stopPropagation(),S({x:ie.clientX,y:ie.clientY}),z(!1),u&&u(t.card_id,{x:ie.clientX,y:ie.clientY})},[u,t.card_id]),C=v(()=>{S(null),z(!1)},[]),N=v(X=>{let ie=X,he=ie.target;if(he.dataset&&(he.dataset.role==="delete"||he.dataset.role==="resize"||he.dataset.role==="drag-handle"||he.dataset.role==="inline-edit"||he.dataset.role==="anchor"))return;ie.preventDefault(),ie.stopPropagation(),r&&r(t.card_id),A.current={x:ie.clientX,y:ie.clientY,cardX:t.position.x,cardY:t.position.y},m&&m(t.card_id),g(!0);let be=Ee=>{let Ce=Ee;if(!A.current)return;let ke=Ce.clientX-A.current.x,Ie=Ce.clientY-A.current.y;i&&i(t.card_id,{x:A.current.cardX+ke,y:A.current.cardY+Ie})},Se=()=>{A.current=null,g(!1),c&&c(t.card_id),document.removeEventListener("mousemove",be),document.removeEventListener("mouseup",Se)};document.addEventListener("mousemove",be),document.addEventListener("mouseup",Se)},[t.card_id,t.position.x,t.position.y,r,i,m,c]),T=v(X=>{let ie=X;ie.preventDefault(),ie.stopPropagation(),k.current={x:ie.clientX,y:ie.clientY,w:t.size.width,h:t.size.height};let he=Se=>{let Ee=Se;if(!k.current)return;let Ce=Ee.clientX-k.current.x,ke=Ee.clientY-k.current.y,Ie=Math.max(120,k.current.w+Ce),Te=Math.max(80,k.current.h+ke);s&&s(t.card_id,{width:Ie,height:Te})},be=()=>{k.current=null,document.removeEventListener("mousemove",he),document.removeEventListener("mouseup",be)};document.addEventListener("mousemove",he),document.addEventListener("mouseup",be)},[t.card_id,t.size.width,t.size.height,s]),W=v(X=>{X.preventDefault(),X.stopPropagation(),a&&a(t.card_id)},[t.card_id,a]),_=v(X=>{let ie=X;ie.preventDefault(),ie.stopPropagation();let be=ie.target.dataset.anchor;if(!be||!p)return;let Se=t.position.x,Ee=t.position.y,Ce=t.size.width,ke=t.size.height,Ie=Se+Ce/2,Te=Ee+ke/2;be==="top"?(Ie=Se+Ce/2,Te=Ee):be==="right"?(Ie=Se+Ce,Te=Ee+ke/2):be==="bottom"?(Ie=Se+Ce/2,Te=Ee+ke):be==="left"&&(Ie=Se,Te=Ee+ke/2),p(t.card_id,be,{x:Ie,y:Te})},[t.card_id,t.position.x,t.position.y,t.size.width,t.size.height,p]),O=v(X=>{l&&l({type:"CHANGE_CARD_TYPE",cardId:t.card_id,newType:X}),C()},[t.card_id,l,C]),U=v(X=>{X.preventDefault(),X.stopPropagation(),B(t.card_title||""),$(!0)},[t.card_title]),K=v(()=>{$(!1),h&&P!==t.card_title&&h(t.card_id,{card_title:P})},[h,t.card_id,t.card_title,P]),te=v(X=>{let ie=X;ie.key==="Enter"?(ie.preventDefault(),K()):ie.key==="Escape"&&(ie.preventDefault(),$(!1),B(t.card_title||""))},[K,t.card_title]),J=v(X=>{let ie=X.target;B(ie.value)},[]),V=v(X=>{X.stopPropagation();let ie=t.content;F(ie.text||""),R(!0)},[t.content]),j=v(()=>{R(!1),h&&h(t.card_id,{content:{text:I}})},[h,t.card_id,I]),Y=v(X=>{let ie=X;if(ie.key==="Escape"){ie.preventDefault(),R(!1);let he=t.content;F(he.text||"")}},[t.content]),H=v(X=>{let ie=X.target;F(ie.value)},[]),Z;switch(t.card_type){case"text":L?Z=o("textarea",{"data-role":"inline-edit","data-testid":`card-desc-edit-${t.card_id}`,value:I,onInput:H,onBlur:j,onKeyDown:Y,onFocus:X=>{let ie=X.target;ie.setSelectionRange(ie.value.length,ie.value.length)},style:{fontSize:"12px",color:"#555555",lineHeight:"1.4",flex:"1",border:"1px solid #3b82f6",borderRadius:"3px",padding:"2px 4px",resize:"none",outline:"none",fontFamily:"inherit",backgroundColor:"#fff",width:"100%",boxSizing:"border-box"}}):Z=o("div",{style:{fontSize:"12px",color:"#555555",lineHeight:"1.4",overflow:"hidden",flex:"1",cursor:"text"},"data-testid":`card-text-content-${t.card_id}`,onClick:V},t.content.text||"");break;case"json":Z=Hc(t);break;case"task":Z=Yc(t);break;case"project":Z=Vc(t,d);break;default:Z=Oc(t)}let ee=t.card_type==="project",se={position:"absolute",left:`${t.position.x}px`,top:`${t.position.y}px`,width:`${t.size.width}px`,height:`${t.size.height}px`,backgroundColor:t.color||"#fef9c3",borderRadius:ee?"999px":"6px",borderLeft:`4px solid ${w}`,boxShadow:n?"0 0 0 2px #3b82f6, 0 4px 12px rgba(0,0,0,0.15)":"0 2px 8px rgba(0,0,0,0.1)",cursor:"grab",userSelect:"none",overflow:"hidden",display:"flex",flexDirection:"column",padding:"8px 10px",boxSizing:"border-box",transition:"box-shadow 150ms ease",zIndex:x?"9999":"1"},Q={fontWeight:"600",fontSize:"14px",color:"#1a1a1a",marginBottom:"4px",lineHeight:"1.3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},le={position:"absolute",top:"4px",right:"4px",width:"18px",height:"18px",borderRadius:"50%",backgroundColor:"rgba(0,0,0,0.15)",color:"#333",fontSize:"12px",lineHeight:"18px",textAlign:"center",cursor:"pointer",display:f?"block":"none",border:"none",padding:"0"},ce={position:"absolute",bottom:"0",right:"0",width:"12px",height:"12px",cursor:"nwse-resize",opacity:"0.4",background:"linear-gradient(135deg, transparent 50%, #666 50%)"},ue={position:"absolute",top:"4px",right:"24px",width:"18px",height:"18px",borderRadius:"3px",backgroundColor:"rgba(0,0,0,0.1)",color:"#333",fontSize:"10px",lineHeight:"18px",textAlign:"center",cursor:"grab",display:f?"block":"none",border:"none",padding:"0"},re=8,ge={position:"absolute",width:`${re}px`,height:`${re}px`,borderRadius:"50%",backgroundColor:"#3b82f6",border:"2px solid #fff",boxSizing:"border-box",cursor:"crosshair",display:f?"block":"none",zIndex:"10"},ne=[{anchor:"top",style:{...ge,top:`${-re/2}px`,left:"50%",marginLeft:`${-re/2}px`}},{anchor:"right",style:{...ge,top:"50%",right:`${-re/2}px`,marginTop:`${-re/2}px`}},{anchor:"bottom",style:{...ge,bottom:`${-re/2}px`,left:"50%",marginLeft:`${-re/2}px`}},{anchor:"left",style:{...ge,top:"50%",left:`${-re/2}px`,marginTop:`${-re/2}px`}}].map((X,ie)=>o("div",{key:`anchor-${X.anchor}`,style:X.style,"data-role":"anchor","data-anchor":X.anchor,"data-testid":`card-anchor-${X.anchor}-${t.card_id}`,onMouseDown:_})),de=t.assignee?o("div",{style:{display:"flex",alignItems:"center",gap:"4px",marginTop:"4px",fontSize:"10px",color:"#555"},"data-testid":`card-assignee-${t.card_id}`},o("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:"#3b82f6",color:"#fff",fontSize:"9px",fontWeight:"700",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:"0"}},t.assignee.charAt(0).toUpperCase()),o("span",{},t.assignee)):null,fe=t.tags&&t.tags.length>0?o("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap",marginTop:"4px"}},...t.tags.map((X,ie)=>o("span",{key:String(ie),style:{fontSize:"10px",padding:"1px 4px",borderRadius:"3px",backgroundColor:"rgba(0,0,0,0.08)",color:"#444"}},X))):null,xe={padding:"6px 12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",whiteSpace:"nowrap"},ye={position:"absolute",left:"100%",top:"0",backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"120px"},we=b?o("div",{className:"card-context-menu",style:{position:"fixed",left:`${b.x}px`,top:`${b.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"10000",minWidth:"160px",fontSize:"13px",color:"#1a1a1a"},"data-testid":`card-context-menu-${t.card_id}`,role:"menu","aria-label":"Card context menu",onClick:X=>X.stopPropagation()},o("div",{style:xe,onClick:X=>{X.stopPropagation(),a&&a(t.card_id),C()},role:"menuitem","data-testid":`ctx-delete-${t.card_id}`},"Delete"),o("div",{style:{...xe,position:"relative"},onMouseEnter:()=>z(!0),role:"menuitem","aria-haspopup":"true","data-testid":`ctx-change-type-${t.card_id}`},"Change Type",o("span",{style:{marginLeft:"8px"}},"\u25B6"),D?o("div",{style:ye,role:"menu","data-testid":`ctx-type-submenu-${t.card_id}`},...Hn.map(X=>o("div",{key:X.value,style:{...xe,fontWeight:t.card_type===X.value?"700":"400"},onClick:ie=>{ie.stopPropagation(),O(X.value)},role:"menuitem","data-testid":`ctx-type-${X.value}-${t.card_id}`},X.label,t.card_type===X.value?" \u2713":""))):null)):null;return ee?o("div",{className:"board-card board-card--project",style:se,onMouseDown:N,onContextMenu:E,onMouseEnter:()=>y(!0),onMouseLeave:()=>{y(!1),C()},"data-card-id":t.card_id,"data-testid":`card-${t.card_id}`,role:"button","aria-label":`Project card: ${t.card_title}`,tabIndex:0},Z,o("div",{style:ue,"data-role":"drag-handle","data-testid":`card-drag-handle-${t.card_id}`,"aria-label":"Export drag handle",title:"Drag to export card"},"\u2630"),...ne,we):o("div",{className:"board-card",style:se,onMouseDown:N,onContextMenu:E,onMouseEnter:()=>y(!0),onMouseLeave:()=>{y(!1),C()},"data-card-id":t.card_id,"data-testid":`card-${t.card_id}`,role:"button","aria-label":`Card: ${t.card_title}`,tabIndex:0},M?o("input",{"data-role":"inline-edit","data-testid":`card-title-edit-${t.card_id}`,value:P,onInput:J,onBlur:K,onKeyDown:te,onFocus:X=>{let ie=X.target;ie.setSelectionRange(ie.value.length,ie.value.length)},style:{...Q,border:"1px solid #3b82f6",borderRadius:"3px",padding:"1px 4px",outline:"none",width:"100%",boxSizing:"border-box",backgroundColor:"#fff"}}):o("div",{style:Q,"data-testid":`card-title-${t.card_id}`,onDblClick:U},t.card_title||"Untitled"),Z,fe,de,o("div",{style:ue,"data-role":"drag-handle","data-testid":`card-drag-handle-${t.card_id}`,"aria-label":`Export drag handle for ${t.card_title}`,title:"Drag to export card"},"\u2630"),o("button",{style:le,"data-role":"delete","data-testid":`card-delete-${t.card_id}`,onClick:W,"aria-label":`Delete ${t.card_title}`,tabIndex:-1},"\xD7"),o("div",{style:ce,"data-role":"resize",onMouseDown:T,"aria-label":"Resize card"}),...ne,we)}function Mi(e){let{container:t,selected:n=!1,highlighted:r=!1,onSelect:i,onMove:s,onResize:a,onDelete:l,onDrop:d,onDragStart:u,onDragEnd:h,children:m}=e,[c,p]=G(!1),[f,y]=G(!1),[x,g]=G(!1),b=oe(null),S=oe(null),D=v(w=>{w.stopPropagation(),l&&l(t.container_id)},[t.container_id,l]),z=v(w=>{w.stopPropagation(),y(E=>!E)},[]),M=v(w=>{let E=w;E.preventDefault(),E.stopPropagation(),i&&i(t.container_id),u&&u(t.container_id),g(!0),b.current={x:E.clientX,y:E.clientY,posX:t.position.x,posY:t.position.y};let C=T=>{let W=T;if(!b.current)return;let _=W.clientX-b.current.x,O=W.clientY-b.current.y;s&&s(t.container_id,{x:b.current.posX+_,y:b.current.posY+O})},N=()=>{b.current=null,g(!1),h&&h(t.container_id),document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",N)};document.addEventListener("mousemove",C),document.addEventListener("mouseup",N)},[t.container_id,t.position.x,t.position.y,i,s,u,h]),$=v(w=>{let E=w;E.preventDefault(),E.stopPropagation(),S.current={x:E.clientX,y:E.clientY,w:t.size.width,h:t.size.height};let C=T=>{let W=T;if(!S.current)return;let _=W.clientX-S.current.x,O=W.clientY-S.current.y,U=Math.max(160,S.current.w+_),K=Math.max(120,S.current.h+O);a&&a(t.container_id,{width:U,height:K})},N=()=>{S.current=null,document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",N)};document.addEventListener("mousemove",C),document.addEventListener("mouseup",N)},[t.container_id,t.size.width,t.size.height,a]),L=v(w=>{w.preventDefault(),p(!0)},[]),R=v(()=>{p(!1)},[]),P=v(w=>{let E=w;if(E.preventDefault(),p(!1),d&&E.dataTransfer){let C=E.dataTransfer.getData("text/plain");C&&d(C,t.container_id)}},[t.container_id,d]),B=r||c,I={position:"absolute",left:`${t.position.x}px`,top:`${t.position.y}px`,width:`${t.size.width}px`,height:`${t.size.height}px`,backgroundColor:r?"#eff6ff":"#ffffff",border:r?"2px dashed #3b82f6":n?"2px solid #3b82f6":"2px solid #d1d5db",borderRadius:"8px",boxShadow:B?"0 0 0 3px rgba(59,130,246,0.3), 0 4px 16px rgba(0,0,0,0.1)":"0 2px 8px rgba(0,0,0,0.08)",display:"flex",flexDirection:"column",overflow:"hidden",zIndex:x?"9999":"0",boxSizing:"border-box",transition:"border 150ms ease, background-color 150ms ease, box-shadow 150ms ease"},F={padding:"6px 12px",borderBottom:"1px solid #e5e7eb",backgroundColor:"#f9fafb",cursor:"grab",userSelect:"none",textAlign:"center",fontWeight:"700",fontSize:"15px",color:"#1f2937",flexShrink:"0"},A={flex:"1",overflow:"auto",position:"relative",padding:"4px"},k={position:"absolute",bottom:"0",right:"0",width:"14px",height:"14px",cursor:"nwse-resize",opacity:"0.4",background:"linear-gradient(135deg, transparent 50%, #666 50%)"};return o("div",{className:"board-container",style:I,"data-container-id":t.container_id,"data-testid":`container-${t.container_id}`,role:"group","aria-label":`Container: ${t.name}`,onDragOver:L,onDragLeave:R,onDrop:P},o("div",{className:"board-container__title",style:{...F,display:"flex",alignItems:"center",justifyContent:"space-between"},onMouseDown:M,"data-testid":`container-title-${t.container_id}`},o("span",null,t.name),o("span",{style:{display:"flex",gap:"4px"}},o("button",{style:{border:"none",backgroundColor:"transparent",cursor:"pointer",color:"#94a3b8",fontSize:"12px",padding:"0 2px",lineHeight:"1"},onClick:z,"aria-label":f?"Expand container":"Minimize container",title:f?"Expand":"Minimize"},f?"\u25B2":"\u2014"),o("button",{style:{border:"none",backgroundColor:"transparent",cursor:"pointer",color:"#94a3b8",fontSize:"14px",padding:"0 2px",lineHeight:"1"},onClick:D,"aria-label":"Delete container",title:"Delete"},"\xD7"))),f?null:o("div",{className:"board-container__contents",style:A,"data-testid":`container-contents-${t.container_id}`},m),f?null:o("div",{style:k,"data-role":"resize",onMouseDown:$,"aria-label":"Resize container"}))}function Ei(e){let t=e.position.x+e.size.width/2,n=e.position.y+e.size.height/2;return{top:{x:t,y:e.position.y},right:{x:e.position.x+e.size.width,y:n},bottom:{x:t,y:e.position.y+e.size.height},left:{x:e.position.x,y:n}}}function Uc(e,t){let n=Ei(e),r=Ei(t),i=[n.top,n.right,n.bottom,n.left],s=[r.top,r.right,r.bottom,r.left],a=1/0,l=n.right,d=r.left;for(let u=0;u<i.length;u++)for(let h=0;h<s.length;h++){let m=s[h].x-i[u].x,c=s[h].y-i[u].y,p=m*m+c*c;p<a&&(a=p,l=i[u],d=s[h])}return{from:l,to:d}}var Ii="board-card-link-arrowhead";function Ri(e){let{links:t,cards:n,selectedLinkId:r,onSelectLink:i,onLinkContextMenu:s,canvasWidth:a,canvasHeight:l}=e,d=new Map;for(let p=0;p<n.length;p++)d.set(n[p].card_id,n[p]);let u=v(p=>{i(p)},[i]),h=[];for(let p=0;p<t.length;p++){let{source:f,link:y}=t[p],x=d.get(y.target_card_id);if(!x)continue;let{from:g,to:b}=Uc(f,x),S=y.link_id===r,D=S?"#3b82f6":y.color||"#94a3b8",z=b.x-g.x,M=b.y-g.y,$=Math.sqrt(z*z+M*M),L=Math.min(40,$*.15),R=$>0?-M/$:0,P=$>0?z/$:0,B=(g.x+b.x)/2,I=(g.y+b.y)/2,F=B+R*L,A=I+P*L,k=`M ${g.x} ${g.y} Q ${F} ${A} ${b.x} ${b.y}`,w=f.card_id;h.push(o("path",{key:`hit-${y.link_id}`,d:k,fill:"none",stroke:"transparent","stroke-width":"12",style:{cursor:"pointer",pointerEvents:"stroke"},onClick:()=>u(y.link_id),onContextMenu:E=>{let C=E;C.preventDefault(),C.stopPropagation(),s&&s(y.link_id,w,{x:C.clientX,y:C.clientY})},"data-testid":`link-hit-${y.link_id}`})),h.push(o("path",{key:y.link_id,d:k,fill:"none",stroke:D,"stroke-width":S?"3":"2","pointer-events":"none","marker-end":`url(#${Ii})`,"data-testid":`link-${y.link_id}`})),y.link_name&&h.push(o("text",{key:`label-${y.link_id}`,x:String(F),y:String(A-6),"text-anchor":"middle",fill:"#64748b","font-size":"11","pointer-events":"none","data-testid":`link-label-${y.link_id}`},y.link_name))}let m={position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",overflow:"visible",zIndex:"9999"},c=o("defs",{},o("marker",{id:Ii,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse"},o("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"#94a3b8"})));return o("svg",{style:m,width:String(a),height:String(l),className:"card-link-overlay","data-testid":"card-link-overlay",role:"img","aria-label":"Card links"},c,o("g",{style:{pointerEvents:"auto"}},...h))}var jc=[{value:"#fef9c3",label:"Yellow"},{value:"#fecaca",label:"Red"},{value:"#fed7aa",label:"Orange"},{value:"#bbf7d0",label:"Green"},{value:"#bfdbfe",label:"Blue"},{value:"#ddd6fe",label:"Purple"},{value:"#fbcfe8",label:"Pink"},{value:"#e5e7eb",label:"Gray"}],Yn=20,kt=5e3;function Gc(e,t){let n=new Set,r=[...e],i=null;for(;r.length>0;){let a=r.pop();if(ze(a)&&a.container_id===t){i=a;break}if(ze(a))for(let l=0;l<a.contents.length;l++)r.push(a.contents[l])}if(!i||!ze(i))return n;let s=[...i.contents];for(;s.length>0;){let a=s.pop();if(ze(a)){n.add(a.container_id);for(let l=0;l<a.contents.length;l++)s.push(a.contents[l])}}return n}function Xc(e,t,n,r){let i=new Set;if(r){i.add(r);let d=Gc(e,r);for(let u of d)i.add(u)}let s=null,a=-1,l=[[e,0,0,0]];for(;l.length>0;){let[d,u,h,m]=l.pop();for(let c=0;c<d.length;c++){let p=d[c];if(!ze(p)||i.has(p.container_id))continue;let f=p.position.x+u,y=p.position.y+h;t>=f&&t<=f+p.size.width&&n>=y&&n<=y+p.size.height&&(m>a&&(s=p.container_id,a=m),p.contents.length>0&&l.push([p.contents,f,y+30,m+1]))}}return s}function Pi(e,t){return{x:Math.round(e.x/t)*t,y:Math.round(e.y/t)*t}}function $i(e,t,n){return{x:(e-n.panX)/n.zoom,y:(t-n.panY)/n.zoom}}function qc(e){let t=[],n=[],r=[];for(let i=e.length-1;i>=0;i--)r.push([e[i],0,0]);for(;r.length>0;){let[i,s,a]=r.pop();if(Le(i)){let l={...i,position:{x:i.position.x+s,y:i.position.y+a}};t.push(l);for(let d=0;d<i.card_link.length;d++)n.push({source:l,link:i.card_link[d]})}else if(ze(i)){let l=s+i.position.x,d=a+i.position.y+30;for(let u=i.contents.length-1;u>=0;u--)r.push([i.contents[u],l,d])}}return{cards:t,links:n}}function Vn(e){let{state:t,dispatch:n,selectedId:r=null,onSelectItem:i,gridEnabled:s=!1,searchQuery:a="",colorFilter:l=null,onOpenProject:d,onCardContextMenu:u,onUpdateItem:h}=e,{collection:m,viewport:c}=t,p=oe(null),f=oe(!1),y=oe(null),[x,g]=G(null),[b,S]=G(null),[D,z]=G(null),[M,$]=G(null),[L,R]=G(!1),[P,B]=G(!1),[I,F]=G(null),A=v(X=>{let ie=X,he=ie.target;if(he.closest(".board-card")||he.closest(".board-container"))return;let be=ie.button===1,Se=ie.button===0&&ie.shiftKey;be||Se?(ie.preventDefault(),f.current=!0,y.current={x:ie.clientX,y:ie.clientY,panX:c.panX,panY:c.panY}):ie.button===0&&i&&i(null)},[c.panX,c.panY,i]);ae(()=>{let X=he=>{if(!f.current||!y.current)return;let be=he,Se=be.clientX-y.current.x,Ee=be.clientY-y.current.y;n({type:"PAN",panX:y.current.panX+Se,panY:y.current.panY+Ee})},ie=()=>{f.current=!1,y.current=null};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",ie),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",ie)}},[n]);let k=v(X=>{let ie=X;if(!ie.ctrlKey)return;ie.preventDefault();let he=ie.deltaY>0?-.1:.1;n({type:"ZOOM",zoom:c.zoom+he})},[c.zoom,n]),w=oe(null);ae(()=>{let X=p.current;if(!X)return;let ie=Ce=>{let ke=[];for(let Ie=0;Ie<Ce.touches.length;Ie++)ke.push({x:Ce.touches[Ie].clientX,y:Ce.touches[Ie].clientY});return ke},he=(Ce,ke)=>Math.sqrt((Ce.x-ke.x)**2+(Ce.y-ke.y)**2),be=Ce=>{let ke=Ce;if(ke.touches.length===2){ke.preventDefault();let Ie=ie(ke);w.current={touches:Ie,panX:c.panX,panY:c.panY,zoom:c.zoom,dist:he(Ie[0],Ie[1])}}},Se=Ce=>{let ke=Ce;if(ke.touches.length!==2||!w.current)return;ke.preventDefault();let Ie=ie(ke),Te=w.current,Ue=(Te.touches[0].x+Te.touches[1].x)/2,Xe=(Te.touches[0].y+Te.touches[1].y)/2,ft=(Ie[0].x+Ie[1].x)/2,pe=(Ie[0].y+Ie[1].y)/2;n({type:"PAN",panX:Te.panX+(ft-Ue),panY:Te.panY+(pe-Xe)});let Me=he(Ie[0],Ie[1]);Te.dist>0&&n({type:"ZOOM",zoom:Te.zoom*(Me/Te.dist)})},Ee=()=>{w.current=null};return X.addEventListener("touchstart",be,{passive:!1}),X.addEventListener("touchmove",Se,{passive:!1}),X.addEventListener("touchend",Ee),()=>{X.removeEventListener("touchstart",be),X.removeEventListener("touchmove",Se),X.removeEventListener("touchend",Ee)}},[c.panX,c.panY,c.zoom,n]);let E=v((X,ie)=>{$({cardId:X,x:ie.x,y:ie.y}),R(!1),B(!1),u&&u(X,ie)},[u]),C=v(()=>{$(null),R(!1),B(!1)},[]);ae(()=>{if(!M)return;let X=()=>{C()};return document.addEventListener("click",X),()=>{document.removeEventListener("click",X)}},[M,C]);let N=v((X,ie,he)=>{F({linkId:X,cardId:ie,x:he.x,y:he.y}),C()},[C]),T=v(()=>{F(null)},[]);ae(()=>{if(!I)return;let X=()=>T();return document.addEventListener("click",X),()=>document.removeEventListener("click",X)},[I,T]);let W=v(X=>{i&&i(X)},[i]),_=v((X,ie)=>{let he=ie;if(s&&(he=Pi(ie,Yn)),n({type:"MOVE_ITEM",itemId:X,position:he}),J.current===X){let Se=0,Ee=0,Ce=[...m];for(;Ce.length>0;){let Ue=Ce.pop();if(Je(Ue)===X){Se=Ue.size.width,Ee=Ue.size.height;break}if(ze(Ue))for(let Xe=0;Xe<Ue.contents.length;Xe++)Ce.push(Ue.contents[Xe])}let ke=he.x+Se/2,Ie=he.y+Ee/2,Te=Xc(m,ke,Ie,X);g(Te)}},[n,s,m]),O=v((X,ie)=>{n({type:"RESIZE_ITEM",itemId:X,size:ie})},[n]),U=v(X=>{n({type:"REMOVE_ITEM",itemId:X}),i&&r===X&&i(null)},[n,r,i]),K=v((X,ie)=>{n({type:"NEST_ITEM",itemId:X,containerId:ie})},[n]),te=v(X=>{S(X),J.current=X,g(null)},[]),J=oe(null);J.current=b;let V=oe(null);V.current=x;let j=v(X=>{let ie=V.current;ie&&n({type:"NEST_ITEM",itemId:X,containerId:ie}),S(null),J.current=null,g(null)},[n]),Y=v((X,ie,he)=>{z({fromCardId:X,fromAnchor:ie,fromPos:he,currentPos:he})},[]),H=oe(null);H.current=D,ae(()=>{if(!D)return;let X=he=>{let be=he,Se=0,Ee=0;if(p.current){let ke=p.current.getBoundingClientRect();Se=ke.left,Ee=ke.top}let Ce=$i(be.clientX-Se,be.clientY-Ee,c);z(ke=>ke?{...ke,currentPos:Ce}:null)},ie=he=>{let be=he,Se=H.current;if(!Se){z(null);return}let Ee=document.elementFromPoint(be.clientX,be.clientY);if(Ee&&Ee.dataset&&Ee.dataset.role==="anchor"&&Ee.dataset.anchor){let Ce=Ee.closest("[data-card-id]");if(Ce&&Ce.dataset.cardId&&Ce.dataset.cardId!==Se.fromCardId){let ke=Ce.dataset.cardId;n({type:"ADD_LINK",cardId:Se.fromCardId,link:{link_id:Ze(),link_name:"relates to",target_card_id:ke,color:"#94a3b8",attributes:{}}})}}z(null)};return document.addEventListener("mousemove",X),document.addEventListener("mouseup",ie),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",ie)}},[D!==null,c.panX,c.panY,c.zoom,n]);let Z=a.toLowerCase(),ee=new Set,se=[],Q=[...m];for(;Q.length>0;){let X=Q.pop();if(se.push(X),ze(X))for(let ie=0;ie<X.contents.length;ie++)Q.push(X.contents[ie])}if(Z)for(let X=0;X<se.length;X++){let ie=se[X];(Le(ie)?ie.card_title:ie.name).toLowerCase().includes(Z)||ee.add(Je(ie))}if(l)for(let X=0;X<se.length;X++){let ie=se[X];Le(ie)&&ie.color!==l&&ee.add(ie.card_id)}let{cards:le,links:ce}=qc(m);function ue(X){let ie=Je(X),he=ee.has(ie),be;if(Le(X))be=o(Ci,{key:ie,card:X,selected:ie===r,onSelect:W,onMove:_,onResize:O,onDelete:U,dispatch:n,onOpenProject:d,onCardContextMenu:E,onUpdate:h,onDragStart:te,onDragEnd:j,onAnchorDragStart:Y});else{let Se=X.contents.map(Ee=>ue(Ee));be=o(Mi,{key:ie,container:X,selected:ie===r,highlighted:x===X.container_id,onSelect:W,onMove:_,onResize:O,onDelete:U,onDrop:K,onDragStart:te,onDragEnd:j},...Se)}return he?o("div",{key:`dim-${ie}`,style:{opacity:"0.3"}},be):be}let re=m.map(X=>ue(X)),ge={flex:"1",overflow:"hidden",position:"relative",backgroundColor:"#f8fafc",cursor:"default",backgroundImage:s?"radial-gradient(circle, #d1d5db 1px, transparent 1px)":"none",backgroundSize:`${Yn}px ${Yn}px`},me={transform:`translate(${c.panX}px, ${c.panY}px) scale(${c.zoom})`,transformOrigin:"0 0",position:"relative",width:`${kt}px`,height:`${kt}px`},ne={padding:"6px 12px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",whiteSpace:"nowrap",fontSize:"13px",color:"#1a1a1a"},de={position:"absolute",left:"100%",top:"0",backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"120px"},fe={height:"1px",backgroundColor:"#e5e7eb",margin:"4px 0"},xe=M?o("div",{className:"board-context-menu",style:{position:"fixed",left:`${M.x}px`,top:`${M.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",zIndex:"10000",minWidth:"160px",fontSize:"13px",color:"#1a1a1a"},"data-testid":`board-context-menu-${M.cardId}`,role:"menu","aria-label":"Card context menu",onClick:X=>X.stopPropagation()},o("div",{style:{...ne,position:"relative"},onMouseEnter:()=>{R(!0),B(!1)},role:"menuitem","aria-haspopup":"true","data-testid":`board-ctx-change-color-${M.cardId}`},"Change Color",o("span",{style:{marginLeft:"8px"}},"\u25B6"),L?o("div",{style:de,role:"menu","data-testid":`board-ctx-color-submenu-${M.cardId}`},...jc.map(X=>o("div",{key:X.value,style:{...ne,gap:"8px"},onClick:ie=>{ie.stopPropagation(),n({type:"UPDATE_CARD",cardId:M.cardId,updates:{color:X.value}}),C()},role:"menuitem","data-testid":`board-ctx-color-${X.label.toLowerCase()}-${M.cardId}`},o("span",{style:{display:"inline-block",width:"14px",height:"14px",borderRadius:"3px",backgroundColor:X.value,border:"1px solid #d1d5db",flexShrink:"0"}}),X.label))):null),o("div",{style:{...ne,position:"relative"},onMouseEnter:()=>{B(!0),R(!1)},role:"menuitem","aria-haspopup":"true","data-testid":`board-ctx-change-type-${M.cardId}`},"Change Type",o("span",{style:{marginLeft:"8px"}},"\u25B6"),P?o("div",{style:de,role:"menu","data-testid":`board-ctx-type-submenu-${M.cardId}`},...Hn.map(X=>o("div",{key:X.value,style:ne,onClick:ie=>{ie.stopPropagation(),n({type:"CHANGE_CARD_TYPE",cardId:M.cardId,newType:X.value}),C()},role:"menuitem","data-testid":`board-ctx-type-${X.value}-${M.cardId}`},X.label))):null),o("div",{style:fe,role:"separator"}),o("div",{style:{...ne,color:"#dc2626"},onClick:X=>{X.stopPropagation(),n({type:"REMOVE_ITEM",itemId:M.cardId}),i&&r===M.cardId&&i(null),C()},role:"menuitem","data-testid":`board-ctx-delete-${M.cardId}`},"Delete")):null,ye=["relates to","depends on","blocks","is blocked by","implements","is implemented by","extends","includes","references","duplicates","parent of","child of"],we=I?o("div",{className:"board-link-context-menu",style:{position:"fixed",left:`${I.x}px`,top:`${I.y}px`,backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 16px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"180px",maxHeight:"240px",overflowY:"auto",zIndex:"10001",fontSize:"13px"},onClick:X=>X.stopPropagation()},o("div",{style:{padding:"4px 14px",fontSize:"11px",color:"#94a3b8",fontWeight:"600"}},"Edge Type"),...ye.map(X=>o("button",{key:X,style:{display:"block",width:"100%",padding:"6px 14px",border:"none",backgroundColor:"transparent",textAlign:"left",cursor:"pointer",fontSize:"13px",color:"#334155",fontFamily:"inherit",boxSizing:"border-box"},onClick:()=>{n({type:"UPDATE_CARD",cardId:I.cardId,updates:{card_link:(()=>{let ie=null,he=[...m];for(;he.length>0;){let be=he.pop();if(Le(be)&&be.card_id===I.cardId){ie=be;break}if(ze(be))for(let Se of be.contents)he.push(Se)}return ie?ie.card_link.map(be=>be.link_id===I.linkId?{...be,link_name:X}:be):[]})()}}),T()},role:"menuitem"},X)),o("div",{style:{height:"1px",backgroundColor:"#e5e7eb",margin:"4px 0"}}),o("button",{style:{display:"block",width:"100%",padding:"6px 14px",border:"none",backgroundColor:"transparent",textAlign:"left",cursor:"pointer",fontSize:"13px",color:"#ef4444",fontFamily:"inherit"},onClick:()=>{n({type:"REMOVE_LINK",cardId:I.cardId,linkId:I.linkId}),T()},role:"menuitem"},"Delete Link")):null;return o("div",{ref:p,className:"board-canvas",style:ge,onMouseDown:A,onWheel:k,"data-testid":"board-canvas",role:"application","aria-label":`Board: ${t.name}`,tabIndex:0},o("div",{className:"board-canvas__inner",style:me,"data-testid":"board-canvas-inner"},o(Ri,{links:ce,cards:le,selectedLinkId:null,onSelectLink:()=>{},onLinkContextMenu:N,canvasWidth:kt,canvasHeight:kt}),D?o("svg",{style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",overflow:"visible"},width:String(kt),height:String(kt),className:"link-drag-overlay","data-testid":"link-drag-overlay"},o("line",{x1:String(D.fromPos.x),y1:String(D.fromPos.y),x2:String(D.currentPos.x),y2:String(D.currentPos.y),stroke:"#3b82f6","stroke-width":"2","stroke-dasharray":"6 4","pointer-events":"none","data-testid":"link-drag-line"})):null,...re),xe,we)}function Kc(e){let t=[],n=[...e];for(;n.length>0;){let r=n.pop();if(Le(r))t.push(r);else if(ze(r))for(let i=r.contents.length-1;i>=0;i--)n.push(r.contents[i])}return t}function Ti(e,t,n,r){let i=r??40,s=Kc(e);if(s.length===0)return{panX:0,panY:0,zoom:1};let a=1/0,l=1/0,d=-1/0,u=-1/0;for(let g=0;g<s.length;g++){let b=s[g];b.position.x<a&&(a=b.position.x),b.position.y<l&&(l=b.position.y);let S=b.position.x+b.size.width,D=b.position.y+b.size.height;S>d&&(d=S),D>u&&(u=D)}let h=d-a+i*2,m=u-l+i*2,c=t/h,p=n/m,f=Math.max(.25,Math.min(4,Math.min(c,p))),y=-a*f+(t-(d-a)*f)/2,x=-l*f+(n-(u-l)*f)/2;return{panX:y,panY:x,zoom:f}}var Un=["#fef9c3","#fecaca","#fed7aa","#bbf7d0","#bfdbfe","#ddd6fe","#fbcfe8","#e5e7eb"];function Di(e){let{zoom:t,gridEnabled:n,selectedColor:r,colorFilter:i,onNewCard:s,onZoomIn:a,onZoomOut:l,onZoomReset:d,onColorSelect:u,onColorFilter:h,onGridToggle:m,onSearch:c}=e,[p,f]=G(""),y=v($=>{let L=$.target.value;f(L),c(L)},[c]),x={display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px",backgroundColor:"rgba(255,255,255,0.95)",borderBottom:"1px solid #e2e8f0",fontSize:"12px",flexShrink:"0",flexWrap:"wrap"},g={padding:"4px 10px",border:"1px solid #d1d5db",borderRadius:"4px",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"12px",color:"#374151",lineHeight:"1.4"},b={...g,backgroundColor:"#3b82f6",color:"#ffffff",borderColor:"#3b82f6"},S={fontSize:"12px",color:"#64748b",minWidth:"40px",textAlign:"center",cursor:"pointer"},D={width:"1px",height:"20px",backgroundColor:"#e2e8f0",margin:"0 4px"},z={padding:"4px 8px",border:"1px solid #d1d5db",borderRadius:"4px",fontSize:"12px",width:"120px",outline:"none"},M=Un.map($=>{let L=$===r,R=$===i,P=()=>{L&&h?h(R?null:$):u($)},B="1px solid rgba(0,0,0,0.15)";return R?B="3px solid #ef4444":L&&(B="2px solid #3b82f6"),o("button",{key:$,title:$,style:{width:"18px",height:"18px",borderRadius:"50%",backgroundColor:$,border:B,cursor:"pointer",padding:"0",flexShrink:"0",opacity:R?"1":i?"0.5":"1"},onClick:P,"aria-label":R?`Clear color filter ${$}`:`Select color ${$}`,"data-testid":`color-swatch-${$}`})});return o("div",{className:"board-toolbar",style:x,role:"toolbar","aria-label":"Board toolbar","data-testid":"board-toolbar"},o("button",{style:g,onClick:s,"data-testid":"btn-new-card","aria-label":"New card"},"+ New Card"),o("div",{style:D}),o("button",{style:g,onClick:l,"data-testid":"btn-zoom-out","aria-label":"Zoom out"},"-"),o("span",{style:S,onClick:d,"data-testid":"zoom-level",role:"status","aria-label":`Zoom ${Math.round(t*100)}%`},`${Math.round(t*100)}%`),o("button",{style:g,onClick:a,"data-testid":"btn-zoom-in","aria-label":"Zoom in"},"+"),o("div",{style:D}),...M,o("div",{style:D}),o("button",{style:n?b:g,onClick:m,"data-testid":"btn-grid-toggle","aria-label":n?"Disable grid snapping":"Enable grid snapping","aria-pressed":String(n)},"Grid"),o("div",{style:D}),o("input",{type:"text",placeholder:"Search cards...",value:p,onInput:y,style:z,"data-testid":"search-input","aria-label":"Search cards"}))}var zi=50,ut={id:Ze(),name:"Untitled",collection:[],viewport:{panX:0,panY:0,zoom:1}};function Ai(e,t){let n=null;function r(s){let a=[];for(let l=0;l<s.length;l++){let d=s[l];if(Je(d)===t){n=d;continue}if(ze(d)){let h=r(d.contents);a.push({...d,contents:h})}else a.push(d)}return a}return[r(e),n]}function dt(e,t,n){let r=[];for(let i=0;i<e.length;i++){let s=e[i];Je(s)===t?r.push(n(s)):ze(s)?r.push({...s,contents:dt(s.contents,t,n)}):r.push(s)}return r}function en(e,t,n){let r=[];for(let i=0;i<e.length;i++){let s=e[i];ze(s)&&s.container_id===t?r.push({...s,contents:[...s.contents,n]}):ze(s)?r.push({...s,contents:en(s.contents,t,n)}):r.push(s)}return r}function Li(e,t){let n=[...e];for(;n.length>0;){let r=n.pop();if(ze(r)){if(r.container_id===t)return r;for(let i=0;i<r.contents.length;i++)n.push(r.contents[i])}}return null}function Zc(e,t,n){let r=null;function i(a){let l=[];for(let d=0;d<a.length;d++){let u=a[d];if(ze(u)&&u.container_id===t){let h=[];for(let m=0;m<u.contents.length;m++){let c=u.contents[m];Je(c)===n?r=c:h.push(c)}l.push({...u,contents:h})}else ze(u)?l.push({...u,contents:i(u.contents)}):l.push(u)}return l}return[i(e),r]}function Jc(e){switch(e){case"text":return{text:""};case"json":return{};case"task":return{};case"project":return{project_id:"",project_name:""}}}function Bi(e,t){switch(t.type){case"ADD_ITEM":return t.containerId?{...e,collection:en(e.collection,t.containerId,t.item)}:{...e,collection:[...e.collection,t.item]};case"REMOVE_ITEM":{let[n]=Ai(e.collection,t.itemId);return{...e,collection:n}}case"MOVE_ITEM":return{...e,collection:dt(e.collection,t.itemId,n=>({...n,position:t.position,...Le(n)?{updatedAt:Date.now()}:{}}))};case"RESIZE_ITEM":return{...e,collection:dt(e.collection,t.itemId,n=>({...n,size:t.size,...Le(n)?{updatedAt:Date.now()}:{}}))};case"UPDATE_CARD":return{...e,collection:dt(e.collection,t.cardId,n=>Le(n)?{...n,...t.updates,updatedAt:Date.now()}:n)};case"CHANGE_CARD_TYPE":return{...e,collection:dt(e.collection,t.cardId,n=>Le(n)?{...n,card_type:t.newType,content:Jc(t.newType),updatedAt:Date.now()}:n)};case"ADD_CONTAINER":return t.parentContainerId?{...e,collection:en(e.collection,t.parentContainerId,t.container)}:{...e,collection:[...e.collection,t.container]};case"NEST_ITEM":{let n=Li(e.collection,t.containerId);if(!n)return e;let[r,i]=Ai(e.collection,t.itemId);if(!i)return e;let s={...i,position:{x:i.position.x-n.position.x,y:i.position.y-n.position.y-30}};return{...e,collection:en(r,t.containerId,s)}}case"UNNEST_ITEM":{let n=Li(e.collection,t.containerId),[r,i]=Zc(e.collection,t.containerId,t.itemId);if(!i)return e;let s=n?{...i,position:{x:i.position.x+n.position.x,y:i.position.y+n.position.y+30}}:i;return{...e,collection:[...r,s]}}case"ADD_LINK":return{...e,collection:dt(e.collection,t.cardId,n=>Le(n)?{...n,card_link:[...n.card_link,t.link],updatedAt:Date.now()}:n)};case"REMOVE_LINK":return{...e,collection:dt(e.collection,t.cardId,n=>Le(n)?{...n,card_link:n.card_link.filter(r=>r.link_id!==t.linkId),updatedAt:Date.now()}:n)};case"PAN":return{...e,viewport:{...e.viewport,panX:t.panX,panY:t.panY}};case"ZOOM":{let n=Math.max(.25,Math.min(4,t.zoom));return{...e,viewport:{...e.viewport,zoom:n}}}case"SET_BOARD":return t.state;case"RENAME_BOARD":return{...e,name:t.name};default:return e}}function Qc(e){return e.type==="PAN"||e.type==="ZOOM"}function Fi(e,t){switch(t.type){case"UNDO":{if(e.past.length===0)return e;let n=e.past[e.past.length-1];return{past:e.past.slice(0,e.past.length-1),present:n,future:[e.present,...e.future]}}case"REDO":{if(e.future.length===0)return e;let n=e.future[0],r=e.future.slice(1);return{past:[...e.past,e.present],present:n,future:r}}case"BOARD_ACTION":{let n=Bi(e.present,t.action);if(n===e.present)return e;if(Qc(t.action))return{...e,present:n};if(t.action.type==="SET_BOARD")return{past:[],present:n,future:[]};let r=[...e.past,e.present];return r.length>zi&&r.splice(0,r.length-zi),{past:r,present:n,future:[]}}default:return e}}function jn(e){let t={past:[],present:e||ut,future:[]},[n,r]=pn(Fi,t),i=v(l=>{r({type:"BOARD_ACTION",action:l})},[r]),s=v(()=>{r({type:"UNDO"})},[r]),a=v(()=>{r({type:"REDO"})},[r]);return{state:n.present,dispatch:i,undo:s,redo:a,canUndo:n.past.length>0,canRedo:n.future.length>0}}function Ni(e,t){let{state:n,dispatch:r,undo:i,redo:s,canUndo:a,canRedo:l}=jn(),d=oe(!1);ae(()=>{e&&t&&!d.current&&(d.current=!0,e.load(t).then(m=>{r({type:"SET_BOARD",state:m})}).catch(()=>{}))},[e,t,r]);let u=oe(null),h=oe(n);return h.current=n,ae(()=>{if(!(!e||!t))return u.current!==null&&clearTimeout(u.current),u.current=setTimeout(()=>{e.save(t,h.current).catch(()=>{}),u.current=null},500),()=>{u.current!==null&&clearTimeout(u.current)}},[e,t,n]),{state:n,dispatch:r,undo:i,redo:s,canUndo:a,canRedo:l}}var tn=class{async load(t){try{let n=localStorage.getItem("board:"+t);return n?JSON.parse(n):{...ut}}catch{return{...ut}}}async save(t,n){try{localStorage.setItem("board:"+t,JSON.stringify(n))}catch{}}};function ed(e){let t=[],n=[...e];for(;n.length>0;){let r=n.pop();if(Le(r))t.push(r);else for(let i=r.contents.length-1;i>=0;i--)n.push(r.contents[i])}return t}function Wi(e){let{collection:t,onCardDropped:n,children:r}=e,i=ot(),s=oe([]);ae(()=>{let u=ed(t),h=s.current,m=new Set(h.map(p=>p.card_id)),c=new Set(u.map(p=>p.card_id));for(let p of u)m.has(p.card_id)||i.publish("project-board",{event:"card-created",card:p});for(let p of h)c.has(p.card_id)||i.publish("project-board",{event:"card-deleted",cardId:p.card_id});for(let p of u)if(m.has(p.card_id)){let f=h.find(y=>y.card_id===p.card_id);f&&f.updatedAt!==p.updatedAt&&i.publish("project-board",{event:"card-updated",card:p})}s.current=u},[t,i]);let a=v(u=>{if(u.type==="text/plain"&&typeof u.data=="string")n(u.data,"");else if(u.type==="application/json"){let h=u.data;n(String(h.title||"Dropped Item"),String(h.description||""))}},[n]),{isOver:l}=zt({acceptTypes:["text/plain","application/json","application/project-card"],onDrop:a}),d={width:"100%",height:"100%",...l?{outline:"2px dashed #3b82f6",outlineOffset:"-2px"}:{}};return o("div",{style:d,"data-dropzone-id":"project-board-dropzone"},r)}var td=new tn;function _i(e){let t=[],n=[...e];for(;n.length>0;){let r=n.pop();if(Le(r))t.push(r);else if(ze(r))for(let i=r.contents.length-1;i>=0;i--)n.push(r.contents[i])}return t}var rt=Date.now(),nd={id:"sample-board-001",name:"Sample Project",collection:[{type:"card",card_id:"sample-1",card_type:"text",card_title:"Auth API",card_link:[{link_id:"link-1",link_name:"blocks",target_card_id:"sample-2",color:"#94a3b8",attributes:{}}],content:{text:"Design the auth flow"},position:{x:50,y:50},size:{width:180,height:120},color:"#3b82f6",priority:"high",assignee:"Alice",createdAt:rt,updatedAt:rt},{type:"card",card_id:"sample-2",card_type:"text",card_title:"Dashboard",card_link:[],content:{text:"Build the main dashboard"},position:{x:300,y:80},size:{width:180,height:120},color:"#22c55e",priority:"medium",assignee:"Bob",createdAt:rt,updatedAt:rt},{type:"card",card_id:"sample-3",card_type:"text",card_title:"Deploy",card_link:[],content:{text:"Set up CI pipeline"},position:{x:150,y:250},size:{width:180,height:120},color:"#f59e0b",priority:"low",createdAt:rt,updatedAt:rt},{type:"card",card_id:"sample-4",card_type:"text",card_title:"Docs",card_link:[],content:{text:"Write API reference"},position:{x:400,y:280},size:{width:180,height:120},color:"#a855f7",priority:"medium",assignee:"Carol",createdAt:rt,updatedAt:rt}],viewport:{panX:0,panY:0,zoom:1}};function od(e){return e.collection.length===0}function Oi(e){let t=e.boardId||"default",{state:n,dispatch:r,undo:i,redo:s,canUndo:a,canRedo:l}=Ni(td,t),[d,u]=G(Un[0]),[h,m]=G(!1),[c,p]=G(""),[f,y]=G(null),[x,g]=G(null),[b,S]=G(n.name||"Untitled"),[D,z]=G(!1),[M,$]=G(""),[L,R]=G(null),[P,B]=G(!0),[I,F]=G([{name:"relates to",weight:1},{name:"depends on",weight:2},{name:"blocks",weight:3},{name:"is blocked by",weight:3},{name:"implements",weight:2},{name:"references",weight:1}]),[A,k]=G(null),[w,E]=G(""),[C,N]=G("1"),[T,W]=G([]),_=oe(!1);ae(()=>{!_.current&&od(n)?(_.current=!0,r({type:"SET_BOARD",state:nd})):n.collection.length>0&&(_.current=!0)},[n,r]);let O=v(()=>{let pe=(-n.viewport.panX+300)/n.viewport.zoom,Me=(-n.viewport.panY+200)/n.viewport.zoom,Re=(Math.random()-.5)*300,De=(Math.random()-.5)*200,qe={type:"card",card_id:Ze(),card_type:"text",card_title:"New Card",card_link:[],content:{text:""},color:d,position:{x:Math.round(pe+Re),y:Math.round(Me+De)},size:{width:180,height:120},priority:"medium",createdAt:Date.now(),updatedAt:Date.now()};r({type:"ADD_ITEM",item:qe})},[n.viewport,d,r]),U=v(()=>{r({type:"ZOOM",zoom:n.viewport.zoom+.1})},[n.viewport.zoom,r]),K=v(()=>{r({type:"ZOOM",zoom:n.viewport.zoom-.1})},[n.viewport.zoom,r]),te=v(()=>{r({type:"ZOOM",zoom:1})},[r]),J=v(()=>{m(pe=>!pe)},[]),V=v(pe=>{p(pe)},[]),j=v(pe=>{y(pe)},[]),Y=v(pe=>{g(pe)},[]),H=v(()=>{B(pe=>!pe)},[]),Z=v(()=>{r({type:"SET_BOARD",state:ut}),y(null)},[r]),ee=v(()=>{let pe=JSON.stringify(n,null,2),Me=new Blob([pe],{type:"application/json"}),Re=URL.createObjectURL(Me),De=document.createElement("a");De.href=Re,De.download=`board-${t}.json`,De.style.display="none",document.body.appendChild(De),De.click(),document.body.removeChild(De),URL.revokeObjectURL(Re)},[n,t]),se=v(()=>{let pe=document.createElement("input");pe.type="file",pe.accept=".json,application/json",pe.style.display="none",pe.addEventListener("change",()=>{let Me=pe.files&&pe.files[0];if(!Me)return;let Re=new FileReader;Re.onload=()=>{try{let De=JSON.parse(Re.result);De&&De.collection&&De.viewport&&r({type:"SET_BOARD",state:De})}catch{}},Re.readAsText(Me)}),document.body.appendChild(pe),pe.click(),document.body.removeChild(pe)},[r]),Q=v(()=>{window.print()},[]),le=_i(n.collection),ce=v(()=>{let pe=_i(n.collection);pe.length>0&&y(pe[0].card_id)},[n.collection]),ue=v(()=>{f&&(r({type:"REMOVE_ITEM",itemId:f}),y(null))},[f,r]),re=v(()=>{if(n.collection.length===0)return;let Re=Ti(n.collection,800,600);r({type:"PAN",panX:Re.panX,panY:Re.panY}),r({type:"ZOOM",zoom:Re.zoom})},[n.collection,r]);ae(()=>{let pe={menus:[{label:"File",items:[{label:"New Board",onClick:Z},{label:"Export JSON",onClick:ee},{label:"Import JSON",onClick:se},{divider:!0},{label:"Print",onClick:Q}]},{label:"Edit",items:[{label:"Undo",shortcut:"Ctrl+Z",onClick:i,disabled:!a},{label:"Redo",shortcut:"Ctrl+Y",onClick:s,disabled:!l},{divider:!0},{label:"Select All",shortcut:"Ctrl+A",onClick:ce},{label:"Delete Selected",onClick:ue}]},{label:"View",items:[{label:"Zoom In",onClick:U},{label:"Zoom Out",onClick:K},{label:"Fit All",onClick:re},{divider:!0},{label:"Toggle Grid",onClick:J}]}]}},[Z,ee,se,Q,i,s,a,l,ce,ue,U,K,re,J]),ae(()=>{let pe=Me=>{let Re=Me;Re.ctrlKey&&Re.key==="z"?(Re.preventDefault(),i()):Re.ctrlKey&&Re.key==="y"&&(Re.preventDefault(),s())};return document.addEventListener("keydown",pe),()=>document.removeEventListener("keydown",pe)},[i,s]),ae(()=>{if(!L)return;let pe=()=>R(null),Me=setTimeout(()=>document.addEventListener("click",pe),0);return()=>{clearTimeout(Me),document.removeEventListener("click",pe)}},[L]);let ge=v(()=>{$(b),z(!0)},[b]),me=v(()=>{let pe=M.trim();pe&&(S(pe),r({type:"RENAME_BOARD",name:pe}),e.onTitleChange&&e.onTitleChange(`Project Board: ${pe}`)),z(!1)},[M,r,e.onTitleChange]),ne=v(()=>{z(!1)},[]),de=v(pe=>{$(pe.target.value)},[]),fe=v(pe=>{let Me=pe;Me.key==="Enter"&&(Me.preventDefault(),me()),Me.key==="Escape"&&(Me.preventDefault(),ne())},[me,ne]),xe={display:"flex",flexDirection:"column",width:"100%",height:"100%",backgroundColor:"#f8fafc",overflow:"hidden"},ye=v((pe,Me)=>{let Re=(-n.viewport.panX+300)/n.viewport.zoom,De=(-n.viewport.panY+200)/n.viewport.zoom,qe=(Math.random()-.5)*300,st=(Math.random()-.5)*200,Et={type:"card",card_id:Ze(),card_type:"text",card_title:pe,card_link:[],content:{text:Me},color:d,position:{x:Math.round(Re+qe),y:Math.round(De+st)},size:{width:180,height:120},priority:"medium",createdAt:Date.now(),updatedAt:Date.now()};r({type:"ADD_ITEM",item:Et})},[n.viewport,d,r]),we={display:"flex",alignItems:"center",height:"28px",backgroundColor:"#f1f5f9",borderBottom:"1px solid #e2e8f0",padding:"0 8px",fontSize:"13px",flexShrink:"0"},X={padding:"2px 10px",border:"none",backgroundColor:"transparent",cursor:"pointer",fontSize:"13px",color:"#334155",borderRadius:"4px",fontFamily:"inherit"},ie=v(()=>{let pe=(-n.viewport.panX+300)/n.viewport.zoom,Me=(-n.viewport.panY+200)/n.viewport.zoom,Re=(Math.random()-.5)*300,De=(Math.random()-.5)*200;r({type:"ADD_CONTAINER",container:{type:"container",container_id:Ze(),name:"New Container",position:{x:Math.round(pe+Re),y:Math.round(Me+De)},size:{width:300,height:250},contents:[]}}),R(null)},[n.viewport,r]),he={position:"absolute",top:"100%",left:"0",marginTop:"2px",backgroundColor:"#ffffff",border:"1px solid #d1d5db",borderRadius:"6px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",padding:"4px 0",minWidth:"180px",zIndex:"1000"},be={display:"block",width:"100%",padding:"6px 14px",border:"none",backgroundColor:"transparent",textAlign:"left",cursor:"pointer",fontSize:"13px",color:"#334155",fontFamily:"inherit",boxSizing:"border-box"},Se=o("div",{style:we,"data-testid":"app-menu-bar"},o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:X,onClick:()=>R(L==="project"?null:"project")},"Project"),L==="project"?o("div",{style:he},o("button",{style:be,onClick:()=>{ge(),R(null)}},"Rename Project..."),o("div",{style:{height:"1px",backgroundColor:"#e5e7eb",margin:"4px 0"}}),o("button",{style:be,onClick:()=>{ie()}},"New Container"),o("button",{style:be,onClick:()=>{O(),R(null)}},"New Card")):null),o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:X,onClick:()=>R(L==="graphs"?null:"graphs")},"Graphs"),L==="graphs"?o("div",{style:he},o("button",{style:be,onClick:()=>{E(""),N("1"),k("add"),R(null)}},"Add Attribute..."),o("button",{style:be,onClick:()=>{k("delete"),R(null)}},"Delete Attribute..."),o("button",{style:be,onClick:()=>{W(I.map(pe=>({...pe}))),k("edit"),R(null)}},"Edit Attributes...")):null),o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:X,onClick:()=>R(L==="settings"?null:"settings")},"Settings"),L==="settings"?o("div",{style:he},o("button",{style:be,onClick:()=>{J(),R(null)}},h?"Disable Grid Snap":"Enable Grid Snap"),o("button",{style:be,onClick:()=>{H(),R(null)}},P?"Hide Links":"Show Links")):null),o("div",{style:{position:"relative",display:"inline-flex"}},o("button",{style:X,onClick:()=>R(L==="help"?null:"help")},"Help"),L==="help"?o("div",{style:he},o("button",{style:be,onClick:()=>R(null)},"About Project Board"),o("button",{style:be,onClick:()=>R(null)},"Keyboard Shortcuts")):null),o("span",{style:{marginLeft:"auto",fontSize:"12px",color:"#94a3b8"}},`Project Board: ${b}`)),Ee=D?o("div",{style:{position:"absolute",inset:"0",backgroundColor:"rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"200"},onClick:ne},o("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",boxShadow:"0 8px 24px rgba(0,0,0,0.2)",minWidth:"300px"},onClick:pe=>pe.stopPropagation(),role:"dialog","aria-label":"Rename project"},o("div",{style:{fontWeight:"600",fontSize:"14px",marginBottom:"12px",color:"#1a1a1a"}},"Rename Project"),o("input",{type:"text",value:M,onInput:de,onKeyDown:fe,autoFocus:!0,style:{width:"100%",padding:"8px 10px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},"data-testid":"rename-input"}),o("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"}},o("button",{onClick:ne,style:{padding:"6px 14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px",fontFamily:"inherit"}},"Cancel"),o("button",{onClick:me,style:{padding:"6px 14px",border:"none",borderRadius:"6px",backgroundColor:"#3b82f6",color:"#ffffff",cursor:"pointer",fontSize:"13px",fontWeight:"600",fontFamily:"inherit"},"data-testid":"rename-confirm"},"Rename")))):null,Ce={position:"absolute",inset:"0",backgroundColor:"rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"200"},ke={backgroundColor:"#ffffff",borderRadius:"8px",padding:"20px",boxShadow:"0 8px 24px rgba(0,0,0,0.2)",minWidth:"320px",maxHeight:"400px",overflow:"auto"},Ie={fontWeight:"600",fontSize:"14px",marginBottom:"12px",color:"#1a1a1a"},Te={width:"100%",padding:"8px 10px",border:"1px solid #d1d5db",borderRadius:"6px",fontSize:"14px",boxSizing:"border-box",outline:"none",fontFamily:"inherit"},Ue={padding:"6px 14px",border:"none",borderRadius:"6px",backgroundColor:"#3b82f6",color:"#ffffff",cursor:"pointer",fontSize:"13px",fontWeight:"600",fontFamily:"inherit"},Xe={padding:"6px 14px",border:"1px solid #d1d5db",borderRadius:"6px",backgroundColor:"#ffffff",cursor:"pointer",fontSize:"13px",fontFamily:"inherit"},ft=null;return A==="add"&&(ft=o("div",{style:Ce,onClick:()=>k(null)},o("div",{style:ke,onClick:pe=>pe.stopPropagation(),role:"dialog","aria-label":"Add edge attribute"},o("div",{style:Ie},"Add Edge Attribute"),o("div",{style:{marginBottom:"8px"}},o("label",{style:{fontSize:"12px",color:"#64748b",display:"block",marginBottom:"4px"}},"Name"),o("input",{type:"text",value:w,style:Te,placeholder:"e.g. depends on",onInput:pe=>E(pe.target.value)})),o("div",{style:{marginBottom:"12px"}},o("label",{style:{fontSize:"12px",color:"#64748b",display:"block",marginBottom:"4px"}},"Weight"),o("input",{type:"number",value:C,style:Te,min:"0",step:"1",onInput:pe=>N(pe.target.value)})),o("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"}},o("button",{style:Xe,onClick:()=>k(null)},"Cancel"),o("button",{style:Ue,onClick:()=>{let pe=w.trim(),Me=parseFloat(C)||1;pe&&F(Re=>[...Re,{name:pe,weight:Me}]),k(null)}},"Add"))))),A==="delete"&&(ft=o("div",{style:Ce,onClick:()=>k(null)},o("div",{style:ke,onClick:pe=>pe.stopPropagation(),role:"dialog","aria-label":"Delete edge attribute"},o("div",{style:Ie},"Delete Edge Attribute"),I.length===0?o("div",{style:{color:"#94a3b8",padding:"8px 0"}},"No attributes defined."):o("div",{style:{display:"flex",flexDirection:"column",gap:"4px"}},...I.map((pe,Me)=>o("div",{key:String(Me),style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 8px",borderRadius:"4px",border:"1px solid #e5e7eb"}},o("span",{style:{fontSize:"13px"}},`${pe.name} (weight: ${pe.weight})`),o("button",{style:{border:"none",backgroundColor:"transparent",color:"#ef4444",cursor:"pointer",fontSize:"16px"},onClick:()=>F(Re=>Re.filter((De,qe)=>qe!==Me))},"\xD7")))),o("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"12px"}},o("button",{style:Xe,onClick:()=>k(null)},"Done"))))),A==="edit"&&(ft=o("div",{style:Ce,onClick:()=>k(null)},o("div",{style:{...ke,minWidth:"400px"},onClick:pe=>pe.stopPropagation(),role:"dialog","aria-label":"Edit edge attributes"},o("div",{style:Ie},"Edit Edge Attributes"),T.length===0?o("div",{style:{color:"#94a3b8",padding:"8px 0"}},"No attributes defined."):o("div",{style:{display:"flex",flexDirection:"column",gap:"6px"}},...T.map((pe,Me)=>o("div",{key:String(Me),style:{display:"flex",alignItems:"center",gap:"8px"}},o("input",{type:"text",value:pe.name,style:{...Te,flex:"1"},onInput:Re=>{let De=Re.target.value;W(qe=>qe.map((st,Et)=>Et===Me?{...st,name:De}:st))}}),o("input",{type:"number",value:String(pe.weight),min:"0",step:"1",style:{...Te,width:"80px"},onInput:Re=>{let De=parseFloat(Re.target.value)||0;W(qe=>qe.map((st,Et)=>Et===Me?{...st,weight:De}:st))}})))),o("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"12px"}},o("button",{style:Xe,onClick:()=>k(null)},"Cancel"),o("button",{style:Ue,onClick:()=>{F(T.filter(pe=>pe.name.trim())),k(null)}},"Save"))))),o("div",{className:"project-manager-app",style:xe,"data-testid":"project-manager-app"},Se,o(Di,{zoom:n.viewport.zoom,gridEnabled:h,selectedColor:d,colorFilter:x,onNewCard:O,onZoomIn:U,onZoomOut:K,onZoomReset:te,onColorSelect:u,onColorFilter:Y,onGridToggle:J,onSearch:V}),o(Wi,{collection:n.collection,onCardDropped:ye},o(Vn,{state:n,dispatch:r,searchQuery:c,gridEnabled:h,selectedId:f,onSelectItem:j,colorFilter:x,onUpdateItem:(pe,Me)=>{r({type:"UPDATE_CARD",cardId:pe,updates:Me})},onCardContextMenu:(pe,Me)=>{}})),Ee,ft)}var rd=28,id=5e3;var Hi=0;function Yi(e){return Hi++,`${e}-${Hi}`}function sd(e){return e.replace(/\s*\(\d+\)$/,"")}function ad(e){let{toasts:t,onDismiss:n}=e;if(t.length===0)return null;let r={position:"absolute",top:"8px",right:"8px",zIndex:"9999",display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none",maxWidth:"320px"},i=t.map(s=>{let a="rgba(50, 50, 50, 0.95)",l="#555";return s.severity==="warning"?(a="rgba(60, 40, 10, 0.95)",l="#f39c12"):s.severity==="error"&&(a="rgba(60, 10, 10, 0.95)",l="#e74c3c"),o("div",{key:String(s.id),className:`unity-desktop__toast unity-desktop__toast--${s.severity}`,style:{backgroundColor:a,border:`1px solid ${l}`,borderRadius:"6px",padding:"10px 14px",color:"#ffffff",fontSize:"13px",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",pointerEvents:"auto",cursor:"pointer",transition:"opacity 200ms ease"},onClick:()=>n(s.id),role:"alert","aria-live":"polite"},s.message)});return o("div",{className:"unity-desktop__toast-container",style:r,"aria-label":"Notifications"},...i)}function ld(){let e=ot(),t=oe(!1);return ae(()=>{t.current||(t.current=!0,e.publish("terminal-output",{text:"Terminal session started",pid:1}))},[e]),o("div",{style:{padding:"16px",fontSize:"12px",color:"#00ff41",height:"100%",overflow:"auto",backgroundColor:"#1a1a2e",fontFamily:"monospace"}},o("div",null,"$ whoami"),o("div",null,"operator"),o("div",null,"$ uname -a"),o("div",null,"Linux specifyjs 6.1.0 #1 SMP x86_64 GNU/Linux"),o("div",{style:{opacity:"0.6",marginTop:"8px",fontSize:"10px"}},"[Published terminal-output message]"),o("div",null,"$ _"))}function cd(){let[e,t]=G([]),n=ct();Tt("terminal-output",s=>{t(a=>[...a,`[terminal] ${s.payload.text}`])});let r=v(s=>{s.preventDefault(),n.startDrag({type:"application/file",data:{name:"readme.txt",size:1024},sourceAppId:"files",preview:"readme.txt"})},[n]);return o("div",{style:{padding:"16px",fontSize:"13px",color:"var(--color-text, #333)",height:"100%",overflow:"auto"}},o("div",{style:{fontWeight:"600",marginBottom:"12px"}},"Home"),o("div",{style:{display:"flex",flexDirection:"column",gap:"6px"}},...["\u{1F4C1} Documents","\u{1F4C1} Downloads","\u{1F4C1} Music","\u{1F4C1} Pictures","\u{1F4C1} Videos"].map(s=>o("span",{style:{cursor:"pointer"}},s)),o("span",{style:{cursor:"grab",padding:"4px 8px",border:"1px dashed #94a3b8",borderRadius:"4px",backgroundColor:"rgba(148, 163, 184, 0.1)"},onMouseDown:r,"aria-label":"Drag readme.txt"},"\u{1F4C4} readme.txt (drag me)")),e.length>0?o("div",{style:{marginTop:"12px",padding:"8px",backgroundColor:"rgba(0,0,0,0.05)",borderRadius:"4px",fontSize:"11px",fontFamily:"monospace"}},o("div",{style:{fontWeight:"600",marginBottom:"4px"}},"Messages received:"),...e.map((s,a)=>o("div",{key:String(a),style:{color:"#64748b"}},s))):null)}function dd(e,t,n){let r={padding:"16px",fontSize:"13px",color:"var(--color-text, #333)",height:"100%",overflow:"auto"};switch(sd(e)){case"Files":return o(nt,{appId:"files"},o(cd,null));case"Terminal":return o(nt,{appId:"terminal"},o(ld,null));case"Browser":return o("div",{style:r},o("div",{style:{padding:"6px 10px",backgroundColor:"#f1f5f9",borderRadius:"4px",marginBottom:"12px",fontSize:"12px",color:"#64748b"}},"https://specifyjs.asymmetric-effort.com"),o("div",{style:{textAlign:"center",padding:"32px",color:"#94a3b8"}},"Web page content area"));case"Mail":return o("div",{style:r},o("div",{style:{fontWeight:"600",marginBottom:"8px"}},"Inbox (3)"),...["Build passed \u2014 CI/CD Pipeline","PR Review: feat/unity-desktop","Weekly sync notes"].map(s=>o("div",{style:{padding:"8px",borderBottom:"1px solid #e2e8f0",cursor:"pointer"}},s)));case"Settings":return o("div",{style:r},o("div",{style:{fontWeight:"600",marginBottom:"12px"}},"System Settings"),...["Appearance","Network","Sound","Power","Users","About"].map(s=>o("div",{style:{padding:"8px 0",borderBottom:"1px solid #e2e8f0"}},s)));case"Word Processor":return o(qt,null);case"IDE":return o(Kt,null);case"Trading":return o(Qt,null);case"Project Board":return o(Oi,{boardId:t||"default",onTitleChange:n||void 0});default:return o("div",{style:r},o("div",{style:{textAlign:"center",padding:"32px",color:"#94a3b8"}},`${e} application content`))}}function ud(e){let{apps:t,user:n,onAppOpen:r,onLogout:i,theme:s="dark",children:a}=e,l=Pt(),d=l.activeMenuBar,u=l.dockSignals,h=oe(l);h.current=l;let[m,c]=G([]),[p,f]=G([]),[y,x]=G(!1),[g,b]=G(!1),[S,D]=G(null),[z,M]=G({x:0,y:0}),[$,L]=G(null),R=v(()=>{x(ne=>!ne)},[]),P=v(ne=>{f(de=>de.filter(fe=>fe.id!==ne))},[]);ae(()=>{if(p.length===0)return;let ne=p[0],de=Date.now()-ne.timestamp,fe=Math.max(0,id-de),xe=setTimeout(()=>{f(ye=>ye.filter(we=>we.id!==ne.id))},fe);return()=>clearTimeout(xe)},[p]);let B=oe(t);B.current=t;let I=oe(r);I.current=r;let F=oe({});for(let ne of m)if(!F.current[ne.id]){let de=ne.id;F.current[de]=fe=>{c(xe=>xe.map(ye=>ye.id===de?{...ye,title:fe}:ye))}}let A=v(ne=>{let fe=B.current.find(xe=>xe.id===ne);fe&&(c(xe=>{let we=xe.filter(Se=>Se.appId===ne).length+1,X=we===1?fe.label:`${fe.label} (${we})`,ie=Yi(ne),he=xe.length>0?Math.max(...xe.map(Se=>Se.zIndex))+1:1,be={id:ie,appId:fe.id,title:X,icon:fe.icon,x:60+xe.length*30,y:40+xe.length*30,width:600,height:400,zIndex:he,focused:!0,windowState:"normal"};return[...xe.map(Se=>({...Se,focused:!1})),be]}),ne==="files"&&h.current.setMenuBar("files",{menus:[{label:"File",items:[{label:"New",shortcut:"Ctrl+N",onClick:()=>{}},{label:"Open",shortcut:"Ctrl+O",onClick:()=>{}},{label:"Save",shortcut:"Ctrl+S",onClick:()=>{}}]},{label:"Edit",items:[{label:"Cut",shortcut:"Ctrl+X",onClick:()=>{}},{label:"Copy",shortcut:"Ctrl+C",onClick:()=>{}},{label:"Paste",shortcut:"Ctrl+V",onClick:()=>{}}]}]}),ne==="terminal"&&h.current.signalDock("terminal",{badge:3}),I.current&&I.current(ne))},[]),k=v(ne=>{c(de=>{if(!de.find(ye=>ye.id===ne))return de;let xe=Math.max(...de.map(ye=>ye.zIndex))+1;return de.map(ye=>ye.id===ne?{...ye,focused:!0,zIndex:xe,windowState:ye.windowState==="minimized"?"normal":ye.windowState}:{...ye,focused:!1})})},[]),w=v(ne=>{c(de=>{let fe=de.filter(X=>X.appId===ne);if(fe.length===0)return de;let ye=[...fe].sort((X,ie)=>ie.zIndex-X.zIndex)[0],we=Math.max(...de.map(X=>X.zIndex))+1;return de.map(X=>X.id===ye.id?{...X,focused:!0,zIndex:we,windowState:X.windowState==="minimized"?"normal":X.windowState}:{...X,focused:!1})}),c(de=>{if(de.filter(xe=>xe.appId===ne).length===0){let ye=B.current.find(he=>he.id===ne);if(!ye)return de;let we=Yi(ne),X=de.length>0?Math.max(...de.map(he=>he.zIndex))+1:1,ie={id:we,appId:ye.id,title:ye.label,icon:ye.icon,x:60+de.length*30,y:40+de.length*30,width:600,height:400,zIndex:X,focused:!0,windowState:"normal"};return ne==="files"&&h.current.setMenuBar("files",{menus:[{label:"File",items:[{label:"New",shortcut:"Ctrl+N",onClick:()=>{}},{label:"Open",shortcut:"Ctrl+O",onClick:()=>{}},{label:"Save",shortcut:"Ctrl+S",onClick:()=>{}}]},{label:"Edit",items:[{label:"Cut",shortcut:"Ctrl+X",onClick:()=>{}},{label:"Copy",shortcut:"Ctrl+C",onClick:()=>{}},{label:"Paste",shortcut:"Ctrl+V",onClick:()=>{}}]}]}),ne==="terminal"&&h.current.signalDock("terminal",{badge:3}),I.current&&I.current(ne),[...de.map(he=>({...he,focused:!1})),ie]}return de})},[]),E=t.map(ne=>{let de=m.some(ye=>ye.appId===ne.id),fe=u.get(ne.id),xe={id:ne.id,icon:ne.icon,label:fe?.tooltip||ne.label,active:de};return fe&&(fe.badge!=null&&(xe.badge=fe.badge>0?fe.badge:void 0),fe.progress!=null&&(xe.progress=fe.progress>0?fe.progress:void 0),fe.urgent&&(xe.urgent=!0)),xe}),C=m.find(ne=>ne.focused),N=C?C.title:void 0,T=v(()=>{b(!0)},[]),W=v(()=>{b(!1)},[]),_=v((ne,de)=>{D(ne),M(de)},[]),O=v(()=>{D(null)},[]),U=v(()=>{},[]),K=v(()=>{i&&i()},[i]),te=[];n&&(te.push({label:n.name,icon:void 0,onClick:U,divider:!1}),te.push({label:"",icon:void 0,onClick:U,divider:!0})),te.push({label:"Lock",icon:void 0,onClick:T,divider:!1}),te.push({label:"Logout",icon:void 0,onClick:K,divider:!1});let J=q(()=>({width:"100%",height:"100%",minHeight:"500px",display:"flex",flexDirection:"column",fontFamily:'Ubuntu, "Segoe UI", sans-serif',fontSize:"13px",color:s==="dark"?"#ffffff":"#1a1a1a",overflow:"hidden",position:"relative"}),[s]),V={display:"flex",flex:"1",overflow:"hidden"},j={display:"flex",flexDirection:"column",height:"100%",backgroundColor:s==="dark"?"var(--dock-bg, rgba(0, 0, 0, 0.7))":"var(--dock-bg, rgba(200, 200, 200, 0.9))",borderRight:s==="dark"?"1px solid rgba(255, 255, 255, 0.1)":"1px solid rgba(0, 0, 0, 0.1)",flexShrink:"0"},Y={width:"100%",height:"100%",position:"relative"},H=o(Bn,{activeAppName:N,activitiesButton:{label:"Activities",onClick:R},appMenuBar:d||void 0,clockFormat:"24h",showSeconds:!0,showDate:!0,user:n?{name:n.name,avatar:n.avatar}:void 0,userMenuItems:te.length>0?te:void 0,height:rd}),Z=o(Fn,{items:E,orientation:"vertical",position:"left",iconSize:36,onItemClick:w,onItemContextMenu:_}),ee=o(ad,{toasts:p,onDismiss:P}),se=m.filter(ne=>ne.windowState!=="minimized").map(ne=>o(At,{key:ne.id,id:ne.id,title:ne.title,icon:ne.icon,defaultPosition:{x:ne.x,y:ne.y},defaultSize:{width:ne.width,height:ne.height},zIndex:ne.zIndex,focused:ne.focused,windowState:ne.windowState,onClose:()=>{c(de=>de.filter(fe=>fe.id!==ne.id))},onFocus:()=>{c(de=>{let fe=Math.max(...de.map(xe=>xe.zIndex))+1;return de.map(xe=>xe.id===ne.id?{...xe,focused:!0,zIndex:fe}:{...xe,focused:!1})})},onMinimize:()=>{c(de=>de.map(fe=>fe.id===ne.id?{...fe,windowState:"minimized"}:fe))},onMaximize:()=>{c(de=>de.map(fe=>fe.id===ne.id?{...fe,windowState:fe.windowState==="maximized"?"normal":"maximized"}:fe))}},dd(t.find(de=>de.id===ne.appId)?.label||ne.title,ne.id,F.current[ne.id]))),Q=[];a&&Q.push(a),Q.push(...se),Q.push(ee);let le=o(Nn,{backgroundColor:s==="dark"?"#2c001e":"#e8e0e4",backgroundGradient:s==="dark"?"linear-gradient(135deg, #2c001e 0%, #5e2750 50%, #2c001e 100%)":"linear-gradient(135deg, #e8e0e4 0%, #d4c4d0 50%, #e8e0e4 100%)"},o("div",{className:"unity-desktop__workspace",style:Y},...Q)),ce=y?o("div",{style:{position:"absolute",inset:"0",zIndex:"100",backgroundColor:"rgba(0, 0, 0, 0.85)",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(80px, 1fr))",gap:"24px",padding:"48px",alignContent:"start",overflowY:"auto"},onClick:R},...t.map(ne=>o("button",{key:ne.id,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",background:"none",border:"none",color:"#ffffff",cursor:"pointer",padding:"12px",borderRadius:"8px",fontSize:"12px"},onClick:de=>{de.stopPropagation(),x(!1),w(ne.id)}},o("span",{style:{fontSize:"32px",display:"block"}},ne.icon),o("span",null,ne.label)))):null,ue=g?o("div",{className:"unity-desktop__lock-overlay",style:{position:"absolute",inset:"0",zIndex:"9999",backgroundColor:"rgba(0,0,0,0.85)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"#ffffff"},onClick:W},o("div",{style:{fontSize:"64px",marginBottom:"16px"}},"\u{1F512}"),o("div",{style:{fontSize:"24px",fontWeight:"600",marginBottom:"8px"}},"Locked"),o("div",{style:{fontSize:"14px",opacity:"0.7"}},"Click to unlock")):null,re=(()=>{if(!S)return null;let ne=t.find(X=>X.id===S),de=m.filter(X=>X.appId===S),fe={padding:"6px 14px",cursor:"pointer"},xe={onMouseEnter:X=>{X.currentTarget.style.backgroundColor="#444"},onMouseLeave:X=>{X.currentTarget.style.backgroundColor="transparent"}},ye={borderBottom:"1px solid #444",margin:"4px 0"},we=[];return we.push(o("div",{key:"new",style:fe,...xe,onClick:()=>{A(S),D(null)},role:"menuitem"},"\u25CF New")),de.length>0&&(we.push(o("div",{key:"sep-1",style:ye})),de.forEach((X,ie)=>{let he=X.title;we.push(o("div",{key:`inst-${X.id}`,style:fe,...xe,onClick:()=>{k(X.id),D(null)},role:"menuitem"},he))})),we.push(o("div",{key:"sep-2",style:ye})),we.push(o("div",{key:"about",style:fe,...xe,onClick:()=>{L(S),D(null)},role:"menuitem"},"About")),o("div",{className:"unity-desktop__context-menu-backdrop",style:{position:"absolute",inset:"0",zIndex:"9000"},onClick:O},o("div",{className:"unity-desktop__context-menu",style:{position:"absolute",top:`${z.y}px`,left:`${z.x}px`,backgroundColor:"#2d2d2d",border:"1px solid #555",borderRadius:"6px",padding:"4px 0",minWidth:"160px",boxShadow:"0 4px 12px rgba(0,0,0,0.4)",zIndex:"9001",color:"#ffffff",fontSize:"13px"},onClick:X=>X.stopPropagation()},...we))})(),ge=$?t.find(ne=>ne.id===$):null,me=ge?o("div",{className:"unity-desktop__about-backdrop",style:{position:"absolute",inset:"0",zIndex:"9500",backgroundColor:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>L(null)},o("div",{style:{backgroundColor:"#2d2d2d",border:"1px solid #555",borderRadius:"8px",padding:"24px",minWidth:"280px",color:"#ffffff",textAlign:"center"},onClick:ne=>ne.stopPropagation()},o("div",{style:{fontSize:"18px",fontWeight:"600",marginBottom:"8px"}},ge.label),o("div",{style:{fontSize:"13px",marginBottom:"4px",color:"#aaa"}},"SpecifyJS Demo App"),o("div",{style:{fontSize:"13px",marginBottom:"4px",color:"#aaa"}},"MIT License"),o("div",{style:{fontSize:"13px",color:"#aaa"}},"v0.2.47"),o("button",{style:{marginTop:"16px",padding:"6px 16px",border:"1px solid #555",borderRadius:"4px",backgroundColor:"#444",color:"#fff",cursor:"pointer"},onClick:()=>L(null)},"Close"))):null;return o("div",{className:"unity-desktop",style:J,"data-theme":s},o("div",{className:"unity-desktop__top-panel",style:{flexShrink:"0",zIndex:"10"}},H),o("div",{style:V},o("div",{className:"unity-desktop__dock",style:j},Z),o("main",{className:"unity-desktop__desktop",style:{flex:"1",position:"relative",overflow:"hidden",minHeight:"0"}},le,ce)),re,me,ue)}function Vi(e){let{apps:t,user:n,onAppOpen:r,onLogout:i,theme:s="dark",children:a}=e;return o(zn,{onWindowOpen:r},o($t,null,o(Dt,null,o(ud,{apps:t,user:n,onAppOpen:r,onLogout:i,theme:s,children:a}))))}function Ui(e){let{id:t,title:n,icon:r,defaultPosition:i,defaultSize:s,minSize:a,resizable:l=!0,onClose:d,menuBar:u,onActivate:h,onDeactivate:m,children:c}=e,p=Pt(),f=q(()=>p.windows.find($=>$.id===t),[p.windows,t]);ae(()=>(u?p.setMenuBar(t,u):p.clearMenuBar(t),()=>{p.clearMenuBar(t)}),[u,t,p]);let y=oe(!1),x=f?f.focused:!1;ae(()=>{let $=y.current;y.current=x,x&&!$?h&&h():!x&&$&&m&&m()},[x,h,m]);let g=v(()=>{p.closeWindow(t),d&&d()},[p,t,d]),b=v(()=>{p.focusWindow(t)},[p,t]),S=v($=>{p.moveWindow(t,$)},[p,t]),D=v($=>{p.resizeWindow(t,$)},[p,t]),z=v(()=>{p.minimizeWindow(t)},[p,t]),M=v(()=>{f&&f.windowState==="maximized"?p.restoreWindow(t):p.maximizeWindow(t)},[p,t,f]);return f?o(nt,{appId:t},o(At,{id:t,title:n,icon:r,defaultPosition:f.position,defaultSize:f.size,minSize:a,resizable:l,windowState:f.windowState,focused:f.focused,zIndex:f.zIndex,onClose:g,onFocus:b,onMove:S,onResize:D,onMinimize:z,onMaximize:M,children:c})):(p.openWindow({id:t,title:n,icon:r,position:i,size:s}),null)}var ji={sm:{padding:"3px 10px",fontSize:"12px",borderRadius:"4px"},md:{padding:"6px 14px",fontSize:"13px",borderRadius:"6px"},lg:{padding:"8px 20px",fontSize:"15px",borderRadius:"6px"}},Gi={primary:{bg:"#3b82f6",color:"white",border:"#3b82f6"},secondary:{bg:"#f8fafc",color:"#0f172a",border:"#d1d5db"},outline:{bg:"transparent",color:"#0f172a",border:"#d1d5db"},ghost:{bg:"transparent",color:"#0f172a",border:"transparent"},danger:{bg:"#ef4444",color:"white",border:"#ef4444"}};function Xi(e){let{children:t,onClick:n,variant:r="secondary",size:i="md",disabled:s=!1,fullWidth:a=!1,type:l="button",className:d,style:u,ariaLabel:h,active:m=!1}=e,c=q(()=>{let p=ji[i]??ji.md,f=Gi[r]??Gi.secondary,y={padding:p.padding,fontSize:p.fontSize,borderRadius:p.borderRadius,border:`1px solid ${f.border}`,backgroundColor:m?"#3b82f6":f.bg,color:m?"white":f.color,cursor:s?"default":"pointer",fontFamily:"inherit",lineHeight:"1.4",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:"4px",transition:"background-color 0.15s, opacity 0.15s",opacity:s?"0.5":"1"};return a&&(y.width="100%"),u&&Object.assign(y,u),y},[r,i,s,a,m,u]);return o("button",{type:l,onClick:s?void 0:n,disabled:s,className:d,style:c,"aria-label":h,"aria-pressed":m?"true":void 0},t)}var pd=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],Ct=Math.PI/180;function fd(e,t,n,r,i,s,a,l,d,u){let h=Math.cos(r*Ct),m=Math.sin(r*Ct),c=Math.cos(i*Ct),p=Math.sin(i*Ct),f=Math.cos(s*Ct),y=Math.sin(s*Ct),x=e*f-t*y,g=e*y+t*f,b=x*c-g*p,S=x*p+g*c,D=n,z=b,M=S*h-D*m,$=S*m+D*h,L=1+a*.001*$,R=l+z*u*L,P=d-M*u*L;return{sx:R,sy:P,depth:$}}function qi(e,t){let n=e.replace("#",""),r,i,s;return n.length===3?(r=parseInt(n[0]+n[0],16),i=parseInt(n[1]+n[1],16),s=parseInt(n[2]+n[2],16)):(r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16)),r=isNaN(r)?0:r,i=isNaN(i)?0:i,s=isNaN(s)?0:s,`rgba(${r},${i},${s},${t})`}function Ki(e,t){let n=e.replace("#",""),r,i,s;n.length===3?(r=parseInt(n[0]+n[0],16),i=parseInt(n[1]+n[1],16),s=parseInt(n[2]+n[2],16)):(r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16)),r=isNaN(r)?0:r,i=isNaN(i)?0:i,s=isNaN(s)?0:s;let a=d=>Math.max(0,Math.min(255,Math.round(d*t))),l=d=>a(d).toString(16).padStart(2,"0");return"#"+l(r)+l(i)+l(s)}function Zi(e){let{layers:t,width:n=700,height:r=500,perspective:i=.5,rotateX:s=35,rotateY:a=45,rotateZ:l=0,showLabels:d=!0,showAxes:u=!0,layerSpacing:h=2,colorScale:m=pd,gridColor:c="#94a3b8",title:p}=e,f=q(()=>{let A=0,k=0,w=0;for(let E=0;E<t.length;E++){let C=t[E],N=C.data.length;N>A&&(A=N);for(let T=0;T<N;T++){let W=C.data[T].length;W>k&&(k=W);for(let _=0;_<W;_++){let O=Math.abs(C.data[T][_]??0);O>w&&(w=O)}}}return{maxRows:Math.max(A,1),maxCols:Math.max(k,1),maxHeight:w>0?w:1}},[t]),y=q(()=>{let A=f.maxHeight+(t.length-1)*h+f.maxHeight,k=Math.sqrt(f.maxCols*f.maxCols+f.maxRows*f.maxRows+A*A),w=Math.min(n,r)*.75;return k>0?w/k:1},[f,t.length,h,n,r]),x=n/2,g=r/2,b=v((A,k,w)=>fd(A,k,w,s,a,l,i,x,g,y),[s,a,l,i,x,g,y]),S=v(()=>{if(!u)return[];let A=[],k=Math.max(f.maxCols,f.maxRows),w=f.maxCols/2,E=f.maxRows/2,C=b(-w,-E,0),N=b(w,-E,0);A.push(o("line",{key:"axis-x",x1:String(C.sx),y1:String(C.sy),x2:String(N.sx),y2:String(N.sy),stroke:"#374151","stroke-width":"1.5"})),A.push(o("text",{key:"axis-x-label",x:String(N.sx+8),y:String(N.sy+4),"font-size":"11","font-family":"sans-serif",fill:"#374151"},"X"));let T=b(-w,E,0);A.push(o("line",{key:"axis-y",x1:String(C.sx),y1:String(C.sy),x2:String(T.sx),y2:String(T.sy),stroke:"#374151","stroke-width":"1.5"})),A.push(o("text",{key:"axis-y-label",x:String(T.sx-12),y:String(T.sy+4),"font-size":"11","font-family":"sans-serif",fill:"#374151"},"Y"));let W=f.maxHeight+(t.length-1)*h,_=b(-w,-E,W);return A.push(o("line",{key:"axis-z",x1:String(C.sx),y1:String(C.sy),x2:String(_.sx),y2:String(_.sy),stroke:"#374151","stroke-width":"1.5"})),A.push(o("text",{key:"axis-z-label",x:String(_.sx-4),y:String(_.sy-8),"font-size":"11","font-family":"sans-serif",fill:"#374151"},"Z")),A},[u,f,t.length,h,b]),D=v(()=>{let A=[],k=f.maxCols/2,w=f.maxRows/2,E=[];for(let C=0;C<t.length;C++){let N=t[C],T=N.color??m[C%m.length],W=N.opacity??.7,_=C*h,O=N.data.length;for(let U=0;U<O-1;U++){let K=N.data[U],te=N.data[U+1],J=Math.min(K.length,te.length);for(let V=0;V<J-1;V++){let j=V-k,Y=V+1-k,H=U-w,Z=U+1-w,ee=(K[V]??0)+_,se=(K[V+1]??0)+_,Q=(te[V]??0)+_,le=(te[V+1]??0)+_,ce=b(j,H,ee),ue=b(Y,H,se),re=b(j,Z,Q),ge=b(Y,Z,le),me=(ce.depth+ue.depth+re.depth+ge.depth)/4,ne=`${ce.sx},${ce.sy} ${ue.sx},${ue.sy} ${ge.sx},${ge.sy} ${re.sx},${re.sy}`;E.push({points:ne,fill:qi(T,W),stroke:Ki(T,.7),strokeWidth:"0.5",depth:me,key:`quad-${C}-${U}-${V}`})}}if(O===1||O>0&&N.data[0].length===1)for(let U=0;U<O;U++){let K=N.data[U];for(let te=0;te<K.length;te++){let J=te-k,V=U-w,j=(K[te]??0)+_,Y=b(J,V,j),H=3,Z=`${Y.sx},${Y.sy-H} ${Y.sx+H},${Y.sy} ${Y.sx},${Y.sy+H} ${Y.sx-H},${Y.sy}`;E.push({points:Z,fill:qi(T,W),stroke:Ki(T,.7),strokeWidth:"0.5",depth:Y.depth,key:`point-${C}-${U}-${te}`})}}}E.sort((C,N)=>C.depth-N.depth);for(let C=0;C<E.length;C++){let N=E[C];A.push(o("polygon",{key:N.key,points:N.points,fill:N.fill,stroke:N.stroke,"stroke-width":N.strokeWidth,"stroke-linejoin":"round"}))}return A},[t,f,h,m,b]),z=v(()=>{let A=[],k=f.maxCols/2,w=f.maxRows/2;for(let E=0;E<=f.maxRows;E++){let C=E-w,N=b(-k,C,0),T=b(k,C,0);A.push(o("line",{key:`base-h-${E}`,x1:String(N.sx),y1:String(N.sy),x2:String(T.sx),y2:String(T.sy),stroke:c,"stroke-width":"0.3","stroke-dasharray":"2 2",opacity:"0.5"}))}for(let E=0;E<=f.maxCols;E++){let C=E-k,N=b(C,-w,0),T=b(C,w,0);A.push(o("line",{key:`base-v-${E}`,x1:String(N.sx),y1:String(N.sy),x2:String(T.sx),y2:String(T.sy),stroke:c,"stroke-width":"0.3","stroke-dasharray":"2 2",opacity:"0.5"}))}return A},[f,c,b]),M=v(()=>{if(!d)return[];let A=[],k=f.maxCols/2,w=f.maxRows/2;for(let E=0;E<t.length;E++){let C=t[E],N=E*h,T=0,W=0;for(let K=0;K<C.data.length;K++){let te=C.data[K];for(let J=0;J<te.length;J++)T+=te[J]??0,W++}let _=W>0?T/W:0,O=b(k+1,0,_+N),U=C.color??m[E%m.length];A.push(o("text",{key:`layer-label-${E}`,x:String(O.sx+8),y:String(O.sy+4),"font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:U},C.label))}return A},[d,t,f,h,m,b]),L=v(()=>p?[o("text",{key:"title",x:String(n/2),y:String(24),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,n])(),R=z(),P=S(),B=D(),I=M(),F=t.length===0?[o("text",{key:"empty-msg",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No layer data")]:[];return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"3D layer visualization",style:{fontFamily:"sans-serif",maxWidth:"100%"}},...L,...F,...R,...P,...B,...I)}function gd(e){if(typeof e=="string")return e;if(!isFinite(e)||isNaN(e))return"--";let t=e.toString().split("."),n=t[0],r=t.length>1?"."+t[1]:"",i=n.startsWith("-"),s=i?n.slice(1):n,a="";for(let l=0;l<s.length;l++)l>0&&(s.length-l)%3===0&&(a+=","),a+=s[l];return(i?"-":"")+a+r}function md(e){if(!isFinite(e)||isNaN(e))return"--";let t=Math.abs(e);return t<100&&t!==Math.floor(t)?t.toFixed(1):String(Math.round(t))}function Ji(e){let{value:t,label:n,prefix:r="",suffix:i="",trend:s,trendLabel:a,sparkline:l,width:d=280,height:u=160,valueColor:h="currentColor",trendUpColor:m="#22c55e",trendDownColor:c="#ef4444",backgroundColor:p="#ffffff"}=e,f=q(()=>gd(t),[t]),y=s!=null&&isFinite(s)&&!isNaN(s),x=l!=null&&l.length>1,g=n!=null&&n.length>0,b=y&&s>=0?m:c,S=20,D=g?u*.38:u*.45,z=Math.min(d*.15,48),M=z*.55,$=D+z*.4+8,L=g?$+22:D+z*.4+22,R=x?Math.min(u*.22,36):0,P=u-S-R,B=d-S*2,I=v(()=>[o("rect",{key:"bg",x:"0",y:"0",width:"100%",rx:"8",ry:"8",fill:p,stroke:"#e5e7eb","stroke-width":"1"})],[d,u,p]),F=v(()=>{let O=[],U=r+f+i;return O.push(o("text",{key:"value",x:String(d/2),y:String(D),"text-anchor":"middle","dominant-baseline":"central","font-size":String(z),"font-weight":"bold","font-family":"sans-serif",fill:h,"aria-label":`Value: ${U}`},r?o("tspan",{key:"prefix","font-size":String(M),"font-weight":"normal"},r):null,f,i?o("tspan",{key:"suffix","font-size":String(M),"font-weight":"normal"},i):null)),O},[d,D,z,M,f,r,i,h]),A=v(()=>g?[o("text",{key:"label",x:String(d/2),y:String($),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},n)]:[],[g,d,$,n]),k=v(()=>{if(!y)return[];let O=[],U=s,K=U>=0,te=8,J=md(U),V=(K?"+":"-")+J+(a?" "+a:""),j=d/2-40,Y=L;if(K){let H=`${j},${Y} ${j-te/2},${Y+te} ${j+te/2},${Y+te}`;O.push(o("polygon",{key:"trend-arrow",points:H,fill:b}))}else{let H=`${j},${Y+te} ${j-te/2},${Y} ${j+te/2},${Y}`;O.push(o("polygon",{key:"trend-arrow",points:H,fill:b}))}return O.push(o("text",{key:"trend-text",x:String(j+te+4),y:String(Y+te*.7),"text-anchor":"start","font-size":"12","font-family":"sans-serif",fill:b,"aria-label":`Trend: ${V}`},V)),O},[y,s,a,b,d,L]),w=v(()=>{if(!x)return[];let O=[],U=l,K=[];for(let ee of U)typeof ee=="number"&&isFinite(ee)&&!isNaN(ee)&&K.push(ee);if(K.length<2)return[];let te=1/0,J=-1/0;for(let ee of K)ee<te&&(te=ee),ee>J&&(J=ee);te===J&&(te-=1,J+=1);let V=J-te,j=B/(K.length-1),Y="";for(let ee=0;ee<K.length;ee++){let se=S+ee*j,Q=P+R-(K[ee]-te)/V*R;ee===0?Y+=`M ${se} ${Q}`:Y+=` L ${se} ${Q}`}let H=S+(K.length-1)*j,Z=Y+` L ${H} ${P+R} L ${S} ${P+R} Z`;return O.push(o("defs",{key:"spark-defs"},o("linearGradient",{key:"spark-grad",id:"sparkGrad",x1:"0",y1:"0",x2:"0",y2:"1"},o("stop",{key:"stop1",offset:"0%","stop-color":"#3b82f6","stop-opacity":"0.3"}),o("stop",{key:"stop2",offset:"100%","stop-color":"#3b82f6","stop-opacity":"0.05"})))),O.push(o("path",{key:"spark-fill",d:Z,fill:"url(#sparkGrad)"})),O.push(o("path",{key:"spark-line",d:Y,fill:"none",stroke:"#3b82f6","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})),O},[x,l,B,P,R,S]),E=I(),C=F(),N=A(),T=k(),W=w(),_=`${r}${f}${i}${g?`, ${n}`:""}`;return o("svg",{width:"100%",viewBox:`0 0 ${d} ${u}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":_,style:{fontFamily:"sans-serif"}},...E,...W,...C,...N,...T)}var nn=Math.PI/180;function hd(e,t,n,r,i,s,a,l){let d=Math.cos(r*nn),u=Math.sin(r*nn),h=Math.cos(i*nn),m=Math.sin(i*nn),c=e*h+n*m,p=-e*m+n*h,f=t*d-p*u,y=t*u+p*d;return{sx:s+c*l,sy:a-f*l,depth:y}}function Mt(e){return{x:Math.sin(e.theta)*Math.cos(e.phi),y:Math.sin(e.theta)*Math.sin(e.phi),z:Math.cos(e.theta)}}function on(e,t,n){let r=Math.sqrt(e*e+t*t+n*n);if(r<1e-10)return{theta:0,phi:0};let i=e/r,s=t/r,a=n/r,l=Math.acos(Math.max(-1,Math.min(1,a))),d=Math.atan2(s,i);return{theta:l,phi:d<0?d+2*Math.PI:d}}function it(e,t,n){let{x:r,y:i,z:s}=Mt(e),a=Math.cos(n),l=Math.sin(n),d,u,h;return t==="x"?(d=r,u=i*a-s*l,h=i*l+s*a):t==="y"?(d=r*a+s*l,u=i,h=-r*l+s*a):(d=r*a-i*l,u=r*l+i*a,h=s),on(d,u,h)}function Gn(e,t){let n=t.angle??Math.PI;switch(t.gate){case"X":return it(e,"x",Math.PI);case"Y":return it(e,"y",Math.PI);case"Z":return it(e,"z",Math.PI);case"H":{let{x:r,y:i,z:s}=Mt(e);return on(s,-i,r)}case"S":return it(e,"z",Math.PI/2);case"T":return it(e,"z",Math.PI/4);case"Rx":return it(e,"x",n);case"Ry":return it(e,"y",n);case"Rz":return it(e,"z",n)}}function Qi(e){let{state:t,gates:n,width:r=400,height:i=400,rotateY:s=-25,rotateX:a=15,zoom:l=1,interactive:d=!0,zoomable:u=!0,showVector:h=!0,showLabels:m=!0,showWireframe:c=!0,showTrail:p=!0,trailMaxPoints:f=200,trailColor:y="#ef4444",wireframeColor:x="#cbd5e1",vectorColor:g="#3b82f6",backgroundColor:b,sphereRadius:S=130,title:D,onStateChange:z}=e,[M,$]=G(t??{theta:0,phi:0}),[L,R]=G(s),[P,B]=G(a),[I,F]=G(l),A=oe([]),k=oe(!1),w=oe(null),E=oe(null);ae(()=>{t&&$(t)},[t?.theta,t?.phi]);let C=oe(0);ae(()=>{if(!n||n.length===0)return;C.current=0;let j=0,Y=()=>{C.current>=n.length||($(H=>{let Z=Gn(H,n[C.current]);return C.current++,z&&z(Z),Z}),j=requestAnimationFrame(Y))};return j=requestAnimationFrame(Y),()=>cancelAnimationFrame(j)},[n]),ae(()=>{let j=Mt(M);A.current.push(j),A.current.length>f&&A.current.splice(0,A.current.length-f)},[M.theta,M.phi]);let N=S*I,T=r/2,W=i/2,_=v((j,Y,H)=>hd(j,Y,H,P,L,T,W,N),[P,L,T,W,N]),O=v(j=>{if(!d)return;let Y=j;k.current=!0,w.current={mx:Y.clientX,my:Y.clientY,rx:P,ry:L}},[d,P,L]),U=v(j=>{if(!k.current||!w.current)return;let Y=j,H=w.current;R(H.ry+(Y.clientX-H.mx)*.5),B(H.rx-(Y.clientY-H.my)*.5)},[]),K=v(()=>{k.current=!1},[]),te=v(j=>{if(!u)return;let Y=j;Y.preventDefault(),F(H=>Math.max(.5,Math.min(3,H*(Y.deltaY>0?.95:1.05))))},[u]),J=[];if(b&&J.push(o("rect",{key:"bg",x:"0",y:"0",width:String(r),height:String(i),fill:b,rx:"6"})),D&&J.push(o("text",{key:"title",x:String(T),y:"24","text-anchor":"middle","font-size":"14","font-weight":"bold","font-family":"sans-serif",fill:"#374151"},D)),c){let Y=[];for(let ee=0;ee<=60;ee++){let se=ee/60*2*Math.PI,Q=_(Math.cos(se),Math.sin(se),0);Y.push(`${ee===0?"M":"L"}${Q.sx.toFixed(1)},${Q.sy.toFixed(1)}`)}J.push(o("path",{key:"eq",d:Y.join(" "),fill:"none",stroke:x,"stroke-width":"0.8",opacity:"0.5"}));let H=[];for(let ee=0;ee<=60;ee++){let se=ee/60*2*Math.PI,Q=_(Math.cos(se),0,Math.sin(se));H.push(`${ee===0?"M":"L"}${Q.sx.toFixed(1)},${Q.sy.toFixed(1)}`)}J.push(o("path",{key:"xz",d:H.join(" "),fill:"none",stroke:x,"stroke-width":"0.8",opacity:"0.4"}));let Z=[];for(let ee=0;ee<=60;ee++){let se=ee/60*2*Math.PI,Q=_(0,Math.cos(se),Math.sin(se));Z.push(`${ee===0?"M":"L"}${Q.sx.toFixed(1)},${Q.sy.toFixed(1)}`)}J.push(o("path",{key:"yz",d:Z.join(" "),fill:"none",stroke:x,"stroke-width":"0.8",opacity:"0.4"}))}let V=[{id:"x",dir:[1,0,0],color:"#ef4444"},{id:"y",dir:[0,1,0],color:"#22c55e"},{id:"z",dir:[0,0,1],color:"#3b82f6"}];for(let j of V){let Y=_(j.dir[0]*1.15,j.dir[1]*1.15,j.dir[2]*1.15),H=_(-j.dir[0]*1.15,-j.dir[1]*1.15,-j.dir[2]*1.15),Z=_(0,0,0);J.push(o("line",{key:`axis-${j.id}`,x1:String(H.sx),y1:String(H.sy),x2:String(Y.sx),y2:String(Y.sy),stroke:j.color,"stroke-width":"0.8",opacity:"0.4","stroke-dasharray":"3 3"}))}if(m){let j=[{text:"|0\u27E9",pos:[0,0,1.3]},{text:"|1\u27E9",pos:[0,0,-1.3]},{text:"|+\u27E9",pos:[1.3,0,0]},{text:"|-\u27E9",pos:[-1.3,0,0]},{text:"|+i\u27E9",pos:[0,1.3,0]},{text:"|-i\u27E9",pos:[0,-1.3,0]}];for(let Y of j){let H=_(Y.pos[0],Y.pos[1],Y.pos[2]);J.push(o("text",{key:`lbl-${Y.text}`,x:String(H.sx),y:String(H.sy),"text-anchor":"middle","dominant-baseline":"central","font-size":"11","font-family":"serif",fill:"#475569",style:{pointerEvents:"none"}},Y.text))}}if(p&&A.current.length>1){let j=A.current,Y=[];for(let H=0;H<j.length;H++){let Z=j[H],ee=_(Z.x,Z.y,Z.z);Y.push(`${H===0?"M":"L"}${ee.sx.toFixed(1)},${ee.sy.toFixed(1)}`)}J.push(o("path",{key:"trail",d:Y.join(" "),fill:"none",stroke:y,"stroke-width":"1.5",opacity:"0.5","stroke-linecap":"round","stroke-linejoin":"round"}))}if(h){let j=Mt(M),Y=_(0,0,0),H=_(j.x,j.y,j.z);J.push(o("line",{key:"vec-line",x1:String(Y.sx),y1:String(Y.sy),x2:String(H.sx),y2:String(H.sy),stroke:g,"stroke-width":"2.5","stroke-linecap":"round"})),J.push(o("circle",{key:"vec-point",cx:String(H.sx),cy:String(H.sy),r:"5",fill:g,stroke:"#fff","stroke-width":"1.5"}));let Z=(M.theta*180/Math.PI).toFixed(0),ee=(M.phi*180/Math.PI).toFixed(0);J.push(o("text",{key:"state-label",x:String(r-10),y:String(i-10),"text-anchor":"end","font-size":"10","font-family":"monospace",fill:"#64748b"},`\u03B8=${Z}\xB0 \u03C6=${ee}\xB0`))}return o("svg",{ref:E,width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":D??"Bloch sphere quantum state visualization",style:{fontFamily:"sans-serif",cursor:d?k.current?"grabbing":"grab":"default"},onMouseDown:d?O:void 0,onMouseMove:d?U:void 0,onMouseUp:d?K:void 0,onMouseLeave:d?K:void 0,onWheel:u?te:void 0},...J)}function bd(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];typeof r=="number"&&isFinite(r)&&!isNaN(r)&&t.push(r)}return t.sort((n,r)=>n-r),t}function Xn(e,t){if(e.length===0)return 0;if(e.length===1)return e[0];let n=t/100*(e.length-1),r=Math.floor(n),i=Math.ceil(n);if(r===i)return e[r];let s=n-r;return e[r]+s*(e[i]-e[r])}function qn(e){let t=bd(e);if(t.length===0)return null;let n=Xn(t,25),r=Xn(t,50),i=Xn(t,75),s=i-n,a=n-1.5*s,l=i+1.5*s,d=t[0];for(let p of t)if(p>=a){d=p;break}let u=t[t.length-1];for(let p=t.length-1;p>=0;p--)if(t[p]<=l){u=t[p];break}let h=0;for(let p of t)h+=p;let m=h/t.length,c=[];for(let p of t)(p<a||p>l)&&c.push(p);return{q1:n,median:r,q3:i,iqr:s,whiskerLow:d,whiskerHigh:u,mean:m,outliers:c,min:t[0],max:t[t.length-1]}}function xd(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function es(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",showOutliers:s=!0,showMean:a=!1,whiskerColor:l="#374151",boxWidth:d=.6,showGrid:u=!0,title:h,padding:m=60}=e,c=i==="vertical",p=n-m*2,f=r-m*2,y=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],x=q(()=>{let w=[];for(let E of t)w.push(qn(E.values));return w},[t]),g=q(()=>{let w=1/0,E=-1/0;for(let T of x){if(T===null)continue;let W=s&&T.outliers.length>0?Math.min(T.whiskerLow,T.outliers[0]):T.whiskerLow,_=s&&T.outliers.length>0?Math.max(T.whiskerHigh,T.outliers[T.outliers.length-1]):T.whiskerHigh;W<w&&(w=W),_>E&&(E=_)}isFinite(w)||(w=0,E=1);let C=E-w,N=C>0?C*.05:.5;return{min:w-N,max:E+N}},[x,s]),b=c?f:p,S=c?p:f,D=t.length>0?t.length:1,z=S/D,M=z*Math.min(Math.max(d,.1),.95),$=v(w=>{let E=g.max-g.min;return E===0?b/2:(w-g.min)/E*b},[g,b]),L=v(()=>{if(!u)return[];let w=[],E=g.max-g.min,C=xd(E),N=Math.ceil(g.min/C)*C;for(let T=N;T<=g.max;T+=C){let W=$(T),_=String(Math.round(T*1e3)/1e3);if(c){let O=m+f-W;w.push(o("line",{key:`grid-${T}`,x1:String(m),y1:String(O),x2:String(m+p),y2:String(O),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`glabel-${T}`,x:String(m-6),y:String(O+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},_))}else{let O=m+W;w.push(o("line",{key:`grid-${T}`,x1:String(O),y1:String(m),x2:String(O),y2:String(m+f),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`glabel-${T}`,x:String(O),y:String(m+f+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},_))}}return w},[u,g,$,c,m,p,f]),R=v(()=>{let w=[];return w.push(o("line",{key:"axis-value",x1:String(m),y1:String(c?m:m+f),x2:String(m),y2:String(m+f),stroke:"#374151","stroke-width":"1.5"})),w.push(o("line",{key:"axis-category",x1:String(m),y1:String(m+f),x2:String(m+p),y2:String(m+f),stroke:"#374151","stroke-width":"1.5"})),w},[m,p,f,c]),P=v(()=>{let w=[];for(let E=0;E<t.length;E++){let C=x[E];if(C===null)continue;let N=t[E],T=N.color??y[E%y.length],W=z*E+z/2,_=M/2;if(c){let O=m+f-$(C.q1),U=m+f-$(C.q3),K=m+f-$(C.median),te=m+f-$(C.whiskerLow),J=m+f-$(C.whiskerHigh),V=m+W;w.push(o("line",{key:`wl-${E}`,x1:String(V),y1:String(O),x2:String(V),y2:String(te),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wlc-${E}`,x1:String(V-_*.4),y1:String(te),x2:String(V+_*.4),y2:String(te),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wh-${E}`,x1:String(V),y1:String(U),x2:String(V),y2:String(J),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`whc-${E}`,x1:String(V-_*.4),y1:String(J),x2:String(V+_*.4),y2:String(J),stroke:l,"stroke-width":"1.5"}));let j=Math.min(O,U),Y=Math.abs(O-U);if(w.push(o("rect",{key:`box-${E}`,x:String(V-_),y:String(j),width:String(M),height:String(Math.max(Y,1)),fill:T,stroke:l,"stroke-width":"1.5",opacity:"0.8","aria-label":`${N.label}: Q1=${C.q1.toFixed(1)}, median=${C.median.toFixed(1)}, Q3=${C.q3.toFixed(1)}`,role:"img"})),w.push(o("line",{key:`med-${E}`,x1:String(V-_),y1:String(K),x2:String(V+_),y2:String(K),stroke:"#fff","stroke-width":"2.5"})),a){let H=m+f-$(C.mean);w.push(o("circle",{key:`mean-${E}`,cx:String(V),cy:String(H),r:"3.5",fill:"#fff",stroke:l,"stroke-width":"1.5","aria-label":`Mean: ${C.mean.toFixed(1)}`}))}if(s)for(let H=0;H<C.outliers.length;H++){let Z=m+f-$(C.outliers[H]);w.push(o("circle",{key:`out-${E}-${H}`,cx:String(V),cy:String(Z),r:"3",fill:"none",stroke:l,"stroke-width":"1.5","aria-label":`Outlier: ${C.outliers[H]}`}))}w.push(o("text",{key:`cat-${E}`,x:String(V),y:String(m+f+18),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"},N.label))}else{let O=m+$(C.q1),U=m+$(C.q3),K=m+$(C.median),te=m+$(C.whiskerLow),J=m+$(C.whiskerHigh),V=m+W;w.push(o("line",{key:`wl-${E}`,x1:String(O),y1:String(V),x2:String(te),y2:String(V),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wlc-${E}`,x1:String(te),y1:String(V-_*.4),x2:String(te),y2:String(V+_*.4),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`wh-${E}`,x1:String(U),y1:String(V),x2:String(J),y2:String(V),stroke:l,"stroke-width":"1.5"})),w.push(o("line",{key:`whc-${E}`,x1:String(J),y1:String(V-_*.4),x2:String(J),y2:String(V+_*.4),stroke:l,"stroke-width":"1.5"}));let j=Math.min(O,U),Y=Math.abs(U-O);if(w.push(o("rect",{key:`box-${E}`,x:String(j),y:String(V-_),width:String(Math.max(Y,1)),height:String(M),fill:T,stroke:l,"stroke-width":"1.5",opacity:"0.8","aria-label":`${N.label}: Q1=${C.q1.toFixed(1)}, median=${C.median.toFixed(1)}, Q3=${C.q3.toFixed(1)}`,role:"img"})),w.push(o("line",{key:`med-${E}`,x1:String(K),y1:String(V-_),x2:String(K),y2:String(V+_),stroke:"#fff","stroke-width":"2.5"})),a){let H=m+$(C.mean);w.push(o("circle",{key:`mean-${E}`,cx:String(H),cy:String(V),r:"3.5",fill:"#fff",stroke:l,"stroke-width":"1.5","aria-label":`Mean: ${C.mean.toFixed(1)}`}))}if(s)for(let H=0;H<C.outliers.length;H++){let Z=m+$(C.outliers[H]);w.push(o("circle",{key:`out-${E}-${H}`,cx:String(Z),cy:String(V),r:"3",fill:"none",stroke:l,"stroke-width":"1.5","aria-label":`Outlier: ${C.outliers[H]}`}))}w.push(o("text",{key:`cat-${E}`,x:String(m-6),y:String(V+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},N.label))}}return w},[t,x,$,c,m,p,f,z,M,l,s,a,y]),B=v(()=>h?[o("text",{key:"title",x:String(n/2),y:String(m/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h)]:[],[h,n,m]),I=L(),F=R(),A=P(),k=B();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Box plot",style:{fontFamily:"sans-serif"}},...k,...I,...F,...A)}function ts(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function yd(e,t,n){return e<t?t:e>n?n:e}function Kn(e){return typeof e=="number"&&isFinite(e)&&!isNaN(e)}function ns(e){let{data:t=[],width:n=600,height:r=400,xLabel:i,yLabel:s,showGrid:a=!0,showAxes:l=!0,showLabels:d=!1,maxBubbleRadius:u=40,minBubbleRadius:h=4,defaultColor:m="#3b82f6",opacity:c=.7,title:p,padding:f=60}=e,y=q(()=>{let A=[];for(let k=0;k<t.length;k++){let w=t[k];Kn(w.x)&&Kn(w.y)&&Kn(w.r)&&A.push(w)}return A},[t]),x=n-f*2,g=r-f*2,b=q(()=>{if(y.length===0)return{xMin:0,xMax:1,yMin:0,yMax:1,rMin:0,rMax:1};let A=1/0,k=-1/0,w=1/0,E=-1/0,C=1/0,N=-1/0;for(let T of y)T.x<A&&(A=T.x),T.x>k&&(k=T.x),T.y<w&&(w=T.y),T.y>E&&(E=T.y),T.r<C&&(C=T.r),T.r>N&&(N=T.r);return A===k&&(A-=1,k+=1),w===E&&(w-=1,E+=1),C===N&&(C=0,N=N>0?N:1),{xMin:A,xMax:k,yMin:w,yMax:E,rMin:C,rMax:N}},[y]),S=v(A=>{let k=b.xMax-b.xMin;return f+(A-b.xMin)/k*x},[b,f,x]),D=v(A=>{let k=b.yMax-b.yMin;return f+g-(A-b.yMin)/k*g},[b,f,g]),z=v(A=>{let k=b.rMax-b.rMin;if(k===0)return(h+u)/2;let w=(A-b.rMin)/k;return h+w*(u-h)},[b,h,u]),M=v(()=>{if(!a)return[];let A=[],k=ts(b.xMax-b.xMin),w=Math.ceil(b.xMin/k)*k;for(let N=w;N<=b.xMax;N+=k){let T=S(N);A.push(o("line",{key:`grid-x-${N}`,x1:String(T),y1:String(f),x2:String(T),y2:String(f+g),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),A.push(o("text",{key:`grid-xlabel-${N}`,x:String(T),y:String(f+g+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(Math.round(N*1e3)/1e3)))}let E=ts(b.yMax-b.yMin),C=Math.ceil(b.yMin/E)*E;for(let N=C;N<=b.yMax;N+=E){let T=D(N);A.push(o("line",{key:`grid-y-${N}`,x1:String(f),y1:String(T),x2:String(f+x),y2:String(T),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),A.push(o("text",{key:`grid-ylabel-${N}`,x:String(f-6),y:String(T+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(Math.round(N*1e3)/1e3)))}return A},[a,b,S,D,f,x,g]),$=v(()=>{if(!l)return[];let A=[];return A.push(o("line",{key:"axis-y",x1:String(f),y1:String(f),x2:String(f),y2:String(f+g),stroke:"#374151","stroke-width":"1.5"})),A.push(o("line",{key:"axis-x",x1:String(f),y1:String(f+g),x2:String(f+x),y2:String(f+g),stroke:"#374151","stroke-width":"1.5"})),i&&A.push(o("text",{key:"x-label",x:String(f+x/2),y:String(f+g+40),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"#374151"},i)),s&&A.push(o("text",{key:"y-label",x:String(f-40),y:String(f+g/2),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"#374151",transform:`rotate(-90, ${f-40}, ${f+g/2})`},s)),A},[l,f,x,g,i,s]),L=v(()=>{let A=[];for(let k=0;k<y.length;k++){let w=y[k],E=S(w.x),C=D(w.y),N=yd(z(w.r),h,u),T=w.color??m;A.push(o("circle",{key:`bubble-${k}`,cx:String(E),cy:String(C),r:String(N),fill:T,opacity:String(c),stroke:T,"stroke-width":"1","stroke-opacity":"0.8","aria-label":w.label??`Bubble at (${w.x}, ${w.y}) size ${w.r}`,role:"img"})),d&&w.label&&A.push(o("text",{key:`label-${k}`,x:String(E),y:String(C-N-4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},w.label))}return A},[y,S,D,z,m,c,d,h,u]),R=v(()=>p?[o("text",{key:"title",x:String(n/2),y:String(f/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},p)]:[],[p,n,f]),P=M(),B=$(),I=L(),F=R();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":p??"Bubble chart",style:{fontFamily:"sans-serif"}},...F,...P,...B,...I)}var Sd=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],vd=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function wd(e){let t=e.split("-");return t.length!==3?new Date(NaN):new Date(parseInt(t[0],10),parseInt(t[1],10)-1,parseInt(t[2],10))}function os(e){let t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${r}`}function rs(e){let t=e.replace("#",""),n=t.length===3?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,r=parseInt(n,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function kd(e,t,n){let r=i=>{let s=Math.max(0,Math.min(255,Math.round(i))).toString(16);return s.length===1?"0"+s:s};return`#${r(e)}${r(t)}${r(n)}`}function Cd(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=Math.min(Math.floor(n*r),r-1),s=n*r-i,a=rs(t[i]),l=rs(t[i+1]);return kd(a.r+(l.r-a.r)*s,a.g+(l.g-a.g)*s,a.b+(l.b-a.b)*s)}var Md=["#9be9a8","#40c463","#30a14e","#216e39"];function is(e){let{data:t=[],width:n=800,height:r=160,colorScale:i=Md,cellSize:s=12,cellGap:a=2,showMonthLabels:l=!0,showDayLabels:d=!0,emptyColor:u="#ebedf0",title:h}=e,{dateMap:m,startDate:c,endDate:p,maxVal:f}=q(()=>{let I=new Map,F=0,A=null,k=null;for(let C of t){let N=wd(C.date);if(isNaN(N.getTime()))continue;let T=os(N);I.set(T,(I.get(T)??0)+C.value);let W=I.get(T);W>F&&(F=W),(A===null||N<A)&&(A=N),(k===null||N>k)&&(k=N)}if(A===null||k===null){let C=new Date;A=new Date(C.getFullYear(),0,1),k=new Date(C.getFullYear(),11,31)}let w=new Date(A);w.setDate(w.getDate()-w.getDay());let E=new Date(k);return E.setDate(E.getDate()+(6-E.getDay())),{dateMap:I,startDate:w,endDate:E,maxVal:F>0?F:1}},[t]),y=d?30:0,x=l?16:0,g=h?28:0,b=y+10,S=g+x+4,D=v(()=>{let I=[],F=new Date(c),A=0;for(;F<=p;){let k=F.getDay();k===0&&F>c&&A++;let w=os(F),E=m.get(w),C=E!==void 0&&E>0?Cd(E/f,i):u,N=b+A*(s+a),T=S+k*(s+a);I.push(o("rect",{key:`day-${w}`,x:String(N),y:String(T),width:String(s),height:String(s),rx:"2",ry:"2",fill:C,"aria-label":`${w}: ${E??0}`})),F.setDate(F.getDate()+1)}return I},[c,p,m,f,i,u,s,a,b,S]),z=v(()=>{if(!l)return[];let I=[],F=new Date(c),A=0,k=-1;for(;F<=p;){let w=F.getDay();w===0&&F>c&&A++;let E=F.getMonth();if(E!==k&&w===0){k=E;let C=b+A*(s+a);I.push(o("text",{key:`month-${A}`,x:String(C),y:String(g+x-2),"font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},Sd[E]))}F.setDate(F.getDate()+1)}return I},[l,c,p,s,a,b,g,x]),M=v(()=>{if(!d)return[];let I=[],F=[1,3,5];for(let A of F){let k=S+A*(s+a)+s/2;I.push(o("text",{key:`day-label-${A}`,x:String(y),y:String(k),"text-anchor":"end","dominant-baseline":"central","font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},vd[A]))}return I},[d,s,a,S,y]),$=v(()=>h?[o("text",{key:"title",x:String(n/2),y:"18","text-anchor":"middle","font-size":"14","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},h)]:[],[h,n]);if(t.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Calendar heat map \u2014 no data"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"No data to display."));let L=$(),R=z(),P=M(),B=D();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Calendar heat map",style:{fontFamily:"sans-serif"}},...L,...R,...P,...B)}var Ed=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function Qe(e,t,n,r){let i=r-Math.PI/2;return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function Id(e,t,n,r,i,s){let a=Qe(e,t,n,i),l=Qe(e,t,n,s),d=Qe(e,t,r,i),u=Qe(e,t,r,s),m=s-i>Math.PI?1:0;return[`M ${a.x} ${a.y}`,`A ${n} ${n} 0 ${m} 1 ${l.x} ${l.y}`,`L ${u.x} ${u.y}`,`A ${r} ${r} 0 ${m} 0 ${d.x} ${d.y}`,"Z"].join(" ")}function Rd(e,t,n,r,i,s,a){let l=Qe(e,t,n,r),d=Qe(e,t,n,i),u=Qe(e,t,n,s),h=Qe(e,t,n,a),m=i-r,c=a-s,p=m>Math.PI?1:0,f=c>Math.PI?1:0;return[`M ${l.x} ${l.y}`,`A ${n} ${n} 0 ${p} 1 ${d.x} ${d.y}`,`Q ${e} ${t} ${u.x} ${u.y}`,`A ${n} ${n} 0 ${f} 1 ${h.x} ${h.y}`,`Q ${e} ${t} ${l.x} ${l.y}`,"Z"].join(" ")}function Pd(e,t,n,r){let i=e.length;if(i===0)return{groups:[],chords:[]};let s=[],a=0;for(let c=0;c<i;c++){let p=0;for(let f=0;f<i;f++){let y=e[c]?.[f]??0;p+=Math.max(0,y)}s.push(p),a+=p}if(a===0){let c=(2*Math.PI-i*r)/Math.max(i,1),p=[],f=0;for(let y=0;y<i;y++)p.push({index:y,label:t[y]??`Group ${y}`,color:n[y%n.length],startAngle:f,endAngle:f+c,value:0}),f+=c+r;return{groups:p,chords:[]}}let l=2*Math.PI-i*r,d=[],u=0;for(let c=0;c<i;c++){let p=s[c]/a*l;d.push({index:c,label:t[c]??`Group ${c}`,color:n[c%n.length],startAngle:u,endAngle:u+p,value:s[c]}),u+=p+r}let h=[];for(let c=0;c<i;c++)h.push(d[c].startAngle);let m=[];for(let c=0;c<i;c++)for(let p=c;p<i;p++){let f=Math.max(0,e[c]?.[p]??0),y=c===p?0:Math.max(0,e[p]?.[c]??0);if(f===0&&y===0)continue;let x=f+y,g=s[c]>0?f/a*l:0,b=h[c],S=b+g;h[c]=S;let D=s[p]>0?f/a*l:0,z=h[p],M=z+D;if(h[p]=M,c===p){f>0&&m.push({sourceIndex:c,targetIndex:p,sourceStartAngle:b,sourceEndAngle:S,targetStartAngle:z,targetEndAngle:M,value:f,color:d[c].color});continue}let $=s[p]>0?y/a*l:0,R=h[p]+$;h[p]=R;let P=s[c]>0?y/a*l:0,I=h[c]+P;h[c]=I,(f>0||y>0)&&m.push({sourceIndex:c,targetIndex:p,sourceStartAngle:b,sourceEndAngle:Math.max(S,b+.001),targetStartAngle:z,targetEndAngle:Math.max(M,z+.001),value:x,color:d[c].color})}return{groups:d,chords:m}}function ss(e){let{matrix:t,labels:n,width:r=600,height:i=600,colors:s=Ed,padAngle:a=.05,showLabels:l=!0,showValues:d=!1,ribbonOpacity:u=.5,innerRadiusRatio:h=.9,title:m}=e;if(!t||t.length===0||!n||n.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Empty chord diagram"},o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let c=r/2,p=i/2,f=Math.min(r,i)/2-40,y=f*Math.max(.5,Math.min(.99,h)),x=f+16,g=q(()=>Pd(t,n,s,a),[t,n,s,a]),b=v(()=>{let L=[];for(let R=0;R<g.groups.length;R++){let P=g.groups[R];if(P.endAngle-P.startAngle<.001)continue;let I=Id(c,p,f,y,P.startAngle,P.endAngle);if(L.push(o("path",{key:`arc-${R}`,d:I,fill:P.color,stroke:"#fff","stroke-width":"1",role:"img","aria-label":`${P.label}: ${P.value}`})),l){let F=(P.startAngle+P.endAngle)/2,A=Qe(c,p,x,F),E=((F-Math.PI/2)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)<Math.PI,C=E?"start":"end",N=F*180/Math.PI-90;E||(N+=180);let T=d?`${P.label} (${P.value})`:P.label;L.push(o("text",{key:`label-${R}`,x:String(A.x),y:String(A.y),"text-anchor":C,"font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(${N}, ${A.x}, ${A.y})`,"dominant-baseline":"central","pointer-events":"none"},T))}}return L},[g,c,p,f,y,x,l,d]),S=v(()=>{let L=[];for(let R=0;R<g.chords.length;R++){let P=g.chords[R],B=Rd(c,p,y,P.sourceStartAngle,P.sourceEndAngle,P.targetStartAngle,P.targetEndAngle);L.push(o("path",{key:`ribbon-${R}`,d:B,fill:P.color,"fill-opacity":String(u),stroke:P.color,"stroke-width":"0.5","stroke-opacity":"0.3"}))}return L},[g,c,p,y,u]),D=v(()=>m?[o("text",{key:"title",x:String(r/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,r]),z=S(),M=b(),$=D();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Chord diagram",style:{fontFamily:"sans-serif"}},...$,...z,...M)}var $d=["#3b82f6","#22c55e","#f59e0b","#8b5cf6","#ef4444","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function Td(e){let t=[],n=0,r=[];r.push([e,0,null]);let i=0;for(;r.length>0;){let[s,a,l]=r.shift(),d=n++;i=Math.max(i,a);let u=s.children??[],h=[];for(let m=0;m<u.length;m++)h.push(n+r.length+m);t.push({id:d,node:s,depth:a,parentId:l,childIndices:h});for(let m=0;m<u.length;m++)r.push([u[m],a+1,d])}return{flatNodes:t,maxDepth:i}}function Dd(e){let t=e.length,n=new Array(t).fill(0);for(let r=t-1;r>=0;r--){let i=e[r];if(i.childIndices.length===0)n[r]=1;else{let s=0;for(let a of i.childIndices)a<t&&(s+=n[a]);n[r]=Math.max(s,1)}}return n}function zd(e,t,n,r,i,s,a,l){let{flatNodes:d,maxDepth:u}=Td(e);if(d.length===0)return[];let h=Dd(d),m=t-s*2,c=n-s*2,p=a==="horizontal",f=u+1,y=p?f>1?(m-r)/u:0:f>1?(c-i)/u:0,x=new Array(d.length),g=h[0],b=p?c:m,S=g>0?b/g:b,D=new Array(d.length);D[0]=[0,g];let z=[0],M=0;for(;M<z.length;){let $=z[M];M++;let L=d[$],[R,P]=D[$],B=(R+P)/2,I=s+L.depth*y,F=s+(B-.5)*S,A=p?I:F,k=p?F:I,w=L.node.color??l[L.depth%l.length];x[$]={id:L.id,label:L.node.label,value:L.node.value!==void 0?String(L.node.value):"",color:w,depth:L.depth,x:A,y:k,parentId:L.parentId,childCount:L.childIndices.length,subtreeLeafCount:h[$]};let E=R;for(let C of L.childIndices)if(C<d.length){let N=h[C],T=E+N;D[C]=[E,T],E=T,z.push(C)}}return x}function as(e){let{data:t,width:n=800,height:r=500,orientation:i="horizontal",nodeWidth:s=120,nodeHeight:a=40,showValues:l=!0,showConnectors:d=!0,connectorColor:u="#94a3b8",colors:h=$d,title:m,padding:c=40}=e;if(!t)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Empty decomposition tree"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let p=i==="horizontal",f=q(()=>zd(t,n,r,s,a,c,i,h),[t,n,r,s,a,c,i,h]),y=q(()=>{let M=new Map;for(let $=0;$<f.length;$++){let L=f[$];M.set(L.id,L)}return M},[f]),x=v(()=>{if(!d)return[];let M=[];for(let $=0;$<f.length;$++){let L=f[$];if(L.parentId===null)continue;let R=y.get(L.parentId);if(!R)continue;let P,B,I,F;p?(P=R.x+s,B=R.y+a/2,I=L.x,F=L.y+a/2):(P=R.x+s/2,B=R.y+a,I=L.x+s/2,F=L.y);let A=(P+I)/2,k=(B+F)/2,w;p?w=`M ${P} ${B} C ${A} ${B}, ${A} ${F}, ${I} ${F}`:w=`M ${P} ${B} C ${P} ${k}, ${I} ${k}, ${I} ${F}`,M.push(o("path",{key:`conn-${$}`,d:w,fill:"none",stroke:u,"stroke-width":"1.5","stroke-opacity":"0.7"}))}return M},[f,y,p,s,a,d,u]),g=v(()=>{let M=[];for(let $=0;$<f.length;$++){let L=f[$];M.push(o("rect",{key:`node-rect-${L.id}`,x:String(L.x),y:String(L.y),width:String(s),height:String(a),rx:"4",ry:"4",fill:L.color,stroke:"#374151","stroke-width":"1",role:"img","aria-label":L.value?`${L.label}: ${L.value}`:L.label}));let R=l&&L.value?L.y+a/2-2:L.y+a/2+4;M.push(o("text",{key:`node-label-${L.id}`,x:String(L.x+s/2),y:String(R),"text-anchor":"middle","font-size":"11","font-weight":"bold","font-family":"sans-serif",fill:"#fff","pointer-events":"none"},L.label)),l&&L.value&&M.push(o("text",{key:`node-value-${L.id}`,x:String(L.x+s/2),y:String(L.y+a/2+12),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"rgba(255,255,255,0.85)","pointer-events":"none"},L.value))}return M},[f,s,a,l]),b=v(()=>m?[o("text",{key:"title",x:String(n/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,n]),S=x(),D=g(),z=b();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Decomposition tree",style:{fontFamily:"sans-serif"}},...z,...S,...D)}var ls=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function Ad(e){return ls[e%ls.length]}function cs(e,t,n){let r=t/2,i=n/2,s=Math.min(t,n)*.3,a=e.length,l=[];for(let d=0;d<a;d++){let u=e[d],h=2*Math.PI*d/Math.max(a,1);l.push({id:u.id,label:u.label??u.id,color:u.color??Ad(d),x:u.x??r+s*Math.cos(h),y:u.y??i+s*Math.sin(h),vx:0,vy:0,fixed:u.fixed??!1,solid:u.solid??!0})}return l}function ds(e,t){let n=t*2;for(let r=0;r<e.length;r++){let i=e[r];if(i.solid)for(let s=r+1;s<e.length;s++){let a=e[s];if(!a.solid)continue;let l=a.x-i.x,d=a.y-i.y,u=l*l+d*d;if(u>=n*n||u<1e-4)continue;let h=Math.sqrt(u),m=l/h,c=d/h,p=n-h;if(i.fixed&&a.fixed)continue;i.fixed?(a.x+=m*p,a.y+=c*p):a.fixed?(i.x-=m*p,i.y-=c*p):(i.x-=m*p*.5,i.y-=c*p*.5,a.x+=m*p*.5,a.y+=c*p*.5);let f=i.vx-a.vx,y=i.vy-a.vy,x=f*m+y*c;x<=0||(i.fixed?(a.vx+=x*m,a.vy+=x*c):a.fixed?(i.vx-=x*m,i.vy-=x*c):(i.vx-=x*m,i.vy-=x*c,a.vx+=x*m,a.vy+=x*c))}}}function Ld(e,t,n,r,i,s,a,l,d=12){let u=e.length;if(u===0)return e;let h=new Map;for(let b=0;b<u;b++)h.set(e[b].id,b);let m=new Float64Array(u),c=new Float64Array(u);for(let b=0;b<u;b++){let S=e[b];for(let D=b+1;D<u;D++){let z=e[D],M=S.x-z.x,$=S.y-z.y,L=M*M+$*$;L<1&&(L=1);let R=Math.sqrt(L),P=i/L,B=M/R*P,I=$/R*P;m[b]+=B,c[b]+=I,m[D]-=B,c[D]-=I}}for(let b=0;b<t.length;b++){let S=t[b],D=h.get(S.source),z=h.get(S.target);if(D===void 0||z===void 0)continue;let M=e[D],$=e[z],L=$.x-M.x,R=$.y-M.y,P=Math.sqrt(L*L+R*R);if(P<.1)continue;let B=S.weight??1,I=P-l,F=s*I*B,A=L/P*F,k=R/P*F;m[D]+=A,c[D]+=k,m[z]-=A,c[z]-=k}let p=n/2,f=r/2,y=.001;for(let b=0;b<u;b++){let S=e[b];m[b]+=(p-S.x)*y,c[b]+=(f-S.y)*y}let x=20,g=[];for(let b=0;b<u;b++){let S=e[b];if(S.fixed){g.push({...S,vx:0,vy:0});continue}let D=(S.vx+m[b])*a,z=(S.vy+c[b])*a,M=Math.sqrt(D*D+z*z),$=10;M>$&&(D=D/M*$,z=z/M*$);let L=S.x+D,R=S.y+z;L=Math.max(x,Math.min(n-x,L)),R=Math.max(x,Math.min(r-x,R)),g.push({...S,x:L,y:R,vx:D,vy:z})}return ds(g,d),g}function Bd(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];t+=r.vx*r.vx+r.vy*r.vy}return t}function us(e){let{nodes:t,edges:n,width:r=600,height:i=400,nodeRadius:s=12,nodeStrokeWidth:a=2,solidNodes:l=!0,showLabels:d=!0,showArrows:u=!1,repulsionForce:h=300,attractionForce:m=.01,damping:c=.9,edgeLength:p=100,edgeColor:f="#94a3b8",edgeWidth:y=1.5,title:x,customForce:g,trails:b}=e;if(!t||t.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":x??"Empty force-directed graph"},x?o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},x):o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let S=oe(cs(t,r,i)),[D,z]=G(0),M=oe(!0),$=oe(!1),L=oe(n);L.current=n;let R=oe(g);R.current=g;let P=oe(null),B=oe({repulsionForce:h,attractionForce:m,damping:c,edgeLength:p,width:r,height:i,nodeRadius:s,solidNodes:l});B.current={repulsionForce:h,attractionForce:m,damping:c,edgeLength:p,width:r,height:i,nodeRadius:s,solidNodes:l};let I=oe(new Map);ae(()=>{S.current=cs(t,r,i),$.current=!1,M.current=!0,I.current=new Map,z(se=>se+1)},[t.length]),ae(()=>{let se=0,Q=()=>{if(!M.current)return;let le=B.current,ce=R.current,ue;if(ce?(ue=ce(S.current,L.current,le.width,le.height,P.current),le.solidNodes&&ds(ue,le.nodeRadius)):ue=Ld(S.current,L.current,le.width,le.height,le.repulsionForce,le.attractionForce,le.damping,le.edgeLength,le.nodeRadius),S.current=ue,b)for(let re=0;re<b.length;re++){let ge=b[re],me=ue.find(fe=>fe.id===ge.nodeId);if(!me)continue;let ne=I.current.get(ge.nodeId);ne||(ne=[],I.current.set(ge.nodeId,ne)),ne.push({x:me.x,y:me.y});let de=ge.maxPoints??200;ne.length>de&&ne.splice(0,ne.length-de)}if(!ce&&Bd(ue)<.01){$.current=!0,z(re=>re+1);return}z(re=>re+1),se=requestAnimationFrame(Q)};return se=requestAnimationFrame(Q),()=>{M.current=!1,cancelAnimationFrame(se)}},[]);let F=S.current,A=v(se=>{S.current=S.current.map(Q=>Q.id===se?{...Q,fixed:!Q.fixed,vx:0,vy:0}:Q),$.current&&($.current=!1,M.current=!0,z(Q=>Q+1))},[]),k=oe(null),w=oe(null),E=v(se=>{let Q=se,le=w.current;if(!le)return{x:Q.clientX,y:Q.clientY};let ce=le.getBoundingClientRect(),ue=r/ce.width,re=i/ce.height;return{x:(Q.clientX-ce.left)*ue,y:(Q.clientY-ce.top)*re}},[r,i]),C=oe(!1),N=v((se,Q)=>{Q.stopPropagation(),k.current=se;let le=S.current.find(ce=>ce.id===se);C.current=le?.fixed??!1,S.current=S.current.map(ce=>ce.id===se?{...ce,fixed:!0,vx:0,vy:0}:ce)},[]),T=v(se=>{let Q=E(se);if(P.current={x:Q.x,y:Q.y},!k.current)return;let le=k.current,ce=20;S.current=S.current.map(ue=>ue.id===le?{...ue,x:Math.max(ce,Math.min(r-ce,Q.x)),y:Math.max(ce,Math.min(i-ce,Q.y))}:ue),$.current&&($.current=!1,M.current=!0),z(ue=>ue+1)},[r,i,E]),W=v(()=>{let se=k.current;se&&(S.current=S.current.map(Q=>Q.id===se?{...Q,fixed:C.current}:Q)),k.current=null},[]),_=v(()=>{k.current=null,P.current=null},[]),O=q(()=>{let se=new Map;for(let Q=0;Q<F.length;Q++)se.set(F[Q].id,F[Q]);return se},[D]),U=v(()=>u?[o("defs",{key:"arrow-defs"},o("marker",{key:"arrowhead",id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:String(10+s),refY:"3.5",orient:"auto",markerUnits:"userSpaceOnUse"},o("polygon",{key:"arrow-poly",points:"0 0, 10 3.5, 0 7",fill:f})))]:[],[u,s,f]),K=v(()=>{let se=[];for(let Q=0;Q<n.length;Q++){let le=n[Q],ce=O.get(le.source),ue=O.get(le.target);if(!ce||!ue||le.weight!==void 0&&le.weight<=0)continue;let re=le.weight?Math.max(.5,Math.min(6,y*le.weight)):y,ge={key:`edge-${Q}`,x1:String(ce.x),y1:String(ce.y),x2:String(ue.x),y2:String(ue.y),stroke:le.color??f,"stroke-width":String(re),"stroke-opacity":"0.6"};u&&(ge["marker-end"]="url(#arrowhead)"),se.push(o("line",ge))}return se},[D,f,y,u]),te=v(()=>{let se=[];for(let Q=0;Q<F.length;Q++){let le=F[Q];se.push(o("circle",{key:`node-${le.id}`,cx:String(le.x),cy:String(le.y),r:String(s),fill:le.color,stroke:le.fixed?"#0f172a":"#fff","stroke-width":le.fixed?"3":String(a),style:{cursor:k.current===le.id?"grabbing":"grab"},onMouseDown:ce=>N(le.id,ce),onDblClick:()=>A(le.id),role:"button",tabIndex:0,"aria-label":`Node: ${le.label}${le.fixed?" (locked)":""} \u2014 drag to move, double-click to lock`})),d&&se.push(o("text",{key:`label-${le.id}`,x:String(le.x),y:String(le.y+s+14),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151","pointer-events":"none"},le.label))}return se},[D,s,d,A]),J=v(()=>x?[o("text",{key:"title",x:String(r/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},x)]:[],[x,r]),V=v(()=>{if(!b||b.length===0)return[];let se=[];for(let Q=0;Q<b.length;Q++){let le=b[Q],ce=I.current.get(le.nodeId);if(!ce||ce.length<2)continue;let ue=[];for(let re=0;re<ce.length;re++){let ge=ce[re];ue.push(`${re===0?"M":"L"}${ge.x.toFixed(1)},${ge.y.toFixed(1)}`)}se.push(o("path",{key:`trail-${le.nodeId}`,d:ue.join(" "),fill:"none",stroke:le.color??"#3b82f6","stroke-width":String(le.width??1),opacity:String(le.opacity??.5),"stroke-linecap":"round","stroke-linejoin":"round"}))}return se},[D,b]),j=U(),Y=V(),H=K(),Z=te(),ee=J();return o("svg",{ref:w,width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":x??"Force-directed graph \u2014 drag nodes to move, double-click to lock",style:{fontFamily:"sans-serif",cursor:k.current?"grabbing":"default"},onMouseMove:T,onMouseUp:W,onMouseLeave:_},...j,...ee,...Y,...H,...Z)}var ps=["#3b82f6","#6366f1","#8b5cf6","#a855f7","#c084fc","#d8b4fe","#e9d5ff","#f3e8ff"];function fs(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",showLabels:s=!0,showValues:a=!0,showPercentage:l=!0,gapSize:d=2,colors:u=ps,title:h}=e,m=i==="vertical",c=h?30:0,p=120,f=q(()=>{let L=0;for(let R=0;R<t.length;R++)t[R].value>L&&(L=t[R].value);return L>0?L:1},[t]),y=v(L=>f===0?0:Math.max(.05,L/f),[f]),x=v((L,R)=>R||(u[L%u.length]??ps[0]),[u]),g=v(()=>{if(t.length===0)return[];let L=[],R=40,P=n-R*2-p,B=r-c-R*2,I=d*(t.length-1),F=Math.max(1,(B-I)/t.length),A=R+P/2;for(let k=0;k<t.length;k++){let w=t[k],E=k<t.length-1?t[k+1]:null,C=x(k,w.color),N=y(w.value),T=E!==null?y(E.value):N*.6,W=P/2*N,_=P/2*T,O=c+R+k*(F+d),U=A-W,K=A+W,te=A+_,J=A-_,V=`${U},${O} ${K},${O} ${te},${O+F} ${J},${O+F}`;L.push(o("polygon",{key:`section-${k}`,points:V,fill:C,stroke:"#fff","stroke-width":"1"}));let j=R+P+12,Y=O+F/2;if(s&&L.push(o("text",{key:`label-${k}`,x:String(j),y:String(Y-(a||l?6:0)),"text-anchor":"start","font-size":"12","font-weight":"bold","font-family":"sans-serif",fill:"#374151"},w.label)),a||l){let H="";if(a&&(H=String(w.value)),l&&t.length>0){let Z=t[0].value,ee=Z>0?Math.round(w.value/Z*100):0;H+=a?` (${ee}%)`:`${ee}%`}L.push(o("text",{key:`value-${k}`,x:String(j),y:String(Y+(s?10:4)),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},H))}}return L},[t,n,r,c,d,s,a,l,x,y,p]),b=v(()=>{if(t.length===0)return[];let L=[],R=40,P=n-R*2,I=r-c-R*2-40,F=d*(t.length-1),A=Math.max(1,(P-F)/t.length),k=c+R+I/2;for(let w=0;w<t.length;w++){let E=t[w],C=w<t.length-1?t[w+1]:null,N=x(w,E.color),T=y(E.value),W=C!==null?y(C.value):T*.6,_=I/2*T,O=I/2*W,U=R+w*(A+d),K=k-_,te=k-O,J=k+O,V=k+_,j=`${U},${K} ${U+A},${te} ${U+A},${J} ${U},${V}`;L.push(o("polygon",{key:`section-${w}`,points:j,fill:N,stroke:"#fff","stroke-width":"1"}));let Y=U+A/2,H=c+R+I+14;if(s&&L.push(o("text",{key:`label-${w}`,x:String(Y),y:String(H),"text-anchor":"middle","font-size":"11","font-weight":"bold","font-family":"sans-serif",fill:"#374151"},E.label)),a||l){let Z="";if(a&&(Z=String(E.value)),l&&t.length>0){let ee=t[0].value,se=ee>0?Math.round(E.value/ee*100):0;Z+=a?` (${se}%)`:`${se}%`}L.push(o("text",{key:`value-${w}`,x:String(Y),y:String(H+14),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#6b7280"},Z))}}return L},[t,n,r,c,d,s,a,l,x,y]),S=v(()=>h?[o("text",{key:"title",x:String(n/2),y:String(20),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h)]:[],[h,n]),D=v(()=>t.length>0?[]:[o("text",{key:"empty",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,n,r]),z=S(),M=m?g():b(),$=D();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Funnel chart",style:{fontFamily:"sans-serif"}},...z,...M,...$)}var gs=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function ms(e){if(e<=0)return 1;let t=e/6,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function Fd(e,t){return t||gs[e%gs.length]}function hs(e){let{tasks:t=[],width:n=800,height:r,barHeight:i=24,barGap:s=8,showGrid:a=!0,showLabels:l=!0,showProgress:d=!1,timeUnit:u="days",title:h,padding:m=50}=e;if(t.length===0)return o("svg",{width:"100%",height:String(r??100),viewBox:`0 0 ${n} ${r??100}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Empty Gantt chart"},o("text",{x:String(n/2),y:String((r??100)/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.4"},"No tasks to display"));let c=l?120:0,p=q(()=>{let B=1/0,I=-1/0;for(let F of t){F.start<B&&(B=F.start);let A=F.start+F.duration;A>I&&(I=A)}return B===1/0&&(B=0,I=1),{min:B,max:I,range:I-B}},[t]),f=q(()=>{let B=t.slice();return B.sort((I,F)=>I.group!==F.group?(I.group??"").localeCompare(F.group??""):I.start-F.start),B},[t]),y=r??m*2+f.length*(i+s)+s+20,x=n-m-c-m,g=m+(h?20:0),b=v(B=>p.range===0?c+m:c+m+(B-p.min)/p.range*x,[p,x,c,m]),S=v(()=>{if(!a)return[];let B=[],I=ms(p.range),F=Math.ceil(p.min/I)*I,A=g+f.length*(i+s)+s;for(let k=F;k<=p.max;k+=I){let w=b(k);B.push(o("line",{key:`grid-${k}`,x1:String(w),y1:String(g),x2:String(w),y2:String(A),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"}))}return B},[a,p,g,f.length,i,s,b]),D=v(()=>{let B=[],I=ms(p.range),F=Math.ceil(p.min/I)*I,A=g-8;for(let k=F;k<=p.max;k+=I){let w=b(k);B.push(o("text",{key:`taxis-${k}`,x:String(w),y:String(A),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},String(k)))}return B.push(o("text",{key:"time-unit",x:String(n-m),y:String(A),"text-anchor":"end","font-size":"10","font-family":"sans-serif",fill:"currentColor",opacity:"0.4","font-style":"italic"},u)),B},[p,g,b,u,n,m]),z=v(()=>{let B=[],I="";for(let F=0;F<f.length;F++){let A=f[F],k=g+F*(i+s)+s,w=b(A.start),E=Math.max(2,b(A.start+A.duration)-w),C=Fd(F,A.color);A.group&&A.group!==I&&(I=A.group,l&&B.push(o("text",{key:`group-${F}`,x:String(m),y:String(k+i/2-12),"font-size":"9","font-family":"sans-serif","font-weight":"bold",fill:"currentColor",opacity:"0.4","text-transform":"uppercase"},A.group))),B.push(o("rect",{key:`bar-${A.id}`,x:String(w),y:String(k),width:String(E),height:String(i),rx:"4",ry:"4",fill:C,role:"graphics-symbol","aria-label":`${A.label}: start ${A.start}, duration ${A.duration}`})),l&&B.push(o("text",{key:`label-${A.id}`,x:String(c+m-8),y:String(k+i/2+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"currentColor"},A.label.length>16?A.label.substring(0,14)+"..":A.label)),d&&E>30&&B.push(o("text",{key:`prog-${A.id}`,x:String(w+E/2),y:String(k+i/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#ffffff"},`${A.start}-${A.start+A.duration}`))}return B},[f,g,i,s,b,l,d,c,m]),M=v(()=>h?[o("text",{key:"title",x:String(n/2),y:String(m/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},h)]:[],[h,n,m]),$=S(),L=D(),R=z(),P=M();return o("svg",{width:"100%",height:String(y),viewBox:`0 0 ${n} ${y}`,xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Gantt chart",style:{fontFamily:"sans-serif"}},...P,...$,...L,...R)}var Nd=Math.PI/180;function Wd(e){return e*Nd}function Ge(e,t,n,r){let i=Wd(r);return{x:e+n*Math.cos(i),y:t+n*Math.sin(i)}}function bs(e,t,n,r,i){let s=Ge(e,t,n,i),a=Ge(e,t,n,r),l=i-r,d=Math.abs(l)>180?1:0,u=l>0?1:0;return`M ${s.x} ${s.y} A ${n} ${n} 0 ${d} ${u===1?0:1} ${a.x} ${a.y}`}function _d(e,t,n){return e<t?t:e>n?n:e}function pt(e){return!isFinite(e)||isNaN(e)?"--":Math.abs(e)>=1e3?Math.round(e).toString():e===Math.floor(e)?e.toString():e.toFixed(1)}function xs(e){let{value:t,min:n=0,max:r=100,width:i=300,height:s=200,startAngle:a=-135,endAngle:l=135,arcWidth:d=20,showValue:u=!0,showMinMax:h=!0,showTicks:m=!0,tickCount:c=10,label:p,unit:f,colors:y=["#22c55e","#f59e0b","#ef4444"],needleColor:x="#374151",backgroundColor:g="#e5e7eb"}=e,b=isFinite(n)&&!isNaN(n)?n:0,S=isFinite(r)&&!isNaN(r)&&r>b?r:b+100,D=isFinite(t)&&!isNaN(t)?_d(t,b,S):b,z=(u?24:0)+(p?18:0),M=i/2,$=(s-z)*.6,L=Math.min(i/2,(s-z)*.55)-d/2-10,R=L-d,P=L-d/2,B=l-a,I=v(V=>{let j=S-b;if(j===0)return a;let Y=(V-b)/j;return a+Y*B},[b,S,a,B]),F=v(()=>{let V=bs(M,$,P,a,l);return[o("path",{key:"bg-arc",d:V,fill:"none",stroke:g,"stroke-width":String(d),"stroke-linecap":"round"})]},[M,$,P,a,l,g,d]),A=v(()=>{if(y.length===0)return[];let V=[],j=B/y.length;for(let Y=0;Y<y.length;Y++){let H=a+Y*j,Z=H+j,ee=bs(M,$,P,H,Z);V.push(o("path",{key:`seg-${Y}`,d:ee,fill:"none",stroke:y[Y],"stroke-width":String(d),"stroke-linecap":Y===0||Y===y.length-1?"round":"butt",opacity:"0.85"}))}return V},[y,B,a,M,$,P,d]),k=v(()=>{if(!m||c<=0)return[];let V=[],j=Math.max(1,Math.min(c,100));for(let Y=0;Y<=j;Y++){let H=Y/j,Z=a+H*B,ee=Y%2===0,se=ee?10:6,Q=Ge(M,$,L+4,Z),le=Ge(M,$,L+4+se,Z);if(V.push(o("line",{key:`tick-${Y}`,x1:String(Q.x),y1:String(Q.y),x2:String(le.x),y2:String(le.y),stroke:"currentColor",opacity:"0.4","stroke-width":ee?"2":"1"})),ee){let ce=b+H*(S-b),ue=Ge(M,$,L+4+se+12,Z);V.push(o("text",{key:`tick-label-${Y}`,x:String(ue.x),y:String(ue.y+3),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"currentColor",opacity:"0.55"},pt(ce)))}}return V},[m,c,a,B,M,$,L,b,S]),w=v(()=>{let V=[],j=I(D),Y=R-8,H=Ge(M,$,Y,j),Z=6,ee=j+90,se=j-90,Q=Ge(M,$,Z,ee),le=Ge(M,$,Z,se);return V.push(o("polygon",{key:"needle",points:`${H.x},${H.y} ${Q.x},${Q.y} ${le.x},${le.y}`,fill:x,stroke:"none"})),V.push(o("circle",{key:"needle-cap",cx:String(M),cy:String($),r:"8",fill:x,stroke:"#fff","stroke-width":"2"})),V},[D,I,M,$,R,x]),E=v(()=>{if(!u)return[];let V=[],j=pt(D),Y=j+(f?" "+f:""),H=$+P+20;return V.push(o("text",{key:"value-text",x:String(M),y:String(H),"text-anchor":"middle","font-size":"22","font-weight":"bold","font-family":"sans-serif",fill:"currentColor","aria-label":`Value: ${Y}`},j,f?o("tspan",{key:"unit","font-size":"14","font-weight":"normal",opacity:"0.6",fill:"currentColor"}," "+f):null)),V},[u,D,f,M,$,P]),C=v(()=>{if(!p)return[];let V=$+P+(u?40:20);return[o("text",{key:"label",x:String(M),y:String(V),"text-anchor":"middle","font-size":"13","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},p)]},[p,M,$,P,u]),N=v(()=>{if(!h)return[];let V=[],j=Ge(M,$,P,a),Y=Ge(M,$,P,l);return V.push(o("text",{key:"min-label",x:String(j.x-4),y:String(j.y+18),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor",opacity:"0.55"},pt(b))),V.push(o("text",{key:"max-label",x:String(Y.x+4),y:String(Y.y+18),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor",opacity:"0.55"},pt(S))),V},[h,M,$,P,a,l,b,S]),T=F(),W=A(),_=k(),O=w(),U=E(),K=C(),te=N(),J=`Gauge: ${pt(D)}${f?" "+f:""}, range ${pt(b)} to ${pt(S)}${p?", "+p:""}`;return o("svg",{width:"100%",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"meter","aria-valuenow":String(D),"aria-valuemin":String(b),"aria-valuemax":String(S),"aria-label":J,style:{fontFamily:"sans-serif"}},...T,...W,..._,...O,...U,...K,...te)}var Bt={AL:{name:"Alabama",path:"m 643,467.4 .4,-7.3 -.9,-1.2 -1.7,-.7 -2.5,-2.8 .5,-2.9 48.8,-5.1 -.7,-2.2 -1.5,-1.5 -.5,-1.4 .6,-6.3 -2.4,-5.7 .5,-2.6 .3,-3.7 2.2,-3.8 -.2,-1.1 -1.7,-1 v -3.2 l -1.8,-1.9 -2.9,-6.1 -12.9,-45.8 -45.7,4 1.3,2 -1.3,67 4.4,33.2 .9,-.5 1.3,.1 .6,.4 .8,-.1 2,-3.8 v -2.3 l 1.1,-1.1 1.4,.5 3.4,6.4 v .9 l -3.3,2.2 3.5,-.4 4.9,-1.6 z"},AK:{name:"Alaska",path:"m 15.8,572 h 2.4 l .7,.7 -1,1.2 -1.9,.2 -2.5,1.3 -3.7,-.1 2.2,-.9 .3,-1.1 2.5,-.3 z m 8.3,-1.7 1.3,.5 h .9 l .5,1.2 .3,-.6 .9,.2 1.1,1.5 0,.5 -4.2,1.9 -2.4,-.1 -1,-.5 -1.1,.7 -2,0 -1.1,-1.4 4.7,-.5 z m 5.4,-.1 1,.1 .7,.7 v 1 l -1.3,.1 -.9,-1.1 z m 2.5,.3 1.3,-.1 -.1,1 -1.1,.6 z m .3,2.2 3.4,-.1 .2,1.1 -1.3,.1 -.3,-.5 -.8,.6 -.4,-.6 -.9,-.2 z m 166.3,7.6 2.1,.1 -1,1.9 -1.1,-.1 -.4,-.8 .5,-1.3 m -1.1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1,-.8 .9,.8 -1.1,3.1 1,1.6 1.2,.3 z m -49.5,-37.3 -.5,.1 -1.5,1.6 .2,.5 1.5,-.6 v -.6 l .9,-.3 z m 1.6,-1.1 -1,.3 -.2,.7 .9,-.1 z m -1.3,-1.6 -.2,.9 h 1.7 l .6,-.4 .1,-1 z m 2.8,-3 -.3,1.9 1.2,-.5 .1,-1.4 z m 58.3,31.9 -2,.3 -.4,1.3 1.3,1.7 z"},WY:{name:"Wyoming",path:"m 355.3,143.7 -51,-5.3 -57.3,-7.9 -2,10.7 -8.5,54.8 -3.3,21.9 32.1,4.8 44.9,5.7 37.5,3.4 3.7,-44.2 z"},DC:{name:"District of Columbia",path:"m 803.5,252 -2.6,-1.8 -1,1.7 .5,.4 .4,.1 .6,.5 .3,.7 -.1,.5 .2,.5 z"}};function ys(e){let{width:t=959,height:n=593,stateColors:r={},defaultColor:i="#D0D0D0",strokeColor:s="#FFFFFF",strokeWidth:a=1,onStateClick:l,onStateHover:d,hoverColor:u="#FFD700",title:h="Map of the United States"}=e,m=q(()=>Object.keys(Bt),[]),c=v(g=>{l&&l(g)},[l]),p=v((g,b)=>{let S=b.currentTarget;S&&S.setAttribute("fill",u),d&&d(g)},[d,u]),f=v((g,b)=>{let S=b.currentTarget;if(S){let D=r[g]??i;S.setAttribute("fill",D)}d&&d(null)},[d,r,i]),y=q(()=>{let g=[];for(let b=0;b<m.length;b++){let S=m[b],D=Bt[S],z=r[S]??i,M={key:`state-${S}`,d:D.path,fill:z,stroke:s,"stroke-width":String(a),"stroke-linejoin":"round","data-state":S,role:"img","aria-label":D.name,style:{cursor:l?"pointer":"default"}};if(l){let L=S;M.onClick=()=>c(L),M.onKeyDown=R=>{(R.key==="Enter"||R.key===" ")&&c(L)},M.tabindex=0,M.role="button",M["aria-label"]=D.name}let $=S;M.onMouseOver=L=>p($,L),M.onMouseOut=L=>f($,L),g.push(o("path",M))}return g},[m,r,i,s,a,l,c,p,f]),x=o("title",{key:"map-title"},h);return o("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h,style:{fontFamily:"sans-serif"}},x,...y)}function Zn(e){let t=e.replace("#",""),n=t.length===3?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,r=parseInt(n,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function Od(e,t,n){let r=i=>{let s=Math.max(0,Math.min(255,Math.round(i))).toString(16);return s.length===1?"0"+s:s};return`#${r(e)}${r(t)}${r(n)}`}function Hd(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=Math.min(Math.floor(n*r),r-1),s=n*r-i,a=Zn(t[i]),l=Zn(t[i+1]);return Od(a.r+(l.r-a.r)*s,a.g+(l.g-a.g)*s,a.b+(l.b-a.b)*s)}function Yd(e){let{r:t,g:n,b:r}=Zn(e);return(.299*t+.587*n+.114*r)/255}var Vd=["#3b82f6","#fbbf24","#ef4444"];function Ss(e){let{data:t=[],rowLabels:n,columnLabels:r,width:i=600,height:s=400,colorScale:a=Vd,minValue:l,maxValue:d,showValues:u=!1,cellBorderColor:h="#fff",cellBorderWidth:m=1,title:c,padding:p=60}=e,f=t.length,y=q(()=>{let k=0;for(let w of t)w.length>k&&(k=w.length);return k},[t]),{minVal:x,maxVal:g}=q(()=>{let k=l??1/0,w=d??-1/0;for(let E of t)for(let C of E)l===void 0&&C<k&&(k=C),d===void 0&&C>w&&(w=C);return k===1/0&&(k=0),w===-1/0&&(w=1),k===w&&(w=k+1),{minVal:k,maxVal:w}},[t,l,d]),b=c?30:0,S=n?p:20,D=r?p:20,z=i-S-20,M=s-b-D-20,$=y>0?z/y:0,L=f>0?M/f:0,R=v(()=>{let k=[];for(let w=0;w<f;w++){let E=t[w];for(let C=0;C<y;C++){let N=C<E.length?E[C]:0,T=(N-x)/(g-x),W=Hd(T,a),_=S+C*$,O=b+20+w*L;if(k.push(o("rect",{key:`cell-${w}-${C}`,x:String(_),y:String(O),width:String($),height:String(L),fill:W,stroke:h,"stroke-width":String(m)})),u){let U=Yd(W)>.5?"#111827":"#ffffff";k.push(o("text",{key:`val-${w}-${C}`,x:String(_+$/2),y:String(O+L/2),"text-anchor":"middle","dominant-baseline":"central","font-size":String(Math.min(11,$*.3,L*.4)),"font-family":"sans-serif",fill:U},String(Math.round(N*100)/100)))}}}return k},[t,f,y,x,g,a,$,L,S,b,u,h,m]),P=v(()=>{let k=[];if(n)for(let w=0;w<f;w++){let E=w<n.length?n[w]:"",C=b+20+w*L+L/2;k.push(o("text",{key:`row-label-${w}`,x:String(S-8),y:String(C),"text-anchor":"end","dominant-baseline":"central","font-size":"11","font-family":"sans-serif",fill:"currentColor"},E))}if(r)for(let w=0;w<y;w++){let E=w<r.length?r[w]:"",C=S+w*$+$/2,N=b+20+f*L+16;k.push(o("text",{key:`col-label-${w}`,x:String(C),y:String(N),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor"},E))}return k},[n,r,f,y,$,L,S,b]),B=v(()=>c?[o("text",{key:"title",x:String(i/2),y:"22","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},c)]:[],[c,i]);if(f===0||y===0)return o("svg",{width:"100%",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":c??"Heat map \u2014 no data"},o("text",{x:String(i/2),y:String(s/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"No data to display."));let I=B(),F=R(),A=P();return o("svg",{width:"100%",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":c??"Heat map",style:{fontFamily:"sans-serif"}},...I,...F,...A)}function Ud(e,t){if(e.length===0)return[];let n=e[0],r=e[0];for(let a=1;a<e.length;a++){let l=e[a];l<n&&(n=l),l>r&&(r=l)}if(n===r)return[{min:n,max:r+1,count:e.length}];let i=(r-n)/t,s=[];for(let a=0;a<t;a++)s.push({min:n+a*i,max:n+(a+1)*i,count:0});for(let a=0;a<e.length;a++){let l=e[a],d=Math.floor((l-n)/i);d>=t&&(d=t-1),s[d].count++}return s}function jd(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function Jn(e){return Number.isInteger(e)?String(e):e.toFixed(1)}function vs(e){let{data:t=[],bins:n=10,width:r=600,height:i=400,barColor:s="#3b82f6",barGap:a=2,showGrid:l=!0,showValues:d=!0,title:u,xLabel:h,yLabel:m,padding:c=60}=e,p=Math.max(1,Math.round(n)),f=q(()=>Ud(t,p),[t,p]),y=q(()=>{let I=0;for(let F=0;F<f.length;F++)f[F].count>I&&(I=f[F].count);return I>0?I:1},[f]),x=r-c*2,g=i-c*2,b=v(()=>{if(!l)return[];let I=jd(y),F=[];for(let A=I;A<=y;A+=I){let k=c+g-A/y*g;F.push(o("line",{key:`grid-${A}`,x1:String(c),y1:String(k),x2:String(c+x),y2:String(k),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),F.push(o("text",{key:`grid-label-${A}`,x:String(c-8),y:String(k+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(A)))}return F},[l,y,c,x,g]),S=v(()=>{let I=[];return I.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+g),stroke:"#374151","stroke-width":"1.5"})),I.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+g),x2:String(c+x),y2:String(c+g),stroke:"#374151","stroke-width":"1.5"})),I},[c,x,g]),D=v(()=>{if(f.length===0)return[];let I=[],F=a*(f.length-1),A=Math.max(1,(x-F)/f.length);for(let k=0;k<f.length;k++){let w=f[k],E=w.count/y*g,C=c+k*(A+a),N=c+g-E;if(I.push(o("rect",{key:`bar-${k}`,x:String(C),y:String(N),width:String(A),height:String(E),fill:s})),d&&w.count>0&&I.push(o("text",{key:`val-${k}`,x:String(C+A/2),y:String(N-4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},String(w.count))),f.length<=15||k%2===0||k===f.length-1){let W=(f.length===1,Jn(w.min));I.push(o("text",{key:`xlabel-${k}`,x:String(C+A/2),y:String(c+g+14),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#6b7280"},W))}}if(f.length>0){let k=f[f.length-1],w=c+x;I.push(o("text",{key:"xlabel-end",x:String(w),y:String(c+g+14),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#6b7280"},Jn(k.max)))}return I},[f,y,a,s,d,c,x,g]),z=v(()=>{let I=[];return u&&I.push(o("text",{key:"title",x:String(r/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},u)),h&&I.push(o("text",{key:"x-label",x:String(c+x/2),y:String(i-8),"text-anchor":"middle","font-size":"12","font-family":"sans-serif",fill:"#374151"},h)),m&&I.push(o("text",{key:"y-label",x:String(14),y:String(c+g/2),"text-anchor":"middle","font-size":"12","font-family":"sans-serif",fill:"#374151",transform:`rotate(-90 14 ${c+g/2})`},m)),I},[u,h,m,r,i,c,x,g]),M=v(()=>t.length>0?[]:[o("text",{key:"empty",x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,r,i]),$=b(),L=S(),R=D(),P=z(),B=M();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":u??"Histogram",style:{fontFamily:"sans-serif"}},...P,...$,...L,...R,...B)}function Gd(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function ws(e){let{data:t=[],width:n=600,height:r=400,orientation:i="vertical",stemColor:s="#94a3b8",stemWidth:a=2,dotRadius:l=6,dotColor:d="#3b82f6",showGrid:u=!0,showValues:h=!0,title:m,padding:c=60}=e,p=i==="vertical",f=p?30:0,y=n-c*2,x=r-c*2-f,g=p?x:y,b=p?y:x,S=q(()=>{let k=0;for(let w=0;w<t.length;w++)t[w].value>k&&(k=t[w].value);return k>0?k:1},[t]),D=q(()=>t.length===0?0:b/t.length,[t.length,b]),z=v(()=>{if(!u)return[];let k=Gd(S),w=[];for(let E=k;E<=S;E+=k){let C=E/S*g;if(p){let N=c+x-C;w.push(o("line",{key:`grid-${E}`,x1:String(c),y1:String(N),x2:String(c+y),y2:String(N),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`grid-label-${E}`,x:String(c-8),y:String(N+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(E)))}else{let N=c+C;w.push(o("line",{key:`grid-${E}`,x1:String(N),y1:String(c),x2:String(N),y2:String(c+x),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),w.push(o("text",{key:`grid-label-${E}`,x:String(N),y:String(c+x+16),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(E)))}}return w},[u,S,p,c,y,x,g]),M=v(()=>{let k=[];return p?k.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})):k.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})),k.push(o("line",{key:"axis-x",x1:String(c),y1:String(c+x),x2:String(c+y),y2:String(c+x),stroke:"#374151","stroke-width":"1.5"})),k},[p,c,y,x]),$=v(()=>{if(t.length===0)return[];let k=[];for(let w=0;w<t.length;w++){let E=t[w],C=E.value/S*g,N=D*w+D/2,T=E.color??d;if(p){let W=c+N,_=c+x,O=c+x-C;k.push(o("line",{key:`stem-${w}`,x1:String(W),y1:String(_),x2:String(W),y2:String(O),stroke:s,"stroke-width":String(a)})),k.push(o("circle",{key:`dot-${w}`,cx:String(W),cy:String(O),r:String(l),fill:T})),h&&k.push(o("text",{key:`val-${w}`,x:String(W),y:String(O-l-4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(E.value)));let U=W,K=c+x+16;k.push(o("text",{key:`cat-${w}`,x:String(U),y:String(K),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151",transform:`rotate(-45, ${U}, ${K})`},E.label))}else{let W=c+N,_=c,O=c+C;k.push(o("line",{key:`stem-${w}`,x1:String(_),y1:String(W),x2:String(O),y2:String(W),stroke:s,"stroke-width":String(a)})),k.push(o("circle",{key:`dot-${w}`,cx:String(O),cy:String(W),r:String(l),fill:T})),h&&k.push(o("text",{key:`val-${w}`,x:String(O+l+4),y:String(W+4),"text-anchor":"start","font-size":"11","font-family":"sans-serif",fill:"#374151"},String(E.value))),k.push(o("text",{key:`cat-${w}`,x:String(c-8),y:String(W+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#374151"},E.label))}}return k},[t,S,D,d,l,s,a,h,p,c,y,x,g]),L=v(()=>m?[o("text",{key:"title",x:String(n/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,n,c]),R=v(()=>t.length>0?[]:[o("text",{key:"empty",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,n,r]),P=z(),B=M(),I=$(),F=L(),A=R();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Lollipop chart",style:{fontFamily:"sans-serif"}},...F,...P,...B,...I,...A)}function Qn(e){let t=e.replace("#",""),n=t.length===3?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t,r=parseInt(n,16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function Xd(e,t,n){let r=i=>{let s=Math.max(0,Math.min(255,Math.round(i))).toString(16);return s.length===1?"0"+s:s};return`#${r(e)}${r(t)}${r(n)}`}function qd(e,t){if(t.length===0)return"#000000";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=Math.min(Math.floor(n*r),r-1),s=n*r-i,a=Qn(t[i]),l=Qn(t[i+1]);return Xd(a.r+(l.r-a.r)*s,a.g+(l.g-a.g)*s,a.b+(l.b-a.b)*s)}function Kd(e){let{r:t,g:n,b:r}=Qn(e);return(.299*t+.587*n+.114*r)/255}var Zd=["#f0f9ff","#3b82f6","#1e3a8a"];function ks(e){let{data:t=[],labels:n,rowLabels:r,columnLabels:i,width:s=500,height:a=500,colorScale:l=Zd,showValues:d=!0,showDiagonal:u=!0,cellBorderColor:h="#e5e7eb",title:m,padding:c=70,symmetric:p=!1}=e,f=r??n,y=i??n,x=t.length,g=q(()=>{let T=0;for(let W of t)W.length>T&&(T=W.length);return T},[t]),b=q(()=>{if(!p||x===0)return t;let T=[],W=Math.max(x,g);for(let _=0;_<W;_++){let O=[];for(let U=0;U<W;U++){let K=t[_],te=K&&U<K.length?K[U]:0,J=t[U],V=J&&_<J.length?J[_]:0;te!==0?O.push(te):O.push(V)}T.push(O)}return T},[t,p,x,g]),S=b.length,D=q(()=>{let T=0;for(let W of b)W.length>T&&(T=W.length);return T},[b]),{minVal:z,maxVal:M}=q(()=>{let T=1/0,W=-1/0;for(let _ of b)for(let O of _)O<T&&(T=O),O>W&&(W=O);return T===1/0&&(T=0),W===-1/0&&(W=1),T===W&&(W=T+1),{minVal:T,maxVal:W}},[b]),$=m?30:0,L=f?c:20,R=y?c:20,P=s-L-20,B=a-$-R-20,I=D>0?P/D:0,F=S>0?B/S:0,A=v(()=>{let T=[];for(let W=0;W<S;W++){let _=b[W];for(let O=0;O<D;O++){let U=O<_.length?_[O]:0,K=(U-z)/(M-z),te=qd(K,l),J=L+O*I,V=$+20+W*F,j=W===O,Y=j&&u?"currentColor":h,H=j&&u?"2":"1";if(T.push(o("rect",{key:`cell-${W}-${O}`,x:String(J),y:String(V),width:String(I),height:String(F),fill:te,stroke:Y,"stroke-width":H})),d){let Z=Kd(te)>.5?"#111827":"#ffffff",ee=Math.min(12,I*.3,F*.35);T.push(o("text",{key:`val-${W}-${O}`,x:String(J+I/2),y:String(V+F/2),"text-anchor":"middle","dominant-baseline":"central","font-size":String(Math.max(8,ee)),"font-weight":j&&u?"bold":"normal","font-family":"sans-serif",fill:Z},String(Math.round(U*100)/100)))}}}return T},[b,S,D,z,M,l,I,F,L,$,d,u,h]),k=v(()=>{let T=[];if(f)for(let W=0;W<S;W++){let _=W<f.length?f[W]:"",O=$+20+W*F+F/2;T.push(o("text",{key:`row-label-${W}`,x:String(L-8),y:String(O),"text-anchor":"end","dominant-baseline":"central","font-size":"11","font-family":"sans-serif",fill:"currentColor"},_))}if(y)for(let W=0;W<D;W++){let _=W<y.length?y[W]:"",O=L+W*I+I/2,U=$+20+S*F+12;T.push(o("text",{key:`col-label-${W}`,x:String(O),y:String(U),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor"},_))}return T},[f,y,S,D,I,F,L,$]),w=v(()=>m?[o("text",{key:"title",x:String(s/2),y:"22","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},m)]:[],[m,s]);if(S===0||D===0)return o("svg",{width:"100%",viewBox:`0 0 ${s} ${a}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Matrix \u2014 no data"},o("text",{x:String(s/2),y:String(a/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"No data to display."));let E=w(),C=A(),N=k();return o("svg",{width:"100%",viewBox:`0 0 ${s} ${a}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Matrix visualization",style:{fontFamily:"sans-serif"}},...E,...C,...N)}var Jd=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function rn(e){if(!e.children||e.children.length===0)return Math.max(0,e.value??0);let t=0,n=[e];for(;n.length>0;){let r=n.pop();if(!r.children||r.children.length===0)t+=Math.max(0,r.value??0);else for(let i=r.children.length-1;i>=0;i--)n.push(r.children[i])}return t}function Qd(e){let t=0,n=[{node:e,depth:0}];for(;n.length>0;){let{node:r,depth:i}=n.pop();if(i>t&&(t=i),r.children)for(let s=r.children.length-1;s>=0;s--)n.push({node:r.children[s],depth:i+1})}return t}function eu(e,t,n,r,i,s,a){let l=[];if(rn(e)<=0)return l;let h=Qd(e)+1,m=s==="horizontal",c=m?i/h:r/h,p=[];for(p.push({node:e,depth:0,spanStart:m?t:n,spanEnd:m?t+r:n+i,colorIndex:0});p.length>0;){let f=p.shift(),{node:y,depth:x,spanStart:g,spanEnd:b,colorIndex:S}=f,D=rn(y);if(D<=0)continue;let z=b-g,M,$,L,R;if(m?(M=g,$=n+x*c,L=z,R=c):(M=t+x*c,$=g,L=c,R=z),l.push({x:M,y:$,w:L,h:R,label:y.label,value:D,color:y.color??a[S%a.length],depth:x}),y.children&&y.children.length>0){let P=g;for(let B=0;B<y.children.length;B++){let I=y.children[B],F=rn(I);if(F<=0)continue;let A=F/D*z;p.push({node:I,depth:x+1,spanStart:P,spanEnd:P+A,colorIndex:x===0?B:S}),P+=A}}}return l}function Cs(e){let{data:t,width:n=600,height:r=400,orientation:i="horizontal",showLabels:s=!0,showValues:a=!0,colors:l=Jd,borderColor:d="#ffffff",borderWidth:u=1,title:h,padding:m=10}=e,c=h?30:0,p=m,f=m+c,y=n-m*2,x=r-m*2-c;if(q(()=>rn(t),[t])<=0||y<=0||x<=0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Empty partition diagram"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data to display"));let b=q(()=>eu(t,p,f,y,x,i,l),[t,p,f,y,x,i,l]),S=[];h&&S.push(o("text",{key:"title",x:String(n/2),y:String(m+16),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h));for(let D=0;D<b.length;D++){let z=b[D];if(S.push(o("rect",{key:`cell-${D}`,x:String(z.x),y:String(z.y),width:String(Math.max(0,z.w)),height:String(Math.max(0,z.h)),fill:z.color,stroke:d,"stroke-width":String(u),role:"graphics-symbol","aria-label":`${z.label}: ${z.value}`})),s&&z.w>20&&z.h>14){let M=Math.floor(z.w/7),$=z.label.length>M?z.label.substring(0,Math.max(1,M-2))+"..":z.label;S.push(o("text",{key:`label-${D}`,x:String(z.x+z.w/2),y:String(z.y+z.h/2+(a?-2:4)),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"#ffffff","pointer-events":"none"},$))}a&&z.w>30&&z.h>28&&S.push(o("text",{key:`value-${D}`,x:String(z.x+z.w/2),y:String(z.y+z.h/2+12),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"rgba(255,255,255,0.8)","pointer-events":"none"},String(z.value)))}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Partition diagram",style:{fontFamily:"sans-serif"}},...S)}function eo(e,t){let n=[];for(let r of t)n.push(String(e[r]??""));return n.join(" | ")}function Ms(e,t){let n=new Set;for(let i of e)n.add(eo(i,t));let r=Array.from(n);return r.sort(),r}function sn(e,t){if(e.length===0)return 0;switch(t){case"count":return e.length;case"sum":{let n=0;for(let r of e)n+=r;return n}case"avg":{let n=0;for(let r of e)n+=r;return n/e.length}case"min":{let n=e[0];for(let r=1;r<e.length;r++)e[r]<n&&(n=e[r]);return n}case"max":{let n=e[0];for(let r=1;r<e.length;r++)e[r]>n&&(n=e[r]);return n}}}function an(e){return Number.isInteger(e)?String(e):e.toFixed(2)}function tu(e,t,n,r,i){let s=Ms(e,t),a=Ms(e,n),l=new Map;for(let p of e){let f=eo(p,t),y=eo(p,n),x=`${f}::${y}`;l.has(x)||l.set(x,[]);let g=l.get(x),b=0;for(let S of r){let D=p[S];if(typeof D=="number")b+=D;else if(typeof D=="string"){let z=parseFloat(D);isNaN(z)||(b+=z)}}g.push(b)}let d=new Map;for(let[p,f]of l)d.set(p,sn(f,i));let u=new Map;for(let p of s){let f=[];for(let y of a){let x=d.get(`${p}::${y}`);x!==void 0&&f.push(x)}u.set(p,sn(f,i==="count"?"sum":i))}let h=new Map;for(let p of a){let f=[];for(let y of s){let x=d.get(`${y}::${p}`);x!==void 0&&f.push(x)}h.set(p,sn(f,i==="count"?"sum":i))}let m=[];for(let p of u.values())m.push(p);let c=sn(m,i==="count"?"sum":i);return{rowKeys:s,colKeys:a,cells:d,rowTotals:u,colTotals:h,grandTotal:c}}function Es(e){let{data:t=[],rows:n=[],columns:r=[],values:i=[],aggregation:s="sum",width:a=600,height:l=400,showTotals:d=!0,title:u,headerColor:h="#3b82f6",cellPadding:m=8}=e;if(t.length===0||n.length===0&&r.length===0||i.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${a} ${l}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"table","aria-label":u??"Empty pivot table"},o("text",{x:String(a/2),y:String(l/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.4"},"No data to display"));let c=q(()=>tu(t,n,r,i,s),[t,n,r,i,s]),{rowKeys:p,colKeys:f,cells:y,rowTotals:x,colTotals:g,grandTotal:b}=c,S=u?30:0,D=f.length+(d?1:0),z=p.length+(d?1:0),M=1+D,$=1+z,L=Math.max(40,(a-m*2)/M),R=Math.max(20,Math.min(36,(l-S-m*2)/$)),P=L*M,B=R*$,I=Math.max(0,(a-P)/2),F=S+Math.max(0,(l-S-B)/2),A=[];u&&A.push(o("text",{key:"title",x:String(a/2),y:String(20),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},u)),A.push(o("rect",{key:"header-row-bg",x:String(I),y:String(F),width:String(P),height:String(R),fill:h})),A.push(o("rect",{key:"header-col-bg",x:String(I),y:String(F+R),width:String(L),height:String(R*z),fill:h,opacity:"0.85"})),A.push(o("text",{key:"corner",x:String(I+L/2),y:String(F+R/2+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},s.toUpperCase()));for(let k=0;k<f.length;k++){let w=I+(k+1)*L,E=Math.floor(L/7),C=f[k],N=C.length>E?C.substring(0,Math.max(1,E-2))+"..":C;A.push(o("text",{key:`ch-${k}`,x:String(w+L/2),y:String(F+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},N))}d&&A.push(o("text",{key:"ch-total",x:String(I+(f.length+1)*L+L/2),y:String(F+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},"Total"));for(let k=0;k<p.length;k++){let w=p[k],E=F+(k+1)*R;k%2===0&&A.push(o("rect",{key:`row-bg-${k}`,x:String(I+L),y:String(E),width:String(L*D),height:String(R),fill:"#f9fafb"}));let C=Math.floor(L/7),N=w.length>C?w.substring(0,Math.max(1,C-2))+"..":w;A.push(o("text",{key:`rh-${k}`,x:String(I+L/2),y:String(E+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#ffffff"},N));for(let T=0;T<f.length;T++){let W=f[T],_=`${w}::${W}`,O=y.get(_),U=I+(T+1)*L;A.push(o("rect",{key:`border-${k}-${T}`,x:String(U),y:String(E),width:String(L),height:String(R),fill:"none",stroke:"#e5e7eb","stroke-width":"0.5"})),A.push(o("text",{key:`cell-${k}-${T}`,x:String(U+L/2),y:String(E+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif",fill:"currentColor"},O!==void 0?an(O):"-"))}if(d){let T=I+(f.length+1)*L,W=x.get(w)??0;A.push(o("rect",{key:`rt-bg-${k}`,x:String(T),y:String(E),width:String(L),height:String(R),fill:"#eff6ff"})),A.push(o("text",{key:`rt-${k}`,x:String(T+L/2),y:String(E+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#1e40af"},an(W)))}}if(d){let k=F+(p.length+1)*R;A.push(o("rect",{key:"total-row-bg",x:String(I),y:String(k),width:String(P),height:String(R),fill:"#eff6ff"})),A.push(o("text",{key:"total-label",x:String(I+L/2),y:String(k+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#1e40af"},"Total"));for(let E=0;E<f.length;E++){let C=f[E],N=g.get(C)??0,T=I+(E+1)*L;A.push(o("text",{key:`ct-${E}`,x:String(T+L/2),y:String(k+R/2+4),"text-anchor":"middle","font-size":"11","font-family":"sans-serif","font-weight":"bold",fill:"#1e40af"},an(N)))}let w=I+(f.length+1)*L;A.push(o("text",{key:"grand-total",x:String(w+L/2),y:String(k+R/2+4),"text-anchor":"middle","font-size":"12","font-family":"sans-serif","font-weight":"bold",fill:"#1e3a8a"},an(b)))}return A.push(o("rect",{key:"outer-border",x:String(I),y:String(F),width:String(P),height:String(B),fill:"none",stroke:"#d1d5db","stroke-width":"1"})),o("svg",{width:"100%",viewBox:`0 0 ${a} ${l}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"table","aria-label":u??"Pivot table",style:{fontFamily:"sans-serif"}},...A)}function ln(e,t){return Math.PI*2*e/t-Math.PI/2}function cn(e,t,n,r){return{x:e+n*Math.cos(r),y:t+n*Math.sin(r)}}function Is(e){let{axes:t=[],series:n=[],width:r=500,height:i=500,levels:s=5,showLabels:a=!0,showValues:l=!1,showLegend:d=!0,showDots:u=!0,gridColor:h="#d1d5db",title:m}=e,c=t.length,p=m?30:0,f=d&&n.length>0?30:0,y=60,x=Math.min((r-y*2)/2,(i-y*2-p-f)/2),g=r/2,b=y+p+x,S=q(()=>{let A=[];for(let k=0;k<c;k++){let w=t[k]?.max;if(w!==void 0&&w>0){A.push(w);continue}let E=0;for(let C of n){let N=C.values[k];N!==void 0&&N>E&&(E=N)}A.push(E>0?E:1)}return A},[t,n,c]),D=v(()=>{if(c<3)return[];let A=[];for(let k=1;k<=s;k++){let w=x*k/s,E=[];for(let C=0;C<c;C++){let N=ln(C,c),T=cn(g,b,w,N);E.push(`${T.x},${T.y}`)}A.push(o("polygon",{key:`ring-${k}`,points:E.join(" "),fill:"none",stroke:h,"stroke-width":k===s?"1.5":"0.5","stroke-dasharray":k===s?"none":"3 2"}))}for(let k=0;k<c;k++){let w=ln(k,c),E=cn(g,b,x,w);A.push(o("line",{key:`spoke-${k}`,x1:String(g),y1:String(b),x2:String(E.x),y2:String(E.y),stroke:h,"stroke-width":"0.75"}))}return A},[c,s,x,g,b,h]),z=v(()=>{if(!a||c<3)return[];let A=[],k=16;for(let w=0;w<c;w++){let E=ln(w,c),C=cn(g,b,x+k,E),N="middle";C.x<g-5?N="end":C.x>g+5&&(N="start");let T=Math.abs(C.y-b)<5?"0.35em":C.y<b?"0em":"0.7em";A.push(o("text",{key:`label-${w}`,x:String(C.x),y:String(C.y),"text-anchor":N,dy:T,"font-size":"12","font-family":"sans-serif",fill:"currentColor"},t[w]?.label??`Axis ${w}`))}return A},[a,c,t,x,g,b]),M=v(()=>{if(c<3||n.length===0)return[];let A=[];for(let k=0;k<n.length;k++){let w=n[k],E=[],C=[],N=[];for(let T=0;T<c;T++){let W=w.values[T]??0,_=S[T],O=Math.min(W/_,1),U=x*O,K=ln(T,c),te=cn(g,b,U,K);E.push(`${te.x},${te.y}`),u&&C.push(o("circle",{key:`dot-${k}-${T}`,cx:String(te.x),cy:String(te.y),r:"3.5",fill:w.color,stroke:"#fff","stroke-width":"1.5"})),l&&N.push(o("text",{key:`val-${k}-${T}`,x:String(te.x),y:String(te.y-8),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:w.color},String(Math.round(W*100)/100)))}A.push(o("polygon",{key:`series-fill-${k}`,points:E.join(" "),fill:w.color,"fill-opacity":String(w.fillOpacity??.15),stroke:"none"})),A.push(o("polygon",{key:`series-line-${k}`,points:E.join(" "),fill:"none",stroke:w.color,"stroke-width":"2","stroke-linejoin":"round"}));for(let T of C)A.push(T);for(let T of N)A.push(T)}return A},[c,n,S,x,g,b,u,l]),$=v(()=>{if(!d||n.length===0)return[];let A=[],k=b+x+40,w=100,E=n.length*w,C=g-E/2;for(let N=0;N<n.length;N++){let T=n[N],W=C+N*w;A.push(o("rect",{key:`legend-swatch-${N}`,x:String(W),y:String(k),width:"12",height:"12",rx:"2",fill:T.color})),A.push(o("text",{key:`legend-text-${N}`,x:String(W+16),y:String(k+10),"font-size":"12","font-family":"sans-serif",fill:"currentColor"},T.label))}return A},[d,n,g,b,x]),L=v(()=>m?[o("text",{key:"title",x:String(r/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"currentColor"},m)]:[],[m,r]);if(c<3)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Radar chart \u2014 insufficient axes"},o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"currentColor",opacity:"0.6"},"Radar chart requires at least 3 axes."));let R=D(),P=z(),B=M(),I=$(),F=L();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Radar chart",style:{fontFamily:"sans-serif"}},...F,...R,...P,...B,...I)}var nu=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function ou(e,t){let n=new Map,r=new Map,i=new Map;for(let l of e)r.set(l,new Set),i.set(l,[]);for(let l of t){if(l.value<=0)continue;let d=r.get(l.target);d&&d.add(l.source);let u=i.get(l.source);u&&u.push(l.target)}let s=[];for(let l of e)r.get(l).size===0&&(n.set(l,0),s.push(l));if(s.length===0){for(let l of e)n.set(l,0);return n}let a=0;for(;a<s.length;){let l=s[a];a++;let d=n.get(l),u=i.get(l)??[];for(let h of u){let m=n.get(h),c=d+1;(m===void 0||c>m)&&n.set(h,c),s.includes(h)||s.push(h)}}for(let l of e)n.has(l)||n.set(l,0);return n}function ru(e,t,n,r,i,s,a,l){if(e.length===0)return{layoutNodes:[],layoutLinks:[]};let d=n-a*2,u=r-a*2,h=t.filter(P=>P.value>0),m=e.map(P=>P.id),c=ou(m,h),p=new Map,f=new Map;for(let P of m)p.set(P,0),f.set(P,0);for(let P of h)f.set(P.source,(f.get(P.source)??0)+P.value),p.set(P.target,(p.get(P.target)??0)+P.value);let y=0;for(let P of c.values())P>y&&(y=P);let x=new Map;for(let P=0;P<=y;P++)x.set(P,[]);for(let[P,B]of c)x.get(B).push(P);let g=new Map,b=y>0?(d-i)/y:0;for(let P=0;P<=y;P++)g.set(P,a+P*b);let S=new Map;for(let P=0;P<e.length;P++)S.set(e[P].id,e[P]);let D=[],z=new Map;for(let P=0;P<=y;P++){let B=x.get(P);if(B.length===0)continue;let I=0;for(let w of B){let E=p.get(w)??0,C=f.get(w)??0;I+=Math.max(E,C,1)}let F=u-s*(B.length-1),A=I>0?F/I:1,k=a;for(let w=0;w<B.length;w++){let E=B[w],C=S.get(E),N=p.get(E)??0,T=f.get(E)??0,W=Math.max(N,T,1),_=Math.max(4,W*A),O=e.findIndex(K=>K.id===E),U={id:E,label:C.label,color:C.color??l[O%l.length],column:P,x:g.get(P),y:k,height:_,totalIn:N,totalOut:T,totalValue:W};D.push(U),z.set(E,U),k+=_+s}}let M=new Map,$=new Map;for(let P of m)M.set(P,0),$.set(P,0);let L=[...h].sort((P,B)=>B.value-P.value),R=[];for(let P of L){let B=z.get(P.source),I=z.get(P.target);if(!B||!I)continue;let F=B.totalOut||1,A=I.totalIn||1,k=P.value/F*B.height,w=P.value/A*I.height,E=Math.max(1,(k+w)/2),C=M.get(P.source),N=$.get(P.target),T=B.y+C+k/2,W=I.y+N+w/2;M.set(P.source,C+k),$.set(P.target,N+w);let _=S.get(P.source);R.push({source:P.source,target:P.target,value:P.value,color:P.color??_?.color??B.color,sourceY:T,targetY:W,width:E})}return{layoutNodes:D,layoutLinks:R}}function Rs(e){let{nodes:t,links:n,width:r=800,height:i=500,nodeWidth:s=20,nodePadding:a=10,showLabels:l=!0,showValues:d=!1,linkOpacity:u=.4,colors:h=nu,title:m,padding:c=40}=e;if(!t||t.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Empty Sankey diagram"},o("text",{x:String(r/2),y:String(i/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#6b7280"},"No data"));let p=q(()=>ru(t,n,r,i,s,a,c,h),[t,n,r,i,s,a,c,h]),f=v(()=>{let D=[];for(let z=0;z<p.layoutLinks.length;z++){let M=p.layoutLinks[z],$=p.layoutNodes.find(F=>F.id===M.source),L=p.layoutNodes.find(F=>F.id===M.target);if(!$||!L)continue;let R=$.x+s,P=L.x,B=(R+P)/2,I=`M ${R} ${M.sourceY} C ${B} ${M.sourceY}, ${B} ${M.targetY}, ${P} ${M.targetY}`;D.push(o("path",{key:`link-${z}`,d:I,fill:"none",stroke:M.color,"stroke-width":String(Math.max(1,M.width)),"stroke-opacity":String(u),"stroke-linecap":"butt"})),d&&M.value>0&&D.push(o("text",{key:`link-val-${z}`,x:String(B),y:String((M.sourceY+M.targetY)/2-4),"text-anchor":"middle","font-size":"9","font-family":"sans-serif",fill:"#6b7280","pointer-events":"none"},String(M.value)))}return D},[p,s,u,d]),y=v(()=>{let D=[];for(let z=0;z<p.layoutNodes.length;z++){let M=p.layoutNodes[z];if(D.push(o("rect",{key:`node-${M.id}`,x:String(M.x),y:String(M.y),width:String(s),height:String(M.height),fill:M.color,stroke:"#374151","stroke-width":"0.5",role:"img","aria-label":`${M.label}: ${M.totalValue}`})),l){let $=p.layoutNodes.reduce((A,k)=>Math.max(A,k.column),0),L=M.column===$,R=L?M.x+s+6:M.x-6,P=L?"start":"end",B=M.column===0,I=B?M.x-6:R,F=B?"end":P;D.push(o("text",{key:`label-${M.id}`,x:String(I),y:String(M.y+M.height/2+4),"text-anchor":F,"font-size":"11","font-family":"sans-serif",fill:"#374151","pointer-events":"none"},M.label))}}return D},[p,s,l]),x=v(()=>m?[o("text",{key:"title",x:String(r/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,r,c]),g=f(),b=y(),S=x();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Sankey diagram",style:{fontFamily:"sans-serif"}},...S,...g,...b)}var iu=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],to=2*Math.PI;function Ft(e){if(!e.children||e.children.length===0)return Math.max(0,e.value??0);let t=0,n=[e];for(;n.length>0;){let r=n.pop();if(!r.children||r.children.length===0)t+=Math.max(0,r.value??0);else for(let i=r.children.length-1;i>=0;i--)n.push(r.children[i])}return t}function su(e){let t=0,n=[{node:e,depth:0}];for(;n.length>0;){let{node:r,depth:i}=n.pop();if(i>t&&(t=i),r.children)for(let s=r.children.length-1;s>=0;s--)n.push({node:r.children[s],depth:i+1})}return t}function au(e,t,n,r,i,s){let a=s-i,l=a>Math.PI?1:0,d=i-Math.PI/2,u=s-Math.PI/2,h=e+r*Math.cos(d),m=t+r*Math.sin(d),c=e+r*Math.cos(u),p=t+r*Math.sin(u),f=e+n*Math.cos(u),y=t+n*Math.sin(u),x=e+n*Math.cos(d),g=t+n*Math.sin(d);if(a>=to-.001){let b=d+Math.PI,S=e+r*Math.cos(b),D=t+r*Math.sin(b),z=e+n*Math.cos(b),M=t+n*Math.sin(b);return[`M ${h} ${m}`,`A ${r} ${r} 0 1 1 ${S} ${D}`,`A ${r} ${r} 0 1 1 ${h} ${m}`,`L ${x} ${g}`,`A ${n} ${n} 0 1 0 ${z} ${M}`,`A ${n} ${n} 0 1 0 ${x} ${g}`,"Z"].join(" ")}return[`M ${h} ${m}`,`A ${r} ${r} 0 ${l} 1 ${c} ${p}`,`L ${f} ${y}`,`A ${n} ${n} 0 ${l} 0 ${x} ${g}`,"Z"].join(" ")}function lu(e,t,n,r){let i=[],s=Ft(e);if(s<=0)return i;let a=su(e),l=a>0?(n-t)/(a+1):n-t,d=[];if(e.children&&e.children.length>0){let u=0;for(let h=0;h<e.children.length;h++){let m=e.children[h],c=Ft(m);if(c<=0)continue;let p=c/s*to;d.push({node:m,startAngle:u,endAngle:u+p,depth:0,colorIndex:h}),u+=p}}else return i.push({startAngle:0,endAngle:to,innerR:t,outerR:t+l,label:e.label,value:s,color:e.color??r[0],depth:0}),i;for(;d.length>0;){let u=d.shift(),{node:h,startAngle:m,endAngle:c,depth:p,colorIndex:f}=u,y=Ft(h);if(y<=0)continue;let x=t+p*l,g=x+l;if(i.push({startAngle:m,endAngle:c,innerR:x,outerR:g,label:h.label,value:y,color:h.color??r[f%r.length],depth:p}),h.children&&h.children.length>0){let b=m,S=c-m;for(let D=0;D<h.children.length;D++){let z=h.children[D],M=Ft(z);if(M<=0)continue;let $=M/y*S;d.push({node:z,startAngle:b,endAngle:b+$,depth:p+1,colorIndex:f}),b+=$}}}return i}function Ps(e){let{data:t,width:n=500,height:r=500,innerRadius:i=40,showLabels:s=!0,colors:a=iu,strokeColor:l="#ffffff",strokeWidth:d=1,title:u}=e,h=n/2,m=r/2,c=u?20:0,p=Math.min(h,m-c)-10;if(q(()=>Ft(t),[t])<=0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":u??"Empty sunburst chart"},o("text",{x:String(h),y:String(m),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data to display"));let y=q(()=>lu(t,i,p,a),[t,i,p,a]),x=[];u&&x.push(o("text",{key:"title",x:String(h),y:String(20),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},u));let g=m+c/2;for(let b=0;b<y.length;b++){let S=y[b],D=au(h,g,S.innerR,S.outerR,S.startAngle,S.endAngle);if(x.push(o("path",{key:`arc-${b}`,d:D,fill:S.color,stroke:l,"stroke-width":String(d),role:"graphics-symbol","aria-label":`${S.label}: ${S.value}`})),s){let z=S.endAngle-S.startAngle,M=S.startAngle+z/2-Math.PI/2,$=(S.innerR+S.outerR)/2,L=S.outerR-S.innerR,R=z*$;if(R>20&&L>14){let P=h+$*Math.cos(M),B=g+$*Math.sin(M),I=Math.floor(Math.min(R,L)/7),F=S.label.length>I?S.label.substring(0,Math.max(1,I-1))+"..":S.label;x.push(o("text",{key:`label-${b}`,x:String(P),y:String(B+4),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#ffffff","pointer-events":"none"},F))}}}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":u??"Sunburst chart",style:{fontFamily:"sans-serif"}},...x)}var cu=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"];function dn(e){if(!e.children||e.children.length===0)return Math.max(0,e.value);let t=0,n=[e];for(;n.length>0;){let r=n.pop();if(!r.children||r.children.length===0)t+=Math.max(0,r.value);else for(let i=r.children.length-1;i>=0;i--)n.push(r.children[i])}return t}function $s(e,t){if(e.length===0||t<=0)return 1/0;let n=0;for(let s of e)n+=s;if(n<=0)return 1/0;let r=n/t,i=0;for(let s of e){if(s<=0)continue;let a=s/r,l=Math.max(a/r,r/a);l>i&&(i=l)}return i}function du(e,t,n,r,i,s){let a=[],l=[],d=dn(e);if(d<=0||r<=0||i<=0)return a;let u=e.children&&e.children.length>0?e.children:[e],h=r*i,m=[];for(let c=0;c<u.length;c++){let p=u[c],f=dn(p);f<=0||m.push({label:p.label,value:f,area:f/d*h,color:p.color??s[c%s.length],node:p})}for(m.sort((c,p)=>p.area-c.area),l.push({nodes:m,rect:{x:t,y:n,w:r,h:i},depth:0});l.length>0;){let c=l.shift(),{nodes:p,rect:f,depth:y}=c;if(p.length===0)continue;let x={...f},g=0;for(;g<p.length&&x.w>0&&x.h>0;){let b=x.w>=x.h,S=b?x.h:x.w,D=[],z=[];D.push(p[g]),z.push(p[g].area),g++;let M=$s(z,S);for(;g<p.length;){let P=[...z,p[g].area],B=$s(P,S);if(B>M)break;D.push(p[g]),z.push(p[g].area),M=B,g++}let $=0;for(let P of z)$+=P;let L=S>0?$/S:0,R=0;for(let P=0;P<D.length;P++){let B=D[P],I=L>0?B.area/L:0,F,A,k,w;if(b?(F=x.x,A=x.y+R,k=L,w=I):(F=x.x+R,A=x.y,k=I,w=L),a.push({x:F,y:A,w:k,h:w,label:B.label,value:B.value,color:B.color,depth:y}),B.node.children&&B.node.children.length>0){let C=F+2,N=A+2+14,T=k-4,W=w-4-14;if(T>4&&W>4){let _=[],O=B.value,U=T*W;for(let K=0;K<B.node.children.length;K++){let te=B.node.children[K],J=dn(te);J<=0||_.push({label:te.label,value:J,area:J/O*U,color:te.color??s[(K+y+1)%s.length],node:te})}_.sort((K,te)=>te.area-K.area),l.push({nodes:_,rect:{x:C,y:N,w:T,h:W},depth:y+1})}}R+=I}b?x={x:x.x+L,y:x.y,w:x.w-L,h:x.h}:x={x:x.x,y:x.y+L,w:x.w,h:x.h-L}}}return a}function Ts(e){let{data:t,width:n=600,height:r=400,showLabels:i=!0,showValues:s=!0,colors:a=cu,borderColor:l="#ffffff",borderWidth:d=2,padding:u=2,title:h}=e,m=h?30:0,c=u,p=u+m,f=n-u*2,y=r-u*2-m;if(q(()=>dn(t),[t])<=0||f<=0||y<=0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Empty treemap"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data to display"));let g=q(()=>du(t,c,p,f,y,a),[t,c,p,f,y,a]),b=[];h&&b.push(o("text",{key:"title",x:String(n/2),y:String(u+16),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},h));for(let S=0;S<g.length;S++){let D=g[S];if(b.push(o("rect",{key:`cell-${S}`,x:String(D.x),y:String(D.y),width:String(Math.max(0,D.w)),height:String(Math.max(0,D.h)),fill:D.color,stroke:l,"stroke-width":String(d),role:"graphics-symbol","aria-label":`${D.label}: ${D.value}`})),i&&D.w>20&&D.h>14){let z=Math.floor(D.w/7),M=D.label.length>z?D.label.substring(0,Math.max(1,z-2))+"..":D.label;b.push(o("text",{key:`label-${S}`,x:String(D.x+4),y:String(D.y+12),"font-size":"11","font-family":"sans-serif",fill:"#ffffff","pointer-events":"none"},M))}s&&D.w>30&&D.h>28&&b.push(o("text",{key:`value-${S}`,x:String(D.x+4),y:String(D.y+24),"font-size":"10","font-family":"sans-serif",fill:"rgba(255,255,255,0.8)","pointer-events":"none"},String(D.value)))}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":h??"Treemap chart",style:{fontFamily:"sans-serif"}},...b)}function Ds(e){let t=e.replace("#",""),n,r,i;return t.length===3?(n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16)):(n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16)),{r:isNaN(n)?0:n,g:isNaN(r)?0:r,b:isNaN(i)?0:i}}function uu(e,t,n){let r=s=>Math.max(0,Math.min(255,Math.round(s))),i=s=>r(s).toString(16).padStart(2,"0");return"#"+i(e)+i(t)+i(n)}function zs(e,t){if(t.length===0)return"#3b82f6";if(t.length===1)return t[0];let n=Math.max(0,Math.min(1,e)),r=t.length-1,i=n*r,s=Math.floor(i),a=Math.min(s+1,r),l=i-s,d=Ds(t[s]),u=Ds(t[a]);return uu(d.r+(u.r-d.r)*l,d.g+(u.g-d.g)*l,d.b+(u.b-d.b)*l)}function un(e,t){if(e<=0)return 1;let n=e/t,r=Math.pow(10,Math.floor(Math.log10(n))),i=n/r;return i<=1.5?r:i<=3.5?2*r:i<=7.5?5*r:10*r}function pu(e,t,n,r,i,s,a,l,d,u){if(e&&e.length>0)return e;let h=Math.max(2,Math.min(50,r)),m=d/(h-1),c=u/(h-1);if(n){let f=[];for(let b=0;b<h;b++)for(let S=0;S<h;S++)f.push({x:i+S*m,y:a+b*c});let x=n(f,{gridSize:h,xMin:i,xMax:s,yMin:a,yMax:l}),g=[];for(let b=0;b<f.length;b++){let S=f[b],D=x[b]??{dx:0,dy:0},z=Math.sqrt(D.dx*D.dx+D.dy*D.dy);g.push({x:S.x,y:S.y,dx:D.dx,dy:D.dy,magnitude:z})}return g}if(!t)return[];let p=[];for(let f=0;f<h;f++)for(let y=0;y<h;y++){let x=i+y*m,g=a+f*c,b=t(x,g),S=Math.sqrt(b.dx*b.dx+b.dy*b.dy);p.push({x,y:g,dx:b.dx,dy:b.dy,magnitude:S})}return p}function fu(e,t,n,r,i){let{padding:s,chartWidth:a,chartHeight:l,xMin:d,xMax:u,yMin:h,yMax:m,xSpan:c,ySpan:p,showGrid:f,showAxes:y,colorByMagnitude:x,colorScale:g,arrowColor:b,arrowWidth:S,effectiveArrowScale:D,maxMagnitude:z,title:M,tickFontSize:$}=i,L=B=>s+(B-d)/c*a,R=B=>s+(m-B)/p*l;if(e.clearRect(0,0,t,n),M&&(e.save(),e.font="bold 16px sans-serif",e.fillStyle="#111827",e.textAlign="center",e.textBaseline="middle",e.fillText(M,t/2,s/2+4),e.restore()),f){e.save(),e.strokeStyle="#e5e7eb",e.lineWidth=.5,e.font=`${$}px sans-serif`,e.fillStyle="#6b7280";let B=un(c,10),I=Math.ceil(d/B)*B;for(let k=I;k<=u;k+=B){let w=L(k);e.beginPath(),e.moveTo(w,s),e.lineTo(w,s+l),e.stroke(),e.textAlign="center",e.textBaseline="top",e.fillText(String(Math.round(k*100)/100),w,s+l+4)}let F=un(p,10),A=Math.ceil(h/F)*F;for(let k=A;k<=m;k+=F){let w=R(k);e.beginPath(),e.moveTo(s,w),e.lineTo(s+a,w),e.stroke(),e.textAlign="right",e.textBaseline="middle",e.fillText(String(Math.round(k*100)/100),s-6,w)}e.restore()}if(y){if(e.save(),e.strokeStyle="#374151",e.lineWidth=S,h<=0&&m>=0){let B=R(0);e.beginPath(),e.moveTo(s,B),e.lineTo(s+a,B),e.stroke()}if(d<=0&&u>=0){let B=L(0);e.beginPath(),e.moveTo(B,s),e.lineTo(B,s+l),e.stroke()}e.strokeStyle="#d1d5db",e.lineWidth=1,e.strokeRect(s,s,a,l),e.restore()}let P=4;for(let B=0;B<r.length;B++){let I=r[B],F=I.magnitude??Math.sqrt(I.dx*I.dx+I.dy*I.dy);if(F<1e-10)continue;let A=L(I.x),k=R(I.y),w=I.dx*D,E=-I.dy*D,C=A+w,N=k+E,T;if(x){let _=F/z;T=zs(_,g)}else T=b;e.save(),e.strokeStyle=T,e.lineWidth=S,e.lineCap="round",e.beginPath(),e.moveTo(A,k),e.lineTo(C,N),e.stroke();let W=Math.sqrt(w*w+E*E);if(W>2){let _=w/W,O=E/W,U=-O,K=_,te=Math.min(P,W*.4),J=C-_*te+U*te*.5,V=N-O*te+K*te*.5,j=C-_*te-U*te*.5,Y=N-O*te-K*te*.5;e.fillStyle=T,e.beginPath(),e.moveTo(C,N),e.lineTo(J,V),e.lineTo(j,Y),e.closePath(),e.fill()}e.restore()}}function As(e){let{data:t,vectorFunction:n,width:r=600,height:i=600,gridSize:s=15,xRange:a=[-5,5],yRange:l=[-5,5],arrowScale:d=1,arrowColor:u="#3b82f6",showGrid:h=!0,showAxes:m=!0,colorByMagnitude:c=!1,colorScale:p=["#3b82f6","#8b5cf6","#ef4444"],title:f,padding:y=50,tickFontSize:x=10,arrowWidth:g=1.5,renderer:b="svg",useGPU:S=!1,computeWorker:D}=e,z=Math.max(2,Math.min(50,s)),M=r-y*2,$=i-y*2,L=a[0],R=a[1],P=l[0],B=l[1],I=R-L,F=B-P,A=q(()=>J=>y+(J-L)/I*M,[y,L,I,M]),k=q(()=>J=>y+(B-J)/F*$,[y,B,F,$]),w=q(()=>pu(t,n,D,z,L,R,P,B,I,F),[t,n,D,z,L,R,P,B,I,F]),E=q(()=>{let J=0;for(let V=0;V<w.length;V++){let j=w[V],Y=j.magnitude??Math.sqrt(j.dx*j.dx+j.dy*j.dy);Y>J&&(J=Y)}return J>0?J:1},[w]),C=q(()=>Math.min(M,$)/Math.max(z,2)/(2*E)*d,[M,$,z,E,d]);if(b==="canvas"){let J=oe(null),V=oe(0);return ae(()=>{let j=J.current;if(!j)return;let Y=j.getContext("2d");if(Y)return V.current&&cancelAnimationFrame(V.current),V.current=requestAnimationFrame(()=>{fu(Y,r,i,w,{padding:y,chartWidth:M,chartHeight:$,xMin:L,xMax:R,yMin:P,yMax:B,xSpan:I,ySpan:F,showGrid:h,showAxes:m,colorByMagnitude:c,colorScale:p,arrowColor:u,arrowWidth:g,effectiveArrowScale:C,maxMagnitude:E,title:f,tickFontSize:x})}),()=>{V.current&&cancelAnimationFrame(V.current)}},[w,r,i,y,M,$,L,R,P,B,I,F,h,m,c,p,u,g,C,E,f,x]),o("canvas",{ref:J,width:r,height:i,role:"img","aria-label":f??"Vector field plot",style:{fontFamily:"sans-serif",maxWidth:"100%"}})}let N=v(()=>{if(!h)return[];let J=[],V=un(I,10),j=Math.ceil(L/V)*V;for(let Z=j;Z<=R;Z+=V){let ee=A(Z);J.push(o("line",{key:`gridv-${Z}`,x1:String(ee),y1:String(y),x2:String(ee),y2:String(y+$),stroke:"#e5e7eb","stroke-width":"0.5"})),J.push(o("text",{key:`xtick-${Z}`,x:String(ee),y:String(y+$+16),"text-anchor":"middle","font-size":String(x),"font-family":"sans-serif",fill:"#6b7280"},String(Math.round(Z*100)/100)))}let Y=un(F,10),H=Math.ceil(P/Y)*Y;for(let Z=H;Z<=B;Z+=Y){let ee=k(Z);J.push(o("line",{key:`gridh-${Z}`,x1:String(y),y1:String(ee),x2:String(y+M),y2:String(ee),stroke:"#e5e7eb","stroke-width":"0.5"})),J.push(o("text",{key:`ytick-${Z}`,x:String(y-6),y:String(ee+4),"text-anchor":"end","font-size":String(x),"font-family":"sans-serif",fill:"#6b7280"},String(Math.round(Z*100)/100)))}return J},[h,L,R,P,B,I,F,A,k,y,M,$]),T=v(()=>{if(!m)return[];let J=[];if(P<=0&&B>=0){let V=k(0);J.push(o("line",{key:"axis-x",x1:String(y),y1:String(V),x2:String(y+M),y2:String(V),stroke:"#374151","stroke-width":String(g)}))}if(L<=0&&R>=0){let V=A(0);J.push(o("line",{key:"axis-y",x1:String(V),y1:String(y),x2:String(V),y2:String(y+$),stroke:"#374151","stroke-width":String(g)}))}return J.push(o("rect",{key:"chart-border",x:String(y),y:String(y),width:String(M),height:String($),fill:"none",stroke:"#d1d5db","stroke-width":"1"})),J},[m,L,R,P,B,A,k,y,M,$]),W=v(()=>{let J=[];for(let j=0;j<w.length;j++){let Y=w[j],H=Y.magnitude??Math.sqrt(Y.dx*Y.dx+Y.dy*Y.dy);if(H<1e-10)continue;let Z=A(Y.x),ee=k(Y.y),se=Y.dx*C,Q=-Y.dy*C,le=Z+se,ce=ee+Q,ue;if(c){let ge=H/E;ue=zs(ge,p)}else ue=u;J.push(o("line",{key:`arrow-line-${j}`,x1:String(Z),y1:String(ee),x2:String(le),y2:String(ce),stroke:ue,"stroke-width":String(g),"stroke-linecap":"round"}));let re=Math.sqrt(se*se+Q*Q);if(re>2){let ge=se/re,me=Q/re,ne=-me,de=ge,fe=Math.min(4,re*.4),xe=le-ge*fe+ne*fe*.5,ye=ce-me*fe+de*fe*.5,we=le-ge*fe-ne*fe*.5,X=ce-me*fe-de*fe*.5;J.push(o("polygon",{key:`arrow-head-${j}`,points:`${le},${ce} ${xe},${ye} ${we},${X}`,fill:ue}))}}return J},[w,A,k,C,c,E,p,u]),_=v(()=>f?[o("text",{key:"title",x:String(r/2),y:String(y/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},f)]:[],[f,r,y]),O=N(),U=T(),K=W(),te=_();return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":f??"Vector field plot",style:{fontFamily:"sans-serif"}},...te,...O,...U,...K)}function gu(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e[r],s=i.type??(i.value>=0?"increase":"decrease");if(s==="total")t.push({label:i.label,value:n,type:"total",start:0,end:n});else{let a=n;n+=i.value,t.push({label:i.label,value:i.value,type:s,start:a,end:n})}}return t}function mu(e){if(e<=0)return 1;let t=e/5,n=Math.pow(10,Math.floor(Math.log10(t))),r=t/n;return r<=1.5?n:r<=3.5?2*n:r<=7.5?5*n:10*n}function Ls(e){let{data:t=[],width:n=600,height:r=400,increaseColor:i="#10b981",decreaseColor:s="#ef4444",totalColor:a="#3b82f6",connectorColor:l="#94a3b8",showValues:d=!0,showGrid:u=!0,showConnectors:h=!0,title:m,padding:c=60}=e,p=n-c*2,f=r-c*2,y=q(()=>gu(t),[t]),{minVal:x,maxVal:g}=q(()=>{let E=0,C=0;for(let N=0;N<y.length;N++){let T=y[N];T.start<E&&(E=T.start),T.end<E&&(E=T.end),T.start>C&&(C=T.start),T.end>C&&(C=T.end)}return E===C&&(C=E+1),{minVal:E,maxVal:C}},[y]),b=g-x,S=v(E=>c+f-(E-x)/b*f,[c,f,x,b]),D=q(()=>y.length===0?0:p/y.length,[y.length,p]),z=6,M=Math.max(1,D-z),$=v(()=>{if(!u)return[];let E=mu(b),C=[],N=Math.ceil(x/E)*E;for(let T=N;T<=g;T+=E){let W=S(T);C.push(o("line",{key:`grid-${T}`,x1:String(c),y1:String(W),x2:String(c+p),y2:String(W),stroke:"#e5e7eb","stroke-width":"1","stroke-dasharray":"4 2"})),C.push(o("text",{key:`grid-label-${T}`,x:String(c-8),y:String(W+4),"text-anchor":"end","font-size":"11","font-family":"sans-serif",fill:"#6b7280"},String(T)))}return C},[u,b,x,g,S,c,p]),L=v(()=>{let E=[];E.push(o("line",{key:"axis-y",x1:String(c),y1:String(c),x2:String(c),y2:String(c+f),stroke:"#374151","stroke-width":"1.5"}));let C=x<=0&&g>=0?S(0):c+f;return E.push(o("line",{key:"axis-x",x1:String(c),y1:String(C),x2:String(c+p),y2:String(C),stroke:"#374151","stroke-width":"1.5"})),E},[c,p,f,x,g,S]),R=v(()=>{if(y.length===0)return[];let E=[];for(let C=0;C<y.length;C++){let N=y[C],T=c+C*D+z/2,W=Math.max(N.start,N.end),_=Math.min(N.start,N.end),O=S(W),U=S(_),K=Math.max(0,U-O),te;if(N.type==="total"?te=a:N.type==="decrease"?te=s:te=i,E.push(o("rect",{key:`bar-${C}`,x:String(T),y:String(O),width:String(M),height:String(K),fill:te,rx:"2",ry:"2"})),d){let J=N.type==="decrease"||N.value<0?U+14:O-4,V=N.type==="total"?String(N.value):(N.value>=0?"+":"")+String(N.value);E.push(o("text",{key:`val-${C}`,x:String(T+M/2),y:String(J),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},V))}if(E.push(o("text",{key:`cat-${C}`,x:String(T+M/2),y:String(c+f+16),"text-anchor":"middle","font-size":"10","font-family":"sans-serif",fill:"#374151"},N.label)),h&&C<y.length-1){let J=y[C+1],V=S(N.end),j=c+(C+1)*D+z/2;J.type!=="total"&&E.push(o("line",{key:`conn-${C}`,x1:String(T+M),y1:String(V),x2:String(j),y2:String(V),stroke:l,"stroke-width":"1","stroke-dasharray":"3 2"}))}}return E},[y,D,M,S,i,s,a,l,d,h,c,f]),P=v(()=>m?[o("text",{key:"title",x:String(n/2),y:String(c/2+4),"text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":"sans-serif",fill:"#111827"},m)]:[],[m,n,c]),B=v(()=>t.length>0?[]:[o("text",{key:"empty",x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":"sans-serif",fill:"#9ca3af"},"No data")],[t.length,n,r]),I=$(),F=L(),A=R(),k=P(),w=B();return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Waterfall chart",style:{fontFamily:"sans-serif"}},...k,...I,...F,...A,...w)}var hu=["#3b82f6","#ef4444","#22c55e","#f59e0b","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1","#84cc16"],bu=[0,-45,45,90];function xu(e,t,n,r,i){let s=t*.6,a=e.length*s,l=t,d=n*Math.PI/180,u=Math.abs(Math.cos(d)),h=Math.abs(Math.sin(d)),m=a*u+l*h,c=a*h+l*u;return{x:r-m/2,y:i-c/2,w:m,h:c}}function yu(e,t){return!(e.x+e.w<t.x||t.x+t.w<e.x||e.y+e.h<t.y||t.y+t.h<e.y)}function Su(e,t,n){return e.x>=0&&e.y>=0&&e.x+e.w<=t&&e.y+e.h<=n}function vu(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function Bs(e){let{words:t=[],width:n=600,height:r=400,minFontSize:i=10,maxFontSize:s=64,fontFamily:a="sans-serif",colors:l=hu,rotations:d=bu,padding:u=4,spiral:h="archimedean",title:m}=e,c=q(()=>{if(t.length===0)return[];let f=t.map((M,$)=>({...M,originalIndex:$})).filter(M=>M.text.length>0&&M.weight>0).sort((M,$)=>$.weight-M.weight);if(f.length===0)return[];let y=f[f.length-1].weight,g=f[0].weight-y;function b(M){if(g===0)return(i+s)/2;let $=(M-y)/g;return i+$*(s-i)}let S=[],D=n/2,z=r/2;for(let M=0;M<f.length;M++){let $=f[M],L=b($.weight),R=d[vu($.text)%d.length],P=$.color??l[M%l.length],B=!1,I=500,F=h==="archimedean"?4:5;for(let A=0;A<I;A++){let k,w;if(h==="archimedean"){let _=A*.1,O=F*_;k=O*Math.cos(_),w=O*Math.sin(_)}else{let _=Math.floor(A/4)+1,O=A%4,U=(A%4===0?0:A)*F;switch(O){case 0:k=_*F*4,w=U;break;case 1:k=-U,w=_*F*4;break;case 2:k=-_*F*4,w=-U;break;default:k=U,w=-_*F*4;break}}let E=D+k,C=z+w,N=xu($.text,L,R,E,C),T={x:N.x-u,y:N.y-u,w:N.w+u*2,h:N.h+u*2};if(!Su(T,n,r))continue;let W=!1;for(let _ of S)if(yu(T,_.bbox)){W=!0;break}if(!W){S.push({text:$.text,x:E,y:C,fontSize:L,rotation:R,color:P,bbox:T}),B=!0;break}}}return S},[t,n,r,i,s,l,d,u,h]);if(t.length===0||c.length===0)return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Word cloud \u2014 no data"},o("text",{x:String(n/2),y:String(r/2),"text-anchor":"middle","font-size":"14","font-family":a,fill:"currentColor",opacity:"0.6"},"No words to display."));let p=[];m&&p.push(o("text",{key:"title",x:String(n/2),y:"24","text-anchor":"middle","font-size":"16","font-weight":"bold","font-family":a,fill:"currentColor"},m));for(let f=0;f<c.length;f++){let y=c[f],x=y.rotation!==0?`translate(${y.x},${y.y}) rotate(${y.rotation})`:`translate(${y.x},${y.y})`;p.push(o("text",{key:`word-${f}`,transform:x,"text-anchor":"middle","dominant-baseline":"central","font-size":String(y.fontSize),"font-family":a,fill:y.color,"aria-label":y.text},y.text))}return o("svg",{width:"100%",viewBox:`0 0 ${n} ${r}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":m??"Word cloud",style:{fontFamily:a}},...p)}var wu={0:"#1e293b",1:"#3b82f6"},ku="#666";function Fs(e){let{data:t=[],colorMap:n,width:r=600,height:i=600,cellGap:s=1,cellRadius:a=0,showGrid:l=!1,gridColor:d="#334155",showIndices:u=!1,backgroundColor:h="#0f172a",padding:m=10,onCellClick:c,onCellHover:p,title:f}=e,y=n??wu,x=t.length,g=q(()=>{let E=0;for(let C=0;C<t.length;C++){let N=t[C];N!==void 0&&N.length>E&&(E=N.length)}return E},[t]),b=u?20:0,S=f?24:0,D=q(()=>{let E=r-m*2-b,C=i-m*2-b-S;if(x===0||g===0)return{cellWidth:0,cellHeight:0};let N=Math.max(0,(E-s*(g-1))/g),T=Math.max(0,(C-s*(x-1))/x);return{cellWidth:N,cellHeight:T}},[r,i,m,x,g,s,b,S]),z=v(E=>{let C=y[E];return C!==void 0?C:ku},[y]),M=v(()=>o("rect",{key:"bg",x:"0",y:"0",width:String(r),height:String(i),fill:h}),[r,i,h]),$=v(()=>f?[o("text",{key:"title",x:String(r/2),y:String(m+14),"text-anchor":"middle","font-size":"14","font-weight":"bold","font-family":"sans-serif",fill:"#e2e8f0"},f)]:[],[f,r,m]),L=v(()=>{if(!l||x===0||g===0)return[];let{cellWidth:E,cellHeight:C}=D,N=m+b,T=m+b+S,W=g*E+(g-1)*s,_=x*C+(x-1)*s,O=[];for(let U=0;U<=g;U++){let K=N+U*(E+s)-s/2;O.push(o("line",{key:`vgrid-${U}`,x1:String(K),y1:String(T-s/2),x2:String(K),y2:String(T+_+s/2),stroke:d,"stroke-width":"0.5"}))}for(let U=0;U<=x;U++){let K=T+U*(C+s)-s/2;O.push(o("line",{key:`hgrid-${U}`,x1:String(N-s/2),y1:String(K),x2:String(N+W+s/2),y2:String(K),stroke:d,"stroke-width":"0.5"}))}return O},[l,x,g,D,m,b,S,s,d]),R=v(()=>{if(!u||x===0||g===0)return[];let{cellWidth:E,cellHeight:C}=D,N=m+b,T=m+b+S,W=[];for(let _=0;_<g;_++){let O=N+_*(E+s)+E/2,U=T-6;W.push(o("text",{key:`col-idx-${_}`,x:String(O),y:String(U),"text-anchor":"middle","font-size":"10","font-family":"monospace",fill:"#94a3b8"},String(_)))}for(let _=0;_<x;_++){let O=N-6,U=T+_*(C+s)+C/2+3;W.push(o("text",{key:`row-idx-${_}`,x:String(O),y:String(U),"text-anchor":"end","font-size":"10","font-family":"monospace",fill:"#94a3b8"},String(_)))}return W},[u,x,g,D,m,b,S,s]),P=v(()=>{if(x===0||g===0)return[];let{cellWidth:E,cellHeight:C}=D,N=m+b,T=m+b+S,W=[];for(let _=0;_<x;_++){let O=t[_];if(O!==void 0)for(let U=0;U<g;U++){let K=U<O.length?O[U]:0,te=N+U*(E+s),J=T+_*(C+s),V=z(K),j={key:`cell-${_}-${U}`,x:String(te),y:String(J),width:String(E),height:String(C),fill:V,rx:String(a),ry:String(a)};if(c){let Y=_,H=U,Z=K;j.onClick=()=>c(Y,H,Z),j.role="button",j.tabIndex=0}if(p){let Y=_,H=U,Z=K;j.onMouseEnter=()=>p(Y,H,Z)}W.push(o("rect",j))}}return W},[x,g,t,D,m,b,S,s,a,z,c,p]),B=M(),I=$(),F=L(),A=R(),k=P(),w=f?`${f} \u2014 ${x}x${g} discrete grid`:`${x}x${g} discrete grid`;return o("svg",{width:"100%",viewBox:`0 0 ${r} ${i}`,preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":w},B,...I,...F,...A,...k)}
|