@cyber-harbour/ui 1.1.44-dev.0 → 1.1.45-dev.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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import {a,x,y,v,d,m,A,D,nb,pa,Wa}from'./chunk-XY4L4GM2.mjs';export{rb as Alert,B as AlertIcon,Ca as AndroidIcon,E as ApiIcon,F as ArrowCircleTopRightIcon,G as ArrowRightIcon,la as BallsMenu,nb as Box,r as BreakpointProvider,H as BugReportIcon,Pa as BurgerMenuIcon,va as BusIcon,A as Button,I as CalendarIcon,wa as CarIcon,ma as CheckIcon,tb as Checkbox,na as ChevronDownIcon,J as ChevronLeftIcon,K as ChevronRightIcon,oa as ChevronUpIcon,Qa as ClockIcon,L as CloseCircleIcon,M as ClosedLockIcon,Ab as ContentLoader,fb as ContextMenu,gb as ContextMenuDelimiter,Ya as Counter,ta as CrossIcon,N as DataSetsIcon,O as DeepSearchIcon,P as DisabledVisibleIcon,Q as DocsIcon,R as DownloadIcon,wb as Drawer,yb as DrawerBody,xb as DrawerHeader,S as EditUserIcon,pb as EmptyData,T as EnableVisibleIcon,U as EnterArrowLeftIcon,Gb as FileField,Aa as FileIcon,V as FiltersIcon,La as FlashIcon,lb as FlexContainer,mb as FlexItem,Ea as FolderAlertIcon,Ma as FolderInfoIcon,b as GlobalStyle,$a as Header,ab as HeaderDelimeter,bb as HeaderSection,W as HomepageIcon,C as ImageIcon,ra as InfoCircleFilledIcon,X as InfoCircleIcon,kb as Input,Ba as IosIcon,sb as Label,ob as Line,ub as LinerProgress,Xa as ListMenu,Za as ListMenuItem,_a as ListMenuSection,Y as MapRadarIcon,ua as MaximizeIcon,Da as MicrosoftIcon,D as MinusIcon,Cb as Modal,Eb as ModalBody,Fb as ModalFooter,Db as ModalHeader,Z as MoonIcon,_ as OpenLockIcon,$ as OrganizationIcon,Bb as Overlay,db as Pagination,Ha as PassportIcon,aa as PasswordFinderIcon,Ja as PencilIcon,ba as PhonebookIcon,ya as PlaneIcon,pa as PlusIcon,Ia as PointIcon,ca as PrintIcon,da as Profiler2Icon,ea as ProfilerIcon,Fa as RelationIcon,Ga as RelationPointsIcon,Na as RotateLeftIcon,Oa as RotateRightIcon,jb as RowActionsMenu,fa as SandBoxIcon,ga as SearchIcon,ib as Select,za as ShipIcon,Sa as Sidebar,Ra as SidebarContext,Ua as SidebarDelimeter,Ta as SidebarItem,Va as SidebarSection,ha as StatisticIcon,ia as SunIcon,vb as Switch,cb as Table,qb as Tag,t as ThemeProvider,zb as Tooltip,Wa as Typography,sa as UnfoldIcon,ja as UpRightArrowCircleIcon,Ka as UserInCircleIcon,qa as UsersIcon,ka as VectorIcon,xa as WayIcon,g as convertPaletteToRem,x as createComponent,y as createStyledComponent,q as darkTheme,p as darkThemePx,u as destructSpaceProps,v as generatePropertySpaceStyle,l as getBreakpoint,i as getButtonSizeStyles,h as getButtonStyles,j as getInputStyles,w as getResponsiveProps,k as getTypographyStyles,m as hexToRgba,o as lightTheme,n as lightThemePx,f as propToRem,d as pxToRem,e as remToPx,c as resolveThemeColor,s as useBreakpoint,hb as useContextMenuControl,eb as useEscapeLayer,z as useTheme}from'./chunk-XY4L4GM2.mjs';import pe,{styled,useTheme,keyframes}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs,Fragment as Fragment$1}from'react/jsx-runtime';import qt,{useState,useRef,useCallback,useEffect,Fragment,forwardRef,useMemo,useImperativeHandle,useLayoutEffect,memo}from'react';import _r from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceCollide,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter}from'd3';import Wr from'react-content-loader';import {renderAsync}from'docx-preview';import Sn from'lodash.throttle';import Rn from'@uiw/react-codemirror';import {vscodeDark}from'@uiw/codemirror-theme-vscode';import {javascript}from'@codemirror/lang-javascript';import {json}from'@codemirror/lang-json';import {html}from'@codemirror/lang-html';import {css}from'@codemirror/lang-css';import {python}from'@codemirror/lang-python';import {java}from'@codemirror/lang-java';import {cpp}from'@codemirror/lang-cpp';import {php}from'@codemirror/lang-php';import {rust}from'@codemirror/lang-rust';import {xml}from'@codemirror/lang-xml';import {yaml}from'@codemirror/lang-yaml';import {markdown}from'@codemirror/lang-markdown';import {sql}from'@codemirror/lang-sql';var Mi=a(({children:d,className:p})=>jsx(yr,{className:p,children:d}),"PageLayout"),yr=styled.div`
1
+ import {a,x,y,v,d,m,A,D,nb,pa,Wa}from'./chunk-XY4L4GM2.mjs';export{rb as Alert,B as AlertIcon,Ca as AndroidIcon,E as ApiIcon,F as ArrowCircleTopRightIcon,G as ArrowRightIcon,la as BallsMenu,nb as Box,r as BreakpointProvider,H as BugReportIcon,Pa as BurgerMenuIcon,va as BusIcon,A as Button,I as CalendarIcon,wa as CarIcon,ma as CheckIcon,tb as Checkbox,na as ChevronDownIcon,J as ChevronLeftIcon,K as ChevronRightIcon,oa as ChevronUpIcon,Qa as ClockIcon,L as CloseCircleIcon,M as ClosedLockIcon,Ab as ContentLoader,fb as ContextMenu,gb as ContextMenuDelimiter,Ya as Counter,ta as CrossIcon,N as DataSetsIcon,O as DeepSearchIcon,P as DisabledVisibleIcon,Q as DocsIcon,R as DownloadIcon,wb as Drawer,yb as DrawerBody,xb as DrawerHeader,S as EditUserIcon,pb as EmptyData,T as EnableVisibleIcon,U as EnterArrowLeftIcon,Gb as FileField,Aa as FileIcon,V as FiltersIcon,La as FlashIcon,lb as FlexContainer,mb as FlexItem,Ea as FolderAlertIcon,Ma as FolderInfoIcon,b as GlobalStyle,$a as Header,ab as HeaderDelimeter,bb as HeaderSection,W as HomepageIcon,C as ImageIcon,ra as InfoCircleFilledIcon,X as InfoCircleIcon,kb as Input,Ba as IosIcon,sb as Label,ob as Line,ub as LinerProgress,Xa as ListMenu,Za as ListMenuItem,_a as ListMenuSection,Y as MapRadarIcon,ua as MaximizeIcon,Da as MicrosoftIcon,D as MinusIcon,Cb as Modal,Eb as ModalBody,Fb as ModalFooter,Db as ModalHeader,Z as MoonIcon,_ as OpenLockIcon,$ as OrganizationIcon,Bb as Overlay,db as Pagination,Ha as PassportIcon,aa as PasswordFinderIcon,Ja as PencilIcon,ba as PhonebookIcon,ya as PlaneIcon,pa as PlusIcon,Ia as PointIcon,ca as PrintIcon,da as Profiler2Icon,ea as ProfilerIcon,Fa as RelationIcon,Ga as RelationPointsIcon,Na as RotateLeftIcon,Oa as RotateRightIcon,jb as RowActionsMenu,fa as SandBoxIcon,ga as SearchIcon,ib as Select,za as ShipIcon,Sa as Sidebar,Ra as SidebarContext,Ua as SidebarDelimeter,Ta as SidebarItem,Va as SidebarSection,ha as StatisticIcon,ia as SunIcon,vb as Switch,cb as Table,qb as Tag,t as ThemeProvider,zb as Tooltip,Wa as Typography,sa as UnfoldIcon,ja as UpRightArrowCircleIcon,Ka as UserInCircleIcon,qa as UsersIcon,ka as VectorIcon,xa as WayIcon,g as convertPaletteToRem,x as createComponent,y as createStyledComponent,q as darkTheme,p as darkThemePx,u as destructSpaceProps,v as generatePropertySpaceStyle,l as getBreakpoint,i as getButtonSizeStyles,h as getButtonStyles,j as getInputStyles,w as getResponsiveProps,k as getTypographyStyles,m as hexToRgba,o as lightTheme,n as lightThemePx,f as propToRem,d as pxToRem,e as remToPx,c as resolveThemeColor,s as useBreakpoint,hb as useContextMenuControl,eb as useEscapeLayer,z as useTheme}from'./chunk-XY4L4GM2.mjs';import pe,{styled,useTheme,keyframes}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs,Fragment as Fragment$1}from'react/jsx-runtime';import qt,{useState,useRef,useCallback,useEffect,Fragment,forwardRef,useMemo,useImperativeHandle,useLayoutEffect,memo}from'react';import _r from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceCollide,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter}from'd3';import Wr from'react-content-loader';import {renderAsync}from'docx-preview';import Sn from'lodash.throttle';import Rn from'@uiw/react-codemirror';import {vscodeDark}from'@uiw/codemirror-theme-vscode';import {javascript}from'@codemirror/lang-javascript';import {json}from'@codemirror/lang-json';import {html}from'@codemirror/lang-html';import {css}from'@codemirror/lang-css';import {python}from'@codemirror/lang-python';import {java}from'@codemirror/lang-java';import {cpp}from'@codemirror/lang-cpp';import {php}from'@codemirror/lang-php';import {rust}from'@codemirror/lang-rust';import {xml}from'@codemirror/lang-xml';import {yaml}from'@codemirror/lang-yaml';import {markdown}from'@codemirror/lang-markdown';import {sql}from'@codemirror/lang-sql';var Mi=a(({children:f,className:p})=>jsx(yr,{className:p,children:f}),"PageLayout"),yr=styled.div`
2
2
  display: grid;
3
3
  min-height: 100dvh;
4
4
  position: relative;
@@ -9,11 +9,11 @@ import {a,x,y,v,d,m,A,D,nb,pa,Wa}from'./chunk-XY4L4GM2.mjs';export{rb as Alert,B
9
9
  & > header {
10
10
  grid-area: header;
11
11
  }
12
- `;var Ei=a(({children:d,className:p})=>jsx(vr,{className:p,children:d}),"PageContent"),vr=styled.main`
12
+ `;var Ti=a(({children:f,className:p})=>jsx(vr,{className:p,children:f}),"PageContent"),vr=styled.main`
13
13
  grid-area: content;
14
14
  min-width: 0;
15
- background: ${({theme:d})=>d.colors.backgroundBase};
16
- `;var Ni=a(({children:d,className:p,top:M=0})=>jsx(Mr,{className:p,$top:M,onClick:I=>I.stopPropagation(),children:d}),"SubNav"),Mr=styled.div(({theme:d,$top:p})=>`
15
+ background: ${({theme:f})=>f.colors.backgroundBase};
16
+ `;var Ni=a(({children:f,className:p,top:M=0})=>jsx(Mr,{className:p,$top:M,onClick:I=>I.stopPropagation(),children:f}),"SubNav"),Mr=styled.div(({theme:f,$top:p})=>`
17
17
  display: flex;
18
18
  flex-direction: column;
19
19
  justify-content: space-between;
@@ -23,38 +23,38 @@ import {a,x,y,v,d,m,A,D,nb,pa,Wa}from'./chunk-XY4L4GM2.mjs';export{rb as Alert,B
23
23
  left: 0;
24
24
  grid-area: sub-nav;
25
25
  min-width: 0;
26
- background: ${d.colors.background};
26
+ background: ${f.colors.background};
27
27
  max-height: calc(100dvh - ${p}px);
28
28
  height: 100%;
29
29
  z-index: 1001;
30
30
  top: ${p}px;
31
31
  overflow: auto;
32
- @media (min-width: ${d.breakpoints.xl}px){
32
+ @media (min-width: ${f.breakpoints.xl}px){
33
33
  position: sticky;
34
- border-right: 1px solid ${d.colors.stroke.light};
34
+ border-right: 1px solid ${f.colors.stroke.light};
35
35
  }
36
- `);var Yi=x(({maxWidth:d,...p})=>jsx(Dr,{...p,$maxWidth:d})),Dr=y(styled.div(({theme:d$1,$maxWidth:p,px:M=20})=>`
37
- ${v(d$1,"padding-inline",M)}
36
+ `);var Yi=x(({maxWidth:f,...p})=>jsx(Dr,{...p,$maxWidth:f})),Dr=y(styled.div(({theme:f,$maxWidth:p,px:M=20})=>`
37
+ ${v(f,"padding-inline",M)}
38
38
  width: 100%;
39
39
  min-width: 0;
40
- max-width: ${typeof p=="number"?d(p,d$1.baseSize):p||"100%"};
41
- `),{ignoreStyles:["padding-inline"]});var Ir=20,Rr="splitter_columns_widths",$t=a((d,p,M)=>{let I=localStorage.getItem(d);if(I)try{let k=JSON.parse(I);if(Array.isArray(k)&&k.length===p)return k}catch{}else if(M.length===p)return M;return Array(p).fill(100/p)},"getSavedWidths"),Vi=a(({columns:d,initialWidths:p,style:M,className:I,splitterClassName:k,minWidth:j=Ir,storageKey:S=Rr})=>{let[P,A]=useState(()=>$t(S,d.length,p)),G=useRef(null),q=useRef(null),H=useRef(j),re=useRef(P),R=useCallback(X=>{if(q.current===null||!G.current)return;let t=G.current.getBoundingClientRect(),te=t.width,U=X-t.left,Y=[...re.current],ge=q.current,$=ge+1,E=Y.slice(0,ge).reduce((Ze,O)=>Ze+O,0),ie=U/te*100-E,Ee=Y[ge]+Y[$]-ie;ie>=H.current&&Ee>=H.current&&(Y[ge]=ie,Y[$]=Ee,A(Y),re.current=Y);},[]),ne=useCallback(X=>R(X.clientX),[R]),le=useCallback(X=>{X.preventDefault(),R(X.touches[0].clientX);},[R]),K=useCallback(()=>{q.current=null,localStorage.setItem(S,JSON.stringify(re.current)),document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",K),document.removeEventListener("touchmove",le),document.removeEventListener("touchend",K);},[ne,le,S]),V=useCallback(X=>t=>{t.preventDefault(),q.current=X,document.addEventListener("mousemove",ne,{passive:false}),document.addEventListener("mouseup",K);},[ne,K]),se=useCallback(X=>t=>{t.preventDefault(),q.current=X,document.addEventListener("touchmove",le,{passive:false}),document.addEventListener("touchend",K);},[le,K]);return useEffect(()=>{let X=$t(S,d.length,p);re.current=X,A(X);},[d.length,p,S]),jsx(Nr,{ref:G,style:M,className:I,children:d.map(({content:X,className:t,style:te},U)=>jsxs(Fragment,{children:[jsx(Fr,{style:{flex:`${P[U]} 1 0%`,...te},className:t,children:X}),U<d.length-1&&jsx(zr,{onMouseDown:V(U),onTouchStart:se(U),className:k,children:jsx(jr,{children:jsxs("svg",{style:{width:14,height:14,flexShrink:0},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"9",cy:"12",r:"1"}),jsx("circle",{cx:"9",cy:"5",r:"1"}),jsx("circle",{cx:"9",cy:"19",r:"1"}),jsx("circle",{cx:"15",cy:"12",r:"1"}),jsx("circle",{cx:"15",cy:"5",r:"1"}),jsx("circle",{cx:"15",cy:"19",r:"1"})]})})})]},U))})},"SplitterLayout"),Nr=pe.div`
40
+ max-width: ${typeof p=="number"?d(p,f.baseSize):p||"100%"};
41
+ `),{ignoreStyles:["padding-inline"]});var Ir=20,Rr="splitter_columns_widths",$t=a((f,p,M)=>{let I=localStorage.getItem(f);if(I)try{let k=JSON.parse(I);if(Array.isArray(k)&&k.length===p)return k}catch{}else if(M.length===p)return M;return Array(p).fill(100/p)},"getSavedWidths"),Vi=a(({columns:f,initialWidths:p,style:M,className:I,splitterClassName:k,minWidth:j=Ir,storageKey:S=Rr})=>{let[P,A]=useState(()=>$t(S,f.length,p)),G=useRef(null),q=useRef(null),H=useRef(j),re=useRef(P),R=useCallback(X=>{if(q.current===null||!G.current)return;let t=G.current.getBoundingClientRect(),te=t.width,U=X-t.left,Y=[...re.current],ge=q.current,$=ge+1,T=Y.slice(0,ge).reduce((Ze,O)=>Ze+O,0),ie=U/te*100-T,Te=Y[ge]+Y[$]-ie;ie>=H.current&&Te>=H.current&&(Y[ge]=ie,Y[$]=Te,A(Y),re.current=Y);},[]),ne=useCallback(X=>R(X.clientX),[R]),le=useCallback(X=>{X.preventDefault(),R(X.touches[0].clientX);},[R]),K=useCallback(()=>{q.current=null,localStorage.setItem(S,JSON.stringify(re.current)),document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",K),document.removeEventListener("touchmove",le),document.removeEventListener("touchend",K);},[ne,le,S]),V=useCallback(X=>t=>{t.preventDefault(),q.current=X,document.addEventListener("mousemove",ne,{passive:false}),document.addEventListener("mouseup",K);},[ne,K]),se=useCallback(X=>t=>{t.preventDefault(),q.current=X,document.addEventListener("touchmove",le,{passive:false}),document.addEventListener("touchend",K);},[le,K]);return useEffect(()=>{let X=$t(S,f.length,p);re.current=X,A(X);},[f.length,p,S]),jsx(Nr,{ref:G,style:M,className:I,children:f.map(({content:X,className:t,style:te},U)=>jsxs(Fragment,{children:[jsx(Fr,{style:{flex:`${P[U]} 1 0%`,...te},className:t,children:X}),U<f.length-1&&jsx(zr,{onMouseDown:V(U),onTouchStart:se(U),className:k,children:jsx(jr,{children:jsxs("svg",{style:{width:14,height:14,flexShrink:0},xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"9",cy:"12",r:"1"}),jsx("circle",{cx:"9",cy:"5",r:"1"}),jsx("circle",{cx:"9",cy:"19",r:"1"}),jsx("circle",{cx:"15",cy:"12",r:"1"}),jsx("circle",{cx:"15",cy:"5",r:"1"}),jsx("circle",{cx:"15",cy:"19",r:"1"})]})})})]},U))})},"SplitterLayout"),Nr=pe.div`
42
42
  display: flex;
43
43
  user-select: none;
44
44
  `,Fr=pe.div`
45
45
  min-width: 0;
46
- `,zr=pe.div(({theme:d})=>`
46
+ `,zr=pe.div(({theme:f})=>`
47
47
  position: relative;
48
48
  z-index: 100;
49
49
  display: none;
50
- border-left: 1px solid ${d.colors.stroke.light};
50
+ border-left: 1px solid ${f.colors.stroke.light};
51
51
 
52
52
  @media (min-width: 1024px) {
53
53
  display: flex;
54
54
  position: sticky;
55
55
  top: 0;
56
56
  }
57
- `),jr=pe.span(({theme:d})=>`
57
+ `),jr=pe.span(({theme:f})=>`
58
58
  position: absolute;
59
59
  top: 50%;
60
60
  left: 50%;
@@ -64,14 +64,14 @@ import {a,x,y,v,d,m,A,D,nb,pa,Wa}from'./chunk-XY4L4GM2.mjs';export{rb as Alert,B
64
64
  align-items: center;
65
65
  width: 16px;
66
66
  height: 24px;
67
- background: ${d.colors.background};
68
- border: 1px solid ${d.colors.stroke.light};
69
- color: ${d.colors.text.lighter};
67
+ background: ${f.colors.background};
68
+ border: 1px solid ${f.colors.stroke.light};
69
+ color: ${f.colors.text.lighter};
70
70
  border-radius: 6px;
71
71
  cursor: col-resize;
72
72
 
73
73
  &:hover {
74
- background: ${d.colors.stroke.lighter};
74
+ background: ${f.colors.stroke.lighter};
75
75
  }
76
76
  `);var Ar=pe.div`
77
77
  width: 100%;
@@ -79,8 +79,8 @@ import {a,x,y,v,d,m,A,D,nb,pa,Wa}from'./chunk-XY4L4GM2.mjs';export{rb as Alert,B
79
79
  display: flex;
80
80
  align-items: center;
81
81
  justify-content: center;
82
- `,Hr=a(({width:d=280,height:p=280})=>{let M=useTheme();return jsx(Ar,{children:jsxs(Wr,{foregroundColor:M.contentLoader.foreground,backgroundColor:M.contentLoader.background,width:d,height:p,viewBox:"0 0 280 280",children:[jsx("path",{d:"m55 38-0.97266 0.22852 7.0801 30.092-18.355-20.979-0.75195 0.6582 19.596 22.395 0.43164 1.834 0.97266-0.22852 0.75195-0.6582-0.37695-0.42969 9.625-27.912-0.94531-0.32617-9.4375 27.371-0.10547-0.12109zm8 34-0.78516 0.61914 0.0957 0.12305-12.311 13.258 0.73242 0.67969 12.205-13.145 14.277 18.084 0.78516-0.61914-14.373-18.207 0.10547-0.11328zm15 19-0.48438 0.875 46.992 25.996 8e-3 4e-3 20.506 11.592-28.182 4.5449 0.15998 0.98819 29.418-4.7441 0.25 0.14062-12.555 24.143 0.88672 0.46094 13-25 15 25 26 30v18l-11 18 0.85352 0.52148 9.8008-16.039-4.6543 33.518 0.99023 0.13867 4.7793-34.408 7.2305 16.27 0.91406-0.40625-7.9141-17.807v-17.104l18 12.316 0.56445-0.82617-18.896-12.928-25.855-29.836-14.633-24.387 0.01562-0.02344h23.805v-1h-23.152l13.848-21.234 55.201-28.791-0.45898-0.88476 0.77734 0.62305 11.402-14.25 16.668-11.842-0.58008-0.81641-16.785 11.928-11.486 14.355-55.434 28.912-14.277 21.893-7.7617-27.166-0.96094 0.27344 7.7227 27.031-1.1191 0.17969-21.604-12.211zm140.43-12.912-6.957-17.338-0.92773 0.37305 6.957 17.338zm-6.957-17.338 0.72266 0.69336 16.232-16.896-0.7207-0.69336zm-3.4766 137.25 5 15 0.94922-0.31641-5-15zm-91-63-0.48047-0.87695-31 17 0.48047 0.87695zm-31 17 5 18 0.96289-0.26758-5-18zm0 0-0.70703-0.70703-12.898 12.898-17.881 9.9336 0.48633 0.875 18-10zm5 18-0.64062-0.76758-18 15 0.64062 0.76758z"}),jsx("circle",{cx:"229.92",cy:"63.7318",r:"5",transform:"rotate(173.661 229.92 63.7318)"}),jsx("circle",{cx:"227.711",cy:"43.8541",r:"5",transform:"rotate(173.661 227.711 43.8541)"}),jsx("circle",{cx:"211.478",cy:"60.7499",r:"5",transform:"rotate(173.661 211.478 60.7499)"}),jsx("circle",{cx:"218.434",cy:"78.0877",r:"5",transform:"rotate(173.661 218.434 78.0877)"}),jsx("circle",{cx:"246.705",cy:"51.8054",r:"5",transform:"rotate(173.661 246.705 51.8054)"}),jsx("circle",{cx:"42",cy:"48",r:"5"}),jsx("circle",{cx:"55",cy:"38",r:"5"}),jsx("circle",{cx:"73",cy:"43",r:"5"}),jsx("circle",{cx:"63",cy:"72",r:"5"}),jsx("circle",{cx:"50",cy:"86",r:"5"}),jsx("circle",{cx:"78",cy:"91",r:"5"}),jsx("circle",{cx:"73",cy:"165",r:"5"}),jsx("circle",{cx:"73",cy:"185",r:"5"}),jsx("circle",{cx:"91",cy:"170",r:"5"}),jsx("circle",{cx:"86",cy:"152",r:"5"}),jsx("circle",{cx:"148",cy:"130",r:"5"}),jsx("circle",{cx:"189",cy:"185",r:"5"}),jsx("circle",{cx:"163",cy:"107",r:"5"}),jsx("circle",{cx:"140",cy:"102",r:"5"}),jsx("circle",{cx:"117",cy:"135",r:"5"}),jsx("circle",{cx:"125",cy:"117",r:"5"}),jsx("circle",{cx:"208",cy:"198",r:"5"}),jsx("circle",{cx:"189",cy:"203",r:"5"}),jsx("circle",{cx:"198",cy:"221",r:"5"}),jsx("circle",{cx:"178",cy:"221",r:"5"}),jsx("circle",{cx:"184",cy:"239",r:"5"}),jsx("circle",{cx:"213",cy:"213",r:"5"}),jsx("circle",{cx:"173",cy:"130",r:"5"}),jsx("circle",{cx:"163",cy:"155",r:"5"}),jsx("circle",{cx:"135",cy:"155",r:"5"}),jsx("circle",{cx:"55",cy:"175",r:"5"})]})})},"GraphLoader"),Ht=Hr;function Xt(d,p,M){let I=p.split(`
83
- `),k=[];return I.forEach(j=>{let S=j.split(" "),P="";for(let A=0;A<S.length;A++){let G=P+(P?" ":"")+S[A];d.measureText(G).width>M&&P?(k.push(P),P=S[A]):P=G;}k.push(P);}),k}a(Xt,"wrapText");var Xe=typeof window<"u"&&window.devicePixelRatio||1;function nn(d){return !d||d.length===0?[]:d.map(p=>({...p,imageCache:new Map}))}a(nn,"prepareButtonImages");var Q={fontSize:4,nodeSizeBase:30,nodeAreaFactor:2,nodeBorderWidth:1,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},fe=a(d=>d.size??Q.nodeSizeBase,"getNodeSize"),on=a((d,p)=>d.width!==void 0?p?d.width*2:d.width:p?1.5:.5,"getLinkWidth"),sn=forwardRef(({loading:d,width:p,height:M,graphData:I,buttons:k=[],enableGrid:j=true,onNodeClick:S,onBackgroundClick:P,onNodeHover:A,onLinkHover:G,onLinkClick:q,onChangeSelectedNodeIds:H},re)=>{let R=useTheme(),[ne,le]=useState(true),[K,V]=useState(null),[se,X]=useState(null),t=useRef({transform:{x:0,y:0,k:1},isPanning:false,hoveredNode:null,hoveredLink:null,draggedNode:null,selectedNodeIds:new Set,hoveredButtonIndex:null,highlightNodes:new Set,highlightLinks:new Set,lastMousePos:{x:0,y:0},mustBeStoppedPropagation:false,mouseStartPos:null,isDragging:false,width:p*Xe,height:M*Xe,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:te,links:U}=useMemo(()=>_r(I),[I]),[Y,ge]=useState([]),$=useRef(null),E=useRef(null),ie=useRef(null),Ee=scaleOrdinal(schemeCategory10),Ze=useCallback(()=>{if(!$.current)return false;try{let e=$.current.getContext("2d");return e?(ie.current=e,!0):(console.error("Failed to get 2D context"),!1)}catch(e){return console.error("Error initializing Canvas 2D context:",e),false}},[]),O=useCallback(()=>E.current?E.current.nodes():null,[]),ce=useCallback(()=>{if(!E.current)return null;let e=E.current.force("link");return e?e.links():null},[]),ft=useCallback(e=>{if(!j)return;e.save(),e.setTransform(1,0,0,1,0,0);let{width:n,height:r}=t.current,o=Q.gridSpacing,a=Q.dotSize;e.fillStyle=R.graph2D.grid.dotColor;for(let u=o/2;u<=n;u+=o)for(let i=o/2;i<=r;i+=o)e.beginPath(),e.arc(u,i,a,0,2*Math.PI),e.fill();e.restore();},[j,R.graph2D.grid.dotColor,Q.gridSpacing,Q.dotSize]),ur=useCallback((e,n,r)=>{if(!e)return "";if(r.measureText(e).width<=n)return e;let a=e,u="...";for(;r.measureText(a+u).width>n&&a.length>0;)a=a.slice(0,-1);return a+u},[]),Ke=a(e=>{let r=Math.min(e,Q.maxZoom)/Q.maxZoom;return Math.max(Q.fontSize*r,Q.fontSize)},"calculateFontSize"),ht=useCallback(e=>{let n=ce(),r=O();!n||n.length===0||!r||r.length===0||(e.lineWidth=.5,e.globalAlpha=1,n.forEach(o=>{let a=typeof o.source=="object"?o.source:r.find(ee=>ee.id===o.source),u=typeof o.target=="object"?o.target:r.find(ee=>ee.id===o.target);if(!a||!u)return;let i={x:a.x||0,y:a.y||0},h={x:u.x||0,y:u.y||0},s=h.x-i.x,c=h.y-i.y,l=Math.sqrt(s*s+c*c),m=s/l,v=c/l,g=fe(a)/2,b=fe(u)/2,W=4,N={x:i.x+m*g,y:i.y+v*g},f={x:h.x-m*(b+W),y:h.y-v*(b+W)},L={x:h.x-m*(b+1),y:h.y-v*(b+1)},C=t.current.highlightLinks.has(o),y=C?R.graph2D.link.highlighted:o.color||R.graph2D.link.normal,x=on(o,C),F=i.x+(h.x-i.x)/2,_=i.y+(h.y-i.y)/2,Z=Math.atan2(c,s);if(o.label){let ee=t.current.transform.k,de=Ke(ee);e.font=`${de}px Sans-Serif`;let be=e.measureText(o.label).width,xe=10;e.beginPath(),e.moveTo(N.x,N.y);let ve=l/2-(be+xe)/2,me={x:i.x+m*ve,y:i.y+v*ve};e.lineTo(me.x,me.y),e.strokeStyle=y,e.lineWidth=x,e.stroke(),e.beginPath();let Pe=l/2+(be+xe)/2,Ne={x:i.x+m*Pe,y:i.y+v*Pe};e.moveTo(Ne.x,Ne.y),e.lineTo(f.x,f.y),e.strokeStyle=y,e.lineWidth=x,e.stroke();}else e.beginPath(),e.moveTo(N.x,N.y),e.lineTo(f.x,f.y),e.strokeStyle=y,e.lineWidth=x,e.stroke();let B=Math.max(2,x*2),J=Math.max(4,x*4);if(e.save(),e.translate(L.x,L.y),e.rotate(Z),e.beginPath(),e.moveTo(0,0),e.lineTo(-J,B),e.lineTo(-J,0),e.lineTo(-J,-B),e.closePath(),e.fillStyle=y,e.fill(),e.restore(),o.label){let ee=t.current.transform.k,de=Ke(ee);e.font=`${de}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(F,_),Math.abs(Z)>Math.PI/2?e.rotate(Z+Math.PI):e.rotate(Z),e.fillStyle=C?R.graph2D.link.highlightedTextColor:R.graph2D.link.textColor,e.fillText(o.label,0,0),e.restore();}}));},[Q,R.graph2D.link]),mt=a((e,n,r,o,a,u,i)=>{try{if(u!=null){let h=a*.8;e.font=`${h}px sans-serif`,e.textBaseline="middle",e.textAlign="left";let s=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(u),c=e.measureText(s).width,l=a*.3,v=(a+l+c)/2;e.drawImage(n,r-v,o-a/2,a,a),e.fillStyle=i||"#99989C",e.fillText(s,r-v+a+l,o);}else e.drawImage(n,r-a/2,o-a/2,a,a);}catch(h){console.warn("Error rendering icon:",h);}},"drawIconWithOptionalCounter"),pt=useCallback((e,n)=>{if(!Y||Y.length===0||!e||!e.x||!e.y)return;let{x:r,y:o}=e,a$1=fe(e),u=a$1*Q.nodeAreaFactor/2;n.save();let i=Math.min(Y.length,8),h=Math.min(Math.PI*2/i,Math.PI);for(let s=0;s<i;s++){let c=s*h,l=(s+1)*h,m$1=t.current.hoveredButtonIndex===s;n.beginPath(),n.arc(r,o,u,c,l,false),n.lineTo(r,o),n.closePath(),n.lineWidth=1,n.strokeStyle=R.graph2D?.button?.stroke||"#FFFFFF",n.stroke(),n.fillStyle=m$1?R.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":R.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",n.fill();let v=u*.2,g=(c+l)/2,b=u-a$1/2+v,W=r+Math.cos(g)*b,N=o+Math.sin(g)*b,f=Y[s],L=typeof f.loading=="function"?f.loading(e):f.loading,C=a(B=>typeof B=="function"?B(e):B,"getImageUrl"),y=C(f.img),x=C(f.hoverImg),F=a(B=>{if(!f.imageCache.has(B)){let J=new Image;J.src=B,f.imageCache.set(B,J);}return f.imageCache.get(B)},"getOrCreateImage"),_=F(y),Z=F(x);if(L){let B=v/2,J=v/12;n.save(),n.translate(W,N),n.rotate(t.current.spinnerAngle);for(let ee=0;ee<12;ee++){let de=Math.PI*2*ee/12,be=ee/12,xe=Math.cos(de)*B,ve=Math.sin(de)*B;n.beginPath(),n.fillStyle=m(R.graph2D?.button?.spinnerColor,be),n.arc(xe,ve,J,0,Math.PI*2),n.fill();}n.restore(),t.current.spinnerAngle+=.1,t.current.spinnerAngle>Math.PI*2&&(t.current.spinnerAngle-=Math.PI*2),t.current.animation.id!==null&&(cancelAnimationFrame(t.current.animation.id),t.current.animation.id=null,t.current.animation.buttonIndex=null),t.current.animation.id=requestAnimationFrame(D),t.current.animation.buttonIndex=s;}else {t.current.animation.id&&t.current.animation.buttonIndex===s&&(cancelAnimationFrame(t.current.animation.id),t.current.animation.id=null,t.current.animation.buttonIndex=null);let B=m$1?Z:_,J=f.getCount?f.getCount(e):null;B.complete?mt(n,B,W,N,v,J,R.graph2D?.button?.textColor):B.onload=()=>{ie.current&&mt(n,B,W,N,v,J,R.graph2D?.button?.textColor);};}}n.restore();},[Y,R.graph2D?.button]),gt=useCallback(e=>{if(!se||!K)return;let n=Number(R.tooltip.padding)||10,r=Number(R.tooltip.maxWidth)||200,o=Number(R.tooltip.fontSize)||14,a=Number(R.tooltip.borderRadius)||4,u=1.4,i=10;e.save(),e.font=`${o}px Sans-Serif`;let h=typeof se=="string"?se:String(se),s=Xt(e,h,r),c=Math.min(r,Math.max(...s.map(f=>e.measureText(f).width))),l=s.length*o*u,m=c+n*2,v=l+n*2,g=K.x-m/2,b=K.y-v-i,W=$.current?.getBoundingClientRect();W&&(g<5&&(g=5),g+m>W.width-5&&(g=W.width-m-5),b<5&&(b=K.y+i));let N=R.tooltip.shadow?.match(/(-?\d+(?:\.\d+)?(?:px)?)\s+(-?\d+(?:\.\d+)?(?:px)?)\s+(-?\d+(?:\.\d+)?(?:px)?)(?:\s+(-?\d+(?:\.\d+)?(?:px)?))?\s+(rgba?\([^)]+\)|#[0-9a-fA-F]{3,8}|\w+)/);N&&(e.shadowOffsetX=parseFloat(N[1]),e.shadowOffsetY=parseFloat(N[2]),e.shadowBlur=parseFloat(N[3]),e.shadowColor=N[5]),e.fillStyle=R.tooltip.background,e.beginPath(),e.roundRect(g,b,m,v,a),e.fill(),e.shadowColor="transparent",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.fillStyle=R.tooltip.color,e.textAlign="left",e.textBaseline="top",s.forEach((f,L)=>{e.fillText(f,g+n,b+o/4+n+L*o*u);}),e.restore();},[se,K,R.tooltip]),yt=useCallback(e=>{let n=O();!n||n.length===0||(e.globalAlpha=1,n.forEach(r=>{let{x:o,y:a,color:u,fontColor:i,label:h}=r,s=r.id&&t.current.selectedNodeIds.has(r.id),c=r.id&&t.current.hoveredNode?.id===r.id,l=fe(r),m=l/2;if(c&&k&&k.length>0&&pt(r,e),s){let v=l/2+Q.nodeBorderWidth,g=l/2+Q.nodeBorderWidth/2;e.save(),e.shadowBlur=Q.nodeBorderWidth*10,e.shadowColor=R.graph2D.ring.selectionFill,e.beginPath(),e.arc(o,a,v,0,2*Math.PI,false),e.fillStyle=R.graph2D.ring.selectionFill,e.fill(),e.restore(),e.beginPath(),e.arc(o,a,g,0,2*Math.PI,false),e.fillStyle=R.graph2D.ring.borderFill,e.fill();}if(e.beginPath(),e.arc(o,a,m,0,2*Math.PI),e.fillStyle=u||Ee(r.group||"0"),e.fill(),h){e.save(),e.translate(o,a);let v=t.current.transform.k,g=Ke(v),b=l*Q.textPaddingFactor;e.font=`${g}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle=i||"#000";let W=ur(h,b,e);e.fillText(W,0,0),e.restore();}}));},[R.graph2D.ring,k,pt]),D=useCallback(()=>{let e=ie.current;e&&(e.clearRect(0,0,t.current.width,t.current.height),ft(e),e.save(),e.setTransform(t.current.transform.k,0,0,t.current.transform.k,t.current.transform.x,t.current.transform.y),ht(e),yt(e),e.restore(),gt(e));},[ht,yt,ft,gt]),bt=useCallback((e,n=[],r,o)=>{let a=ce()||[],u=O()||[];if(!E.current||!e.length)return;let{width:i,height:h}=t.current,s=r?.smoothAppearance??false,c=r?.transitionDuration??1e3,l=new Set(u.map(f=>f.id)),m=e.filter(f=>!l.has(f.id)),v=new Set(a.map(f=>`${typeof f.source=="object"?f.source.id:f.source}-${typeof f.target=="object"?f.target.id:f.target}`)),g=n.filter(f=>{let L=`${typeof f.source=="object"?f.source.id:f.source}-${typeof f.target=="object"?f.target.id:f.target}`;return !v.has(L)});if(m.length===0&&g.length===0)return;let b=[...u,...m],W=[...a,...g];s&&(m.forEach(f=>{let L=g.filter(C=>{let y=typeof C.source=="object"?C.source.id:C.source,x=typeof C.target=="object"?C.target.id:C.target;return y===f.id&&l.has(x)||x===f.id&&l.has(y)});if(L.length>0){let C=L[0],y=typeof C.source=="object"?C.source.id===f.id?C.target:C.source.id:C.source===f.id?C.target:C.source,x=b.find(F=>F.id===y);if(x&&x.x!==void 0&&x.y!==void 0){let F=30+Math.random()*20,_=Math.random()*Math.PI*2;f.x=x.x+Math.cos(_)*F,f.y=x.y+Math.sin(_)*F,f.vx=0,f.vy=0;}}else {let C=i/2,y=h/2,x=Math.min(i,h)/4,F=Math.random()*Math.PI*2;f.x=C+Math.cos(F)*(x*Math.random()),f.y=y+Math.sin(F)*(x*Math.random()),f.vx=0,f.vy=0;}}),u.forEach(f=>{f.fx=f.x,f.fy=f.y;})),E.current.nodes(b);let N=E.current.force("link");N&&N.links(W),g.forEach(f=>{let L=typeof f.source=="object"?f.source:b.find(y=>y.id===f.source),C=typeof f.target=="object"?f.target:b.find(y=>y.id===f.target);!L||!C||(!L.neighbors&&(L.neighbors=[]),!C.neighbors&&(C.neighbors=[]),L.neighbors.push(C),C.neighbors.push(L),!L.links&&(L.links=[]),!C.links&&(C.links=[]),L.links.push(f),C.links.push(f));}),s?(E.current.alphaTarget(.3),E.current.alpha(.3),E.current.velocityDecay(.7),E.current.restart(),setTimeout(()=>{u.forEach(f=>{f.fx=void 0,f.fy=void 0;}),E.current?.alphaTarget(0),E.current?.alpha(.1),E.current?.velocityDecay(.6);},c)):E.current.alpha(.1).restart(),D(),o?.();},[te,D]),xt=useCallback(e=>{let n=O(),r=ce();if(!E.current||!e.length||!n||n.length===0||!r||r.length===0)return;let o=new Set(e);if(e.forEach(s=>t.current.selectedNodeIds.delete(s)),t.current.hoveredNode&&t.current.hoveredNode.id!==void 0&&o.has(t.current.hoveredNode.id)&&(t.current.hoveredNode=null,X(null),V(null)),t.current.hoveredLink){let s=typeof t.current.hoveredLink.source=="object"?t.current.hoveredLink.source.id:t.current.hoveredLink.source,c=typeof t.current.hoveredLink.target=="object"?t.current.hoveredLink.target.id:t.current.hoveredLink.target;(s!==void 0&&o.has(s)||c!==void 0&&o.has(c))&&(t.current.hoveredLink=null);}t.current.draggedNode&&t.current.draggedNode.id!==void 0&&o.has(t.current.draggedNode.id)&&(t.current.draggedNode=null);let a=n.filter(s=>s.id!==void 0&&!o.has(s.id)),u=r.filter(s=>{let c=typeof s.source=="object"?s.source.id:s.source,l=typeof s.target=="object"?s.target.id:s.target;return c!==void 0&&!o.has(c)&&l!==void 0&&!o.has(l)}),i=[];t.current.highlightLinks.forEach(s=>{let c=typeof s.source=="object"?s.source.id:s.source,l=typeof s.target=="object"?s.target.id:s.target;(c!==void 0&&o.has(c)||l!==void 0&&o.has(l))&&i.push(s);}),i.forEach(s=>t.current.highlightLinks.delete(s)),a.forEach(s=>{s.neighbors=[],s.links=[];}),u.forEach(s=>{let c=typeof s.source=="object"?s.source:a.find(m=>m.id===s.source),l=typeof s.target=="object"?s.target:a.find(m=>m.id===s.target);!c||!l||(c.neighbors=c.neighbors||[],l.neighbors=l.neighbors||[],c.neighbors.push(l),l.neighbors.push(c),c.links=c.links||[],l.links=l.links||[],c.links.push(s),l.links.push(s));}),E.current.nodes(a);let h=E.current.force("link");h&&h.links(u),H?.(t.current.selectedNodeIds),D();},[D,H]),ye=useCallback((e=0,n=20)=>{let r=O();if(!ie.current||!$.current||!r||!r.length)return;let a$1=1/0,u=1/0,i=-1/0,h=-1/0;if(r.forEach(s=>{if(s.x===void 0||s.y===void 0)return;let c=s.x,l=s.y;a$1=Math.min(a$1,c),u=Math.min(u,l),i=Math.max(i,c),h=Math.max(h,l);}),isFinite(a$1)&&isFinite(i)&&isFinite(u)&&isFinite(h)){let{width:s,height:c}=t.current;a$1-=n,u-=n,i+=n,h+=n;let l=i-a$1,m=h-u,v=l>0?s/l:1,g=m>0?c/m:1,b=Math.min(v,g,10),W=a$1+l/2,N=u+m/2,f={k:b,x:s/2-W*b,y:c/2-N*b};if(e>0){let L={...t.current.transform},C=Date.now(),y=a(()=>{let x=Math.min(1,(Date.now()-C)/e),F=x===1?1:1-Math.pow(1-x,3),_={k:L.k+(f.k-L.k)*F,x:L.x+(f.x-L.x)*F,y:L.y+(f.y-L.y)*F};t.current.transform=_,D(),x<1&&requestAnimationFrame(y);},"animateZoom");requestAnimationFrame(y);}else t.current.transform=f,D();}},[]),vt=useCallback((e=0,n=20)=>{let r=O(),o=ie.current,a$1=t.current.selectedNodeIds;if(!o||!$.current||!r||!r.length||a$1.size===0)return;let u=r.filter(l=>l.id&&a$1.has(l.id));if(u.length===0)return;let i=1/0,h=1/0,s=-1/0,c=-1/0;if(u.forEach(l=>{l.x===void 0||l.y===void 0||(i=Math.min(i,l.x),h=Math.min(h,l.y),s=Math.max(s,l.x),c=Math.max(c,l.y));}),i===s&&h===c&&(i-=100,h-=100,s+=100,c+=100),isFinite(i)&&isFinite(s)&&isFinite(h)&&isFinite(c)){let{width:l,height:m}=t.current;i-=n,h-=n,s+=n,c+=n;let v=s-i,g=c-h,b=v>0?l/v:1,W=g>0?m/g:1,N=Math.min(b,W,Q.maxZoom),f=i+v/2,L=h+g/2,C={k:N,x:l/2-f*N,y:m/2-L*N};if(e>0){let y={...t.current.transform},x=Date.now(),F=a(()=>{let _=Math.min(1,(Date.now()-x)/e),Z=_===1?1:1-Math.pow(1-_,3),B={k:y.k+(C.k-y.k)*Z,x:y.x+(C.x-y.x)*Z,y:y.y+(C.y-y.y)*Z};t.current.transform=B,D(),_<1&&requestAnimationFrame(F);},"animateZoom");requestAnimationFrame(F);}else t.current.transform=C,D();}},[O,D]),wt=useCallback((e,n=0,r=20)=>{let o=O();if(!ie.current||!$.current||!o||!o.length||!e||e.length===0)return;let u=new Set(e),i=o.filter(m=>m.id&&u.has(m.id));if(i.length===0)return;let h=1/0,s=1/0,c=-1/0,l=-1/0;if(i.forEach(m=>{m.x===void 0||m.y===void 0||(h=Math.min(h,m.x),s=Math.min(s,m.y),c=Math.max(c,m.x),l=Math.max(l,m.y));}),h===c&&s===l&&(h-=100,s-=100,c+=100,l+=100),isFinite(h)&&isFinite(c)&&isFinite(s)&&isFinite(l)){let{width:m,height:v}=t.current;h-=r,s-=r,c+=r,l+=r;let g=c-h,b=l-s,W=g>0?m/g:1,N=b>0?v/b:1,f=Math.min(W,N,Q.maxZoom),L=h+g/2,C=s+b/2,y={k:f,x:m/2-L*f,y:v/2-C*f};if(n>0){let x={...t.current.transform},F=Date.now(),_=a(()=>{let Z=Math.min(1,(Date.now()-F)/n),B=Z===1?1:1-Math.pow(1-Z,3),J={k:x.k+(y.k-x.k)*B,x:x.x+(y.x-x.x)*B,y:x.y+(y.y-x.y)*B};t.current.transform=J,D(),Z<1&&requestAnimationFrame(_);},"animateZoom");requestAnimationFrame(_);}else t.current.transform=y,D();}},[O,D]),Ce=useCallback(e=>{t.current.selectedNodeIds.clear(),t.current.highlightLinks.clear(),e.forEach(n=>t.current.selectedNodeIds.add(n)),H?.(t.current.selectedNodeIds),D();},[D,H]),St=useCallback((e,n)=>{let r=O();!r||r.length===0||(r.forEach(o=>{o.id&&e.includes(o.id)&&(o.size=n);}),E.current&&(E.current.force("collide",forceCollide().radius(o=>fe(o)).iterations(2).strength(1)),E.current.alpha(.2).restart()),D());},[O,D]),Mt=useCallback((e,n)=>{let r=O();!r||r.length===0||(r.forEach(o=>{o.id&&e.includes(o.id)&&(o.color=n);}),D());},[O,D]),Ct=useCallback((e,n)=>{let r=ce();!r||r.length===0||(r.forEach(o=>{o.id&&e.includes(o.id)&&(o.width=n);}),D());},[ce,D]),Pt=useCallback((e,n)=>{let r=ce();!r||r.length===0||(r.forEach(o=>{o.id&&e.includes(o.id)&&(o.color=n);}),D());},[ce,D]),Dt=useCallback((e,n)=>{let r=O(),o=ce();if(!r||!o||r.length===0||o.length===0)return 0;let a=r.find(c=>c.id===e),u=r.find(c=>c.id===n);if(!a||!u)return console.warn("Source or target node not found"),0;if(e===n)return Ce([e]),1;let i=new Map;o.forEach(c=>{let l=typeof c.source=="object"?c.source.id:c.source,m=typeof c.target=="object"?c.target.id:c.target;l===void 0||m===void 0||(i.has(l)||i.set(l,[]),i.has(m)||i.set(m,[]),i.get(l).push({nodeId:m,link:c}),i.get(m).push({nodeId:l,link:c}));});let h=[{nodeId:e,path:[e],links:[]}],s=new Set([e]);for(;h.length>0;){let c=h.shift();if(c.nodeId===n)return Ce(c.path),t.current.highlightLinks.clear(),c.links.forEach(m=>{t.current.highlightLinks.add(m);}),D(),c.path.length;(i.get(c.nodeId)||[]).forEach(({nodeId:m,link:v})=>{s.has(m)||(s.add(m),h.push({nodeId:m,path:[...c.path,m],links:[...c.links,v]}));});}return console.warn("No path found between nodes"),0},[O,ce,Ce,D]),Lt=useCallback((e,n)=>{let r=O();if(!r||r.length===0||e.size===0)return;let o=n?.spacing??100,a=r.filter(g=>g.id!==void 0&&e.has(g.id));if(a.length===0){console.warn("No nodes found with provided IDs");return}let u=n?.columns??Math.ceil(Math.sqrt(a.length)),i=a.reduce((g,b)=>g+(b.x??0),0)/a.length,h=a.reduce((g,b)=>g+(b.y??0),0)/a.length,s=Math.ceil(a.length/u),c=(u-1)*o,l=(s-1)*o,m=i-c/2,v=h-l/2;a.forEach((g,b)=>{let W=b%u,N=Math.floor(b/u),f=m+W*o,L=v+N*o;g.x=f,g.y=L,g.fx=f,g.fy=L;}),E.current&&E.current.alpha(.3).restart(),D();},[O,D]),Et=useCallback((e,n)=>{let r=O();if(!r||r.length===0)return;let o=n?.spacing??100,a=n?.groupSpacing??200,u=n?.columns,i=new Map;r.forEach(y=>{let x=y[e],F;Array.isArray(x)?F=x.length>0?String(x[0]):"undefined":typeof x=="string"?F=x:F="undefined",i.has(F)||i.set(F,[]),i.get(F).push(y);});let h=i.size,s=Math.ceil(Math.sqrt(h)),c=r.reduce((y,x)=>y+(x.x??0),0)/r.length,l=r.reduce((y,x)=>y+(x.y??0),0)/r.length,m=0,v=[];i.forEach(y=>{let x=u??Math.ceil(Math.sqrt(y.length)),F=Math.ceil(y.length/x),_=(x-1)*o,Z=(F-1)*o;v.push({width:_,height:Z});});let g=Math.max(...v.map(y=>y.width),0),b=Math.max(...v.map(y=>y.height),0),W=Math.ceil(h/s),N=(s-1)*(g+a),f=(W-1)*(b+a),L=c-N/2,C=l-f/2;i.forEach((y,x)=>{if(y.length===0){m++;return}let F=m%s,_=Math.floor(m/s),Z=L+F*(g+a),B=C+_*(b+a),J=u??Math.ceil(Math.sqrt(y.length)),ee=Math.ceil(y.length/J),de=(J-1)*o,be=(ee-1)*o,xe=Z-de/2,ve=B-be/2;y.forEach((me,Pe)=>{let Ne=Pe%J,mr=Math.floor(Pe/J),Nt=xe+Ne*o,Ft=ve+mr*o;me.x=Nt,me.y=Ft,me.fx=Nt,me.fy=Ft;}),m++;}),E.current&&E.current.alpha(.3).restart(),D(),ye(300,50);},[O,D,ye]),Te=useCallback((e,n)=>{let r=O();if(!r||r.length===0)return null;let o=typeof window<"u"&&window.devicePixelRatio||1,a=(e*o-t.current.transform.x)/t.current.transform.k,u=(n*o-t.current.transform.y)/t.current.transform.k;return r.find(i=>{let h=fe(i)/2,s=(i.x||0)-a,c=(i.y||0)-u;return Math.sqrt(s*s+c*c)<=h})||null},[]),ke=useCallback((e,n)=>{let r=ce(),o=O();if(!r||r.length===0||!o||o.length===0)return null;let a=typeof window<"u"&&window.devicePixelRatio||1,u=(e*a-t.current.transform.x)/t.current.transform.k,i=(n*a-t.current.transform.y)/t.current.transform.k,h=5;return r.find(s=>{let c=typeof s.source=="object"?s.source:o.find(ee=>ee.id===s.source),l=typeof s.target=="object"?s.target:o.find(ee=>ee.id===s.target);if(!c||!l)return false;let m=c.x||0,v=c.y||0,g=l.x||0,b=l.y||0,W=u-m,N=i-v,f=g-m,L=b-v,C=W*f+N*L,y=f*f+L*L;if(y===0)return false;let x=C/y;x=Math.max(0,Math.min(1,x));let F=m+x*f,_=v+x*L,Z=u-F,B=i-_;return Math.sqrt(Z*Z+B*B)<=h})||null},[]),Tt=useCallback((e,n,r,o,a,u,i)=>{let h=e-r,s=n-o,c=Math.sqrt(h*h+s*s),l=Math.atan2(s,h);l<0&&(l+=2*Math.PI);let g=c>=a*.5&&c<=a*1,b=false;return u===Math.PI&&i===Math.PI*2?b=l>=Math.PI&&l<=Math.PI*2:u===0&&i===Math.PI?b=l>=0&&l<=Math.PI:b=u<=i&&l>=u&&l<=i||u>i&&(l>=u||l<=i),g&&b},[]),Ue=useCallback(e=>{e!==t.current.hoveredNode&&(t.current.hoveredNode=e,A&&A(e));},[A]),Ve=useCallback((e,n)=>{if(n===t.current.hoveredLink)return;let r=new Set,o=new Set;if(n){o.add(n);let a=O();if(a){let u=typeof n.source=="object"?n.source:a.find(h=>h.id===n.source),i=typeof n.target=="object"?n.target:a.find(h=>h.id===n.target);u&&r.add(u),i&&r.add(i);}}t.current.hoveredLink=n,G&&G(n,e);},[G,O]),kt=useCallback(e=>{q&&q(e);},[q]),It=useCallback((e,n)=>{n.id&&(e.ctrlKey||e.metaKey?(t.current.selectedNodeIds.has(n.id)?t.current.selectedNodeIds.delete(n.id):t.current.selectedNodeIds.add(n.id),t.current.highlightLinks.clear()):(t.current.selectedNodeIds.clear(),t.current.highlightLinks.clear(),t.current.selectedNodeIds.add(n.id)),H?.(t.current.selectedNodeIds),D()),S&&S(n);},[S,H,D]),Rt=useCallback(()=>{t.current.selectedNodeIds.clear(),t.current.highlightLinks.clear(),H?.(t.current.selectedNodeIds),D(),P&&P();},[P,H,D]),Je=useCallback(e=>{if(!$.current||!E.current)return;let n=$.current.getBoundingClientRect(),r=e.clientX-n.left,o=e.clientY-n.top;t.current.mouseStartPos={x:r,y:o},t.current.isDragging=false;let a=Te(r,o);a?(t.current.draggedNode=a,a.fx=a.x,a.fy=a.y):(t.current.isPanning=true,t.current.lastMousePos={x:r,y:o});},[Te]),Ie=useCallback((e,n)=>{let r=null;if($.current&&t.current&&Y.length>0&&t.current.hoveredNode){let a=fe(t.current.hoveredNode)*Q.nodeAreaFactor/2,u=$.current.getBoundingClientRect(),i=$.current.width/u.width,h=$.current.height/u.height,s=e*i,c=n*h,l=(s-t.current.transform.x)/t.current.transform.k,m=(c-t.current.transform.y)/t.current.transform.k,v=t.current.hoveredNode?.x||0,g=t.current.hoveredNode?.y||0,b=Math.min(Y.length,8),W=Math.min(Math.PI*2/b,Math.PI);for(let N=0;N<b;N++){let f=N*W,L=(N+1)*W;if(Tt(l,m,v,g,a,f,L)){r=N;break}}}return r},[Y]),Qe=useCallback(e=>{if(!$.current)return;let n=$.current.getBoundingClientRect(),r=e.clientX-n.left,o=e.clientY-n.top;if(t.current.draggedNode&&t.current.mouseStartPos&&E.current){let i=t.current.mouseStartPos.x,h=t.current.mouseStartPos.y,s=r-i,c=o-h;Math.sqrt(s*s+c*c)>3&&(t.current.isDragging=true,E.current.alphaTarget()===0&&E.current.alphaTarget(0).restart());let v=typeof window<"u"&&window.devicePixelRatio||1,g=(r*v-t.current.transform.x)/t.current.transform.k,b=(o*v-t.current.transform.y)/t.current.transform.k;t.current.draggedNode.fx=g,t.current.draggedNode.fy=b;return}if(t.current.isPanning&&t.current.mouseStartPos){let i=r-t.current.lastMousePos.x,h=o-t.current.lastMousePos.y,s=t.current.mouseStartPos.x,c=t.current.mouseStartPos.y;Math.sqrt(Math.pow(r-s,2)+Math.pow(o-c,2))>3&&(t.current.isDragging=true),t.current.transform={...t.current.transform,x:t.current.transform.x+i,y:t.current.transform.y+h},t.current.lastMousePos={x:r,y:o},D();return}let a,u;if(t.current.hoveredNode&&$.current&&Y.length>0){let i=Ie(r,o);if(i!==null&&(u=t.current.hoveredNode),i!==null&&t.current.hoveredButtonIndex===i&&V({x:r,y:o}),i!==t.current.hoveredButtonIndex){if(a=true,i!==null){let h=Y[i];if(h?.tooltip){let s=typeof h.tooltip=="function"?h.tooltip(t.current.hoveredNode):h.tooltip;X(s),V({x:r,y:o});}else X(null),V(null);}else X(null),V(null);t.current.hoveredButtonIndex=i;}}else t.current.hoveredButtonIndex!==null&&(t.current.hoveredButtonIndex=null,X(null),V(null));if(!u&&(u=Te(r,o),!u)){let i=ke(r,o),h=i!==t.current.hoveredLink;if(i&&t.current.hoveredNode&&Ue(null),Ve(e,i),$.current&&($.current.style.cursor=i?"pointer":"default"),h){D();return}}u&&t.current.hoveredLink&&Ve(e,null),u!==t.current.hoveredNode&&(a=true),Ue(u),$.current&&($.current.style.cursor=u?"pointer":"default"),a&&D();},[Y,Te,ke,Ue,Ve,D,Tt,Ie]),dr=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.stopPropagation(),e.preventDefault()),t.current.mustBeStoppedPropagation=false;},[]),Re=useCallback(e=>{let n=t.current.isDragging;if(n&&(t.current.mustBeStoppedPropagation=true),!n&&t.current.mouseStartPos){let r=$.current?.getBoundingClientRect();if(r){let o=e.clientX-r.left,a=e.clientY-r.top;if(Y.length>0&&t.current.hoveredButtonIndex===null){let i=Ie(o,a);t.current.hoveredButtonIndex=i;}let u=false;if(t.current.hoveredNode&&t.current.hoveredButtonIndex!==null&&k[t.current.hoveredButtonIndex]){let i=k[t.current.hoveredButtonIndex];i&&i.onClick&&(i.onClick(t.current.hoveredNode),u=true,t.current.hoveredButtonIndex=null);}if(!u&&t.current.draggedNode)It(e,t.current.draggedNode);else if(!u&&!t.current.draggedNode){let i=ke(o,a);i?kt(i):Rt();}}}if(t.current.draggedNode&&E.current){if(n){E.current.alphaTarget(0);let r=.05,o=.04,a=.6;E.current.alpha(r).alphaDecay(o),E.current.velocityDecay(a);}else E.current.alphaTarget(0);t.current.draggedNode.fx=void 0,t.current.draggedNode.fy=void 0,t.current.draggedNode=null;}t.current.isDragging=false,t.current.mouseStartPos=null,t.current.isPanning&&(t.current.isPanning=false),D();},[k,D,It,Rt,ke,kt,Ie,Y]),et=useCallback(e=>{if(e.stopPropagation(),e.preventDefault(),!$.current)return;let n=$.current.getBoundingClientRect(),r=e.clientX-n.left,o=e.clientY-n.top,u=-e.deltaY>0?1.1:1/1.1,i=t.current.transform,h=i.k*u;if(h<.01||h>10)return;let s=i.k*u,c=r-(r-i.x)*u,l=o-(o-i.y)*u;t.current.transform={k:s,x:c,y:l},D();},[D]),tt=a((e,n)=>{let r=e.touches[0];if(r){let o={clientX:r.clientX,clientY:r.clientY};n(o);}},"convertTouchToMouseEvent"),fr=useCallback(e=>{tt(e,Je);},[Je]),rt=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.preventDefault(),e.stopPropagation()),t.current.mustBeStoppedPropagation=false,tt(e,Re);},[Re]),hr=useCallback(e=>{tt(e,Qe);},[Qe]);return useImperativeHandle(re,()=>({zoomToFit:ye,zoomToSelected:vt,zoomToNodes:wt,addNodes:bt,removeNodes:xt,setSelectedNodes:Ce,setNodeSizes:St,setNodeColors:Mt,setLinkWidths:Ct,setLinkColors:Pt,findShortestPath:Dt,arrangeSelectedInGrid:Lt,arrangeNodesByTypeInGrid:Et}),[ye,vt,wt,bt,xt,Ce,St,Mt,Ct,Pt,Dt,Lt,Et]),useEffect(()=>{let e=$.current,{width:n,height:r}=t.current;if(!e)return;Ze(),le(true);let o=n/2,a=r/2,u=Q.nodeSizeBase,h=u*2.5;E.current&&E.current.stop();let s=E.current=forceSimulation(te).force("link",forceLink(U).id(c=>c.id).distance(h).strength(.9)).force("charge",forceManyBody().strength(-u/10*200).theta(.5).distanceMin(u*2)).force("x",forceX().strength(.03)).force("y",forceY().strength(.03)).force("center",forceCenter(o,a).strength(.05)).force("collide",forceCollide().radius(c=>fe(c)).iterations(2).strength(1)).velocityDecay(.6);return ()=>{s.stop();}},[te,U]),useLayoutEffect(()=>{let e=$.current;e&&(t.current.width=p*Xe,t.current.height=M*Xe,e.width=t.current.width,e.height=t.current.height);},[p,M]),useEffect(()=>{if(E.current){let e=E.current;e.on("tick",()=>{D();}),e.on("end",()=>{ne&&(ye(0,20),setTimeout(()=>{le(false);},200));});}ne||D();},[te,U,ne,D,ye]),useEffect(()=>{!te||!U||U.forEach(e=>{let n=typeof e.source=="object"?e.source:te.find(o=>o.id===e.source),r=typeof e.target=="object"?e.target:te.find(o=>o.id===e.target);!n||!r||(!n.neighbors&&(n.neighbors=[]),!r.neighbors&&(r.neighbors=[]),n.neighbors.push(r),r.neighbors.push(n),!n.links&&(n.links=[]),!r.links&&(r.links=[]),n.links.push(e),r.links.push(e));});},[te,U]),useEffect(()=>{k&&k.length>0&&ge(nn(k));},[k]),useEffect(()=>{let e=$.current;if(!(!e||typeof window>"u"))return e.addEventListener("wheel",et,{passive:false}),e.addEventListener("touchend",rt,{passive:false}),()=>{e.removeEventListener("wheel",et),e.removeEventListener("touchend",rt);}},[et,rt]),jsx(cn,{children:jsxs(an,{children:[(d||ne)&&jsx(Ht,{width:p,height:M}),jsx(ln,{ref:$,style:{width:p,height:M,display:d||ne?"none":"block"},onMouseDown:Je,onMouseMove:Qe,onMouseUp:Re,onMouseLeave:Re,onClick:dr,onTouchStart:fr,onTouchMove:hr})]})})}),cn=styled.div`
82
+ `,Hr=a(({width:f=280,height:p=280})=>{let M=useTheme();return jsx(Ar,{children:jsxs(Wr,{foregroundColor:M.contentLoader.foreground,backgroundColor:M.contentLoader.background,width:f,height:p,viewBox:"0 0 280 280",children:[jsx("path",{d:"m55 38-0.97266 0.22852 7.0801 30.092-18.355-20.979-0.75195 0.6582 19.596 22.395 0.43164 1.834 0.97266-0.22852 0.75195-0.6582-0.37695-0.42969 9.625-27.912-0.94531-0.32617-9.4375 27.371-0.10547-0.12109zm8 34-0.78516 0.61914 0.0957 0.12305-12.311 13.258 0.73242 0.67969 12.205-13.145 14.277 18.084 0.78516-0.61914-14.373-18.207 0.10547-0.11328zm15 19-0.48438 0.875 46.992 25.996 8e-3 4e-3 20.506 11.592-28.182 4.5449 0.15998 0.98819 29.418-4.7441 0.25 0.14062-12.555 24.143 0.88672 0.46094 13-25 15 25 26 30v18l-11 18 0.85352 0.52148 9.8008-16.039-4.6543 33.518 0.99023 0.13867 4.7793-34.408 7.2305 16.27 0.91406-0.40625-7.9141-17.807v-17.104l18 12.316 0.56445-0.82617-18.896-12.928-25.855-29.836-14.633-24.387 0.01562-0.02344h23.805v-1h-23.152l13.848-21.234 55.201-28.791-0.45898-0.88476 0.77734 0.62305 11.402-14.25 16.668-11.842-0.58008-0.81641-16.785 11.928-11.486 14.355-55.434 28.912-14.277 21.893-7.7617-27.166-0.96094 0.27344 7.7227 27.031-1.1191 0.17969-21.604-12.211zm140.43-12.912-6.957-17.338-0.92773 0.37305 6.957 17.338zm-6.957-17.338 0.72266 0.69336 16.232-16.896-0.7207-0.69336zm-3.4766 137.25 5 15 0.94922-0.31641-5-15zm-91-63-0.48047-0.87695-31 17 0.48047 0.87695zm-31 17 5 18 0.96289-0.26758-5-18zm0 0-0.70703-0.70703-12.898 12.898-17.881 9.9336 0.48633 0.875 18-10zm5 18-0.64062-0.76758-18 15 0.64062 0.76758z"}),jsx("circle",{cx:"229.92",cy:"63.7318",r:"5",transform:"rotate(173.661 229.92 63.7318)"}),jsx("circle",{cx:"227.711",cy:"43.8541",r:"5",transform:"rotate(173.661 227.711 43.8541)"}),jsx("circle",{cx:"211.478",cy:"60.7499",r:"5",transform:"rotate(173.661 211.478 60.7499)"}),jsx("circle",{cx:"218.434",cy:"78.0877",r:"5",transform:"rotate(173.661 218.434 78.0877)"}),jsx("circle",{cx:"246.705",cy:"51.8054",r:"5",transform:"rotate(173.661 246.705 51.8054)"}),jsx("circle",{cx:"42",cy:"48",r:"5"}),jsx("circle",{cx:"55",cy:"38",r:"5"}),jsx("circle",{cx:"73",cy:"43",r:"5"}),jsx("circle",{cx:"63",cy:"72",r:"5"}),jsx("circle",{cx:"50",cy:"86",r:"5"}),jsx("circle",{cx:"78",cy:"91",r:"5"}),jsx("circle",{cx:"73",cy:"165",r:"5"}),jsx("circle",{cx:"73",cy:"185",r:"5"}),jsx("circle",{cx:"91",cy:"170",r:"5"}),jsx("circle",{cx:"86",cy:"152",r:"5"}),jsx("circle",{cx:"148",cy:"130",r:"5"}),jsx("circle",{cx:"189",cy:"185",r:"5"}),jsx("circle",{cx:"163",cy:"107",r:"5"}),jsx("circle",{cx:"140",cy:"102",r:"5"}),jsx("circle",{cx:"117",cy:"135",r:"5"}),jsx("circle",{cx:"125",cy:"117",r:"5"}),jsx("circle",{cx:"208",cy:"198",r:"5"}),jsx("circle",{cx:"189",cy:"203",r:"5"}),jsx("circle",{cx:"198",cy:"221",r:"5"}),jsx("circle",{cx:"178",cy:"221",r:"5"}),jsx("circle",{cx:"184",cy:"239",r:"5"}),jsx("circle",{cx:"213",cy:"213",r:"5"}),jsx("circle",{cx:"173",cy:"130",r:"5"}),jsx("circle",{cx:"163",cy:"155",r:"5"}),jsx("circle",{cx:"135",cy:"155",r:"5"}),jsx("circle",{cx:"55",cy:"175",r:"5"})]})})},"GraphLoader"),Ht=Hr;function Xt(f,p,M){let I=p.split(`
83
+ `),k=[];return I.forEach(j=>{let S=j.split(" "),P="";for(let A=0;A<S.length;A++){let G=P+(P?" ":"")+S[A];f.measureText(G).width>M&&P?(k.push(P),P=S[A]):P=G;}k.push(P);}),k}a(Xt,"wrapText");var Xe=typeof window<"u"&&window.devicePixelRatio||1;function nn(f){return !f||f.length===0?[]:f.map(p=>({...p,imageCache:new Map}))}a(nn,"prepareButtonImages");var Q={fontSize:4,nodeSizeBase:30,nodeAreaFactor:2,nodeBorderWidth:1,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},fe=a(f=>f.size??Q.nodeSizeBase,"getNodeSize"),on=a((f,p)=>f.width!==void 0?p?f.width*2:f.width:p?1.5:.5,"getLinkWidth"),sn=forwardRef(({loading:f,width:p,height:M,graphData:I,buttons:k=[],enableGrid:j=true,onNodeClick:S,onBackgroundClick:P,onNodeHover:A,onLinkHover:G,onLinkClick:q,onChangeSelectedNodeIds:H},re)=>{let R=useTheme(),[ne,le]=useState(true),[K,V]=useState(null),[se,X]=useState(null),t=useRef({transform:{x:0,y:0,k:1},isPanning:false,hoveredNode:null,hoveredLink:null,draggedNode:null,selectedNodeIds:new Set,hoveredButtonIndex:null,highlightNodes:new Set,highlightLinks:new Set,lastMousePos:{x:0,y:0},mustBeStoppedPropagation:false,mouseStartPos:null,isDragging:false,width:p*Xe,height:M*Xe,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:te,links:U}=useMemo(()=>_r(I),[I]),[Y,ge]=useState([]),$=useRef(null),T=useRef(null),ie=useRef(null),Te=scaleOrdinal(schemeCategory10),Ze=useCallback(()=>{if(!$.current)return false;try{let e=$.current.getContext("2d");return e?(ie.current=e,!0):(console.error("Failed to get 2D context"),!1)}catch(e){return console.error("Error initializing Canvas 2D context:",e),false}},[]),O=useCallback(()=>T.current?T.current.nodes():null,[]),ce=useCallback(()=>{if(!T.current)return null;let e=T.current.force("link");return e?e.links():null},[]),ft=useCallback(e=>{if(!j)return;e.save(),e.setTransform(1,0,0,1,0,0);let{width:n,height:r}=t.current,o=Q.gridSpacing,a=Q.dotSize;e.fillStyle=R.graph2D.grid.dotColor;for(let l=o/2;l<=n;l+=o)for(let i=o/2;i<=r;i+=o)e.beginPath(),e.arc(l,i,a,0,2*Math.PI),e.fill();e.restore();},[j,R.graph2D.grid.dotColor,Q.gridSpacing,Q.dotSize]),ur=useCallback((e,n,r)=>{if(!e)return "";if(r.measureText(e).width<=n)return e;let o="...",a=r.measureText(o).width,l=0,i=e.length;for(;l<i;){let d=l+i+1>>1;r.measureText(e.slice(0,d)).width+a<=n?l=d:i=d-1;}return l===0?o:e.slice(0,l)+o},[]),Ke=a(e=>{let r=Math.min(e,Q.maxZoom)/Q.maxZoom;return Math.max(Q.fontSize*r,Q.fontSize)},"calculateFontSize"),ht=useCallback(e=>{let n=ce(),r=O();!n||n.length===0||!r||r.length===0||(e.lineWidth=.5,e.globalAlpha=1,n.forEach(o=>{let a=typeof o.source=="object"?o.source:r.find(ee=>ee.id===o.source),l=typeof o.target=="object"?o.target:r.find(ee=>ee.id===o.target);if(!a||!l)return;let i={x:a.x||0,y:a.y||0},d={x:l.x||0,y:l.y||0},s=d.x-i.x,c=d.y-i.y,u=Math.sqrt(s*s+c*c),m=s/u,v=c/u,g=fe(a)/2,b=fe(l)/2,W=4,N={x:i.x+m*g,y:i.y+v*g},h={x:d.x-m*(b+W),y:d.y-v*(b+W)},L={x:d.x-m*(b+1),y:d.y-v*(b+1)},C=t.current.highlightLinks.has(o),y=C?R.graph2D.link.highlighted:o.color||R.graph2D.link.normal,x=on(o,C),F=i.x+(d.x-i.x)/2,_=i.y+(d.y-i.y)/2,Z=Math.atan2(c,s);if(o.label){let ee=t.current.transform.k,de=Ke(ee);e.font=`${de}px Sans-Serif`;let be=e.measureText(o.label).width,xe=10;e.beginPath(),e.moveTo(N.x,N.y);let ve=u/2-(be+xe)/2,me={x:i.x+m*ve,y:i.y+v*ve};e.lineTo(me.x,me.y),e.strokeStyle=y,e.lineWidth=x,e.stroke(),e.beginPath();let Pe=u/2+(be+xe)/2,Ne={x:i.x+m*Pe,y:i.y+v*Pe};e.moveTo(Ne.x,Ne.y),e.lineTo(h.x,h.y),e.strokeStyle=y,e.lineWidth=x,e.stroke();}else e.beginPath(),e.moveTo(N.x,N.y),e.lineTo(h.x,h.y),e.strokeStyle=y,e.lineWidth=x,e.stroke();let B=Math.max(2,x*2),J=Math.max(4,x*4);if(e.save(),e.translate(L.x,L.y),e.rotate(Z),e.beginPath(),e.moveTo(0,0),e.lineTo(-J,B),e.lineTo(-J,0),e.lineTo(-J,-B),e.closePath(),e.fillStyle=y,e.fill(),e.restore(),o.label){let ee=t.current.transform.k,de=Ke(ee);e.font=`${de}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(F,_),Math.abs(Z)>Math.PI/2?e.rotate(Z+Math.PI):e.rotate(Z),e.fillStyle=C?R.graph2D.link.highlightedTextColor:R.graph2D.link.textColor,e.fillText(o.label,0,0),e.restore();}}));},[Q,R.graph2D.link]),mt=a((e,n,r,o,a,l,i)=>{try{if(l!=null){let d=a*.8;e.font=`${d}px sans-serif`,e.textBaseline="middle",e.textAlign="left";let s=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(l),c=e.measureText(s).width,u=a*.3,v=(a+u+c)/2;e.drawImage(n,r-v,o-a/2,a,a),e.fillStyle=i||"#99989C",e.fillText(s,r-v+a+u,o);}else e.drawImage(n,r-a/2,o-a/2,a,a);}catch(d){console.warn("Error rendering icon:",d);}},"drawIconWithOptionalCounter"),pt=useCallback((e,n)=>{if(!Y||Y.length===0||!e||!e.x||!e.y)return;let{x:r,y:o}=e,a$1=fe(e),l=a$1*Q.nodeAreaFactor/2;n.save();let i=Math.min(Y.length,8),d=Math.min(Math.PI*2/i,Math.PI);for(let s=0;s<i;s++){let c=s*d,u=(s+1)*d,m$1=t.current.hoveredButtonIndex===s;n.beginPath(),n.arc(r,o,l,c,u,false),n.lineTo(r,o),n.closePath(),n.lineWidth=1,n.strokeStyle=R.graph2D?.button?.stroke||"#FFFFFF",n.stroke(),n.fillStyle=m$1?R.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":R.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",n.fill();let v=l*.2,g=(c+u)/2,b=l-a$1/2+v,W=r+Math.cos(g)*b,N=o+Math.sin(g)*b,h=Y[s],L=typeof h.loading=="function"?h.loading(e):h.loading,C=a(B=>typeof B=="function"?B(e):B,"getImageUrl"),y=C(h.img),x=C(h.hoverImg),F=a(B=>{if(!h.imageCache.has(B)){let J=new Image;J.src=B,h.imageCache.set(B,J);}return h.imageCache.get(B)},"getOrCreateImage"),_=F(y),Z=F(x);if(L){let B=v/2,J=v/12;n.save(),n.translate(W,N),n.rotate(t.current.spinnerAngle);for(let ee=0;ee<12;ee++){let de=Math.PI*2*ee/12,be=ee/12,xe=Math.cos(de)*B,ve=Math.sin(de)*B;n.beginPath(),n.fillStyle=m(R.graph2D?.button?.spinnerColor,be),n.arc(xe,ve,J,0,Math.PI*2),n.fill();}n.restore(),t.current.spinnerAngle+=.1,t.current.spinnerAngle>Math.PI*2&&(t.current.spinnerAngle-=Math.PI*2),t.current.animation.id!==null&&(cancelAnimationFrame(t.current.animation.id),t.current.animation.id=null,t.current.animation.buttonIndex=null),t.current.animation.id=requestAnimationFrame(D),t.current.animation.buttonIndex=s;}else {t.current.animation.id&&t.current.animation.buttonIndex===s&&(cancelAnimationFrame(t.current.animation.id),t.current.animation.id=null,t.current.animation.buttonIndex=null);let B=m$1?Z:_,J=h.getCount?h.getCount(e):null;B.complete?mt(n,B,W,N,v,J,R.graph2D?.button?.textColor):B.onload=()=>{ie.current&&mt(n,B,W,N,v,J,R.graph2D?.button?.textColor);};}}n.restore();},[Y,R.graph2D?.button]),gt=useCallback(e=>{if(!se||!K)return;let n=Number(R.tooltip.padding)||10,r=Number(R.tooltip.maxWidth)||200,o=Number(R.tooltip.fontSize)||14,a=Number(R.tooltip.borderRadius)||4,l=1.4,i=10;e.save(),e.font=`${o}px Sans-Serif`;let d=typeof se=="string"?se:String(se),s=Xt(e,d,r),c=Math.min(r,Math.max(...s.map(h=>e.measureText(h).width))),u=s.length*o*l,m=c+n*2,v=u+n*2,g=K.x-m/2,b=K.y-v-i,W=$.current?.getBoundingClientRect();W&&(g<5&&(g=5),g+m>W.width-5&&(g=W.width-m-5),b<5&&(b=K.y+i));let N=R.tooltip.shadow?.match(/(-?\d+(?:\.\d+)?(?:px)?)\s+(-?\d+(?:\.\d+)?(?:px)?)\s+(-?\d+(?:\.\d+)?(?:px)?)(?:\s+(-?\d+(?:\.\d+)?(?:px)?))?\s+(rgba?\([^)]+\)|#[0-9a-fA-F]{3,8}|\w+)/);N&&(e.shadowOffsetX=parseFloat(N[1]),e.shadowOffsetY=parseFloat(N[2]),e.shadowBlur=parseFloat(N[3]),e.shadowColor=N[5]),e.fillStyle=R.tooltip.background,e.beginPath(),e.roundRect(g,b,m,v,a),e.fill(),e.shadowColor="transparent",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0,e.fillStyle=R.tooltip.color,e.textAlign="left",e.textBaseline="top",s.forEach((h,L)=>{e.fillText(h,g+n,b+o/4+n+L*o*l);}),e.restore();},[se,K,R.tooltip]),yt=useCallback(e=>{let n=O();!n||n.length===0||(e.globalAlpha=1,n.forEach(r=>{let{x:o,y:a,color:l,fontColor:i,label:d}=r,s=r.id&&t.current.selectedNodeIds.has(r.id),c=r.id&&t.current.hoveredNode?.id===r.id,u=fe(r),m=u/2;if(c&&k&&k.length>0&&pt(r,e),s){let v=u/2+Q.nodeBorderWidth,g=u/2+Q.nodeBorderWidth/2;e.save(),e.shadowBlur=Q.nodeBorderWidth*10,e.shadowColor=R.graph2D.ring.selectionFill,e.beginPath(),e.arc(o,a,v,0,2*Math.PI,false),e.fillStyle=R.graph2D.ring.selectionFill,e.fill(),e.restore(),e.beginPath(),e.arc(o,a,g,0,2*Math.PI,false),e.fillStyle=R.graph2D.ring.borderFill,e.fill();}if(e.beginPath(),e.arc(o,a,m,0,2*Math.PI),e.fillStyle=l||Te(r.group||"0"),e.fill(),d){e.save(),e.translate(o,a);let v=t.current.transform.k,g=Ke(v),b=u*Q.textPaddingFactor;e.font=`${g}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle=i||"#000";let W=ur(d,b,e);e.fillText(W,0,0),e.restore();}}));},[R.graph2D.ring,k,pt]),D=useCallback(()=>{let e=ie.current;e&&(e.clearRect(0,0,t.current.width,t.current.height),ft(e),e.save(),e.setTransform(t.current.transform.k,0,0,t.current.transform.k,t.current.transform.x,t.current.transform.y),ht(e),yt(e),e.restore(),gt(e));},[ht,yt,ft,gt]),bt=useCallback((e,n=[],r,o)=>{let a=ce()||[],l=O()||[];if(!T.current||!e.length)return;let{width:i,height:d}=t.current,s=r?.smoothAppearance??false,c=r?.transitionDuration??1e3,u=new Set(l.map(h=>h.id)),m=e.filter(h=>!u.has(h.id)),v=new Set(a.map(h=>`${typeof h.source=="object"?h.source.id:h.source}-${typeof h.target=="object"?h.target.id:h.target}`)),g=n.filter(h=>{let L=`${typeof h.source=="object"?h.source.id:h.source}-${typeof h.target=="object"?h.target.id:h.target}`;return !v.has(L)});if(m.length===0&&g.length===0)return;let b=[...l,...m],W=[...a,...g];s&&(m.forEach(h=>{let L=g.filter(C=>{let y=typeof C.source=="object"?C.source.id:C.source,x=typeof C.target=="object"?C.target.id:C.target;return y===h.id&&u.has(x)||x===h.id&&u.has(y)});if(L.length>0){let C=L[0],y=typeof C.source=="object"?C.source.id===h.id?C.target:C.source.id:C.source===h.id?C.target:C.source,x=b.find(F=>F.id===y);if(x&&x.x!==void 0&&x.y!==void 0){let F=30+Math.random()*20,_=Math.random()*Math.PI*2;h.x=x.x+Math.cos(_)*F,h.y=x.y+Math.sin(_)*F,h.vx=0,h.vy=0;}}else {let C=i/2,y=d/2,x=Math.min(i,d)/4,F=Math.random()*Math.PI*2;h.x=C+Math.cos(F)*(x*Math.random()),h.y=y+Math.sin(F)*(x*Math.random()),h.vx=0,h.vy=0;}}),l.forEach(h=>{h.fx=h.x,h.fy=h.y;})),T.current.nodes(b);let N=T.current.force("link");N&&N.links(W),g.forEach(h=>{let L=typeof h.source=="object"?h.source:b.find(y=>y.id===h.source),C=typeof h.target=="object"?h.target:b.find(y=>y.id===h.target);!L||!C||(!L.neighbors&&(L.neighbors=[]),!C.neighbors&&(C.neighbors=[]),L.neighbors.push(C),C.neighbors.push(L),!L.links&&(L.links=[]),!C.links&&(C.links=[]),L.links.push(h),C.links.push(h));}),s?(T.current.alphaTarget(.3),T.current.alpha(.3),T.current.velocityDecay(.7),T.current.restart(),setTimeout(()=>{l.forEach(h=>{h.fx=void 0,h.fy=void 0;}),T.current?.alphaTarget(0),T.current?.alpha(.1),T.current?.velocityDecay(.6);},c)):T.current.alpha(.1).restart(),D(),o?.();},[te,D]),xt=useCallback(e=>{let n=O(),r=ce();if(!T.current||!e.length||!n||n.length===0||!r||r.length===0)return;let o=new Set(e);if(e.forEach(s=>t.current.selectedNodeIds.delete(s)),t.current.hoveredNode&&t.current.hoveredNode.id!==void 0&&o.has(t.current.hoveredNode.id)&&(t.current.hoveredNode=null,X(null),V(null)),t.current.hoveredLink){let s=typeof t.current.hoveredLink.source=="object"?t.current.hoveredLink.source.id:t.current.hoveredLink.source,c=typeof t.current.hoveredLink.target=="object"?t.current.hoveredLink.target.id:t.current.hoveredLink.target;(s!==void 0&&o.has(s)||c!==void 0&&o.has(c))&&(t.current.hoveredLink=null);}t.current.draggedNode&&t.current.draggedNode.id!==void 0&&o.has(t.current.draggedNode.id)&&(t.current.draggedNode=null);let a=n.filter(s=>s.id!==void 0&&!o.has(s.id)),l=r.filter(s=>{let c=typeof s.source=="object"?s.source.id:s.source,u=typeof s.target=="object"?s.target.id:s.target;return c!==void 0&&!o.has(c)&&u!==void 0&&!o.has(u)}),i=[];t.current.highlightLinks.forEach(s=>{let c=typeof s.source=="object"?s.source.id:s.source,u=typeof s.target=="object"?s.target.id:s.target;(c!==void 0&&o.has(c)||u!==void 0&&o.has(u))&&i.push(s);}),i.forEach(s=>t.current.highlightLinks.delete(s)),a.forEach(s=>{s.neighbors=[],s.links=[];}),l.forEach(s=>{let c=typeof s.source=="object"?s.source:a.find(m=>m.id===s.source),u=typeof s.target=="object"?s.target:a.find(m=>m.id===s.target);!c||!u||(c.neighbors=c.neighbors||[],u.neighbors=u.neighbors||[],c.neighbors.push(u),u.neighbors.push(c),c.links=c.links||[],u.links=u.links||[],c.links.push(s),u.links.push(s));}),T.current.nodes(a);let d=T.current.force("link");d&&d.links(l),H?.(t.current.selectedNodeIds),D();},[D,H]),ye=useCallback((e=0,n=20)=>{let r=O();if(!ie.current||!$.current||!r||!r.length)return;let a$1=1/0,l=1/0,i=-1/0,d=-1/0;if(r.forEach(s=>{if(s.x===void 0||s.y===void 0)return;let c=s.x,u=s.y;a$1=Math.min(a$1,c),l=Math.min(l,u),i=Math.max(i,c),d=Math.max(d,u);}),isFinite(a$1)&&isFinite(i)&&isFinite(l)&&isFinite(d)){let{width:s,height:c}=t.current;a$1-=n,l-=n,i+=n,d+=n;let u=i-a$1,m=d-l,v=u>0?s/u:1,g=m>0?c/m:1,b=Math.min(v,g,10),W=a$1+u/2,N=l+m/2,h={k:b,x:s/2-W*b,y:c/2-N*b};if(e>0){let L={...t.current.transform},C=Date.now(),y=a(()=>{let x=Math.min(1,(Date.now()-C)/e),F=x===1?1:1-Math.pow(1-x,3),_={k:L.k+(h.k-L.k)*F,x:L.x+(h.x-L.x)*F,y:L.y+(h.y-L.y)*F};t.current.transform=_,D(),x<1&&requestAnimationFrame(y);},"animateZoom");requestAnimationFrame(y);}else t.current.transform=h,D();}},[]),vt=useCallback((e=0,n=20)=>{let r=O(),o=ie.current,a$1=t.current.selectedNodeIds;if(!o||!$.current||!r||!r.length||a$1.size===0)return;let l=r.filter(u=>u.id&&a$1.has(u.id));if(l.length===0)return;let i=1/0,d=1/0,s=-1/0,c=-1/0;if(l.forEach(u=>{u.x===void 0||u.y===void 0||(i=Math.min(i,u.x),d=Math.min(d,u.y),s=Math.max(s,u.x),c=Math.max(c,u.y));}),i===s&&d===c&&(i-=100,d-=100,s+=100,c+=100),isFinite(i)&&isFinite(s)&&isFinite(d)&&isFinite(c)){let{width:u,height:m}=t.current;i-=n,d-=n,s+=n,c+=n;let v=s-i,g=c-d,b=v>0?u/v:1,W=g>0?m/g:1,N=Math.min(b,W,Q.maxZoom),h=i+v/2,L=d+g/2,C={k:N,x:u/2-h*N,y:m/2-L*N};if(e>0){let y={...t.current.transform},x=Date.now(),F=a(()=>{let _=Math.min(1,(Date.now()-x)/e),Z=_===1?1:1-Math.pow(1-_,3),B={k:y.k+(C.k-y.k)*Z,x:y.x+(C.x-y.x)*Z,y:y.y+(C.y-y.y)*Z};t.current.transform=B,D(),_<1&&requestAnimationFrame(F);},"animateZoom");requestAnimationFrame(F);}else t.current.transform=C,D();}},[O,D]),wt=useCallback((e,n=0,r=20)=>{let o=O();if(!ie.current||!$.current||!o||!o.length||!e||e.length===0)return;let l=new Set(e),i=o.filter(m=>m.id&&l.has(m.id));if(i.length===0)return;let d=1/0,s=1/0,c=-1/0,u=-1/0;if(i.forEach(m=>{m.x===void 0||m.y===void 0||(d=Math.min(d,m.x),s=Math.min(s,m.y),c=Math.max(c,m.x),u=Math.max(u,m.y));}),d===c&&s===u&&(d-=100,s-=100,c+=100,u+=100),isFinite(d)&&isFinite(c)&&isFinite(s)&&isFinite(u)){let{width:m,height:v}=t.current;d-=r,s-=r,c+=r,u+=r;let g=c-d,b=u-s,W=g>0?m/g:1,N=b>0?v/b:1,h=Math.min(W,N,Q.maxZoom),L=d+g/2,C=s+b/2,y={k:h,x:m/2-L*h,y:v/2-C*h};if(n>0){let x={...t.current.transform},F=Date.now(),_=a(()=>{let Z=Math.min(1,(Date.now()-F)/n),B=Z===1?1:1-Math.pow(1-Z,3),J={k:x.k+(y.k-x.k)*B,x:x.x+(y.x-x.x)*B,y:x.y+(y.y-x.y)*B};t.current.transform=J,D(),Z<1&&requestAnimationFrame(_);},"animateZoom");requestAnimationFrame(_);}else t.current.transform=y,D();}},[O,D]),Ce=useCallback(e=>{t.current.selectedNodeIds.clear(),t.current.highlightLinks.clear(),e.forEach(n=>t.current.selectedNodeIds.add(n)),H?.(t.current.selectedNodeIds),D();},[D,H]),St=useCallback((e,n)=>{let r=O();!r||r.length===0||(r.forEach(o=>{o.id&&e.includes(o.id)&&(o.size=n);}),T.current&&(T.current.force("collide",forceCollide().radius(o=>fe(o)).iterations(2).strength(1)),T.current.alpha(.2).restart()),D());},[O,D]),Mt=useCallback((e,n)=>{let r=O();!r||r.length===0||(r.forEach(o=>{o.id&&e.includes(o.id)&&(o.color=n);}),D());},[O,D]),Ct=useCallback((e,n)=>{let r=ce();!r||r.length===0||(r.forEach(o=>{o.id&&e.includes(o.id)&&(o.width=n);}),D());},[ce,D]),Pt=useCallback((e,n)=>{let r=ce();!r||r.length===0||(r.forEach(o=>{o.id&&e.includes(o.id)&&(o.color=n);}),D());},[ce,D]),Dt=useCallback((e,n)=>{let r=O(),o=ce();if(!r||!o||r.length===0||o.length===0)return 0;let a=r.find(c=>c.id===e),l=r.find(c=>c.id===n);if(!a||!l)return console.warn("Source or target node not found"),0;if(e===n)return Ce([e]),1;let i=new Map;o.forEach(c=>{let u=typeof c.source=="object"?c.source.id:c.source,m=typeof c.target=="object"?c.target.id:c.target;u===void 0||m===void 0||(i.has(u)||i.set(u,[]),i.has(m)||i.set(m,[]),i.get(u).push({nodeId:m,link:c}),i.get(m).push({nodeId:u,link:c}));});let d=[{nodeId:e,path:[e],links:[]}],s=new Set([e]);for(;d.length>0;){let c=d.shift();if(c.nodeId===n)return Ce(c.path),t.current.highlightLinks.clear(),c.links.forEach(m=>{t.current.highlightLinks.add(m);}),D(),c.path.length;(i.get(c.nodeId)||[]).forEach(({nodeId:m,link:v})=>{s.has(m)||(s.add(m),d.push({nodeId:m,path:[...c.path,m],links:[...c.links,v]}));});}return console.warn("No path found between nodes"),0},[O,ce,Ce,D]),Lt=useCallback((e,n)=>{let r=O();if(!r||r.length===0||e.size===0)return;let o=n?.spacing??100,a=r.filter(g=>g.id!==void 0&&e.has(g.id));if(a.length===0){console.warn("No nodes found with provided IDs");return}let l=n?.columns??Math.ceil(Math.sqrt(a.length)),i=a.reduce((g,b)=>g+(b.x??0),0)/a.length,d=a.reduce((g,b)=>g+(b.y??0),0)/a.length,s=Math.ceil(a.length/l),c=(l-1)*o,u=(s-1)*o,m=i-c/2,v=d-u/2;a.forEach((g,b)=>{let W=b%l,N=Math.floor(b/l),h=m+W*o,L=v+N*o;g.x=h,g.y=L,g.fx=h,g.fy=L;}),T.current&&T.current.alpha(.3).restart(),D();},[O,D]),Tt=useCallback((e,n)=>{let r=O();if(!r||r.length===0)return;let o=n?.spacing??100,a=n?.groupSpacing??200,l=n?.columns,i=new Map;r.forEach(y=>{let x=y[e],F;Array.isArray(x)?F=x.length>0?String(x[0]):"undefined":typeof x=="string"?F=x:F="undefined",i.has(F)||i.set(F,[]),i.get(F).push(y);});let d=i.size,s=Math.ceil(Math.sqrt(d)),c=r.reduce((y,x)=>y+(x.x??0),0)/r.length,u=r.reduce((y,x)=>y+(x.y??0),0)/r.length,m=0,v=[];i.forEach(y=>{let x=l??Math.ceil(Math.sqrt(y.length)),F=Math.ceil(y.length/x),_=(x-1)*o,Z=(F-1)*o;v.push({width:_,height:Z});});let g=Math.max(...v.map(y=>y.width),0),b=Math.max(...v.map(y=>y.height),0),W=Math.ceil(d/s),N=(s-1)*(g+a),h=(W-1)*(b+a),L=c-N/2,C=u-h/2;i.forEach((y,x)=>{if(y.length===0){m++;return}let F=m%s,_=Math.floor(m/s),Z=L+F*(g+a),B=C+_*(b+a),J=l??Math.ceil(Math.sqrt(y.length)),ee=Math.ceil(y.length/J),de=(J-1)*o,be=(ee-1)*o,xe=Z-de/2,ve=B-be/2;y.forEach((me,Pe)=>{let Ne=Pe%J,mr=Math.floor(Pe/J),Nt=xe+Ne*o,Ft=ve+mr*o;me.x=Nt,me.y=Ft,me.fx=Nt,me.fy=Ft;}),m++;}),T.current&&T.current.alpha(.3).restart(),D(),ye(300,50);},[O,D,ye]),Ee=useCallback((e,n)=>{let r=O();if(!r||r.length===0)return null;let o=typeof window<"u"&&window.devicePixelRatio||1,a=(e*o-t.current.transform.x)/t.current.transform.k,l=(n*o-t.current.transform.y)/t.current.transform.k;return r.find(i=>{let d=fe(i)/2,s=(i.x||0)-a,c=(i.y||0)-l;return Math.sqrt(s*s+c*c)<=d})||null},[]),ke=useCallback((e,n)=>{let r=ce(),o=O();if(!r||r.length===0||!o||o.length===0)return null;let a=typeof window<"u"&&window.devicePixelRatio||1,l=(e*a-t.current.transform.x)/t.current.transform.k,i=(n*a-t.current.transform.y)/t.current.transform.k,d=5;return r.find(s=>{let c=typeof s.source=="object"?s.source:o.find(ee=>ee.id===s.source),u=typeof s.target=="object"?s.target:o.find(ee=>ee.id===s.target);if(!c||!u)return false;let m=c.x||0,v=c.y||0,g=u.x||0,b=u.y||0,W=l-m,N=i-v,h=g-m,L=b-v,C=W*h+N*L,y=h*h+L*L;if(y===0)return false;let x=C/y;x=Math.max(0,Math.min(1,x));let F=m+x*h,_=v+x*L,Z=l-F,B=i-_;return Math.sqrt(Z*Z+B*B)<=d})||null},[]),Et=useCallback((e,n,r,o,a,l,i)=>{let d=e-r,s=n-o,c=Math.sqrt(d*d+s*s),u=Math.atan2(s,d);u<0&&(u+=2*Math.PI);let g=c>=a*.5&&c<=a*1,b=false;return l===Math.PI&&i===Math.PI*2?b=u>=Math.PI&&u<=Math.PI*2:l===0&&i===Math.PI?b=u>=0&&u<=Math.PI:b=l<=i&&u>=l&&u<=i||l>i&&(u>=l||u<=i),g&&b},[]),Ue=useCallback(e=>{e!==t.current.hoveredNode&&(t.current.hoveredNode=e,A&&A(e));},[A]),Ve=useCallback((e,n)=>{if(n===t.current.hoveredLink)return;let r=new Set,o=new Set;if(n){o.add(n);let a=O();if(a){let l=typeof n.source=="object"?n.source:a.find(d=>d.id===n.source),i=typeof n.target=="object"?n.target:a.find(d=>d.id===n.target);l&&r.add(l),i&&r.add(i);}}t.current.hoveredLink=n,G&&G(n,e);},[G,O]),kt=useCallback(e=>{q&&q(e);},[q]),It=useCallback((e,n)=>{n.id&&(e.ctrlKey||e.metaKey?(t.current.selectedNodeIds.has(n.id)?t.current.selectedNodeIds.delete(n.id):t.current.selectedNodeIds.add(n.id),t.current.highlightLinks.clear()):(t.current.selectedNodeIds.clear(),t.current.highlightLinks.clear(),t.current.selectedNodeIds.add(n.id)),H?.(t.current.selectedNodeIds),D()),S&&S(n);},[S,H,D]),Rt=useCallback(()=>{t.current.selectedNodeIds.clear(),t.current.highlightLinks.clear(),H?.(t.current.selectedNodeIds),D(),P&&P();},[P,H,D]),Je=useCallback(e=>{if(!$.current||!T.current)return;let n=$.current.getBoundingClientRect(),r=e.clientX-n.left,o=e.clientY-n.top;t.current.mouseStartPos={x:r,y:o},t.current.isDragging=false;let a=Ee(r,o);a?(t.current.draggedNode=a,a.fx=a.x,a.fy=a.y):(t.current.isPanning=true,t.current.lastMousePos={x:r,y:o});},[Ee]),Ie=useCallback((e,n)=>{let r=null;if($.current&&t.current&&Y.length>0&&t.current.hoveredNode){let a=fe(t.current.hoveredNode)*Q.nodeAreaFactor/2,l=$.current.getBoundingClientRect(),i=$.current.width/l.width,d=$.current.height/l.height,s=e*i,c=n*d,u=(s-t.current.transform.x)/t.current.transform.k,m=(c-t.current.transform.y)/t.current.transform.k,v=t.current.hoveredNode?.x||0,g=t.current.hoveredNode?.y||0,b=Math.min(Y.length,8),W=Math.min(Math.PI*2/b,Math.PI);for(let N=0;N<b;N++){let h=N*W,L=(N+1)*W;if(Et(u,m,v,g,a,h,L)){r=N;break}}}return r},[Y]),Qe=useCallback(e=>{if(!$.current)return;let n=$.current.getBoundingClientRect(),r=e.clientX-n.left,o=e.clientY-n.top;if(t.current.draggedNode&&t.current.mouseStartPos&&T.current){let i=t.current.mouseStartPos.x,d=t.current.mouseStartPos.y,s=r-i,c=o-d;Math.sqrt(s*s+c*c)>3&&(t.current.isDragging=true,T.current.alphaTarget()===0&&T.current.alphaTarget(0).restart());let v=typeof window<"u"&&window.devicePixelRatio||1,g=(r*v-t.current.transform.x)/t.current.transform.k,b=(o*v-t.current.transform.y)/t.current.transform.k;t.current.draggedNode.fx=g,t.current.draggedNode.fy=b;return}if(t.current.isPanning&&t.current.mouseStartPos){let i=r-t.current.lastMousePos.x,d=o-t.current.lastMousePos.y,s=t.current.mouseStartPos.x,c=t.current.mouseStartPos.y;Math.sqrt(Math.pow(r-s,2)+Math.pow(o-c,2))>3&&(t.current.isDragging=true),t.current.transform={...t.current.transform,x:t.current.transform.x+i,y:t.current.transform.y+d},t.current.lastMousePos={x:r,y:o},D();return}let a,l;if(t.current.hoveredNode&&$.current&&Y.length>0){let i=Ie(r,o);if(i!==null&&(l=t.current.hoveredNode),i!==null&&t.current.hoveredButtonIndex===i&&V({x:r,y:o}),i!==t.current.hoveredButtonIndex){if(a=true,i!==null){let d=Y[i];if(d?.tooltip){let s=typeof d.tooltip=="function"?d.tooltip(t.current.hoveredNode):d.tooltip;X(s),V({x:r,y:o});}else X(null),V(null);}else X(null),V(null);t.current.hoveredButtonIndex=i;}}else t.current.hoveredButtonIndex!==null&&(t.current.hoveredButtonIndex=null,X(null),V(null));if(!l&&(l=Ee(r,o),!l)){let i=ke(r,o),d=i!==t.current.hoveredLink;if(i&&t.current.hoveredNode&&Ue(null),Ve(e,i),$.current&&($.current.style.cursor=i?"pointer":"default"),d){D();return}}l&&t.current.hoveredLink&&Ve(e,null),l!==t.current.hoveredNode&&(a=true),Ue(l),$.current&&($.current.style.cursor=l?"pointer":"default"),a&&D();},[Y,Ee,ke,Ue,Ve,D,Et,Ie]),dr=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.stopPropagation(),e.preventDefault()),t.current.mustBeStoppedPropagation=false;},[]),Re=useCallback(e=>{let n=t.current.isDragging;if(n&&(t.current.mustBeStoppedPropagation=true),!n&&t.current.mouseStartPos){let r=$.current?.getBoundingClientRect();if(r){let o=e.clientX-r.left,a=e.clientY-r.top;if(Y.length>0&&t.current.hoveredButtonIndex===null){let i=Ie(o,a);t.current.hoveredButtonIndex=i;}let l=false;if(t.current.hoveredNode&&t.current.hoveredButtonIndex!==null&&k[t.current.hoveredButtonIndex]){let i=k[t.current.hoveredButtonIndex];i&&i.onClick&&(i.onClick(t.current.hoveredNode),l=true,t.current.hoveredButtonIndex=null);}if(!l&&t.current.draggedNode)It(e,t.current.draggedNode);else if(!l&&!t.current.draggedNode){let i=ke(o,a);i?kt(i):Rt();}}}if(t.current.draggedNode&&T.current){if(n){T.current.alphaTarget(0);let r=.05,o=.04,a=.6;T.current.alpha(r).alphaDecay(o),T.current.velocityDecay(a);}else T.current.alphaTarget(0);t.current.draggedNode.fx=void 0,t.current.draggedNode.fy=void 0,t.current.draggedNode=null;}t.current.isDragging=false,t.current.mouseStartPos=null,t.current.isPanning&&(t.current.isPanning=false),D();},[k,D,It,Rt,ke,kt,Ie,Y]),et=useCallback(e=>{if(e.stopPropagation(),e.preventDefault(),!$.current)return;let n=$.current.getBoundingClientRect(),r=e.clientX-n.left,o=e.clientY-n.top,l=-e.deltaY>0?1.1:1/1.1,i=t.current.transform,d=i.k*l;if(d<.01||d>10)return;let s=i.k*l,c=r-(r-i.x)*l,u=o-(o-i.y)*l;t.current.transform={k:s,x:c,y:u},D();},[D]),tt=a((e,n)=>{let r=e.touches[0];if(r){let o={clientX:r.clientX,clientY:r.clientY};n(o);}},"convertTouchToMouseEvent"),fr=useCallback(e=>{tt(e,Je);},[Je]),rt=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.preventDefault(),e.stopPropagation()),t.current.mustBeStoppedPropagation=false,tt(e,Re);},[Re]),hr=useCallback(e=>{tt(e,Qe);},[Qe]);return useImperativeHandle(re,()=>({zoomToFit:ye,zoomToSelected:vt,zoomToNodes:wt,addNodes:bt,removeNodes:xt,setSelectedNodes:Ce,setNodeSizes:St,setNodeColors:Mt,setLinkWidths:Ct,setLinkColors:Pt,findShortestPath:Dt,arrangeSelectedInGrid:Lt,arrangeNodesByTypeInGrid:Tt}),[ye,vt,wt,bt,xt,Ce,St,Mt,Ct,Pt,Dt,Lt,Tt]),useEffect(()=>{let e=$.current,{width:n,height:r}=t.current;if(!e)return;Ze(),le(true);let o=n/2,a=r/2,l=Q.nodeSizeBase,d=l*2.5;T.current&&T.current.stop();let s=T.current=forceSimulation(te).force("link",forceLink(U).id(c=>c.id).distance(d).strength(.9)).force("charge",forceManyBody().strength(-l/10*200).theta(.5).distanceMin(l*2)).force("x",forceX().strength(.03)).force("y",forceY().strength(.03)).force("center",forceCenter(o,a).strength(.05)).force("collide",forceCollide().radius(c=>fe(c)).iterations(2).strength(1)).velocityDecay(.6);return ()=>{s.stop();}},[te,U]),useLayoutEffect(()=>{let e=$.current;e&&(t.current.width=p*Xe,t.current.height=M*Xe,e.width=t.current.width,e.height=t.current.height);},[p,M]),useEffect(()=>{if(T.current){let e=T.current;e.on("tick",()=>{D();}),e.on("end",()=>{ne&&(ye(0,20),setTimeout(()=>{le(false);},200));});}ne||D();},[te,U,ne,D,ye]),useEffect(()=>{!te||!U||U.forEach(e=>{let n=typeof e.source=="object"?e.source:te.find(o=>o.id===e.source),r=typeof e.target=="object"?e.target:te.find(o=>o.id===e.target);!n||!r||(!n.neighbors&&(n.neighbors=[]),!r.neighbors&&(r.neighbors=[]),n.neighbors.push(r),r.neighbors.push(n),!n.links&&(n.links=[]),!r.links&&(r.links=[]),n.links.push(e),r.links.push(e));});},[te,U]),useEffect(()=>{k&&k.length>0&&ge(nn(k));},[k]),useEffect(()=>{let e=$.current;if(!(!e||typeof window>"u"))return e.addEventListener("wheel",et,{passive:false}),e.addEventListener("touchend",rt,{passive:false}),()=>{e.removeEventListener("wheel",et),e.removeEventListener("touchend",rt);}},[et,rt]),jsx(cn,{children:jsxs(an,{children:[(f||ne)&&jsx(Ht,{width:p,height:M}),jsx(ln,{ref:$,style:{width:p,height:M,display:f||ne?"none":"block"},onMouseDown:Je,onMouseMove:Qe,onMouseUp:Re,onMouseLeave:Re,onClick:dr,onTouchStart:fr,onTouchMove:hr})]})})}),cn=styled.div`
84
84
  display: flex;
85
85
  align-items: center;
86
86
  justify-content: center;
@@ -88,16 +88,16 @@ import {a,x,y,v,d,m,A,D,nb,pa,Wa}from'./chunk-XY4L4GM2.mjs';export{rb as Alert,B
88
88
  min-width: 0;
89
89
  `,an=styled.div`
90
90
  position: relative;
91
- `,ln=styled.canvas``;sn.displayName="Graph2D";var Ic=x(({isActive:d,position:p,top:M=0,left:I=0,right:k,bottom:j,offset:S,...P})=>jsxs(Fragment$1,{children:[d&&S&&jsx(dn,{$position:p,$top:M,$left:I,$right:k,$bottom:j,$offset:S}),jsx(fn,{$isActive:d,$position:p,$top:M,$left:I,$right:k,$bottom:j,...P})]})),dn=pe.div(({$top:d$1,$left:p,$right:M,$bottom:I,$position:k,$offset:j,theme:S})=>{let P=j.top??0,A=j.left??0,G=j.right??0,q=j.bottom??0;return `
91
+ `,ln=styled.canvas``;sn.displayName="Graph2D";var Ic=x(({isActive:f,position:p,top:M=0,left:I=0,right:k,bottom:j,offset:S,...P})=>jsxs(Fragment$1,{children:[f&&S&&jsx(dn,{$position:p,$top:M,$left:I,$right:k,$bottom:j,$offset:S}),jsx(fn,{$isActive:f,$position:p,$top:M,$left:I,$right:k,$bottom:j,...P})]})),dn=pe.div(({$top:f,$left:p,$right:M,$bottom:I,$position:k,$offset:j,theme:S})=>{let P=j.top??0,A=j.left??0,G=j.right??0,q=j.bottom??0;return `
92
92
  position: ${k};
93
93
  z-index: 999;
94
94
  background-color: ${S.colors.backgroundBase};
95
- ${typeof d$1=="number"?`top: ${d(d$1-P,S.baseSize)};`:""}
95
+ ${typeof f=="number"?`top: ${d(f-P,S.baseSize)};`:""}
96
96
  ${typeof p=="number"?`left: ${d(p-A,S.baseSize)};`:""}
97
97
  ${typeof M=="number"?`right: ${d(M-G,S.baseSize)};`:""}
98
98
  ${typeof I=="number"?`bottom: ${d(I-q,S.baseSize)};`:""}
99
- `}),fn=pe.div(({$isActive:d$1,$top:p,$left:M,$right:I,$bottom:k,$position:j,theme:S})=>`
100
- ${d$1?`
99
+ `}),fn=pe.div(({$isActive:f,$top:p,$left:M,$right:I,$bottom:k,$position:j,theme:S})=>`
100
+ ${f?`
101
101
  position: ${j};
102
102
  z-index: 1000;
103
103
  ${typeof p=="number"?`top: ${d(p,S.baseSize)};`:""}
@@ -107,24 +107,24 @@ ${d$1?`
107
107
  `:""}
108
108
 
109
109
  min-width: 0;
110
- `);var Zt=a(({url:d})=>{let[p,M]=useState(1),[I,k]=useState(),j=qt.useRef(null),S=qt.useRef(null);return jsxs(pn,{ref:S,children:[jsxs(gn,{children:[jsx(A,{variant:"outlined","aria-label":"zoom-out",color:"secondary",size:"small",icon:jsx(D,{style:{width:20,height:20}}),onClick:()=>M(P=>Math.max(P-.25,.25)),disabled:p<=.25,p:5}),jsxs(nb,{py:5,px:8,children:[p*100,"%"]}),jsx(A,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(pa,{style:{width:14,height:14}}),onClick:()=>M(P=>Math.min(P+.25,4)),disabled:p>=4,p:8})]}),jsx(yn,{children:jsx("img",{src:d,ref:j,alt:"image",style:{display:"block",width:"auto",maxWidth:"none",objectFit:"contain",transition:"all 0.2s ease-in-out",marginInline:"auto",marginBlock:10,flexShrink:0,...I==="width"&&{width:`calc(${p*100}% - 20px)`},...I==="height"&&{height:`calc(${p*100}% - 20px)`}},onLoad:()=>{if(j.current&&S.current){let{width:P,height:A}=j.current;k(P<A?"height":"width");}}})})]})},"ImageDriver"),pn=pe.div`
110
+ `);var Zt=a(({url:f})=>{let[p,M]=useState(1),[I,k]=useState(),j=qt.useRef(null),S=qt.useRef(null);return jsxs(pn,{ref:S,children:[jsxs(gn,{children:[jsx(A,{variant:"outlined","aria-label":"zoom-out",color:"secondary",size:"small",icon:jsx(D,{style:{width:20,height:20}}),onClick:()=>M(P=>Math.max(P-.25,.25)),disabled:p<=.25,p:5}),jsxs(nb,{py:5,px:8,children:[p*100,"%"]}),jsx(A,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(pa,{style:{width:14,height:14}}),onClick:()=>M(P=>Math.min(P+.25,4)),disabled:p>=4,p:8})]}),jsx(yn,{children:jsx("img",{src:f,ref:j,alt:"image",style:{display:"block",width:"auto",maxWidth:"none",objectFit:"contain",transition:"all 0.2s ease-in-out",marginInline:"auto",marginBlock:10,flexShrink:0,...I==="width"&&{width:`calc(${p*100}% - 20px)`},...I==="height"&&{height:`calc(${p*100}% - 20px)`}},onLoad:()=>{if(j.current&&S.current){let{width:P,height:A}=j.current;k(P<A?"height":"width");}}})})]})},"ImageDriver"),pn=pe.div`
111
111
  height: 100%;
112
112
  width: 100%;
113
113
  display: flex;
114
114
  flex-direction: column;
115
- `,gn=pe.div(({theme:d})=>`
115
+ `,gn=pe.div(({theme:f})=>`
116
116
  display: flex;
117
117
  justify-content: center;
118
118
  align-items: stretch;
119
119
  padding: 22px;
120
120
  gap: 4px;
121
- border-bottom: 1px solid ${d.colors.stroke.light};
121
+ border-bottom: 1px solid ${f.colors.stroke.light};
122
122
  position: relative;
123
123
  `),yn=pe.div`
124
124
  height: 100%;
125
125
  width: 100%;
126
126
  overflow: auto;
127
- `;var Ut=a(({url:d})=>jsx(xn,{children:jsx("audio",{controls:true,src:d,style:{width:"100%"}})}),"AudioDriver"),xn=pe.div`
127
+ `;var Ut=a(({url:f})=>jsx(xn,{children:jsx("audio",{controls:true,src:f,style:{width:"100%"}})}),"AudioDriver"),xn=pe.div`
128
128
  display: flex;
129
129
  flex-direction: column;
130
130
  justify-content: center;
@@ -132,33 +132,33 @@ ${d$1?`
132
132
  width: 100%;
133
133
  height: 100%;
134
134
  padding: 22px;
135
- `;var ct=a(({url:d})=>{let[p,M]=useState(null),[I,k]=useState(false),[j,S]=useState(true),[P,A]=useState(null);useEffect(()=>{k(true);},[]),useEffect(()=>{if(!I)return;a(async()=>{try{let H=await import('./PdfDriver-V2KCAAOW.mjs');M(()=>H.PdfDriver),S(!1);}catch(H){console.error("Failed to load PDF driver:",H),A("Failed to load PDF viewer"),S(false);}},"load")();},[I]);let G=jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",width:"100%"},children:jsx("span",{style:{color:"#6b7280"},children:"Loading PDF viewer..."})});return !I||j?G:P||!p?jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",width:"100%"},children:jsx("span",{style:{color:"#ef4444"},children:P||"PDF viewer unavailable"})}):jsx(p,{url:d})},"PdfDriverWrapper");var Qt=50,Mn=1e4,er=a(({url:d,blob:p})=>{let M=useRef(null),I=useRef(null),[k,j]=useState(null),[S,P]=useState(true),[A$1,G]=useState(1),q=useRef(false),[H,re]=useState({width:0,height:0}),R=useRef(0),ne=a(()=>{q.current=true,G(K=>Math.min(K+.25,4));},"handleZoomIn"),le=a(()=>{q.current=true,G(K=>Math.max(K-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(I.current)try{P(!0),j(null);let V=p;if(!V&&d&&(V=await(await fetch(d)).blob()),!V){j("No DOCX file provided");return}if(V.size/(1024*1024)>Qt){j(`File too large (> ${Qt} MB)`);return}I.current.innerHTML="";let X=renderAsync(V,I.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),t=new Promise((U,Y)=>setTimeout(()=>Y(new Error("DOCX render timed out")),Mn));await Promise.race([X,t]),await new Promise(U=>requestAnimationFrame(U));let te=I.current.querySelector(".docx-wrapper");if(te&&(R.current=te.offsetWidth,re({width:te.offsetWidth,height:te.offsetHeight})),M.current&&R.current>0){let U=Math.min(M.current.clientWidth/R.current,1);G(U);}P(!1);}catch(V){j(V?.message||"Failed to open DOCX file"),P(false);}},"renderDocument")();},[d,p]),useEffect(()=>{if(!M.current)return;let K=Sn(se=>{if(!(q.current||R.current===0))for(let X of se){let t=Math.min(X.contentRect.width/R.current,1);G(t);}},150),V=new ResizeObserver(K);return V.observe(M.current),()=>{V.disconnect(),K.cancel();}},[]),jsxs(Cn,{children:[jsxs(Pn,{children:[jsx(A,{variant:"outlined","aria-label":"zoom-out",color:"secondary",size:"small",icon:jsx(D,{style:{width:20,height:20}}),onClick:le,disabled:A$1<=.25,p:5}),jsxs(nb,{py:5,px:8,children:[Math.round(A$1*100),"%"]}),jsx(A,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(pa,{style:{width:14,height:14}}),onClick:ne,disabled:A$1>=4,p:8})]}),!!k&&!S&&jsx(Dn,{children:k}),S&&jsx(Ln,{children:"Loading..."}),jsx(En,{ref:M,children:jsx(Tn,{style:{width:H.width>0?H.width*A$1:void 0,height:H.height>0?H.height*A$1:void 0},children:jsx(kn,{ref:I,style:{transform:`scale(${A$1})`,transformOrigin:"top left"}})})})]})},"DocxDriver"),Cn=pe.div`
135
+ `;var ct=a(({url:f})=>{let[p,M]=useState(null),[I,k]=useState(false),[j,S]=useState(true),[P,A]=useState(null);useEffect(()=>{k(true);},[]),useEffect(()=>{if(!I)return;a(async()=>{try{let H=await import('./PdfDriver-V2KCAAOW.mjs');M(()=>H.PdfDriver),S(!1);}catch(H){console.error("Failed to load PDF driver:",H),A("Failed to load PDF viewer"),S(false);}},"load")();},[I]);let G=jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",width:"100%"},children:jsx("span",{style:{color:"#6b7280"},children:"Loading PDF viewer..."})});return !I||j?G:P||!p?jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",width:"100%"},children:jsx("span",{style:{color:"#ef4444"},children:P||"PDF viewer unavailable"})}):jsx(p,{url:f})},"PdfDriverWrapper");var Qt=50,Mn=1e4,er=a(({url:f,blob:p})=>{let M=useRef(null),I=useRef(null),[k,j]=useState(null),[S,P]=useState(true),[A$1,G]=useState(1),q=useRef(false),[H,re]=useState({width:0,height:0}),R=useRef(0),ne=a(()=>{q.current=true,G(K=>Math.min(K+.25,4));},"handleZoomIn"),le=a(()=>{q.current=true,G(K=>Math.max(K-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(I.current)try{P(!0),j(null);let V=p;if(!V&&f&&(V=await(await fetch(f)).blob()),!V){j("No DOCX file provided");return}if(V.size/(1024*1024)>Qt){j(`File too large (> ${Qt} MB)`);return}I.current.innerHTML="";let X=renderAsync(V,I.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),t=new Promise((U,Y)=>setTimeout(()=>Y(new Error("DOCX render timed out")),Mn));await Promise.race([X,t]),await new Promise(U=>requestAnimationFrame(U));let te=I.current.querySelector(".docx-wrapper");if(te&&(R.current=te.offsetWidth,re({width:te.offsetWidth,height:te.offsetHeight})),M.current&&R.current>0){let U=Math.min(M.current.clientWidth/R.current,1);G(U);}P(!1);}catch(V){j(V?.message||"Failed to open DOCX file"),P(false);}},"renderDocument")();},[f,p]),useEffect(()=>{if(!M.current)return;let K=Sn(se=>{if(!(q.current||R.current===0))for(let X of se){let t=Math.min(X.contentRect.width/R.current,1);G(t);}},150),V=new ResizeObserver(K);return V.observe(M.current),()=>{V.disconnect(),K.cancel();}},[]),jsxs(Cn,{children:[jsxs(Pn,{children:[jsx(A,{variant:"outlined","aria-label":"zoom-out",color:"secondary",size:"small",icon:jsx(D,{style:{width:20,height:20}}),onClick:le,disabled:A$1<=.25,p:5}),jsxs(nb,{py:5,px:8,children:[Math.round(A$1*100),"%"]}),jsx(A,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(pa,{style:{width:14,height:14}}),onClick:ne,disabled:A$1>=4,p:8})]}),!!k&&!S&&jsx(Dn,{children:k}),S&&jsx(Ln,{children:"Loading..."}),jsx(Tn,{ref:M,children:jsx(En,{style:{width:H.width>0?H.width*A$1:void 0,height:H.height>0?H.height*A$1:void 0},children:jsx(kn,{ref:I,style:{transform:`scale(${A$1})`,transformOrigin:"top left"}})})})]})},"DocxDriver"),Cn=pe.div`
136
136
  height: 100%;
137
137
  width: 100%;
138
138
  display: flex;
139
139
  flex-direction: column;
140
- `,Pn=pe.div(({theme:d})=>`
140
+ `,Pn=pe.div(({theme:f})=>`
141
141
  display: flex;
142
142
  justify-content: center;
143
143
  align-items: stretch;
144
144
  padding: 22px;
145
145
  gap: 4px;
146
- border-bottom: 1px solid ${d.colors.stroke.light};
147
- `),Dn=pe.div(({theme:d})=>`
148
- color: ${d.colors.error};
146
+ border-bottom: 1px solid ${f.colors.stroke.light};
147
+ `),Dn=pe.div(({theme:f})=>`
148
+ color: ${f.colors.error};
149
149
  padding: 20px;
150
- `),Ln=pe.div(({theme:d})=>`
150
+ `),Ln=pe.div(({theme:f})=>`
151
151
  display: flex;
152
152
  align-items: center;
153
153
  justify-content: center;
154
154
  padding: 20px;
155
- color: ${d.colors.text.light};
156
- `),En=pe.div(({theme:d})=>`
155
+ color: ${f.colors.text.light};
156
+ `),Tn=pe.div(({theme:f})=>`
157
157
  width: 100%;
158
158
  height: 100%;
159
159
  overflow: auto;
160
- background-color: ${d.colors.stroke.main};
161
- `),Tn=pe.div`
160
+ background-color: ${f.colors.stroke.main};
161
+ `),En=pe.div`
162
162
  overflow: hidden;
163
163
  margin: 0 auto;
164
164
  `,kn=pe.div`
@@ -191,22 +191,22 @@ ${d$1?`
191
191
  max-width: 100% !important;
192
192
  height: auto !important;
193
193
  }
194
- `;keyframes`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`;var Xn=a(d=>({js:[javascript({jsx:false})],jsx:[javascript({jsx:true})],ts:[javascript({typescript:true,jsx:false})],tsx:[javascript({typescript:true,jsx:true})],json:[json()],html:[html()],css:[css()],scss:[css()],py:[python()],java:[java()],cpp:[cpp()],c:[cpp()],php:[php()],rs:[rust()],xml:[xml()],yaml:[yaml()],yml:[yaml()],md:[markdown()],sql:[sql()],sh:[markdown()],bash:[markdown()]})[d]||[],"getLanguageExtension"),sr=a(({url:d,extension:p})=>{let[M,I]=useState(""),[k,j]=useState(true),[S,P]=useState(null),[A,G]=useState(0),q=useRef(null);return useEffect(()=>{a(async()=>{try{j(!0),P(null);let re=await fetch(d);if(!re.ok)throw new Error(`Failed to load file: ${re.statusText}`);I(await re.text());}catch(re){P(re instanceof Error?re.message:"Failed to load text content");}finally{j(false);}},"load")();},[d]),useEffect(()=>{let H=a(()=>{q.current&&G(q.current.clientHeight);},"update");return H(),window.addEventListener("resize",H),()=>window.removeEventListener("resize",H)},[k]),k?jsx(Yn,{children:"Loading text content..."}):S?jsxs(Gn,{children:["Error: ",S]}):jsx(On,{ref:q,children:A>0&&jsx(Rn,{value:M,theme:vscodeDark,extensions:Xn(p),editable:false,height:`${A}px`,basicSetup:{lineNumbers:true,highlightActiveLineGutter:false,highlightActiveLine:false,foldGutter:true,dropCursor:false,indentOnInput:false,syntaxHighlighting:true,bracketMatching:true,closeBrackets:false,autocompletion:false,rectangularSelection:false,crosshairCursor:false,highlightSelectionMatches:false,closeBracketsKeymap:false,searchKeymap:false,foldKeymap:true,completionKeymap:false,lintKeymap:false}})})},"TextDriver"),On=pe.div`
194
+ `;keyframes`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`;var Xn=a(f=>({js:[javascript({jsx:false})],jsx:[javascript({jsx:true})],ts:[javascript({typescript:true,jsx:false})],tsx:[javascript({typescript:true,jsx:true})],json:[json()],html:[html()],css:[css()],scss:[css()],py:[python()],java:[java()],cpp:[cpp()],c:[cpp()],php:[php()],rs:[rust()],xml:[xml()],yaml:[yaml()],yml:[yaml()],md:[markdown()],sql:[sql()],sh:[markdown()],bash:[markdown()]})[f]||[],"getLanguageExtension"),sr=a(({url:f,extension:p})=>{let[M,I]=useState(""),[k,j]=useState(true),[S,P]=useState(null),[A,G]=useState(0),q=useRef(null);return useEffect(()=>{a(async()=>{try{j(!0),P(null);let re=await fetch(f);if(!re.ok)throw new Error(`Failed to load file: ${re.statusText}`);I(await re.text());}catch(re){P(re instanceof Error?re.message:"Failed to load text content");}finally{j(false);}},"load")();},[f]),useEffect(()=>{let H=a(()=>{q.current&&G(q.current.clientHeight);},"update");return H(),window.addEventListener("resize",H),()=>window.removeEventListener("resize",H)},[k]),k?jsx(Yn,{children:"Loading text content..."}):S?jsxs(Gn,{children:["Error: ",S]}):jsx(On,{ref:q,children:A>0&&jsx(Rn,{value:M,theme:vscodeDark,extensions:Xn(p),editable:false,height:`${A}px`,basicSetup:{lineNumbers:true,highlightActiveLineGutter:false,highlightActiveLine:false,foldGutter:true,dropCursor:false,indentOnInput:false,syntaxHighlighting:true,bracketMatching:true,closeBrackets:false,autocompletion:false,rectangularSelection:false,crosshairCursor:false,highlightSelectionMatches:false,closeBracketsKeymap:false,searchKeymap:false,foldKeymap:true,completionKeymap:false,lintKeymap:false}})})},"TextDriver"),On=pe.div`
195
195
  height: 100%;
196
196
  width: 100%;
197
- `,Yn=pe.div(({theme:d})=>`
197
+ `,Yn=pe.div(({theme:f})=>`
198
198
  display: flex;
199
199
  align-items: center;
200
200
  justify-content: center;
201
201
  padding: 32px;
202
- color: ${d.colors.text.light};
203
- `),Gn=pe.div(({theme:d})=>`
202
+ color: ${f.colors.text.light};
203
+ `),Gn=pe.div(({theme:f})=>`
204
204
  display: flex;
205
205
  align-items: center;
206
206
  justify-content: center;
207
207
  padding: 32px;
208
- color: ${d.colors.error};
209
- `);var cr=a(({url:d})=>jsx(Zn,{children:jsx("video",{controls:true,src:d,style:{width:"100%",maxHeight:"100%"}})}),"VideoDriver"),Zn=pe.div`
208
+ color: ${f.colors.error};
209
+ `);var cr=a(({url:f})=>jsx(Zn,{children:jsx("video",{controls:true,src:f,style:{width:"100%",maxHeight:"100%"}})}),"VideoDriver"),Zn=pe.div`
210
210
  display: flex;
211
211
  flex-direction: column;
212
212
  justify-content: center;
@@ -220,8 +220,8 @@ ${d$1?`
220
220
  justify-content: center;
221
221
  align-items: center;
222
222
  padding: 20px;
223
- `;var Ka=a(d=>jsx(Qn,{children:jsx(ar,{...d})}),"FileViewer"),Qn=pe.div`
223
+ `;var Ka=a(f=>jsx(Qn,{children:jsx(ar,{...f})}),"FileViewer"),Qn=pe.div`
224
224
  height: 100%;
225
225
  width: 100%;
226
- `;export{Yi as Container,Ka as FileViewer,Ic as FullscreenCard,sn as Graph2D,Ei as PageContent,Mi as PageLayout,Vi as SplitterLayout,Mr as Styled,yr as StyledContainer,vr as StyledMain,Ni as SubNav};//# sourceMappingURL=index.mjs.map
226
+ `;export{Yi as Container,Ka as FileViewer,Ic as FullscreenCard,sn as Graph2D,Ti as PageContent,Mi as PageLayout,Vi as SplitterLayout,Mr as Styled,yr as StyledContainer,vr as StyledMain,Ni as SubNav};//# sourceMappingURL=index.mjs.map
227
227
  //# sourceMappingURL=index.mjs.map