@cyber-harbour/ui 2.0.39 → 2.0.40
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.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,w,x,u,c,l,z,Pa,mb,ma,Wa,yb,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
|
|
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`
|
|
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,ib,G,gb,H}from'./chunk-JJ6PGR3K.mjs';export
|
|
|
9
9
|
& > header {
|
|
10
10
|
grid-area: header;
|
|
11
11
|
}
|
|
12
|
-
`;var Oi=a(({children:r,className:n})=>jsx(
|
|
12
|
+
`;var Oi=a(({children:r,className:n})=>jsx(Vt,{className:n,children:r}),"PageContent"),Vt=styled.main`
|
|
13
13
|
grid-area: content;
|
|
14
14
|
min-width: 0;
|
|
15
15
|
background: ${({theme:r})=>r.colors.backgroundBase};
|
|
16
|
-
`;var Xi=a(({children:r,className:n,top:u=0})=>jsx(
|
|
16
|
+
`;var Xi=a(({children:r,className:n,top:u=0})=>jsx(Jt,{className:n,$top:u,onClick:m=>m.stopPropagation(),children:r}),"SubNav"),Jt=styled.div(({theme:r,$top:n})=>`
|
|
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,ib,G,gb,H}from'./chunk-JJ6PGR3K.mjs';export
|
|
|
33
33
|
position: sticky;
|
|
34
34
|
border-right: 1px solid ${r.colors.stroke.light};
|
|
35
35
|
}
|
|
36
|
-
`);var ta=w(({maxWidth:r,...n})=>jsx(
|
|
36
|
+
`);var ta=w(({maxWidth:r,...n})=>jsx(er,{...n,$maxWidth:r})),er=x(styled.div(({theme:r,$maxWidth:n,px:u$1=20})=>`
|
|
37
37
|
${u(r,"padding-inline",u$1)}
|
|
38
38
|
width: 100%;
|
|
39
39
|
min-width: 0;
|
|
40
40
|
max-width: ${typeof n=="number"?c(n,r.baseSize):n||"100%"};
|
|
41
|
-
`),{ignoreStyles:["padding-inline"]});var
|
|
41
|
+
`),{ignoreStyles:["padding-inline"]});var ir=nr.div`
|
|
42
42
|
width: 100%;
|
|
43
43
|
height: 100%;
|
|
44
44
|
display: flex;
|
|
45
45
|
align-items: center;
|
|
46
46
|
justify-content: center;
|
|
47
|
-
`,ir=a(({width:r=280,height:n=280})=>{let u=useTheme();return jsx(or,{children:jsxs(tr,{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"),mt=ir;var De=typeof window<"u"&&window.devicePixelRatio||1;function kr(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(kr,"prepareButtonImages");var j={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},Dr=forwardRef(({loading:r,width:n,height:u,graphData:m,buttons:y=[],onNodeClick:x,onBackgroundClick:h,onNodeHover:k,onLinkHover:A,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(()=>ur(m),[m]),[F,U]=useState([]),R=useRef(null),P=useRef(null),Z=useRef(null),Ft=scaleOrdinal(schemeCategory10),At=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=j.gridSpacing,s=j.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,j.gridSpacing,j.dotSize]),Ot=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,j.maxZoom)/j.maxZoom;return Math.max(j.fontSize*o,j.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,$=j.nodeSizeBase/2,L=j.nodeSizeBase/2,z=4,p={x:c.x+T*$,y:c.y+C*$},D={x:l.x-T*(L+z),y:l.y-C*(L+z)},b={x:l.x-T*(L+1),y:l.y-C*(L+1)},H=t.current.highlightLinks.has(a),B=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=B,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=B,e.lineWidth=W,e.stroke();}else e.beginPath(),e.moveTo(p.x,p.y),e.lineTo(D.x,D.y),e.strokeStyle=B,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=B,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();}}));},[j,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(!F||F.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(F.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-j.nodeSizeBase/2+T,L=o+Math.cos(C)*$,z=a+Math.sin(C)*$,p=F[l$1];if(p.loading){let D=T/2,b=T/12;i.save(),i.translate(L,z),i.rotate(t.current.spinnerAngle);for(let H=0;H<12;H++){let B=Math.PI*2*H/12,W=H/12,q=Math.cos(B)*D,ne=Math.sin(B)*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,z,T,b,S.graph2D?.button?.textColor):D.onload=()=>{Z.current&&_e(i,D,L,z,T,b,S.graph2D?.button?.textColor);};}}i.restore();},[F,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=j.nodeSizeBase,T=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=S.graph2D.ring.highlightFill,e.fill();}if(g)if(y&&y.length>0)qe(o,e);else {let C=j.nodeSizeBase*j.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||Ft(o.group||"0"),e.fill(),l){e.save(),e.translate(a,s);let C=t.current.transform.k,$=Ce(C),L=w*j.textPaddingFactor;e.font=`${$}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle=c||"#000";let z=Ot(l,L,e);e.fillText(z,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,B=typeof b.target=="object"?b.target.id:b.target;return H===p.id&&g.has(B)||B===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,B=$.find(W=>W.id===H);if(B&&B.x!==void 0&&B.y!==void 0){let W=30+Math.random()*20,q=Math.random()*Math.PI*2;p.x=B.x+Math.cos(q)*W,p.y=B.y+Math.sin(q)*W,p.vx=0,p.vy=0;}}else {let b=d/2,H=c/2,B=Math.min(d,c)/4,W=Math.random()*Math.PI*2;p.x=b+Math.cos(W)*(B*Math.random()),p.y=H+Math.sin(W)*(B*Math.random()),p.vx=0,p.vy=0;}}),s.forEach(p=>{p.fx=p.x,p.fy=p.y;})),P.current.nodes($);let z=P.current.force("link");z&&z.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),z=s+w/2,p=d+T/2,D={k:L,x:f/2-z*L,y:g/2-p*L};if(e>0){let b={...t.current.transform},H=Date.now(),B=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(B);},"animateZoom");requestAnimationFrame(B);}else t.current.transform=D,G();}},[]),me=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},[]),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,z=d-T,p=c-C,D=$-T,b=L-C,H=z*D+p*b,B=D*D+b*b;if(B===0)return false;let W=H/B;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,A&&A(e),t.current.highlightNodes=i,t.current.highlightLinks=o;},[A,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&&F.length>0){let a=j.nodeSizeBase*j.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(F.length,8),L=Math.min(Math.PI*2/$,Math.PI);for(let z=0;z<$;z++){let p=z*L,D=(z+1)*L;if(Je(g,w,T,C,a,p,D)){o=z;break}}}return o},[F]),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&&F.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();},[F,me,ye,Ne,Te,G,Je,ve]),$t=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;F.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,F]),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"),Ht=useCallback(e=>{Ee(e,Ie);},[Ie]),je=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.preventDefault(),e.stopPropagation()),t.current.mustBeStoppedPropagation=false,Ee(e,we);},[we]),Wt=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;At(),re(true);let a=i/2,s=o/2,d=j.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(kr(y));},[y]),useEffect(()=>{let e=R.current;if(!(!e||typeof window>"u"))return e.addEventListener("wheel",Le,{passive:false}),e.addEventListener("touchend",je,{passive:false}),()=>{e.removeEventListener("wheel",Le),e.removeEventListener("touchend",je);}},[Le,je]),jsxs(Pr,{children:[(r||E)&&jsx(mt,{width:n,height:u}),jsx(Sr,{ref:R,style:{width:n,height:u,display:r||E?"none":"block"},onMouseDown:Ie,onMouseMove:Re,onMouseUp:we,onMouseLeave:we,onClick:$t,onTouchStart:Ht,onTouchMove:Wt})]})}),Pr=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"),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`
|
|
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
|
-
`,
|
|
54
|
+
`,Mr=styled.canvas``;Pr.displayName="Graph2D";var Ia=w(({isActive:r,position:n,top:u=0,left:m=0,right:y,bottom:x,...h})=>jsx(Tr,{$isActive:r,$position:n,$top:u,$left:m,$right:y,$bottom:x,...h})),Tr=nr.div(({$isActive:r,$top:n,$left:u,$right:m,$bottom:y,$position:x,theme:h})=>`
|
|
55
55
|
${r?`
|
|
56
56
|
position: ${x};
|
|
57
57
|
z-index: 1000;
|
|
@@ -63,5 +63,5 @@ ${r?`
|
|
|
63
63
|
`:""}
|
|
64
64
|
|
|
65
65
|
min-width: 0;
|
|
66
|
-
`);var kt=a(({url:r})=>{let[n,u]=useState(1),[m,y]=useState(),x=bt.useRef(null),h=bt.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,{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,{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 Pt=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,A]=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),A("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 Mt=a(({url:r,extension:n})=>jsxs("a",{href:r,download:`file.${n}`,className:"text-blue-500 underline",children:["Download ",n.toUpperCase()," file"]}),"DownloadDriver");var Nt=50,jr=1e4,Tt=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)>Nt){y(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Nt} \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(A){y(A?.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 $r=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"),It=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 A=$r(n);return jsx("div",{className:"h-full w-full overflow-auto",children:A!=="text"?jsx(Prism,{className:"min-h-full! m-0! py-0!",language:A,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 Lt=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 Et=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(kt,{url:k});if(["mp3","wav","ogg","flac"].includes(h))return jsx(Pt,{url:k});if(["mp4","webm"].includes(h))return jsx(Lt,{url:k});if(n==="pdf")return jsx(Fe,{url:k});if(["xlsx","pptx"].includes(h))return jsx(Mt,{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(It,{url:k,extension:h})}return h==="docx"?jsx(Tt,{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(Et,{...r})}),"FileViewer");var Os=a(({text:r,speed:n=50,onDone:u,markdown:m=false,markdownComponents:y={},className:x,...h})=>{let[k,A]=useState("");return useEffect(()=>{let O;if(n>0){A("");let Y=0;O=setInterval(()=>{let S=r.charAt(Y);A(E=>E+S),Y++,Y>=r.length&&(clearInterval(O),u?.());},n);}else A(r),u?.();return ()=>{O&&clearInterval(O);}},[r,n,u]),m?jsx("div",{className:x,children:jsx(Gr,{remarkPlugins:[_r],components:y,...h,children:k})}):jsx(Wa,{className:x,...h,children:k})},"Typewriter");var Jr={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={...Jr,...m},A=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):qr(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:A})})},"CopyToClipboard");var zt=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"),cn=a((r,n)=>{let u=r?Me(r,n):void 0;return u&&n?format(u,n):r},"renderDate"),ac=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[A,O]=useState(getMonth(zt(r))),[Y,S]=useState(getYear(zt(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(Bt,{month:A,year:Y,minDate:m,maxDate:y,selectedDate:E,onSelectDate:re,onChangeMonth:O,onChangeYear:S}):n?jsx(ln,{range:true,value:r,onChange:h,...k}):jsx(dn,{value:r,onChange:h,minDate:m,maxDate:y,month:A,year:Y,selectedDate:E,onChangeMonth:O,onChangeYear:S,onSelectDate:re,formatStr:x,...k})},"DatePicker"),ln=a(({minDate:r,maxDate:n,value:u,onChange:m})=>null,"DatePickerGroupInput"),dn=a(({placeholder:r,value:n,onChange:u,inputProps:m,...y})=>{let[x,h]=useState(false);return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:x,onClickOutside:()=>h(false),content:jsx(mb,{children:jsx(Bt,{...y})}),children:jsx("div",{onClick:()=>h(true),children:jsx(ib,{...m,placeholder:r,value:cn(n,y.formatStr),onChange:k=>u?.(k.target.value)})})})},"DatePickerInput"),Bt=a(({month:r,year:n,selectedDate:u,minDate:m,maxDate:y,onSelectDate:x,onChangeMonth:h,onChangeYear:k})=>{let A=useMemo(()=>new Array(12).fill(null).map((M,F)=>{let U=new Date(0,F);return {value:F+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,F)=>{let U=startOfWeek(new Date,{weekStartsOn:F});return format(U,"EEE")}),[]),S=useMemo(()=>{let M=getWeeksInMonth(new Date(n,r)),F=startOfMonth(new Date(n,r)),U=previousMonday(F),R=differenceInDays(F,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,{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:A,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,{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 F=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||!F;return jsx(un,{date:M,isCurrentMonth:F,isCurrentDay:U,isSelected:!!R,isInRange:!!P,isDisabled:!!Z,onSelectDate:x},M.toISOString())})})]})},"DatePickerCalendar"),un=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,ac as DatePicker,Bt as DatePickerCalendar,Cs as FileViewer,Ia as FullscreenCard,Dr as Graph2D,Oi as PageContent,ji as PageLayout,Zt as Styled,Xt as StyledContainer,qt as StyledMain,Xi as SubNav,Os as Typewriter};//# sourceMappingURL=index.mjs.map
|
|
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
|
|
67
67
|
//# sourceMappingURL=index.mjs.map
|