@cyber-harbour/ui 2.0.40 → 2.0.42

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 as z$1,Pa,mb,ma,Wa,yb,y,ib,G,gb,H}from'./chunk-JJ6PGR3K.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-JJ6PGR3K.mjs';import nr,{styled,useTheme}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import xt,{forwardRef,useState,useRef,useMemo,useCallback,useImperativeHandle,useEffect,useLayoutEffect,memo}from'react';import pr from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import rr 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 _r from'react-markdown';import qr from'remark-gfm';import Vr 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 zi=a(({children:r,className:n})=>jsx(Gt,{className:n,children:r}),"PageLayout"),Gt=styled.div`
1
+ import {a,w,x,u,c,l,z,Pa,mb,ma,Wa,yb,y,ib,G,gb,H}from'./chunk-FLNUFTXX.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-FLNUFTXX.mjs';import nr,{styled,useTheme}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import kt,{forwardRef,useState,useRef,useMemo,useCallback,useImperativeHandle,useEffect,useLayoutEffect,memo}from'react';import pr from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import rr 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 _r from'react-markdown';import qr from'remark-gfm';import Vr 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 zi=a(({children:r,className:n})=>jsx(Gt,{className:n,children:r}),"PageLayout"),Gt=styled.div`
2
2
  display: grid;
3
3
  min-height: 100dvh;
4
4
  position: relative;
@@ -44,7 +44,7 @@ import {a,w,x,u,c,l,z as z$1,Pa,mb,ma,Wa,yb,y,ib,G,gb,H}from'./chunk-JJ6PGR3K.mj
44
44
  display: flex;
45
45
  align-items: center;
46
46
  justify-content: center;
47
- `,ar=a(({width:r=280,height:n=280})=>{let u=useTheme();return jsx(ir,{children:jsxs(rr,{foregroundColor:u.contentLoader.foreground,backgroundColor:u.contentLoader.background,width:r,height:n,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"),yt=ar;var De=typeof window<"u"&&window.devicePixelRatio||1;function Dr(r){return !r||r.length===0?[]:r.map(n=>{let u=new Image;u.src=n.img;let m=new Image;return m.src=n.hoverImg,{...n,normalImg:u,hoverImg:m}})}a(Dr,"prepareButtonImages");var z={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},Pr=forwardRef(({loading:r,width:n,height:u,graphData:m,buttons:y=[],onNodeClick:x,onBackgroundClick:h,onNodeHover:k,onLinkHover:j,onLinkClick:O},Y)=>{let S=useTheme(),[E,re]=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:n*De,height:u*De,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:_,links:M}=useMemo(()=>pr(m),[m]),[A,U]=useState([]),R=useRef(null),P=useRef(null),Z=useRef(null),At=scaleOrdinal(schemeCategory10),Ot=useCallback(()=>{if(!R.current)return false;try{let e=R.current.getContext("2d");return e?(Z.current=e,!0):(console.error("Failed to get 2D context"),!1)}catch(e){return console.error("Error initializing Canvas 2D context:",e),false}},[]),Q=useCallback(()=>P.current?P.current.nodes():null,[]),he=useCallback(()=>{if(!P.current)return null;let e=P.current.force("link");return e?e.links():null},[]),Xe=useCallback(e=>{e.save(),e.setTransform(1,0,0,1,0,0);let{width:i,height:o}=t.current,a=z.gridSpacing,s=z.dotSize;e.fillStyle=S.graph2D.grid.dotColor;for(let d=a/2;d<=i;d+=a)for(let c=a/2;c<=o;c+=a)e.beginPath(),e.arc(d,c,s,0,2*Math.PI),e.fill();e.restore();},[S.graph2D.grid.dotColor,z.gridSpacing,z.dotSize]),$t=useCallback((e,i,o)=>{if(!e)return "";if(o.measureText(e).width<=i)return e;let s=e,d="...";for(;o.measureText(s+d).width>i&&s.length>0;)s=s.slice(0,-1);return s+d},[]),Ce=a(e=>{let o=Math.min(e,z.maxZoom)/z.maxZoom;return Math.max(z.fontSize*o,z.fontSize)},"calculateFontSize"),Ge=useCallback(e=>{let i=he(),o=Q();!i||i.length===0||!o||o.length===0||(e.lineWidth=.5,e.globalAlpha=1,i.forEach(a=>{let s=typeof a.source=="object"?a.source:o.find(ee=>ee.id===a.source),d=typeof a.target=="object"?a.target:o.find(ee=>ee.id===a.target);if(!s||!d)return;let c={x:s.x||0,y:s.y||0},l={x:d.x||0,y:d.y||0},f=l.x-c.x,g=l.y-c.y,w=Math.sqrt(f*f+g*g),T=f/w,C=g/w,$=z.nodeSizeBase/2,L=z.nodeSizeBase/2,B=4,p={x:c.x+T*$,y:c.y+C*$},D={x:l.x-T*(L+B),y:l.y-C*(L+B)},b={x:l.x-T*(L+1),y:l.y-C*(L+1)},H=t.current.highlightLinks.has(a),F=H?S.graph2D.link.highlighted:S.graph2D.link.normal,W=H?1.5:.5,q=c.x+(l.x-c.x)/2,ne=c.y+(l.y-c.y)/2,oe=Math.atan2(g,f);if(a.label){let ee=t.current.transform.k,ie=Ce(ee);e.font=`${ie}px Sans-Serif`;let tt=e.measureText(a.label).width,rt=10;e.beginPath(),e.moveTo(p.x,p.y);let nt=w/2-(tt+rt)/2,ot={x:c.x+T*nt,y:c.y+C*nt};e.lineTo(ot.x,ot.y),e.strokeStyle=F,e.lineWidth=W,e.stroke(),e.beginPath();let it=w/2+(tt+rt)/2,at={x:c.x+T*it,y:c.y+C*it};e.moveTo(at.x,at.y),e.lineTo(D.x,D.y),e.strokeStyle=F,e.lineWidth=W,e.stroke();}else e.beginPath(),e.moveTo(p.x,p.y),e.lineTo(D.x,D.y),e.strokeStyle=F,e.lineWidth=W,e.stroke();let pe=2;if(e.save(),e.translate(b.x,b.y),e.rotate(oe),e.beginPath(),e.moveTo(0,0),e.lineTo(-4,pe),e.lineTo(-4,0),e.lineTo(-4,-2),e.closePath(),e.fillStyle=F,e.fill(),e.restore(),a.label){let ee=t.current.transform.k,ie=Ce(ee);e.font=`${ie}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(q,ne),Math.abs(oe)>Math.PI/2?e.rotate(oe+Math.PI):e.rotate(oe),e.fillStyle=H?S.graph2D.link.highlightedTextColor:S.graph2D.link.textColor,e.fillText(a.label,0,0),e.restore();}}));},[z,S.graph2D.link]),_e=a((e,i,o,a,s,d,c)=>{try{if(d!=null){let l=s*.8;e.font=`${l}px sans-serif`,e.textBaseline="middle",e.textAlign="left";let f=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(d),g=e.measureText(f).width,w=s*.3,C=(s+w+g)/2;e.drawImage(i,o-C,a-s/2,s,s),e.fillStyle=c||"#99989C",e.fillText(f,o-C+s+w,a);}else e.drawImage(i,o-s/2,a-s/2,s,s);}catch(l){console.warn("Error rendering icon:",l);}},"drawIconWithOptionalCounter"),qe=useCallback((e,i)=>{if(!A||A.length===0||!e||!e.x||!e.y)return;let{x:o,y:a}=e,s=z.nodeSizeBase*z.nodeAreaFactor/2;i.save();let d=Math.min(A.length,8),c=Math.min(Math.PI*2/d,Math.PI);for(let l$1=0;l$1<d;l$1++){let f=l$1*c,g=(l$1+1)*c,w=t.current.hoveredButtonIndex===l$1;i.beginPath(),i.arc(o,a,s,f,g,false),i.lineTo(o,a),i.closePath(),i.lineWidth=1,i.strokeStyle=S.graph2D?.button?.stroke||"#FFFFFF",i.stroke(),i.fillStyle=w?S.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":S.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",i.fill();let T=s*.2,C=(f+g)/2,$=s-z.nodeSizeBase/2+T,L=o+Math.cos(C)*$,B=a+Math.sin(C)*$,p=A[l$1];if(p.loading){let D=T/2,b=T/12;i.save(),i.translate(L,B),i.rotate(t.current.spinnerAngle);for(let H=0;H<12;H++){let F=Math.PI*2*H/12,W=H/12,q=Math.cos(F)*D,ne=Math.sin(F)*D;i.beginPath(),i.fillStyle=l(S.graph2D?.button?.spinnerColor,W),i.arc(q,ne,b,0,Math.PI*2),i.fill();}i.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(G),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 D=w?p.hoverImg:p.normalImg,b=p.getCount?p.getCount(e):null;D.complete?_e(i,D,L,B,T,b,S.graph2D?.button?.textColor):D.onload=()=>{Z.current&&_e(i,D,L,B,T,b,S.graph2D?.button?.textColor);};}}i.restore();},[A,S.graph2D?.button]),Ve=useCallback(e=>{let i=Q();!i||i.length===0||(e.globalAlpha=1,i.forEach(o=>{let{x:a,y:s,color:d,fontColor:c,label:l}=o,f=t.current.highlightNodes.has(o)||o===t.current.hoveredNode||o===t.current.draggedNode,g=o===t.current.selectedNode,w=z.nodeSizeBase,T=z.nodeSizeBase/2;if(f&&!g){let C=z.nodeSizeBase*z.nodeAreaFactor*.75/2;e.beginPath(),e.arc(a,s,C,0,2*Math.PI,false),e.fillStyle=S.graph2D.ring.highlightFill,e.fill();}if(g)if(y&&y.length>0)qe(o,e);else {let C=z.nodeSizeBase*z.nodeAreaFactor/2;e.beginPath(),e.arc(a,s,C,0,2*Math.PI,false),e.fillStyle=S.graph2D.ring.selectionFill||S.graph2D.ring.highlightFill,e.fill();}if(e.beginPath(),e.arc(a,s,T,0,2*Math.PI),e.fillStyle=d||At(o.group||"0"),e.fill(),l){e.save(),e.translate(a,s);let C=t.current.transform.k,$=Ce(C),L=w*z.textPaddingFactor;e.font=`${$}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle=c||"#000";let B=$t(l,L,e);e.fillText(B,0,0),e.restore();}}));},[S.graph2D.ring,y,qe]),G=useCallback(()=>{let e=Z.current;e&&(e.clearRect(0,0,t.current.width,t.current.height),Xe(e),e.save(),e.setTransform(t.current.transform.k,0,0,t.current.transform.k,t.current.transform.x,t.current.transform.y),Ge(e),Ve(e),e.restore());},[Ge,Ve,Xe]),Ue=useCallback((e,i=[],o)=>{let a=he()||[],s=Q()||[];if(!P.current||!e.length)return;let{width:d,height:c}=t.current,l=o?.smoothAppearance??false,f=o?.transitionDuration??1e3,g=new Set(s.map(p=>p.id)),w=e.filter(p=>!g.has(p.id)),T=new Set(a.map(p=>`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`)),C=i.filter(p=>{let D=`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`;return !T.has(D)});if(w.length===0&&C.length===0)return;let $=[...s,...w],L=[...a,...C];l&&(w.forEach(p=>{let D=C.filter(b=>{let H=typeof b.source=="object"?b.source.id:b.source,F=typeof b.target=="object"?b.target.id:b.target;return H===p.id&&g.has(F)||F===p.id&&g.has(H)});if(D.length>0){let b=D[0],H=typeof b.source=="object"?b.source.id===p.id?b.target:b.source.id:b.source===p.id?b.target:b.source,F=$.find(W=>W.id===H);if(F&&F.x!==void 0&&F.y!==void 0){let W=30+Math.random()*20,q=Math.random()*Math.PI*2;p.x=F.x+Math.cos(q)*W,p.y=F.y+Math.sin(q)*W,p.vx=0,p.vy=0;}}else {let b=d/2,H=c/2,F=Math.min(d,c)/4,W=Math.random()*Math.PI*2;p.x=b+Math.cos(W)*(F*Math.random()),p.y=H+Math.sin(W)*(F*Math.random()),p.vx=0,p.vy=0;}}),s.forEach(p=>{p.fx=p.x,p.fy=p.y;})),P.current.nodes($);let B=P.current.force("link");B&&B.links(L),C.forEach(p=>{let D=typeof p.source=="object"?p.source:$.find(H=>H.id===p.source),b=typeof p.target=="object"?p.target:$.find(H=>H.id===p.target);!D||!b||(!D.neighbors&&(D.neighbors=[]),!b.neighbors&&(b.neighbors=[]),D.neighbors.push(b),b.neighbors.push(D),!D.links&&(D.links=[]),!b.links&&(b.links=[]),D.links.push(p),b.links.push(p));}),l?(P.current.alphaTarget(.3),P.current.alpha(.3),P.current.velocityDecay(.7),P.current.restart(),setTimeout(()=>{s.forEach(p=>{p.fx=void 0,p.fy=void 0;}),P.current?.alphaTarget(0),P.current?.alpha(.1),P.current?.velocityDecay(.6);},f)):P.current.alpha(.1).restart(),G();},[_,G]),Ze=useCallback(e=>{let i=Q(),o=he();if(!P.current||!e.length||!i||i.length===0||!o||o.length===0)return;let a=new Set(e);if(t.current.selectedNode&&t.current.selectedNode.id!==void 0&&a.has(t.current.selectedNode.id)&&(t.current.selectedNode=null),t.current.hoveredNode&&t.current.hoveredNode.id!==void 0&&a.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,f=typeof t.current.hoveredLink.target=="object"?t.current.hoveredLink.target.id:t.current.hoveredLink.target;(l!==void 0&&a.has(l)||f!==void 0&&a.has(f))&&(t.current.hoveredLink=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set);}t.current.draggedNode&&t.current.draggedNode.id!==void 0&&a.has(t.current.draggedNode.id)&&(t.current.draggedNode=null);let s=i.filter(l=>l.id!==void 0&&!a.has(l.id)),d=o.filter(l=>{let f=typeof l.source=="object"?l.source.id:l.source,g=typeof l.target=="object"?l.target.id:l.target;return f!==void 0&&!a.has(f)&&g!==void 0&&!a.has(g)});s.forEach(l=>{l.neighbors=[],l.links=[];}),d.forEach(l=>{let f=typeof l.source=="object"?l.source:s.find(w=>w.id===l.source),g=typeof l.target=="object"?l.target:s.find(w=>w.id===l.target);!f||!g||(f.neighbors=f.neighbors||[],g.neighbors=g.neighbors||[],f.neighbors.push(g),g.neighbors.push(f),f.links=f.links||[],g.links=g.links||[],f.links.push(l),g.links.push(l));}),P.current.nodes(s);let c=P.current.force("link");c&&c.links(d),G();},[G]),ge=useCallback((e=0,i=20)=>{let o=Q();if(!Z.current||!R.current||!o||!o.length)return;let s=1/0,d=1/0,c=-1/0,l=-1/0;if(o.forEach(f=>{if(f.x===void 0||f.y===void 0)return;let g=f.x,w=f.y;s=Math.min(s,g),d=Math.min(d,w),c=Math.max(c,g),l=Math.max(l,w);}),isFinite(s)&&isFinite(c)&&isFinite(d)&&isFinite(l)){let{width:f,height:g}=t.current;s-=i,d-=i,c+=i,l+=i;let w=c-s,T=l-d,C=w>0?f/w:1,$=T>0?g/T:1,L=Math.min(C,$,10),B=s+w/2,p=d+T/2,D={k:L,x:f/2-B*L,y:g/2-p*L};if(e>0){let b={...t.current.transform},H=Date.now(),F=a(()=>{let W=Math.min(1,(Date.now()-H)/e),q=W===1?1:1-Math.pow(1-W,3),ne={k:b.k+(D.k-b.k)*q,x:b.x+(D.x-b.x)*q,y:b.y+(D.y-b.y)*q};t.current.transform=ne,G(),W<1&&requestAnimationFrame(F);},"animateZoom");requestAnimationFrame(F);}else t.current.transform=D,G();}},[]),me=useCallback((e,i)=>{let o=Q();if(!o||o.length===0)return null;let a=z.nodeSizeBase/2,s=typeof window<"u"&&window.devicePixelRatio||1,d=(e*s-t.current.transform.x)/t.current.transform.k,c=(i*s-t.current.transform.y)/t.current.transform.k;return o.find(l=>{let f=(l.x||0)-d,g=(l.y||0)-c;return Math.sqrt(f*f+g*g)<=a})||null},[]),ye=useCallback((e,i)=>{let o=he(),a=Q();if(!o||o.length===0||!a||a.length===0)return null;let s=typeof window<"u"&&window.devicePixelRatio||1,d=(e*s-t.current.transform.x)/t.current.transform.k,c=(i*s-t.current.transform.y)/t.current.transform.k,l=5;return o.find(f=>{let g=typeof f.source=="object"?f.source:a.find(ie=>ie.id===f.source),w=typeof f.target=="object"?f.target:a.find(ie=>ie.id===f.target);if(!g||!w)return false;let T=g.x||0,C=g.y||0,$=w.x||0,L=w.y||0,B=d-T,p=c-C,D=$-T,b=L-C,H=B*D+p*b,F=D*D+b*b;if(F===0)return false;let W=H/F;W=Math.max(0,Math.min(1,W));let q=T+W*D,ne=C+W*b,oe=d-q,pe=c-ne;return Math.sqrt(oe*oe+pe*pe)<=l})||null},[]),Je=useCallback((e,i,o,a,s,d,c)=>{let l=e-o,f=i-a,g=Math.sqrt(l*l+f*f),w=Math.atan2(f,l);w<0&&(w+=2*Math.PI);let $=g>=s*.5&&g<=s*1,L=false;return d===Math.PI&&c===Math.PI*2?L=w>=Math.PI&&w<=Math.PI*2:d===0&&c===Math.PI?L=w>=0&&w<=Math.PI:L=d<=c&&w>=d&&w<=c||d>c&&(w>=d||w<=c),$&&L},[]),Ne=useCallback(e=>{if(e===t.current.hoveredNode)return;let i=new Set,o=new Set;e&&(i.add(e),e.neighbors&&e.neighbors.forEach(a=>i.add(a)),e.links&&e.links.forEach(a=>o.add(a))),t.current.hoveredNode=e,k&&k(e),t.current.highlightNodes=i,t.current.highlightLinks=o;},[k]),Te=useCallback(e=>{if(e===t.current.hoveredLink)return;let i=new Set,o=new Set;if(e){o.add(e);let a=Q();if(a){let s=typeof e.source=="object"?e.source:a.find(c=>c.id===e.source),d=typeof e.target=="object"?e.target:a.find(c=>c.id===e.target);s&&i.add(s),d&&i.add(d);}}t.current.hoveredLink=e,j&&j(e),t.current.highlightNodes=i,t.current.highlightLinks=o;},[j,Q]),Ke=useCallback(e=>{O&&O(e);},[O]),Qe=useCallback(e=>{t.current.selectedNode=e,x&&x(e);},[x]),et=useCallback(()=>{t.current.selectedNode=null,h&&h();},[h]),Ie=useCallback(e=>{if(!R.current||!P.current)return;let i=R.current.getBoundingClientRect(),o=e.clientX-i.left,a=e.clientY-i.top;t.current.mouseStartPos={x:o,y:a},t.current.isDragging=false;let s=me(o,a);s?(t.current.draggedNode=s,s.fx=s.x,s.fy=s.y):(t.current.isPanning=true,t.current.lastMousePos={x:o,y:a});},[me]),ve=useCallback((e,i)=>{let o=null;if(R.current&&t.current&&A.length>0){let a=z.nodeSizeBase*z.nodeAreaFactor/2,s=R.current.getBoundingClientRect(),d=R.current.width/s.width,c=R.current.height/s.height,l=e*d,f=i*c,g=(l-t.current.transform.x)/t.current.transform.k,w=(f-t.current.transform.y)/t.current.transform.k,T=t.current.selectedNode?.x||0,C=t.current.selectedNode?.y||0,$=Math.min(A.length,8),L=Math.min(Math.PI*2/$,Math.PI);for(let B=0;B<$;B++){let p=B*L,D=(B+1)*L;if(Je(g,w,T,C,a,p,D)){o=B;break}}}return o},[A]),Re=useCallback(e=>{if(!R.current)return;let i=R.current.getBoundingClientRect(),o=e.clientX-i.left,a=e.clientY-i.top;if(t.current.draggedNode&&t.current.mouseStartPos&&P.current){let c=t.current.mouseStartPos.x,l=t.current.mouseStartPos.y,f=o-c,g=a-l;Math.sqrt(f*f+g*g)>3&&(t.current.isDragging=true,P.current.alphaTarget()===0&&P.current.alphaTarget(0).restart());let C=typeof window<"u"&&window.devicePixelRatio||1,$=(o*C-t.current.transform.x)/t.current.transform.k,L=(a*C-t.current.transform.y)/t.current.transform.k;t.current.draggedNode.fx=$,t.current.draggedNode.fy=L;return}if(t.current.isPanning&&t.current.mouseStartPos){let c=o-t.current.lastMousePos.x,l=a-t.current.lastMousePos.y,f=t.current.mouseStartPos.x,g=t.current.mouseStartPos.y;Math.sqrt(Math.pow(o-f,2)+Math.pow(a-g,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:o,y:a},G();return}let s,d;if(t.current.selectedNode&&R.current&&A.length>0){let c=ve(o,a);c!==null&&(d=t.current.selectedNode),c!==t.current.hoveredButtonIndex&&(s=true),t.current.hoveredButtonIndex=c;}else t.current.hoveredButtonIndex!==null&&(t.current.hoveredButtonIndex=null);if(!d&&(d=me(o,a),!d)){let c=ye(o,a),l=c!==t.current.hoveredLink;if(c&&t.current.hoveredNode&&Ne(null),Te(c),R.current&&(R.current.style.cursor=c?"pointer":"default"),l){G();return}}d&&t.current.hoveredLink&&Te(null),d!==t.current.hoveredNode&&(s=true),Ne(d),R.current&&(R.current.style.cursor=d?"pointer":"default"),s&&G();},[A,me,ye,Ne,Te,G,Je,ve]),Ht=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.stopPropagation(),e.preventDefault()),t.current.mustBeStoppedPropagation=false;},[]),we=useCallback(e=>{let i=t.current.isDragging;if(i&&(t.current.mustBeStoppedPropagation=true),!i&&t.current.mouseStartPos){let o=R.current?.getBoundingClientRect();if(o){let a=e.clientX-o.left,s=e.clientY-o.top;A.length>0&&t.current.hoveredButtonIndex===null&&(t.current.hoveredButtonIndex=ve(a,s));let d=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),d=true,t.current.hoveredButtonIndex=null);}if(!d&&t.current.draggedNode)Qe(t.current.draggedNode);else if(!d&&!t.current.draggedNode){let c=ye(a,s);c?Ke(c):et();}}}if(t.current.draggedNode&&P.current){if(i){P.current.alphaTarget(0);let o=.05,a=.04,s=.6;P.current.alpha(o).alphaDecay(a),P.current.velocityDecay(s);}else P.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),G();},[y,G,Qe,et,ye,Ke,ve,A]),Le=useCallback(e=>{if(e.stopPropagation(),e.preventDefault(),!R.current)return;let i=R.current.getBoundingClientRect(),o=e.clientX-i.left,a=e.clientY-i.top,d=-e.deltaY>0?1.1:1/1.1,c=t.current.transform,l=c.k*d;if(l<.01||l>10)return;let f=c.k*d,g=o-(o-c.x)*d,w=a-(a-c.y)*d;t.current.transform={k:f,x:g,y:w},G();},[G]),Ee=a((e,i)=>{let o=e.touches[0];if(o){let a={clientX:o.clientX,clientY:o.clientY};i(a);}},"convertTouchToMouseEvent"),Wt=useCallback(e=>{Ee(e,Ie);},[Ie]),ze=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.preventDefault(),e.stopPropagation()),t.current.mustBeStoppedPropagation=false,Ee(e,we);},[we]),Yt=useCallback(e=>{Ee(e,Re);},[Re]);return useImperativeHandle(Y,()=>({zoomToFit:ge,addNodes:Ue,removeNodes:Ze}),[ge,Ue,Ze]),useEffect(()=>{let e=R.current,{width:i,height:o}=t.current;if(!e)return;Ot(),re(true);let a=i/2,s=o/2,d=z.nodeSizeBase,c=d/2,l=d*2.5;P.current&&P.current.stop();let f=P.current=forceSimulation(_).force("link",forceLink(M).id(g=>g.id).distance(l).strength(.9)).force("charge",forceManyBody().strength(-d/10*200).theta(.5).distanceMin(d*2)).force("x",forceX().strength(.03)).force("y",forceY().strength(.03)).force("center",forceCenter(a,s).strength(.05)).force("collide",forceCollide().radius(c*2).iterations(2).strength(1)).velocityDecay(.6);return ()=>{f.stop();}},[_,M]),useLayoutEffect(()=>{let e=R.current;e&&(t.current.width=n*De,t.current.height=u*De,e.width=t.current.width,e.height=t.current.height);},[n,u]),useEffect(()=>{if(P.current){let e=P.current;e.on("tick",()=>{G();}),e.on("end",()=>{E&&(ge(0,20),setTimeout(()=>{re(false);},200));});}E||G();},[_,M,E,G,ge]),useEffect(()=>{!_||!M||M.forEach(e=>{let i=typeof e.source=="object"?e.source:_.find(a=>a.id===e.source),o=typeof e.target=="object"?e.target:_.find(a=>a.id===e.target);!i||!o||(!i.neighbors&&(i.neighbors=[]),!o.neighbors&&(o.neighbors=[]),i.neighbors.push(o),o.neighbors.push(i),!i.links&&(i.links=[]),!o.links&&(o.links=[]),i.links.push(e),o.links.push(e));});},[_,M]),useEffect(()=>{y&&y.length>0&&U(Dr(y));},[y]),useEffect(()=>{let e=R.current;if(!(!e||typeof window>"u"))return e.addEventListener("wheel",Le,{passive:false}),e.addEventListener("touchend",ze,{passive:false}),()=>{e.removeEventListener("wheel",Le),e.removeEventListener("touchend",ze);}},[Le,ze]),jsxs(Sr,{children:[(r||E)&&jsx(yt,{width:n,height:u}),jsx(Mr,{ref:R,style:{width:n,height:u,display:r||E?"none":"block"},onMouseDown:Ie,onMouseMove:Re,onMouseUp:we,onMouseLeave:we,onClick:Ht,onTouchStart:Wt,onTouchMove:Yt})]})}),Sr=styled.div`
47
+ `,ar=a(({width:r=280,height:n=280})=>{let u=useTheme();return jsx(ir,{children:jsxs(rr,{foregroundColor:u.contentLoader.foreground,backgroundColor:u.contentLoader.background,width:r,height:n,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=ar;var Pe=typeof window<"u"&&window.devicePixelRatio||1;function Dr(r){return !r||r.length===0?[]:r.map(n=>{let u=new Image;u.src=n.img;let m=new Image;return m.src=n.hoverImg,{...n,normalImg:u,hoverImg:m}})}a(Dr,"prepareButtonImages");var j={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},Pr=forwardRef(({loading:r,width:n,height:u,graphData:m,buttons:y=[],onNodeClick:x,onBackgroundClick:h,onNodeHover:D,onLinkHover:E,onLinkClick:A},W)=>{let M=useTheme(),[z,ne]=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:n*Pe,height:u*Pe,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:G,links:U}=useMemo(()=>pr(m),[m]),[k,_]=useState([]),N=useRef(null),S=useRef(null),K=useRef(null),ee=scaleOrdinal(schemeCategory10),Ot=useCallback(()=>{if(!N.current)return false;try{let e=N.current.getContext("2d");return e?(K.current=e,!0):(console.error("Failed to get 2D context"),!1)}catch(e){return console.error("Error initializing Canvas 2D context:",e),false}},[]),Q=useCallback(()=>S.current?S.current.nodes():null,[]),ge=useCallback(()=>{if(!S.current)return null;let e=S.current.force("link");return e?e.links():null},[]),Ge=useCallback(e=>{e.save(),e.setTransform(1,0,0,1,0,0);let{width:i,height:o}=t.current,a=j.gridSpacing,s=j.dotSize;e.fillStyle=M.graph2D.grid.dotColor;for(let d=a/2;d<=i;d+=a)for(let c=a/2;c<=o;c+=a)e.beginPath(),e.arc(d,c,s,0,2*Math.PI),e.fill();e.restore();},[M.graph2D.grid.dotColor,j.gridSpacing,j.dotSize]),$t=useCallback((e,i,o)=>{if(!e)return "";if(o.measureText(e).width<=i)return e;let s=e,d="...";for(;o.measureText(s+d).width>i&&s.length>0;)s=s.slice(0,-1);return s+d},[]),Te=a(e=>{let o=Math.min(e,j.maxZoom)/j.maxZoom;return Math.max(j.fontSize*o,j.fontSize)},"calculateFontSize"),_e=useCallback(e=>{let i=ge(),o=Q();!i||i.length===0||!o||o.length===0||(e.lineWidth=.5,e.globalAlpha=1,i.forEach(a=>{let s=typeof a.source=="object"?a.source:o.find(te=>te.id===a.source),d=typeof a.target=="object"?a.target:o.find(te=>te.id===a.target);if(!s||!d)return;let c={x:s.x||0,y:s.y||0},l={x:d.x||0,y:d.y||0},f=l.x-c.x,g=l.y-c.y,w=Math.sqrt(f*f+g*g),I=f/w,C=g/w,O=j.nodeSizeBase/2,R=j.nodeSizeBase/2,B=4,p={x:c.x+I*O,y:c.y+C*O},P={x:l.x-I*(R+B),y:l.y-C*(R+B)},b={x:l.x-I*(R+1),y:l.y-C*(R+1)},$=t.current.highlightLinks.has(a),F=$?M.graph2D.link.highlighted:M.graph2D.link.normal,H=$?1.5:.5,q=c.x+(l.x-c.x)/2,oe=c.y+(l.y-c.y)/2,ie=Math.atan2(g,f);if(a.label){let te=t.current.transform.k,ae=Te(te);e.font=`${ae}px Sans-Serif`;let rt=e.measureText(a.label).width,nt=10;e.beginPath(),e.moveTo(p.x,p.y);let ot=w/2-(rt+nt)/2,it={x:c.x+I*ot,y:c.y+C*ot};e.lineTo(it.x,it.y),e.strokeStyle=F,e.lineWidth=H,e.stroke(),e.beginPath();let at=w/2+(rt+nt)/2,st={x:c.x+I*at,y:c.y+C*at};e.moveTo(st.x,st.y),e.lineTo(P.x,P.y),e.strokeStyle=F,e.lineWidth=H,e.stroke();}else e.beginPath(),e.moveTo(p.x,p.y),e.lineTo(P.x,P.y),e.strokeStyle=F,e.lineWidth=H,e.stroke();let fe=2;if(e.save(),e.translate(b.x,b.y),e.rotate(ie),e.beginPath(),e.moveTo(0,0),e.lineTo(-4,fe),e.lineTo(-4,0),e.lineTo(-4,-2),e.closePath(),e.fillStyle=F,e.fill(),e.restore(),a.label){let te=t.current.transform.k,ae=Te(te);e.font=`${ae}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(q,oe),Math.abs(ie)>Math.PI/2?e.rotate(ie+Math.PI):e.rotate(ie),e.fillStyle=$?M.graph2D.link.highlightedTextColor:M.graph2D.link.textColor,e.fillText(a.label,0,0),e.restore();}}));},[j,M.graph2D.link]),qe=a((e,i,o,a,s,d,c)=>{try{if(d!=null){let l=s*.8;e.font=`${l}px sans-serif`,e.textBaseline="middle",e.textAlign="left";let f=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(d),g=e.measureText(f).width,w=s*.3,C=(s+w+g)/2;e.drawImage(i,o-C,a-s/2,s,s),e.fillStyle=c||"#99989C",e.fillText(f,o-C+s+w,a);}else e.drawImage(i,o-s/2,a-s/2,s,s);}catch(l){console.warn("Error rendering icon:",l);}},"drawIconWithOptionalCounter"),Ve=useCallback((e,i)=>{if(!k||k.length===0||!e||!e.x||!e.y)return;let{x:o,y:a}=e,s=j.nodeSizeBase*j.nodeAreaFactor/2;i.save();let d=Math.min(k.length,8),c=Math.min(Math.PI*2/d,Math.PI);for(let l$1=0;l$1<d;l$1++){let f=l$1*c,g=(l$1+1)*c,w=t.current.hoveredButtonIndex===l$1;i.beginPath(),i.arc(o,a,s,f,g,false),i.lineTo(o,a),i.closePath(),i.lineWidth=1,i.strokeStyle=M.graph2D?.button?.stroke||"#FFFFFF",i.stroke(),i.fillStyle=w?M.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":M.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",i.fill();let I=s*.2,C=(f+g)/2,O=s-j.nodeSizeBase/2+I,R=o+Math.cos(C)*O,B=a+Math.sin(C)*O,p=k[l$1];if(p.loading){let P=I/2,b=I/12;i.save(),i.translate(R,B),i.rotate(t.current.spinnerAngle);for(let $=0;$<12;$++){let F=Math.PI*2*$/12,H=$/12,q=Math.cos(F)*P,oe=Math.sin(F)*P;i.beginPath(),i.fillStyle=l(M.graph2D?.button?.spinnerColor,H),i.arc(q,oe,b,0,Math.PI*2),i.fill();}i.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(X),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 P=w?p.hoverImg:p.normalImg,b=p.getCount?p.getCount(e):null;P.complete?qe(i,P,R,B,I,b,M.graph2D?.button?.textColor):P.onload=()=>{K.current&&qe(i,P,R,B,I,b,M.graph2D?.button?.textColor);};}}i.restore();},[k,M.graph2D?.button]),Ue=useCallback(e=>{let i=Q();!i||i.length===0||(e.globalAlpha=1,i.forEach(o=>{let{x:a,y:s,color:d,fontColor:c,label:l}=o,f=t.current.highlightNodes.has(o)||o===t.current.hoveredNode||o===t.current.draggedNode,g=o===t.current.selectedNode,w=j.nodeSizeBase,I=j.nodeSizeBase/2;if(f&&!g){let C=j.nodeSizeBase*j.nodeAreaFactor*.75/2;e.beginPath(),e.arc(a,s,C,0,2*Math.PI,false),e.fillStyle=M.graph2D.ring.highlightFill,e.fill();}if(g)if(y&&y.length>0)Ve(o,e);else {let C=j.nodeSizeBase*j.nodeAreaFactor/2;e.beginPath(),e.arc(a,s,C,0,2*Math.PI,false),e.fillStyle=M.graph2D.ring.selectionFill||M.graph2D.ring.highlightFill,e.fill();}if(e.beginPath(),e.arc(a,s,I,0,2*Math.PI),e.fillStyle=d||ee(o.group||"0"),e.fill(),l){e.save(),e.translate(a,s);let C=t.current.transform.k,O=Te(C),R=w*j.textPaddingFactor;e.font=`${O}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle=c||"#000";let B=$t(l,R,e);e.fillText(B,0,0),e.restore();}}));},[M.graph2D.ring,y,Ve]),X=useCallback(()=>{let e=K.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),_e(e),Ue(e),e.restore());},[_e,Ue,Ge]),Ze=useCallback((e,i=[],o)=>{let a=ge()||[],s=Q()||[];if(!S.current||!e.length)return;let{width:d,height:c}=t.current,l=o?.smoothAppearance??false,f=o?.transitionDuration??1e3,g=new Set(s.map(p=>p.id)),w=e.filter(p=>!g.has(p.id)),I=new Set(a.map(p=>`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`)),C=i.filter(p=>{let P=`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`;return !I.has(P)});if(w.length===0&&C.length===0)return;let O=[...s,...w],R=[...a,...C];l&&(w.forEach(p=>{let P=C.filter(b=>{let $=typeof b.source=="object"?b.source.id:b.source,F=typeof b.target=="object"?b.target.id:b.target;return $===p.id&&g.has(F)||F===p.id&&g.has($)});if(P.length>0){let b=P[0],$=typeof b.source=="object"?b.source.id===p.id?b.target:b.source.id:b.source===p.id?b.target:b.source,F=O.find(H=>H.id===$);if(F&&F.x!==void 0&&F.y!==void 0){let H=30+Math.random()*20,q=Math.random()*Math.PI*2;p.x=F.x+Math.cos(q)*H,p.y=F.y+Math.sin(q)*H,p.vx=0,p.vy=0;}}else {let b=d/2,$=c/2,F=Math.min(d,c)/4,H=Math.random()*Math.PI*2;p.x=b+Math.cos(H)*(F*Math.random()),p.y=$+Math.sin(H)*(F*Math.random()),p.vx=0,p.vy=0;}}),s.forEach(p=>{p.fx=p.x,p.fy=p.y;})),S.current.nodes(O);let B=S.current.force("link");B&&B.links(R),C.forEach(p=>{let P=typeof p.source=="object"?p.source:O.find($=>$.id===p.source),b=typeof p.target=="object"?p.target:O.find($=>$.id===p.target);!P||!b||(!P.neighbors&&(P.neighbors=[]),!b.neighbors&&(b.neighbors=[]),P.neighbors.push(b),b.neighbors.push(P),!P.links&&(P.links=[]),!b.links&&(b.links=[]),P.links.push(p),b.links.push(p));}),l?(S.current.alphaTarget(.3),S.current.alpha(.3),S.current.velocityDecay(.7),S.current.restart(),setTimeout(()=>{s.forEach(p=>{p.fx=void 0,p.fy=void 0;}),S.current?.alphaTarget(0),S.current?.alpha(.1),S.current?.velocityDecay(.6);},f)):S.current.alpha(.1).restart(),X();},[G,X]),Je=useCallback(e=>{let i=Q(),o=ge();if(!S.current||!e.length||!i||i.length===0||!o||o.length===0)return;let a=new Set(e);if(t.current.selectedNode&&t.current.selectedNode.id!==void 0&&a.has(t.current.selectedNode.id)&&(t.current.selectedNode=null),t.current.hoveredNode&&t.current.hoveredNode.id!==void 0&&a.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,f=typeof t.current.hoveredLink.target=="object"?t.current.hoveredLink.target.id:t.current.hoveredLink.target;(l!==void 0&&a.has(l)||f!==void 0&&a.has(f))&&(t.current.hoveredLink=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set);}t.current.draggedNode&&t.current.draggedNode.id!==void 0&&a.has(t.current.draggedNode.id)&&(t.current.draggedNode=null);let s=i.filter(l=>l.id!==void 0&&!a.has(l.id)),d=o.filter(l=>{let f=typeof l.source=="object"?l.source.id:l.source,g=typeof l.target=="object"?l.target.id:l.target;return f!==void 0&&!a.has(f)&&g!==void 0&&!a.has(g)});s.forEach(l=>{l.neighbors=[],l.links=[];}),d.forEach(l=>{let f=typeof l.source=="object"?l.source:s.find(w=>w.id===l.source),g=typeof l.target=="object"?l.target:s.find(w=>w.id===l.target);!f||!g||(f.neighbors=f.neighbors||[],g.neighbors=g.neighbors||[],f.neighbors.push(g),g.neighbors.push(f),f.links=f.links||[],g.links=g.links||[],f.links.push(l),g.links.push(l));}),S.current.nodes(s);let c=S.current.force("link");c&&c.links(d),X();},[X]),me=useCallback((e=0,i=20)=>{let o=Q();if(!K.current||!N.current||!o||!o.length)return;let s=1/0,d=1/0,c=-1/0,l=-1/0;if(o.forEach(f=>{if(f.x===void 0||f.y===void 0)return;let g=f.x,w=f.y;s=Math.min(s,g),d=Math.min(d,w),c=Math.max(c,g),l=Math.max(l,w);}),isFinite(s)&&isFinite(c)&&isFinite(d)&&isFinite(l)){let{width:f,height:g}=t.current;s-=i,d-=i,c+=i,l+=i;let w=c-s,I=l-d,C=w>0?f/w:1,O=I>0?g/I:1,R=Math.min(C,O,10),B=s+w/2,p=d+I/2,P={k:R,x:f/2-B*R,y:g/2-p*R};if(e>0){let b={...t.current.transform},$=Date.now(),F=a(()=>{let H=Math.min(1,(Date.now()-$)/e),q=H===1?1:1-Math.pow(1-H,3),oe={k:b.k+(P.k-b.k)*q,x:b.x+(P.x-b.x)*q,y:b.y+(P.y-b.y)*q};t.current.transform=oe,X(),H<1&&requestAnimationFrame(F);},"animateZoom");requestAnimationFrame(F);}else t.current.transform=P,X();}},[]),ye=useCallback((e,i)=>{let o=Q();if(!o||o.length===0)return null;let a=j.nodeSizeBase/2,s=typeof window<"u"&&window.devicePixelRatio||1,d=(e*s-t.current.transform.x)/t.current.transform.k,c=(i*s-t.current.transform.y)/t.current.transform.k;return o.find(l=>{let f=(l.x||0)-d,g=(l.y||0)-c;return Math.sqrt(f*f+g*g)<=a})||null},[]),ve=useCallback((e,i)=>{let o=ge(),a=Q();if(!o||o.length===0||!a||a.length===0)return null;let s=typeof window<"u"&&window.devicePixelRatio||1,d=(e*s-t.current.transform.x)/t.current.transform.k,c=(i*s-t.current.transform.y)/t.current.transform.k,l=5;return o.find(f=>{let g=typeof f.source=="object"?f.source:a.find(ae=>ae.id===f.source),w=typeof f.target=="object"?f.target:a.find(ae=>ae.id===f.target);if(!g||!w)return false;let I=g.x||0,C=g.y||0,O=w.x||0,R=w.y||0,B=d-I,p=c-C,P=O-I,b=R-C,$=B*P+p*b,F=P*P+b*b;if(F===0)return false;let H=$/F;H=Math.max(0,Math.min(1,H));let q=I+H*P,oe=C+H*b,ie=d-q,fe=c-oe;return Math.sqrt(ie*ie+fe*fe)<=l})||null},[]),Ke=useCallback((e,i,o,a,s,d,c)=>{let l=e-o,f=i-a,g=Math.sqrt(l*l+f*f),w=Math.atan2(f,l);w<0&&(w+=2*Math.PI);let O=g>=s*.5&&g<=s*1,R=false;return d===Math.PI&&c===Math.PI*2?R=w>=Math.PI&&w<=Math.PI*2:d===0&&c===Math.PI?R=w>=0&&w<=Math.PI:R=d<=c&&w>=d&&w<=c||d>c&&(w>=d||w<=c),O&&R},[]),Ie=useCallback(e=>{if(e===t.current.hoveredNode)return;let i=new Set,o=new Set;e&&(i.add(e),e.neighbors&&e.neighbors.forEach(a=>i.add(a)),e.links&&e.links.forEach(a=>o.add(a))),t.current.hoveredNode=e,D&&D(e),t.current.highlightNodes=i,t.current.highlightLinks=o;},[D]),Le=useCallback(e=>{if(e===t.current.hoveredLink)return;let i=new Set,o=new Set;if(e){o.add(e);let a=Q();if(a){let s=typeof e.source=="object"?e.source:a.find(c=>c.id===e.source),d=typeof e.target=="object"?e.target:a.find(c=>c.id===e.target);s&&i.add(s),d&&i.add(d);}}t.current.hoveredLink=e,E&&E(e),t.current.highlightNodes=i,t.current.highlightLinks=o;},[E,Q]),Qe=useCallback(e=>{A&&A(e);},[A]),et=useCallback(e=>{t.current.selectedNode=e,x&&x(e);},[x]),tt=useCallback(()=>{t.current.selectedNode=null,h&&h();},[h]),Re=useCallback(e=>{if(!N.current||!S.current)return;let i=N.current.getBoundingClientRect(),o=e.clientX-i.left,a=e.clientY-i.top;t.current.mouseStartPos={x:o,y:a},t.current.isDragging=false;let s=ye(o,a);s?(t.current.draggedNode=s,s.fx=s.x,s.fy=s.y):(t.current.isPanning=true,t.current.lastMousePos={x:o,y:a});},[ye]),we=useCallback((e,i)=>{let o=null;if(N.current&&t.current&&k.length>0){let a=j.nodeSizeBase*j.nodeAreaFactor/2,s=N.current.getBoundingClientRect(),d=N.current.width/s.width,c=N.current.height/s.height,l=e*d,f=i*c,g=(l-t.current.transform.x)/t.current.transform.k,w=(f-t.current.transform.y)/t.current.transform.k,I=t.current.selectedNode?.x||0,C=t.current.selectedNode?.y||0,O=Math.min(k.length,8),R=Math.min(Math.PI*2/O,Math.PI);for(let B=0;B<O;B++){let p=B*R,P=(B+1)*R;if(Ke(g,w,I,C,a,p,P)){o=B;break}}}return o},[k]),Ee=useCallback(e=>{if(!N.current)return;let i=N.current.getBoundingClientRect(),o=e.clientX-i.left,a=e.clientY-i.top;if(t.current.draggedNode&&t.current.mouseStartPos&&S.current){let c=t.current.mouseStartPos.x,l=t.current.mouseStartPos.y,f=o-c,g=a-l;Math.sqrt(f*f+g*g)>3&&(t.current.isDragging=true,S.current.alphaTarget()===0&&S.current.alphaTarget(0).restart());let C=typeof window<"u"&&window.devicePixelRatio||1,O=(o*C-t.current.transform.x)/t.current.transform.k,R=(a*C-t.current.transform.y)/t.current.transform.k;t.current.draggedNode.fx=O,t.current.draggedNode.fy=R;return}if(t.current.isPanning&&t.current.mouseStartPos){let c=o-t.current.lastMousePos.x,l=a-t.current.lastMousePos.y,f=t.current.mouseStartPos.x,g=t.current.mouseStartPos.y;Math.sqrt(Math.pow(o-f,2)+Math.pow(a-g,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:o,y:a},X();return}let s,d;if(t.current.selectedNode&&N.current&&k.length>0){let c=we(o,a);c!==null&&(d=t.current.selectedNode),c!==t.current.hoveredButtonIndex&&(s=true),t.current.hoveredButtonIndex=c;}else t.current.hoveredButtonIndex!==null&&(t.current.hoveredButtonIndex=null);if(!d&&(d=ye(o,a),!d)){let c=ve(o,a),l=c!==t.current.hoveredLink;if(c&&t.current.hoveredNode&&Ie(null),Le(c),N.current&&(N.current.style.cursor=c?"pointer":"default"),l){X();return}}d&&t.current.hoveredLink&&Le(null),d!==t.current.hoveredNode&&(s=true),Ie(d),N.current&&(N.current.style.cursor=d?"pointer":"default"),s&&X();},[k,ye,ve,Ie,Le,X,Ke,we]),Ht=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.stopPropagation(),e.preventDefault()),t.current.mustBeStoppedPropagation=false;},[]),be=useCallback(e=>{let i=t.current.isDragging;if(i&&(t.current.mustBeStoppedPropagation=true),!i&&t.current.mouseStartPos){let o=N.current?.getBoundingClientRect();if(o){let a=e.clientX-o.left,s=e.clientY-o.top;k.length>0&&t.current.hoveredButtonIndex===null&&(t.current.hoveredButtonIndex=we(a,s));let d=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),d=true,t.current.hoveredButtonIndex=null);}if(!d&&t.current.draggedNode)et(t.current.draggedNode);else if(!d&&!t.current.draggedNode){let c=ve(a,s);c?Qe(c):tt();}}}if(t.current.draggedNode&&S.current){if(i){S.current.alphaTarget(0);let o=.05,a=.04,s=.6;S.current.alpha(o).alphaDecay(a),S.current.velocityDecay(s);}else S.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),X();},[y,X,et,tt,ve,Qe,we,k]),ze=useCallback(e=>{if(e.stopPropagation(),e.preventDefault(),!N.current)return;let i=N.current.getBoundingClientRect(),o=e.clientX-i.left,a=e.clientY-i.top,d=-e.deltaY>0?1.1:1/1.1,c=t.current.transform,l=c.k*d;if(l<.01||l>10)return;let f=c.k*d,g=o-(o-c.x)*d,w=a-(a-c.y)*d;t.current.transform={k:f,x:g,y:w},X();},[X]),je=a((e,i)=>{let o=e.touches[0];if(o){let a={clientX:o.clientX,clientY:o.clientY};i(a);}},"convertTouchToMouseEvent"),Wt=useCallback(e=>{je(e,Re);},[Re]),Be=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.preventDefault(),e.stopPropagation()),t.current.mustBeStoppedPropagation=false,je(e,be);},[be]),Yt=useCallback(e=>{je(e,Ee);},[Ee]);return useImperativeHandle(W,()=>({zoomToFit:me,addNodes:Ze,removeNodes:Je}),[me,Ze,Je]),useEffect(()=>{let e=N.current,{width:i,height:o}=t.current;if(!e)return;Ot(),ne(true);let a=i/2,s=o/2,d=j.nodeSizeBase,c=d/2,l=d*2.5;S.current&&S.current.stop();let f=S.current=forceSimulation(G).force("link",forceLink(U).id(g=>g.id).distance(l).strength(.9)).force("charge",forceManyBody().strength(-d/10*200).theta(.5).distanceMin(d*2)).force("x",forceX().strength(.03)).force("y",forceY().strength(.03)).force("center",forceCenter(a,s).strength(.05)).force("collide",forceCollide().radius(c*2).iterations(2).strength(1)).velocityDecay(.6);return ()=>{f.stop();}},[G,U]),useLayoutEffect(()=>{let e=N.current;e&&(t.current.width=n*Pe,t.current.height=u*Pe,e.width=t.current.width,e.height=t.current.height);},[n,u]),useEffect(()=>{if(S.current){let e=S.current;e.on("tick",()=>{X();}),e.on("end",()=>{z&&(me(0,20),setTimeout(()=>{ne(false);},200));});}z||X();},[G,U,z,X,me]),useEffect(()=>{!G||!U||U.forEach(e=>{let i=typeof e.source=="object"?e.source:G.find(a=>a.id===e.source),o=typeof e.target=="object"?e.target:G.find(a=>a.id===e.target);!i||!o||(!i.neighbors&&(i.neighbors=[]),!o.neighbors&&(o.neighbors=[]),i.neighbors.push(o),o.neighbors.push(i),!i.links&&(i.links=[]),!o.links&&(o.links=[]),i.links.push(e),o.links.push(e));});},[G,U]),useEffect(()=>{y&&y.length>0&&_(Dr(y));},[y]),useEffect(()=>{let e=N.current;if(!(!e||typeof window>"u"))return e.addEventListener("wheel",ze,{passive:false}),e.addEventListener("touchend",Be,{passive:false}),()=>{e.removeEventListener("wheel",ze),e.removeEventListener("touchend",Be);}},[ze,Be]),jsxs(Sr,{children:[(r||z)&&jsx(vt,{width:n,height:u}),jsx(Mr,{ref:N,style:{width:n,height:u,display:r||z?"none":"block"},onMouseDown:Re,onMouseMove:Ee,onMouseUp:be,onMouseLeave:be,onClick:Ht,onTouchStart:Wt,onTouchMove:Yt})]})}),Sr=styled.div`
48
48
  display: flex;
49
49
  align-items: center;
50
50
  justify-content: center;
@@ -63,5 +63,5 @@ ${r?`
63
63
  `:""}
64
64
 
65
65
  min-width: 0;
66
- `);var Dt=a(({url:r})=>{let[n,u]=useState(1),[m,y]=useState(),x=xt.useRef(null),h=xt.useRef(null),k=a(()=>{u(O=>Math.min(O+.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$1,{variant:"outlined","aria-label":"zoom-out",color:"secondary",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:a(()=>{u(O=>Math.max(O-.25,.25));},"handleZoomOut"),disabled:n<=.25,p:5}),jsxs(mb,{py:5,px:8,children:[n*100,"%"]}),jsx(z$1,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(ma,{style:{width:14,height:14}}),onClick:k,disabled:n>=4,p:8})]}),jsx("div",{className:"h-full w-full overflow-auto flex items-center justify-center",children:jsx("img",{src:r,ref:x,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(${n*100}% - 20px)`},...m==="height"&&{height:`calc(${n*100}% - 20px)`}},onLoad:()=>{if(x.current&&h.current){let O=x.current.width,Y=x.current.height,S=O<Y?"height":"width";y(S);}}})})]})},"ImageDriver");var St=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 Fe=a(({url:r})=>{let[n,u]=useState(null),[m,y]=useState(false),[x,h]=useState(true),[k,j]=useState(null);return useEffect(()=>{y(true);},[]),useEffect(()=>{if(!m)return;a(async()=>{try{let Y=await import('./PdfDriver-IW5FDIIK.mjs');u(()=>Y.PdfDriver),h(!1);}catch(Y){console.error("Failed to load PDF driver:",Y),j("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[m]),m?x?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):k||!n?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:k||"PDF viewer unavailable"})})}):jsx(n,{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 Ct=a(({url:r,extension:n})=>jsxs("a",{href:r,download:`file.${n}`,className:"text-blue-500 underline",children:["Download ",n.toUpperCase()," file"]}),"DownloadDriver");var Tt=50,jr=1e4,It=a(({url:r,blob:n})=>{let u=useRef(null),[m,y]=useState(null),[x,h]=useState(true);return useEffect(()=>{a(async()=>{if(u.current)try{if(h(!0),y(null),!n&&r&&(n=await(await fetch(r)).blob()),!n){y("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(n.size/(1024*1024)>Tt){y(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Tt} \u041C\u0411)`);return}u.current.innerHTML="";let O=renderAsync(n,u.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),Y=new Promise((S,E)=>setTimeout(()=>E(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")),jr));await Promise.race([O,Y]),h(!1);}catch(j){y(j?.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,n]),jsxs(Fragment,{children:[!!m&&!x&&jsx("div",{className:"text-red-500 p-5",children:m}),x&&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:u,className:"w-full h-full overflow-auto"})]})},"DocxDriver");var Hr=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"),Rt=a(({url:r,extension:n})=>{let[u,m]=useState(""),[y,x]=useState(true),[h,k]=useState(null);if(useEffect(()=>{a(async()=>{try{x(!0),k(null);let S=await fetch(r);if(!S.ok)throw new Error(`Failed to load file: ${S.statusText}`);let E=await S.text();m(E);}catch(S){k(S instanceof Error?S.message:"Failed to load text content");}finally{x(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 j=Hr(n);return jsx("div",{className:"h-full w-full overflow-auto",children:j!=="text"?jsx(Prism,{className:"min-h-full! m-0! py-0!",language:j,style:darcula,showLineNumbers:true,wrapLines:true,children:u}):jsx("pre",{className:"whitespace-pre-wrap p-4 text-sm font-mono bg-gray-50 min-h-full",children:u})})},"TextDriver");var Et=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 zt=memo(a(function({extension:n,blob:u,path:m,buffer:y,not_supported_message:x=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:n,blob:u,path:m,buffer:y});let h=n.toLocaleLowerCase().trim(),k;if(m?k=m:u&&(k=URL.createObjectURL(u)),k){if(["jpeg","jpg","png","gif","bmp","webp"].includes(h))return jsx(Dt,{url:k});if(["mp3","wav","ogg","flac"].includes(h))return jsx(St,{url:k});if(["mp4","webm"].includes(h))return jsx(Et,{url:k});if(n==="pdf")return jsx(Fe,{url:k});if(["xlsx","pptx"].includes(h))return jsx(Ct,{url:k,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(Rt,{url:k,extension:h})}return h==="docx"?jsx(It,{url:k,blob:u}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(mb,{children:jsx(Wa,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:x})})})},"Driver"));var Cs=a(r=>jsx("div",{className:"h-full w-full",children:jsx(zt,{...r})}),"FileViewer");var Os=a(({text:r,speed:n=50,onDone:u,markdown:m=false,markdownComponents:y={},className:x,...h})=>{let[k,j]=useState("");return useEffect(()=>{let O;if(n>0){j("");let Y=0;O=setInterval(()=>{let S=r.charAt(Y);j(E=>E+S),Y++,Y>=r.length&&(clearInterval(O),u?.());},n);}else j(r),u?.();return ()=>{O&&clearInterval(O);}},[r,n,u]),m?jsx("div",{className:x,children:jsx(_r,{remarkPlugins:[qr],components:y,...h,children:k})}):jsx(Wa,{className:x,...h,children:k})},"Typewriter");var Kr={timeout:2e3,message:"Copied!"},Us=a(({text:r,children:n,format:u="text/plain",tooltip:m})=>{let[y,x]=useState(false),h=useRef(null),k={...Kr,...m},j=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):Vr(r,{format:u}),x(true),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>x(false),k.timeout);},"handleCopy");return useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]),jsx(yb,{onMouseLeave:()=>x(false),className:y?"visible":"hidden",content:k.message,children:n({copy:j})})},"CopyToClipboard");var Bt=a(r=>new Date(r?Array.isArray(r)?r[1]||r[0]||new Date:r:new Date),"getInitValue"),Me=a((r,n)=>{let u;if(n){let y=parse(r||"",n,new Date);if(isValid(y)&&getYear(y)>=1970)return y}let m=new Date(r||"");return isNaN(m.getTime())?u:m},"parseDate"),ln=a((r,n)=>{let u=r?Me(r,n):void 0;return u&&n?format(u,n):r},"renderDate"),sc=a(({value:r,range:n,inline:u=false,minDate:m=new Date(getYear(new Date)-5,0,1),maxDate:y=new Date(getYear(new Date)+5,11,31),format:x="dd.MM.yyyy",onChange:h,...k})=>{let[j,O]=useState(getMonth(Bt(r))),[Y,S]=useState(getYear(Bt(r))),E=useMemo(()=>{if(r){if(Array.isArray(r)){let t=Me(r[0],x),_=Me(r[1],x);return [t,_]}return Me(r,x)}},[r]),re=useCallback(t=>{if(n){let _=!!(E&&Array.isArray(E)&&E[0]),M=!!(E&&Array.isArray(E)&&E[1]);!_||_&&M?h?.([t.toString(),""]):_&&!M&&(t<E[0]?h?.([t.toString(),E[0].toString()]):h?.([E[0].toString(),t.toString()]));}else h?.(t.toString());},[n,E,h]);return u?jsx(Ft,{month:j,year:Y,minDate:m,maxDate:y,selectedDate:E,onSelectDate:re,onChangeMonth:O,onChangeYear:S}):n?jsx(dn,{range:true,value:r,onChange:h,...k}):jsx(un,{value:r,onChange:h,minDate:m,maxDate:y,month:j,year:Y,selectedDate:E,onChangeMonth:O,onChangeYear:S,onSelectDate:re,formatStr:x,...k})},"DatePicker"),dn=a(({minDate:r,maxDate:n,value:u,onChange:m})=>null,"DatePickerGroupInput"),un=a(({placeholder:r,value:n,onChange:u,inputProps:m,...y$1})=>{let[x,h]=useState(false),k=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:x,onClickOutside:()=>h(false),content:jsx(mb,{children:jsx(Ft,{...y$1})}),containerStyle:{zIndex:`${k.zIndex.popover}`},children:jsx("div",{onClick:()=>h(true),children:jsx(ib,{...m,placeholder:r,value:ln(n,y$1.formatStr),onChange:j=>u?.(j.target.value)})})})},"DatePickerInput"),Ft=a(({month:r,year:n,selectedDate:u,minDate:m,maxDate:y,onSelectDate:x,onChangeMonth:h,onChangeYear:k})=>{let j=useMemo(()=>new Array(12).fill(null).map((M,A)=>{let U=new Date(0,A);return {value:A+1,inputDisplay:format(U,"MMMM")}}),[]),O=useMemo(()=>{let M=getYear(m),U=getYear(y)-M+1;return new Array(U).fill(null).map((R,P)=>{let Z=M+P;return {value:Z,inputDisplay:Z.toString()}})},[m,y]),Y=useMemo(()=>new Array(7).fill(null).map((M,A)=>{let U=startOfWeek(new Date,{weekStartsOn:A});return format(U,"EEE")}),[]),S=useMemo(()=>{let M=getWeeksInMonth(new Date(n,r)),A=startOfMonth(new Date(n,r)),U=previousMonday(A),R=differenceInDays(A,U);return new Array(M*7).fill(null).map((P,Z)=>new Date(n,r,Z-R+1))},[r,n]),E=useCallback(()=>{r===0?(k(n-1),h(11)):h(r-1);},[r,n]),re=useCallback(()=>{r===11?(k(n+1),h(0)):h(r+1);},[r,n]),t=useMemo(()=>m?!(n<getYear(m)||n===getYear(m)&&r<=getMonth(m)):true,[r,n,m]),_=useMemo(()=>y?!(n>getYear(y)||n===getYear(y)&&r>=getMonth(y)):true,[r,n,y]);return jsxs("div",{className:"flex flex-col date-picker-calendar",children:[jsxs("div",{className:"flex justify-center items-center gap-2 pb-3",children:[t&&jsx(z$1,{size:"small",variant:"empty",icon:jsx(G,{}),onClick:E}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(gb,{placeholder:"",hasBorder:false,selected:r+1,options:j,onSelect:M=>h(M-1),maxWidth:150,maxHeight:300}),jsx(gb,{placeholder:"",hasBorder:false,selected:n,options:O,onSelect:M=>k(M),maxWidth:100,maxHeight:300})]}),_&&jsx(z$1,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:re})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:Y.map(M=>jsx("div",{className:"text-center",children:M},M))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:S.map(M=>{let A=getMonth(M)===r,U=format(M,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),R=u&&(Array.isArray(u)&&(u[0]&&format(M,"yyyy-MM-dd")===format(u[0],"yyyy-MM-dd")||u[1]&&format(M,"yyyy-MM-dd")===format(u[1],"yyyy-MM-dd"))||!Array.isArray(u)&&format(M,"yyyy-MM-dd")===format(u,"yyyy-MM-dd")),P=u&&Array.isArray(u)&&u[0]&&u[1]&&M>u[0]&&M<u[1],Z=m&&M<m||y&&M>y||!A;return jsx(pn,{date:M,isCurrentMonth:A,isCurrentDay:U,isSelected:!!R,isInRange:!!P,isDisabled:!!Z,onSelectDate:x},M.toISOString())})})]})},"DatePickerCalendar"),pn=a(({date:r,isCurrentMonth:n,isCurrentDay:u,isSelected:m,isInRange:y,isDisabled:x,onSelectDate:h})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${x?"text-gray-400 cursor-not-allowed":m?"bg-blue-500 text-white":y?"bg-blue-100":u?"text-blue-500":n?"text-black":"text-gray-400"} ${x?"":m?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(()=>{x||h(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");export{ta as Container,Us as CopyToClipboard,sc as DatePicker,Ft as DatePickerCalendar,Cs as FileViewer,Ia as FullscreenCard,Pr as Graph2D,Oi as PageContent,zi as PageLayout,Jt as Styled,Gt as StyledContainer,Vt as StyledMain,Xi as SubNav,Os as Typewriter};//# sourceMappingURL=index.mjs.map
66
+ `);var Pt=a(({url:r})=>{let[n,u]=useState(1),[m,y]=useState(),x=kt.useRef(null),h=kt.useRef(null),D=a(()=>{u(A=>Math.min(A+.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(()=>{u(A=>Math.max(A-.25,.25));},"handleZoomOut"),disabled:n<=.25,p:5}),jsxs(mb,{py:5,px:8,children:[n*100,"%"]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"secondary",icon:jsx(ma,{style:{width:14,height:14}}),onClick:D,disabled:n>=4,p:8})]}),jsx("div",{className:"h-full w-full overflow-auto flex items-center justify-center",children:jsx("img",{src:r,ref:x,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(${n*100}% - 20px)`},...m==="height"&&{height:`calc(${n*100}% - 20px)`}},onLoad:()=>{if(x.current&&h.current){let A=x.current.width,W=x.current.height,M=A<W?"height":"width";y(M);}}})})]})},"ImageDriver");var Mt=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[n,u]=useState(null),[m,y]=useState(false),[x,h]=useState(true),[D,E]=useState(null);return useEffect(()=>{y(true);},[]),useEffect(()=>{if(!m)return;a(async()=>{try{let W=await import('./PdfDriver-HQDASHKU.mjs');u(()=>W.PdfDriver),h(!1);}catch(W){console.error("Failed to load PDF driver:",W),E("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[m]),m?x?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):D||!n?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(n,{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:n})=>jsxs("a",{href:r,download:`file.${n}`,className:"text-blue-500 underline",children:["Download ",n.toUpperCase()," file"]}),"DownloadDriver");var It=50,jr=1e4,Lt=a(({url:r,blob:n})=>{let u=useRef(null),[m,y]=useState(null),[x,h]=useState(true);return useEffect(()=>{a(async()=>{if(u.current)try{if(h(!0),y(null),!n&&r&&(n=await(await fetch(r)).blob()),!n){y("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(n.size/(1024*1024)>It){y(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${It} \u041C\u0411)`);return}u.current.innerHTML="";let A=renderAsync(n,u.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),W=new Promise((M,z)=>setTimeout(()=>z(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")),jr));await Promise.race([A,W]),h(!1);}catch(E){y(E?.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,n]),jsxs(Fragment,{children:[!!m&&!x&&jsx("div",{className:"text-red-500 p-5",children:m}),x&&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:u,className:"w-full h-full overflow-auto"})]})},"DocxDriver");var Hr=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"),Rt=a(({url:r,extension:n})=>{let[u,m]=useState(""),[y,x]=useState(true),[h,D]=useState(null);if(useEffect(()=>{a(async()=>{try{x(!0),D(null);let M=await fetch(r);if(!M.ok)throw new Error(`Failed to load file: ${M.statusText}`);let z=await M.text();m(z);}catch(M){D(M instanceof Error?M.message:"Failed to load text content");}finally{x(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 E=Hr(n);return jsx("div",{className:"h-full w-full overflow-auto",children:E!=="text"?jsx(Prism,{className:"min-h-full! m-0! py-0!",language:E,style:darcula,showLineNumbers:true,wrapLines:true,children:u}):jsx("pre",{className:"whitespace-pre-wrap p-4 text-sm font-mono bg-gray-50 min-h-full",children:u})})},"TextDriver");var zt=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 jt=memo(a(function({extension:n,blob:u,path:m,buffer:y,not_supported_message:x=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:n,blob:u,path:m,buffer:y});let h=n.toLocaleLowerCase().trim(),D;if(m?D=m:u&&(D=URL.createObjectURL(u)),D){if(["jpeg","jpg","png","gif","bmp","webp"].includes(h))return jsx(Pt,{url:D});if(["mp3","wav","ogg","flac"].includes(h))return jsx(Mt,{url:D});if(["mp4","webm"].includes(h))return jsx(zt,{url:D});if(n==="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(Rt,{url:D,extension:h})}return h==="docx"?jsx(Lt,{url:D,blob:u}):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:x})})})},"Driver"));var Cs=a(r=>jsx("div",{className:"h-full w-full",children:jsx(jt,{...r})}),"FileViewer");var Os=a(({text:r,speed:n=50,onDone:u,markdown:m=false,markdownComponents:y={},className:x,...h})=>{let[D,E]=useState("");return useEffect(()=>{let A;if(n>0){E("");let W=0;A=setInterval(()=>{let M=r.charAt(W);E(z=>z+M),W++,W>=r.length&&(clearInterval(A),u?.());},n);}else E(r),u?.();return ()=>{A&&clearInterval(A);}},[r,n,u]),m?jsx("div",{className:x,children:jsx(_r,{remarkPlugins:[qr],components:y,...h,children:D})}):jsx(Wa,{className:x,...h,children:D})},"Typewriter");var Kr={timeout:2e3,message:"Copied!"},Us=a(({text:r,children:n,format:u="text/plain",tooltip:m})=>{let[y,x]=useState(false),h=useRef(null),D={...Kr,...m},E=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):Vr(r,{format:u}),x(true),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>x(false),D.timeout);},"handleCopy");return useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]),jsx(yb,{onMouseLeave:()=>x(false),className:y?"visible":"hidden",content:D.message,children:n({copy:E})})},"CopyToClipboard");var Ft=a(r=>new Date(r?Array.isArray(r)?r[1]||r[0]||new Date:r:new Date),"getInitValue"),Ne=a((r,n)=>{let u;if(n){let y=parse(r||"",n,new Date);if(isValid(y)&&getYear(y)>=1970)return y}let m=new Date(r||"");return isNaN(m.getTime())?u:m},"parseDate"),ln=a((r,n)=>{let u=r?Ne(r,n):void 0;return u&&n?format(u,n):r},"renderDate"),cc=a(({value:r,range:n,inline:u=false,minDate:m=new Date(getYear(new Date)-5,0,1),maxDate:y=new Date(getYear(new Date)+5,11,31),format:x="dd.MM.yyyy",onChange:h,...D})=>{let[E,A]=useState(getMonth(Ft(r))),[W,M]=useState(getYear(Ft(r))),z=useMemo(()=>{if(r){if(Array.isArray(r)){let t=Ne(r[0],x),G=Ne(r[1],x);return [t,G]}return Ne(r,x)}},[r]),ne=useCallback(t=>{if(n){let G=!!(z&&Array.isArray(z)&&z[0]),U=!!(z&&Array.isArray(z)&&z[1]);!G||G&&U?h?.([t.toString(),""]):G&&!U&&(t<z[0]?h?.([t.toString(),z[0].toString()]):h?.([z[0].toString(),t.toString()]));}else h?.(t.toString());},[n,z,h]);return u?jsx(At,{month:E,year:W,minDate:m,maxDate:y,selectedDate:z,onSelectDate:ne,onChangeMonth:A,onChangeYear:M}):n?jsx(dn,{range:true,value:r,onChange:h,...D}):jsx(un,{value:r,onChange:h,minDate:m,maxDate:y,month:E,year:W,selectedDate:z,onChangeMonth:A,onChangeYear:M,onSelectDate:ne,formatStr:x,...D})},"DatePicker"),dn=a(({minDate:r,maxDate:n,value:u,onChange:m})=>null,"DatePickerGroupInput"),un=a(({placeholder:r,value:n,onChange:u,inputProps:m,...y$1})=>{let[x,h]=useState(false),D=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:x,onClickOutside:()=>h(false),content:jsx(mb,{children:jsx(At,{...y$1})}),containerStyle:{zIndex:`${D.zIndex.popover}`},children:jsx("div",{onClick:()=>h(true),children:jsx(ib,{...m,placeholder:r,value:ln(n,y$1.formatStr),onChange:E=>u?.(E.target.value)})})})},"DatePickerInput"),At=a(({month:r,year:n,selectedDate:u,minDate:m,maxDate:y,onSelectDate:x,onChangeMonth:h,onChangeYear:D})=>{let E=useMemo(()=>new Array(12).fill(null).map((k,_)=>{let N=new Date(0,_);return {value:_+1,inputDisplay:format(N,"MMMM")}}),[]),A=useMemo(()=>{let k=getYear(m),N=getYear(y)-k+1;return new Array(N).fill(null).map((S,K)=>{let ee=k+K;return {value:ee,inputDisplay:ee.toString()}})},[m,y]),W=useMemo(()=>new Array(7).fill(null).map((k,_)=>{let N=startOfWeek(new Date,{weekStartsOn:_});return format(N,"EEE")}),[]),M=useMemo(()=>{let k=getWeeksInMonth(new Date(n,r)),_=startOfMonth(new Date(n,r)),N=previousMonday(_),S=differenceInDays(_,N);return new Array(k*7).fill(null).map((K,ee)=>new Date(n,r,ee-S+1))},[r,n]),z$1=useCallback(()=>{r===0?(D(n-1),h(11)):h(r-1);},[r,n]),ne=useCallback(()=>{r===11?(D(n+1),h(0)):h(r+1);},[r,n]),t=useMemo(()=>m?!(n<getYear(m)||n===getYear(m)&&r<=getMonth(m)):true,[r,n,m]),G$1=useMemo(()=>y?!(n>getYear(y)||n===getYear(y)&&r>=getMonth(y)):true,[r,n,y]),U=useCallback(k=>{k.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:U,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:z$1}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(gb,{placeholder:"",hasBorder:false,selected:r+1,options:E,onSelect:k=>h(k-1),maxWidth:150,maxHeight:300}),jsx(gb,{placeholder:"",hasBorder:false,selected:n,options:A,onSelect:k=>D(k),maxWidth:100,maxHeight:300})]}),G$1&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:ne})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:W.map(k=>jsx("div",{className:"text-center",children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:M.map(k=>{let _=getMonth(k)===r,N=format(k,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),S=u&&(Array.isArray(u)&&(u[0]&&format(k,"yyyy-MM-dd")===format(u[0],"yyyy-MM-dd")||u[1]&&format(k,"yyyy-MM-dd")===format(u[1],"yyyy-MM-dd"))||!Array.isArray(u)&&format(k,"yyyy-MM-dd")===format(u,"yyyy-MM-dd")),K=u&&Array.isArray(u)&&u[0]&&u[1]&&k>u[0]&&k<u[1],ee=m&&k<m||y&&k>y||!_;return jsx(pn,{date:k,isCurrentMonth:_,isCurrentDay:N,isSelected:!!S,isInRange:!!K,isDisabled:!!ee,onSelectDate:x},k.toISOString())})})]})},"DatePickerCalendar"),pn=a(({date:r,isCurrentMonth:n,isCurrentDay:u,isSelected:m,isInRange:y,isDisabled:x,onSelectDate:h})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${x?"text-gray-400 cursor-not-allowed":m?"bg-blue-500 text-white":y?"bg-blue-100":u?"text-blue-500":n?"text-black":"text-gray-400"} ${x?"":m?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(E=>{x||h(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");export{ta as Container,Us as CopyToClipboard,cc as DatePicker,At as DatePickerCalendar,Cs as FileViewer,Ia as FullscreenCard,Pr as Graph2D,Oi as PageContent,zi as PageLayout,Jt as Styled,Gt as StyledContainer,Vt as StyledMain,Xi as SubNav,Os as Typewriter};//# sourceMappingURL=index.mjs.map
67
67
  //# sourceMappingURL=index.mjs.map