@cyber-harbour/ui 2.0.46 → 2.0.47

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,w,x,u,c,l,z,Pa,mb,ma,Wa,yb,y,ib,G,gb,H}from'./chunk-UEDRXYVT.mjs';export{qb as Alert,A as AlertIcon,za as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ia as BallsMenu,mb as Box,q as BreakpointProvider,E as BugReportIcon,Na as BurgerMenuIcon,sa as BusIcon,z as Button,F as CalendarIcon,ta as CarIcon,Gb as ChatField,ja as CheckIcon,sb as Checkbox,ka as ChevronDownIcon,G as ChevronLeftIcon,H as ChevronRightIcon,la as ChevronUpIcon,Oa as ClockIcon,I as CloseCircleIcon,J as ClosedLockIcon,zb as ContentLoader,db as ContextMenu,eb as ContextMenuDelimiter,qa as CrossIcon,K as DataSetsIcon,L as DeepSearchIcon,M as DisabledVisibleIcon,N as DocsIcon,O as DownloadIcon,vb as Drawer,xb as DrawerBody,wb as DrawerHeader,P as EditUserIcon,ob as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,jb as FileField,xa as FileIcon,S as FiltersIcon,Ia as FlashIcon,kb as FlexContainer,lb as FlexItem,Ba as FolderAlertIcon,Ja as FolderInfoIcon,_a as Header,$a as HeaderDelimeter,ab as HeaderSection,T as HomepageIcon,Qa as ImageIcon,oa as InfoCircleFilledIcon,U as InfoCircleIcon,ib as Input,ya as IosIcon,rb as Label,nb as Line,tb as LinerProgress,Xa as ListMenu,Ya as ListMenuItem,Za as ListMenuSection,V as MapRadarIcon,ra as MaximizeIcon,Aa as MicrosoftIcon,Pa as MinusIcon,Bb as Modal,Db as ModalBody,Eb as ModalFooter,Cb as ModalHeader,W as MoonIcon,X as OpenLockIcon,Y as OrganizationIcon,Ab as Overlay,cb as Pagination,Ea as PassportIcon,Z as PasswordFinderIcon,Ga as PencilIcon,_ as PhonebookIcon,va as PlaneIcon,ma as PlusIcon,Fa as PointIcon,$ as PrintIcon,aa as Profiler2Icon,ba as ProfilerIcon,Hb as ProgressLoader,Ca as RelationIcon,Da as RelationPointsIcon,Ka as RotateLeftIcon,La as RotateRightIcon,hb as RowActionsMenu,ca as SandBoxIcon,da as SearchIcon,gb as Select,wa as ShipIcon,Sa as Sidebar,Ra as SidebarContext,Ua as SidebarDelimeter,Ta as SidebarItem,Va as SidebarSection,ea as StatisticIcon,fa as SunIcon,ub as Switch,bb as Table,pb as Tag,Fb as TailwindExample,s as ThemeProvider,yb as Tooltip,Wa as Typography,pa as UnfoldIcon,ga as UpRightArrowCircleIcon,Ma as UploadImageIcon,Ha as UserInCircleIcon,na as UsersIcon,ha as VectorIcon,ua as WayIcon,f as convertPaletteToRem,w as createComponent,x as createStyledComponent,p as darkTheme,o as darkThemePx,t as destructSpaceProps,u as generatePropertySpaceStyle,k as getBreakpoint,h as getButtonSizeStyles,g as getButtonStyles,i as getInputStyles,v as getResponsiveProps,j as getTypographyStyles,l as hexToRgba,n as lightTheme,m as lightThemePx,e as propToRem,c as pxToRem,d as remToPx,b as resolveThemeColor,r as useBreakpoint,fb as useContextMenuControl,y as useTheme}from'./chunk-UEDRXYVT.mjs';import ur,{styled,useTheme}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Dt,{forwardRef,useState,useRef,useMemo,useCallback,useImperativeHandle,useEffect,useLayoutEffect,memo}from'react';import wr from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import dr from'react-content-loader';import {renderAsync}from'docx-preview';import {Prism}from'react-syntax-highlighter';import {darcula}from'react-syntax-highlighter/dist/esm/styles/prism';import eo from'react-markdown';import to from'remark-gfm';import ro from'copy-to-clipboard';import {parse,isValid,getYear,format,getMonth,startOfWeek,getWeeksInMonth,startOfMonth,previousMonday,differenceInDays}from'date-fns';import {Popover}from'react-tiny-popover';var Ua=a(({children:r,className:o})=>jsx(Qt,{className:o,children:r}),"PageLayout"),Qt=styled.div`
1
+ import {a,w,x,u,c,l,z,Pa,mb,ma,Wa,yb,y,ib,G,gb,H}from'./chunk-YDKJRUAI.mjs';export{qb as Alert,A as AlertIcon,za as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ia as BallsMenu,mb as Box,q as BreakpointProvider,E as BugReportIcon,Na as BurgerMenuIcon,sa as BusIcon,z as Button,F as CalendarIcon,ta as CarIcon,Gb as ChatField,ja as CheckIcon,sb as Checkbox,ka as ChevronDownIcon,G as ChevronLeftIcon,H as ChevronRightIcon,la as ChevronUpIcon,Oa as ClockIcon,I as CloseCircleIcon,J as ClosedLockIcon,zb as ContentLoader,db as ContextMenu,eb as ContextMenuDelimiter,qa as CrossIcon,K as DataSetsIcon,L as DeepSearchIcon,M as DisabledVisibleIcon,N as DocsIcon,O as DownloadIcon,vb as Drawer,xb as DrawerBody,wb as DrawerHeader,P as EditUserIcon,ob as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,jb as FileField,xa as FileIcon,S as FiltersIcon,Ia as FlashIcon,kb as FlexContainer,lb as FlexItem,Ba as FolderAlertIcon,Ja as FolderInfoIcon,_a as Header,$a as HeaderDelimeter,ab as HeaderSection,T as HomepageIcon,Qa as ImageIcon,oa as InfoCircleFilledIcon,U as InfoCircleIcon,ib as Input,ya as IosIcon,rb as Label,nb as Line,tb as LinerProgress,Xa as ListMenu,Ya as ListMenuItem,Za as ListMenuSection,V as MapRadarIcon,ra as MaximizeIcon,Aa as MicrosoftIcon,Pa as MinusIcon,Bb as Modal,Db as ModalBody,Eb as ModalFooter,Cb as ModalHeader,W as MoonIcon,X as OpenLockIcon,Y as OrganizationIcon,Ab as Overlay,cb as Pagination,Ea as PassportIcon,Z as PasswordFinderIcon,Ga as PencilIcon,_ as PhonebookIcon,va as PlaneIcon,ma as PlusIcon,Fa as PointIcon,$ as PrintIcon,aa as Profiler2Icon,ba as ProfilerIcon,Hb as ProgressLoader,Ca as RelationIcon,Da as RelationPointsIcon,Ka as RotateLeftIcon,La as RotateRightIcon,hb as RowActionsMenu,ca as SandBoxIcon,da as SearchIcon,gb as Select,wa as ShipIcon,Sa as Sidebar,Ra as SidebarContext,Ua as SidebarDelimeter,Ta as SidebarItem,Va as SidebarSection,ea as StatisticIcon,fa as SunIcon,ub as Switch,bb as Table,pb as Tag,Fb as TailwindExample,s as ThemeProvider,yb as Tooltip,Wa as Typography,pa as UnfoldIcon,ga as UpRightArrowCircleIcon,Ma as UploadImageIcon,Ha as UserInCircleIcon,na as UsersIcon,ha as VectorIcon,ua as WayIcon,f as convertPaletteToRem,w as createComponent,x as createStyledComponent,p as darkTheme,o as darkThemePx,t as destructSpaceProps,u as generatePropertySpaceStyle,k as getBreakpoint,h as getButtonSizeStyles,g as getButtonStyles,i as getInputStyles,v as getResponsiveProps,j as getTypographyStyles,l as hexToRgba,n as lightTheme,m as lightThemePx,e as propToRem,c as pxToRem,d as remToPx,b as resolveThemeColor,r as useBreakpoint,fb as useContextMenuControl,y as useTheme}from'./chunk-YDKJRUAI.mjs';import pr,{styled,useTheme}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Pt,{forwardRef,useState,useRef,useMemo,useCallback,useImperativeHandle,useEffect,useLayoutEffect,memo}from'react';import xr from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import ur from'react-content-loader';import {renderAsync}from'docx-preview';import {Prism}from'react-syntax-highlighter';import {darcula}from'react-syntax-highlighter/dist/esm/styles/prism';import to from'react-markdown';import ro from'remark-gfm';import oo from'copy-to-clipboard';import {parse,isValid,getYear,format,getMonth,startOfWeek,getWeeksInMonth,startOfMonth,previousMonday,differenceInDays}from'date-fns';import {Popover}from'react-tiny-popover';var Ua=a(({children:r,className:o})=>jsx(er,{className:o,children:r}),"PageLayout"),er=styled.div`
2
2
  display: grid;
3
3
  min-height: 100dvh;
4
4
  position: relative;
@@ -9,11 +9,11 @@ import {a,w,x,u,c,l,z,Pa,mb,ma,Wa,yb,y,ib,G,gb,H}from'./chunk-UEDRXYVT.mjs';expo
9
9
  & > header {
10
10
  grid-area: header;
11
11
  }
12
- `;var ei=a(({children:r,className:o})=>jsx(rr,{className:o,children:r}),"PageContent"),rr=styled.main`
12
+ `;var ei=a(({children:r,className:o})=>jsx(or,{className:o,children:r}),"PageContent"),or=styled.main`
13
13
  grid-area: content;
14
14
  min-width: 0;
15
15
  background: ${({theme:r})=>r.colors.backgroundBase};
16
- `;var ai=a(({children:r,className:o,top:d=0})=>jsx(ar,{className:o,$top:d,onClick:m=>m.stopPropagation(),children:r}),"SubNav"),ar=styled.div(({theme:r,$top:o})=>`
16
+ `;var ai=a(({children:r,className:o,top:d=0})=>jsx(ir,{className:o,$top:d,onClick:m=>m.stopPropagation(),children:r}),"SubNav"),ir=styled.div(({theme:r,$top:o})=>`
17
17
  display: flex;
18
18
  flex-direction: column;
19
19
  justify-content: space-between;
@@ -33,25 +33,25 @@ import {a,w,x,u,c,l,z,Pa,mb,ma,Wa,yb,y,ib,G,gb,H}from'./chunk-UEDRXYVT.mjs';expo
33
33
  position: sticky;
34
34
  border-right: 1px solid ${r.colors.stroke.light};
35
35
  }
36
- `);var mi=w(({maxWidth:r,...o})=>jsx(cr,{...o,$maxWidth:r})),cr=x(styled.div(({theme:r,$maxWidth:o,px:d=20})=>`
36
+ `);var mi=w(({maxWidth:r,...o})=>jsx(lr,{...o,$maxWidth:r})),lr=x(styled.div(({theme:r,$maxWidth:o,px:d=20})=>`
37
37
  ${u(r,"padding-inline",d)}
38
38
  width: 100%;
39
39
  min-width: 0;
40
40
  max-width: ${typeof o=="number"?c(o,r.baseSize):o||"100%"};
41
- `),{ignoreStyles:["padding-inline"]});var hr=ur.div`
41
+ `),{ignoreStyles:["padding-inline"]});var gr=pr.div`
42
42
  width: 100%;
43
43
  height: 100%;
44
44
  display: flex;
45
45
  align-items: center;
46
46
  justify-content: center;
47
- `,gr=a(({width:r=280,height:o=280})=>{let d=useTheme();return jsx(hr,{children:jsxs(dr,{foregroundColor:d.contentLoader.foreground,backgroundColor:d.contentLoader.background,width:r,height:o,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"),vt=gr;var Se=typeof window<"u"&&window.devicePixelRatio||1;function Lr(r){return !r||r.length===0?[]:r.map(o=>{let d=new Image;d.src=o.img;let m=new Image;return m.src=o.hoverImg,{...o,normalImg:d,hoverImg:m}})}a(Lr,"prepareButtonImages");var j={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},Rr=forwardRef(({loading:r,width:o,height:d,graphData:m,buttons:y=[],onNodeClick:w,onBackgroundClick:h,onNodeHover:D,onLinkHover:L,onLinkClick:B},H)=>{let P=useTheme(),[I,Z]=useState(true),t=useRef({transform:{x:0,y:0,k:1},isPanning:false,hoveredNode:null,hoveredLink:null,draggedNode:null,selectedNode:null,hoveredButtonIndex:null,highlightNodes:new Set,highlightLinks:new Set,lastMousePos:{x:0,y:0},mustBeStoppedPropagation:false,mouseStartPos:null,isDragging:false,width:o*Se,height:d*Se,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:X,links:G}=useMemo(()=>wr(m),[m]),[k,V]=useState([]),T=useRef(null),M=useRef(null),Q=useRef(null),te=scaleOrdinal(schemeCategory10),Vt=useCallback(()=>{if(!T.current)return false;try{let e=T.current.getContext("2d");return e?(Q.current=e,!0):(console.error("Failed to get 2D context"),!1)}catch(e){return console.error("Error initializing Canvas 2D context:",e),false}},[]),ee=useCallback(()=>M.current?M.current.nodes():null,[]),me=useCallback(()=>{if(!M.current)return null;let e=M.current.force("link");return e?e.links():null},[]),Ge=useCallback(e=>{e.save(),e.setTransform(1,0,0,1,0,0);let{width:a,height:n}=t.current,i=j.gridSpacing,s=j.dotSize;e.fillStyle=P.graph2D.grid.dotColor;for(let u=i/2;u<=a;u+=i)for(let c=i/2;c<=n;c+=i)e.beginPath(),e.arc(u,c,s,0,2*Math.PI),e.fill();e.restore();},[P.graph2D.grid.dotColor,j.gridSpacing,j.dotSize]),qt=useCallback((e,a,n)=>{if(!e)return "";if(n.measureText(e).width<=a)return e;let s=e,u="...";for(;n.measureText(s+u).width>a&&s.length>0;)s=s.slice(0,-1);return s+u},[]),Ie=a(e=>{let n=Math.min(e,j.maxZoom)/j.maxZoom;return Math.max(j.fontSize*n,j.fontSize)},"calculateFontSize"),Ve=useCallback(e=>{let a=me(),n=ee();!a||a.length===0||!n||n.length===0||(e.lineWidth=.5,e.globalAlpha=1,a.forEach(i=>{let s=typeof i.source=="object"?i.source:n.find(re=>re.id===i.source),u=typeof i.target=="object"?i.target:n.find(re=>re.id===i.target);if(!s||!u)return;let c={x:s.x||0,y:s.y||0},l={x:u.x||0,y:u.y||0},g=l.x-c.x,b=l.y-c.y,v=Math.sqrt(g*g+b*b),R=g/v,C=b/v,$=j.nodeSizeBase/2,z=j.nodeSizeBase/2,F=4,p={x:c.x+R*$,y:c.y+C*$},S={x:l.x-R*(z+F),y:l.y-C*(z+F)},x={x:l.x-R*(z+1),y:l.y-C*(z+1)},O=t.current.highlightLinks.has(i),A=O?P.graph2D.link.highlighted:P.graph2D.link.normal,W=O?1.5:.5,q=c.x+(l.x-c.x)/2,ne=c.y+(l.y-c.y)/2,ae=Math.atan2(b,g);if(i.label){let re=t.current.transform.k,ie=Ie(re);e.font=`${ie}px Sans-Serif`;let ot=e.measureText(i.label).width,nt=10;e.beginPath(),e.moveTo(p.x,p.y);let at=v/2-(ot+nt)/2,it={x:c.x+R*at,y:c.y+C*at};e.lineTo(it.x,it.y),e.strokeStyle=A,e.lineWidth=W,e.stroke(),e.beginPath();let st=v/2+(ot+nt)/2,ct={x:c.x+R*st,y:c.y+C*st};e.moveTo(ct.x,ct.y),e.lineTo(S.x,S.y),e.strokeStyle=A,e.lineWidth=W,e.stroke();}else e.beginPath(),e.moveTo(p.x,p.y),e.lineTo(S.x,S.y),e.strokeStyle=A,e.lineWidth=W,e.stroke();let he=2;if(e.save(),e.translate(x.x,x.y),e.rotate(ae),e.beginPath(),e.moveTo(0,0),e.lineTo(-4,he),e.lineTo(-4,0),e.lineTo(-4,-2),e.closePath(),e.fillStyle=A,e.fill(),e.restore(),i.label){let re=t.current.transform.k,ie=Ie(re);e.font=`${ie}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(q,ne),Math.abs(ae)>Math.PI/2?e.rotate(ae+Math.PI):e.rotate(ae),e.fillStyle=O?P.graph2D.link.highlightedTextColor:P.graph2D.link.textColor,e.fillText(i.label,0,0),e.restore();}}));},[j,P.graph2D.link]),qe=a((e,a,n,i,s,u,c)=>{try{if(u!=null){let l=s*.8;e.font=`${l}px sans-serif`,e.textBaseline="middle",e.textAlign="left";let g=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(u),b=e.measureText(g).width,v=s*.3,C=(s+v+b)/2;e.drawImage(a,n-C,i-s/2,s,s),e.fillStyle=c||"#99989C",e.fillText(g,n-C+s+v,i);}else e.drawImage(a,n-s/2,i-s/2,s,s);}catch(l){console.warn("Error rendering icon:",l);}},"drawIconWithOptionalCounter"),Ue=useCallback((e,a)=>{if(!k||k.length===0||!e||!e.x||!e.y)return;let{x:n,y:i}=e,s=j.nodeSizeBase*j.nodeAreaFactor/2;a.save();let u=Math.min(k.length,8),c=Math.min(Math.PI*2/u,Math.PI);for(let l$1=0;l$1<u;l$1++){let g=l$1*c,b=(l$1+1)*c,v=t.current.hoveredButtonIndex===l$1;a.beginPath(),a.arc(n,i,s,g,b,false),a.lineTo(n,i),a.closePath(),a.lineWidth=1,a.strokeStyle=P.graph2D?.button?.stroke||"#FFFFFF",a.stroke(),a.fillStyle=v?P.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":P.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",a.fill();let R=s*.2,C=(g+b)/2,$=s-j.nodeSizeBase/2+R,z=n+Math.cos(C)*$,F=i+Math.sin(C)*$,p=k[l$1];if(p.loading){let S=R/2,x=R/12;a.save(),a.translate(z,F),a.rotate(t.current.spinnerAngle);for(let O=0;O<12;O++){let A=Math.PI*2*O/12,W=O/12,q=Math.cos(A)*S,ne=Math.sin(A)*S;a.beginPath(),a.fillStyle=l(P.graph2D?.button?.spinnerColor,W),a.arc(q,ne,x,0,Math.PI*2),a.fill();}a.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(_),t.current.animation.buttonIndex=l$1;}else {t.current.animation.id&&t.current.animation.buttonIndex===l$1&&(cancelAnimationFrame(t.current.animation.id),t.current.animation.id=null,t.current.animation.buttonIndex=null);let S=v?p.hoverImg:p.normalImg,x=p.getCount?p.getCount(e):null;S.complete?qe(a,S,z,F,R,x,P.graph2D?.button?.textColor):S.onload=()=>{Q.current&&qe(a,S,z,F,R,x,P.graph2D?.button?.textColor);};}}a.restore();},[k,P.graph2D?.button]),Ze=useCallback(e=>{let a=ee();!a||a.length===0||(e.globalAlpha=1,a.forEach(n=>{let{x:i,y:s,color:u,fontColor:c,label:l}=n,g=t.current.highlightNodes.has(n)||n===t.current.hoveredNode||n===t.current.draggedNode,b=n===t.current.selectedNode,v=j.nodeSizeBase,R=j.nodeSizeBase/2;if(g&&!b){let C=j.nodeSizeBase*j.nodeAreaFactor*.75/2;e.beginPath(),e.arc(i,s,C,0,2*Math.PI,false),e.fillStyle=P.graph2D.ring.highlightFill,e.fill();}if(b)if(y&&y.length>0)Ue(n,e);else {let C=j.nodeSizeBase*j.nodeAreaFactor/2;e.beginPath(),e.arc(i,s,C,0,2*Math.PI,false),e.fillStyle=P.graph2D.ring.selectionFill||P.graph2D.ring.highlightFill,e.fill();}if(e.beginPath(),e.arc(i,s,R,0,2*Math.PI),e.fillStyle=u||te(n.group||"0"),e.fill(),l){e.save(),e.translate(i,s);let C=t.current.transform.k,$=Ie(C),z=v*j.textPaddingFactor;e.font=`${$}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle=c||"#000";let F=qt(l,z,e);e.fillText(F,0,0),e.restore();}}));},[P.graph2D.ring,y,Ue]),_=useCallback(()=>{let e=Q.current;e&&(e.clearRect(0,0,t.current.width,t.current.height),Ge(e),e.save(),e.setTransform(t.current.transform.k,0,0,t.current.transform.k,t.current.transform.x,t.current.transform.y),Ve(e),Ze(e),e.restore());},[Ve,Ze,Ge]),Je=useCallback((e,a=[],n)=>{let i=me()||[],s=ee()||[];if(!M.current||!e.length)return;let{width:u,height:c}=t.current,l=n?.smoothAppearance??false,g=n?.transitionDuration??1e3,b=new Set(s.map(p=>p.id)),v=e.filter(p=>!b.has(p.id)),R=new Set(i.map(p=>`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`)),C=a.filter(p=>{let S=`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`;return !R.has(S)});if(v.length===0&&C.length===0)return;let $=[...s,...v],z=[...i,...C];l&&(v.forEach(p=>{let S=C.filter(x=>{let O=typeof x.source=="object"?x.source.id:x.source,A=typeof x.target=="object"?x.target.id:x.target;return O===p.id&&b.has(A)||A===p.id&&b.has(O)});if(S.length>0){let x=S[0],O=typeof x.source=="object"?x.source.id===p.id?x.target:x.source.id:x.source===p.id?x.target:x.source,A=$.find(W=>W.id===O);if(A&&A.x!==void 0&&A.y!==void 0){let W=30+Math.random()*20,q=Math.random()*Math.PI*2;p.x=A.x+Math.cos(q)*W,p.y=A.y+Math.sin(q)*W,p.vx=0,p.vy=0;}}else {let x=u/2,O=c/2,A=Math.min(u,c)/4,W=Math.random()*Math.PI*2;p.x=x+Math.cos(W)*(A*Math.random()),p.y=O+Math.sin(W)*(A*Math.random()),p.vx=0,p.vy=0;}}),s.forEach(p=>{p.fx=p.x,p.fy=p.y;})),M.current.nodes($);let F=M.current.force("link");F&&F.links(z),C.forEach(p=>{let S=typeof p.source=="object"?p.source:$.find(O=>O.id===p.source),x=typeof p.target=="object"?p.target:$.find(O=>O.id===p.target);!S||!x||(!S.neighbors&&(S.neighbors=[]),!x.neighbors&&(x.neighbors=[]),S.neighbors.push(x),x.neighbors.push(S),!S.links&&(S.links=[]),!x.links&&(x.links=[]),S.links.push(p),x.links.push(p));}),l?(M.current.alphaTarget(.3),M.current.alpha(.3),M.current.velocityDecay(.7),M.current.restart(),setTimeout(()=>{s.forEach(p=>{p.fx=void 0,p.fy=void 0;}),M.current?.alphaTarget(0),M.current?.alpha(.1),M.current?.velocityDecay(.6);},g)):M.current.alpha(.1).restart(),_();},[X,_]),Ke=useCallback(e=>{let a=ee(),n=me();if(!M.current||!e.length||!a||a.length===0||!n||n.length===0)return;let i=new Set(e);if(t.current.selectedNode&&t.current.selectedNode.id!==void 0&&i.has(t.current.selectedNode.id)&&(t.current.selectedNode=null),t.current.hoveredNode&&t.current.hoveredNode.id!==void 0&&i.has(t.current.hoveredNode.id)&&(t.current.hoveredNode=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set),t.current.hoveredLink){let l=typeof t.current.hoveredLink.source=="object"?t.current.hoveredLink.source.id:t.current.hoveredLink.source,g=typeof t.current.hoveredLink.target=="object"?t.current.hoveredLink.target.id:t.current.hoveredLink.target;(l!==void 0&&i.has(l)||g!==void 0&&i.has(g))&&(t.current.hoveredLink=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set);}t.current.draggedNode&&t.current.draggedNode.id!==void 0&&i.has(t.current.draggedNode.id)&&(t.current.draggedNode=null);let s=a.filter(l=>l.id!==void 0&&!i.has(l.id)),u=n.filter(l=>{let g=typeof l.source=="object"?l.source.id:l.source,b=typeof l.target=="object"?l.target.id:l.target;return g!==void 0&&!i.has(g)&&b!==void 0&&!i.has(b)});s.forEach(l=>{l.neighbors=[],l.links=[];}),u.forEach(l=>{let g=typeof l.source=="object"?l.source:s.find(v=>v.id===l.source),b=typeof l.target=="object"?l.target:s.find(v=>v.id===l.target);!g||!b||(g.neighbors=g.neighbors||[],b.neighbors=b.neighbors||[],g.neighbors.push(b),b.neighbors.push(g),g.links=g.links||[],b.links=b.links||[],g.links.push(l),b.links.push(l));}),M.current.nodes(s);let c=M.current.force("link");c&&c.links(u),_();},[_]),ye=useCallback((e=0,a$1=20)=>{let n=ee();if(!Q.current||!T.current||!n||!n.length)return;let s=1/0,u=1/0,c=-1/0,l=-1/0;if(n.forEach(g=>{if(g.x===void 0||g.y===void 0)return;let b=g.x,v=g.y;s=Math.min(s,b),u=Math.min(u,v),c=Math.max(c,b),l=Math.max(l,v);}),isFinite(s)&&isFinite(c)&&isFinite(u)&&isFinite(l)){let{width:g,height:b}=t.current;s-=a$1,u-=a$1,c+=a$1,l+=a$1;let v=c-s,R=l-u,C=v>0?g/v:1,$=R>0?b/R:1,z=Math.min(C,$,10),F=s+v/2,p=u+R/2,S={k:z,x:g/2-F*z,y:b/2-p*z};if(e>0){let x={...t.current.transform},O=Date.now(),A=a(()=>{let W=Math.min(1,(Date.now()-O)/e),q=W===1?1:1-Math.pow(1-W,3),ne={k:x.k+(S.k-x.k)*q,x:x.x+(S.x-x.x)*q,y:x.y+(S.y-x.y)*q};t.current.transform=ne,_(),W<1&&requestAnimationFrame(A);},"animateZoom");requestAnimationFrame(A);}else t.current.transform=S,_();}},[]),be=useCallback((e,a)=>{let n=ee();if(!n||n.length===0)return null;let i=j.nodeSizeBase/2,s=typeof window<"u"&&window.devicePixelRatio||1,u=(e*s-t.current.transform.x)/t.current.transform.k,c=(a*s-t.current.transform.y)/t.current.transform.k;return n.find(l=>{let g=(l.x||0)-u,b=(l.y||0)-c;return Math.sqrt(g*g+b*b)<=i})||null},[]),ve=useCallback((e,a)=>{let n=me(),i=ee();if(!n||n.length===0||!i||i.length===0)return null;let s=typeof window<"u"&&window.devicePixelRatio||1,u=(e*s-t.current.transform.x)/t.current.transform.k,c=(a*s-t.current.transform.y)/t.current.transform.k,l=5;return n.find(g=>{let b=typeof g.source=="object"?g.source:i.find(ie=>ie.id===g.source),v=typeof g.target=="object"?g.target:i.find(ie=>ie.id===g.target);if(!b||!v)return false;let R=b.x||0,C=b.y||0,$=v.x||0,z=v.y||0,F=u-R,p=c-C,S=$-R,x=z-C,O=F*S+p*x,A=S*S+x*x;if(A===0)return false;let W=O/A;W=Math.max(0,Math.min(1,W));let q=R+W*S,ne=C+W*x,ae=u-q,he=c-ne;return Math.sqrt(ae*ae+he*he)<=l})||null},[]),Qe=useCallback((e,a,n,i,s,u,c)=>{let l=e-n,g=a-i,b=Math.sqrt(l*l+g*g),v=Math.atan2(g,l);v<0&&(v+=2*Math.PI);let $=b>=s*.5&&b<=s*1,z=false;return u===Math.PI&&c===Math.PI*2?z=v>=Math.PI&&v<=Math.PI*2:u===0&&c===Math.PI?z=v>=0&&v<=Math.PI:z=u<=c&&v>=u&&v<=c||u>c&&(v>=u||v<=c),$&&z},[]),Le=useCallback(e=>{if(e===t.current.hoveredNode)return;let a=new Set,n=new Set;e&&(a.add(e),e.neighbors&&e.neighbors.forEach(i=>a.add(i)),e.links&&e.links.forEach(i=>n.add(i))),t.current.hoveredNode=e,D&&D(e),t.current.highlightNodes=a,t.current.highlightLinks=n;},[D]),Re=useCallback(e=>{if(e===t.current.hoveredLink)return;let a=new Set,n=new Set;if(e){n.add(e);let i=ee();if(i){let s=typeof e.source=="object"?e.source:i.find(c=>c.id===e.source),u=typeof e.target=="object"?e.target:i.find(c=>c.id===e.target);s&&a.add(s),u&&a.add(u);}}t.current.hoveredLink=e,L&&L(e),t.current.highlightNodes=a,t.current.highlightLinks=n;},[L,ee]),et=useCallback(e=>{B&&B(e);},[B]),tt=useCallback(e=>{t.current.selectedNode=e,w&&w(e);},[w]),rt=useCallback(()=>{t.current.selectedNode=null,h&&h();},[h]),Ee=useCallback(e=>{if(!T.current||!M.current)return;let a=T.current.getBoundingClientRect(),n=e.clientX-a.left,i=e.clientY-a.top;t.current.mouseStartPos={x:n,y:i},t.current.isDragging=false;let s=be(n,i);s?(t.current.draggedNode=s,s.fx=s.x,s.fy=s.y):(t.current.isPanning=true,t.current.lastMousePos={x:n,y:i});},[be]),we=useCallback((e,a)=>{let n=null;if(T.current&&t.current&&k.length>0){let i=j.nodeSizeBase*j.nodeAreaFactor/2,s=T.current.getBoundingClientRect(),u=T.current.width/s.width,c=T.current.height/s.height,l=e*u,g=a*c,b=(l-t.current.transform.x)/t.current.transform.k,v=(g-t.current.transform.y)/t.current.transform.k,R=t.current.selectedNode?.x||0,C=t.current.selectedNode?.y||0,$=Math.min(k.length,8),z=Math.min(Math.PI*2/$,Math.PI);for(let F=0;F<$;F++){let p=F*z,S=(F+1)*z;if(Qe(b,v,R,C,i,p,S)){n=F;break}}}return n},[k]),ze=useCallback(e=>{if(!T.current)return;let a=T.current.getBoundingClientRect(),n=e.clientX-a.left,i=e.clientY-a.top;if(t.current.draggedNode&&t.current.mouseStartPos&&M.current){let c=t.current.mouseStartPos.x,l=t.current.mouseStartPos.y,g=n-c,b=i-l;Math.sqrt(g*g+b*b)>3&&(t.current.isDragging=true,M.current.alphaTarget()===0&&M.current.alphaTarget(0).restart());let C=typeof window<"u"&&window.devicePixelRatio||1,$=(n*C-t.current.transform.x)/t.current.transform.k,z=(i*C-t.current.transform.y)/t.current.transform.k;t.current.draggedNode.fx=$,t.current.draggedNode.fy=z;return}if(t.current.isPanning&&t.current.mouseStartPos){let c=n-t.current.lastMousePos.x,l=i-t.current.lastMousePos.y,g=t.current.mouseStartPos.x,b=t.current.mouseStartPos.y;Math.sqrt(Math.pow(n-g,2)+Math.pow(i-b,2))>3&&(t.current.isDragging=true),t.current.transform={...t.current.transform,x:t.current.transform.x+c,y:t.current.transform.y+l},t.current.lastMousePos={x:n,y:i},_();return}let s,u;if(t.current.selectedNode&&T.current&&k.length>0){let c=we(n,i);c!==null&&(u=t.current.selectedNode),c!==t.current.hoveredButtonIndex&&(s=true),t.current.hoveredButtonIndex=c;}else t.current.hoveredButtonIndex!==null&&(t.current.hoveredButtonIndex=null);if(!u&&(u=be(n,i),!u)){let c=ve(n,i),l=c!==t.current.hoveredLink;if(c&&t.current.hoveredNode&&Le(null),Re(c),T.current&&(T.current.style.cursor=c?"pointer":"default"),l){_();return}}u&&t.current.hoveredLink&&Re(null),u!==t.current.hoveredNode&&(s=true),Le(u),T.current&&(T.current.style.cursor=u?"pointer":"default"),s&&_();},[k,be,ve,Le,Re,_,Qe,we]),Ut=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.stopPropagation(),e.preventDefault()),t.current.mustBeStoppedPropagation=false;},[]),xe=useCallback(e=>{let a=t.current.isDragging;if(a&&(t.current.mustBeStoppedPropagation=true),!a&&t.current.mouseStartPos){let n=T.current?.getBoundingClientRect();if(n){let i=e.clientX-n.left,s=e.clientY-n.top;k.length>0&&t.current.hoveredButtonIndex===null&&(t.current.hoveredButtonIndex=we(i,s));let u=false;if(t.current.selectedNode&&t.current.hoveredButtonIndex!==null&&y[t.current.hoveredButtonIndex]){let c=y[t.current.hoveredButtonIndex];c&&c.onClick&&(c.onClick(t.current.selectedNode),u=true,t.current.hoveredButtonIndex=null);}if(!u&&t.current.draggedNode)tt(t.current.draggedNode);else if(!u&&!t.current.draggedNode){let c=ve(i,s);c?et(c):rt();}}}if(t.current.draggedNode&&M.current){if(a){M.current.alphaTarget(0);let n=.05,i=.04,s=.6;M.current.alpha(n).alphaDecay(i),M.current.velocityDecay(s);}else M.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),_();},[y,_,tt,rt,ve,et,we,k]),je=useCallback(e=>{if(e.stopPropagation(),e.preventDefault(),!T.current)return;let a=T.current.getBoundingClientRect(),n=e.clientX-a.left,i=e.clientY-a.top,u=-e.deltaY>0?1.1:1/1.1,c=t.current.transform,l=c.k*u;if(l<.01||l>10)return;let g=c.k*u,b=n-(n-c.x)*u,v=i-(i-c.y)*u;t.current.transform={k:g,x:b,y:v},_();},[_]),Be=a((e,a)=>{let n=e.touches[0];if(n){let i={clientX:n.clientX,clientY:n.clientY};a(i);}},"convertTouchToMouseEvent"),Zt=useCallback(e=>{Be(e,Ee);},[Ee]),Fe=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.preventDefault(),e.stopPropagation()),t.current.mustBeStoppedPropagation=false,Be(e,xe);},[xe]),Jt=useCallback(e=>{Be(e,ze);},[ze]);return useImperativeHandle(H,()=>({zoomToFit:ye,addNodes:Je,removeNodes:Ke}),[ye,Je,Ke]),useEffect(()=>{let e=T.current,{width:a,height:n}=t.current;if(!e)return;Vt(),Z(true);let i=a/2,s=n/2,u=j.nodeSizeBase,c=u/2,l=u*2.5;M.current&&M.current.stop();let g=M.current=forceSimulation(X).force("link",forceLink(G).id(b=>b.id).distance(l).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(i,s).strength(.05)).force("collide",forceCollide().radius(c*2).iterations(2).strength(1)).velocityDecay(.6);return ()=>{g.stop();}},[X,G]),useLayoutEffect(()=>{let e=T.current;e&&(t.current.width=o*Se,t.current.height=d*Se,e.width=t.current.width,e.height=t.current.height);},[o,d]),useEffect(()=>{if(M.current){let e=M.current;e.on("tick",()=>{_();}),e.on("end",()=>{I&&(ye(0,20),setTimeout(()=>{Z(false);},200));});}I||_();},[X,G,I,_,ye]),useEffect(()=>{!X||!G||G.forEach(e=>{let a=typeof e.source=="object"?e.source:X.find(i=>i.id===e.source),n=typeof e.target=="object"?e.target:X.find(i=>i.id===e.target);!a||!n||(!a.neighbors&&(a.neighbors=[]),!n.neighbors&&(n.neighbors=[]),a.neighbors.push(n),n.neighbors.push(a),!a.links&&(a.links=[]),!n.links&&(n.links=[]),a.links.push(e),n.links.push(e));});},[X,G]),useEffect(()=>{y&&y.length>0&&V(Lr(y));},[y]),useEffect(()=>{let e=T.current;if(!(!e||typeof window>"u"))return e.addEventListener("wheel",je,{passive:false}),e.addEventListener("touchend",Fe,{passive:false}),()=>{e.removeEventListener("wheel",je),e.removeEventListener("touchend",Fe);}},[je,Fe]),jsxs(Er,{children:[(r||I)&&jsx(vt,{width:o,height:d}),jsx(zr,{ref:T,style:{width:o,height:d,display:r||I?"none":"block"},onMouseDown:Ee,onMouseMove:ze,onMouseUp:xe,onMouseLeave:xe,onClick:Ut,onTouchStart:Zt,onTouchMove:Jt})]})}),Er=styled.div`
47
+ `,fr=a(({width:r=280,height:o=280})=>{let d=useTheme();return jsx(gr,{children:jsxs(ur,{foregroundColor:d.contentLoader.foreground,backgroundColor:d.contentLoader.background,width:r,height:o,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"),wt=fr;var Se=typeof window<"u"&&window.devicePixelRatio||1;function Rr(r){return !r||r.length===0?[]:r.map(o=>{let d=new Image;d.src=o.img;let m=new Image;return m.src=o.hoverImg,{...o,normalImg:d,hoverImg:m}})}a(Rr,"prepareButtonImages");var j={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},Er=forwardRef(({loading:r,width:o,height:d,graphData:m,buttons:y=[],onNodeClick:w,onBackgroundClick:h,onNodeHover:D,onLinkHover:L,onLinkClick:B},H)=>{let P=useTheme(),[I,Z]=useState(true),t=useRef({transform:{x:0,y:0,k:1},isPanning:false,hoveredNode:null,hoveredLink:null,draggedNode:null,selectedNode:null,hoveredButtonIndex:null,highlightNodes:new Set,highlightLinks:new Set,lastMousePos:{x:0,y:0},mustBeStoppedPropagation:false,mouseStartPos:null,isDragging:false,width:o*Se,height:d*Se,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:X,links:G}=useMemo(()=>xr(m),[m]),[k,V]=useState([]),T=useRef(null),M=useRef(null),Q=useRef(null),te=scaleOrdinal(schemeCategory10),qt=useCallback(()=>{if(!T.current)return false;try{let e=T.current.getContext("2d");return e?(Q.current=e,!0):(console.error("Failed to get 2D context"),!1)}catch(e){return console.error("Error initializing Canvas 2D context:",e),false}},[]),ee=useCallback(()=>M.current?M.current.nodes():null,[]),me=useCallback(()=>{if(!M.current)return null;let e=M.current.force("link");return e?e.links():null},[]),Ve=useCallback(e=>{e.save(),e.setTransform(1,0,0,1,0,0);let{width:a,height:n}=t.current,i=j.gridSpacing,s=j.dotSize;e.fillStyle=P.graph2D.grid.dotColor;for(let u=i/2;u<=a;u+=i)for(let c=i/2;c<=n;c+=i)e.beginPath(),e.arc(u,c,s,0,2*Math.PI),e.fill();e.restore();},[P.graph2D.grid.dotColor,j.gridSpacing,j.dotSize]),Ut=useCallback((e,a,n)=>{if(!e)return "";if(n.measureText(e).width<=a)return e;let s=e,u="...";for(;n.measureText(s+u).width>a&&s.length>0;)s=s.slice(0,-1);return s+u},[]),Ie=a(e=>{let n=Math.min(e,j.maxZoom)/j.maxZoom;return Math.max(j.fontSize*n,j.fontSize)},"calculateFontSize"),qe=useCallback(e=>{let a=me(),n=ee();!a||a.length===0||!n||n.length===0||(e.lineWidth=.5,e.globalAlpha=1,a.forEach(i=>{let s=typeof i.source=="object"?i.source:n.find(re=>re.id===i.source),u=typeof i.target=="object"?i.target:n.find(re=>re.id===i.target);if(!s||!u)return;let c={x:s.x||0,y:s.y||0},l={x:u.x||0,y:u.y||0},g=l.x-c.x,b=l.y-c.y,v=Math.sqrt(g*g+b*b),R=g/v,C=b/v,$=j.nodeSizeBase/2,z=j.nodeSizeBase/2,F=4,p={x:c.x+R*$,y:c.y+C*$},S={x:l.x-R*(z+F),y:l.y-C*(z+F)},x={x:l.x-R*(z+1),y:l.y-C*(z+1)},O=t.current.highlightLinks.has(i),A=O?P.graph2D.link.highlighted:P.graph2D.link.normal,W=O?1.5:.5,q=c.x+(l.x-c.x)/2,ne=c.y+(l.y-c.y)/2,ae=Math.atan2(b,g);if(i.label){let re=t.current.transform.k,ie=Ie(re);e.font=`${ie}px Sans-Serif`;let nt=e.measureText(i.label).width,at=10;e.beginPath(),e.moveTo(p.x,p.y);let it=v/2-(nt+at)/2,st={x:c.x+R*it,y:c.y+C*it};e.lineTo(st.x,st.y),e.strokeStyle=A,e.lineWidth=W,e.stroke(),e.beginPath();let ct=v/2+(nt+at)/2,lt={x:c.x+R*ct,y:c.y+C*ct};e.moveTo(lt.x,lt.y),e.lineTo(S.x,S.y),e.strokeStyle=A,e.lineWidth=W,e.stroke();}else e.beginPath(),e.moveTo(p.x,p.y),e.lineTo(S.x,S.y),e.strokeStyle=A,e.lineWidth=W,e.stroke();let he=2;if(e.save(),e.translate(x.x,x.y),e.rotate(ae),e.beginPath(),e.moveTo(0,0),e.lineTo(-4,he),e.lineTo(-4,0),e.lineTo(-4,-2),e.closePath(),e.fillStyle=A,e.fill(),e.restore(),i.label){let re=t.current.transform.k,ie=Ie(re);e.font=`${ie}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(q,ne),Math.abs(ae)>Math.PI/2?e.rotate(ae+Math.PI):e.rotate(ae),e.fillStyle=O?P.graph2D.link.highlightedTextColor:P.graph2D.link.textColor,e.fillText(i.label,0,0),e.restore();}}));},[j,P.graph2D.link]),Ue=a((e,a,n,i,s,u,c)=>{try{if(u!=null){let l=s*.8;e.font=`${l}px sans-serif`,e.textBaseline="middle",e.textAlign="left";let g=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(u),b=e.measureText(g).width,v=s*.3,C=(s+v+b)/2;e.drawImage(a,n-C,i-s/2,s,s),e.fillStyle=c||"#99989C",e.fillText(g,n-C+s+v,i);}else e.drawImage(a,n-s/2,i-s/2,s,s);}catch(l){console.warn("Error rendering icon:",l);}},"drawIconWithOptionalCounter"),Ze=useCallback((e,a)=>{if(!k||k.length===0||!e||!e.x||!e.y)return;let{x:n,y:i}=e,s=j.nodeSizeBase*j.nodeAreaFactor/2;a.save();let u=Math.min(k.length,8),c=Math.min(Math.PI*2/u,Math.PI);for(let l$1=0;l$1<u;l$1++){let g=l$1*c,b=(l$1+1)*c,v=t.current.hoveredButtonIndex===l$1;a.beginPath(),a.arc(n,i,s,g,b,false),a.lineTo(n,i),a.closePath(),a.lineWidth=1,a.strokeStyle=P.graph2D?.button?.stroke||"#FFFFFF",a.stroke(),a.fillStyle=v?P.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":P.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",a.fill();let R=s*.2,C=(g+b)/2,$=s-j.nodeSizeBase/2+R,z=n+Math.cos(C)*$,F=i+Math.sin(C)*$,p=k[l$1];if(p.loading){let S=R/2,x=R/12;a.save(),a.translate(z,F),a.rotate(t.current.spinnerAngle);for(let O=0;O<12;O++){let A=Math.PI*2*O/12,W=O/12,q=Math.cos(A)*S,ne=Math.sin(A)*S;a.beginPath(),a.fillStyle=l(P.graph2D?.button?.spinnerColor,W),a.arc(q,ne,x,0,Math.PI*2),a.fill();}a.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(_),t.current.animation.buttonIndex=l$1;}else {t.current.animation.id&&t.current.animation.buttonIndex===l$1&&(cancelAnimationFrame(t.current.animation.id),t.current.animation.id=null,t.current.animation.buttonIndex=null);let S=v?p.hoverImg:p.normalImg,x=p.getCount?p.getCount(e):null;S.complete?Ue(a,S,z,F,R,x,P.graph2D?.button?.textColor):S.onload=()=>{Q.current&&Ue(a,S,z,F,R,x,P.graph2D?.button?.textColor);};}}a.restore();},[k,P.graph2D?.button]),Je=useCallback(e=>{let a=ee();!a||a.length===0||(e.globalAlpha=1,a.forEach(n=>{let{x:i,y:s,color:u,fontColor:c,label:l}=n,g=t.current.highlightNodes.has(n)||n===t.current.hoveredNode||n===t.current.draggedNode,b=n===t.current.selectedNode,v=j.nodeSizeBase,R=j.nodeSizeBase/2;if(g&&!b){let C=j.nodeSizeBase*j.nodeAreaFactor*.75/2;e.beginPath(),e.arc(i,s,C,0,2*Math.PI,false),e.fillStyle=P.graph2D.ring.highlightFill,e.fill();}if(b)if(y&&y.length>0)Ze(n,e);else {let C=j.nodeSizeBase*j.nodeAreaFactor/2;e.beginPath(),e.arc(i,s,C,0,2*Math.PI,false),e.fillStyle=P.graph2D.ring.selectionFill||P.graph2D.ring.highlightFill,e.fill();}if(e.beginPath(),e.arc(i,s,R,0,2*Math.PI),e.fillStyle=u||te(n.group||"0"),e.fill(),l){e.save(),e.translate(i,s);let C=t.current.transform.k,$=Ie(C),z=v*j.textPaddingFactor;e.font=`${$}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle=c||"#000";let F=Ut(l,z,e);e.fillText(F,0,0),e.restore();}}));},[P.graph2D.ring,y,Ze]),_=useCallback(()=>{let e=Q.current;e&&(e.clearRect(0,0,t.current.width,t.current.height),Ve(e),e.save(),e.setTransform(t.current.transform.k,0,0,t.current.transform.k,t.current.transform.x,t.current.transform.y),qe(e),Je(e),e.restore());},[qe,Je,Ve]),Ke=useCallback((e,a=[],n)=>{let i=me()||[],s=ee()||[];if(!M.current||!e.length)return;let{width:u,height:c}=t.current,l=n?.smoothAppearance??false,g=n?.transitionDuration??1e3,b=new Set(s.map(p=>p.id)),v=e.filter(p=>!b.has(p.id)),R=new Set(i.map(p=>`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`)),C=a.filter(p=>{let S=`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`;return !R.has(S)});if(v.length===0&&C.length===0)return;let $=[...s,...v],z=[...i,...C];l&&(v.forEach(p=>{let S=C.filter(x=>{let O=typeof x.source=="object"?x.source.id:x.source,A=typeof x.target=="object"?x.target.id:x.target;return O===p.id&&b.has(A)||A===p.id&&b.has(O)});if(S.length>0){let x=S[0],O=typeof x.source=="object"?x.source.id===p.id?x.target:x.source.id:x.source===p.id?x.target:x.source,A=$.find(W=>W.id===O);if(A&&A.x!==void 0&&A.y!==void 0){let W=30+Math.random()*20,q=Math.random()*Math.PI*2;p.x=A.x+Math.cos(q)*W,p.y=A.y+Math.sin(q)*W,p.vx=0,p.vy=0;}}else {let x=u/2,O=c/2,A=Math.min(u,c)/4,W=Math.random()*Math.PI*2;p.x=x+Math.cos(W)*(A*Math.random()),p.y=O+Math.sin(W)*(A*Math.random()),p.vx=0,p.vy=0;}}),s.forEach(p=>{p.fx=p.x,p.fy=p.y;})),M.current.nodes($);let F=M.current.force("link");F&&F.links(z),C.forEach(p=>{let S=typeof p.source=="object"?p.source:$.find(O=>O.id===p.source),x=typeof p.target=="object"?p.target:$.find(O=>O.id===p.target);!S||!x||(!S.neighbors&&(S.neighbors=[]),!x.neighbors&&(x.neighbors=[]),S.neighbors.push(x),x.neighbors.push(S),!S.links&&(S.links=[]),!x.links&&(x.links=[]),S.links.push(p),x.links.push(p));}),l?(M.current.alphaTarget(.3),M.current.alpha(.3),M.current.velocityDecay(.7),M.current.restart(),setTimeout(()=>{s.forEach(p=>{p.fx=void 0,p.fy=void 0;}),M.current?.alphaTarget(0),M.current?.alpha(.1),M.current?.velocityDecay(.6);},g)):M.current.alpha(.1).restart(),_();},[X,_]),Qe=useCallback(e=>{let a=ee(),n=me();if(!M.current||!e.length||!a||a.length===0||!n||n.length===0)return;let i=new Set(e);if(t.current.selectedNode&&t.current.selectedNode.id!==void 0&&i.has(t.current.selectedNode.id)&&(t.current.selectedNode=null),t.current.hoveredNode&&t.current.hoveredNode.id!==void 0&&i.has(t.current.hoveredNode.id)&&(t.current.hoveredNode=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set),t.current.hoveredLink){let l=typeof t.current.hoveredLink.source=="object"?t.current.hoveredLink.source.id:t.current.hoveredLink.source,g=typeof t.current.hoveredLink.target=="object"?t.current.hoveredLink.target.id:t.current.hoveredLink.target;(l!==void 0&&i.has(l)||g!==void 0&&i.has(g))&&(t.current.hoveredLink=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set);}t.current.draggedNode&&t.current.draggedNode.id!==void 0&&i.has(t.current.draggedNode.id)&&(t.current.draggedNode=null);let s=a.filter(l=>l.id!==void 0&&!i.has(l.id)),u=n.filter(l=>{let g=typeof l.source=="object"?l.source.id:l.source,b=typeof l.target=="object"?l.target.id:l.target;return g!==void 0&&!i.has(g)&&b!==void 0&&!i.has(b)});s.forEach(l=>{l.neighbors=[],l.links=[];}),u.forEach(l=>{let g=typeof l.source=="object"?l.source:s.find(v=>v.id===l.source),b=typeof l.target=="object"?l.target:s.find(v=>v.id===l.target);!g||!b||(g.neighbors=g.neighbors||[],b.neighbors=b.neighbors||[],g.neighbors.push(b),b.neighbors.push(g),g.links=g.links||[],b.links=b.links||[],g.links.push(l),b.links.push(l));}),M.current.nodes(s);let c=M.current.force("link");c&&c.links(u),_();},[_]),ye=useCallback((e=0,a$1=20)=>{let n=ee();if(!Q.current||!T.current||!n||!n.length)return;let s=1/0,u=1/0,c=-1/0,l=-1/0;if(n.forEach(g=>{if(g.x===void 0||g.y===void 0)return;let b=g.x,v=g.y;s=Math.min(s,b),u=Math.min(u,v),c=Math.max(c,b),l=Math.max(l,v);}),isFinite(s)&&isFinite(c)&&isFinite(u)&&isFinite(l)){let{width:g,height:b}=t.current;s-=a$1,u-=a$1,c+=a$1,l+=a$1;let v=c-s,R=l-u,C=v>0?g/v:1,$=R>0?b/R:1,z=Math.min(C,$,10),F=s+v/2,p=u+R/2,S={k:z,x:g/2-F*z,y:b/2-p*z};if(e>0){let x={...t.current.transform},O=Date.now(),A=a(()=>{let W=Math.min(1,(Date.now()-O)/e),q=W===1?1:1-Math.pow(1-W,3),ne={k:x.k+(S.k-x.k)*q,x:x.x+(S.x-x.x)*q,y:x.y+(S.y-x.y)*q};t.current.transform=ne,_(),W<1&&requestAnimationFrame(A);},"animateZoom");requestAnimationFrame(A);}else t.current.transform=S,_();}},[]),be=useCallback((e,a)=>{let n=ee();if(!n||n.length===0)return null;let i=j.nodeSizeBase/2,s=typeof window<"u"&&window.devicePixelRatio||1,u=(e*s-t.current.transform.x)/t.current.transform.k,c=(a*s-t.current.transform.y)/t.current.transform.k;return n.find(l=>{let g=(l.x||0)-u,b=(l.y||0)-c;return Math.sqrt(g*g+b*b)<=i})||null},[]),ve=useCallback((e,a)=>{let n=me(),i=ee();if(!n||n.length===0||!i||i.length===0)return null;let s=typeof window<"u"&&window.devicePixelRatio||1,u=(e*s-t.current.transform.x)/t.current.transform.k,c=(a*s-t.current.transform.y)/t.current.transform.k,l=5;return n.find(g=>{let b=typeof g.source=="object"?g.source:i.find(ie=>ie.id===g.source),v=typeof g.target=="object"?g.target:i.find(ie=>ie.id===g.target);if(!b||!v)return false;let R=b.x||0,C=b.y||0,$=v.x||0,z=v.y||0,F=u-R,p=c-C,S=$-R,x=z-C,O=F*S+p*x,A=S*S+x*x;if(A===0)return false;let W=O/A;W=Math.max(0,Math.min(1,W));let q=R+W*S,ne=C+W*x,ae=u-q,he=c-ne;return Math.sqrt(ae*ae+he*he)<=l})||null},[]),et=useCallback((e,a,n,i,s,u,c)=>{let l=e-n,g=a-i,b=Math.sqrt(l*l+g*g),v=Math.atan2(g,l);v<0&&(v+=2*Math.PI);let $=b>=s*.5&&b<=s*1,z=false;return u===Math.PI&&c===Math.PI*2?z=v>=Math.PI&&v<=Math.PI*2:u===0&&c===Math.PI?z=v>=0&&v<=Math.PI:z=u<=c&&v>=u&&v<=c||u>c&&(v>=u||v<=c),$&&z},[]),Le=useCallback(e=>{if(e===t.current.hoveredNode)return;let a=new Set,n=new Set;e&&(a.add(e),e.neighbors&&e.neighbors.forEach(i=>a.add(i)),e.links&&e.links.forEach(i=>n.add(i))),t.current.hoveredNode=e,D&&D(e),t.current.highlightNodes=a,t.current.highlightLinks=n;},[D]),Re=useCallback(e=>{if(e===t.current.hoveredLink)return;let a=new Set,n=new Set;if(e){n.add(e);let i=ee();if(i){let s=typeof e.source=="object"?e.source:i.find(c=>c.id===e.source),u=typeof e.target=="object"?e.target:i.find(c=>c.id===e.target);s&&a.add(s),u&&a.add(u);}}t.current.hoveredLink=e,L&&L(e),t.current.highlightNodes=a,t.current.highlightLinks=n;},[L,ee]),tt=useCallback(e=>{B&&B(e);},[B]),rt=useCallback(e=>{t.current.selectedNode=e,w&&w(e);},[w]),ot=useCallback(()=>{t.current.selectedNode=null,h&&h();},[h]),Ee=useCallback(e=>{if(!T.current||!M.current)return;let a=T.current.getBoundingClientRect(),n=e.clientX-a.left,i=e.clientY-a.top;t.current.mouseStartPos={x:n,y:i},t.current.isDragging=false;let s=be(n,i);s?(t.current.draggedNode=s,s.fx=s.x,s.fy=s.y):(t.current.isPanning=true,t.current.lastMousePos={x:n,y:i});},[be]),we=useCallback((e,a)=>{let n=null;if(T.current&&t.current&&k.length>0){let i=j.nodeSizeBase*j.nodeAreaFactor/2,s=T.current.getBoundingClientRect(),u=T.current.width/s.width,c=T.current.height/s.height,l=e*u,g=a*c,b=(l-t.current.transform.x)/t.current.transform.k,v=(g-t.current.transform.y)/t.current.transform.k,R=t.current.selectedNode?.x||0,C=t.current.selectedNode?.y||0,$=Math.min(k.length,8),z=Math.min(Math.PI*2/$,Math.PI);for(let F=0;F<$;F++){let p=F*z,S=(F+1)*z;if(et(b,v,R,C,i,p,S)){n=F;break}}}return n},[k]),ze=useCallback(e=>{if(!T.current)return;let a=T.current.getBoundingClientRect(),n=e.clientX-a.left,i=e.clientY-a.top;if(t.current.draggedNode&&t.current.mouseStartPos&&M.current){let c=t.current.mouseStartPos.x,l=t.current.mouseStartPos.y,g=n-c,b=i-l;Math.sqrt(g*g+b*b)>3&&(t.current.isDragging=true,M.current.alphaTarget()===0&&M.current.alphaTarget(0).restart());let C=typeof window<"u"&&window.devicePixelRatio||1,$=(n*C-t.current.transform.x)/t.current.transform.k,z=(i*C-t.current.transform.y)/t.current.transform.k;t.current.draggedNode.fx=$,t.current.draggedNode.fy=z;return}if(t.current.isPanning&&t.current.mouseStartPos){let c=n-t.current.lastMousePos.x,l=i-t.current.lastMousePos.y,g=t.current.mouseStartPos.x,b=t.current.mouseStartPos.y;Math.sqrt(Math.pow(n-g,2)+Math.pow(i-b,2))>3&&(t.current.isDragging=true),t.current.transform={...t.current.transform,x:t.current.transform.x+c,y:t.current.transform.y+l},t.current.lastMousePos={x:n,y:i},_();return}let s,u;if(t.current.selectedNode&&T.current&&k.length>0){let c=we(n,i);c!==null&&(u=t.current.selectedNode),c!==t.current.hoveredButtonIndex&&(s=true),t.current.hoveredButtonIndex=c;}else t.current.hoveredButtonIndex!==null&&(t.current.hoveredButtonIndex=null);if(!u&&(u=be(n,i),!u)){let c=ve(n,i),l=c!==t.current.hoveredLink;if(c&&t.current.hoveredNode&&Le(null),Re(c),T.current&&(T.current.style.cursor=c?"pointer":"default"),l){_();return}}u&&t.current.hoveredLink&&Re(null),u!==t.current.hoveredNode&&(s=true),Le(u),T.current&&(T.current.style.cursor=u?"pointer":"default"),s&&_();},[k,be,ve,Le,Re,_,et,we]),Zt=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.stopPropagation(),e.preventDefault()),t.current.mustBeStoppedPropagation=false;},[]),xe=useCallback(e=>{let a=t.current.isDragging;if(a&&(t.current.mustBeStoppedPropagation=true),!a&&t.current.mouseStartPos){let n=T.current?.getBoundingClientRect();if(n){let i=e.clientX-n.left,s=e.clientY-n.top;k.length>0&&t.current.hoveredButtonIndex===null&&(t.current.hoveredButtonIndex=we(i,s));let u=false;if(t.current.selectedNode&&t.current.hoveredButtonIndex!==null&&y[t.current.hoveredButtonIndex]){let c=y[t.current.hoveredButtonIndex];c&&c.onClick&&(c.onClick(t.current.selectedNode),u=true,t.current.hoveredButtonIndex=null);}if(!u&&t.current.draggedNode)rt(t.current.draggedNode);else if(!u&&!t.current.draggedNode){let c=ve(i,s);c?tt(c):ot();}}}if(t.current.draggedNode&&M.current){if(a){M.current.alphaTarget(0);let n=.05,i=.04,s=.6;M.current.alpha(n).alphaDecay(i),M.current.velocityDecay(s);}else M.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),_();},[y,_,rt,ot,ve,tt,we,k]),je=useCallback(e=>{if(e.stopPropagation(),e.preventDefault(),!T.current)return;let a=T.current.getBoundingClientRect(),n=e.clientX-a.left,i=e.clientY-a.top,u=-e.deltaY>0?1.1:1/1.1,c=t.current.transform,l=c.k*u;if(l<.01||l>10)return;let g=c.k*u,b=n-(n-c.x)*u,v=i-(i-c.y)*u;t.current.transform={k:g,x:b,y:v},_();},[_]),Be=a((e,a)=>{let n=e.touches[0];if(n){let i={clientX:n.clientX,clientY:n.clientY};a(i);}},"convertTouchToMouseEvent"),Jt=useCallback(e=>{Be(e,Ee);},[Ee]),Fe=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.preventDefault(),e.stopPropagation()),t.current.mustBeStoppedPropagation=false,Be(e,xe);},[xe]),Kt=useCallback(e=>{Be(e,ze);},[ze]);return useImperativeHandle(H,()=>({zoomToFit:ye,addNodes:Ke,removeNodes:Qe}),[ye,Ke,Qe]),useEffect(()=>{let e=T.current,{width:a,height:n}=t.current;if(!e)return;qt(),Z(true);let i=a/2,s=n/2,u=j.nodeSizeBase,c=u/2,l=u*2.5;M.current&&M.current.stop();let g=M.current=forceSimulation(X).force("link",forceLink(G).id(b=>b.id).distance(l).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(i,s).strength(.05)).force("collide",forceCollide().radius(c*2).iterations(2).strength(1)).velocityDecay(.6);return ()=>{g.stop();}},[X,G]),useLayoutEffect(()=>{let e=T.current;e&&(t.current.width=o*Se,t.current.height=d*Se,e.width=t.current.width,e.height=t.current.height);},[o,d]),useEffect(()=>{if(M.current){let e=M.current;e.on("tick",()=>{_();}),e.on("end",()=>{I&&(ye(0,20),setTimeout(()=>{Z(false);},200));});}I||_();},[X,G,I,_,ye]),useEffect(()=>{!X||!G||G.forEach(e=>{let a=typeof e.source=="object"?e.source:X.find(i=>i.id===e.source),n=typeof e.target=="object"?e.target:X.find(i=>i.id===e.target);!a||!n||(!a.neighbors&&(a.neighbors=[]),!n.neighbors&&(n.neighbors=[]),a.neighbors.push(n),n.neighbors.push(a),!a.links&&(a.links=[]),!n.links&&(n.links=[]),a.links.push(e),n.links.push(e));});},[X,G]),useEffect(()=>{y&&y.length>0&&V(Rr(y));},[y]),useEffect(()=>{let e=T.current;if(!(!e||typeof window>"u"))return e.addEventListener("wheel",je,{passive:false}),e.addEventListener("touchend",Fe,{passive:false}),()=>{e.removeEventListener("wheel",je),e.removeEventListener("touchend",Fe);}},[je,Fe]),jsxs(zr,{children:[(r||I)&&jsx(wt,{width:o,height:d}),jsx(jr,{ref:T,style:{width:o,height:d,display:r||I?"none":"block"},onMouseDown:Ee,onMouseMove:ze,onMouseUp:xe,onMouseLeave:xe,onClick:Zt,onTouchStart:Jt,onTouchMove:Kt})]})}),zr=styled.div`
48
48
  display: flex;
49
49
  align-items: center;
50
50
  justify-content: center;
51
51
  width: 100%;
52
52
  min-width: 0;
53
53
  position: relative;
54
- `,zr=styled.canvas``;Rr.displayName="Graph2D";var _i=w(({isActive:r,position:o,top:d=0,left:m=0,right:y,bottom:w,...h})=>jsx(Fr,{$isActive:r,$position:o,$top:d,$left:m,$right:y,$bottom:w,...h})),Fr=ur.div(({$isActive:r,$top:o,$left:d,$right:m,$bottom:y,$position:w,theme:h})=>`
54
+ `,jr=styled.canvas``;Er.displayName="Graph2D";var _i=w(({isActive:r,position:o,top:d=0,left:m=0,right:y,bottom:w,...h})=>jsx(Ar,{$isActive:r,$position:o,$top:d,$left:m,$right:y,$bottom:w,...h})),Ar=pr.div(({$isActive:r,$top:o,$left:d,$right:m,$bottom:y,$position:w,theme:h})=>`
55
55
  ${r?`
56
56
  position: ${w};
57
57
  z-index: 1000;
@@ -63,7 +63,7 @@ ${r?`
63
63
  `:""}
64
64
 
65
65
  min-width: 0;
66
- `);var St=a(({url:r})=>{let[o,d]=useState(1),[m,y]=useState(),w=Dt.useRef(null),h=Dt.useRef(null),D=a(()=>{d(B=>Math.min(B+.25,4));},"handleZoomIn");return jsxs("div",{ref:h,className:"h-full w-full flex flex-col",children:[jsxs("div",{className:"flex justify-center items-stretch p-5.5 gap-1 border-b border-gray-200 relative ",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"secondary",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:a(()=>{d(B=>Math.max(B-.25,.25));},"handleZoomOut"),disabled:o<=.25,p:5}),jsxs(mb,{py:5,px:8,children:[o*100,"%"]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(ma,{style:{width:14,height:14}}),onClick:D,disabled:o>=4,p:8})]}),jsx("div",{className:"h-full w-full overflow-auto flex items-center justify-center",children:jsx("img",{src:r,ref:w,alt:"image",className:"block w-auto max-w-none object-contain",style:{transition:"height 0.2s ease-in-out",marginInline:"auto",marginBlock:10,flexShrink:0,...m==="width"&&{width:`calc(${o*100}% - 20px)`},...m==="height"&&{height:`calc(${o*100}% - 20px)`}},onLoad:()=>{if(w.current&&h.current){let B=w.current.width,H=w.current.height,P=B<H?"height":"width";y(P);}}})})]})},"ImageDriver");var Ct=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full p-5.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var Oe=a(({url:r})=>{let[o,d]=useState(null),[m,y]=useState(false),[w,h]=useState(true),[D,L]=useState(null);return useEffect(()=>{y(true);},[]),useEffect(()=>{if(!m)return;a(async()=>{try{let H=await import('./PdfDriver-C7JM5PKK.mjs');d(()=>H.PdfDriver),h(!1);}catch(H){console.error("Failed to load PDF driver:",H),L("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[m]),m?w?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):D||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:D||"PDF viewer unavailable"})})}):jsx(o,{url:r}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var Nt=a(({url:r,extension:o})=>jsxs("a",{href:r,download:`file.${o}`,className:"text-blue-500 underline",children:["Download ",o.toUpperCase()," file"]}),"DownloadDriver");var Lt=50,Yr=1e4,Rt=a(({url:r,blob:o})=>{let d=useRef(null),[m,y]=useState(null),[w,h]=useState(true);return useEffect(()=>{a(async()=>{if(d.current)try{if(h(!0),y(null),!o&&r&&(o=await(await fetch(r)).blob()),!o){y("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(o.size/(1024*1024)>Lt){y(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Lt} \u041C\u0411)`);return}d.current.innerHTML="";let B=renderAsync(o,d.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),H=new Promise((P,I)=>setTimeout(()=>I(new Error("\u0420\u0435\u043D\u0434\u0435\u0440\u0438\u043D\u0433 DOCX \u0437\u0430\u0439\u043D\u044F\u0432 \u043D\u0430\u0434\u0442\u043E \u0431\u0430\u0433\u0430\u0442\u043E \u0447\u0430\u0441\u0443")),Yr));await Promise.race([B,H]),h(!1);}catch(L){y(L?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),h(false);}},"renderDocument")();},[r,o]),jsxs(Fragment,{children:[!!m&&!w&&jsx("div",{className:"text-red-500 p-5",children:m}),w&&jsx("div",{className:"flex items-center justify-center p-5",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:d,className:"w-full h-full overflow-auto"})]})},"DocxDriver");var Ur=a(r=>({js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",html:"html",css:"css",scss:"scss",py:"python",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",rb:"ruby",go:"go",rs:"rust",swift:"swift",kt:"kotlin",xml:"xml",yaml:"yaml",yml:"yaml",md:"markdown",sql:"sql",sh:"bash",bash:"bash",txt:"text"})[r]||"text","getLanguageFromExtension"),Et=a(({url:r,extension:o})=>{let[d,m]=useState(""),[y,w]=useState(true),[h,D]=useState(null);if(useEffect(()=>{a(async()=>{try{w(!0),D(null);let P=await fetch(r);if(!P.ok)throw new Error(`Failed to load file: ${P.statusText}`);let I=await P.text();m(I);}catch(P){D(P instanceof Error?P.message:"Failed to load text content");}finally{w(false);}},"loadTextContent")();},[r]),y)return jsx("div",{className:"flex items-center justify-center p-8",children:jsx("div",{className:"text-gray-500",children:"Loading text content..."})});if(h)return jsx("div",{className:"flex items-center justify-center p-8",children:jsxs("div",{className:"text-red-500",children:["Error: ",h]})});let L=Ur(o);return jsx("div",{className:"h-full w-full overflow-auto",children:L!=="text"?jsx(Prism,{className:"min-h-full! m-0! py-0!",language:L,style:darcula,showLineNumbers:true,wrapLines:true,children:d}):jsx("pre",{className:"whitespace-pre-wrap p-4 text-sm font-mono bg-gray-50 min-h-full",children:d})})},"TextDriver");var jt=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full",children:jsx("video",{controls:true,src:r,className:"w-full max-h-full"})}),"VideoDriver");var Bt=memo(a(function({extension:o,blob:d,path:m,buffer:y,not_supported_message:w=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:o,blob:d,path:m,buffer:y});let h=o.toLocaleLowerCase().trim(),D;if(m?D=m:d&&(D=URL.createObjectURL(d)),D){if(["jpeg","jpg","png","gif","bmp","webp"].includes(h))return jsx(St,{url:D});if(["mp3","wav","ogg","flac"].includes(h))return jsx(Ct,{url:D});if(["mp4","webm"].includes(h))return jsx(jt,{url:D});if(o==="pdf")return jsx(Oe,{url:D});if(["xlsx","pptx"].includes(h))return jsx(Nt,{url:D,extension:h});if(["txt","js","jsx","ts","tsx","json","html","css","scss","py","java","cpp","c","cs","php","rb","go","rs","swift","kt","xml","yaml","yml","md","sql","sh","bash"].includes(h))return jsx(Et,{url:D,extension:h})}return h==="docx"?jsx(Rt,{url:D,blob:d}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(mb,{className:"mx-5",children:jsx(Wa,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:w})})})},"Driver"));var Ws=a(r=>jsx("div",{className:"h-full w-full",children:jsx(Bt,{...r})}),"FileViewer");var $t=250,ec=a(({text:r,speed:o=50,onDone:d,markdown:m=false,markdownComponents:y={},className:w,...h})=>{let[D,L]=useState(""),B=useRef(null),H=useRef(null);return useEffect(()=>{let P=false;if(o>0){L(""),B.current=performance.now();let I=a(Z=>{if(P||!B.current)return;let t=Z-B.current,X=t/o>$t?o/2:o,G=t/o>$t?1.5:1,k=Math.floor(t/X*G);if(k>=r.length){L(r),P=true,d?.();return}L(r.slice(0,k)),H.current=requestAnimationFrame(I);},"tick");H.current=requestAnimationFrame(I);}else L(r),d?.();return ()=>{H.current&&cancelAnimationFrame(H.current);}},[r,o,d]),m?jsx("div",{className:w,children:jsx(eo,{remarkPlugins:[to],components:y,...h,children:D})}):jsx(Wa,{className:w,...h,children:D})},"Typewriter");var io={timeout:2e3,message:"Copied!"},dc=a(({text:r,children:o,format:d="text/plain",tooltip:m})=>{let[y,w]=useState(false),h=useRef(null),D={...io,...m},L=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):ro(r,{format:d}),w(true),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>w(false),D.timeout);},"handleCopy");return useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]),jsx(yb,{onMouseLeave:()=>w(false),className:y?"visible":"hidden",content:D.message,children:o({copy:L})})},"CopyToClipboard");var Ot=a(r=>new Date(r?Array.isArray(r)?r[1]||r[0]||new Date:r:new Date),"getInitValue"),Ne=a((r,o)=>{let d;if(o){let y=parse(r||"",o,new Date);if(isValid(y)&&getYear(y)>=1970)return y}let m=new Date(r||"");return isNaN(m.getTime())?d:m},"parseDate"),yo=a((r,o)=>{let d=r?Ne(r,o):void 0;return d&&o?format(d,o):r},"renderDate"),Dc=a(({value:r,range:o,inline:d=false,minDate:m=new Date(getYear(new Date)-5,0,1),maxDate:y=new Date(getYear(new Date)+5,11,31),format:w="dd.MM.yyyy",onChange:h,...D})=>{let[L,B]=useState(getMonth(Ot(r))),[H,P]=useState(getYear(Ot(r))),I=useMemo(()=>{if(r){if(Array.isArray(r)){let t=Ne(r[0],w),X=Ne(r[1],w);return [t,X]}return Ne(r,w)}},[r]),Z=useCallback(t=>{if(o){let X=!!(I&&Array.isArray(I)&&I[0]),G=!!(I&&Array.isArray(I)&&I[1]);!X||X&&G?h?.([t.toString(),""]):X&&!G&&(t<I[0]?h?.([t.toString(),I[0].toString()]):h?.([I[0].toString(),t.toString()]));}else h?.(t.toString());},[o,I,h]);return d?jsx(Ht,{month:L,year:H,minDate:m,maxDate:y,selectedDate:I,onSelectDate:Z,onChangeMonth:B,onChangeYear:P}):o?jsx(bo,{range:true,value:r,onChange:h,...D}):jsx(vo,{value:r,onChange:h,minDate:m,maxDate:y,month:L,year:H,selectedDate:I,onChangeMonth:B,onChangeYear:P,onSelectDate:Z,formatStr:w,...D})},"DatePicker"),bo=a(({minDate:r,maxDate:o,value:d,onChange:m})=>null,"DatePickerGroupInput"),vo=a(({placeholder:r,value:o,onChange:d,inputProps:m,...y$1})=>{let[w,h]=useState(false),D=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:w,onClickOutside:()=>h(false),content:jsx(mb,{children:jsx(Ht,{...y$1})}),containerStyle:{zIndex:`${D.zIndex.popover}`},children:jsx("div",{onClick:()=>h(true),children:jsx(ib,{...m,placeholder:r,value:yo(o,y$1.formatStr),onChange:L=>d?.(L.target.value)})})})},"DatePickerInput"),Ht=a(({month:r,year:o,selectedDate:d,minDate:m,maxDate:y,onSelectDate:w,onChangeMonth:h,onChangeYear:D})=>{let L=useMemo(()=>new Array(12).fill(null).map((k,V)=>{let T=new Date(0,V);return {value:V+1,inputDisplay:format(T,"MMMM")}}),[]),B=useMemo(()=>{let k=getYear(m),T=getYear(y)-k+1;return new Array(T).fill(null).map((M,Q)=>{let te=k+Q;return {value:te,inputDisplay:te.toString()}})},[m,y]),H$1=useMemo(()=>new Array(7).fill(null).map((k,V)=>{let T=startOfWeek(new Date,{weekStartsOn:V});return format(T,"EEE")}),[]),P=useMemo(()=>{let k=getWeeksInMonth(new Date(o,r)),V=startOfMonth(new Date(o,r)),T=previousMonday(V),M=differenceInDays(V,T);return new Array(k*7).fill(null).map((Q,te)=>new Date(o,r,te-M+1))},[r,o]),I=useCallback(()=>{r===0?(D(o-1),h(11)):h(r-1);},[r,o]),Z=useCallback(()=>{r===11?(D(o+1),h(0)):h(r+1);},[r,o]),t=useMemo(()=>m?!(o<getYear(m)||o===getYear(m)&&r<=getMonth(m)):true,[r,o,m]),X=useMemo(()=>y?!(o>getYear(y)||o===getYear(y)&&r>=getMonth(y)):true,[r,o,y]),G$1=useCallback(k=>{k.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:G$1,children:[jsxs("div",{className:"flex justify-center items-center gap-2 pb-3",children:[t&&jsx(z,{size:"small",variant:"empty",icon:jsx(G,{}),onClick:I}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(gb,{placeholder:"",hasBorder:false,selected:r+1,options:L,onSelect:k=>h(k-1),maxWidth:150,maxHeight:300}),jsx(gb,{placeholder:"",hasBorder:false,selected:o,options:B,onSelect:k=>D(k),maxWidth:100,maxHeight:300})]}),X&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:Z})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:H$1.map(k=>jsx("div",{className:"text-center",children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:P.map(k=>{let V=getMonth(k)===r,T=format(k,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),M=d&&(Array.isArray(d)&&(d[0]&&format(k,"yyyy-MM-dd")===format(d[0],"yyyy-MM-dd")||d[1]&&format(k,"yyyy-MM-dd")===format(d[1],"yyyy-MM-dd"))||!Array.isArray(d)&&format(k,"yyyy-MM-dd")===format(d,"yyyy-MM-dd")),Q=d&&Array.isArray(d)&&d[0]&&d[1]&&k>d[0]&&k<d[1],te=m&&k<m||y&&k>y||!V;return jsx(wo,{date:k,isCurrentMonth:V,isCurrentDay:T,isSelected:!!M,isInRange:!!Q,isDisabled:!!te,onSelectDate:w},k.toISOString())})})]})},"DatePickerCalendar"),wo=a(({date:r,isCurrentMonth:o,isCurrentDay:d,isSelected:m,isInRange:y,isDisabled:w,onSelectDate:h})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${w?"text-gray-400 cursor-not-allowed":m?"bg-blue-500 text-white":y?"bg-blue-100":d?"text-blue-500":o?"text-black":"text-gray-400"} ${w?"":m?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(L=>{w||h(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");var Do=a(r=>{switch(r){case "primary":return "bg-blue-100 border-blue-200 dark:bg-blue-800/10 dark:border-blue-900";case "error":return "bg-red-100 border-red-200 dark:bg-red-800/10 dark:border-red-900";case "warning":return "bg-yellow-100 border-yellow-200 dark:bg-yellow-800/10 dark:border-yellow-900";case "success":return "bg-teal-100 border-teal-200 dark:bg-teal-800/10 dark:border-teal-900";case "default":default:return "bg-white border border-gray-200 dark:bg-neutral-800 dark:border-neutral-700"}},"getColorStyle"),Po=a(r=>{switch(r){case "primary":return "text-blue-800 dark:text-blue-500";case "error":return "text-red-800 dark:text-red-500";case "warning":return "text-yellow-800 dark:text-yellow-500";case "success":return "text-teal-800 dark:text-teal-500";case "default":default:return "text-gray-800 dark:text-white"}},"getTextColor"),So=a(r=>{switch(r){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),_t=a(({id:r,color:o="default",message:d,duration:m,transitionDirection:y,cancelable:w=true,onClose:h})=>{let[D,L]=useState(false),[B,H]=useState(false),P=useRef(null),I=useCallback(()=>{L(true),P.current=setTimeout(()=>{h(r);},300);},[r,h]);return useEffect(()=>{if(H(true),m&&m<1/0){let Z=setTimeout(()=>{I();},m);return ()=>clearTimeout(Z)}},[m,I]),useEffect(()=>()=>{P.current&&clearTimeout(P.current);},[]),jsx("div",{className:`max-w-xs
66
+ `);var Mt=a(({url:r})=>{let[o,d]=useState(1),[m,y]=useState(),w=Pt.useRef(null),h=Pt.useRef(null),D=a(()=>{d(B=>Math.min(B+.25,4));},"handleZoomIn");return jsxs("div",{ref:h,className:"h-full w-full flex flex-col",children:[jsxs("div",{className:"flex justify-center items-stretch p-5.5 gap-1 border-b border-gray-200 relative ",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"secondary",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:a(()=>{d(B=>Math.max(B-.25,.25));},"handleZoomOut"),disabled:o<=.25,p:5}),jsxs(mb,{py:5,px:8,children:[o*100,"%"]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(ma,{style:{width:14,height:14}}),onClick:D,disabled:o>=4,p:8})]}),jsx("div",{className:"h-full w-full overflow-auto flex items-center justify-center",children:jsx("img",{src:r,ref:w,alt:"image",className:"block w-auto max-w-none object-contain",style:{transition:"height 0.2s ease-in-out",marginInline:"auto",marginBlock:10,flexShrink:0,...m==="width"&&{width:`calc(${o*100}% - 20px)`},...m==="height"&&{height:`calc(${o*100}% - 20px)`}},onLoad:()=>{if(w.current&&h.current){let B=w.current.width,H=w.current.height,P=B<H?"height":"width";y(P);}}})})]})},"ImageDriver");var Tt=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full p-5.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var Oe=a(({url:r})=>{let[o,d]=useState(null),[m,y]=useState(false),[w,h]=useState(true),[D,L]=useState(null);return useEffect(()=>{y(true);},[]),useEffect(()=>{if(!m)return;a(async()=>{try{let H=await import('./PdfDriver-FOHJU5XC.mjs');d(()=>H.PdfDriver),h(!1);}catch(H){console.error("Failed to load PDF driver:",H),L("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[m]),m?w?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):D||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:D||"PDF viewer unavailable"})})}):jsx(o,{url:r}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var It=a(({url:r,extension:o})=>jsxs("a",{href:r,download:`file.${o}`,className:"text-blue-500 underline",children:["Download ",o.toUpperCase()," file"]}),"DownloadDriver");var Rt=50,Xr=1e4,Et=a(({url:r,blob:o})=>{let d=useRef(null),[m,y]=useState(null),[w,h]=useState(true);return useEffect(()=>{a(async()=>{if(d.current)try{if(h(!0),y(null),!o&&r&&(o=await(await fetch(r)).blob()),!o){y("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(o.size/(1024*1024)>Rt){y(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Rt} \u041C\u0411)`);return}d.current.innerHTML="";let B=renderAsync(o,d.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),H=new Promise((P,I)=>setTimeout(()=>I(new Error("\u0420\u0435\u043D\u0434\u0435\u0440\u0438\u043D\u0433 DOCX \u0437\u0430\u0439\u043D\u044F\u0432 \u043D\u0430\u0434\u0442\u043E \u0431\u0430\u0433\u0430\u0442\u043E \u0447\u0430\u0441\u0443")),Xr));await Promise.race([B,H]),h(!1);}catch(L){y(L?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),h(false);}},"renderDocument")();},[r,o]),jsxs(Fragment,{children:[!!m&&!w&&jsx("div",{className:"text-red-500 p-5",children:m}),w&&jsx("div",{className:"flex items-center justify-center p-5",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:d,className:"w-full h-full overflow-auto"})]})},"DocxDriver");var Zr=a(r=>({js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",html:"html",css:"css",scss:"scss",py:"python",java:"java",cpp:"cpp",c:"c",cs:"csharp",php:"php",rb:"ruby",go:"go",rs:"rust",swift:"swift",kt:"kotlin",xml:"xml",yaml:"yaml",yml:"yaml",md:"markdown",sql:"sql",sh:"bash",bash:"bash",txt:"text"})[r]||"text","getLanguageFromExtension"),zt=a(({url:r,extension:o})=>{let[d,m]=useState(""),[y,w]=useState(true),[h,D]=useState(null);if(useEffect(()=>{a(async()=>{try{w(!0),D(null);let P=await fetch(r);if(!P.ok)throw new Error(`Failed to load file: ${P.statusText}`);let I=await P.text();m(I);}catch(P){D(P instanceof Error?P.message:"Failed to load text content");}finally{w(false);}},"loadTextContent")();},[r]),y)return jsx("div",{className:"flex items-center justify-center p-8",children:jsx("div",{className:"text-gray-500",children:"Loading text content..."})});if(h)return jsx("div",{className:"flex items-center justify-center p-8",children:jsxs("div",{className:"text-red-500",children:["Error: ",h]})});let L=Zr(o);return jsx("div",{className:"h-full w-full overflow-auto",children:L!=="text"?jsx(Prism,{className:"min-h-full! m-0! py-0!",language:L,style:darcula,showLineNumbers:true,wrapLines:true,children:d}):jsx("pre",{className:"whitespace-pre-wrap p-4 text-sm font-mono bg-gray-50 min-h-full",children:d})})},"TextDriver");var Bt=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full",children:jsx("video",{controls:true,src:r,className:"w-full max-h-full"})}),"VideoDriver");var Ft=memo(a(function({extension:o,blob:d,path:m,buffer:y,not_supported_message:w=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:o,blob:d,path:m,buffer:y});let h=o.toLocaleLowerCase().trim(),D;if(m?D=m:d&&(D=URL.createObjectURL(d)),D){if(["jpeg","jpg","png","gif","bmp","webp"].includes(h))return jsx(Mt,{url:D});if(["mp3","wav","ogg","flac"].includes(h))return jsx(Tt,{url:D});if(["mp4","webm"].includes(h))return jsx(Bt,{url:D});if(o==="pdf")return jsx(Oe,{url:D});if(["xlsx","pptx"].includes(h))return jsx(It,{url:D,extension:h});if(["txt","js","jsx","ts","tsx","json","html","css","scss","py","java","cpp","c","cs","php","rb","go","rs","swift","kt","xml","yaml","yml","md","sql","sh","bash"].includes(h))return jsx(zt,{url:D,extension:h})}return h==="docx"?jsx(Et,{url:D,blob:d}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(mb,{className:"mx-5",children:jsx(Wa,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:w})})})},"Driver"));var Ws=a(r=>jsx("div",{className:"h-full w-full",children:jsx(Ft,{...r})}),"FileViewer");var Ot=250,ec=a(({text:r,speed:o=50,onDone:d,markdown:m=false,markdownComponents:y={},className:w,...h})=>{let[D,L]=useState(""),B=useRef(null),H=useRef(null);return useEffect(()=>{let P=false;if(o>0){L(""),B.current=performance.now();let I=a(Z=>{if(P||!B.current)return;let t=Z-B.current,X=t/o>Ot?o/2:o,G=t/o>Ot?1.5:1,k=Math.floor(t/X*G);if(k>=r.length){L(r),P=true,d?.();return}L(r.slice(0,k)),H.current=requestAnimationFrame(I);},"tick");H.current=requestAnimationFrame(I);}else L(r),d?.();return ()=>{H.current&&cancelAnimationFrame(H.current);}},[r,o,d]),m?jsx("div",{className:w,children:jsx(to,{remarkPlugins:[ro],components:y,...h,children:D})}):jsx(Wa,{className:w,...h,children:D})},"Typewriter");var so={timeout:2e3,message:"Copied!"},dc=a(({text:r,children:o,format:d="text/plain",tooltip:m})=>{let[y,w]=useState(false),h=useRef(null),D={...so,...m},L=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):oo(r,{format:d}),w(true),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>w(false),D.timeout);},"handleCopy");return useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]),jsx(yb,{onMouseLeave:()=>w(false),className:y?"visible":"hidden",content:D.message,children:o({copy:L})})},"CopyToClipboard");var Ht=a(r=>new Date(r?Array.isArray(r)?r[1]||r[0]||new Date:r:new Date),"getInitValue"),Ne=a((r,o)=>{let d;if(o){let y=parse(r||"",o,new Date);if(isValid(y)&&getYear(y)>=1970)return y}let m=new Date(r||"");return isNaN(m.getTime())?d:m},"parseDate"),yo=a((r,o)=>{let d=r?Ne(r,o):void 0;return d&&o?format(d,o):r},"renderDate"),Dc=a(({value:r,range:o,inline:d=false,minDate:m=new Date(getYear(new Date)-5,0,1),maxDate:y=new Date(getYear(new Date)+5,11,31),format:w="dd.MM.yyyy",onChange:h,...D})=>{let[L,B]=useState(getMonth(Ht(r))),[H,P]=useState(getYear(Ht(r))),I=useMemo(()=>{if(r){if(Array.isArray(r)){let t=Ne(r[0],w),X=Ne(r[1],w);return [t,X]}return Ne(r,w)}},[r]),Z=useCallback(t=>{if(o){let X=!!(I&&Array.isArray(I)&&I[0]),G=!!(I&&Array.isArray(I)&&I[1]);!X||X&&G?h?.([t.toString(),""]):X&&!G&&(t<I[0]?h?.([t.toString(),I[0].toString()]):h?.([I[0].toString(),t.toString()]));}else h?.(t.toString());},[o,I,h]);return d?jsx(Wt,{month:L,year:H,minDate:m,maxDate:y,selectedDate:I,onSelectDate:Z,onChangeMonth:B,onChangeYear:P}):o?jsx(bo,{range:true,value:r,onChange:h,...D}):jsx(vo,{value:r,onChange:h,minDate:m,maxDate:y,month:L,year:H,selectedDate:I,onChangeMonth:B,onChangeYear:P,onSelectDate:Z,formatStr:w,...D})},"DatePicker"),bo=a(({minDate:r,maxDate:o,value:d,onChange:m})=>null,"DatePickerGroupInput"),vo=a(({placeholder:r,value:o,onChange:d,inputProps:m,...y$1})=>{let[w,h]=useState(false),D=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:w,onClickOutside:()=>h(false),content:jsx(mb,{children:jsx(Wt,{...y$1})}),containerStyle:{zIndex:`${D.zIndex.popover}`},children:jsx("div",{onClick:()=>h(true),children:jsx(ib,{...m,placeholder:r,value:yo(o,y$1.formatStr),onChange:L=>d?.(L.target.value)})})})},"DatePickerInput"),Wt=a(({month:r,year:o,selectedDate:d,minDate:m,maxDate:y,onSelectDate:w,onChangeMonth:h,onChangeYear:D})=>{let L=useMemo(()=>new Array(12).fill(null).map((k,V)=>{let T=new Date(0,V);return {value:V+1,inputDisplay:format(T,"MMMM")}}),[]),B=useMemo(()=>{let k=getYear(m),T=getYear(y)-k+1;return new Array(T).fill(null).map((M,Q)=>{let te=k+Q;return {value:te,inputDisplay:te.toString()}})},[m,y]),H$1=useMemo(()=>new Array(7).fill(null).map((k,V)=>{let T=startOfWeek(new Date,{weekStartsOn:V});return format(T,"EEE")}),[]),P=useMemo(()=>{let k=getWeeksInMonth(new Date(o,r)),V=startOfMonth(new Date(o,r)),T=previousMonday(V),M=differenceInDays(V,T);return new Array(k*7).fill(null).map((Q,te)=>new Date(o,r,te-M+1))},[r,o]),I=useCallback(()=>{r===0?(D(o-1),h(11)):h(r-1);},[r,o]),Z=useCallback(()=>{r===11?(D(o+1),h(0)):h(r+1);},[r,o]),t=useMemo(()=>m?!(o<getYear(m)||o===getYear(m)&&r<=getMonth(m)):true,[r,o,m]),X=useMemo(()=>y?!(o>getYear(y)||o===getYear(y)&&r>=getMonth(y)):true,[r,o,y]),G$1=useCallback(k=>{k.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:G$1,children:[jsxs("div",{className:"flex justify-center items-center gap-2 pb-3",children:[t&&jsx(z,{size:"small",variant:"empty",icon:jsx(G,{}),onClick:I}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(gb,{placeholder:"",hasBorder:false,selected:r+1,options:L,onSelect:k=>h(k-1),maxWidth:150,maxHeight:300}),jsx(gb,{placeholder:"",hasBorder:false,selected:o,options:B,onSelect:k=>D(k),maxWidth:100,maxHeight:300})]}),X&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:Z})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:H$1.map(k=>jsx("div",{className:"text-center",children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:P.map(k=>{let V=getMonth(k)===r,T=format(k,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),M=d&&(Array.isArray(d)&&(d[0]&&format(k,"yyyy-MM-dd")===format(d[0],"yyyy-MM-dd")||d[1]&&format(k,"yyyy-MM-dd")===format(d[1],"yyyy-MM-dd"))||!Array.isArray(d)&&format(k,"yyyy-MM-dd")===format(d,"yyyy-MM-dd")),Q=d&&Array.isArray(d)&&d[0]&&d[1]&&k>d[0]&&k<d[1],te=m&&differenceInDays(k,m)<0||y&&differenceInDays(k,y)>0||!V;return jsx(wo,{date:k,isCurrentMonth:V,isCurrentDay:T,isSelected:!!M,isInRange:!!Q,isDisabled:!!te,onSelectDate:w},k.toISOString())})})]})},"DatePickerCalendar"),wo=a(({date:r,isCurrentMonth:o,isCurrentDay:d,isSelected:m,isInRange:y,isDisabled:w,onSelectDate:h})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${w?"text-gray-400 cursor-not-allowed":m?"bg-blue-500 text-white":y?"bg-blue-100":d?"text-blue-500":o?"text-black":"text-gray-400"} ${w?"":m?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(L=>{w||h(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");var Do=a(r=>{switch(r){case "primary":return "bg-blue-100 border-blue-200 dark:bg-blue-800/10 dark:border-blue-900";case "error":return "bg-red-100 border-red-200 dark:bg-red-800/10 dark:border-red-900";case "warning":return "bg-yellow-100 border-yellow-200 dark:bg-yellow-800/10 dark:border-yellow-900";case "success":return "bg-teal-100 border-teal-200 dark:bg-teal-800/10 dark:border-teal-900";case "default":default:return "bg-white border border-gray-200 dark:bg-neutral-800 dark:border-neutral-700"}},"getColorStyle"),Po=a(r=>{switch(r){case "primary":return "text-blue-800 dark:text-blue-500";case "error":return "text-red-800 dark:text-red-500";case "warning":return "text-yellow-800 dark:text-yellow-500";case "success":return "text-teal-800 dark:text-teal-500";case "default":default:return "text-gray-800 dark:text-white"}},"getTextColor"),So=a(r=>{switch(r){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),Gt=a(({id:r,color:o="default",message:d,duration:m,transitionDirection:y,cancelable:w=true,onClose:h})=>{let[D,L]=useState(false),[B,H]=useState(false),P=useRef(null),I=useCallback(()=>{L(true),P.current=setTimeout(()=>{h(r);},300);},[r,h]);return useEffect(()=>{if(H(true),m&&m<1/0){let Z=setTimeout(()=>{I();},m);return ()=>clearTimeout(Z)}},[m,I]),useEffect(()=>()=>{P.current&&clearTimeout(P.current);},[]),jsx("div",{className:`max-w-xs
67
67
  border
68
68
  w-full
69
69
  text-sm
@@ -73,6 +73,6 @@ ${r?`
73
73
  duration-300
74
74
  ${D||!B?"opacity-0":"opacity-100"}
75
75
  ${B?"translate-y-0":So(y)}
76
- ${Do(o)} ${Po(o)}`,children:jsxs("div",{className:"flex p-4 ",children:[d,w&&jsx("div",{className:"ms-auto",children:jsx("button",{type:"button",className:"inline-flex shrink-0 justify-center items-center size-5 rounded-lg opacity-50 hover:opacity-100 focus:outline-hidden focus:opacity-100 cursor-pointer","aria-label":"Close",onClick:I,children:jsxs("svg",{className:"shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]})})})]})})},"Toast");var Co=a((r,o)=>{switch(r){case "top-right":return `top-${o} right-${o}`;case "top-left":return `top-${o} left-${o}`;case "bottom-right":return `bottom-${o} right-${o}`;case "bottom-left":return `bottom-${o} left-${o}`;default:return `top-${o} right-${o}`}},"getPosition"),Bc=a(({items:r,onClose:o,position:d="top-right",offset:m=4})=>{let y=useMemo(()=>d.startsWith("top")?"top":"bottom",[d]);return jsx("div",{className:`fixed flex min-w-0 max-w-xs w-full flex-col z-50 gap-2 ${Co(d,m)}`,children:r.map(w=>jsx(_t,{transitionDirection:y,...w,onClose:o},w.id))})},"ToastsList");
77
- export{mi as Container,dc as CopyToClipboard,Dc as DatePicker,Ht as DatePickerCalendar,Ws as FileViewer,_i as FullscreenCard,Rr as Graph2D,ei as PageContent,Ua as PageLayout,ar as Styled,Qt as StyledContainer,rr as StyledMain,ai as SubNav,Bc as ToastsList,ec as Typewriter};//# sourceMappingURL=index.mjs.map
76
+ ${Do(o)} ${Po(o)}`,children:jsxs("div",{className:"flex p-4 ",children:[d,w&&jsx("div",{className:"ms-auto",children:jsx("button",{type:"button",className:"inline-flex shrink-0 justify-center items-center size-5 rounded-lg opacity-50 hover:opacity-100 focus:outline-hidden focus:opacity-100 cursor-pointer","aria-label":"Close",onClick:I,children:jsxs("svg",{className:"shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]})})})]})})},"Toast");var Co=a((r,o)=>{switch(r){case "top-right":return `top-${o} right-${o}`;case "top-left":return `top-${o} left-${o}`;case "bottom-right":return `bottom-${o} right-${o}`;case "bottom-left":return `bottom-${o} left-${o}`;default:return `top-${o} right-${o}`}},"getPosition"),Bc=a(({items:r,onClose:o,position:d="top-right",offset:m=4})=>{let y=useMemo(()=>d.startsWith("top")?"top":"bottom",[d]);return jsx("div",{className:`fixed flex min-w-0 max-w-xs w-full flex-col z-50 gap-2 ${Co(d,m)}`,children:r.map(w=>jsx(Gt,{transitionDirection:y,...w,onClose:o},w.id))})},"ToastsList");
77
+ export{mi as Container,dc as CopyToClipboard,Dc as DatePicker,Wt as DatePickerCalendar,Ws as FileViewer,_i as FullscreenCard,Er as Graph2D,ei as PageContent,Ua as PageLayout,ir as Styled,er as StyledContainer,or as StyledMain,ai as SubNav,Bc as ToastsList,ec as Typewriter};//# sourceMappingURL=index.mjs.map
78
78
  //# sourceMappingURL=index.mjs.map