@mickyballadelli/react-things 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,6 +29,7 @@ export function Example() {
29
29
  - GlassBox
30
30
  - DraggableBox
31
31
  - CodeViewer
32
+ - DataCardGrid
32
33
  - DockBar
33
34
  - CommandPalette
34
35
  - SplitPane
@@ -41,6 +42,7 @@ export function Example() {
41
42
  - SmartTooltip
42
43
  - ResizableFrame
43
44
  - InspectorPanel
45
+ - KanbanBoard
44
46
  - ColorPicker
45
47
  - TimelineScrubber
46
48
  - FileDropZone
@@ -0,0 +1,28 @@
1
+ import type { BoxProps } from '@mui/material/Box';
2
+ import type { ReactNode } from 'react';
3
+ export type DataCardGridStatus = 'neutral' | 'good' | 'warning' | 'danger';
4
+ export type DataCardGridMetric = {
5
+ id: string;
6
+ label: string;
7
+ value: number | string;
8
+ previousValue?: number;
9
+ delta?: number;
10
+ helper?: string;
11
+ unit?: string;
12
+ color?: string;
13
+ status?: DataCardGridStatus;
14
+ progress?: number;
15
+ trend?: number[];
16
+ icon?: ReactNode;
17
+ formatter?: (value: number | string) => string;
18
+ };
19
+ export type DataCardGridProps = BoxProps & {
20
+ metrics: DataCardGridMetric[];
21
+ title?: string;
22
+ subtitle?: string;
23
+ columns?: number;
24
+ density?: 'comfortable' | 'compact';
25
+ showSparklines?: boolean;
26
+ showProgress?: boolean;
27
+ };
28
+ export declare function DataCardGrid({ metrics, title, subtitle, columns, density, showSparklines, showProgress, sx, ...props }: DataCardGridProps): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import type { BoxProps } from '@mui/material/Box';
2
+ export type KanbanCard = {
3
+ id: string;
4
+ title: string;
5
+ description?: string;
6
+ tags?: string[];
7
+ color?: string;
8
+ data?: unknown;
9
+ };
10
+ export type KanbanColumn = {
11
+ id: string;
12
+ title: string;
13
+ cards: KanbanCard[];
14
+ color?: string;
15
+ };
16
+ export type KanbanBoardProps = Omit<BoxProps, 'onChange'> & {
17
+ columns?: KanbanColumn[];
18
+ defaultColumns?: KanbanColumn[];
19
+ title?: string;
20
+ subtitle?: string;
21
+ density?: 'comfortable' | 'compact';
22
+ allowColumnDrag?: boolean;
23
+ onChange?: (columns: KanbanColumn[]) => void;
24
+ onCardSelect?: (card: KanbanCard, column: KanbanColumn) => void;
25
+ };
26
+ export declare function KanbanBoard({ columns, defaultColumns, title, subtitle, density, allowColumnDrag, onChange, onCardSelect, sx, ...props }: KanbanBoardProps): import("react").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -36,3 +36,7 @@ export type { InfiniteCanvasItem, InfiniteCanvasProps, InfiniteCanvasViewport }
36
36
  export { InfiniteCanvas } from './components/InfiniteCanvas';
37
37
  export type { SmartTooltipAction, SmartTooltipProps } from './components/SmartTooltip';
38
38
  export { SmartTooltip } from './components/SmartTooltip';
39
+ export type { DataCardGridMetric, DataCardGridProps, DataCardGridStatus } from './components/DataCardGrid';
40
+ export { DataCardGrid } from './components/DataCardGrid';
41
+ export type { KanbanBoardProps, KanbanCard, KanbanColumn } from './components/KanbanBoard';
42
+ export { KanbanBoard } from './components/KanbanBoard';
@@ -1,24 +1,24 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),K=require("@mui/material"),b=require("react"),p=require("@mui/material/Box"),F=require("@mui/material/styles"),ne=require("@mui/material/Tooltip"),q=require("@mui/material/Typography"),De=require("@mui/material/Collapse"),We=require("@mui/material/InputBase"),Ee=require("@mui/material/List"),$e=require("@mui/material/ListItemButton"),Xe=require("@mui/material/ListItemIcon"),Ce=require("@mui/material/ListItemText"),qe=require("@mui/icons-material/AddBox"),Ye=require("@mui/icons-material/AddLink"),Fe=require("@mui/icons-material/Close"),Ne=require("@mui/icons-material/Delete"),Oe=require("@mui/icons-material/LinkOff"),ce=require("@mui/material/IconButton"),de=require("@mui/material/MenuItem"),G=require("@mui/material/Stack"),Z=require("@mui/material/TextField"),He=require("@mui/icons-material/DragIndicator"),oe=require("@mui/material/Button"),Ge=require("@mui/material/Checkbox"),be=require("@mui/material/Chip"),Ve=require("@mui/material/Divider"),Ue=require("@mui/material/FormControlLabel"),Pe=require("@mui/material/Paper"),Le=require("@mui/material/Slider"),Ze=require("@mui/material/InputAdornment"),_e=require("@mui/icons-material/ContentCopy"),Qe=require("@mui/icons-material/PushPin"),Je=require("@mui/icons-material/PushPinOutlined"),Ke=require("@mui/material/ClickAwayListener"),et=require("@mui/material/Popper");function tt({title:t="React Things",children:n}){return e.jsxs(K.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,p:2,bgcolor:"background.paper"},children:[e.jsx(K.Typography,{variant:"subtitle1",fontWeight:700,children:t}),n?e.jsx(K.Box,{sx:{mt:1},children:n}):null]})}const me="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",Se=12,rt={c:"#659ad2",cpp:"#00599c",cplusplus:"#00599c","c++":"#00599c",typescript:"#3178c6",ts:"#3178c6",tsx:"#3178c6",javascript:"#f7df1e",js:"#f7df1e",jsx:"#f7df1e",java:"#e76f00",powershell:"#5391fe",ps1:"#5391fe",rust:"#dea584",rs:"#dea584",go:"#00add8",golang:"#00add8",shell:"#89e051",sh:"#89e051",bash:"#89e051",zsh:"#89e051",python:"#3776ab",py:"#3776ab",csharp:"#9b4f96","c#":"#9b4f96",cs:"#9b4f96",php:"#777bb4",ruby:"#cc342d",rb:"#cc342d",swift:"#f05138",kotlin:"#a97bff",kt:"#a97bff",sql:"#336791",html:"#e34f26",css:"#1572b6",dart:"#0175c2"};function nt(t){return t.trim().replace(/^\./,"").toLowerCase().replace(/\s+/g,"")}function ot(t){return rt[nt(t)]??"#93c5fd"}function it(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function at(t){const n=it(t),d=/^(import|from|export|function|return|const|let|var|type|interface|class|extends|new|if|else|for|while|switch|case|break|continue|async|await|try|catch|finally|throw|fn|pub|use|mod|impl|trait|struct|enum|match|mut|let|where|package|func|defer|go|select|range|map|chan|SELECT|FROM|WHERE|AS|AND|OR|INSERT|UPDATE|DELETE|CREATE|TABLE|ORDER|BY|GROUP|LIMIT|select|from|where|as|and|or|insert|update|delete|create|table|order|by|group|limit)\b/;return/^['"`]/.test(t)?`<span style="color:#86efac">${n}</span>`:/^\d/.test(t)?`<span style="color:#fbbf24">${n}</span>`:/^<\/?[A-Z][\w.]*/.test(t)?`<span style="color:#67e8f9">${n}</span>`:d.test(t)?`<span style="color:#c084fc">${n}</span>`:/^[$#][\w-]+$|^\.[\w-]+$/.test(t)?`<span style="color:#f9a8d4">${n}</span>`:/^[A-Z][\w.]*$/.test(t)?`<span style="color:#93c5fd">${n}</span>`:/^[a-z][\w-]*(?==|:)/.test(t)?`<span style="color:#f9a8d4">${n}</span>`:/^[{}()[\].,:;=<>/]+$/.test(t)?`<span style="color:#94a3b8">${n}</span>`:n}function st(t){return t.split(/(\s+|<\/?[A-Z][\w.]*|['"`][^'"`]*['"`]|\d*\.?\d+|[A-Za-z_$][\w$-]*|[{}()[\].,:;=<>/]+)/g).map(n=>at(n)).join("")}function lt({label:t,language:n,value:d,onChange:l,minHeight:f=360}){const c=d??"",g=Math.max(c.split(`
2
- `).length,1),x=Array.from({length:g},(y,v)=>v+1).join(`
3
- `),a=st(c),m=ot(n);return e.jsxs(K.Box,{children:[e.jsxs(K.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:1.5,py:1,bgcolor:"#111827",color:"#d1d5db",borderTopLeftRadius:4,borderTopRightRadius:4},children:[e.jsx(K.Typography,{variant:"caption",fontWeight:800,children:t}),e.jsx(K.Typography,{variant:"caption",sx:{fontFamily:"monospace",color:m,textTransform:"lowercase"},children:n})]}),e.jsxs(K.Box,{sx:{display:"grid",gridTemplateColumns:"48px 1fr",minHeight:f,bgcolor:"#0f172a",borderBottomLeftRadius:4,borderBottomRightRadius:4,overflow:"hidden"},children:[e.jsx(K.Box,{component:"pre","aria-hidden":"true",sx:{m:0,px:1.5,py:1.5,color:"#64748b",bgcolor:"#111827",fontFamily:me,fontSize:14,lineHeight:1.6,textAlign:"right",userSelect:"none"},children:x}),e.jsxs(K.Box,{sx:{position:"relative",minHeight:f,bgcolor:"#0f172a",overflow:"auto"},children:[e.jsx(K.Box,{component:"pre","aria-hidden":"true",dangerouslySetInnerHTML:{__html:a},sx:{position:"absolute",inset:0,m:0,p:`${Se}px`,boxSizing:"border-box",pointerEvents:"none",color:"#e5e7eb",fontFamily:me,fontSize:14,lineHeight:1.6,tabSize:2,whiteSpace:"pre-wrap",overflowWrap:"normal"}}),e.jsx(K.Box,{component:"textarea","aria-label":`${t} code editor`,spellCheck:!1,value:c,onChange:y=>l(y.target.value),sx:{position:"relative",width:"100%",minWidth:0,minHeight:f,resize:"vertical",border:0,outline:0,p:`${Se}px`,boxSizing:"border-box",color:"transparent",WebkitTextFillColor:"transparent",bgcolor:"transparent",caretColor:"#60a5fa",fontFamily:me,fontSize:14,lineHeight:1.6,tabSize:2,whiteSpace:"pre-wrap",overflow:"auto",textShadow:"none",MozOsxFontSmoothing:"auto","&::selection":{color:"transparent",WebkitTextFillColor:"transparent",bgcolor:"rgba(96, 165, 250, 0.35)"}}})]})]})]})}function ct({children:t,initialPosition:n={x:50,y:50},dragSx:d,onPositionChange:l,onDraggingChange:f,sx:c,...g}){const x=b.useRef(null),a=b.useRef(null),[m,y]=b.useState(n),[v,j]=b.useState({x:0,y:0}),[T,$]=b.useState(!1);b.useLayoutEffect(()=>{const u=x.current,S=a.current;if(!u||!S)return;const E=u.getBoundingClientRect(),D=S.getBoundingClientRect(),k=window.getComputedStyle(u),L=m.x/100*E.width,w=m.y/100*E.height;l?.(m,{containerWidth:E.width,containerHeight:E.height,draggableWidth:D.width,draggableHeight:D.height,draggableLeft:L-D.width/2,draggableTop:w-D.height/2,containerBackgroundImage:k.backgroundImage,containerBackgroundSize:k.backgroundSize,containerBackgroundPosition:k.backgroundPosition})},[]);function o(u,S){y(u),l?.(u,S)}function M(u,S,E=v){const D=x.current,k=a.current;if(!D||!k)return;const L=D.getBoundingClientRect(),w=k.getBoundingClientRect(),A=window.getComputedStyle(D),N=u-E.x+w.width/2,X=S-E.y+w.height/2,s=w.width/L.width*50,R=w.height/L.height*50,h=(N-L.left)/L.width*100,I=(X-L.top)/L.height*100,B={x:Math.min(Math.max(h,s),100-s),y:Math.min(Math.max(I,R),100-R)},i=B.x/100*L.width,P=B.y/100*L.height;o(B,{containerWidth:L.width,containerHeight:L.height,draggableWidth:w.width,draggableHeight:w.height,draggableLeft:i-w.width/2,draggableTop:P-w.height/2,containerBackgroundImage:A.backgroundImage,containerBackgroundSize:A.backgroundSize,containerBackgroundPosition:A.backgroundPosition})}return e.jsx(p,{...g,ref:x,sx:[{position:"relative",overflow:"hidden",touchAction:"none"},...Array.isArray(c)?c:c?[c]:[]],onPointerMove:u=>{T&&M(u.clientX,u.clientY)},onPointerUp:u=>{$(!1),f?.(!1),u.currentTarget.releasePointerCapture(u.pointerId)},onPointerCancel:()=>{$(!1),f?.(!1)},children:e.jsx(p,{ref:a,sx:[{position:"absolute",left:`${m.x}%`,top:`${m.y}%`,transform:"translate(-50%, -50%)",cursor:T?"grabbing":"grab",userSelect:"none"},...Array.isArray(d)?d:d?[d]:[]],onPointerDown:u=>{const S=u.currentTarget.getBoundingClientRect(),E={x:u.clientX-S.left,y:u.clientY-S.top};$(!0),f?.(!0),j(E),u.currentTarget.setPointerCapture(u.pointerId),M(u.clientX,u.clientY,E)},children:t})})}function Ie(t){return Math.min(Math.max(t,0),1)}function dt({transparency:t=.36,fill:n=.72,liquidColor:d="#39b8ff",glassColor:l="#ffffff",motion:f=0,refractionActive:c=!0,children:g,sx:x,...a}){const y=`glass-liquid-${b.useId().replace(/:/g,"")}`,v=1-Ie(t),j=Ie(t),$=`${(1-Math.min(Math.max(n,0),1))*100}%`,o=Math.abs(Math.round(f*8))+1,M=.012+Math.abs(Math.sin(f/17))*.012,u=18+v*18,S=c;return e.jsxs(p,{...a,sx:[{position:"relative",overflow:"hidden",border:1,borderColor:F.alpha(l,.48),borderRadius:2,minHeight:160,p:3,color:"common.white",bgcolor:F.alpha(l,.08+j*.18),boxShadow:`
4
- inset 0 1px 0 ${F.alpha(l,.68)},
5
- inset 14px 0 34px ${F.alpha(l,.12)},
6
- inset -18px 0 32px ${F.alpha(d,v*.2)},
7
- 0 18px 48px ${F.alpha("#0b2030",.18)}
8
- `,backdropFilter:"blur(12px) saturate(170%) contrast(108%)",WebkitBackdropFilter:"blur(12px) saturate(170%) contrast(108%)","&::before":{content:'""',position:"absolute",left:0,right:0,top:$,bottom:0,background:`
9
- linear-gradient(160deg, ${F.alpha(l,v*.16)} 0%, ${F.alpha(d,v*.28)} 42%, ${F.alpha("#063451",v*.2)} 100%)
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ie=require("@mui/material"),w=require("react"),u=require("@mui/material/Box"),N=require("@mui/material/styles"),ce=require("@mui/material/Tooltip"),q=require("@mui/material/Typography"),Ge=require("@mui/material/Collapse"),Ue=require("@mui/material/InputBase"),Ze=require("@mui/material/List"),Me=require("@mui/material/ListItemButton"),_e=require("@mui/material/ListItemIcon"),Re=require("@mui/material/ListItemText"),Ke=require("@mui/icons-material/AddBox"),Qe=require("@mui/icons-material/AddLink"),Je=require("@mui/icons-material/Close"),Ne=require("@mui/icons-material/Delete"),et=require("@mui/icons-material/LinkOff"),de=require("@mui/material/IconButton"),xe=require("@mui/material/MenuItem"),Y=require("@mui/material/Stack"),Z=require("@mui/material/TextField"),Oe=require("@mui/icons-material/DragIndicator"),oe=require("@mui/material/Button"),tt=require("@mui/material/Checkbox"),me=require("@mui/material/Chip"),rt=require("@mui/material/Divider"),nt=require("@mui/material/FormControlLabel"),we=require("@mui/material/Paper"),He=require("@mui/material/Slider"),ot=require("@mui/material/InputAdornment"),it=require("@mui/icons-material/ContentCopy"),at=require("@mui/icons-material/PushPin"),st=require("@mui/icons-material/PushPinOutlined"),lt=require("@mui/material/ClickAwayListener"),ct=require("@mui/material/Popper"),dt=require("@mui/material/LinearProgress"),ze=require("@mui/icons-material/Add"),Ae=require("@mui/icons-material/Edit"),ut=require("@mui/material/Dialog"),pt=require("@mui/material/DialogActions"),ht=require("@mui/material/DialogContent"),xt=require("@mui/material/DialogTitle");function ft({title:t="React Things",children:n}){return e.jsxs(ie.Box,{sx:{border:1,borderColor:"divider",borderRadius:1,p:2,bgcolor:"background.paper"},children:[e.jsx(ie.Typography,{variant:"subtitle1",fontWeight:700,children:t}),n?e.jsx(ie.Box,{sx:{mt:1},children:n}):null]})}const ke="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",Pe=12,gt={c:"#659ad2",cpp:"#00599c",cplusplus:"#00599c","c++":"#00599c",typescript:"#3178c6",ts:"#3178c6",tsx:"#3178c6",javascript:"#f7df1e",js:"#f7df1e",jsx:"#f7df1e",java:"#e76f00",powershell:"#5391fe",ps1:"#5391fe",rust:"#dea584",rs:"#dea584",go:"#00add8",golang:"#00add8",shell:"#89e051",sh:"#89e051",bash:"#89e051",zsh:"#89e051",python:"#3776ab",py:"#3776ab",csharp:"#9b4f96","c#":"#9b4f96",cs:"#9b4f96",php:"#777bb4",ruby:"#cc342d",rb:"#cc342d",swift:"#f05138",kotlin:"#a97bff",kt:"#a97bff",sql:"#336791",html:"#e34f26",css:"#1572b6",dart:"#0175c2"};function bt(t){return t.trim().replace(/^\./,"").toLowerCase().replace(/\s+/g,"")}function mt(t){return gt[bt(t)]??"#93c5fd"}function yt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function jt(t){const n=yt(t),a=/^(import|from|export|function|return|const|let|var|type|interface|class|extends|new|if|else|for|while|switch|case|break|continue|async|await|try|catch|finally|throw|fn|pub|use|mod|impl|trait|struct|enum|match|mut|let|where|package|func|defer|go|select|range|map|chan|SELECT|FROM|WHERE|AS|AND|OR|INSERT|UPDATE|DELETE|CREATE|TABLE|ORDER|BY|GROUP|LIMIT|select|from|where|as|and|or|insert|update|delete|create|table|order|by|group|limit)\b/;return/^['"`]/.test(t)?`<span style="color:#86efac">${n}</span>`:/^\d/.test(t)?`<span style="color:#fbbf24">${n}</span>`:/^<\/?[A-Z][\w.]*/.test(t)?`<span style="color:#67e8f9">${n}</span>`:a.test(t)?`<span style="color:#c084fc">${n}</span>`:/^[$#][\w-]+$|^\.[\w-]+$/.test(t)?`<span style="color:#f9a8d4">${n}</span>`:/^[A-Z][\w.]*$/.test(t)?`<span style="color:#93c5fd">${n}</span>`:/^[a-z][\w-]*(?==|:)/.test(t)?`<span style="color:#f9a8d4">${n}</span>`:/^[{}()[\].,:;=<>/]+$/.test(t)?`<span style="color:#94a3b8">${n}</span>`:n}function wt(t){return t.split(/(\s+|<\/?[A-Z][\w.]*|['"`][^'"`]*['"`]|\d*\.?\d+|[A-Za-z_$][\w$-]*|[{}()[\].,:;=<>/]+)/g).map(n=>jt(n)).join("")}function vt({label:t,language:n,value:a,onChange:l,minHeight:h=360}){const c=a??"",j=Math.max(c.split(`
2
+ `).length,1),g=Array.from({length:j},(y,k)=>k+1).join(`
3
+ `),d=wt(c),C=mt(n);return e.jsxs(ie.Box,{children:[e.jsxs(ie.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",px:1.5,py:1,bgcolor:"#111827",color:"#d1d5db",borderTopLeftRadius:4,borderTopRightRadius:4},children:[e.jsx(ie.Typography,{variant:"caption",fontWeight:800,children:t}),e.jsx(ie.Typography,{variant:"caption",sx:{fontFamily:"monospace",color:C,textTransform:"lowercase"},children:n})]}),e.jsxs(ie.Box,{sx:{display:"grid",gridTemplateColumns:"48px 1fr",minHeight:h,bgcolor:"#0f172a",borderBottomLeftRadius:4,borderBottomRightRadius:4,overflow:"hidden"},children:[e.jsx(ie.Box,{component:"pre","aria-hidden":"true",sx:{m:0,px:1.5,py:1.5,color:"#64748b",bgcolor:"#111827",fontFamily:ke,fontSize:14,lineHeight:1.6,textAlign:"right",userSelect:"none"},children:g}),e.jsxs(ie.Box,{sx:{position:"relative",minHeight:h,bgcolor:"#0f172a",overflow:"auto"},children:[e.jsx(ie.Box,{component:"pre","aria-hidden":"true",dangerouslySetInnerHTML:{__html:d},sx:{position:"absolute",inset:0,m:0,p:`${Pe}px`,boxSizing:"border-box",pointerEvents:"none",color:"#e5e7eb",fontFamily:ke,fontSize:14,lineHeight:1.6,tabSize:2,whiteSpace:"pre-wrap",overflowWrap:"normal"}}),e.jsx(ie.Box,{component:"textarea","aria-label":`${t} code editor`,spellCheck:!1,value:c,onChange:y=>l(y.target.value),sx:{position:"relative",width:"100%",minWidth:0,minHeight:h,resize:"vertical",border:0,outline:0,p:`${Pe}px`,boxSizing:"border-box",color:"transparent",WebkitTextFillColor:"transparent",bgcolor:"transparent",caretColor:"#60a5fa",fontFamily:ke,fontSize:14,lineHeight:1.6,tabSize:2,whiteSpace:"pre-wrap",overflow:"auto",textShadow:"none",MozOsxFontSmoothing:"auto","&::selection":{color:"transparent",WebkitTextFillColor:"transparent",bgcolor:"rgba(96, 165, 250, 0.35)"}}})]})]})]})}function Ct({children:t,initialPosition:n={x:50,y:50},dragSx:a,onPositionChange:l,onDraggingChange:h,sx:c,...j}){const g=w.useRef(null),d=w.useRef(null),[C,y]=w.useState(n),[k,x]=w.useState({x:0,y:0}),[L,I]=w.useState(!1);w.useLayoutEffect(()=>{const f=g.current,M=d.current;if(!f||!M)return;const O=f.getBoundingClientRect(),F=M.getBoundingClientRect(),D=window.getComputedStyle(f),R=C.x/100*O.width,$=C.y/100*O.height;l?.(C,{containerWidth:O.width,containerHeight:O.height,draggableWidth:F.width,draggableHeight:F.height,draggableLeft:R-F.width/2,draggableTop:$-F.height/2,containerBackgroundImage:D.backgroundImage,containerBackgroundSize:D.backgroundSize,containerBackgroundPosition:D.backgroundPosition})},[]);function i(f,M){y(f),l?.(f,M)}function B(f,M,O=k){const F=g.current,D=d.current;if(!F||!D)return;const R=F.getBoundingClientRect(),$=D.getBoundingClientRect(),T=window.getComputedStyle(F),V=f-O.x+$.width/2,H=M-O.y+$.height/2,p=$.width/R.width*50,P=$.height/R.height*50,m=(V-R.left)/R.width*100,z=(H-R.top)/R.height*100,X={x:Math.min(Math.max(m,p),100-p),y:Math.min(Math.max(z,P),100-P)},o=X.x/100*R.width,W=X.y/100*R.height;i(X,{containerWidth:R.width,containerHeight:R.height,draggableWidth:$.width,draggableHeight:$.height,draggableLeft:o-$.width/2,draggableTop:W-$.height/2,containerBackgroundImage:T.backgroundImage,containerBackgroundSize:T.backgroundSize,containerBackgroundPosition:T.backgroundPosition})}return e.jsx(u,{...j,ref:g,sx:[{position:"relative",overflow:"hidden",touchAction:"none"},...Array.isArray(c)?c:c?[c]:[]],onPointerMove:f=>{L&&B(f.clientX,f.clientY)},onPointerUp:f=>{I(!1),h?.(!1),f.currentTarget.releasePointerCapture(f.pointerId)},onPointerCancel:()=>{I(!1),h?.(!1)},children:e.jsx(u,{ref:d,sx:[{position:"absolute",left:`${C.x}%`,top:`${C.y}%`,transform:"translate(-50%, -50%)",cursor:L?"grabbing":"grab",userSelect:"none"},...Array.isArray(a)?a:a?[a]:[]],onPointerDown:f=>{const M=f.currentTarget.getBoundingClientRect(),O={x:f.clientX-M.left,y:f.clientY-M.top};I(!0),h?.(!0),x(O),f.currentTarget.setPointerCapture(f.pointerId),B(f.clientX,f.clientY,O)},children:t})})}function Te(t){return Math.min(Math.max(t,0),1)}function kt({transparency:t=.36,fill:n=.72,liquidColor:a="#39b8ff",glassColor:l="#ffffff",motion:h=0,refractionActive:c=!0,children:j,sx:g,...d}){const y=`glass-liquid-${w.useId().replace(/:/g,"")}`,k=1-Te(t),x=Te(t),I=`${(1-Math.min(Math.max(n,0),1))*100}%`,i=Math.abs(Math.round(h*8))+1,B=.012+Math.abs(Math.sin(h/17))*.012,f=18+k*18,M=c;return e.jsxs(u,{...d,sx:[{position:"relative",overflow:"hidden",border:1,borderColor:N.alpha(l,.48),borderRadius:2,minHeight:160,p:3,color:"common.white",bgcolor:N.alpha(l,.08+x*.18),boxShadow:`
4
+ inset 0 1px 0 ${N.alpha(l,.68)},
5
+ inset 14px 0 34px ${N.alpha(l,.12)},
6
+ inset -18px 0 32px ${N.alpha(a,k*.2)},
7
+ 0 18px 48px ${N.alpha("#0b2030",.18)}
8
+ `,backdropFilter:"blur(12px) saturate(170%) contrast(108%)",WebkitBackdropFilter:"blur(12px) saturate(170%) contrast(108%)","&::before":{content:'""',position:"absolute",left:0,right:0,top:I,bottom:0,background:`
9
+ linear-gradient(160deg, ${N.alpha(l,k*.16)} 0%, ${N.alpha(a,k*.28)} 42%, ${N.alpha("#063451",k*.2)} 100%)
10
10
  `,opacity:.95,boxShadow:`
11
- inset 0 18px 28px ${F.alpha(l,.12+v*.16)},
12
- inset 0 -34px 44px ${F.alpha("#032536",v*.22)}
11
+ inset 0 18px 28px ${N.alpha(l,.12+k*.16)},
12
+ inset 0 -34px 44px ${N.alpha("#032536",k*.22)}
13
13
  `},"&::after":{content:'""',position:"absolute",inset:0,background:`
14
- linear-gradient(105deg, ${F.alpha(l,.34)} 0%, ${F.alpha(l,.08)} 18%, ${F.alpha(l,0)} 34%),
15
- radial-gradient(circle at 18% 18%, ${F.alpha(l,.38)} 0 3%, ${F.alpha(l,0)} 18%)
16
- `,pointerEvents:"none"},"& .GlassBox-liquidLens":{position:"absolute",inset:0,zIndex:1,pointerEvents:"none",backgroundImage:"var(--glassbox-refraction-background, none)",backgroundSize:"var(--glassbox-refraction-background-size, cover)",backgroundPosition:"var(--glassbox-refraction-background-position, center)",backgroundRepeat:"no-repeat",filter:`url(#${y}) saturate(150%) contrast(112%)`,opacity:S?.72:0,transition:"opacity 120ms ease-out",maskImage:`linear-gradient(to bottom, transparent 0, transparent calc(${$} + 10px), black calc(${$} + 28px), black 100%)`,WebkitMaskImage:`linear-gradient(to bottom, transparent 0, transparent calc(${$} + 10px), black calc(${$} + 28px), black 100%)`},"& .GlassBox-refractionOffset":{position:"absolute",inset:0,zIndex:2,pointerEvents:"none",opacity:S?.16+j*.16:0,backdropFilter:"blur(3px) saturate(190%)",WebkitBackdropFilter:"blur(3px) saturate(190%)",background:`
17
- linear-gradient(180deg, ${F.alpha(l,.2)} 0, ${F.alpha(l,0)} 20%),
18
- linear-gradient(90deg, ${F.alpha(l,0)} 0 18%, ${F.alpha(l,.14)} 26%, ${F.alpha(l,0)} 34% 58%, ${F.alpha(l,.1)} 68%, ${F.alpha(l,0)} 76% 100%)
19
- `,transition:"opacity 120ms ease-out",maskImage:`linear-gradient(to bottom, transparent 0, transparent ${$}, black calc(${$} + 18px), black 100%)`,WebkitMaskImage:`linear-gradient(to bottom, transparent 0, transparent ${$}, black calc(${$} + 18px), black 100%)`},"& .GlassBox-content":{position:"relative",zIndex:3,textShadow:`0 1px 10px ${F.alpha("#00121d",.36)}`},"& > *":{position:"relative",zIndex:3}},...Array.isArray(x)?x:x?[x]:[]],children:[e.jsx(p,{component:"svg","aria-hidden":"true",focusable:"false",sx:{position:"absolute",width:0,height:0,overflow:"hidden"},children:e.jsxs("filter",{id:y,children:[e.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:`${M} ${M*2.6}`,numOctaves:"2",seed:o,result:"liquidNoise"}),e.jsx("feDisplacementMap",{in:"SourceGraphic",in2:"liquidNoise",scale:u,xChannelSelector:"R",yChannelSelector:"G"})]})}),e.jsx(p,{className:"GlassBox-liquidLens"}),e.jsx(p,{className:"GlassBox-refractionOffset"}),e.jsx(p,{className:"GlassBox-content",children:g})]})}function ut(t,n,d){return Math.min(Math.max(t,n),d)}function pt({items:t,iconSize:n=52,magnification:d=1.7,gap:l=10,tooltip:f=!0,sx:c,...g}){const[x,a]=b.useState(null);return e.jsx(p,{...g,role:"toolbar",sx:[{display:"inline-flex",alignItems:"flex-end",gap:`${l}px`,p:1,border:1,borderColor:"rgba(255,255,255,0.5)",borderRadius:3,bgcolor:"rgba(255,255,255,0.34)",boxShadow:"0 18px 44px rgba(15, 23, 42, 0.22)",backdropFilter:"blur(18px) saturate(150%)",WebkitBackdropFilter:"blur(18px) saturate(150%)"},...Array.isArray(c)?c:c?[c]:[]],onMouseLeave:()=>a(null),children:t.map((m,y)=>{const v=x===null?4:Math.abs(y-x),j=ut(1-v/3,0,1),T=1+(d-1)*j,$=-18*j,o=e.jsx(p,{component:"button",type:"button","aria-label":m.label,onClick:m.onClick,onMouseEnter:()=>a(y),sx:{width:n,height:n,display:"grid",placeItems:"center",flex:"0 0 auto",border:0,borderRadius:2,p:0,color:"inherit",bgcolor:"rgba(255,255,255,0.72)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.85), 0 8px 18px rgba(15, 23, 42, 0.18)",cursor:"pointer",transform:`translateY(${$}px) scale(${T})`,transformOrigin:"bottom center",transition:"transform 130ms ease-out, background-color 130ms ease-out","&:focus-visible":{outline:"2px solid #2563eb",outlineOffset:3},"&:active":{bgcolor:"rgba(255,255,255,0.9)"}},children:e.jsx(q,{component:"span","aria-hidden":"true",sx:{display:"grid",placeItems:"center",fontSize:Math.round(n*.52),lineHeight:1},children:m.icon})},m.id);return f?e.jsx(ne,{title:m.label,placement:"top",arrow:!0,children:o},m.id):o})})}function Te(t){return t.toLowerCase().trim()}function ht(t){return Te([t.label,t.description,t.group,t.parentId,...t.keywords??[]].filter(Boolean).join(" "))}function Re(t){return Array.from(new Set(t.map(n=>n.group).filter(Boolean)))}function xt({items:t,variant:n="list",selectedId:d,placeholder:l="Search",emptyText:f="No items found",maxResults:c,showSearch:g=!0,dense:x=!1,expandedGroups:a,defaultExpandedGroups:m,onExpandedGroupsChange:y,onSelect:v,sx:j,...T}){const $=m??Re(t),[o,M]=b.useState(""),[u,S]=b.useState(0),[E,D]=b.useState($),k=Te(o),L=a??E,w=b.useMemo(()=>{const i=k?t.filter(P=>ht(P).includes(k)):t;return typeof c=="number"?i.slice(0,c):i},[t,c,k]),A=Re(w),N=w;function X(i){i.onSelect?.(),v?.(i),M(""),S(0)}function s(i){a===void 0&&D(i),y?.(i)}function R(i){s(L.includes(i)?L.filter(P=>P!==i):[...L,i])}function h(i,P=0){const _=i.id===d;return e.jsxs($e,{selected:_,dense:x,onClick:()=>X(i),sx:{borderRadius:1,pl:1.25+P*2,"&.Mui-selected":{bgcolor:"action.selected",color:"primary.main"},"&.Mui-selected:hover, &:hover":{bgcolor:"action.hover"}},children:[i.icon?e.jsx(Xe,{sx:{minWidth:34,color:"inherit"},children:i.icon}):null,e.jsx(Ce,{primary:i.label,secondary:i.description,primaryTypographyProps:{fontWeight:_?850:700},secondaryTypographyProps:{color:"text.secondary"}})]},i.id)}function I(){return w.length?A.length?A.map(i=>e.jsxs(p,{children:[e.jsx(q,{variant:"caption",fontWeight:900,color:"text.secondary",sx:{display:"block",px:1.25,pt:1.5,pb:.5},children:i}),w.filter(P=>P.group===i).map(P=>h(P))]},i)):w.map(i=>h(i)):e.jsx(p,{sx:{px:2,py:4,textAlign:"center",color:"text.secondary"},children:f})}function B(){return w.length?A.length?A.map(i=>{const P=k||L.includes(i);return e.jsxs(p,{children:[e.jsxs($e,{dense:x,onClick:()=>R(i),sx:{borderRadius:1,px:1.25},children:[e.jsx(q,{component:"span","aria-hidden":"true",sx:{mr:1,width:16,color:"text.secondary"},children:P?"▾":"▸"}),e.jsx(Ce,{primary:i,primaryTypographyProps:{fontWeight:900}})]}),e.jsx(De,{in:!!P,timeout:"auto",unmountOnExit:!0,children:w.filter(_=>_.group===i).map(_=>h(_,1))})]},i)}):w.map(i=>h(i)):e.jsx(p,{sx:{px:2,py:4,textAlign:"center",color:"text.secondary"},children:f})}return e.jsxs(p,{...T,sx:[{display:"flex",flexDirection:"column",gap:1,minWidth:0},...Array.isArray(j)?j:j?[j]:[]],children:[g?e.jsx(p,{sx:{px:1.25,py:.75,border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper"},children:e.jsx(We,{fullWidth:!0,value:o,placeholder:l,onChange:i=>{M(i.target.value),S(0)},onKeyDown:i=>{i.key==="ArrowDown"&&(i.preventDefault(),S(P=>Math.min(P+1,N.length-1))),i.key==="ArrowUp"&&(i.preventDefault(),S(P=>Math.max(P-1,0))),i.key==="Enter"&&N[u]&&(i.preventDefault(),X(N[u]))},sx:{fontSize:14}})}):null,e.jsx(Ee,{disablePadding:!0,dense:x,sx:{overflow:"auto"},children:n==="tree"?B():I()})]})}function ze(t,n,d){return Math.min(Math.max(t,n),d)}function ft(t){if(!t||typeof window>"u")return null;const n=window.localStorage.getItem(t),d=n===null?Number.NaN:Number(n);return Number.isFinite(d)?d:null}function gt({first:t,second:n,orientation:d="horizontal",initialSize:l=50,size:f,defaultSize:c,minSize:g=20,maxSize:x=80,dividerSize:a=8,snapPoints:m=[],snapThreshold:y=4,resetSize:v=c??l,collapsed:j,defaultCollapsed:T=null,collapsedSize:$=0,persistKey:o,keyboardStep:M=5,onSizeChange:u,onCollapsedChange:S,onDraggingChange:E,dividerLabel:D="Resize panels",sx:k,...L}){const w=b.useRef(null),[A,N]=b.useState(()=>ft(o)??c??l),[X,s]=b.useState(T),[R,h]=b.useState(!1),I=d==="horizontal",i=ze(f??A,g,x),P=j??X,_=P==="first"?$:P==="second"?100-$:i,ie=P==="first"&&$<=0,ae=P==="second"&&$<=0;b.useEffect(()=>{o&&window.localStorage.setItem(o,String(i))},[o,i]),b.useEffect(()=>{E?.(R)},[R,E]);function H(C){const te=m.reduce((se,he)=>{const xe=Math.abs(se-C);return Math.abs(he-C)<xe?he:se},C),re=Math.abs(te-C)<=y,Q=ze(re?te:C,g,x);f===void 0&&N(Q),u?.(Q),pe(null)}function ee(C,te){const re=w.current;if(!re)return;const Q=re.getBoundingClientRect(),se=I?(C-Q.left)/Q.width*100:(te-Q.top)/Q.height*100;H(se)}function V(C){H(i+C)}function J(){H(v)}function ue(C){pe(P===C?null:C)}function pe(C){j===void 0&&s(C),S?.(C)}return e.jsxs(p,{...L,ref:w,sx:[{display:"grid",gridTemplateColumns:I?`${_}% ${a}px 1fr`:"1fr",gridTemplateRows:I?"1fr":`${_}% ${a}px 1fr`,minHeight:280,overflow:"hidden",userSelect:R?"none":void 0},...Array.isArray(k)?k:k?[k]:[]],onPointerMove:C=>{R&&ee(C.clientX,C.clientY)},onPointerUp:()=>{h(!1)},onPointerCancel:()=>h(!1),children:[e.jsx(p,{sx:{minWidth:0,minHeight:0,overflow:"auto",display:ie?"none":void 0},children:t}),e.jsx(p,{role:"separator","aria-label":D,"aria-orientation":I?"vertical":"horizontal","aria-valuemin":g,"aria-valuemax":x,"aria-valuenow":Math.round(i),tabIndex:0,onPointerDown:C=>{h(!0),C.currentTarget.setPointerCapture(C.pointerId),ee(C.clientX,C.clientY)},onPointerUp:C=>{h(!1),C.currentTarget.releasePointerCapture(C.pointerId)},onDoubleClick:J,onKeyDown:C=>{C.key==="Enter"&&(J(),C.preventDefault()),C.key==="Home"&&(ue("first"),C.preventDefault()),C.key==="End"&&(ue("second"),C.preventDefault()),(C.key==="ArrowLeft"||C.key==="ArrowUp")&&(V(-M),C.preventDefault()),(C.key==="ArrowRight"||C.key==="ArrowDown")&&(V(M),C.preventDefault())},sx:{position:"relative",bgcolor:R?"primary.main":"divider",cursor:I?"col-resize":"row-resize",touchAction:"none",transition:"background-color 120ms ease","&:hover":{bgcolor:"primary.main"},"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:-2},"&::after":{content:'""',position:"absolute",inset:I?"30% -4px":"-4px 30%",borderRadius:999,bgcolor:R?"primary.contrastText":"text.disabled",opacity:.55}}}),e.jsx(p,{sx:{minWidth:0,minHeight:0,overflow:"auto",display:ae?"none":void 0},children:n})]})}function bt(t,n){return n??t?.getBoundingClientRect()??null}function mt({open:t,children:n,anchorEl:d,anchorRect:l,containerRef:f,placement:c="top",offset:g=8,boundaryPadding:x=8,autoUpdate:a=!0,arrow:m=!0,sx:y,...v}){const j=b.useRef(null),[T,$]=b.useState({left:-9999,top:-9999}),o=b.useCallback(()=>{if(!t)return;const M=bt(d,l),u=j.current;if(!M||!u)return;const S=f?.current?.getBoundingClientRect(),E=S?.left??0,D=S?.top??0,k=S?.width??window.innerWidth,L=S?.height??window.innerHeight,w=u.offsetWidth/2,A=u.offsetHeight,N=M.left-E+M.width/2,X=c==="top"?M.top-D-g:M.bottom-D+g,s=Math.min(Math.max(N,w+x),k-w-x),R=c==="top"?Math.max(X,A+x):Math.min(X,L-A-x);$({left:s,top:R})},[d,l,x,f,g,t,c]);return b.useLayoutEffect(()=>{o()},[o]),b.useEffect(()=>{if(!(!t||!a))return window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[a,t,o]),t?e.jsx(p,{...v,ref:j,role:"toolbar",sx:[{position:f?"absolute":"fixed",left:T.left,top:T.top,zIndex:1300,display:"inline-flex",alignItems:"center",gap:.5,p:.5,borderRadius:1.5,bgcolor:"rgba(15,23,42,0.96)",color:"#e5e7eb",boxShadow:"0 16px 40px rgba(15, 23, 42, 0.34)",transform:c==="top"?"translate(-50%, -100%)":"translate(-50%, 0)",backdropFilter:"blur(12px)","&::after":m?{content:'""',position:"absolute",left:"50%",width:10,height:10,bgcolor:"rgba(15,23,42,0.96)",transform:"translateX(-50%) rotate(45deg)",bottom:c==="top"?-5:void 0,top:c==="bottom"?-5:void 0}:void 0},...Array.isArray(y)?y:y?[y]:[]],children:n}):null}function yt({strength:t=18,tilt:n=10,lift:d=10,glare:l=!0,perspective:f=900,sx:c,children:g,...x}){const[a,m]=b.useState({x:0,y:0,rotateX:0,rotateY:0,glareX:50,glareY:50,active:!1});return e.jsx(p,{...x,onMouseMove:y=>{const v=y.currentTarget.getBoundingClientRect(),j=(y.clientX-v.left)/v.width,T=(y.clientY-v.top)/v.height,$=(j-.5)*t,o=(T-.5)*t;m({x:$,y:o,rotateX:(.5-T)*n,rotateY:(j-.5)*n,glareX:j*100,glareY:T*100,active:!0})},onMouseLeave:()=>m({x:0,y:0,rotateX:0,rotateY:0,glareX:50,glareY:50,active:!1}),sx:[{position:"relative",overflow:"hidden",transform:`
20
- perspective(${f}px)
21
- translate3d(${a.x}px, ${a.y}px, ${a.active?-d:0}px)
22
- rotateX(${a.rotateX}deg)
23
- rotateY(${a.rotateY}deg)
24
- `,transformStyle:"preserve-3d",transition:a.active?"transform 80ms ease-out, box-shadow 120ms ease-out":"transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 260ms ease",willChange:"transform",boxShadow:a.active?"0 28px 70px rgba(15, 23, 42, 0.24)":"0 14px 34px rgba(15, 23, 42, 0.12)","&::before":l?{content:'""',position:"absolute",inset:0,pointerEvents:"none",opacity:a.active?.78:0,transition:"opacity 160ms ease",background:`radial-gradient(circle at ${a.glareX}% ${a.glareY}%, rgba(255,255,255,0.55), rgba(255,255,255,0.16) 22%, transparent 48%)`,mixBlendMode:"screen"}:void 0,"& > *":{position:"relative",zIndex:1,transform:a.active?"translateZ(24px)":"translateZ(0)",transition:"transform 180ms ease"}},...Array.isArray(c)?c:c?[c]:[]],children:g})}function wt({radius:t=160,dim:n=.72,sx:d,children:l,...f}){const[c,g]=b.useState({x:50,y:50});return e.jsx(p,{...f,onMouseMove:x=>{const a=x.currentTarget.getBoundingClientRect();g({x:(x.clientX-a.left)/a.width*100,y:(x.clientY-a.top)/a.height*100})},sx:[{position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",inset:0,pointerEvents:"none",background:`radial-gradient(circle ${t}px at ${c.x}% ${c.y}%, transparent 0, transparent 45%, rgba(0,0,0,${n}) 100%)`}},...Array.isArray(d)?d:d?[d]:[]],children:l})}function Me(t,n){return Math.round(t/n)*n}function jt(t,n,d,l,f){const c=t.x+d/2,g=t.y+l/2,x=n.x+d/2,a=n.y+l/2,m=(c+x)/2;if(f==="ellipse"){const y=Math.max(Math.abs(x-c)/2,24),v=Math.max(Math.abs(a-g)/2,24);return`M ${c} ${g} A ${y} ${v} 0 0 1 ${x} ${a}`}return f==="curved"?`M ${c} ${g} C ${m} ${g}, ${m} ${a}, ${x} ${a}`:f==="step"?`M ${c} ${g} L ${m} ${g} L ${m} ${a} L ${x} ${a}`:`M ${c} ${g} L ${x} ${a}`}function vt({nodes:t,connections:n=[],nodeWidth:d=132,nodeHeight:l=52,mode:f="edit",snapToGrid:c=!1,gridSize:g=24,showGrid:x=!1,selectedNodeId:a,connectionStyle:m="line",editableTools:y=!1,linkTypes:v=["line","curved","step","ellipse"],renderNode:j,onNodesChange:T,onConnectionsChange:$,onNodeMove:o,onNodeSelect:M,sx:u,...S}){const[E,D]=b.useState(t),[k,L]=b.useState(n),w=y?E:t,A=y?k:n,[N,X]=b.useState(Object.fromEntries(w.map(r=>[r.id,{x:r.x,y:r.y}]))),[s,R]=b.useState(a??null),[h,I]=b.useState(!1),[B,i]=b.useState(""),[P,_]=b.useState(v[0]??"line"),[ie,ae]=b.useState(""),[H,ee]=b.useState(null),V=a??s,J=w.find(r=>r.id===V)??null,ue=A.map((r,z)=>({connection:r,index:z})).filter(({connection:r})=>r.from===V||r.to===V),pe=t.map(r=>`${r.id}:${r.label}:${r.x}:${r.y}:${r.color??""}`).join("|"),C=n.map(r=>`${r.from}:${r.to}:${r.type??""}:${r.label??""}:${r.color??""}`).join("|");b.useEffect(()=>{y||D(t),X(r=>({...Object.fromEntries(t.map(z=>[z.id,r[z.id]??{x:z.x,y:z.y}]))}))},[y,pe]),b.useEffect(()=>{y||L(n)},[C,y]);function te(r){D(r),T?.(r)}function re(r){L(r),$?.(r)}function Q(r,z){const Y=c?{x:Me(z.x,g),y:Me(z.y,g)}:z;X(W=>({...W,[r]:Y})),y&&te(w.map(W=>W.id===r?{...W,...Y}:W)),o?.(r,Y)}function se(){const r=w.length+1,z={id:`node-${Date.now()}`,label:`Box ${r}`,x:48+r*18,y:48+r*18,color:"#ffffff"};te([...w,z]),X(Y=>({...Y,[z.id]:{x:z.x,y:z.y}})),R(z.id)}function he(){V&&(te(w.filter(r=>r.id!==V)),re(A.filter(r=>r.from!==V&&r.to!==V)),R(null),I(!1))}function xe(r){V&&te(w.map(z=>z.id===V?{...z,...r}:z))}function we(){if(!V||!B||V===B)return;const r={from:V,to:B,type:P,label:ie,color:P==="ellipse"?"#db2777":P==="step"?"#059669":"#2563eb"},z=[...A.filter(Y=>!(Y.from===V&&Y.to===B)),r];re(z),i(""),ae(""),ee(z.indexOf(r))}function fe(r,z){const Y=A[r];if(!Y)return;const W={...Y,...z},U=A.map((O,le)=>le===r?W:O).filter((O,le)=>le===r||O.from!==W.from||O.to!==W.to);re(U)}function Be(r){re(A.filter((z,Y)=>Y!==r)),ee(null)}return e.jsxs(p,{...S,sx:[{position:"relative",minHeight:360,overflow:"hidden",bgcolor:"#f8fafc",backgroundImage:x?"linear-gradient(rgba(148,163,184,0.24) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,0.24) 1px, transparent 1px)":void 0,backgroundSize:x?`${g}px ${g}px`:void 0},...Array.isArray(u)?u:u?[u]:[]],children:[e.jsx(p,{component:"svg",sx:{position:"absolute",inset:0,width:"100%",height:"100%"},children:A.map(r=>{const z=N[r.from],Y=N[r.to];if(!z||!Y)return null;const W=jt(z,Y,d,l,r.type??m),U=(z.x+Y.x+d)/2,O=(z.y+Y.y+l)/2;return e.jsxs("g",{children:[e.jsx("path",{d:W,fill:"none",stroke:r.color??"#94a3b8",strokeWidth:"2.5"}),r.label?e.jsx("text",{x:U,y:O-8,textAnchor:"middle",fill:r.color??"#64748b",fontSize:"11",fontWeight:"700",children:r.label}):null]},`${r.from}-${r.to}-${r.type??r.label??"link"}`)})}),w.map(r=>{const z=N[r.id],Y=r.id===V;return e.jsx(p,{role:"button",tabIndex:0,sx:{position:"absolute",left:z.x,top:z.y,width:d,height:l,display:"grid",placeItems:"center",border:Y?2:1,borderColor:Y?"primary.main":"divider",borderRadius:1,bgcolor:r.color??"background.paper",cursor:f==="edit"?"grab":"pointer",userSelect:"none",boxShadow:Y?"0 18px 34px rgba(37,99,235,0.22)":"0 12px 28px rgba(15,23,42,0.12)",touchAction:"none"},onPointerDown:W=>{if(R(r.id),ee(null),y&&I(!0),M?.(r),f==="readonly")return;const U=W.clientX,O=W.clientY,le=N[r.id];W.currentTarget.setPointerCapture(W.pointerId);function je(ke){Q(r.id,{x:le.x+ke.clientX-U,y:le.y+ke.clientY-O})}function ve(){window.removeEventListener("pointermove",je),window.removeEventListener("pointerup",ve)}window.addEventListener("pointermove",je),window.addEventListener("pointerup",ve)},onKeyDown:W=>{if(f==="readonly")return;const U=c?g:8,O=N[r.id];W.key==="ArrowLeft"&&(Q(r.id,{x:O.x-U,y:O.y}),W.preventDefault()),W.key==="ArrowRight"&&(Q(r.id,{x:O.x+U,y:O.y}),W.preventDefault()),W.key==="ArrowUp"&&(Q(r.id,{x:O.x,y:O.y-U}),W.preventDefault()),W.key==="ArrowDown"&&(Q(r.id,{x:O.x,y:O.y+U}),W.preventDefault())},children:j?j(r,Y):e.jsx(q,{fontWeight:800,children:r.label})},r.id)}),y&&J&&h?e.jsx(p,{sx:{position:"absolute",right:12,top:12,zIndex:20,width:340,maxWidth:"calc(100% - 24px)",maxHeight:"calc(100% - 24px)",overflow:"auto",border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper",boxShadow:"0 20px 48px rgba(15,23,42,0.22)"},children:e.jsxs(G,{spacing:1.25,sx:{p:1.5},children:[e.jsxs(G,{direction:"row",spacing:.75,alignItems:"center",children:[e.jsx(q,{variant:"subtitle2",fontWeight:900,sx:{flex:1},children:"Box editor"}),e.jsx(ne,{title:"Add box",children:e.jsx(ce,{size:"small",color:"primary",onClick:se,children:e.jsx(qe,{fontSize:"small"})})}),e.jsx(ne,{title:"Remove box",children:e.jsx("span",{children:e.jsx(ce,{size:"small",color:"error",onClick:he,disabled:!J,children:e.jsx(Ne,{fontSize:"small"})})})}),e.jsx(ne,{title:"Close editor",children:e.jsx(ce,{size:"small",onClick:()=>I(!1),children:e.jsx(Fe,{fontSize:"small"})})})]}),e.jsxs(p,{sx:{display:"grid",gridTemplateColumns:"1fr 96px",gap:1},children:[e.jsx(Z,{size:"small",label:"Label",value:J?.label??"",disabled:!J,onChange:r=>xe({label:r.target.value})}),e.jsx(Z,{size:"small",label:"Color",type:"color",value:J?.color??"#ffffff",disabled:!J,onChange:r=>xe({color:r.target.value})})]}),e.jsxs(p,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:1.25},children:[e.jsxs(G,{spacing:1,children:[e.jsx(q,{variant:"caption",fontWeight:900,color:"text.secondary",children:"Links"}),e.jsxs(p,{sx:{display:"grid",gridTemplateColumns:"1fr 32px",gap:.5,alignItems:"center"},children:[e.jsxs(Z,{select:!0,size:"small",label:"To",value:B,disabled:!J,onChange:r=>i(r.target.value),children:[e.jsx(de,{value:"",children:"Pick target"}),w.filter(r=>r.id!==V).map(r=>e.jsx(de,{value:r.id,children:r.label},r.id))]}),e.jsx(ne,{title:`Add link from ${J?.label??"box"}`,children:e.jsx("span",{children:e.jsx(ce,{size:"small",color:"primary",disabled:!J||!B,onClick:we,sx:{width:32,height:32,border:1,borderColor:"divider",borderRadius:1},children:e.jsx(Ye,{fontSize:"small"})})})})]}),ue.length?ue.map(({connection:r,index:z})=>{const Y=w.find(O=>O.id===r.from),W=w.find(O=>O.id===r.to),U=H===z;return e.jsxs(p,{sx:{width:"100%",display:"grid",gridTemplateColumns:"1fr 32px",gap:.5,alignItems:"center"},children:[e.jsx(p,{component:"button",onClick:()=>ee(z),sx:{px:1,py:.75,minWidth:0,border:1,borderColor:U?"primary.main":"divider",borderRadius:1,bgcolor:U?"primary.main":"background.paper",color:U?"primary.contrastText":"text.primary",cursor:"pointer",font:"inherit",textAlign:"left"},children:(Y?.label??r.from)+" -> "+(W?.label??r.to)}),e.jsx(ne,{title:"Remove link",children:e.jsx(ce,{size:"small",color:"error",onClick:()=>Be(z),sx:{width:32,height:32},children:e.jsx(Oe,{fontSize:"small"})})})]},`${r.from}-${r.to}-${z}`)}):e.jsx(q,{variant:"body2",color:"text.secondary",children:"No linked boxes."})]}),e.jsxs(G,{spacing:1,children:[e.jsx(q,{variant:"caption",fontWeight:900,color:"text.secondary",children:"Link details"}),H!==null&&A[H]?e.jsxs(e.Fragment,{children:[e.jsx(Z,{select:!0,size:"small",label:"From",value:A[H].from,onChange:r=>fe(H,{from:r.target.value}),children:w.filter(r=>r.id!==A[H].to).map(r=>e.jsx(de,{value:r.id,children:r.label},r.id))}),e.jsxs(p,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsx(Z,{select:!0,size:"small",label:"To",value:A[H].to,onChange:r=>fe(H,{to:r.target.value}),children:w.filter(r=>r.id!==A[H].from).map(r=>e.jsx(de,{value:r.id,children:r.label},r.id))}),e.jsx(Z,{select:!0,size:"small",label:"Shape",value:A[H].type??m,onChange:r=>fe(H,{type:r.target.value}),children:v.map(r=>e.jsx(de,{value:r,children:r},r))})]}),e.jsx(Z,{size:"small",label:"Label",value:A[H].label??"",onChange:r=>fe(H,{label:r.target.value})})]}):e.jsx(q,{variant:"body2",color:"text.secondary",children:"Pick a link."})]})]})]})}):null]})}function kt({before:t,after:n,initialPosition:d=50,sx:l,...f}){const[c,g]=b.useState(d);return e.jsxs(p,{...f,sx:[{position:"relative",overflow:"hidden",minHeight:280},...Array.isArray(l)?l:l?[l]:[]],onPointerMove:x=>{if(x.buttons!==1)return;const a=x.currentTarget.getBoundingClientRect();g((x.clientX-a.left)/a.width*100)},children:[e.jsx(p,{sx:{position:"absolute",inset:0},children:n}),e.jsx(p,{sx:{position:"absolute",inset:0,width:`${c}%`,overflow:"hidden"},children:t}),e.jsx(p,{sx:{position:"absolute",top:0,bottom:0,left:`${c}%`,width:3,bgcolor:"#ffffff",boxShadow:"0 0 0 1px rgba(0,0,0,0.2)",cursor:"ew-resize"}})]})}function $t({initialWidth:t=320,initialHeight:n=220,minWidth:d=160,minHeight:l=120,sx:f,children:c,...g}){const[x,a]=b.useState({width:t,height:n});return e.jsxs(p,{...g,sx:[{position:"relative",width:x.width,height:x.height,overflow:"auto",border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper"},...Array.isArray(f)?f:f?[f]:[]],children:[c,e.jsx(p,{sx:{position:"absolute",right:4,bottom:4,width:28,height:28,display:"grid",placeItems:"center",cursor:"nwse-resize",color:"text.secondary",bgcolor:"background.paper",border:1,borderColor:"divider",borderRadius:1,boxShadow:"0 6px 16px rgba(15,23,42,0.14)"},onPointerDown:m=>{const y=m.clientX,v=m.clientY,j=x;function T(o){a({width:Math.max(d,j.width+o.clientX-y),height:Math.max(l,j.height+o.clientY-v)})}function $(){window.removeEventListener("pointermove",T),window.removeEventListener("pointerup",$)}window.addEventListener("pointermove",T),window.addEventListener("pointerup",$)},children:e.jsx(He,{fontSize:"small"})})]})}function Ct(t){return t.type==="boolean"?t.value?"On":"Off":`${t.value}${t.unit?` ${t.unit}`:""}`}function St(t){return t.reduce((n,d)=>{const l=d.group??"Settings";return{...n,[l]:[...n[l]??[],d]}},{})}function It({fields:t,onChange:n,title:d="Inspector",description:l,density:f="comfortable",showValueSummary:c=!0,showReset:g=!0,sx:x}){const a=St(t),m=f==="compact"?1.25:2,y=f==="compact"?"small":"medium";function v(j){j.defaultValue!==void 0&&n?.(j.id,j.defaultValue)}return e.jsx(Pe,{variant:"outlined",sx:[{p:f==="compact"?1.5:2,borderRadius:1},...Array.isArray(x)?x:[x]],children:e.jsxs(G,{spacing:m,children:[e.jsxs(p,{children:[e.jsxs(G,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[e.jsx(q,{variant:"subtitle1",fontWeight:850,children:d}),c?e.jsx(be,{size:"small",label:`${t.length} fields`}):null]}),l?e.jsx(q,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:l}):null]}),Object.entries(a).map(([j,T],$)=>e.jsxs(G,{spacing:m,children:[$>0?e.jsx(Ve,{}):null,e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:850,sx:{textTransform:"uppercase"},children:j}),T.map(o=>{const M=g&&o.defaultValue!==void 0&&o.defaultValue!==o.value;return o.type==="boolean"?e.jsxs(p,{children:[e.jsxs(G,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[e.jsx(Ue,{control:e.jsx(Ge,{checked:!!o.value,disabled:o.disabled,onChange:u=>n?.(o.id,u.target.checked)}),label:o.label}),M?e.jsx(oe,{size:"small",onClick:()=>v(o),children:"Reset"}):null]}),o.description?e.jsx(q,{variant:"caption",color:"text.secondary",children:o.description}):null]},o.id):o.type==="number"?e.jsxs(G,{spacing:1,children:[e.jsxs(G,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:y,label:o.label,type:"number",value:o.value,helperText:o.description,disabled:o.disabled,inputProps:{min:o.min,max:o.max,step:o.step},onChange:u=>n?.(o.id,Number(u.target.value))}),o.unit?e.jsx(be,{label:o.unit,size:"small",sx:{mt:1}}):null,M?e.jsx(oe,{size:"small",onClick:()=>v(o),sx:{mt:.5},children:"Reset"}):null]}),o.min!==void 0||o.max!==void 0?e.jsx(Le,{value:Number(o.value),min:o.min??0,max:o.max??100,step:o.step??1,disabled:o.disabled,valueLabelDisplay:"auto",onChange:(u,S)=>n?.(o.id,Array.isArray(S)?S[0]:S)}):null]},o.id):o.type==="select"?e.jsxs(G,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{select:!0,fullWidth:!0,size:y,label:o.label,value:o.value,helperText:o.description,disabled:o.disabled,onChange:u=>n?.(o.id,u.target.value),children:(o.options??[]).map(u=>e.jsx(de,{value:u.value,children:u.label},u.value))}),M?e.jsx(oe,{size:"small",onClick:()=>v(o),sx:{mt:.5},children:"Reset"}):null]},o.id):o.type==="color"?e.jsxs(G,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:y,label:o.label,value:o.value,helperText:o.description,disabled:o.disabled,onChange:u=>n?.(o.id,u.target.value),InputProps:{startAdornment:e.jsx(p,{component:"input",type:"color",value:String(o.value),disabled:o.disabled,onChange:u=>n?.(o.id,u.target.value),sx:{width:28,height:28,p:0,mr:1,border:0,bgcolor:"transparent",cursor:o.disabled?"default":"pointer"}})}}),M?e.jsx(oe,{size:"small",onClick:()=>v(o),sx:{mt:.5},children:"Reset"}):null]},o.id):e.jsxs(G,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:y,label:o.label,value:o.value,helperText:o.description,disabled:o.disabled,onChange:u=>n?.(o.id,u.target.value)}),M?e.jsx(oe,{size:"small",onClick:()=>v(o),sx:{mt:.5},children:"Reset"}):null]},o.id)})]},j)),c?e.jsxs(p,{sx:{p:1.25,borderRadius:1,bgcolor:"action.hover"},children:[e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:850,children:"Current values"}),e.jsx(G,{direction:"row",flexWrap:"wrap",gap:.75,sx:{mt:1},children:t.map(j=>e.jsx(be,{size:"small",label:`${j.label}: ${Ct(j)}`},j.id))})]}):null]})})}function Rt({value:t,alpha:n=1,swatches:d=["#2563eb","#7c3aed","#db2777","#dc2626","#f59e0b","#059669"],showValue:l=!0,onChange:f,onAlphaChange:c}){const g=Math.round(n*100),x=`${t}${Math.round(n*255).toString(16).padStart(2,"0")}`;return e.jsx(Pe,{variant:"outlined",sx:{p:2,borderRadius:1},children:e.jsxs(G,{spacing:2,children:[e.jsx(p,{sx:{height:96,borderRadius:1,border:1,borderColor:"divider",backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%), linear-gradient(-45deg, #e5e7eb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e5e7eb 75%), linear-gradient(-45deg, transparent 75%, #e5e7eb 75%)",backgroundSize:"18px 18px",backgroundPosition:"0 0, 0 9px, 9px -9px, -9px 0"},children:e.jsx(p,{sx:{height:"100%",borderRadius:1,bgcolor:t,opacity:n}})}),e.jsxs(G,{direction:{xs:"column",sm:"row"},spacing:1.5,children:[e.jsx(Z,{label:"Color",type:"color",value:t,onChange:a=>f?.(a.target.value),sx:{width:{xs:"100%",sm:120}}}),e.jsx(Z,{label:"Hex",value:t,onChange:a=>f?.(a.target.value),fullWidth:!0})]}),e.jsxs(p,{children:[e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:800,children:"Alpha"}),e.jsx(Le,{min:0,max:1,step:.01,value:n,onChange:(a,m)=>c?.(Array.isArray(m)?m[0]:m),valueLabelDisplay:"auto",valueLabelFormat:a=>`${Math.round(a*100)}%`}),e.jsx(Z,{label:"Alpha",type:"number",value:g,onChange:a=>c?.(Math.min(Math.max(Number(a.target.value),0),100)/100),InputProps:{endAdornment:e.jsx(Ze,{position:"end",children:"%"})},fullWidth:!0})]}),e.jsx(p,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:d.map(a=>e.jsx(p,{component:"button","aria-label":a,onClick:()=>f?.(a),sx:{width:32,height:32,borderRadius:"50%",border:2,borderColor:a.toLowerCase()===t.toLowerCase()?"text.primary":"divider",bgcolor:a,cursor:"pointer"}},a))}),l?e.jsxs(p,{sx:{p:1.5,borderRadius:1,bgcolor:"#0f172a",color:"#e5e7eb"},children:[e.jsx(q,{variant:"caption",color:"#94a3b8",children:"selected color"}),e.jsx(q,{fontFamily:"monospace",children:x})]}):null]})})}function zt({onFiles:t,sx:n,...d}){const[l,f]=b.useState(!1);function c(g){g&&t?.(Array.from(g))}return e.jsxs(p,{...d,onDragOver:g=>{g.preventDefault(),f(!0)},onDragLeave:()=>f(!1),onDrop:g=>{g.preventDefault(),f(!1),c(g.dataTransfer.files)},sx:[{p:4,border:2,borderStyle:"dashed",borderColor:l?"primary.main":"divider",borderRadius:1,textAlign:"center",bgcolor:l?"primary.50":"background.paper"},...Array.isArray(n)?n:n?[n]:[]],children:[e.jsx(q,{fontWeight:800,children:"Drop files here"}),e.jsx(q,{variant:"body2",color:"text.secondary",children:"Drag files into this zone"})]})}function ge(t,n,d){return Math.min(Math.max(t,n),d)}function Mt(t){const n=Math.floor(t/60),d=Math.floor(t%60);return`${n}:${String(d).padStart(2,"0")}`}function ye(t,n){return n>0?ge(t/n*100,0,100):0}function At(t,n){return n.reduce((d,l)=>d?Math.abs(l.time-t)<Math.abs(d.time-t)?l:d:l,null)}function Pt({duration:t,value:n,defaultValue:d=0,markers:l=[],thumbnails:f=[],disabled:c=!1,showTime:g=!0,preview:x=!0,step:a=1,formatTime:m=Mt,onChange:y,sx:v,...j}){const T=b.useRef(null),[$,o]=b.useState(d),[M,u]=b.useState(!1),[S,E]=b.useState(null),D=ge(n??$,0,t),k=S===null?D:S,L=ye(D,t),w=ye(k,t),A=b.useMemo(()=>[...l].sort((h,I)=>h.time-I.time),[l]),N=At(k,f);function X(h,I){const B=a>0?Math.round(h/a)*a:h,i=ge(B,0,t);n===void 0&&o(i),y?.(i,I)}function s(h){const I=T.current;if(!I)return D;const B=I.getBoundingClientRect();return ge((h-B.left)/B.width,0,1)*t}function R(h){E(s(h))}return e.jsxs(p,{...j,sx:[{width:"100%",color:c?"text.disabled":"text.primary",userSelect:"none"},...Array.isArray(v)?v:v?[v]:[]],children:[g?e.jsxs(p,{sx:{display:"flex",justifyContent:"space-between",mb:1},children:[e.jsx(q,{variant:"caption",fontWeight:800,children:m(D)}),e.jsx(q,{variant:"caption",color:"text.secondary",children:m(t)})]}):null,e.jsxs(p,{ref:T,role:"slider",tabIndex:c?-1:0,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":Math.round(D),onPointerMove:h=>{c||(R(h.clientX),M&&X(s(h.clientX),"drag"))},onPointerLeave:()=>{M||E(null)},onPointerDown:h=>{c||(u(!0),h.currentTarget.setPointerCapture(h.pointerId),X(s(h.clientX),"click"))},onPointerUp:h=>{u(!1),h.currentTarget.releasePointerCapture(h.pointerId)},onPointerCancel:()=>u(!1),onKeyDown:h=>{c||(h.key==="ArrowLeft"&&(X(D-a,"keyboard"),h.preventDefault()),h.key==="ArrowRight"&&(X(D+a,"keyboard"),h.preventDefault()),h.key==="Home"&&(X(0,"keyboard"),h.preventDefault()),h.key==="End"&&(X(t,"keyboard"),h.preventDefault()))},sx:{position:"relative",height:86,cursor:c?"default":"pointer",outline:"none","&:focus-visible .TimelineScrubber-track":{boxShadow:"0 0 0 3px rgba(37,99,235,0.28)"}},children:[x&&S!==null?e.jsxs(p,{sx:{position:"absolute",left:`${w}%`,top:0,transform:"translateX(-50%)",width:116,p:.75,border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper",boxShadow:"0 14px 34px rgba(15,23,42,0.18)",pointerEvents:"none",zIndex:2},children:[e.jsx(p,{sx:{height:56,borderRadius:.75,overflow:"hidden",bgcolor:"#e5e7eb"},children:N?.thumbnail??e.jsx(p,{sx:{height:"100%",display:"grid",placeItems:"center",bgcolor:"#0f172a",color:"#fff"},children:e.jsx(q,{variant:"caption",fontWeight:900,children:m(k)})})}),e.jsx(q,{variant:"caption",fontWeight:800,sx:{display:"block",mt:.5,textAlign:"center"},children:m(k)})]}):null,e.jsx(p,{className:"TimelineScrubber-track",sx:{position:"absolute",left:0,right:0,bottom:18,height:12,borderRadius:999,bgcolor:"#e5e7eb",overflow:"hidden",transition:"box-shadow 120ms ease"},children:e.jsx(p,{sx:{width:`${L}%`,height:"100%",borderRadius:999,background:"linear-gradient(90deg, #2563eb, #06b6d4)"}})}),A.map(h=>{const I=ye(h.time,t);return e.jsx(ne,{title:h.label??m(h.time),arrow:!0,children:e.jsx(p,{onPointerDown:B=>{B.stopPropagation(),X(h.time,"marker")},sx:{position:"absolute",left:`${I}%`,bottom:11,width:12,height:26,borderRadius:999,transform:"translateX(-50%)",bgcolor:h.color??"#f59e0b",border:"2px solid",borderColor:"background.paper",boxShadow:"0 8px 18px rgba(15,23,42,0.2)",zIndex:1}})},h.id)}),e.jsx(p,{sx:{position:"absolute",left:`${L}%`,bottom:5,width:28,height:28,borderRadius:"50%",transform:"translateX(-50%)",bgcolor:"background.paper",border:3,borderColor:"#2563eb",boxShadow:M?"0 12px 30px rgba(37,99,235,0.36)":"0 8px 20px rgba(15,23,42,0.2)"}})]})]})}function Ae(t,n,d){return Math.min(Math.max(t,n),d)}function Lt({items:t=[],defaultViewport:n={x:0,y:0,zoom:1},viewport:d,minZoom:l=.3,maxZoom:f=2.5,showGrid:c=!0,showMinimap:g=!0,selectedItemId:x,renderItem:a,onViewportChange:m,onItemMove:y,onItemSelect:v,sx:j,...T}){const $=b.useRef(null),[o,M]=b.useState(n),[u,S]=b.useState(Object.fromEntries(t.map(s=>[s.id,{x:s.x,y:s.y}]))),[E,D]=b.useState(x??null),k=d??o,L=x??E,w=b.useMemo(()=>{const s=t.map(i=>({x:u[i.id]?.x??i.x,y:u[i.id]?.y??i.y,width:i.width??140,height:i.height??80}));if(!s.length)return{minX:-200,minY:-120,width:400,height:240};const R=Math.min(...s.map(i=>i.x))-80,h=Math.min(...s.map(i=>i.y))-80,I=Math.max(...s.map(i=>i.x+i.width))+80,B=Math.max(...s.map(i=>i.y+i.height))+80;return{minX:R,minY:h,width:I-R,height:B-h}},[u,t]);function A(s){const R={...s,zoom:Ae(s.zoom,l,f)};d===void 0&&M(R),m?.(R)}function N(s,R){const h=$.current?.getBoundingClientRect();return{x:(s-(h?.left??0)-k.x)/k.zoom,y:(R-(h?.top??0)-k.y)/k.zoom}}function X(s){D(s?.id??null),v?.(s)}return e.jsxs(p,{...T,ref:$,onWheel:s=>{s.preventDefault();const R=Ae(k.zoom*(s.deltaY>0?.92:1.08),l,f),h=N(s.clientX,s.clientY),I=$.current?.getBoundingClientRect(),B=s.clientX-(I?.left??0)-h.x*R,i=s.clientY-(I?.top??0)-h.y*R;A({x:B,y:i,zoom:R})},onPointerDown:s=>{if(s.target!==s.currentTarget)return;X(null);const R=s.clientX,h=s.clientY,I=k;s.currentTarget.setPointerCapture(s.pointerId);function B(P){A({...I,x:I.x+P.clientX-R,y:I.y+P.clientY-h})}function i(){window.removeEventListener("pointermove",B),window.removeEventListener("pointerup",i)}window.addEventListener("pointermove",B),window.addEventListener("pointerup",i)},sx:[{position:"relative",minHeight:420,overflow:"hidden",bgcolor:"#f8fafc",cursor:"grab",touchAction:"none"},...Array.isArray(j)?j:j?[j]:[]],children:[e.jsx(p,{sx:{position:"absolute",inset:0,pointerEvents:"none",backgroundImage:c?"linear-gradient(rgba(148,163,184,0.25) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,0.25) 1px, transparent 1px)":void 0,backgroundSize:`${32*k.zoom}px ${32*k.zoom}px`,backgroundPosition:`${k.x}px ${k.y}px`}}),e.jsx(p,{sx:{position:"absolute",left:k.x,top:k.y,transform:`scale(${k.zoom})`,transformOrigin:"0 0"},children:t.map(s=>{const R=u[s.id]??{x:s.x,y:s.y},h=s.id===L;return e.jsx(p,{onPointerDown:I=>{I.stopPropagation(),X(s);const B=u[s.id]??{x:s.x,y:s.y},i=N(I.clientX,I.clientY);I.currentTarget.setPointerCapture(I.pointerId);function P(ie){const ae=N(ie.clientX,ie.clientY),H={x:B.x+ae.x-i.x,y:B.y+ae.y-i.y};S(ee=>({...ee,[s.id]:H})),y?.(s.id,H)}function _(){window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",_)}window.addEventListener("pointermove",P),window.addEventListener("pointerup",_)},sx:{position:"absolute",left:R.x,top:R.y,width:s.width??140,height:s.height??80,display:"grid",placeItems:"center",border:h?2:1,borderColor:h?"primary.main":"divider",borderRadius:1,bgcolor:s.color??"background.paper",boxShadow:h?"0 18px 40px rgba(37,99,235,0.24)":"0 12px 28px rgba(15,23,42,0.13)",cursor:"grab",userSelect:"none"},children:a?a(s,h):e.jsx(q,{fontWeight:900,children:s.label??s.id})},s.id)})}),e.jsxs(p,{sx:{position:"absolute",left:12,bottom:12,display:"flex",gap:.75,alignItems:"center",px:1,py:.5,borderRadius:1,bgcolor:"rgba(255,255,255,0.92)",border:1,borderColor:"divider",fontSize:12,fontWeight:800},children:[Math.round(k.zoom*100),"%"]}),g?e.jsx(p,{sx:{position:"absolute",right:12,bottom:12,width:160,height:100,border:1,borderColor:"divider",borderRadius:1,bgcolor:"rgba(255,255,255,0.9)",overflow:"hidden"},children:t.map(s=>{const R=u[s.id]??{x:s.x,y:s.y},h=(R.x-w.minX)/w.width*100,I=(R.y-w.minY)/w.height*100,B=(s.width??140)/w.width*100,i=(s.height??80)/w.height*100;return e.jsx(p,{sx:{position:"absolute",left:`${h}%`,top:`${I}%`,width:`${B}%`,height:`${i}%`,minWidth:6,minHeight:4,borderRadius:.5,bgcolor:s.id===L?"primary.main":s.color??"#94a3b8"}},s.id)})}):null]})}function Tt({children:t,title:n,content:d,media:l,actions:f=[],copyText:c,placement:g="top",pinMode:x=!0,defaultPinned:a=!1,openDelay:m=120,sx:y,...v}){const j=b.useRef(null),T=b.useRef(null),$=b.useRef(null),[o,M]=b.useState(a),[u,S]=b.useState(a),[E,D]=b.useState(!1);function k(){$.current&&window.clearTimeout($.current),T.current&&window.clearTimeout(T.current)}function L(){k(),!o&&($.current=window.setTimeout(()=>M(!0),m))}function w(){k(),M(!0)}function A(){k(),u||(T.current=window.setTimeout(()=>M(!1),100))}function N(){const s=!u;S(s),M(s||o)}async function X(){c&&(await navigator.clipboard?.writeText(c),D(!0),window.setTimeout(()=>D(!1),1100))}return e.jsxs(e.Fragment,{children:[e.jsx(p,{component:"span",ref:j,onMouseEnter:L,onMouseLeave:A,onFocus:L,onBlur:A,onClick:()=>{x&&(M(!0),S(!0))},sx:{display:"inline-flex"},children:t}),e.jsx(et,{open:o,anchorEl:j.current,placement:g,modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{padding:12}}],sx:{zIndex:1500},children:e.jsx(Ke,{onClickAway:()=>{u&&(M(!1),S(!1))},children:e.jsx(p,{onMouseEnter:w,onMouseLeave:A,sx:{width:320,maxWidth:"calc(100vw - 24px)",borderRadius:1,overflow:"hidden",boxShadow:"0 24px 64px rgba(15,23,42,0.28)",bgcolor:"background.paper"},children:e.jsx(p,{...v,sx:[{p:1.25},...Array.isArray(y)?y:y?[y]:[]],children:e.jsxs(G,{spacing:1.25,children:[l?e.jsx(p,{sx:{borderRadius:1,overflow:"hidden",bgcolor:"#e5e7eb"},children:l}):null,e.jsxs(G,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsxs(p,{sx:{minWidth:0,flex:1},children:[n?e.jsx(q,{fontWeight:900,children:n}):null,d?e.jsx(q,{variant:"body2",color:"text.secondary",sx:{mt:n?.25:0},children:d}):null]}),x?e.jsx(ne,{title:u?"Unpin":"Pin",children:e.jsx(ce,{size:"small",onClick:N,children:u?e.jsx(Qe,{fontSize:"small"}):e.jsx(Je,{fontSize:"small"})})}):null]}),c||f.length?e.jsxs(G,{direction:"row",spacing:1,flexWrap:"wrap",children:[c?e.jsx(oe,{size:"small",variant:"outlined",startIcon:e.jsx(_e,{}),onClick:X,children:E?"Copied":"Copy"}):null,f.map(s=>e.jsx(oe,{size:"small",variant:"contained",startIcon:s.icon,onClick:s.onClick,children:s.label},s.id))]}):null]})})})})})]})}exports.BeforeAfterSlider=kt;exports.CodeViewer=lt;exports.ColorPicker=Rt;exports.CommandPalette=xt;exports.ComponentExample=tt;exports.DockBar=pt;exports.DraggableBox=ct;exports.FileDropZone=zt;exports.FloatingToolbar=mt;exports.GlassBox=dt;exports.InfiniteCanvas=Lt;exports.InspectorPanel=It;exports.MagneticCard=yt;exports.NodeCanvas=vt;exports.ResizableFrame=$t;exports.SmartTooltip=Tt;exports.SplitPane=gt;exports.SpotlightPanel=wt;exports.TimelineScrubber=Pt;
14
+ linear-gradient(105deg, ${N.alpha(l,.34)} 0%, ${N.alpha(l,.08)} 18%, ${N.alpha(l,0)} 34%),
15
+ radial-gradient(circle at 18% 18%, ${N.alpha(l,.38)} 0 3%, ${N.alpha(l,0)} 18%)
16
+ `,pointerEvents:"none"},"& .GlassBox-liquidLens":{position:"absolute",inset:0,zIndex:1,pointerEvents:"none",backgroundImage:"var(--glassbox-refraction-background, none)",backgroundSize:"var(--glassbox-refraction-background-size, cover)",backgroundPosition:"var(--glassbox-refraction-background-position, center)",backgroundRepeat:"no-repeat",filter:`url(#${y}) saturate(150%) contrast(112%)`,opacity:M?.72:0,transition:"opacity 120ms ease-out",maskImage:`linear-gradient(to bottom, transparent 0, transparent calc(${I} + 10px), black calc(${I} + 28px), black 100%)`,WebkitMaskImage:`linear-gradient(to bottom, transparent 0, transparent calc(${I} + 10px), black calc(${I} + 28px), black 100%)`},"& .GlassBox-refractionOffset":{position:"absolute",inset:0,zIndex:2,pointerEvents:"none",opacity:M?.16+x*.16:0,backdropFilter:"blur(3px) saturate(190%)",WebkitBackdropFilter:"blur(3px) saturate(190%)",background:`
17
+ linear-gradient(180deg, ${N.alpha(l,.2)} 0, ${N.alpha(l,0)} 20%),
18
+ linear-gradient(90deg, ${N.alpha(l,0)} 0 18%, ${N.alpha(l,.14)} 26%, ${N.alpha(l,0)} 34% 58%, ${N.alpha(l,.1)} 68%, ${N.alpha(l,0)} 76% 100%)
19
+ `,transition:"opacity 120ms ease-out",maskImage:`linear-gradient(to bottom, transparent 0, transparent ${I}, black calc(${I} + 18px), black 100%)`,WebkitMaskImage:`linear-gradient(to bottom, transparent 0, transparent ${I}, black calc(${I} + 18px), black 100%)`},"& .GlassBox-content":{position:"relative",zIndex:3,textShadow:`0 1px 10px ${N.alpha("#00121d",.36)}`},"& > *":{position:"relative",zIndex:3}},...Array.isArray(g)?g:g?[g]:[]],children:[e.jsx(u,{component:"svg","aria-hidden":"true",focusable:"false",sx:{position:"absolute",width:0,height:0,overflow:"hidden"},children:e.jsxs("filter",{id:y,children:[e.jsx("feTurbulence",{type:"fractalNoise",baseFrequency:`${B} ${B*2.6}`,numOctaves:"2",seed:i,result:"liquidNoise"}),e.jsx("feDisplacementMap",{in:"SourceGraphic",in2:"liquidNoise",scale:f,xChannelSelector:"R",yChannelSelector:"G"})]})}),e.jsx(u,{className:"GlassBox-liquidLens"}),e.jsx(u,{className:"GlassBox-refractionOffset"}),e.jsx(u,{className:"GlassBox-content",children:j})]})}function $t(t,n,a){return Math.min(Math.max(t,n),a)}function St({items:t,iconSize:n=52,magnification:a=1.7,gap:l=10,tooltip:h=!0,sx:c,...j}){const[g,d]=w.useState(null);return e.jsx(u,{...j,role:"toolbar",sx:[{display:"inline-flex",alignItems:"flex-end",gap:`${l}px`,p:1,border:1,borderColor:"rgba(255,255,255,0.5)",borderRadius:3,bgcolor:"rgba(255,255,255,0.34)",boxShadow:"0 18px 44px rgba(15, 23, 42, 0.22)",backdropFilter:"blur(18px) saturate(150%)",WebkitBackdropFilter:"blur(18px) saturate(150%)"},...Array.isArray(c)?c:c?[c]:[]],onMouseLeave:()=>d(null),children:t.map((C,y)=>{const k=g===null?4:Math.abs(y-g),x=$t(1-k/3,0,1),L=1+(a-1)*x,I=-18*x,i=e.jsx(u,{component:"button",type:"button","aria-label":C.label,onClick:C.onClick,onMouseEnter:()=>d(y),sx:{width:n,height:n,display:"grid",placeItems:"center",flex:"0 0 auto",border:0,borderRadius:2,p:0,color:"inherit",bgcolor:"rgba(255,255,255,0.72)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.85), 0 8px 18px rgba(15, 23, 42, 0.18)",cursor:"pointer",transform:`translateY(${I}px) scale(${L})`,transformOrigin:"bottom center",transition:"transform 130ms ease-out, background-color 130ms ease-out","&:focus-visible":{outline:"2px solid #2563eb",outlineOffset:3},"&:active":{bgcolor:"rgba(255,255,255,0.9)"}},children:e.jsx(q,{component:"span","aria-hidden":"true",sx:{display:"grid",placeItems:"center",fontSize:Math.round(n*.52),lineHeight:1},children:C.icon})},C.id);return h?e.jsx(ce,{title:C.label,placement:"top",arrow:!0,children:i},C.id):i})})}function Ve(t){return t.toLowerCase().trim()}function It(t){return Ve([t.label,t.description,t.group,t.parentId,...t.keywords??[]].filter(Boolean).join(" "))}function Le(t){return Array.from(new Set(t.map(n=>n.group).filter(Boolean)))}function Dt({items:t,variant:n="list",selectedId:a,placeholder:l="Search",emptyText:h="No items found",maxResults:c,showSearch:j=!0,dense:g=!1,expandedGroups:d,defaultExpandedGroups:C,onExpandedGroupsChange:y,onSelect:k,sx:x,...L}){const I=C??Le(t),[i,B]=w.useState(""),[f,M]=w.useState(0),[O,F]=w.useState(I),D=Ve(i),R=d??O,$=w.useMemo(()=>{const o=D?t.filter(W=>It(W).includes(D)):t;return typeof c=="number"?o.slice(0,c):o},[t,c,D]),T=Le($),V=$;function H(o){o.onSelect?.(),k?.(o),B(""),M(0)}function p(o){d===void 0&&F(o),y?.(o)}function P(o){p(R.includes(o)?R.filter(W=>W!==o):[...R,o])}function m(o,W=0){const J=o.id===a;return e.jsxs(Me,{selected:J,dense:g,onClick:()=>H(o),sx:{borderRadius:1,pl:1.25+W*2,"&.Mui-selected":{bgcolor:"action.selected",color:"primary.main"},"&.Mui-selected:hover, &:hover":{bgcolor:"action.hover"}},children:[o.icon?e.jsx(_e,{sx:{minWidth:34,color:"inherit"},children:o.icon}):null,e.jsx(Re,{primary:o.label,secondary:o.description,primaryTypographyProps:{fontWeight:J?850:700},secondaryTypographyProps:{color:"text.secondary"}})]},o.id)}function z(){return $.length?T.length?T.map(o=>e.jsxs(u,{children:[e.jsx(q,{variant:"caption",fontWeight:900,color:"text.secondary",sx:{display:"block",px:1.25,pt:1.5,pb:.5},children:o}),$.filter(W=>W.group===o).map(W=>m(W))]},o)):$.map(o=>m(o)):e.jsx(u,{sx:{px:2,py:4,textAlign:"center",color:"text.secondary"},children:h})}function X(){return $.length?T.length?T.map(o=>{const W=D||R.includes(o);return e.jsxs(u,{children:[e.jsxs(Me,{dense:g,onClick:()=>P(o),sx:{borderRadius:1,px:1.25},children:[e.jsx(q,{component:"span","aria-hidden":"true",sx:{mr:1,width:16,color:"text.secondary"},children:W?"▾":"▸"}),e.jsx(Re,{primary:o,primaryTypographyProps:{fontWeight:900}})]}),e.jsx(Ge,{in:!!W,timeout:"auto",unmountOnExit:!0,children:$.filter(J=>J.group===o).map(J=>m(J,1))})]},o)}):$.map(o=>m(o)):e.jsx(u,{sx:{px:2,py:4,textAlign:"center",color:"text.secondary"},children:h})}return e.jsxs(u,{...L,sx:[{display:"flex",flexDirection:"column",gap:1,minWidth:0},...Array.isArray(x)?x:x?[x]:[]],children:[j?e.jsx(u,{sx:{px:1.25,py:.75,border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper"},children:e.jsx(Ue,{fullWidth:!0,value:i,placeholder:l,onChange:o=>{B(o.target.value),M(0)},onKeyDown:o=>{o.key==="ArrowDown"&&(o.preventDefault(),M(W=>Math.min(W+1,V.length-1))),o.key==="ArrowUp"&&(o.preventDefault(),M(W=>Math.max(W-1,0))),o.key==="Enter"&&V[f]&&(o.preventDefault(),H(V[f]))},sx:{fontSize:14}})}):null,e.jsx(Ze,{disablePadding:!0,dense:g,sx:{overflow:"auto"},children:n==="tree"?X():z()})]})}function Be(t,n,a){return Math.min(Math.max(t,n),a)}function Mt(t){if(!t||typeof window>"u")return null;const n=window.localStorage.getItem(t),a=n===null?Number.NaN:Number(n);return Number.isFinite(a)?a:null}function Rt({first:t,second:n,orientation:a="horizontal",initialSize:l=50,size:h,defaultSize:c,minSize:j=20,maxSize:g=80,dividerSize:d=8,snapPoints:C=[],snapThreshold:y=4,resetSize:k=c??l,collapsed:x,defaultCollapsed:L=null,collapsedSize:I=0,persistKey:i,keyboardStep:B=5,onSizeChange:f,onCollapsedChange:M,onDraggingChange:O,dividerLabel:F="Resize panels",sx:D,...R}){const $=w.useRef(null),[T,V]=w.useState(()=>Mt(i)??c??l),[H,p]=w.useState(L),[P,m]=w.useState(!1),z=a==="horizontal",o=Be(h??T,j,g),W=x??H,J=W==="first"?I:W==="second"?100-I:o,ue=W==="first"&&I<=0,ee=W==="second"&&I<=0;w.useEffect(()=>{i&&window.localStorage.setItem(i,String(o))},[i,o]),w.useEffect(()=>{O?.(P)},[P,O]);function G(A){const se=C.reduce((ne,fe)=>{const ge=Math.abs(ne-A);return Math.abs(fe-A)<ge?fe:ne},A),re=Math.abs(se-A)<=y,K=Be(re?se:A,j,g);h===void 0&&V(K),f?.(K),le(null)}function ae(A,se){const re=$.current;if(!re)return;const K=re.getBoundingClientRect(),ne=z?(A-K.left)/K.width*100:(se-K.top)/K.height*100;G(ne)}function _(A){G(o+A)}function te(){G(k)}function pe(A){le(W===A?null:A)}function le(A){x===void 0&&p(A),M?.(A)}return e.jsxs(u,{...R,ref:$,sx:[{display:"grid",gridTemplateColumns:z?`${J}% ${d}px 1fr`:"1fr",gridTemplateRows:z?"1fr":`${J}% ${d}px 1fr`,minHeight:280,overflow:"hidden",userSelect:P?"none":void 0},...Array.isArray(D)?D:D?[D]:[]],onPointerMove:A=>{P&&ae(A.clientX,A.clientY)},onPointerUp:()=>{m(!1)},onPointerCancel:()=>m(!1),children:[e.jsx(u,{sx:{minWidth:0,minHeight:0,overflow:"auto",display:ue?"none":void 0},children:t}),e.jsx(u,{role:"separator","aria-label":F,"aria-orientation":z?"vertical":"horizontal","aria-valuemin":j,"aria-valuemax":g,"aria-valuenow":Math.round(o),tabIndex:0,onPointerDown:A=>{m(!0),A.currentTarget.setPointerCapture(A.pointerId),ae(A.clientX,A.clientY)},onPointerUp:A=>{m(!1),A.currentTarget.releasePointerCapture(A.pointerId)},onDoubleClick:te,onKeyDown:A=>{A.key==="Enter"&&(te(),A.preventDefault()),A.key==="Home"&&(pe("first"),A.preventDefault()),A.key==="End"&&(pe("second"),A.preventDefault()),(A.key==="ArrowLeft"||A.key==="ArrowUp")&&(_(-B),A.preventDefault()),(A.key==="ArrowRight"||A.key==="ArrowDown")&&(_(B),A.preventDefault())},sx:{position:"relative",bgcolor:P?"primary.main":"divider",cursor:z?"col-resize":"row-resize",touchAction:"none",transition:"background-color 120ms ease","&:hover":{bgcolor:"primary.main"},"&:focus-visible":{outline:"2px solid",outlineColor:"primary.main",outlineOffset:-2},"&::after":{content:'""',position:"absolute",inset:z?"30% -4px":"-4px 30%",borderRadius:999,bgcolor:P?"primary.contrastText":"text.disabled",opacity:.55}}}),e.jsx(u,{sx:{minWidth:0,minHeight:0,overflow:"auto",display:ee?"none":void 0},children:n})]})}function zt(t,n){return n??t?.getBoundingClientRect()??null}function At({open:t,children:n,anchorEl:a,anchorRect:l,containerRef:h,placement:c="top",offset:j=8,boundaryPadding:g=8,autoUpdate:d=!0,arrow:C=!0,sx:y,...k}){const x=w.useRef(null),[L,I]=w.useState({left:-9999,top:-9999}),i=w.useCallback(()=>{if(!t)return;const B=zt(a,l),f=x.current;if(!B||!f)return;const M=h?.current?.getBoundingClientRect(),O=M?.left??0,F=M?.top??0,D=M?.width??window.innerWidth,R=M?.height??window.innerHeight,$=f.offsetWidth/2,T=f.offsetHeight,V=B.left-O+B.width/2,H=c==="top"?B.top-F-j:B.bottom-F+j,p=Math.min(Math.max(V,$+g),D-$-g),P=c==="top"?Math.max(H,T+g):Math.min(H,R-T-g);I({left:p,top:P})},[a,l,g,h,j,t,c]);return w.useLayoutEffect(()=>{i()},[i]),w.useEffect(()=>{if(!(!t||!d))return window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[d,t,i]),t?e.jsx(u,{...k,ref:x,role:"toolbar",sx:[{position:h?"absolute":"fixed",left:L.left,top:L.top,zIndex:1300,display:"inline-flex",alignItems:"center",gap:.5,p:.5,borderRadius:1.5,bgcolor:"rgba(15,23,42,0.96)",color:"#e5e7eb",boxShadow:"0 16px 40px rgba(15, 23, 42, 0.34)",transform:c==="top"?"translate(-50%, -100%)":"translate(-50%, 0)",backdropFilter:"blur(12px)","&::after":C?{content:'""',position:"absolute",left:"50%",width:10,height:10,bgcolor:"rgba(15,23,42,0.96)",transform:"translateX(-50%) rotate(45deg)",bottom:c==="top"?-5:void 0,top:c==="bottom"?-5:void 0}:void 0},...Array.isArray(y)?y:y?[y]:[]],children:n}):null}function Pt({strength:t=18,tilt:n=10,lift:a=10,glare:l=!0,perspective:h=900,sx:c,children:j,...g}){const[d,C]=w.useState({x:0,y:0,rotateX:0,rotateY:0,glareX:50,glareY:50,active:!1});return e.jsx(u,{...g,onMouseMove:y=>{const k=y.currentTarget.getBoundingClientRect(),x=(y.clientX-k.left)/k.width,L=(y.clientY-k.top)/k.height,I=(x-.5)*t,i=(L-.5)*t;C({x:I,y:i,rotateX:(.5-L)*n,rotateY:(x-.5)*n,glareX:x*100,glareY:L*100,active:!0})},onMouseLeave:()=>C({x:0,y:0,rotateX:0,rotateY:0,glareX:50,glareY:50,active:!1}),sx:[{position:"relative",overflow:"hidden",transform:`
20
+ perspective(${h}px)
21
+ translate3d(${d.x}px, ${d.y}px, ${d.active?-a:0}px)
22
+ rotateX(${d.rotateX}deg)
23
+ rotateY(${d.rotateY}deg)
24
+ `,transformStyle:"preserve-3d",transition:d.active?"transform 80ms ease-out, box-shadow 120ms ease-out":"transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 260ms ease",willChange:"transform",boxShadow:d.active?"0 28px 70px rgba(15, 23, 42, 0.24)":"0 14px 34px rgba(15, 23, 42, 0.12)","&::before":l?{content:'""',position:"absolute",inset:0,pointerEvents:"none",opacity:d.active?.78:0,transition:"opacity 160ms ease",background:`radial-gradient(circle at ${d.glareX}% ${d.glareY}%, rgba(255,255,255,0.55), rgba(255,255,255,0.16) 22%, transparent 48%)`,mixBlendMode:"screen"}:void 0,"& > *":{position:"relative",zIndex:1,transform:d.active?"translateZ(24px)":"translateZ(0)",transition:"transform 180ms ease"}},...Array.isArray(c)?c:c?[c]:[]],children:j})}function Tt({radius:t=160,dim:n=.72,sx:a,children:l,...h}){const[c,j]=w.useState({x:50,y:50});return e.jsx(u,{...h,onMouseMove:g=>{const d=g.currentTarget.getBoundingClientRect();j({x:(g.clientX-d.left)/d.width*100,y:(g.clientY-d.top)/d.height*100})},sx:[{position:"relative",overflow:"hidden","&::after":{content:'""',position:"absolute",inset:0,pointerEvents:"none",background:`radial-gradient(circle ${t}px at ${c.x}% ${c.y}%, transparent 0, transparent 45%, rgba(0,0,0,${n}) 100%)`}},...Array.isArray(a)?a:a?[a]:[]],children:l})}function We(t,n){return Math.round(t/n)*n}function Lt(t,n,a,l,h){const c=t.x+a/2,j=t.y+l/2,g=n.x+a/2,d=n.y+l/2,C=(c+g)/2;if(h==="ellipse"){const y=Math.max(Math.abs(g-c)/2,24),k=Math.max(Math.abs(d-j)/2,24);return`M ${c} ${j} A ${y} ${k} 0 0 1 ${g} ${d}`}return h==="curved"?`M ${c} ${j} C ${C} ${j}, ${C} ${d}, ${g} ${d}`:h==="step"?`M ${c} ${j} L ${C} ${j} L ${C} ${d} L ${g} ${d}`:`M ${c} ${j} L ${g} ${d}`}function Bt({nodes:t,connections:n=[],nodeWidth:a=132,nodeHeight:l=52,mode:h="edit",snapToGrid:c=!1,gridSize:j=24,showGrid:g=!1,selectedNodeId:d,connectionStyle:C="line",editableTools:y=!1,linkTypes:k=["line","curved","step","ellipse"],renderNode:x,onNodesChange:L,onConnectionsChange:I,onNodeMove:i,onNodeSelect:B,sx:f,...M}){const[O,F]=w.useState(t),[D,R]=w.useState(n),$=y?O:t,T=y?D:n,[V,H]=w.useState(Object.fromEntries($.map(r=>[r.id,{x:r.x,y:r.y}]))),[p,P]=w.useState(d??null),[m,z]=w.useState(!1),[X,o]=w.useState(""),[W,J]=w.useState(k[0]??"line"),[ue,ee]=w.useState(""),[G,ae]=w.useState(null),_=d??p,te=$.find(r=>r.id===_)??null,pe=T.map((r,v)=>({connection:r,index:v})).filter(({connection:r})=>r.from===_||r.to===_),le=t.map(r=>`${r.id}:${r.label}:${r.x}:${r.y}:${r.color??""}`).join("|"),A=n.map(r=>`${r.from}:${r.to}:${r.type??""}:${r.label??""}:${r.color??""}`).join("|");w.useEffect(()=>{y||F(t),H(r=>({...Object.fromEntries(t.map(v=>[v.id,r[v.id]??{x:v.x,y:v.y}]))}))},[y,le]),w.useEffect(()=>{y||R(n)},[A,y]);function se(r){F(r),L?.(r)}function re(r){R(r),I?.(r)}function K(r,v){const E=c?{x:We(v.x,j),y:We(v.y,j)}:v;H(S=>({...S,[r]:E})),y&&se($.map(S=>S.id===r?{...S,...E}:S)),i?.(r,E)}function ne(){const r=$.length+1,v={id:`node-${Date.now()}`,label:`Box ${r}`,x:48+r*18,y:48+r*18,color:"#ffffff"};se([...$,v]),H(E=>({...E,[v.id]:{x:v.x,y:v.y}})),P(v.id)}function fe(){_&&(se($.filter(r=>r.id!==_)),re(T.filter(r=>r.from!==_&&r.to!==_)),P(null),z(!1))}function ge(r){_&&se($.map(v=>v.id===_?{...v,...r}:v))}function ve(){if(!_||!X||_===X)return;const r={from:_,to:X,type:W,label:ue,color:W==="ellipse"?"#db2777":W==="step"?"#059669":"#2563eb"},v=[...T.filter(E=>!(E.from===_&&E.to===X)),r];re(v),o(""),ee(""),ae(v.indexOf(r))}function s(r,v){const E=T[r];if(!E)return;const S={...E,...v},Q=T.map((U,he)=>he===r?S:U).filter((U,he)=>he===r||U.from!==S.from||U.to!==S.to);re(Q)}function b(r){re(T.filter((v,E)=>E!==r)),ae(null)}return e.jsxs(u,{...M,sx:[{position:"relative",minHeight:360,overflow:"hidden",bgcolor:"#f8fafc",backgroundImage:g?"linear-gradient(rgba(148,163,184,0.24) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,0.24) 1px, transparent 1px)":void 0,backgroundSize:g?`${j}px ${j}px`:void 0},...Array.isArray(f)?f:f?[f]:[]],children:[e.jsx(u,{component:"svg",sx:{position:"absolute",inset:0,width:"100%",height:"100%"},children:T.map(r=>{const v=V[r.from],E=V[r.to];if(!v||!E)return null;const S=Lt(v,E,a,l,r.type??C),Q=(v.x+E.x+a)/2,U=(v.y+E.y+l)/2;return e.jsxs("g",{children:[e.jsx("path",{d:S,fill:"none",stroke:r.color??"#94a3b8",strokeWidth:"2.5"}),r.label?e.jsx("text",{x:Q,y:U-8,textAnchor:"middle",fill:r.color??"#64748b",fontSize:"11",fontWeight:"700",children:r.label}):null]},`${r.from}-${r.to}-${r.type??r.label??"link"}`)})}),$.map(r=>{const v=V[r.id],E=r.id===_;return e.jsx(u,{role:"button",tabIndex:0,sx:{position:"absolute",left:v.x,top:v.y,width:a,height:l,display:"grid",placeItems:"center",border:E?2:1,borderColor:E?"primary.main":"divider",borderRadius:1,bgcolor:r.color??"background.paper",cursor:h==="edit"?"grab":"pointer",userSelect:"none",boxShadow:E?"0 18px 34px rgba(37,99,235,0.22)":"0 12px 28px rgba(15,23,42,0.12)",touchAction:"none"},onPointerDown:S=>{if(P(r.id),ae(null),y&&z(!0),B?.(r),h==="readonly")return;const Q=S.clientX,U=S.clientY,he=V[r.id];S.currentTarget.setPointerCapture(S.pointerId);function be(De){K(r.id,{x:he.x+De.clientX-Q,y:he.y+De.clientY-U})}function Ie(){window.removeEventListener("pointermove",be),window.removeEventListener("pointerup",Ie)}window.addEventListener("pointermove",be),window.addEventListener("pointerup",Ie)},onKeyDown:S=>{if(h==="readonly")return;const Q=c?j:8,U=V[r.id];S.key==="ArrowLeft"&&(K(r.id,{x:U.x-Q,y:U.y}),S.preventDefault()),S.key==="ArrowRight"&&(K(r.id,{x:U.x+Q,y:U.y}),S.preventDefault()),S.key==="ArrowUp"&&(K(r.id,{x:U.x,y:U.y-Q}),S.preventDefault()),S.key==="ArrowDown"&&(K(r.id,{x:U.x,y:U.y+Q}),S.preventDefault())},children:x?x(r,E):e.jsx(q,{fontWeight:800,children:r.label})},r.id)}),y&&te&&m?e.jsx(u,{sx:{position:"absolute",right:12,top:12,zIndex:20,width:340,maxWidth:"calc(100% - 24px)",maxHeight:"calc(100% - 24px)",overflow:"auto",border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper",boxShadow:"0 20px 48px rgba(15,23,42,0.22)"},children:e.jsxs(Y,{spacing:1.25,sx:{p:1.5},children:[e.jsxs(Y,{direction:"row",spacing:.75,alignItems:"center",children:[e.jsx(q,{variant:"subtitle2",fontWeight:900,sx:{flex:1},children:"Box editor"}),e.jsx(ce,{title:"Add box",children:e.jsx(de,{size:"small",color:"primary",onClick:ne,children:e.jsx(Ke,{fontSize:"small"})})}),e.jsx(ce,{title:"Remove box",children:e.jsx("span",{children:e.jsx(de,{size:"small",color:"error",onClick:fe,disabled:!te,children:e.jsx(Ne,{fontSize:"small"})})})}),e.jsx(ce,{title:"Close editor",children:e.jsx(de,{size:"small",onClick:()=>z(!1),children:e.jsx(Je,{fontSize:"small"})})})]}),e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"1fr 96px",gap:1},children:[e.jsx(Z,{size:"small",label:"Label",value:te?.label??"",disabled:!te,onChange:r=>ge({label:r.target.value})}),e.jsx(Z,{size:"small",label:"Color",type:"color",value:te?.color??"#ffffff",disabled:!te,onChange:r=>ge({color:r.target.value})})]}),e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"1fr",gap:1.25},children:[e.jsxs(Y,{spacing:1,children:[e.jsx(q,{variant:"caption",fontWeight:900,color:"text.secondary",children:"Links"}),e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"1fr 32px",gap:.5,alignItems:"center"},children:[e.jsxs(Z,{select:!0,size:"small",label:"To",value:X,disabled:!te,onChange:r=>o(r.target.value),children:[e.jsx(xe,{value:"",children:"Pick target"}),$.filter(r=>r.id!==_).map(r=>e.jsx(xe,{value:r.id,children:r.label},r.id))]}),e.jsx(ce,{title:`Add link from ${te?.label??"box"}`,children:e.jsx("span",{children:e.jsx(de,{size:"small",color:"primary",disabled:!te||!X,onClick:ve,sx:{width:32,height:32,border:1,borderColor:"divider",borderRadius:1},children:e.jsx(Qe,{fontSize:"small"})})})})]}),pe.length?pe.map(({connection:r,index:v})=>{const E=$.find(U=>U.id===r.from),S=$.find(U=>U.id===r.to),Q=G===v;return e.jsxs(u,{sx:{width:"100%",display:"grid",gridTemplateColumns:"1fr 32px",gap:.5,alignItems:"center"},children:[e.jsx(u,{component:"button",onClick:()=>ae(v),sx:{px:1,py:.75,minWidth:0,border:1,borderColor:Q?"primary.main":"divider",borderRadius:1,bgcolor:Q?"primary.main":"background.paper",color:Q?"primary.contrastText":"text.primary",cursor:"pointer",font:"inherit",textAlign:"left"},children:(E?.label??r.from)+" -> "+(S?.label??r.to)}),e.jsx(ce,{title:"Remove link",children:e.jsx(de,{size:"small",color:"error",onClick:()=>b(v),sx:{width:32,height:32},children:e.jsx(et,{fontSize:"small"})})})]},`${r.from}-${r.to}-${v}`)}):e.jsx(q,{variant:"body2",color:"text.secondary",children:"No linked boxes."})]}),e.jsxs(Y,{spacing:1,children:[e.jsx(q,{variant:"caption",fontWeight:900,color:"text.secondary",children:"Link details"}),G!==null&&T[G]?e.jsxs(e.Fragment,{children:[e.jsx(Z,{select:!0,size:"small",label:"From",value:T[G].from,onChange:r=>s(G,{from:r.target.value}),children:$.filter(r=>r.id!==T[G].to).map(r=>e.jsx(xe,{value:r.id,children:r.label},r.id))}),e.jsxs(u,{sx:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1},children:[e.jsx(Z,{select:!0,size:"small",label:"To",value:T[G].to,onChange:r=>s(G,{to:r.target.value}),children:$.filter(r=>r.id!==T[G].from).map(r=>e.jsx(xe,{value:r.id,children:r.label},r.id))}),e.jsx(Z,{select:!0,size:"small",label:"Shape",value:T[G].type??C,onChange:r=>s(G,{type:r.target.value}),children:k.map(r=>e.jsx(xe,{value:r,children:r},r))})]}),e.jsx(Z,{size:"small",label:"Label",value:T[G].label??"",onChange:r=>s(G,{label:r.target.value})})]}):e.jsx(q,{variant:"body2",color:"text.secondary",children:"Pick a link."})]})]})]})}):null]})}function Wt({before:t,after:n,initialPosition:a=50,sx:l,...h}){const[c,j]=w.useState(a);return e.jsxs(u,{...h,sx:[{position:"relative",overflow:"hidden",minHeight:280},...Array.isArray(l)?l:l?[l]:[]],onPointerMove:g=>{if(g.buttons!==1)return;const d=g.currentTarget.getBoundingClientRect();j((g.clientX-d.left)/d.width*100)},children:[e.jsx(u,{sx:{position:"absolute",inset:0},children:n}),e.jsx(u,{sx:{position:"absolute",inset:0,width:`${c}%`,overflow:"hidden"},children:t}),e.jsx(u,{sx:{position:"absolute",top:0,bottom:0,left:`${c}%`,width:3,bgcolor:"#ffffff",boxShadow:"0 0 0 1px rgba(0,0,0,0.2)",cursor:"ew-resize"}})]})}function Et({initialWidth:t=320,initialHeight:n=220,minWidth:a=160,minHeight:l=120,sx:h,children:c,...j}){const[g,d]=w.useState({width:t,height:n});return e.jsxs(u,{...j,sx:[{position:"relative",width:g.width,height:g.height,overflow:"auto",border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper"},...Array.isArray(h)?h:h?[h]:[]],children:[c,e.jsx(u,{sx:{position:"absolute",right:4,bottom:4,width:28,height:28,display:"grid",placeItems:"center",cursor:"nwse-resize",color:"text.secondary",bgcolor:"background.paper",border:1,borderColor:"divider",borderRadius:1,boxShadow:"0 6px 16px rgba(15,23,42,0.14)"},onPointerDown:C=>{const y=C.clientX,k=C.clientY,x=g;function L(i){d({width:Math.max(a,x.width+i.clientX-y),height:Math.max(l,x.height+i.clientY-k)})}function I(){window.removeEventListener("pointermove",L),window.removeEventListener("pointerup",I)}window.addEventListener("pointermove",L),window.addEventListener("pointerup",I)},children:e.jsx(Oe,{fontSize:"small"})})]})}function qt(t){return t.type==="boolean"?t.value?"On":"Off":`${t.value}${t.unit?` ${t.unit}`:""}`}function Xt(t){return t.reduce((n,a)=>{const l=a.group??"Settings";return{...n,[l]:[...n[l]??[],a]}},{})}function Ft({fields:t,onChange:n,title:a="Inspector",description:l,density:h="comfortable",showValueSummary:c=!0,showReset:j=!0,sx:g}){const d=Xt(t),C=h==="compact"?1.25:2,y=h==="compact"?"small":"medium";function k(x){x.defaultValue!==void 0&&n?.(x.id,x.defaultValue)}return e.jsx(we,{variant:"outlined",sx:[{p:h==="compact"?1.5:2,borderRadius:1},...Array.isArray(g)?g:[g]],children:e.jsxs(Y,{spacing:C,children:[e.jsxs(u,{children:[e.jsxs(Y,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[e.jsx(q,{variant:"subtitle1",fontWeight:850,children:a}),c?e.jsx(me,{size:"small",label:`${t.length} fields`}):null]}),l?e.jsx(q,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:l}):null]}),Object.entries(d).map(([x,L],I)=>e.jsxs(Y,{spacing:C,children:[I>0?e.jsx(rt,{}):null,e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:850,sx:{textTransform:"uppercase"},children:x}),L.map(i=>{const B=j&&i.defaultValue!==void 0&&i.defaultValue!==i.value;return i.type==="boolean"?e.jsxs(u,{children:[e.jsxs(Y,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[e.jsx(nt,{control:e.jsx(tt,{checked:!!i.value,disabled:i.disabled,onChange:f=>n?.(i.id,f.target.checked)}),label:i.label}),B?e.jsx(oe,{size:"small",onClick:()=>k(i),children:"Reset"}):null]}),i.description?e.jsx(q,{variant:"caption",color:"text.secondary",children:i.description}):null]},i.id):i.type==="number"?e.jsxs(Y,{spacing:1,children:[e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:y,label:i.label,type:"number",value:i.value,helperText:i.description,disabled:i.disabled,inputProps:{min:i.min,max:i.max,step:i.step},onChange:f=>n?.(i.id,Number(f.target.value))}),i.unit?e.jsx(me,{label:i.unit,size:"small",sx:{mt:1}}):null,B?e.jsx(oe,{size:"small",onClick:()=>k(i),sx:{mt:.5},children:"Reset"}):null]}),i.min!==void 0||i.max!==void 0?e.jsx(He,{value:Number(i.value),min:i.min??0,max:i.max??100,step:i.step??1,disabled:i.disabled,valueLabelDisplay:"auto",onChange:(f,M)=>n?.(i.id,Array.isArray(M)?M[0]:M)}):null]},i.id):i.type==="select"?e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{select:!0,fullWidth:!0,size:y,label:i.label,value:i.value,helperText:i.description,disabled:i.disabled,onChange:f=>n?.(i.id,f.target.value),children:(i.options??[]).map(f=>e.jsx(xe,{value:f.value,children:f.label},f.value))}),B?e.jsx(oe,{size:"small",onClick:()=>k(i),sx:{mt:.5},children:"Reset"}):null]},i.id):i.type==="color"?e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:y,label:i.label,value:i.value,helperText:i.description,disabled:i.disabled,onChange:f=>n?.(i.id,f.target.value),InputProps:{startAdornment:e.jsx(u,{component:"input",type:"color",value:String(i.value),disabled:i.disabled,onChange:f=>n?.(i.id,f.target.value),sx:{width:28,height:28,p:0,mr:1,border:0,bgcolor:"transparent",cursor:i.disabled?"default":"pointer"}})}}),B?e.jsx(oe,{size:"small",onClick:()=>k(i),sx:{mt:.5},children:"Reset"}):null]},i.id):e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsx(Z,{fullWidth:!0,size:y,label:i.label,value:i.value,helperText:i.description,disabled:i.disabled,onChange:f=>n?.(i.id,f.target.value)}),B?e.jsx(oe,{size:"small",onClick:()=>k(i),sx:{mt:.5},children:"Reset"}):null]},i.id)})]},x)),c?e.jsxs(u,{sx:{p:1.25,borderRadius:1,bgcolor:"action.hover"},children:[e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:850,children:"Current values"}),e.jsx(Y,{direction:"row",flexWrap:"wrap",gap:.75,sx:{mt:1},children:t.map(x=>e.jsx(me,{size:"small",label:`${x.label}: ${qt(x)}`},x.id))})]}):null]})})}function Yt({value:t,alpha:n=1,swatches:a=["#2563eb","#7c3aed","#db2777","#dc2626","#f59e0b","#059669"],showValue:l=!0,onChange:h,onAlphaChange:c}){const j=Math.round(n*100),g=`${t}${Math.round(n*255).toString(16).padStart(2,"0")}`;return e.jsx(we,{variant:"outlined",sx:{p:2,borderRadius:1},children:e.jsxs(Y,{spacing:2,children:[e.jsx(u,{sx:{height:96,borderRadius:1,border:1,borderColor:"divider",backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%), linear-gradient(-45deg, #e5e7eb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e5e7eb 75%), linear-gradient(-45deg, transparent 75%, #e5e7eb 75%)",backgroundSize:"18px 18px",backgroundPosition:"0 0, 0 9px, 9px -9px, -9px 0"},children:e.jsx(u,{sx:{height:"100%",borderRadius:1,bgcolor:t,opacity:n}})}),e.jsxs(Y,{direction:{xs:"column",sm:"row"},spacing:1.5,children:[e.jsx(Z,{label:"Color",type:"color",value:t,onChange:d=>h?.(d.target.value),sx:{width:{xs:"100%",sm:120}}}),e.jsx(Z,{label:"Hex",value:t,onChange:d=>h?.(d.target.value),fullWidth:!0})]}),e.jsxs(u,{children:[e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:800,children:"Alpha"}),e.jsx(He,{min:0,max:1,step:.01,value:n,onChange:(d,C)=>c?.(Array.isArray(C)?C[0]:C),valueLabelDisplay:"auto",valueLabelFormat:d=>`${Math.round(d*100)}%`}),e.jsx(Z,{label:"Alpha",type:"number",value:j,onChange:d=>c?.(Math.min(Math.max(Number(d.target.value),0),100)/100),InputProps:{endAdornment:e.jsx(ot,{position:"end",children:"%"})},fullWidth:!0})]}),e.jsx(u,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:a.map(d=>e.jsx(u,{component:"button","aria-label":d,onClick:()=>h?.(d),sx:{width:32,height:32,borderRadius:"50%",border:2,borderColor:d.toLowerCase()===t.toLowerCase()?"text.primary":"divider",bgcolor:d,cursor:"pointer"}},d))}),l?e.jsxs(u,{sx:{p:1.5,borderRadius:1,bgcolor:"#0f172a",color:"#e5e7eb"},children:[e.jsx(q,{variant:"caption",color:"#94a3b8",children:"selected color"}),e.jsx(q,{fontFamily:"monospace",children:g})]}):null]})})}function Nt({onFiles:t,sx:n,...a}){const[l,h]=w.useState(!1);function c(j){j&&t?.(Array.from(j))}return e.jsxs(u,{...a,onDragOver:j=>{j.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:j=>{j.preventDefault(),h(!1),c(j.dataTransfer.files)},sx:[{p:4,border:2,borderStyle:"dashed",borderColor:l?"primary.main":"divider",borderRadius:1,textAlign:"center",bgcolor:l?"primary.50":"background.paper"},...Array.isArray(n)?n:n?[n]:[]],children:[e.jsx(q,{fontWeight:800,children:"Drop files here"}),e.jsx(q,{variant:"body2",color:"text.secondary",children:"Drag files into this zone"})]})}function Ce(t,n,a){return Math.min(Math.max(t,n),a)}function Ot(t){const n=Math.floor(t/60),a=Math.floor(t%60);return`${n}:${String(a).padStart(2,"0")}`}function $e(t,n){return n>0?Ce(t/n*100,0,100):0}function Ht(t,n){return n.reduce((a,l)=>a?Math.abs(l.time-t)<Math.abs(a.time-t)?l:a:l,null)}function Vt({duration:t,value:n,defaultValue:a=0,markers:l=[],thumbnails:h=[],disabled:c=!1,showTime:j=!0,preview:g=!0,step:d=1,formatTime:C=Ot,onChange:y,sx:k,...x}){const L=w.useRef(null),[I,i]=w.useState(a),[B,f]=w.useState(!1),[M,O]=w.useState(null),F=Ce(n??I,0,t),D=M===null?F:M,R=$e(F,t),$=$e(D,t),T=w.useMemo(()=>[...l].sort((m,z)=>m.time-z.time),[l]),V=Ht(D,h);function H(m,z){const X=d>0?Math.round(m/d)*d:m,o=Ce(X,0,t);n===void 0&&i(o),y?.(o,z)}function p(m){const z=L.current;if(!z)return F;const X=z.getBoundingClientRect();return Ce((m-X.left)/X.width,0,1)*t}function P(m){O(p(m))}return e.jsxs(u,{...x,sx:[{width:"100%",color:c?"text.disabled":"text.primary",userSelect:"none"},...Array.isArray(k)?k:k?[k]:[]],children:[j?e.jsxs(u,{sx:{display:"flex",justifyContent:"space-between",mb:1},children:[e.jsx(q,{variant:"caption",fontWeight:800,children:C(F)}),e.jsx(q,{variant:"caption",color:"text.secondary",children:C(t)})]}):null,e.jsxs(u,{ref:L,role:"slider",tabIndex:c?-1:0,"aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":Math.round(F),onPointerMove:m=>{c||(P(m.clientX),B&&H(p(m.clientX),"drag"))},onPointerLeave:()=>{B||O(null)},onPointerDown:m=>{c||(f(!0),m.currentTarget.setPointerCapture(m.pointerId),H(p(m.clientX),"click"))},onPointerUp:m=>{f(!1),m.currentTarget.releasePointerCapture(m.pointerId)},onPointerCancel:()=>f(!1),onKeyDown:m=>{c||(m.key==="ArrowLeft"&&(H(F-d,"keyboard"),m.preventDefault()),m.key==="ArrowRight"&&(H(F+d,"keyboard"),m.preventDefault()),m.key==="Home"&&(H(0,"keyboard"),m.preventDefault()),m.key==="End"&&(H(t,"keyboard"),m.preventDefault()))},sx:{position:"relative",height:86,cursor:c?"default":"pointer",outline:"none","&:focus-visible .TimelineScrubber-track":{boxShadow:"0 0 0 3px rgba(37,99,235,0.28)"}},children:[g&&M!==null?e.jsxs(u,{sx:{position:"absolute",left:`${$}%`,top:0,transform:"translateX(-50%)",width:116,p:.75,border:1,borderColor:"divider",borderRadius:1,bgcolor:"background.paper",boxShadow:"0 14px 34px rgba(15,23,42,0.18)",pointerEvents:"none",zIndex:2},children:[e.jsx(u,{sx:{height:56,borderRadius:.75,overflow:"hidden",bgcolor:"#e5e7eb"},children:V?.thumbnail??e.jsx(u,{sx:{height:"100%",display:"grid",placeItems:"center",bgcolor:"#0f172a",color:"#fff"},children:e.jsx(q,{variant:"caption",fontWeight:900,children:C(D)})})}),e.jsx(q,{variant:"caption",fontWeight:800,sx:{display:"block",mt:.5,textAlign:"center"},children:C(D)})]}):null,e.jsx(u,{className:"TimelineScrubber-track",sx:{position:"absolute",left:0,right:0,bottom:18,height:12,borderRadius:999,bgcolor:"#e5e7eb",overflow:"hidden",transition:"box-shadow 120ms ease"},children:e.jsx(u,{sx:{width:`${R}%`,height:"100%",borderRadius:999,background:"linear-gradient(90deg, #2563eb, #06b6d4)"}})}),T.map(m=>{const z=$e(m.time,t);return e.jsx(ce,{title:m.label??C(m.time),arrow:!0,children:e.jsx(u,{onPointerDown:X=>{X.stopPropagation(),H(m.time,"marker")},sx:{position:"absolute",left:`${z}%`,bottom:11,width:12,height:26,borderRadius:999,transform:"translateX(-50%)",bgcolor:m.color??"#f59e0b",border:"2px solid",borderColor:"background.paper",boxShadow:"0 8px 18px rgba(15,23,42,0.2)",zIndex:1}})},m.id)}),e.jsx(u,{sx:{position:"absolute",left:`${R}%`,bottom:5,width:28,height:28,borderRadius:"50%",transform:"translateX(-50%)",bgcolor:"background.paper",border:3,borderColor:"#2563eb",boxShadow:B?"0 12px 30px rgba(37,99,235,0.36)":"0 8px 20px rgba(15,23,42,0.2)"}})]})]})}function Ee(t,n,a){return Math.min(Math.max(t,n),a)}function Gt({items:t=[],defaultViewport:n={x:0,y:0,zoom:1},viewport:a,minZoom:l=.3,maxZoom:h=2.5,showGrid:c=!0,showMinimap:j=!0,selectedItemId:g,renderItem:d,onViewportChange:C,onItemMove:y,onItemSelect:k,sx:x,...L}){const I=w.useRef(null),[i,B]=w.useState(n),[f,M]=w.useState(Object.fromEntries(t.map(p=>[p.id,{x:p.x,y:p.y}]))),[O,F]=w.useState(g??null),D=a??i,R=g??O,$=w.useMemo(()=>{const p=t.map(o=>({x:f[o.id]?.x??o.x,y:f[o.id]?.y??o.y,width:o.width??140,height:o.height??80}));if(!p.length)return{minX:-200,minY:-120,width:400,height:240};const P=Math.min(...p.map(o=>o.x))-80,m=Math.min(...p.map(o=>o.y))-80,z=Math.max(...p.map(o=>o.x+o.width))+80,X=Math.max(...p.map(o=>o.y+o.height))+80;return{minX:P,minY:m,width:z-P,height:X-m}},[f,t]);function T(p){const P={...p,zoom:Ee(p.zoom,l,h)};a===void 0&&B(P),C?.(P)}function V(p,P){const m=I.current?.getBoundingClientRect();return{x:(p-(m?.left??0)-D.x)/D.zoom,y:(P-(m?.top??0)-D.y)/D.zoom}}function H(p){F(p?.id??null),k?.(p)}return e.jsxs(u,{...L,ref:I,onWheel:p=>{p.preventDefault();const P=Ee(D.zoom*(p.deltaY>0?.92:1.08),l,h),m=V(p.clientX,p.clientY),z=I.current?.getBoundingClientRect(),X=p.clientX-(z?.left??0)-m.x*P,o=p.clientY-(z?.top??0)-m.y*P;T({x:X,y:o,zoom:P})},onPointerDown:p=>{if(p.target!==p.currentTarget)return;H(null);const P=p.clientX,m=p.clientY,z=D;p.currentTarget.setPointerCapture(p.pointerId);function X(W){T({...z,x:z.x+W.clientX-P,y:z.y+W.clientY-m})}function o(){window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",o)}window.addEventListener("pointermove",X),window.addEventListener("pointerup",o)},sx:[{position:"relative",minHeight:420,overflow:"hidden",bgcolor:"#f8fafc",cursor:"grab",touchAction:"none"},...Array.isArray(x)?x:x?[x]:[]],children:[e.jsx(u,{sx:{position:"absolute",inset:0,pointerEvents:"none",backgroundImage:c?"linear-gradient(rgba(148,163,184,0.25) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,0.25) 1px, transparent 1px)":void 0,backgroundSize:`${32*D.zoom}px ${32*D.zoom}px`,backgroundPosition:`${D.x}px ${D.y}px`}}),e.jsx(u,{sx:{position:"absolute",left:D.x,top:D.y,transform:`scale(${D.zoom})`,transformOrigin:"0 0"},children:t.map(p=>{const P=f[p.id]??{x:p.x,y:p.y},m=p.id===R;return e.jsx(u,{onPointerDown:z=>{z.stopPropagation(),H(p);const X=f[p.id]??{x:p.x,y:p.y},o=V(z.clientX,z.clientY);z.currentTarget.setPointerCapture(z.pointerId);function W(ue){const ee=V(ue.clientX,ue.clientY),G={x:X.x+ee.x-o.x,y:X.y+ee.y-o.y};M(ae=>({...ae,[p.id]:G})),y?.(p.id,G)}function J(){window.removeEventListener("pointermove",W),window.removeEventListener("pointerup",J)}window.addEventListener("pointermove",W),window.addEventListener("pointerup",J)},sx:{position:"absolute",left:P.x,top:P.y,width:p.width??140,height:p.height??80,display:"grid",placeItems:"center",border:m?2:1,borderColor:m?"primary.main":"divider",borderRadius:1,bgcolor:p.color??"background.paper",boxShadow:m?"0 18px 40px rgba(37,99,235,0.24)":"0 12px 28px rgba(15,23,42,0.13)",cursor:"grab",userSelect:"none"},children:d?d(p,m):e.jsx(q,{fontWeight:900,children:p.label??p.id})},p.id)})}),e.jsxs(u,{sx:{position:"absolute",left:12,bottom:12,display:"flex",gap:.75,alignItems:"center",px:1,py:.5,borderRadius:1,bgcolor:"rgba(255,255,255,0.92)",border:1,borderColor:"divider",fontSize:12,fontWeight:800},children:[Math.round(D.zoom*100),"%"]}),j?e.jsx(u,{sx:{position:"absolute",right:12,bottom:12,width:160,height:100,border:1,borderColor:"divider",borderRadius:1,bgcolor:"rgba(255,255,255,0.9)",overflow:"hidden"},children:t.map(p=>{const P=f[p.id]??{x:p.x,y:p.y},m=(P.x-$.minX)/$.width*100,z=(P.y-$.minY)/$.height*100,X=(p.width??140)/$.width*100,o=(p.height??80)/$.height*100;return e.jsx(u,{sx:{position:"absolute",left:`${m}%`,top:`${z}%`,width:`${X}%`,height:`${o}%`,minWidth:6,minHeight:4,borderRadius:.5,bgcolor:p.id===R?"primary.main":p.color??"#94a3b8"}},p.id)})}):null]})}function Ut({children:t,title:n,content:a,media:l,actions:h=[],copyText:c,placement:j="top",pinMode:g=!0,defaultPinned:d=!1,openDelay:C=120,sx:y,...k}){const x=w.useRef(null),L=w.useRef(null),I=w.useRef(null),[i,B]=w.useState(d),[f,M]=w.useState(d),[O,F]=w.useState(!1);function D(){I.current&&window.clearTimeout(I.current),L.current&&window.clearTimeout(L.current)}function R(){D(),!i&&(I.current=window.setTimeout(()=>B(!0),C))}function $(){D(),B(!0)}function T(){D(),f||(L.current=window.setTimeout(()=>B(!1),100))}function V(){const p=!f;M(p),B(p||i)}async function H(){c&&(await navigator.clipboard?.writeText(c),F(!0),window.setTimeout(()=>F(!1),1100))}return e.jsxs(e.Fragment,{children:[e.jsx(u,{component:"span",ref:x,onMouseEnter:R,onMouseLeave:T,onFocus:R,onBlur:T,onClick:()=>{g&&(B(!0),M(!0))},sx:{display:"inline-flex"},children:t}),e.jsx(ct,{open:i,anchorEl:x.current,placement:j,modifiers:[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{padding:12}}],sx:{zIndex:1500},children:e.jsx(lt,{onClickAway:()=>{f&&(B(!1),M(!1))},children:e.jsx(u,{onMouseEnter:$,onMouseLeave:T,sx:{width:320,maxWidth:"calc(100vw - 24px)",borderRadius:1,overflow:"hidden",boxShadow:"0 24px 64px rgba(15,23,42,0.28)",bgcolor:"background.paper"},children:e.jsx(u,{...k,sx:[{p:1.25},...Array.isArray(y)?y:y?[y]:[]],children:e.jsxs(Y,{spacing:1.25,children:[l?e.jsx(u,{sx:{borderRadius:1,overflow:"hidden",bgcolor:"#e5e7eb"},children:l}):null,e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsxs(u,{sx:{minWidth:0,flex:1},children:[n?e.jsx(q,{fontWeight:900,children:n}):null,a?e.jsx(q,{variant:"body2",color:"text.secondary",sx:{mt:n?.25:0},children:a}):null]}),g?e.jsx(ce,{title:f?"Unpin":"Pin",children:e.jsx(de,{size:"small",onClick:V,children:f?e.jsx(at,{fontSize:"small"}):e.jsx(st,{fontSize:"small"})})}):null]}),c||h.length?e.jsxs(Y,{direction:"row",spacing:1,flexWrap:"wrap",children:[c?e.jsx(oe,{size:"small",variant:"outlined",startIcon:e.jsx(it,{}),onClick:H,children:O?"Copied":"Copy"}):null,h.map(p=>e.jsx(oe,{size:"small",variant:"contained",startIcon:p.icon,onClick:p.onClick,children:p.label},p.id))]}):null]})})})})})]})}const je={neutral:"#64748b",good:"#059669",warning:"#d97706",danger:"#dc2626"};function Zt(t,n,a){return Math.min(Math.max(t,n),a)}function _t(t){return t.color??je[t.status??"neutral"]}function Kt(t){return typeof t.delta=="number"?t.delta:typeof t.value=="number"&&typeof t.previousValue=="number"&&t.previousValue!==0?(t.value-t.previousValue)/Math.abs(t.previousValue)*100:null}function Qt(t){return t.formatter?t.formatter(t.value):typeof t.value=="number"?new Intl.NumberFormat("en",{maximumFractionDigits:1}).format(t.value):t.value}function Jt(t,n,a){if(t.length<2)return"";const l=Math.min(...t),c=Math.max(...t)-l||1;return t.map((j,g)=>{const d=g/(t.length-1)*n,C=a-(j-l)/c*a;return`${g===0?"M":"L"} ${d.toFixed(2)} ${C.toFixed(2)}`}).join(" ")}function er({values:t,color:n}){const h=Jt(t,180,54),c=h?`${h} L 180 54 L 0 54 Z`:"";return e.jsxs(u,{component:"svg",viewBox:"0 0 180 54",sx:{display:"block",width:"100%",height:54},children:[e.jsx(u,{component:"path",d:c,sx:{fill:N.alpha(n,.14)}}),e.jsx(u,{component:"path",d:h,sx:{fill:"none",stroke:n,strokeWidth:4,strokeLinecap:"round",strokeLinejoin:"round"}}),t.length?e.jsx(u,{component:"circle",cx:180,cy:54-(t[t.length-1]-Math.min(...t))/(Math.max(...t)-Math.min(...t)||1)*54,r:4,sx:{fill:n}}):null]})}function tr({metrics:t,title:n,subtitle:a,columns:l=3,density:h="comfortable",showSparklines:c=!0,showProgress:j=!0,sx:g,...d}){const C=h==="compact";return e.jsxs(u,{...d,sx:[{width:"100%"},...Array.isArray(g)?g:g?[g]:[]],children:[n||a?e.jsxs(u,{sx:{mb:2},children:[n?e.jsx(q,{variant:"h6",fontWeight:900,children:n}):null,a?e.jsx(q,{variant:"body2",color:"text.secondary",children:a}):null]}):null,e.jsx(u,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"repeat(2, minmax(0, 1fr))",lg:`repeat(${l}, minmax(0, 1fr))`},gap:C?1.25:2},children:t.map(y=>{const k=_t(y),x=Kt(y),L=(x??0)>=0;return e.jsx(we,{variant:"outlined",sx:{p:C?1.5:2,borderRadius:1,overflow:"hidden",position:"relative",borderColor:N.alpha(k,.32),background:`linear-gradient(180deg, ${N.alpha(k,.08)}, rgba(255,255,255,0) 42%)`},children:e.jsxs(Y,{spacing:C?1:1.5,children:[e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",justifyContent:"space-between",children:[e.jsxs(u,{sx:{minWidth:0},children:[e.jsx(q,{variant:"caption",color:"text.secondary",fontWeight:850,sx:{textTransform:"uppercase"},children:y.label}),e.jsxs(Y,{direction:"row",spacing:.75,alignItems:"baseline",sx:{mt:.5},children:[e.jsx(q,{variant:C?"h5":"h4",fontWeight:950,sx:{lineHeight:1},children:Qt(y)}),y.unit?e.jsx(q,{variant:"body2",color:"text.secondary",fontWeight:800,children:y.unit}):null]})]}),y.icon?e.jsx(u,{sx:{color:k,display:"grid",placeItems:"center",mt:.25},children:y.icon}):null]}),e.jsxs(Y,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",children:[x!==null?e.jsx(me,{size:"small",label:`${L?"+":""}${x.toFixed(1)}%`,sx:{color:L?je.good:je.danger,bgcolor:N.alpha(L?je.good:je.danger,.12),fontWeight:850}}):e.jsx(u,{}),y.helper?e.jsx(q,{variant:"caption",color:"text.secondary",textAlign:"right",children:y.helper}):null]}),c&&y.trend?.length?e.jsx(er,{values:y.trend,color:k}):null,j&&typeof y.progress=="number"?e.jsx(dt,{variant:"determinate",value:Zt(y.progress,0,100),sx:{height:8,borderRadius:999,bgcolor:N.alpha(k,.14),"& .MuiLinearProgress-bar":{bgcolor:k,borderRadius:999}}}):null]})},y.id)})})]})}const rr=[{id:"todo",title:"To do",color:"#2563eb",cards:[{id:"card-1",title:"Map user journey",description:"Find the rough edges before building.",tags:["Research"]},{id:"card-2",title:"Write API contract",description:"Lock the shape of the data.",tags:["Backend"]}]},{id:"doing",title:"Doing",color:"#d97706",cards:[{id:"card-3",title:"Build board interactions",description:"Drag between columns and reorder cards.",tags:["UI"],color:"#fef3c7"}]},{id:"done",title:"Done",color:"#059669",cards:[{id:"card-4",title:"Choose visual system",description:"Dense, clean, and readable.",tags:["Design"],color:"#dcfce7"}]}];function Se(t){return typeof crypto<"u"&&"randomUUID"in crypto?`${t}-${crypto.randomUUID()}`:`${t}-${Date.now()}-${Math.round(Math.random()*1e3)}`}function nr(t,n,a){const l=[...t],[h]=l.splice(n,1);return l.splice(a,0,h),l}function qe(t,n){for(const a of t){const l=a.cards.find(h=>h.id===n);if(l)return{card:l,column:a}}return null}function Xe(t,n){return t.map(a=>({...a,cards:a.cards.filter(l=>l.id!==n)}))}function or(t,n,a,l){return t.map(h=>{if(h.id!==n)return h;const c=[...h.cards];return c.splice(l,0,a),{...h,cards:c}})}function Fe(t,n){const a=t.currentTarget.getBoundingClientRect();return t.clientY>a.top+a.height/2?n+1:n}function ir(t){return t.split(",").map(n=>n.trim()).filter(Boolean)}function ye(t,n,a,l){if(!n||n.type!=="card"||n.fromColumnId!==a)return!1;const c=t.find(j=>j.id===a)?.cards.findIndex(j=>j.id===n.cardId)??-1;return l===c||l===c+1}function Ye({compact:t,onDragOver:n,onDrop:a}){return e.jsx(u,{onDragOver:n,onDrop:a,sx:{height:t?44:56,border:1,borderStyle:"dashed",borderColor:"primary.main",borderRadius:1,bgcolor:N.alpha("#2563eb",.08),transition:"height 120ms ease, background-color 120ms ease"}})}function ar({columns:t,defaultColumns:n=rr,title:a="Kanban",subtitle:l,density:h="comfortable",allowColumnDrag:c=!0,onChange:j,onCardSelect:g,sx:d,...C}){const[y,k]=w.useState(n),[x,L]=w.useState(null),[I,i]=w.useState(null),[B,f]=w.useState(null),[M,O]=w.useState(""),[F,D]=w.useState({}),[R,$]=w.useState(null),[T,V]=w.useState(""),[H,p]=w.useState(""),[P,m]=w.useState(""),[z,X]=w.useState("#ffffff"),o=t??y,W=h==="compact",J=R?.card?qe(o,R.card.id):null,ue=w.useMemo(()=>o.reduce((s,b)=>s+b.cards.length,0),[o]);function ee(s){t||k(s),j?.(s)}function G(){const s=M.trim();s&&(ee([...o,{id:Se("column"),title:s,cards:[],color:"#64748b"}]),O(""))}function ae(s,b){ee(o.map(r=>r.id===s?{...r,title:b}:r))}function _(s){ee(o.filter(b=>b.id!==s))}function te(s){const b=F[s]?.trim();if(!b)return;const r={id:Se("card"),title:b};ee(o.map(v=>v.id===s?{...v,cards:[...v.cards,r]}:v)),D(v=>({...v,[s]:""}))}function pe(s,b,r){$({columnId:s,mode:b,card:r}),V(r?.title??""),p(r?.description??""),m((r?.tags??[]).join(", ")),X(r?.color??"#ffffff")}function le(){$(null),V(""),p(""),m(""),X("#ffffff")}function A(){if(!R||!T.trim())return;const s={id:R.card?.id??Se("card"),title:T.trim(),description:H.trim()||void 0,tags:ir(P),color:z};if(R.mode==="add"){ee(o.map(b=>b.id===R.columnId?{...b,cards:[...b.cards,s]}:b)),le();return}ee(o.map(b=>({...b,cards:b.cards.map(r=>r.id===s.id?s:r)}))),le()}function se(s){ee(Xe(o,s)),le()}function re(s,b,r){const v=qe(o,s);if(!v)return;const E=v.column.cards.findIndex(be=>be.id===s),S=v.column.id===b&&E<r?r-1:r,Q=Xe(o,s),U=Q.find(be=>be.id===b),he=Math.min(Math.max(S,0),U?.cards.length??0);ee(or(Q,b,v.card,he))}function K(s,b){if(ye(o,x,s,b)){i(null);return}i(r=>r?.columnId===s&&r.index===b?r:{columnId:s,index:b})}function ne(){L(null),i(null)}function fe(s,b){const r=o.findIndex(E=>E.id===s),v=o.findIndex(E=>E.id===b);r<0||v<0||r===v||ee(nr(o,r,v))}function ge(s,b){if(s.preventDefault(),!x)return;if(x.type==="column"){fe(x.columnId,b),ne();return}const v=o.find(E=>E.id===b)?.cards.length??0;ye(o,x,b,v)||re(x.cardId,b,v),ne()}function ve(s,b,r){if(s.preventDefault(),s.stopPropagation(),!x||x.type!=="card")return;const v=Fe(s,r);ye(o,x,b,v)||re(x.cardId,b,v),ne()}return e.jsxs(u,{...C,sx:[{width:"100%",color:"text.primary"},...Array.isArray(d)?d:d?[d]:[]],children:[e.jsxs(Y,{direction:{xs:"column",sm:"row"},spacing:2,alignItems:{xs:"stretch",sm:"center"},justifyContent:"space-between",sx:{mb:2},children:[e.jsxs(u,{children:[e.jsx(q,{variant:"h6",fontWeight:900,children:a}),e.jsx(q,{variant:"body2",color:"text.secondary",children:l??`${o.length} columns, ${ue} cards`})]}),e.jsxs(Y,{direction:"row",spacing:1,children:[e.jsx(Z,{size:"small",label:"New column",value:M,onChange:s=>O(s.target.value),onKeyDown:s=>{s.key==="Enter"&&G()}}),e.jsx(oe,{variant:"contained",startIcon:e.jsx(ze,{}),onClick:G,children:"Column"})]})]}),e.jsx(u,{sx:{display:"grid",gridAutoFlow:{xs:"row",md:"column"},gridAutoColumns:{md:"minmax(280px, 1fr)"},gridTemplateColumns:{xs:"1fr",md:"none"},gap:2,overflowX:{xs:"visible",md:"auto"},pb:1},children:o.map(s=>e.jsx(we,{variant:"outlined",draggable:c&&x?.type!=="card",onDragStart:()=>{c&&L({type:"column",columnId:s.id})},onDragOver:b=>{b.preventDefault(),x?.type==="card"&&b.target===b.currentTarget&&K(s.id,s.cards.length)},onDrop:b=>ge(b,s.id),onDragEnd:ne,sx:{p:W?1.25:1.5,borderRadius:1,minHeight:260,bgcolor:N.alpha(s.color??"#64748b",.06),borderColor:N.alpha(s.color??"#64748b",.28)},children:e.jsxs(Y,{spacing:W?1:1.25,children:[e.jsxs(Y,{direction:"row",spacing:1,alignItems:"center",children:[c?e.jsx(Oe,{fontSize:"small",color:"disabled"}):null,B===s.id?e.jsx(Z,{autoFocus:!0,fullWidth:!0,size:"small",value:s.title,onChange:b=>ae(s.id,b.target.value),onBlur:()=>f(null),onKeyDown:b=>{b.key==="Enter"&&f(null)}}):e.jsx(q,{fontWeight:900,sx:{flex:1,minWidth:0},children:s.title}),e.jsx(me,{size:"small",label:s.cards.length}),e.jsx(ce,{title:"Rename column",children:e.jsx(de,{size:"small",onClick:()=>f(s.id),children:e.jsx(Ae,{fontSize:"small"})})}),e.jsx(ce,{title:"Delete column",children:e.jsx(de,{size:"small",onClick:()=>_(s.id),children:e.jsx(Ne,{fontSize:"small"})})})]}),e.jsxs(Y,{spacing:1,children:[s.cards.map((b,r)=>{const v=x?.type==="card"&&x.cardId!==b.id&&I?.columnId===s.id&&I.index===r,E=x?.type==="card"&&x.cardId===b.id;return e.jsxs(u,{children:[v?e.jsx(u,{sx:{mb:1},children:e.jsx(Ye,{compact:W,onDragOver:S=>{S.preventDefault(),S.stopPropagation(),K(s.id,r)},onDrop:S=>{S.preventDefault(),S.stopPropagation(),x?.type==="card"&&(ye(o,x,s.id,r)||re(x.cardId,s.id,r),ne())}})}):null,e.jsx(we,{variant:"outlined",draggable:!0,onDragStart:S=>{S.stopPropagation(),S.dataTransfer.effectAllowed="move",L({type:"card",cardId:b.id,fromColumnId:s.id}),K(s.id,r)},onDragOver:S=>{S.preventDefault(),S.stopPropagation(),K(s.id,Fe(S,r))},onDrop:S=>ve(S,s.id,r),onDragEnd:ne,onClick:()=>g?.(b,s),sx:{p:W?1.25:1.5,borderRadius:1,cursor:E?"grabbing":"grab",bgcolor:b.color??"background.paper",borderColor:E?"primary.main":"divider",opacity:E?.42:1,transform:E?"scale(0.98)":"scale(1)",transition:"transform 120ms ease, opacity 120ms ease, border-color 120ms ease",boxShadow:E?"0 18px 40px rgba(37,99,235,0.22)":void 0},children:e.jsxs(Y,{spacing:1,children:[e.jsxs(Y,{direction:"row",spacing:1,alignItems:"flex-start",children:[e.jsxs(u,{sx:{flex:1,minWidth:0},children:[e.jsx(q,{fontWeight:850,children:b.title}),b.description?e.jsx(q,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:b.description}):null]}),e.jsx(de,{size:"small",onClick:S=>{S.stopPropagation(),pe(s.id,"edit",b)},children:e.jsx(Ae,{fontSize:"small"})})]}),b.tags?.length?e.jsx(Y,{direction:"row",flexWrap:"wrap",gap:.75,children:b.tags.map(S=>e.jsx(me,{size:"small",label:S},S))}):null]})})]},b.id)}),x?.type==="card"&&I?.columnId===s.id&&I.index===s.cards.length?e.jsx(Ye,{compact:W,onDragOver:b=>{b.preventDefault(),b.stopPropagation(),K(s.id,s.cards.length)},onDrop:b=>{b.preventDefault(),b.stopPropagation(),x?.type==="card"&&(ye(o,x,s.id,s.cards.length)||re(x.cardId,s.id,s.cards.length),ne())}}):null]}),e.jsxs(Y,{direction:"row",spacing:1,children:[e.jsx(Z,{fullWidth:!0,size:"small",label:"Quick card",value:F[s.id]??"",onChange:b=>D(r=>({...r,[s.id]:b.target.value})),onKeyDown:b=>{b.key==="Enter"&&te(s.id)}}),e.jsx(oe,{variant:"outlined",onClick:()=>te(s.id),children:"Add"})]}),e.jsx(oe,{startIcon:e.jsx(ze,{}),onClick:()=>pe(s.id,"add"),children:"Detailed card"})]})},s.id))}),e.jsxs(ut,{open:!!R,onClose:le,fullWidth:!0,maxWidth:"sm",children:[e.jsx(xt,{children:R?.mode==="add"?"Add card":"Edit card"}),e.jsx(ht,{children:e.jsxs(Y,{spacing:2,sx:{pt:1},children:[e.jsx(Z,{label:"Title",value:T,onChange:s=>V(s.target.value),autoFocus:!0}),e.jsx(Z,{label:"Description",value:H,onChange:s=>p(s.target.value),multiline:!0,minRows:3}),e.jsx(Z,{label:"Tags",helperText:"Comma separated",value:P,onChange:s=>m(s.target.value)}),e.jsx(Z,{label:"Color",value:z,onChange:s=>X(s.target.value),select:!0,children:[{label:"White",value:"#ffffff"},{label:"Blue",value:"#dbeafe"},{label:"Green",value:"#dcfce7"},{label:"Yellow",value:"#fef3c7"},{label:"Red",value:"#fee2e2"}].map(s=>e.jsx(xe,{value:s.value,children:s.label},s.value))})]})}),e.jsxs(pt,{children:[J?e.jsx(oe,{color:"error",onClick:()=>se(J.card.id),children:"Delete"}):null,e.jsx(oe,{onClick:le,children:"Cancel"}),e.jsx(oe,{variant:"contained",onClick:A,children:R?.mode==="add"?"Add":"Save"})]})]})]})}exports.BeforeAfterSlider=Wt;exports.CodeViewer=vt;exports.ColorPicker=Yt;exports.CommandPalette=Dt;exports.ComponentExample=ft;exports.DataCardGrid=tr;exports.DockBar=St;exports.DraggableBox=Ct;exports.FileDropZone=Nt;exports.FloatingToolbar=At;exports.GlassBox=kt;exports.InfiniteCanvas=Gt;exports.InspectorPanel=Ft;exports.KanbanBoard=ar;exports.MagneticCard=Pt;exports.NodeCanvas=Bt;exports.ResizableFrame=Et;exports.SmartTooltip=Ut;exports.SplitPane=Rt;exports.SpotlightPanel=Tt;exports.TimelineScrubber=Vt;