@cyber-harbour/ui 2.2.21 → 2.2.23
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.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +63 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -62
- package/dist/index.mjs.map +1 -1
- package/dist/styles/tailwind.css +1 -1
- package/dist/styles/tailwind.css.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,w,x,u,c,l,z,Ra,_a,na,Na,sa,rb,Eb,y,mb,G,kb,H,nb}from'./chunk-DTPQDD44.mjs';export{vb as Alert,A as AlertIcon,Ba as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ja as BallsMenu,rb as Box,q as BreakpointProvider,E as BugReportIcon,Pa as BurgerMenuIcon,ta as BusIcon,z as Button,F as CalendarIcon,ua as CarIcon,Mb as ChatField,ka as CheckIcon,xb as Checkbox,la as ChevronDownIcon,G as ChevronLeftIcon,H as ChevronRightIcon,ma as ChevronUpIcon,Qa as ClockIcon,I as CloseCircleIcon,J as ClosedLockIcon,Fb as ContentLoader,hb as ContextMenu,ib as ContextMenuDelimiter,ra as CrossIcon,K as DataSetsIcon,L as DeepSearchIcon,M as DisabledVisibleIcon,N as DocsIcon,O as DownloadIcon,Ab as Drawer,Cb as DrawerBody,Bb as DrawerHeader,P as EditUserIcon,tb as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,Ta as FaceSearchIcon,za as File2Icon,ob as FileField,ya as FileIcon,S as FiltersIcon,Ka as FlashIcon,pb as FlexContainer,qb as FlexItem,Da as FolderAlertIcon,T as FolderIcon,La as FolderInfoIcon,cb as Header,db as HeaderDelimeter,eb as HeaderSection,U as HomepageIcon,Sa as ImageIcon,pa as InfoCircleFilledIcon,V as InfoCircleIcon,mb as Input,Aa as IosIcon,wb as Label,sb as Line,yb as LinerProgress,$a as ListMenu,ab as ListMenuItem,bb as ListMenuSection,W as MapRadarIcon,sa as MaximizeIcon,Ua as MessageAsteriskIcon,Ca as MicrosoftIcon,Ra as MinusIcon,Hb as Modal,Jb as ModalBody,Kb as ModalFooter,Ib as ModalHeader,X as MoonIcon,Y as OpenLockIcon,Z as OrganizationIcon,Gb as Overlay,gb as Pagination,Ga as PassportIcon,_ as PasswordFinderIcon,Ia as PencilIcon,$ as PhonebookIcon,wa as PlaneIcon,na as PlusIcon,Ha as PointIcon,aa as PrintIcon,ba as Profiler2Icon,ca as ProfilerIcon,Nb as ProgressLoader,Ea as RelationIcon,Fa as RelationPointsIcon,Ma as RotateLeftIcon,Na as RotateRightIcon,lb as RowActionsMenu,da as SandBoxIcon,ea as SearchIcon,kb as Select,xa as ShipIcon,Wa as Sidebar,Va as SidebarContext,Ya as SidebarDelimeter,Xa as SidebarItem,Za as SidebarSection,fa as StatisticIcon,Eb as StyledTooltipContent,ga as SunIcon,zb as Switch,fb as Table,ub as Tag,Lb as TailwindExample,s as ThemeProvider,Db as Tooltip,_a as Typography,qa as UnfoldIcon,ha as UpRightArrowCircleIcon,Oa as UploadImageIcon,Ja as UserInCircleIcon,oa as UsersIcon,ia as VectorIcon,va 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,jb as useContextMenuControl,y as useTheme}from'./chunk-DTPQDD44.mjs';import
|
|
1
|
+
import {a,w,x,u,c,l,z,Ra,_a,na as na$1,Na,sa as sa$1,rb,Eb,y,mb,G,kb,H,nb}from'./chunk-DTPQDD44.mjs';export{vb as Alert,A as AlertIcon,Ba as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ja as BallsMenu,rb as Box,q as BreakpointProvider,E as BugReportIcon,Pa as BurgerMenuIcon,ta as BusIcon,z as Button,F as CalendarIcon,ua as CarIcon,Mb as ChatField,ka as CheckIcon,xb as Checkbox,la as ChevronDownIcon,G as ChevronLeftIcon,H as ChevronRightIcon,ma as ChevronUpIcon,Qa as ClockIcon,I as CloseCircleIcon,J as ClosedLockIcon,Fb as ContentLoader,hb as ContextMenu,ib as ContextMenuDelimiter,ra as CrossIcon,K as DataSetsIcon,L as DeepSearchIcon,M as DisabledVisibleIcon,N as DocsIcon,O as DownloadIcon,Ab as Drawer,Cb as DrawerBody,Bb as DrawerHeader,P as EditUserIcon,tb as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,Ta as FaceSearchIcon,za as File2Icon,ob as FileField,ya as FileIcon,S as FiltersIcon,Ka as FlashIcon,pb as FlexContainer,qb as FlexItem,Da as FolderAlertIcon,T as FolderIcon,La as FolderInfoIcon,cb as Header,db as HeaderDelimeter,eb as HeaderSection,U as HomepageIcon,Sa as ImageIcon,pa as InfoCircleFilledIcon,V as InfoCircleIcon,mb as Input,Aa as IosIcon,wb as Label,sb as Line,yb as LinerProgress,$a as ListMenu,ab as ListMenuItem,bb as ListMenuSection,W as MapRadarIcon,sa as MaximizeIcon,Ua as MessageAsteriskIcon,Ca as MicrosoftIcon,Ra as MinusIcon,Hb as Modal,Jb as ModalBody,Kb as ModalFooter,Ib as ModalHeader,X as MoonIcon,Y as OpenLockIcon,Z as OrganizationIcon,Gb as Overlay,gb as Pagination,Ga as PassportIcon,_ as PasswordFinderIcon,Ia as PencilIcon,$ as PhonebookIcon,wa as PlaneIcon,na as PlusIcon,Ha as PointIcon,aa as PrintIcon,ba as Profiler2Icon,ca as ProfilerIcon,Nb as ProgressLoader,Ea as RelationIcon,Fa as RelationPointsIcon,Ma as RotateLeftIcon,Na as RotateRightIcon,lb as RowActionsMenu,da as SandBoxIcon,ea as SearchIcon,kb as Select,xa as ShipIcon,Wa as Sidebar,Va as SidebarContext,Ya as SidebarDelimeter,Xa as SidebarItem,Za as SidebarSection,fa as StatisticIcon,Eb as StyledTooltipContent,ga as SunIcon,zb as Switch,fb as Table,ub as Tag,Lb as TailwindExample,s as ThemeProvider,Db as Tooltip,_a as Typography,qa as UnfoldIcon,ha as UpRightArrowCircleIcon,Oa as UploadImageIcon,Ja as UserInCircleIcon,oa as UsersIcon,ia as VectorIcon,va 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,jb as useContextMenuControl,y as useTheme}from'./chunk-DTPQDD44.mjs';import Vo,{styled,useTheme,keyframes,css as css$1}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs}from'react/jsx-runtime';import {useState,useRef,useCallback,useEffect,Fragment,forwardRef,useMemo,useImperativeHandle,useLayoutEffect,memo}from'react';import Qo from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import $o from'react-content-loader';import {renderAsync}from'docx-preview';import Dn from'lodash.throttle';import Nn from'@uiw/react-codemirror';import {vscodeDark,vscodeLight}from'@uiw/codemirror-theme-vscode';import {javascript}from'@codemirror/lang-javascript';import {html}from'@codemirror/lang-html';import {css}from'@codemirror/lang-css';import {python}from'@codemirror/lang-python';import {java}from'@codemirror/lang-java';import {cpp}from'@codemirror/lang-cpp';import {php}from'@codemirror/lang-php';import {rust}from'@codemirror/lang-rust';import {xml}from'@codemirror/lang-xml';import {yaml}from'@codemirror/lang-yaml';import {markdown}from'@codemirror/lang-markdown';import {sql}from'@codemirror/lang-sql';import Fn from'react-markdown';import On from'remark-gfm';import {TableVirtuoso,Virtuoso}from'react-virtuoso';import nr from'papaparse';import {darkStyles,defaultStyles,JsonView,collapseAllNested}from'react-json-view-lite';import'react-json-view-lite/dist/index.css';import _a$1 from'copy-to-clipboard';import {Popover}from'react-tiny-popover';import {parse,isValid,getYear,format,getMonth,startOfWeek,startOfMonth,endOfMonth,getDay,previousSunday,nextSaturday,differenceInDays}from'date-fns';import {createPortal}from'react-dom';var El=a(({children:e,className:o})=>jsx(Mo,{className:o,children:e}),"PageLayout"),Mo=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,Ra,_a,na,Na,sa,rb,Eb,y,mb,G,kb,H,nb}from'./chunk-DTPQDD44.
|
|
|
9
9
|
& > header {
|
|
10
10
|
grid-area: header;
|
|
11
11
|
}
|
|
12
|
-
`;var
|
|
12
|
+
`;var _l=a(({children:e,className:o})=>jsx(Ro,{className:o,children:e}),"PageContent"),Ro=styled.main`
|
|
13
13
|
grid-area: content;
|
|
14
14
|
min-width: 0;
|
|
15
|
-
background: ${({theme:
|
|
16
|
-
`;var
|
|
15
|
+
background: ${({theme:e})=>e.colors.backgroundBase};
|
|
16
|
+
`;var Hl=a(({children:e,className:o,top:n=0})=>jsx(Io,{className:o,$top:n,onClick:a=>a.stopPropagation(),children:e}),"SubNav"),Io=styled.div(({theme:e,$top:o})=>`
|
|
17
17
|
display: flex;
|
|
18
18
|
flex-direction: column;
|
|
19
19
|
justify-content: space-between;
|
|
@@ -23,47 +23,47 @@ import {a,w,x,u,c,l,z,Ra,_a,na,Na,sa,rb,Eb,y,mb,G,kb,H,nb}from'./chunk-DTPQDD44.
|
|
|
23
23
|
left: 0;
|
|
24
24
|
grid-area: sub-nav;
|
|
25
25
|
min-width: 0;
|
|
26
|
-
background: ${
|
|
26
|
+
background: ${e.colors.background};
|
|
27
27
|
max-height: calc(100dvh - ${o}px);
|
|
28
28
|
height: 100%;
|
|
29
29
|
z-index: 1001;
|
|
30
30
|
top: ${o}px;
|
|
31
31
|
overflow: auto;
|
|
32
|
-
@media (min-width: ${
|
|
32
|
+
@media (min-width: ${e.breakpoints.xl}px){
|
|
33
33
|
position: sticky;
|
|
34
|
-
border-right: 1px solid ${
|
|
34
|
+
border-right: 1px solid ${e.colors.stroke.light};
|
|
35
35
|
}
|
|
36
|
-
`);var
|
|
37
|
-
${u(
|
|
36
|
+
`);var Kl=w(({maxWidth:e,...o})=>jsx(_o,{...o,$maxWidth:e})),_o=x(styled.div(({theme:e,$maxWidth:o,px:n=20})=>`
|
|
37
|
+
${u(e,"padding-inline",n)}
|
|
38
38
|
width: 100%;
|
|
39
39
|
min-width: 0;
|
|
40
|
-
max-width: ${typeof o=="number"?c(o,
|
|
41
|
-
`),{ignoreStyles:["padding-inline"]});var
|
|
40
|
+
max-width: ${typeof o=="number"?c(o,e.baseSize):o||"100%"};
|
|
41
|
+
`),{ignoreStyles:["padding-inline"]});var Ho=20,Wo="splitter_columns_widths",zr=a((e,o,n)=>{let a=localStorage.getItem(e);if(a)try{let l=JSON.parse(a);if(Array.isArray(l)&&l.length===o)return l}catch{}else if(n.length===o)return n;return Array(o).fill(100/o)},"getSavedWidths"),nc=a(({columns:e,initialWidths:o,layoutClassname:n="",splitterClassname:a="",minWidth:l=Ho,storageKey:i=Wo})=>{let[d,b]=useState(()=>zr(i,e.length,o)),v=useRef(null),x=useRef(null),C=useRef(l),h=useRef(d),R=useCallback(S=>{if(x.current===null||!v.current)return;let D=v.current.getBoundingClientRect(),P=D.width,W=S-D.left,V=[...h.current],X=x.current,q=X+1,ce=V.slice(0,X).reduce((ye,pe)=>ye+pe,0),de=W/P*100-ce,se=V[X]+V[q]-de;de>=C.current&&se>=C.current&&(V[X]=de,V[q]=se,b(V),h.current=V);},[]),A=useCallback(S=>R(S.clientX),[R]),r=useCallback(S=>{S.preventDefault(),R(S.touches[0].clientX);},[R]),L=useCallback(()=>{x.current=null,localStorage.setItem(i,JSON.stringify(h.current)),document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",r),document.removeEventListener("touchend",L);},[A,r,i]),k=useCallback(S=>D=>{D.preventDefault(),x.current=S,document.addEventListener("mousemove",A,{passive:false}),document.addEventListener("mouseup",L);},[A,L]),T=useCallback(S=>D=>{D.preventDefault(),x.current=S,document.addEventListener("touchmove",r,{passive:false}),document.addEventListener("touchend",L);},[r,L]);return useEffect(()=>{let S=zr(i,e.length,o);h.current=S,b(S);},[e.length,o,i]),jsx("div",{ref:v,className:`flex select-none ${n}`,children:e.map(({content:S,className:D},P)=>jsxs(Fragment,{children:[jsx("div",{className:D,style:{flex:`${d[P]} 1 0%`},children:S}),P<e.length-1&&jsx("div",{onMouseDown:k(P),onTouchStart:T(P),className:`hidden lg:flex! lg:sticky lg:top-0 border-s border-gray-200 dark:border-neutral-700 ${a}`,children:jsx("span",{className:"absolute top-1/2 start-1/2 -translate-x-1/2 -translate-y-1/2 block w-5 h-8 flex justify-center items-center bg-white dark:bg-neutral-800 border border-gray-200 dark:border-neutral-700 text-gray-400 dark:text-neutral-500 rounded-md cursor-col-resize hover:bg-gray-100 dark:hover:bg-neutral-700",children:jsxs("svg",{className:"shrink-0 size-5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"9",cy:"12",r:"1"}),jsx("circle",{cx:"9",cy:"5",r:"1"}),jsx("circle",{cx:"9",cy:"19",r:"1"}),jsx("circle",{cx:"15",cy:"12",r:"1"}),jsx("circle",{cx:"15",cy:"5",r:"1"}),jsx("circle",{cx:"15",cy:"19",r:"1"})]})})})]},`${P}`))})},"SplitterLayout");var qo=Vo.div`
|
|
42
42
|
width: 100%;
|
|
43
43
|
height: 100%;
|
|
44
44
|
display: flex;
|
|
45
45
|
align-items: center;
|
|
46
46
|
justify-content: center;
|
|
47
|
-
`,Co=a(({width:r=280,height:o=280})=>{let n=useTheme();return jsx(Do,{children:jsxs(xo,{foregroundColor:n.contentLoader.foreground,backgroundColor:n.contentLoader.background,width:r,height:o,viewBox:"0 0 280 280",children:[jsx("path",{d:"m55 38-0.97266 0.22852 7.0801 30.092-18.355-20.979-0.75195 0.6582 19.596 22.395 0.43164 1.834 0.97266-0.22852 0.75195-0.6582-0.37695-0.42969 9.625-27.912-0.94531-0.32617-9.4375 27.371-0.10547-0.12109zm8 34-0.78516 0.61914 0.0957 0.12305-12.311 13.258 0.73242 0.67969 12.205-13.145 14.277 18.084 0.78516-0.61914-14.373-18.207 0.10547-0.11328zm15 19-0.48438 0.875 46.992 25.996 8e-3 4e-3 20.506 11.592-28.182 4.5449 0.15998 0.98819 29.418-4.7441 0.25 0.14062-12.555 24.143 0.88672 0.46094 13-25 15 25 26 30v18l-11 18 0.85352 0.52148 9.8008-16.039-4.6543 33.518 0.99023 0.13867 4.7793-34.408 7.2305 16.27 0.91406-0.40625-7.9141-17.807v-17.104l18 12.316 0.56445-0.82617-18.896-12.928-25.855-29.836-14.633-24.387 0.01562-0.02344h23.805v-1h-23.152l13.848-21.234 55.201-28.791-0.45898-0.88476 0.77734 0.62305 11.402-14.25 16.668-11.842-0.58008-0.81641-16.785 11.928-11.486 14.355-55.434 28.912-14.277 21.893-7.7617-27.166-0.96094 0.27344 7.7227 27.031-1.1191 0.17969-21.604-12.211zm140.43-12.912-6.957-17.338-0.92773 0.37305 6.957 17.338zm-6.957-17.338 0.72266 0.69336 16.232-16.896-0.7207-0.69336zm-3.4766 137.25 5 15 0.94922-0.31641-5-15zm-91-63-0.48047-0.87695-31 17 0.48047 0.87695zm-31 17 5 18 0.96289-0.26758-5-18zm0 0-0.70703-0.70703-12.898 12.898-17.881 9.9336 0.48633 0.875 18-10zm5 18-0.64062-0.76758-18 15 0.64062 0.76758z"}),jsx("circle",{cx:"229.92",cy:"63.7318",r:"5",transform:"rotate(173.661 229.92 63.7318)"}),jsx("circle",{cx:"227.711",cy:"43.8541",r:"5",transform:"rotate(173.661 227.711 43.8541)"}),jsx("circle",{cx:"211.478",cy:"60.7499",r:"5",transform:"rotate(173.661 211.478 60.7499)"}),jsx("circle",{cx:"218.434",cy:"78.0877",r:"5",transform:"rotate(173.661 218.434 78.0877)"}),jsx("circle",{cx:"246.705",cy:"51.8054",r:"5",transform:"rotate(173.661 246.705 51.8054)"}),jsx("circle",{cx:"42",cy:"48",r:"5"}),jsx("circle",{cx:"55",cy:"38",r:"5"}),jsx("circle",{cx:"73",cy:"43",r:"5"}),jsx("circle",{cx:"63",cy:"72",r:"5"}),jsx("circle",{cx:"50",cy:"86",r:"5"}),jsx("circle",{cx:"78",cy:"91",r:"5"}),jsx("circle",{cx:"73",cy:"165",r:"5"}),jsx("circle",{cx:"73",cy:"185",r:"5"}),jsx("circle",{cx:"91",cy:"170",r:"5"}),jsx("circle",{cx:"86",cy:"152",r:"5"}),jsx("circle",{cx:"148",cy:"130",r:"5"}),jsx("circle",{cx:"189",cy:"185",r:"5"}),jsx("circle",{cx:"163",cy:"107",r:"5"}),jsx("circle",{cx:"140",cy:"102",r:"5"}),jsx("circle",{cx:"117",cy:"135",r:"5"}),jsx("circle",{cx:"125",cy:"117",r:"5"}),jsx("circle",{cx:"208",cy:"198",r:"5"}),jsx("circle",{cx:"189",cy:"203",r:"5"}),jsx("circle",{cx:"198",cy:"221",r:"5"}),jsx("circle",{cx:"178",cy:"221",r:"5"}),jsx("circle",{cx:"184",cy:"239",r:"5"}),jsx("circle",{cx:"213",cy:"213",r:"5"}),jsx("circle",{cx:"173",cy:"130",r:"5"}),jsx("circle",{cx:"163",cy:"155",r:"5"}),jsx("circle",{cx:"135",cy:"155",r:"5"}),jsx("circle",{cx:"55",cy:"175",r:"5"})]})})},"GraphLoader"),gr=Co;var yt=typeof window<"u"&&window.devicePixelRatio||1;function Wo(r){return !r||r.length===0?[]:r.map(o=>{let n=new Image;n.src=o.img;let a=new Image;return a.src=o.hoverImg,{...o,normalImg:n,hoverImg:a}})}a(Wo,"prepareButtonImages");var te={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},$o=forwardRef(({loading:r,width:o,height:n,graphData:a$1,buttons:u=[],onNodeClick:s,onBackgroundClick:g,onNodeHover:w,onLinkHover:k,onLinkClick:L},R)=>{let f=useTheme(),[z,F]=useState(true),t=useRef({transform:{x:0,y:0,k:1},isPanning:false,hoveredNode:null,hoveredLink:null,draggedNode:null,selectedNode:null,hoveredButtonIndex:null,highlightNodes:new Set,highlightLinks:new Set,lastMousePos:{x:0,y:0},mustBeStoppedPropagation:false,mouseStartPos:null,isDragging:false,width:o*yt,height:n*yt,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:I,links:x}=useMemo(()=>Eo(a$1),[a$1]),[N,C]=useState([]),M=useRef(null),D=useRef(null),W=useRef(null),Y=scaleOrdinal(schemeCategory10),Z=useCallback(()=>{if(!M.current)return false;try{let e=M.current.getContext("2d");return e?(W.current=e,!0):(console.error("Failed to get 2D context"),!1)}catch(e){return console.error("Error initializing Canvas 2D context:",e),false}},[]),oe=useCallback(()=>D.current?D.current.nodes():null,[]),me=useCallback(()=>{if(!D.current)return null;let e=D.current.force("link");return e?e.links():null},[]),be=useCallback(e=>{e.save(),e.setTransform(1,0,0,1,0,0);let{width:c,height:d}=t.current,l=te.gridSpacing,h=te.dotSize;e.fillStyle=f.graph2D.grid.dotColor;for(let y=l/2;y<=c;y+=l)for(let m=l/2;m<=d;m+=l)e.beginPath(),e.arc(y,m,h,0,2*Math.PI),e.fill();e.restore();},[f.graph2D.grid.dotColor,te.gridSpacing,te.dotSize]),de=useCallback((e,c,d)=>{if(!e)return "";if(d.measureText(e).width<=c)return e;let h=e,y="...";for(;d.measureText(h+y).width>c&&h.length>0;)h=h.slice(0,-1);return h+y},[]),Re=a(e=>{let d=Math.min(e,te.maxZoom)/te.maxZoom;return Math.max(te.fontSize*d,te.fontSize)},"calculateFontSize"),ve=useCallback(e=>{let c=me(),d=oe();!c||c.length===0||!d||d.length===0||(e.lineWidth=.5,e.globalAlpha=1,c.forEach(l=>{let h=typeof l.source=="object"?l.source:d.find(Ce=>Ce.id===l.source),y=typeof l.target=="object"?l.target:d.find(Ce=>Ce.id===l.target);if(!h||!y)return;let m={x:h.x||0,y:h.y||0},b={x:y.x||0,y:y.y||0},T=b.x-m.x,E=b.y-m.y,_=Math.sqrt(T*T+E*E),U=T/_,H=E/_,re=te.nodeSizeBase/2,V=te.nodeSizeBase/2,v=4,p={x:m.x+U*re,y:m.y+H*re},P={x:b.x-U*(V+v),y:b.y-H*(V+v)},S={x:b.x-U*(V+1),y:b.y-H*(V+1)},j=t.current.highlightLinks.has(l),O=j?f.graph2D.link.highlighted:f.graph2D.link.normal,G=j?1.5:.5,se=m.x+(b.x-m.x)/2,ke=m.y+(b.y-m.y)/2,Ee=Math.atan2(E,T);if(l.label){let Ce=t.current.transform.k,pe=Re(Ce);e.font=`${pe}px Sans-Serif`;let Me=e.measureText(l.label).width,at=10;e.beginPath(),e.moveTo(p.x,p.y);let Kt=_/2-(Me+at)/2,Jt={x:m.x+U*Kt,y:m.y+H*Kt};e.lineTo(Jt.x,Jt.y),e.strokeStyle=O,e.lineWidth=G,e.stroke(),e.beginPath();let Qt=_/2+(Me+at)/2,er={x:m.x+U*Qt,y:m.y+H*Qt};e.moveTo(er.x,er.y),e.lineTo(P.x,P.y),e.strokeStyle=O,e.lineWidth=G,e.stroke();}else e.beginPath(),e.moveTo(p.x,p.y),e.lineTo(P.x,P.y),e.strokeStyle=O,e.lineWidth=G,e.stroke();let Be=2;if(e.save(),e.translate(S.x,S.y),e.rotate(Ee),e.beginPath(),e.moveTo(0,0),e.lineTo(-v,Be),e.lineTo(-v,0),e.lineTo(-v,-Be),e.closePath(),e.fillStyle=O,e.fill(),e.restore(),l.label){let Ce=t.current.transform.k,pe=Re(Ce);e.font=`${pe}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(se,ke),Math.abs(Ee)>Math.PI/2?e.rotate(Ee+Math.PI):e.rotate(Ee),e.fillStyle=j?f.graph2D.link.highlightedTextColor:f.graph2D.link.textColor,e.fillText(l.label,0,0),e.restore();}}));},[te,f.graph2D.link]),$=a((e,c,d,l,h,y,m)=>{try{if(y!=null){let b=h*.8;e.font=`${b}px sans-serif`,e.textBaseline="middle",e.textAlign="left";let T=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(y),E=e.measureText(T).width,_=h*.3,H=(h+_+E)/2;e.drawImage(c,d-H,l-h/2,h,h),e.fillStyle=m||"#99989C",e.fillText(T,d-H+h+_,l);}else e.drawImage(c,d-h/2,l-h/2,h,h);}catch(b){console.warn("Error rendering icon:",b);}},"drawIconWithOptionalCounter"),A=useCallback((e,c)=>{if(!N||N.length===0||!e||!e.x||!e.y)return;let{x:d,y:l$1}=e,h=te.nodeSizeBase*te.nodeAreaFactor/2;c.save();let y=Math.min(N.length,8),m=Math.min(Math.PI*2/y,Math.PI);for(let b=0;b<y;b++){let T=b*m,E=(b+1)*m,_=t.current.hoveredButtonIndex===b;c.beginPath(),c.arc(d,l$1,h,T,E,false),c.lineTo(d,l$1),c.closePath(),c.lineWidth=1,c.strokeStyle=f.graph2D?.button?.stroke||"#FFFFFF",c.stroke(),c.fillStyle=_?f.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":f.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",c.fill();let U=h*.2,H=(T+E)/2,re=h-te.nodeSizeBase/2+U,V=d+Math.cos(H)*re,v=l$1+Math.sin(H)*re,p=N[b];if(p.loading){let P=U/2,S=U/12;c.save(),c.translate(V,v),c.rotate(t.current.spinnerAngle);for(let j=0;j<12;j++){let O=Math.PI*2*j/12,G=j/12,se=Math.cos(O)*P,ke=Math.sin(O)*P;c.beginPath(),c.fillStyle=l(f.graph2D?.button?.spinnerColor,G),c.arc(se,ke,S,0,Math.PI*2),c.fill();}c.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(B),t.current.animation.buttonIndex=b;}else {t.current.animation.id&&t.current.animation.buttonIndex===b&&(cancelAnimationFrame(t.current.animation.id),t.current.animation.id=null,t.current.animation.buttonIndex=null);let P=_?p.hoverImg:p.normalImg,S=p.getCount?p.getCount(e):null;P.complete?$(c,P,V,v,U,S,f.graph2D?.button?.textColor):P.onload=()=>{W.current&&$(c,P,V,v,U,S,f.graph2D?.button?.textColor);};}}c.restore();},[N,f.graph2D?.button]),K=useCallback(e=>{let c=oe();!c||c.length===0||(e.globalAlpha=1,c.forEach(d=>{let{x:l,y:h,color:y,fontColor:m,label:b}=d,T=t.current.highlightNodes.has(d)||d===t.current.hoveredNode||d===t.current.draggedNode,E=d===t.current.selectedNode,_=te.nodeSizeBase,U=te.nodeSizeBase/2;if(T&&!E){let H=te.nodeSizeBase*te.nodeAreaFactor*.75/2;e.beginPath(),e.arc(l,h,H,0,2*Math.PI,false),e.fillStyle=f.graph2D.ring.highlightFill,e.fill();}if(E)if(u&&u.length>0)A(d,e);else {let H=te.nodeSizeBase*te.nodeAreaFactor/2;e.beginPath(),e.arc(l,h,H,0,2*Math.PI,false),e.fillStyle=f.graph2D.ring.selectionFill||f.graph2D.ring.highlightFill,e.fill();}if(e.beginPath(),e.arc(l,h,U,0,2*Math.PI),e.fillStyle=y||Y(d.group||"0"),e.fill(),b){e.save(),e.translate(l,h);let H=t.current.transform.k,re=Re(H),V=_*te.textPaddingFactor;e.font=`${re}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle=m||"#000";let v=de(b,V,e);e.fillText(v,0,0),e.restore();}}));},[f.graph2D.ring,u,A]),B=useCallback(()=>{let e=W.current;e&&(e.clearRect(0,0,t.current.width,t.current.height),be(e),e.save(),e.setTransform(t.current.transform.k,0,0,t.current.transform.k,t.current.transform.x,t.current.transform.y),ve(e),K(e),e.restore());},[ve,K,be]),Q=useCallback((e,c=[],d)=>{let l=me()||[],h=oe()||[];if(!D.current||!e.length)return;let{width:y,height:m}=t.current,b=d?.smoothAppearance??false,T=d?.transitionDuration??1e3,E=new Set(h.map(p=>p.id)),_=e.filter(p=>!E.has(p.id)),U=new Set(l.map(p=>`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`)),H=c.filter(p=>{let P=`${typeof p.source=="object"?p.source.id:p.source}-${typeof p.target=="object"?p.target.id:p.target}`;return !U.has(P)});if(_.length===0&&H.length===0)return;let re=[...h,..._],V=[...l,...H];b&&(_.forEach(p=>{let P=H.filter(S=>{let j=typeof S.source=="object"?S.source.id:S.source,O=typeof S.target=="object"?S.target.id:S.target;return j===p.id&&E.has(O)||O===p.id&&E.has(j)});if(P.length>0){let S=P[0],j=typeof S.source=="object"?S.source.id===p.id?S.target:S.source.id:S.source===p.id?S.target:S.source,O=re.find(G=>G.id===j);if(O&&O.x!==void 0&&O.y!==void 0){let G=30+Math.random()*20,se=Math.random()*Math.PI*2;p.x=O.x+Math.cos(se)*G,p.y=O.y+Math.sin(se)*G,p.vx=0,p.vy=0;}}else {let S=y/2,j=m/2,O=Math.min(y,m)/4,G=Math.random()*Math.PI*2;p.x=S+Math.cos(G)*(O*Math.random()),p.y=j+Math.sin(G)*(O*Math.random()),p.vx=0,p.vy=0;}}),h.forEach(p=>{p.fx=p.x,p.fy=p.y;})),D.current.nodes(re);let v=D.current.force("link");v&&v.links(V),H.forEach(p=>{let P=typeof p.source=="object"?p.source:re.find(j=>j.id===p.source),S=typeof p.target=="object"?p.target:re.find(j=>j.id===p.target);!P||!S||(!P.neighbors&&(P.neighbors=[]),!S.neighbors&&(S.neighbors=[]),P.neighbors.push(S),S.neighbors.push(P),!P.links&&(P.links=[]),!S.links&&(S.links=[]),P.links.push(p),S.links.push(p));}),b?(D.current.alphaTarget(.3),D.current.alpha(.3),D.current.velocityDecay(.7),D.current.restart(),setTimeout(()=>{h.forEach(p=>{p.fx=void 0,p.fy=void 0;}),D.current?.alphaTarget(0),D.current?.alpha(.1),D.current?.velocityDecay(.6);},T)):D.current.alpha(.1).restart(),B();},[I,B]),ae=useCallback(e=>{let c=oe(),d=me();if(!D.current||!e.length||!c||c.length===0||!d||d.length===0)return;let l=new Set(e);if(t.current.selectedNode&&t.current.selectedNode.id!==void 0&&l.has(t.current.selectedNode.id)&&(t.current.selectedNode=null),t.current.hoveredNode&&t.current.hoveredNode.id!==void 0&&l.has(t.current.hoveredNode.id)&&(t.current.hoveredNode=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set),t.current.hoveredLink){let b=typeof t.current.hoveredLink.source=="object"?t.current.hoveredLink.source.id:t.current.hoveredLink.source,T=typeof t.current.hoveredLink.target=="object"?t.current.hoveredLink.target.id:t.current.hoveredLink.target;(b!==void 0&&l.has(b)||T!==void 0&&l.has(T))&&(t.current.hoveredLink=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set);}t.current.draggedNode&&t.current.draggedNode.id!==void 0&&l.has(t.current.draggedNode.id)&&(t.current.draggedNode=null);let h=c.filter(b=>b.id!==void 0&&!l.has(b.id)),y=d.filter(b=>{let T=typeof b.source=="object"?b.source.id:b.source,E=typeof b.target=="object"?b.target.id:b.target;return T!==void 0&&!l.has(T)&&E!==void 0&&!l.has(E)});h.forEach(b=>{b.neighbors=[],b.links=[];}),y.forEach(b=>{let T=typeof b.source=="object"?b.source:h.find(_=>_.id===b.source),E=typeof b.target=="object"?b.target:h.find(_=>_.id===b.target);!T||!E||(T.neighbors=T.neighbors||[],E.neighbors=E.neighbors||[],T.neighbors.push(E),E.neighbors.push(T),T.links=T.links||[],E.links=E.links||[],T.links.push(b),E.links.push(b));}),D.current.nodes(h);let m=D.current.force("link");m&&m.links(y),B();},[B]),ee=useCallback((e=0,c=20)=>{let d=oe();if(!W.current||!M.current||!d||!d.length)return;let h=1/0,y=1/0,m=-1/0,b=-1/0;if(d.forEach(T=>{if(T.x===void 0||T.y===void 0)return;let E=T.x,_=T.y;h=Math.min(h,E),y=Math.min(y,_),m=Math.max(m,E),b=Math.max(b,_);}),isFinite(h)&&isFinite(m)&&isFinite(y)&&isFinite(b)){let{width:T,height:E}=t.current;h-=c,y-=c,m+=c,b+=c;let _=m-h,U=b-y,H=_>0?T/_:1,re=U>0?E/U:1,V=Math.min(H,re,10),v=h+_/2,p=y+U/2,P={k:V,x:T/2-v*V,y:E/2-p*V};if(e>0){let S={...t.current.transform},j=Date.now(),O=a(()=>{let G=Math.min(1,(Date.now()-j)/e),se=G===1?1:1-Math.pow(1-G,3),ke={k:S.k+(P.k-S.k)*se,x:S.x+(P.x-S.x)*se,y:S.y+(P.y-S.y)*se};t.current.transform=ke,B(),G<1&&requestAnimationFrame(O);},"animateZoom");requestAnimationFrame(O);}else t.current.transform=P,B();}},[]),q=useCallback((e,c)=>{let d=oe();if(!d||d.length===0)return null;let l=te.nodeSizeBase/2,h=typeof window<"u"&&window.devicePixelRatio||1,y=(e*h-t.current.transform.x)/t.current.transform.k,m=(c*h-t.current.transform.y)/t.current.transform.k;return d.find(b=>{let T=(b.x||0)-y,E=(b.y||0)-m;return Math.sqrt(T*T+E*E)<=l})||null},[]),ne=useCallback((e,c)=>{let d=me(),l=oe();if(!d||d.length===0||!l||l.length===0)return null;let h=typeof window<"u"&&window.devicePixelRatio||1,y=(e*h-t.current.transform.x)/t.current.transform.k,m=(c*h-t.current.transform.y)/t.current.transform.k,b=5;return d.find(T=>{let E=typeof T.source=="object"?T.source:l.find(pe=>pe.id===T.source),_=typeof T.target=="object"?T.target:l.find(pe=>pe.id===T.target);if(!E||!_)return false;let U=E.x||0,H=E.y||0,re=_.x||0,V=_.y||0,v=y-U,p=m-H,P=re-U,S=V-H,j=v*P+p*S,O=P*P+S*S;if(O===0)return false;let G=j/O;G=Math.max(0,Math.min(1,G));let se=U+G*P,ke=H+G*S,Ee=y-se,Be=m-ke;return Math.sqrt(Ee*Ee+Be*Be)<=b})||null},[]),ie=useCallback((e,c,d,l,h,y,m)=>{let b=e-d,T=c-l,E=Math.sqrt(b*b+T*T),_=Math.atan2(T,b);_<0&&(_+=2*Math.PI);let re=E>=h*.5&&E<=h*1,V=false;return y===Math.PI&&m===Math.PI*2?V=_>=Math.PI&&_<=Math.PI*2:y===0&&m===Math.PI?V=_>=0&&_<=Math.PI:V=y<=m&&_>=y&&_<=m||y>m&&(_>=y||_<=m),re&&V},[]),ue=useCallback(e=>{if(e===t.current.hoveredNode)return;let c=new Set,d=new Set;e&&(c.add(e),e.neighbors&&e.neighbors.forEach(l=>c.add(l)),e.links&&e.links.forEach(l=>d.add(l))),t.current.hoveredNode=e,w&&w(e),t.current.highlightNodes=c,t.current.highlightLinks=d;},[w]),ye=useCallback(e=>{if(e===t.current.hoveredLink)return;let c=new Set,d=new Set;if(e){d.add(e);let l=oe();if(l){let h=typeof e.source=="object"?e.source:l.find(m=>m.id===e.source),y=typeof e.target=="object"?e.target:l.find(m=>m.id===e.target);h&&c.add(h),y&&c.add(y);}}t.current.hoveredLink=e,k&&k(e),t.current.highlightNodes=c,t.current.highlightLinks=d;},[k,oe]),we=useCallback(e=>{L&&L(e);},[L]),fe=useCallback(e=>{t.current.selectedNode=e,s&&s(e);},[s]),De=useCallback(()=>{t.current.selectedNode=null,g&&g();},[g]),Ie=useCallback(e=>{if(!M.current||!D.current)return;let c=M.current.getBoundingClientRect(),d=e.clientX-c.left,l=e.clientY-c.top;t.current.mouseStartPos={x:d,y:l},t.current.isDragging=false;let h=q(d,l);h?(t.current.draggedNode=h,h.fx=h.x,h.fy=h.y):(t.current.isPanning=true,t.current.lastMousePos={x:d,y:l});},[q]),We=useCallback((e,c)=>{let d=null;if(M.current&&t.current&&N.length>0){let l=te.nodeSizeBase*te.nodeAreaFactor/2,h=M.current.getBoundingClientRect(),y=M.current.width/h.width,m=M.current.height/h.height,b=e*y,T=c*m,E=(b-t.current.transform.x)/t.current.transform.k,_=(T-t.current.transform.y)/t.current.transform.k,U=t.current.selectedNode?.x||0,H=t.current.selectedNode?.y||0,re=Math.min(N.length,8),V=Math.min(Math.PI*2/re,Math.PI);for(let v=0;v<re;v++){let p=v*V,P=(v+1)*V;if(ie(E,_,U,H,l,p,P)){d=v;break}}}return d},[N]),Ne=useCallback(e=>{if(!M.current)return;let c=M.current.getBoundingClientRect(),d=e.clientX-c.left,l=e.clientY-c.top;if(t.current.draggedNode&&t.current.mouseStartPos&&D.current){let m=t.current.mouseStartPos.x,b=t.current.mouseStartPos.y,T=d-m,E=l-b;Math.sqrt(T*T+E*E)>3&&(t.current.isDragging=true,D.current.alphaTarget()===0&&D.current.alphaTarget(0).restart());let H=typeof window<"u"&&window.devicePixelRatio||1,re=(d*H-t.current.transform.x)/t.current.transform.k,V=(l*H-t.current.transform.y)/t.current.transform.k;t.current.draggedNode.fx=re,t.current.draggedNode.fy=V;return}if(t.current.isPanning&&t.current.mouseStartPos){let m=d-t.current.lastMousePos.x,b=l-t.current.lastMousePos.y,T=t.current.mouseStartPos.x,E=t.current.mouseStartPos.y;Math.sqrt(Math.pow(d-T,2)+Math.pow(l-E,2))>3&&(t.current.isDragging=true),t.current.transform={...t.current.transform,x:t.current.transform.x+m,y:t.current.transform.y+b},t.current.lastMousePos={x:d,y:l},B();return}let h,y;if(t.current.selectedNode&&M.current&&N.length>0){let m=We(d,l);m!==null&&(y=t.current.selectedNode),m!==t.current.hoveredButtonIndex&&(h=true),t.current.hoveredButtonIndex=m;}else t.current.hoveredButtonIndex!==null&&(t.current.hoveredButtonIndex=null);if(!y&&(y=q(d,l),!y)){let m=ne(d,l),b=m!==t.current.hoveredLink;if(m&&t.current.hoveredNode&&ue(null),ye(m),M.current&&(M.current.style.cursor=m?"pointer":"default"),b){B();return}}y&&t.current.hoveredLink&&ye(null),y!==t.current.hoveredNode&&(h=true),ue(y),M.current&&(M.current.style.cursor=y?"pointer":"default"),h&&B();},[N,q,ne,ue,ye,B,ie,We]),Ze=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.stopPropagation(),e.preventDefault()),t.current.mustBeStoppedPropagation=false;},[]),$e=useCallback(e=>{let c=t.current.isDragging;if(c&&(t.current.mustBeStoppedPropagation=true),!c&&t.current.mouseStartPos){let d=M.current?.getBoundingClientRect();if(d){let l=e.clientX-d.left,h=e.clientY-d.top;N.length>0&&t.current.hoveredButtonIndex===null&&(t.current.hoveredButtonIndex=We(l,h));let y=false;if(t.current.selectedNode&&t.current.hoveredButtonIndex!==null&&u[t.current.hoveredButtonIndex]){let m=u[t.current.hoveredButtonIndex];m&&m.onClick&&(m.onClick(t.current.selectedNode),y=true,t.current.hoveredButtonIndex=null);}if(!y&&t.current.draggedNode)fe(t.current.draggedNode);else if(!y&&!t.current.draggedNode){let m=ne(l,h);m?we(m):De();}}}if(t.current.draggedNode&&D.current){if(c){D.current.alphaTarget(0);let d=.05,l=.04,h=.6;D.current.alpha(d).alphaDecay(l),D.current.velocityDecay(h);}else D.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),B();},[u,B,fe,De,ne,we,We,N]),ot=useCallback(e=>{if(e.stopPropagation(),e.preventDefault(),!M.current)return;let c=M.current.getBoundingClientRect(),d=e.clientX-c.left,l=e.clientY-c.top,y=-e.deltaY>0?1.1:1/1.1,m=t.current.transform,b=m.k*y;if(b<.01||b>10)return;let T=m.k*y,E=d-(d-m.x)*y,_=l-(l-m.y)*y;t.current.transform={k:T,x:E,y:_},B();},[B]),je=a((e,c)=>{let d=e.touches[0];if(d){let l={clientX:d.clientX,clientY:d.clientY};c(l);}},"convertTouchToMouseEvent"),nt=useCallback(e=>{je(e,Ie);},[Ie]),Ve=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.preventDefault(),e.stopPropagation()),t.current.mustBeStoppedPropagation=false,je(e,$e);},[$e]),et=useCallback(e=>{je(e,Ne);},[Ne]);return useImperativeHandle(R,()=>({zoomToFit:ee,addNodes:Q,removeNodes:ae}),[ee,Q,ae]),useEffect(()=>{let e=M.current,{width:c,height:d}=t.current;if(!e)return;Z(),F(true);let l=c/2,h=d/2,y=te.nodeSizeBase,m=y/2,b=y*2.5;D.current&&D.current.stop();let T=D.current=forceSimulation(I).force("link",forceLink(x).id(E=>E.id).distance(b).strength(.9)).force("charge",forceManyBody().strength(-y/10*200).theta(.5).distanceMin(y*2)).force("x",forceX().strength(.03)).force("y",forceY().strength(.03)).force("center",forceCenter(l,h).strength(.05)).force("collide",forceCollide().radius(m*2).iterations(2).strength(1)).velocityDecay(.6);return ()=>{T.stop();}},[I,x]),useLayoutEffect(()=>{let e=M.current;e&&(t.current.width=o*yt,t.current.height=n*yt,e.width=t.current.width,e.height=t.current.height);},[o,n]),useEffect(()=>{if(D.current){let e=D.current;e.on("tick",()=>{B();}),e.on("end",()=>{z&&(ee(0,20),setTimeout(()=>{F(false);},200));});}z||B();},[I,x,z,B,ee]),useEffect(()=>{!I||!x||x.forEach(e=>{let c=typeof e.source=="object"?e.source:I.find(l=>l.id===e.source),d=typeof e.target=="object"?e.target:I.find(l=>l.id===e.target);!c||!d||(!c.neighbors&&(c.neighbors=[]),!d.neighbors&&(d.neighbors=[]),c.neighbors.push(d),d.neighbors.push(c),!c.links&&(c.links=[]),!d.links&&(d.links=[]),c.links.push(e),d.links.push(e));});},[I,x]),useEffect(()=>{u&&u.length>0&&C(Wo(u));},[u]),useEffect(()=>{let e=M.current;if(!(!e||typeof window>"u"))return e.addEventListener("wheel",ot,{passive:false}),e.addEventListener("touchend",Ve,{passive:false}),()=>{e.removeEventListener("wheel",ot),e.removeEventListener("touchend",Ve);}},[ot,Ve]),jsxs(Xo,{children:[(r||z)&&jsx(gr,{width:o,height:n}),jsx(Yo,{ref:M,style:{width:o,height:n,display:r||z?"none":"block"},onMouseDown:Ie,onMouseMove:Ne,onMouseUp:$e,onMouseLeave:$e,onClick:Ze,onTouchStart:nt,onTouchMove:et})]})}),Xo=styled.div`
|
|
47
|
+
`,Yo=a(({width:e=280,height:o=280})=>{let n=useTheme();return jsx(qo,{children:jsxs($o,{foregroundColor:n.contentLoader.foreground,backgroundColor:n.contentLoader.background,width:e,height:o,viewBox:"0 0 280 280",children:[jsx("path",{d:"m55 38-0.97266 0.22852 7.0801 30.092-18.355-20.979-0.75195 0.6582 19.596 22.395 0.43164 1.834 0.97266-0.22852 0.75195-0.6582-0.37695-0.42969 9.625-27.912-0.94531-0.32617-9.4375 27.371-0.10547-0.12109zm8 34-0.78516 0.61914 0.0957 0.12305-12.311 13.258 0.73242 0.67969 12.205-13.145 14.277 18.084 0.78516-0.61914-14.373-18.207 0.10547-0.11328zm15 19-0.48438 0.875 46.992 25.996 8e-3 4e-3 20.506 11.592-28.182 4.5449 0.15998 0.98819 29.418-4.7441 0.25 0.14062-12.555 24.143 0.88672 0.46094 13-25 15 25 26 30v18l-11 18 0.85352 0.52148 9.8008-16.039-4.6543 33.518 0.99023 0.13867 4.7793-34.408 7.2305 16.27 0.91406-0.40625-7.9141-17.807v-17.104l18 12.316 0.56445-0.82617-18.896-12.928-25.855-29.836-14.633-24.387 0.01562-0.02344h23.805v-1h-23.152l13.848-21.234 55.201-28.791-0.45898-0.88476 0.77734 0.62305 11.402-14.25 16.668-11.842-0.58008-0.81641-16.785 11.928-11.486 14.355-55.434 28.912-14.277 21.893-7.7617-27.166-0.96094 0.27344 7.7227 27.031-1.1191 0.17969-21.604-12.211zm140.43-12.912-6.957-17.338-0.92773 0.37305 6.957 17.338zm-6.957-17.338 0.72266 0.69336 16.232-16.896-0.7207-0.69336zm-3.4766 137.25 5 15 0.94922-0.31641-5-15zm-91-63-0.48047-0.87695-31 17 0.48047 0.87695zm-31 17 5 18 0.96289-0.26758-5-18zm0 0-0.70703-0.70703-12.898 12.898-17.881 9.9336 0.48633 0.875 18-10zm5 18-0.64062-0.76758-18 15 0.64062 0.76758z"}),jsx("circle",{cx:"229.92",cy:"63.7318",r:"5",transform:"rotate(173.661 229.92 63.7318)"}),jsx("circle",{cx:"227.711",cy:"43.8541",r:"5",transform:"rotate(173.661 227.711 43.8541)"}),jsx("circle",{cx:"211.478",cy:"60.7499",r:"5",transform:"rotate(173.661 211.478 60.7499)"}),jsx("circle",{cx:"218.434",cy:"78.0877",r:"5",transform:"rotate(173.661 218.434 78.0877)"}),jsx("circle",{cx:"246.705",cy:"51.8054",r:"5",transform:"rotate(173.661 246.705 51.8054)"}),jsx("circle",{cx:"42",cy:"48",r:"5"}),jsx("circle",{cx:"55",cy:"38",r:"5"}),jsx("circle",{cx:"73",cy:"43",r:"5"}),jsx("circle",{cx:"63",cy:"72",r:"5"}),jsx("circle",{cx:"50",cy:"86",r:"5"}),jsx("circle",{cx:"78",cy:"91",r:"5"}),jsx("circle",{cx:"73",cy:"165",r:"5"}),jsx("circle",{cx:"73",cy:"185",r:"5"}),jsx("circle",{cx:"91",cy:"170",r:"5"}),jsx("circle",{cx:"86",cy:"152",r:"5"}),jsx("circle",{cx:"148",cy:"130",r:"5"}),jsx("circle",{cx:"189",cy:"185",r:"5"}),jsx("circle",{cx:"163",cy:"107",r:"5"}),jsx("circle",{cx:"140",cy:"102",r:"5"}),jsx("circle",{cx:"117",cy:"135",r:"5"}),jsx("circle",{cx:"125",cy:"117",r:"5"}),jsx("circle",{cx:"208",cy:"198",r:"5"}),jsx("circle",{cx:"189",cy:"203",r:"5"}),jsx("circle",{cx:"198",cy:"221",r:"5"}),jsx("circle",{cx:"178",cy:"221",r:"5"}),jsx("circle",{cx:"184",cy:"239",r:"5"}),jsx("circle",{cx:"213",cy:"213",r:"5"}),jsx("circle",{cx:"173",cy:"130",r:"5"}),jsx("circle",{cx:"163",cy:"155",r:"5"}),jsx("circle",{cx:"135",cy:"155",r:"5"}),jsx("circle",{cx:"55",cy:"175",r:"5"})]})})},"GraphLoader"),_r=Yo;var Lt=typeof window<"u"&&window.devicePixelRatio||1;function un(e){return !e||e.length===0?[]:e.map(o=>{let n=new Image;n.src=o.img;let a=new Image;return a.src=o.hoverImg,{...o,normalImg:n,hoverImg:a}})}a(un,"prepareButtonImages");var ae={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},pn=forwardRef(({loading:e,width:o,height:n,graphData:a$1,buttons:l$1=[],onNodeClick:i,onBackgroundClick:d,onNodeHover:b,onLinkHover:v,onLinkClick:x},C)=>{let h=useTheme(),[R,A]=useState(true),r=useRef({transform:{x:0,y:0,k:1},isPanning:false,hoveredNode:null,hoveredLink:null,draggedNode:null,selectedNode:null,hoveredButtonIndex:null,highlightNodes:new Set,highlightLinks:new Set,lastMousePos:{x:0,y:0},mustBeStoppedPropagation:false,mouseStartPos:null,isDragging:false,width:o*Lt,height:n*Lt,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:L,links:k}=useMemo(()=>Qo(a$1),[a$1]),[T,S]=useState([]),D=useRef(null),P=useRef(null),W=useRef(null),V=scaleOrdinal(schemeCategory10),X=useCallback(()=>{if(!D.current)return false;try{let t=D.current.getContext("2d");return t?(W.current=t,!0):(console.error("Failed to get 2D context"),!1)}catch(t){return console.error("Error initializing Canvas 2D context:",t),false}},[]),q=useCallback(()=>P.current?P.current.nodes():null,[]),ce=useCallback(()=>{if(!P.current)return null;let t=P.current.force("link");return t?t.links():null},[]),de=useCallback(t=>{t.save(),t.setTransform(1,0,0,1,0,0);let{width:u,height:c}=r.current,p=ae.gridSpacing,f=ae.dotSize;t.fillStyle=h.graph2D.grid.dotColor;for(let y=p/2;y<=u;y+=p)for(let g=p/2;g<=c;g+=p)t.beginPath(),t.arc(y,g,f,0,2*Math.PI),t.fill();t.restore();},[h.graph2D.grid.dotColor,ae.gridSpacing,ae.dotSize]),se=useCallback((t,u,c)=>{if(!t)return "";if(c.measureText(t).width<=u)return t;let f=t,y="...";for(;c.measureText(f+y).width>u&&f.length>0;)f=f.slice(0,-1);return f+y},[]),ye=a(t=>{let c=Math.min(t,ae.maxZoom)/ae.maxZoom;return Math.max(ae.fontSize*c,ae.fontSize)},"calculateFontSize"),pe=useCallback(t=>{let u=ce(),c=q();!u||u.length===0||!c||c.length===0||(t.lineWidth=.5,t.globalAlpha=1,u.forEach(p=>{let f=typeof p.source=="object"?p.source:c.find(ve=>ve.id===p.source),y=typeof p.target=="object"?p.target:c.find(ve=>ve.id===p.target);if(!f||!y)return;let g={x:f.x||0,y:f.y||0},m={x:y.x||0,y:y.y||0},M=m.x-g.x,I=m.y-g.y,j=Math.sqrt(M*M+I*I),K=M/j,$=I/j,ne=ae.nodeSizeBase/2,ee=ae.nodeSizeBase/2,oe=4,N={x:g.x+K*ne,y:g.y+$*ne},H={x:m.x-K*(ee+oe),y:m.y-$*(ee+oe)},O={x:m.x-K*(ee+1),y:m.y-$*(ee+1)},ie=r.current.highlightLinks.has(p),w=ie?h.graph2D.link.highlighted:h.graph2D.link.normal,z=ie?1.5:.5,B=g.x+(m.x-g.x)/2,Y=g.y+(m.y-g.y)/2,U=Math.atan2(I,M);if(p.label){let ve=r.current.transform.k,xe=ye(ve);t.font=`${xe}px Sans-Serif`;let Ie=t.measureText(p.label).width,Fe=10;t.beginPath(),t.moveTo(N.x,N.y);let Ke=j/2-(Ie+Fe)/2,Qe={x:g.x+K*Ke,y:g.y+$*Ke};t.lineTo(Qe.x,Qe.y),t.strokeStyle=w,t.lineWidth=z,t.stroke(),t.beginPath();let Ue=j/2+(Ie+Fe)/2,lt={x:g.x+K*Ue,y:g.y+$*Ue};t.moveTo(lt.x,lt.y),t.lineTo(H.x,H.y),t.strokeStyle=w,t.lineWidth=z,t.stroke();}else t.beginPath(),t.moveTo(N.x,N.y),t.lineTo(H.x,H.y),t.strokeStyle=w,t.lineWidth=z,t.stroke();let he=2;if(t.save(),t.translate(O.x,O.y),t.rotate(U),t.beginPath(),t.moveTo(0,0),t.lineTo(-oe,he),t.lineTo(-oe,0),t.lineTo(-oe,-he),t.closePath(),t.fillStyle=w,t.fill(),t.restore(),p.label){let ve=r.current.transform.k,xe=ye(ve);t.font=`${xe}px Sans-Serif`,t.textAlign="center",t.textBaseline="middle",t.save(),t.translate(B,Y),Math.abs(U)>Math.PI/2?t.rotate(U+Math.PI):t.rotate(U),t.fillStyle=ie?h.graph2D.link.highlightedTextColor:h.graph2D.link.textColor,t.fillText(p.label,0,0),t.restore();}}));},[ae,h.graph2D.link]),_=a((t,u,c,p,f,y,g)=>{try{if(y!=null){let m=f*.8;t.font=`${m}px sans-serif`,t.textBaseline="middle",t.textAlign="left";let M=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(y),I=t.measureText(M).width,j=f*.3,$=(f+j+I)/2;t.drawImage(u,c-$,p-f/2,f,f),t.fillStyle=g||"#99989C",t.fillText(M,c-$+f+j,p);}else t.drawImage(u,c-f/2,p-f/2,f,f);}catch(m){console.warn("Error rendering icon:",m);}},"drawIconWithOptionalCounter"),E=useCallback((t,u)=>{if(!T||T.length===0||!t||!t.x||!t.y)return;let{x:c,y:p}=t,f=ae.nodeSizeBase*ae.nodeAreaFactor/2;u.save();let y=Math.min(T.length,8),g=Math.min(Math.PI*2/y,Math.PI);for(let m=0;m<y;m++){let M=m*g,I=(m+1)*g,j=r.current.hoveredButtonIndex===m;u.beginPath(),u.arc(c,p,f,M,I,false),u.lineTo(c,p),u.closePath(),u.lineWidth=1,u.strokeStyle=h.graph2D?.button?.stroke||"#FFFFFF",u.stroke(),u.fillStyle=j?h.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":h.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",u.fill();let K=f*.2,$=(M+I)/2,ne=f-ae.nodeSizeBase/2+K,ee=c+Math.cos($)*ne,oe=p+Math.sin($)*ne,N=T[m];if(N.loading){let H=K/2,O=K/12;u.save(),u.translate(ee,oe),u.rotate(r.current.spinnerAngle);for(let ie=0;ie<12;ie++){let w=Math.PI*2*ie/12,z=ie/12,B=Math.cos(w)*H,Y=Math.sin(w)*H;u.beginPath(),u.fillStyle=l(h.graph2D?.button?.spinnerColor,z),u.arc(B,Y,O,0,Math.PI*2),u.fill();}u.restore(),r.current.spinnerAngle+=.1,r.current.spinnerAngle>Math.PI*2&&(r.current.spinnerAngle-=Math.PI*2),r.current.animation.id!==null&&(cancelAnimationFrame(r.current.animation.id),r.current.animation.id=null,r.current.animation.buttonIndex=null),r.current.animation.id=requestAnimationFrame(F),r.current.animation.buttonIndex=m;}else {r.current.animation.id&&r.current.animation.buttonIndex===m&&(cancelAnimationFrame(r.current.animation.id),r.current.animation.id=null,r.current.animation.buttonIndex=null);let H=j?N.hoverImg:N.normalImg,O=N.getCount?N.getCount(t):null;H.complete?_(u,H,ee,oe,K,O,h.graph2D?.button?.textColor):H.onload=()=>{W.current&&_(u,H,ee,oe,K,O,h.graph2D?.button?.textColor);};}}u.restore();},[T,h.graph2D?.button]),G=useCallback(t=>{let u=q();!u||u.length===0||(t.globalAlpha=1,u.forEach(c=>{let{x:p,y:f,color:y,fontColor:g,label:m}=c,M=r.current.highlightNodes.has(c)||c===r.current.hoveredNode||c===r.current.draggedNode,I=c===r.current.selectedNode,j=ae.nodeSizeBase,K=ae.nodeSizeBase/2;if(M&&!I){let $=ae.nodeSizeBase*ae.nodeAreaFactor*.75/2;t.beginPath(),t.arc(p,f,$,0,2*Math.PI,false),t.fillStyle=h.graph2D.ring.highlightFill,t.fill();}if(I)if(l$1&&l$1.length>0)E(c,t);else {let $=ae.nodeSizeBase*ae.nodeAreaFactor/2;t.beginPath(),t.arc(p,f,$,0,2*Math.PI,false),t.fillStyle=h.graph2D.ring.selectionFill||h.graph2D.ring.highlightFill,t.fill();}if(t.beginPath(),t.arc(p,f,K,0,2*Math.PI),t.fillStyle=y||V(c.group||"0"),t.fill(),m){t.save(),t.translate(p,f);let $=r.current.transform.k,ne=ye($),ee=j*ae.textPaddingFactor;t.font=`${ne}px Sans-Serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle=g||"#000";let oe=se(m,ee,t);t.fillText(oe,0,0),t.restore();}}));},[h.graph2D.ring,l$1,E]),F=useCallback(()=>{let t=W.current;t&&(t.clearRect(0,0,r.current.width,r.current.height),de(t),t.save(),t.setTransform(r.current.transform.k,0,0,r.current.transform.k,r.current.transform.x,r.current.transform.y),pe(t),G(t),t.restore());},[pe,G,de]),Q=useCallback((t,u=[],c)=>{let p=ce()||[],f=q()||[];if(!P.current||!t.length)return;let{width:y,height:g}=r.current,m=c?.smoothAppearance??false,M=c?.transitionDuration??1e3,I=new Set(f.map(N=>N.id)),j=t.filter(N=>!I.has(N.id)),K=new Set(p.map(N=>`${typeof N.source=="object"?N.source.id:N.source}-${typeof N.target=="object"?N.target.id:N.target}`)),$=u.filter(N=>{let H=`${typeof N.source=="object"?N.source.id:N.source}-${typeof N.target=="object"?N.target.id:N.target}`;return !K.has(H)});if(j.length===0&&$.length===0)return;let ne=[...f,...j],ee=[...p,...$];m&&(j.forEach(N=>{let H=$.filter(O=>{let ie=typeof O.source=="object"?O.source.id:O.source,w=typeof O.target=="object"?O.target.id:O.target;return ie===N.id&&I.has(w)||w===N.id&&I.has(ie)});if(H.length>0){let O=H[0],ie=typeof O.source=="object"?O.source.id===N.id?O.target:O.source.id:O.source===N.id?O.target:O.source,w=ne.find(z=>z.id===ie);if(w&&w.x!==void 0&&w.y!==void 0){let z=30+Math.random()*20,B=Math.random()*Math.PI*2;N.x=w.x+Math.cos(B)*z,N.y=w.y+Math.sin(B)*z,N.vx=0,N.vy=0;}}else {let O=y/2,ie=g/2,w=Math.min(y,g)/4,z=Math.random()*Math.PI*2;N.x=O+Math.cos(z)*(w*Math.random()),N.y=ie+Math.sin(z)*(w*Math.random()),N.vx=0,N.vy=0;}}),f.forEach(N=>{N.fx=N.x,N.fy=N.y;})),P.current.nodes(ne);let oe=P.current.force("link");oe&&oe.links(ee),$.forEach(N=>{let H=typeof N.source=="object"?N.source:ne.find(ie=>ie.id===N.source),O=typeof N.target=="object"?N.target:ne.find(ie=>ie.id===N.target);!H||!O||(!H.neighbors&&(H.neighbors=[]),!O.neighbors&&(O.neighbors=[]),H.neighbors.push(O),O.neighbors.push(H),!H.links&&(H.links=[]),!O.links&&(O.links=[]),H.links.push(N),O.links.push(N));}),m?(P.current.alphaTarget(.3),P.current.alpha(.3),P.current.velocityDecay(.7),P.current.restart(),setTimeout(()=>{f.forEach(N=>{N.fx=void 0,N.fy=void 0;}),P.current?.alphaTarget(0),P.current?.alpha(.1),P.current?.velocityDecay(.6);},M)):P.current.alpha(.1).restart(),F();},[L,F]),fe=useCallback(t=>{let u=q(),c=ce();if(!P.current||!t.length||!u||u.length===0||!c||c.length===0)return;let p=new Set(t);if(r.current.selectedNode&&r.current.selectedNode.id!==void 0&&p.has(r.current.selectedNode.id)&&(r.current.selectedNode=null),r.current.hoveredNode&&r.current.hoveredNode.id!==void 0&&p.has(r.current.hoveredNode.id)&&(r.current.hoveredNode=null,r.current.highlightNodes=new Set,r.current.highlightLinks=new Set),r.current.hoveredLink){let m=typeof r.current.hoveredLink.source=="object"?r.current.hoveredLink.source.id:r.current.hoveredLink.source,M=typeof r.current.hoveredLink.target=="object"?r.current.hoveredLink.target.id:r.current.hoveredLink.target;(m!==void 0&&p.has(m)||M!==void 0&&p.has(M))&&(r.current.hoveredLink=null,r.current.highlightNodes=new Set,r.current.highlightLinks=new Set);}r.current.draggedNode&&r.current.draggedNode.id!==void 0&&p.has(r.current.draggedNode.id)&&(r.current.draggedNode=null);let f=u.filter(m=>m.id!==void 0&&!p.has(m.id)),y=c.filter(m=>{let M=typeof m.source=="object"?m.source.id:m.source,I=typeof m.target=="object"?m.target.id:m.target;return M!==void 0&&!p.has(M)&&I!==void 0&&!p.has(I)});f.forEach(m=>{m.neighbors=[],m.links=[];}),y.forEach(m=>{let M=typeof m.source=="object"?m.source:f.find(j=>j.id===m.source),I=typeof m.target=="object"?m.target:f.find(j=>j.id===m.target);!M||!I||(M.neighbors=M.neighbors||[],I.neighbors=I.neighbors||[],M.neighbors.push(I),I.neighbors.push(M),M.links=M.links||[],I.links=I.links||[],M.links.push(m),I.links.push(m));}),P.current.nodes(f);let g=P.current.force("link");g&&g.links(y),F();},[F]),le=useCallback((t=0,u=20)=>{let c=q();if(!W.current||!D.current||!c||!c.length)return;let f=1/0,y=1/0,g=-1/0,m=-1/0;if(c.forEach(M=>{if(M.x===void 0||M.y===void 0)return;let I=M.x,j=M.y;f=Math.min(f,I),y=Math.min(y,j),g=Math.max(g,I),m=Math.max(m,j);}),isFinite(f)&&isFinite(g)&&isFinite(y)&&isFinite(m)){let{width:M,height:I}=r.current;f-=u,y-=u,g+=u,m+=u;let j=g-f,K=m-y,$=j>0?M/j:1,ne=K>0?I/K:1,ee=Math.min($,ne,10),oe=f+j/2,N=y+K/2,H={k:ee,x:M/2-oe*ee,y:I/2-N*ee};if(t>0){let O={...r.current.transform},ie=Date.now(),w=a(()=>{let z=Math.min(1,(Date.now()-ie)/t),B=z===1?1:1-Math.pow(1-z,3),Y={k:O.k+(H.k-O.k)*B,x:O.x+(H.x-O.x)*B,y:O.y+(H.y-O.y)*B};r.current.transform=Y,F(),z<1&&requestAnimationFrame(w);},"animateZoom");requestAnimationFrame(w);}else r.current.transform=H,F();}},[]),J=useCallback((t,u)=>{let c=q();if(!c||c.length===0)return null;let p=ae.nodeSizeBase/2,f=typeof window<"u"&&window.devicePixelRatio||1,y=(t*f-r.current.transform.x)/r.current.transform.k,g=(u*f-r.current.transform.y)/r.current.transform.k;return c.find(m=>{let M=(m.x||0)-y,I=(m.y||0)-g;return Math.sqrt(M*M+I*I)<=p})||null},[]),re=useCallback((t,u)=>{let c=ce(),p=q();if(!c||c.length===0||!p||p.length===0)return null;let f=typeof window<"u"&&window.devicePixelRatio||1,y=(t*f-r.current.transform.x)/r.current.transform.k,g=(u*f-r.current.transform.y)/r.current.transform.k,m=5;return c.find(M=>{let I=typeof M.source=="object"?M.source:p.find(xe=>xe.id===M.source),j=typeof M.target=="object"?M.target:p.find(xe=>xe.id===M.target);if(!I||!j)return false;let K=I.x||0,$=I.y||0,ne=j.x||0,ee=j.y||0,oe=y-K,N=g-$,H=ne-K,O=ee-$,ie=oe*H+N*O,w=H*H+O*O;if(w===0)return false;let z=ie/w;z=Math.max(0,Math.min(1,z));let B=K+z*H,Y=$+z*O,U=y-B,he=g-Y;return Math.sqrt(U*U+he*he)<=m})||null},[]),De=useCallback((t,u,c,p,f,y,g)=>{let m=t-c,M=u-p,I=Math.sqrt(m*m+M*M),j=Math.atan2(M,m);j<0&&(j+=2*Math.PI);let ne=I>=f*.5&&I<=f*1,ee=false;return y===Math.PI&&g===Math.PI*2?ee=j>=Math.PI&&j<=Math.PI*2:y===0&&g===Math.PI?ee=j>=0&&j<=Math.PI:ee=y<=g&&j>=y&&j<=g||y>g&&(j>=y||j<=g),ne&&ee},[]),ue=useCallback(t=>{if(t===r.current.hoveredNode)return;let u=new Set,c=new Set;t&&(u.add(t),t.neighbors&&t.neighbors.forEach(p=>u.add(p)),t.links&&t.links.forEach(p=>c.add(p))),r.current.hoveredNode=t,b&&b(t),r.current.highlightNodes=u,r.current.highlightLinks=c;},[b]),Ce=useCallback(t=>{if(t===r.current.hoveredLink)return;let u=new Set,c=new Set;if(t){c.add(t);let p=q();if(p){let f=typeof t.source=="object"?t.source:p.find(g=>g.id===t.source),y=typeof t.target=="object"?t.target:p.find(g=>g.id===t.target);f&&u.add(f),y&&u.add(y);}}r.current.hoveredLink=t,v&&v(t),r.current.highlightNodes=u,r.current.highlightLinks=c;},[v,q]),Ye=useCallback(t=>{x&&x(t);},[x]),we=useCallback(t=>{r.current.selectedNode=t,i&&i(t);},[i]),Re=useCallback(()=>{r.current.selectedNode=null,d&&d();},[d]),Pe=useCallback(t=>{if(!D.current||!P.current)return;let u=D.current.getBoundingClientRect(),c=t.clientX-u.left,p=t.clientY-u.top;r.current.mouseStartPos={x:c,y:p},r.current.isDragging=false;let f=J(c,p);f?(r.current.draggedNode=f,f.fx=f.x,f.fy=f.y):(r.current.isPanning=true,r.current.lastMousePos={x:c,y:p});},[J]),Me=useCallback((t,u)=>{let c=null;if(D.current&&r.current&&T.length>0){let p=ae.nodeSizeBase*ae.nodeAreaFactor/2,f=D.current.getBoundingClientRect(),y=D.current.width/f.width,g=D.current.height/f.height,m=t*y,M=u*g,I=(m-r.current.transform.x)/r.current.transform.k,j=(M-r.current.transform.y)/r.current.transform.k,K=r.current.selectedNode?.x||0,$=r.current.selectedNode?.y||0,ne=Math.min(T.length,8),ee=Math.min(Math.PI*2/ne,Math.PI);for(let oe=0;oe<ne;oe++){let N=oe*ee,H=(oe+1)*ee;if(De(I,j,K,$,p,N,H)){c=oe;break}}}return c},[T]),be=useCallback(t=>{if(!D.current)return;let u=D.current.getBoundingClientRect(),c=t.clientX-u.left,p=t.clientY-u.top;if(r.current.draggedNode&&r.current.mouseStartPos&&P.current){let g=r.current.mouseStartPos.x,m=r.current.mouseStartPos.y,M=c-g,I=p-m;Math.sqrt(M*M+I*I)>3&&(r.current.isDragging=true,P.current.alphaTarget()===0&&P.current.alphaTarget(0).restart());let $=typeof window<"u"&&window.devicePixelRatio||1,ne=(c*$-r.current.transform.x)/r.current.transform.k,ee=(p*$-r.current.transform.y)/r.current.transform.k;r.current.draggedNode.fx=ne,r.current.draggedNode.fy=ee;return}if(r.current.isPanning&&r.current.mouseStartPos){let g=c-r.current.lastMousePos.x,m=p-r.current.lastMousePos.y,M=r.current.mouseStartPos.x,I=r.current.mouseStartPos.y;Math.sqrt(Math.pow(c-M,2)+Math.pow(p-I,2))>3&&(r.current.isDragging=true),r.current.transform={...r.current.transform,x:r.current.transform.x+g,y:r.current.transform.y+m},r.current.lastMousePos={x:c,y:p},F();return}let f,y;if(r.current.selectedNode&&D.current&&T.length>0){let g=Me(c,p);g!==null&&(y=r.current.selectedNode),g!==r.current.hoveredButtonIndex&&(f=true),r.current.hoveredButtonIndex=g;}else r.current.hoveredButtonIndex!==null&&(r.current.hoveredButtonIndex=null);if(!y&&(y=J(c,p),!y)){let g=re(c,p),m=g!==r.current.hoveredLink;if(g&&r.current.hoveredNode&&ue(null),Ce(g),D.current&&(D.current.style.cursor=g?"pointer":"default"),m){F();return}}y&&r.current.hoveredLink&&Ce(null),y!==r.current.hoveredNode&&(f=true),ue(y),D.current&&(D.current.style.cursor=y?"pointer":"default"),f&&F();},[T,J,re,ue,Ce,F,De,Me]),Le=useCallback(t=>{r.current.mustBeStoppedPropagation&&(t.stopPropagation(),t.preventDefault()),r.current.mustBeStoppedPropagation=false;},[]),Je=useCallback(t=>{let u=r.current.isDragging;if(u&&(r.current.mustBeStoppedPropagation=true),!u&&r.current.mouseStartPos){let c=D.current?.getBoundingClientRect();if(c){let p=t.clientX-c.left,f=t.clientY-c.top;T.length>0&&r.current.hoveredButtonIndex===null&&(r.current.hoveredButtonIndex=Me(p,f));let y=false;if(r.current.selectedNode&&r.current.hoveredButtonIndex!==null&&l$1[r.current.hoveredButtonIndex]){let g=l$1[r.current.hoveredButtonIndex];g&&g.onClick&&(g.onClick(r.current.selectedNode),y=true,r.current.hoveredButtonIndex=null);}if(!y&&r.current.draggedNode)we(r.current.draggedNode);else if(!y&&!r.current.draggedNode){let g=re(p,f);g?Ye(g):Re();}}}if(r.current.draggedNode&&P.current){if(u){P.current.alphaTarget(0);let c=.05,p=.04,f=.6;P.current.alpha(c).alphaDecay(p),P.current.velocityDecay(f);}else P.current.alphaTarget(0);r.current.draggedNode.fx=void 0,r.current.draggedNode.fy=void 0,r.current.draggedNode=null;}r.current.isDragging=false,r.current.mouseStartPos=null,r.current.isPanning&&(r.current.isPanning=false),F();},[l$1,F,we,Re,re,Ye,Me,T]),ht=useCallback(t=>{if(t.stopPropagation(),t.preventDefault(),!D.current)return;let u=D.current.getBoundingClientRect(),c=t.clientX-u.left,p=t.clientY-u.top,y=-t.deltaY>0?1.1:1/1.1,g=r.current.transform,m=g.k*y;if(m<.01||m>10)return;let M=g.k*y,I=c-(c-g.x)*y,j=p-(p-g.y)*y;r.current.transform={k:M,x:I,y:j},F();},[F]),ft=a((t,u)=>{let c=t.touches[0];if(c){let p={clientX:c.clientX,clientY:c.clientY};u(p);}},"convertTouchToMouseEvent"),Ut=useCallback(t=>{ft(t,Pe);},[Pe]),mt=useCallback(t=>{r.current.mustBeStoppedPropagation&&(t.preventDefault(),t.stopPropagation()),r.current.mustBeStoppedPropagation=false,ft(t,Je);},[Je]),Zt=useCallback(t=>{ft(t,be);},[be]);return useImperativeHandle(C,()=>({zoomToFit:le,addNodes:Q,removeNodes:fe}),[le,Q,fe]),useEffect(()=>{let t=D.current,{width:u,height:c}=r.current;if(!t)return;X(),A(true);let p=u/2,f=c/2,y=ae.nodeSizeBase,g=y/2,m=y*2.5;P.current&&P.current.stop();let M=P.current=forceSimulation(L).force("link",forceLink(k).id(I=>I.id).distance(m).strength(.9)).force("charge",forceManyBody().strength(-y/10*200).theta(.5).distanceMin(y*2)).force("x",forceX().strength(.03)).force("y",forceY().strength(.03)).force("center",forceCenter(p,f).strength(.05)).force("collide",forceCollide().radius(g*2).iterations(2).strength(1)).velocityDecay(.6);return ()=>{M.stop();}},[L,k]),useLayoutEffect(()=>{let t=D.current;t&&(r.current.width=o*Lt,r.current.height=n*Lt,t.width=r.current.width,t.height=r.current.height);},[o,n]),useEffect(()=>{if(P.current){let t=P.current;t.on("tick",()=>{F();}),t.on("end",()=>{R&&(le(0,20),setTimeout(()=>{A(false);},200));});}R||F();},[L,k,R,F,le]),useEffect(()=>{!L||!k||k.forEach(t=>{let u=typeof t.source=="object"?t.source:L.find(p=>p.id===t.source),c=typeof t.target=="object"?t.target:L.find(p=>p.id===t.target);!u||!c||(!u.neighbors&&(u.neighbors=[]),!c.neighbors&&(c.neighbors=[]),u.neighbors.push(c),c.neighbors.push(u),!u.links&&(u.links=[]),!c.links&&(c.links=[]),u.links.push(t),c.links.push(t));});},[L,k]),useEffect(()=>{l$1&&l$1.length>0&&S(un(l$1));},[l$1]),useEffect(()=>{let t=D.current;if(!(!t||typeof window>"u"))return t.addEventListener("wheel",ht,{passive:false}),t.addEventListener("touchend",mt,{passive:false}),()=>{t.removeEventListener("wheel",ht),t.removeEventListener("touchend",mt);}},[ht,mt]),jsxs(hn,{children:[(e||R)&&jsx(_r,{width:o,height:n}),jsx(fn,{ref:D,style:{width:o,height:n,display:e||R?"none":"block"},onMouseDown:Pe,onMouseMove:be,onMouseUp:Je,onMouseLeave:Je,onClick:Le,onTouchStart:Ut,onTouchMove:Zt})]})}),hn=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
|
-
`,
|
|
55
|
-
${
|
|
56
|
-
position: ${
|
|
54
|
+
`,fn=styled.canvas``;pn.displayName="Graph2D";var Ac=w(({isActive:e,position:o,top:n=0,left:a=0,right:l,bottom:i,...d})=>jsx(bn,{$isActive:e,$position:o,$top:n,$left:a,$right:l,$bottom:i,...d})),bn=Vo.div(({$isActive:e,$top:o,$left:n,$right:a,$bottom:l,$position:i,theme:d})=>`
|
|
55
|
+
${e?`
|
|
56
|
+
position: ${i};
|
|
57
57
|
z-index: 1000;
|
|
58
|
-
${typeof o=="number"?`top: ${c(o,
|
|
59
|
-
${typeof n=="number"?`left: ${c(n,
|
|
60
|
-
${typeof a=="number"?`right: ${c(a,
|
|
61
|
-
${typeof
|
|
58
|
+
${typeof o=="number"?`top: ${c(o,d.baseSize)};`:""}
|
|
59
|
+
${typeof n=="number"?`left: ${c(n,d.baseSize)};`:""}
|
|
60
|
+
${typeof a=="number"?`right: ${c(a,d.baseSize)};`:""}
|
|
61
|
+
${typeof l=="number"?`bottom: ${c(l,d.baseSize)};`:""}
|
|
62
62
|
|
|
63
63
|
`:""}
|
|
64
64
|
|
|
65
65
|
min-width: 0;
|
|
66
|
-
`);var Ko=[.1,.25,.5,.75,1,1.5,2,3,4,5],Jo=5,Qo=.1,en=140;function wt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(wt,"computePadding");var vr=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:u=Ko,maxZoom:s=Jo,minZoom:g=Qo,showMinimap:w=true,minimapWidth:k=en,className:L,onZoomChange:R})=>{let[f,z$1]=useState("adaptive"),[F,t]=useState(1),[I,x]=useState(0),[N,C]=useState(false),M=useRef(false),[D,W]=useState(false),[Y,Z]=useState(false),[oe,me]=useState({left:0,top:0}),be=useRef(0),[de,Re]=useState({width:0,height:0}),ve=useRef({width:0,height:0}),$=useRef(null),A=useRef(null),K=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),B=useRef(f),Q=useRef(F),ae=useRef(R);B.current=f,Q.current=F,ae.current=R;let ee=n||ve.current.width,q=a$1||ve.current.height,ne=useMemo(()=>[...u].sort((v,p)=>v-p),[u]),ie=useCallback(()=>de.width===0||ee===0?1:Math.min(de.width/ee,de.height/q,1),[de,ee,q]),ue=useCallback((v,p)=>{if(p==="in"){let S=ne.find(j=>j>v+.001);return S!==void 0?Math.min(S,s):v}let P=ne.findLast(S=>S<v-.001);return P!==void 0?Math.max(P,g):v},[ne,s,g]),ye=useCallback(()=>B.current==="adaptive"?ie():Q.current,[ie]),we=useCallback(v=>{z$1("manual"),t(v),ae.current?.(v,"manual");},[]),fe=useCallback(()=>{z$1("adaptive"),ae.current?.(ie(),"adaptive");},[ie]),De=useCallback(v=>{requestAnimationFrame(()=>{let p=A.current;if(!p)return;let P=p.getBoundingClientRect(),S=ee*v,j=q*v,O=wt(S,j,P.width,P.height);p.scrollLeft=S/2+O.x-P.width/2,p.scrollTop=j/2+O.y-P.height/2;});},[ee,q]);useEffect(()=>{z$1("adaptive"),t(1),x(0),W(false),Z(false),ve.current={width:0,height:0};},[r]),useEffect(()=>{let v=A.current;if(!v)return;let p=new ResizeObserver(P=>{let S=P[0];if(!S)return;let{width:j,height:O}=S.contentRect;Re(G=>G.width===j&&G.height===O?G:{width:j,height:O});});return p.observe(v),()=>p.disconnect()},[]),useEffect(()=>{let v=A.current;if(!v)return;let p=a(()=>{cancelAnimationFrame(be.current),be.current=requestAnimationFrame(()=>{let P=v.scrollLeft,S=v.scrollTop;me(j=>j.left===P&&j.top===S?j:{left:P,top:S});});},"handleScroll");return v.addEventListener("scroll",p,{passive:true}),()=>{v.removeEventListener("scroll",p),cancelAnimationFrame(be.current);}},[]),useEffect(()=>{let v=A.current;if(!v||!D)return;let p=a(P=>{if(!(P.ctrlKey||P.metaKey))return;P.preventDefault();let S=ye(),j=P.deltaY>0?"out":"in",O=ue(S,j),G=ie();if(j==="out"&&O<=G){fe();return}let se=v.getBoundingClientRect(),ke,Ee,Be=ve.current.width||1,Ce=ve.current.height||1;if(B.current==="adaptive"){let pe=$.current;if(!pe)return;let Me=pe.getBoundingClientRect();ke=(P.clientX-Me.left)/(Me.width/Be),Ee=(P.clientY-Me.top)/(Me.height/Ce);}else {let pe=Be*S,Me=Ce*S,at=wt(pe,Me,se.width,se.height);ke=(v.scrollLeft+P.clientX-se.left-at.x)/S,Ee=(v.scrollTop+P.clientY-se.top-at.y)/S;}we(O),requestAnimationFrame(()=>{let pe=v.getBoundingClientRect(),Me=wt(Be*O,Ce*O,pe.width,pe.height);v.scrollLeft=ke*O+Me.x-(P.clientX-pe.left),v.scrollTop=Ee*O+Me.y-(P.clientY-pe.top);});},"handleWheel");return v.addEventListener("wheel",p,{passive:false}),()=>v.removeEventListener("wheel",p)},[D,ye,ue,ie,we,fe]),useEffect(()=>{if(f!=="manual")return;let v=A.current;if(!v)return;let p=a(j=>{j.button===0&&(j.preventDefault(),M.current=true,C(true),K.current={x:j.clientX,y:j.clientY,scrollLeft:v.scrollLeft,scrollTop:v.scrollTop});},"handleMouseDown"),P=a(j=>{if(!M.current)return;let{x:O,y:G,scrollLeft:se,scrollTop:ke}=K.current;v.scrollLeft=se-(j.clientX-O),v.scrollTop=ke-(j.clientY-G);},"handleMouseMove"),S=a(()=>{M.current=false,C(false);},"handleMouseUp");return v.addEventListener("mousedown",p),window.addEventListener("mousemove",P),window.addEventListener("mouseup",S),()=>{v.removeEventListener("mousedown",p),window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",S);}},[f]);let Ie=useCallback(()=>{f==="manual"&&fe();},[f,fe]),We=useCallback(()=>{let v=ye(),p=ue(v,"in");p!==v&&(we(p),De(p));},[ye,ue,we,De]),Ne=useCallback(()=>{let v=ye(),p=ue(v,"out");if(p<=ie()){fe();return}we(p),De(p);},[ye,ue,ie,fe,we,De]),Ze=useCallback(()=>{we(1),De(1);},[we,De]),$e=useCallback(()=>{x(v=>(v+90)%360);},[]),ot=useCallback(()=>{let v=$.current;v&&(ve.current={width:v.naturalWidth,height:v.naturalHeight},W(true),Z(false));},[]),je=f==="adaptive"?ie():F,nt=ee*je,Ve=q*je,et=de.width,e=de.height,c=f==="manual"?wt(nt,Ve,et,e):{x:0,y:0},d=w&&f==="manual"&&(nt>et||Ve>e),l=ee>0?k/ee:0,h=q*l,y=et>0?et/F*l:0,m=e>0?e/F*l:0,b=Math.max(0,oe.left-c.x)/F*l,T=Math.max(0,oe.top-c.y)/F*l,E=f==="adaptive"?"Fit":`${Math.round(F*100)}%`,_=ue(je,"in")!==je,U=f==="manual"||je>g,H=I!==0?{transform:`rotate(${I}deg)`}:{},re=f==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",...H}:{width:nt,height:Ve,maxWidth:"none",maxHeight:"none",marginLeft:c.x,marginTop:c.y,flexShrink:0,...H},V={cursor:f==="manual"?N?"grabbing":"grab":"default"};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${L??""}`,children:[jsxs("div",{className:"flex w-full items-center px-8.5 py-3 gap-1 shrink-0 flex-wrap",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:Ne,disabled:!U,p:7,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!"}),jsx("button",{type:"button",onClick:f==="manual"?fe:void 0,className:"flex items-center justify-center bg-white dark:bg-neutral-800 h-[38px] min-w-16 px-3 select-none border border-gray-300 dark:border-neutral-600 rounded-md","aria-label":E,children:jsx(_a,{style:{fontSize:12,fontWeight:500},children:E})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:We,disabled:!_,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!",p:10}),jsx(z,{variant:"outlined","aria-label":"rotate-right",size:"small",color:"default",icon:jsx(Na,{style:{width:16,height:16}}),onClick:$e,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]! ml-auto",p:10}),jsx(z,{variant:"outlined","aria-label":"fit-to-container",size:"small",color:f==="adaptive"?"primary":"default",icon:jsx(sa,{style:{width:14,height:14}}),onClick:fe,className:`${f==="adaptive"?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} h-[38px]!`,p:10}),jsx(z,{variant:"outlined","aria-label":"original-size",size:"small",color:f==="manual"&&F===1?"primary":"default",onClick:Ze,className:`${f==="manual"&&F===1?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} h-[38px]!`,py:10,px:11,children:jsx(_a,{style:{fontSize:12,fontWeight:500,lineHeight:1},children:"1:1"})})]}),jsxs("div",{className:"flex-1 min-h-0 min-w-0 relative",children:[jsx("div",{ref:A,className:`h-full w-full ${f==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:V,onDoubleClick:Ie,children:Y?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(_a,{color:"text.lighter",children:"Failed to load image"})}):jsx("img",{ref:$,src:r,alt:o,draggable:false,className:"block select-none",style:re,onLoad:ot,onError:()=>Z(true)})}),d&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:k,height:h,backdropFilter:"blur(8px)",background:"rgba(255,255,255,0.75)"},children:[jsx("img",{src:r,alt:"",draggable:false,className:"block w-full h-full object-contain"}),jsx("div",{className:"absolute border-2 border-blue-500 rounded-sm",style:{width:Math.min(y,k),height:Math.min(m,h),left:Math.max(0,Math.min(b,k-y)),top:Math.max(0,Math.min(T,h-m)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var wr=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full py-5.5 px-8.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var At=a(({url:r})=>{let[o,n]=useState(null),[a$1,u]=useState(false),[s,g]=useState(true),[w,k]=useState(null);return useEffect(()=>{u(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let R=await import('./PdfDriver-MGKDGHEQ.mjs');n(()=>R.PdfDriver),g(!1);}catch(R){console.error("Failed to load PDF driver:",R),k("Failed to load PDF viewer"),g(false);}},"loadPdfDriver")();},[a$1]),a$1?s?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})}):w||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:w||"PDF viewer unavailable"})})}):jsx(o,{url:r}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var Sr=50,on=1e4,Dr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[u,s]=useState(null),[g,w]=useState(true),[k,L]=useState(1),R=useRef(false),[f,z$1]=useState({width:0,height:0}),F=useRef(0),t=a(()=>{R.current=true,L(x=>Math.min(x+.25,4));},"handleZoomIn"),I=a(()=>{R.current=true,L(x=>Math.max(x-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{w(!0),s(null);let N=o;if(!N&&r&&(N=await(await fetch(r)).blob()),!N){s("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(N.size/(1024*1024)>Sr){s(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Sr} \u041C\u0411)`);return}a$1.current.innerHTML="";let M=renderAsync(N,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),D=new Promise((Y,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")),on));await Promise.race([M,D]),await new Promise(Y=>requestAnimationFrame(Y));let W=a$1.current.querySelector(".docx-wrapper");if(W&&(F.current=W.offsetWidth,z$1({width:W.offsetWidth,height:W.offsetHeight})),n.current&&F.current>0){let Y=n.current.clientWidth,Z=Math.min(Y/F.current,1);L(Z);}w(!1);}catch(N){s(N?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),w(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let x=rn(C=>{if(!(R.current||F.current===0))for(let M of C){let D=M.contentRect.width,W=Math.min(D/F.current,1);L(W);}},150),N=new ResizeObserver(x);return N.observe(n.current),()=>{N.disconnect(),x.cancel();}},[]),jsxs("div",{className:"h-full w-full flex flex-col px-0.5",children:[jsxs("div",{className:"flex justify-center items-stretch px-8 py-3 gap-1 border-b border-gray-200 dark:border-neutral-700",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:I,disabled:k<=.25,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:7}),jsxs(rb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(_a,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(_a,{children:[Math.round(k*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:t,disabled:k>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!u&&!g&&jsx("div",{className:"text-red-500 p-8",children:u}),g&&jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:n,className:"w-full h-full overflow-auto bg-gray-400 dark:bg-neutral-700 [&::-webkit-scrollbar-thumb]:bg-gray-100 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-600 [&::-webkit-scrollbar-track]:bg-gray-400 dark:[&::-webkit-scrollbar-track]:bg-neutral-700",style:{scrollbarGutter:"stable both-edges"},children:jsx("div",{style:{width:f.width>0?f.width*k:void 0,height:f.height>0?f.height*k:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:a$1,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
|
|
66
|
+
`);var wn=[.1,.25,.5,.75,1,1.5,2,3,4,5],xn=5,kn=.1,Sn=120;function vt(e,o,n,a){return {x:e<n?(n-e)/2:0,y:o<a?(a-o)/2:0}}a(vt,"computePadding");var Br=a(({url:e,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:l=wn,maxZoom:i=xn,minZoom:d=kn,showMinimap:b=true,minimapWidth:v=Sn,className:x,onZoomChange:C})=>{let[h,R]=useState("adaptive"),[A,r]=useState(1),[L,k]=useState(0),[T,S]=useState(false),D=useRef(false),[P,W]=useState(false),[V,X]=useState(false),[q,ce]=useState({left:0,top:0}),de=useRef(0),[se,ye]=useState({width:0,height:0}),pe=useRef({width:0,height:0}),_=useRef(null),E=useRef(null),G=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),F=useRef(h),Q=useRef(A),fe=useRef(L),le=useRef(C);F.current=h,Q.current=A,fe.current=L,le.current=C;let J=n||pe.current.width,re=a$1||pe.current.height,De=L===90||L===270,ue=De?re:J,Ce=De?J:re,Ye=useMemo(()=>[...l].sort((w,z)=>w-z),[l]),we=useCallback(()=>se.width===0||ue===0?1:Math.min(se.width/ue,se.height/Ce,1),[se,ue,Ce]),Re=useCallback((w,z)=>{if(z==="in"){let Y=Ye.find(U=>U>w+.001);return Y!==void 0?Math.min(Y,i):w}let B=Ye.findLast(Y=>Y<w-.001);return B!==void 0?Math.max(B,d):w},[Ye,i,d]),Pe=useCallback(()=>F.current==="adaptive"?we():Q.current,[we]),Me=useCallback(w=>{R("manual"),r(w),le.current?.(w,"manual");},[]),be=useCallback(()=>{R("adaptive"),le.current?.(we(),"adaptive");},[we]),Le=useCallback(w=>{requestAnimationFrame(()=>{let z=E.current;if(!z)return;let B=z.getBoundingClientRect(),Y=ue*w,U=Ce*w,he=vt(Y,U,B.width,B.height);z.scrollLeft=Y/2+he.x-B.width/2,z.scrollTop=U/2+he.y-B.height/2;});},[ue,Ce]);useEffect(()=>{R("adaptive"),r(1),k(0),W(false),X(false),pe.current={width:0,height:0};},[e]),useEffect(()=>{let w=E.current;if(!w)return;let z=new ResizeObserver(B=>{let Y=B[0];if(!Y)return;let{width:U,height:he}=Y.contentRect;ye(ve=>ve.width===U&&ve.height===he?ve:{width:U,height:he});});return z.observe(w),()=>z.disconnect()},[]),useEffect(()=>{let w=E.current;if(!w)return;let z=a(()=>{cancelAnimationFrame(de.current),de.current=requestAnimationFrame(()=>{let B=w.scrollLeft,Y=w.scrollTop;ce(U=>U.left===B&&U.top===Y?U:{left:B,top:Y});});},"handleScroll");return w.addEventListener("scroll",z,{passive:true}),()=>{w.removeEventListener("scroll",z),cancelAnimationFrame(de.current);}},[]),useEffect(()=>{let w=E.current;if(!w||!P)return;let z=a(B=>{if(!(B.ctrlKey||B.metaKey))return;B.preventDefault();let Y=Pe(),U=B.deltaY>0?"out":"in",he=Re(Y,U),ve=we();if(U==="out"&&he<=ve){be();return}let xe=w.getBoundingClientRect(),Ie=fe.current,Fe=Ie===90||Ie===270,Ke=pe.current.width||1,Qe=pe.current.height||1,Ue=Fe?Qe:Ke,lt=Fe?Ke:Qe,Gt,Jt;if(F.current==="adaptive"){let Ze=_.current;if(!Ze)return;let Ge=Ze.getBoundingClientRect();Gt=(B.clientX-Ge.left)/(Ge.width/Ue),Jt=(B.clientY-Ge.top)/(Ge.height/lt);}else {let Ze=Ue*Y,Ge=lt*Y,kr=vt(Ze,Ge,xe.width,xe.height);Gt=(w.scrollLeft+B.clientX-xe.left-kr.x)/Y,Jt=(w.scrollTop+B.clientY-xe.top-kr.y)/Y;}Me(he),requestAnimationFrame(()=>{let Ze=w.getBoundingClientRect(),Ge=vt(Ue*he,lt*he,Ze.width,Ze.height);w.scrollLeft=Gt*he+Ge.x-(B.clientX-Ze.left),w.scrollTop=Jt*he+Ge.y-(B.clientY-Ze.top);});},"handleWheel");return w.addEventListener("wheel",z,{passive:false}),()=>w.removeEventListener("wheel",z)},[P,Pe,Re,we,Me,be]),useEffect(()=>{if(h!=="manual")return;let w=E.current;if(!w)return;let z=a(U=>{U.button===0&&(U.preventDefault(),D.current=true,S(true),G.current={x:U.clientX,y:U.clientY,scrollLeft:w.scrollLeft,scrollTop:w.scrollTop});},"handleMouseDown"),B=a(U=>{if(!D.current)return;let{x:he,y:ve,scrollLeft:xe,scrollTop:Ie}=G.current;w.scrollLeft=xe-(U.clientX-he),w.scrollTop=Ie-(U.clientY-ve);},"handleMouseMove"),Y=a(()=>{D.current=false,S(false);},"handleMouseUp");return w.addEventListener("mousedown",z),window.addEventListener("mousemove",B),window.addEventListener("mouseup",Y),()=>{w.removeEventListener("mousedown",z),window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",Y);}},[h]);let Je=useCallback(()=>{h==="manual"&&be();},[h,be]),ht=useCallback(()=>{let w=Pe(),z=Re(w,"in");z!==w&&(Me(z),Le(z));},[Pe,Re,Me,Le]),ft=useCallback(()=>{let w=Pe(),z=Re(w,"out");if(z<=we()){be();return}Me(z),Le(z);},[Pe,Re,we,be,Me,Le]),Ut=useCallback(()=>{Me(1),Le(1);},[Me,Le]),mt=useCallback(()=>{k(w=>{let z=(w+90)%360;if(F.current==="manual"){let B=pe.current.width,Y=pe.current.height,U=z===90||z===270,he=U?Y:B,ve=U?B:Y,xe=Q.current;requestAnimationFrame(()=>{let Ie=E.current;if(!Ie)return;let Fe=Ie.getBoundingClientRect(),Ke=he*xe,Qe=ve*xe,Ue=vt(Ke,Qe,Fe.width,Fe.height);Ie.scrollLeft=Ke/2+Ue.x-Fe.width/2,Ie.scrollTop=Qe/2+Ue.y-Fe.height/2;});}return z});},[]),Zt=useCallback(()=>{let w=_.current;w&&(pe.current={width:w.naturalWidth,height:w.naturalHeight},W(true),X(false));},[]),t=h==="adaptive"?we():A,u=ue*t,c=Ce*t,p=se.width,f=se.height,y=h==="manual"?vt(u,c,p,f):{x:0,y:0},g=b&&h==="manual"&&(u>p||c>f),m=ue>0?v/ue:0,M=Ce*m,I=p>0?p/A*m:0,j=f>0?f/A*m:0,K=Math.max(0,q.left-y.x)/A*m,$=Math.max(0,q.top-y.y)/A*m,ne=h==="adaptive"?"Fit":`${Math.round(A*100)}%`,ee=Re(t,"in")!==t,oe=h==="manual"||t>d,N=h==="adaptive"?{width:ue?u:void 0,height:Ce?c:void 0,position:"relative",flexShrink:0}:{width:u,height:c,marginLeft:y.x,marginTop:y.y,flexShrink:0,position:"relative"},H={width:J*t,height:re*t,maxWidth:"none",maxHeight:"none",position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) rotate(${L}deg)`},O={cursor:h==="manual"?T?"grabbing":"grab":"default"},ie={width:J*m,height:re*m,position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) rotate(${L}deg)`};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${x??""}`,children:[jsxs("div",{className:"flex w-full items-center px-8.5 py-3 gap-1 shrink-0 flex-wrap",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:ft,disabled:!oe,p:7,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!"}),jsx("button",{type:"button",onClick:h==="manual"?be:void 0,className:"flex items-center justify-center bg-white dark:bg-neutral-800 h-[38px] min-w-16 px-3 select-none border border-gray-300 dark:border-neutral-600 rounded-md","aria-label":ne,children:jsx(_a,{style:{fontSize:12,fontWeight:500},children:ne})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na$1,{style:{width:14,height:14}}),onClick:ht,disabled:!ee,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!",p:10}),jsx(z,{variant:"outlined","aria-label":"rotate-right",size:"small",color:"default",icon:jsx(Na,{style:{width:16,height:16}}),onClick:mt,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]! ml-auto",p:10}),jsx(z,{variant:"outlined","aria-label":"fit-to-container",size:"small",color:h==="adaptive"?"primary":"default",icon:jsx(sa$1,{style:{width:14,height:14}}),onClick:be,className:`${h==="adaptive"?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} h-[38px]!`,p:10}),jsx(z,{variant:"outlined","aria-label":"original-size",size:"small",color:h==="manual"&&A===1?"primary":"default",onClick:Ut,className:`${h==="manual"&&A===1?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} h-[38px]!`,py:10,px:11,children:jsx(_a,{style:{fontSize:12,fontWeight:500,lineHeight:1},children:"1:1"})})]}),jsxs("div",{className:"flex-1 min-h-0 min-w-0 relative",children:[jsx("div",{ref:E,className:`h-full w-full ${h==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:O,onDoubleClick:Je,children:V?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(_a,{color:"text.lighter",children:"Failed to load image"})}):jsx("div",{style:N,children:jsx("img",{ref:_,src:e,alt:o,draggable:false,className:"block select-none",style:H,onLoad:Zt,onError:()=>X(true)})})}),g&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:v,height:M,backdropFilter:"blur(8px)",background:"rgba(255,255,255,0.75)"},children:[jsx("div",{style:ie,children:jsx("img",{src:e,alt:"",draggable:false,className:"block w-full h-full object-fill"})}),jsx("div",{className:"absolute border-2 border-blue-500 rounded-sm",style:{width:Math.min(I,v),height:Math.min(j,M),left:Math.max(0,Math.min(K,v-I)),top:Math.max(0,Math.min($,M-j)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var Wr=a(({url:e})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full py-5.5 px-8.5",children:jsx("audio",{controls:true,src:e,className:"w-full"})}),"AudioDriver");var Qt=a(({url:e})=>{let[o,n]=useState(null),[a$1,l]=useState(false),[i,d]=useState(true),[b,v]=useState(null);return useEffect(()=>{l(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let C=await import('./PdfDriver-MGKDGHEQ.mjs');n(()=>C.PdfDriver),d(!1);}catch(C){console.error("Failed to load PDF driver:",C),v("Failed to load PDF viewer"),d(false);}},"loadPdfDriver")();},[a$1]),a$1?i?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})}):b||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:b||"PDF viewer unavailable"})})}):jsx(o,{url:e}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var Xr=50,Pn=1e4,qr=a(({url:e,blob:o})=>{let n=useRef(null),a$1=useRef(null),[l,i]=useState(null),[d,b]=useState(true),[v,x]=useState(1),C=useRef(false),[h,R]=useState({width:0,height:0}),A=useRef(0),r=a(()=>{C.current=true,x(k=>Math.min(k+.25,4));},"handleZoomIn"),L=a(()=>{C.current=true,x(k=>Math.max(k-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{b(!0),i(null);let T=o;if(!T&&e&&(T=await(await fetch(e)).blob()),!T){i("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(T.size/(1024*1024)>Xr){i(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Xr} \u041C\u0411)`);return}a$1.current.innerHTML="";let D=renderAsync(T,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),P=new Promise((V,X)=>setTimeout(()=>X(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")),Pn));await Promise.race([D,P]),await new Promise(V=>requestAnimationFrame(V));let W=a$1.current.querySelector(".docx-wrapper");if(W&&(A.current=W.offsetWidth,R({width:W.offsetWidth,height:W.offsetHeight})),n.current&&A.current>0){let V=n.current.clientWidth,X=Math.min(V/A.current,1);x(X);}b(!1);}catch(T){i(T?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),b(false);}},"renderDocument")();},[e,o]),useEffect(()=>{if(!n.current)return;let k=Dn(S=>{if(!(C.current||A.current===0))for(let D of S){let P=D.contentRect.width,W=Math.min(P/A.current,1);x(W);}},150),T=new ResizeObserver(k);return T.observe(n.current),()=>{T.disconnect(),k.cancel();}},[]),jsxs("div",{className:"h-full w-full flex flex-col px-0.5",children:[jsxs("div",{className:"flex justify-center items-stretch px-8 py-3 gap-1 border-b border-gray-200 dark:border-neutral-700",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:L,disabled:v<=.25,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:7}),jsxs(rb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(_a,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(_a,{children:[Math.round(v*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na$1,{style:{width:14,height:14}}),onClick:r,disabled:v>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!l&&!d&&jsx("div",{className:"text-red-500 p-8",children:l}),d&&jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:n,className:"w-full h-full overflow-auto bg-gray-400 dark:bg-neutral-700 [&::-webkit-scrollbar-thumb]:bg-gray-100 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-600 [&::-webkit-scrollbar-track]:bg-gray-400 dark:[&::-webkit-scrollbar-track]:bg-neutral-700",style:{scrollbarGutter:"stable both-edges"},children:jsx("div",{style:{width:h.width>0?h.width*v:void 0,height:h.height>0?h.height*v:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:a$1,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
|
|
67
67
|
[&>div.docx-wrapper_table]:table-fixed!
|
|
68
68
|
[&>div.docx-wrapper_table_td]:w-fit!
|
|
69
69
|
[&>div.docx-wrapper_table_col]:w-fit!
|
|
@@ -79,11 +79,11 @@ ${r?`
|
|
|
79
79
|
[&>div.docx-wrapper]:box-border
|
|
80
80
|
[&>div.docx-wrapper]:min-w-fit!
|
|
81
81
|
[&>div.docx-wrapper]:w-full!
|
|
82
|
-
[&>div.docx-wrapper]:min-h-full`,style:{boxSizing:"border-box",wordBreak:"break-word",overflowWrap:"break-word",transform:`scale(${
|
|
83
|
-
`||
|
|
84
|
-
`)){let
|
|
85
|
-
`+
|
|
86
|
-
`),{data:Q}=
|
|
82
|
+
[&>div.docx-wrapper]:min-h-full`,style:{boxSizing:"border-box",wordBreak:"break-word",overflowWrap:"break-word",transform:`scale(${v})`,transformOrigin:"top left"}})})})]})},"DocxDriver");var Bn=a(e=>({js:[javascript({jsx:false})],jsx:[javascript({jsx:true})],ts:[javascript({typescript:true,jsx:false})],tsx:[javascript({typescript:true,jsx:true})],html:[html()],css:[css()],scss:[css()],py:[python()],java:[java()],cpp:[cpp()],c:[cpp()],php:[php()],rs:[rust()],xml:[xml()],yaml:[yaml()],yml:[yaml()],md:[markdown()],sql:[sql()],sh:[markdown()],bash:[markdown()]})[e]||[],"getLanguageExtension");function Hn(){let[e,o]=useState(()=>typeof document<"u"?document.documentElement.classList.contains("dark"):false);return useEffect(()=>{let n=new MutationObserver(()=>{o(document.documentElement.classList.contains("dark"));});return n.observe(document.documentElement,{attributes:true,attributeFilter:["class"]}),()=>n.disconnect()},[]),e}a(Hn,"useIsDarkMode");var Gr=a(({url:e,extension:o})=>{let[n,a$1]=useState(""),[l,i]=useState(true),[d,b]=useState(null),[v,x]=useState(0),C=useRef(null),h=Hn();if(useEffect(()=>{a(async()=>{try{i(!0),b(null);let L=await fetch(e);if(!L.ok)throw new Error(`Failed to load file: ${L.statusText}`);let k=await L.text();if(o==="json")try{k=JSON.stringify(JSON.parse(k),null,2);}catch{}a$1(k);}catch(L){b(L instanceof Error?L.message:"Failed to load text content");}finally{i(false);}},"loadTextContent")();},[e]),useEffect(()=>{let r=a(()=>{if(C.current){let L=C.current.clientHeight;x(L);}},"updateHeight");return r(),window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r);}},[l]),l)return jsx("div",{className:"flex items-center justify-center p-8.5",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading text content..."})});if(d)return jsx("div",{className:"flex items-center justify-center p-8.5",children:jsxs("div",{className:"text-red-500",children:["Error: ",d]})});if(o==="md")return jsx("div",{ref:C,className:"h-full w-full overflow-auto p-5 prose dark:prose-invert max-w-[100%] select-text prose-table px-8.5",style:{wordBreak:"break-word"},children:jsx(Fn,{remarkPlugins:[On],children:n})});let A=Bn(o);return jsx("div",{ref:C,className:"h-full w-full",children:v>0&&jsx(Nn,{value:n,theme:h?vscodeDark:vscodeLight,extensions:A,editable:false,height:`${v}px`,basicSetup:{lineNumbers:true,highlightActiveLineGutter:false,highlightActiveLine:false,foldGutter:true,dropCursor:false,indentOnInput:false,syntaxHighlighting:true,bracketMatching:true,closeBrackets:false,autocompletion:false,rectangularSelection:false,crosshairCursor:false,highlightSelectionMatches:false,closeBracketsKeymap:false,searchKeymap:false,foldKeymap:true,completionKeymap:false,lintKeymap:false}})})},"TextDriver");var Kr=a(({url:e})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full px-8.5",children:jsx("video",{controls:true,src:e,className:"w-full max-h-full"})}),"VideoDriver");var dt=class{static{a(this,"LruChunkCache");}cache=new Map;pinned=new Set;maxSize;constructor(o=8){this.maxSize=o;}get(o){let n=this.cache.get(o);return n!==void 0&&(this.cache.delete(o),this.cache.set(o,n)),n}set(o,n){if(this.cache.delete(o),this.cache.size>=this.maxSize){for(let a of this.cache.keys())if(!this.pinned.has(a)){this.cache.delete(a);break}}this.cache.set(o,n);}pin(o){this.pinned.clear();for(let n of o)this.pinned.add(n);this.pinned.size>this.maxSize&&(this.maxSize=this.pinned.size+4);}clear(){this.cache.clear(),this.pinned.clear();}};var ot="chunks",rr=class{static{a(this,"IndexedDBStore");}db;sessionId;dbName;constructor(o,n,a){this.db=o,this.sessionId=n,this.dbName=a;}async set(o,n){return new Promise((a,l)=>{let i=this.db.transaction(ot,"readwrite");i.objectStore(ot).put(n,o),i.oncomplete=()=>a(),i.onerror=()=>l(i.error);})}async get(o){return new Promise((n,a)=>{let i=this.db.transaction(ot,"readonly").objectStore(ot).get(o);i.onsuccess=()=>n(i.result??void 0),i.onerror=()=>a(i.error);})}async clear(){return new Promise((o,n)=>{let a=this.db.transaction(ot,"readwrite");a.objectStore(ot).clear(),a.oncomplete=()=>o(),a.onerror=()=>n(a.error);})}async destroy(){return this.db.close(),new Promise((o,n)=>{let a=indexedDB.deleteDatabase(this.dbName);a.onsuccess=()=>o(),a.onerror=()=>n(a.error),a.onblocked=()=>o();})}},or=class{static{a(this,"MemoryStore");}sessionId=null;chunks=new Map;async set(o,n){this.chunks.set(o,n);}async get(o){return this.chunks.get(o)}async clear(){this.chunks.clear();}async destroy(){this.chunks.clear();}};async function Ot(){let e=`${Date.now()}_${Math.random().toString(36).slice(2)}`,o=`csv-chunks-${e}`;try{let n=await new Promise((a,l)=>{let i=indexedDB.open(o,1);i.onupgradeneeded=()=>{let d=i.result;d.objectStoreNames.contains(ot)||d.createObjectStore(ot);},i.onsuccess=()=>a(i.result),i.onerror=()=>l(i.error);});return new rr(n,e,o)}catch{return console.warn("IndexedDB unavailable, falling back to in-memory storage"),new or}}a(Ot,"createChunkStore");function Vn(e){let o=[],n=false,a=0,l=0;for(let i=0;i<e.length;i++){let d=e[i];if(d==='"')n=!n;else if(!n&&(d===`
|
|
83
|
+
`||d==="\r"&&e[i+1]!==`
|
|
84
|
+
`)){let b=i,v=e.slice(a,b).replace(/\r$/,"");v&&o.push(v),a=i+1,l=i+1;}}return [o,e.slice(l)]}a(Vn,"splitCsvRows");function Xn(e,o){return e.stream?Promise.resolve(e.stream):e.blob?Promise.resolve(e.blob.stream()):e.url?fetch(e.url,{signal:o}).then(n=>{if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.body}):Promise.reject(new Error("No source provided"))}a(Xn,"resolveStream");function Qr(e){let[o,n]=useState("idle"),[a,l]=useState(0),[i,d]=useState([]),[b,v]=useState(null),[x,C]=useState(0),[h,R]=useState(0),A=useRef(e),r=useRef(0),L=useRef(0),k=useRef(""),T=useRef(new dt(10)),S=useRef(null),D=useRef(null),P=useRef(new Set),W=useRef(null),V=useRef(false),X=useCallback((E,G)=>{let F=E+`
|
|
85
|
+
`+G.join(`
|
|
86
|
+
`),{data:Q}=nr.parse(F,{header:true,dynamicTyping:false,skipEmptyLines:true});return Q},[]),q=useCallback(async(E,G)=>{let F=S.current;if(!F)return;let Q=Math.max(0,Math.floor(E/1e3)-2),fe=Math.min(r.current-1,Math.floor(G/1e3)+2),le=false;for(let J=Q;J<=fe;J++)if(T.current.get(J)===void 0&&!P.current.has(J)){P.current.add(J);try{let re=await F.get(J);if(re&&k.current){let De=X(k.current,re);T.current.set(J,De),le=!0;}}finally{P.current.delete(J);}}le&&R(J=>J+1);},[X]),ce=useCallback(E=>{let G=Math.floor(E/1e3),F=E%1e3;return T.current.get(G)?.[F]},[h]),de=useCallback(async()=>{V.current=true;let E=new AbortController;D.current=E,await S.current?.destroy();let G=await Ot();S.current=G,r.current=0,L.current=0,k.current="",T.current.clear(),d([]),l(0),v(null),C(0),n("loading");let F=A.current;try{let Q=await Xn(F,E.signal);n("streaming");let fe=Q.getReader(),le=new TextDecoder("utf-8"),J="",re=[],De=!0,ue=0,Ce=0,Ye=F.blob?.size||0;for(;;){if(E.signal.aborted)return;let{done:we,value:Re}=await fe.read();if(we)break;ue+=Re.byteLength,Ye&&C(ue/Ye),J+=le.decode(Re,{stream:!0});let[Pe,Me]=Vn(J);if(Pe.length!==0){if(J=Me,De&&Pe.length>0){k.current=Pe.shift().replace(/^\uFEFF/,"");let{data:be}=nr.parse(k.current,{});be[0]&&d(be[0]),De=!1;}for(let be of Pe)if(be.trim()&&(re.push(be),re.length>=1e3)){let Le=r.current;if(await G.set(Le,re),Le<3){let Je=X(k.current,re);T.current.set(Le,Je);}r.current+=1,Ce+=re.length,re=[],L.current=Ce,W.current||(W.current=requestAnimationFrame(()=>{l(L.current),W.current=null;}));}}}if(J.trim())if(De){k.current=J;let{data:we}=nr.parse(k.current,{});we[0]&&d(we[0]);}else re.push(J);re.length>0&&(await G.set(r.current,re),r.current+=1,Ce+=re.length),W.current&&(cancelAnimationFrame(W.current),W.current=null),l(Ce),C(1),n("done");}catch(Q){if(E.signal.aborted)return;let fe=Q instanceof Error?Q.message:"Unknown error";v(fe),n("partial_error");}finally{V.current=false;}},[X]),se=useRef(false);useEffect(()=>(se.current=true,V.current||de(),()=>{se.current=false,queueMicrotask(()=>{se.current||(D.current?.abort(),S.current?.destroy(),W.current&&cancelAnimationFrame(W.current));});}),[de]);let ye=S.current?.sessionId??null,pe=r.current,_=useCallback(E=>{T.current.pin(E);},[]);return {state:o,headers:i,totalRows:a,getRow:ce,error:b,progress:x,prefetchRange:q,sessionId:ye,chunkCount:pe,pinChunks:_}}a(Qr,"useCsvStream");var qn=`
|
|
87
87
|
const DB_VERSION = 1;
|
|
88
88
|
const STORE_NAME = 'chunks';
|
|
89
89
|
|
|
@@ -169,31 +169,31 @@ self.onmessage = async (e) => {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
|
-
`,
|
|
172
|
+
`,kt=null,St=null;function sr(){if(!kt){let e=new Blob([qn],{type:"application/javascript"});St=URL.createObjectURL(e),kt=new Worker(St);}return kt}a(sr,"getSearchWorker");function eo(){kt?.terminate(),kt=null,St&&(URL.revokeObjectURL(St),St=null);}a(eo,"terminateSearchWorker");function to(e,o){let[n,a]=useState(""),[l,i]=useState("idle"),[d,b]=useState(null),[v,x]=useState({searched:0,total:0,found:0}),C=useRef(null),h=useCallback(r=>{if(!e||o===0)return;if(!r.trim()){b(null),i("idle"),x({searched:0,total:0,found:0});return}i("searching"),x({searched:0,total:o,found:0});let L=sr();L.onmessage=k=>{let{type:T}=k.data;T==="progress"&&x({searched:k.data.searched,total:k.data.total,found:k.data.found}),T==="done"&&(b(k.data.matchedIndices),i("done")),T==="cancelled"&&i("idle"),T==="error"&&(i("idle"),console.error("Search worker error:",k.data.message));},L.postMessage({type:"cancel"}),L.postMessage({type:"search",sessionId:e,query:r,chunkCount:o,chunkSize:1e3});},[e,o]),R=useCallback(r=>{a(r),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{h(r);},300);},[h]),A=useCallback(()=>{a(""),b(null),i("idle"),x({searched:0,total:0,found:0}),sr().postMessage({type:"cancel"});},[]);return useEffect(()=>()=>{C.current&&clearTimeout(C.current),eo();},[]),{query:n,onQueryChange:R,clearSearch:A,searchState:l,matchedIndices:d,searchProgress:v}}a(to,"useCsvSearch");var ta={loading:"Loading...",rows:"rows",retry:"Retry",searchPlaceholder:"Search...",searchFound:"found",searching:"Searching..."};function ra(e,o,n){let a=1/0,l=-1/0,i=Math.min(n,e.length-1);for(let d=o;d<=i;d++){let b=e[d];b<a&&(a=b),b>l&&(l=b);}return {min:a,max:l}}a(ra,"getMinMax");function oa(e,o,n){let a=Math.min(100,n),l=e.map(()=>[]);for(let i=0;i<a;i++){let d=o(i);if(d)for(let b=0;b<e.length;b++){let v=d[e[b]]??"";l[b].push(v.length);}}return e.map((i,d)=>{let b=i.length*9,v=l[d];if(v.length===0)return Math.min(Math.max(150,b+24),800);v.sort((A,r)=>A-r);let x=Math.floor(v.length*.9),h=v[x]*7.5+24,R=Math.max(b+24,h);return Math.min(Math.max(50,R),800)})}a(oa,"estimateColumnWidths");var dr=a(e=>{let{state:o,headers:n,totalRows:a$1,getRow:l,error:i,progress:d,prefetchRange:b,sessionId:v,chunkCount:x,pinChunks:C}=Qr(e),h={...ta,...e.labels},{query:R,onQueryChange:A,clearSearch:r,searchState:L,matchedIndices:k}=to(v,x),T=k!==null,S=T?k.length:a$1,[D,P]=useState([]),W=useRef(null),V=useRef(null),X=useRef(false),q=useRef(false);useEffect(()=>{q.current=false,X.current=false,P([]);},[v]),useEffect(()=>{if(n.length===0||X.current||q.current||a$1===0)return;let _=l(0);!_||!n.some(E=>_[E]!==void 0)||(q.current=true,P(oa(n,l,a$1)));},[n,a$1,l]),useEffect(()=>()=>V.current?.(),[]);let ce=useCallback((_,E)=>{_.preventDefault(),X.current=true;let G=_.clientX,F=D[E]??150;W.current={index:E,startX:G,startWidth:F};let Q=a(le=>{if(!W.current)return;let J=le.clientX-G,re=Math.max(50,F+J);P(De=>{let ue=[...De];return ue[E]=re,ue});},"onMouseMove"),fe=a(()=>{W.current=null,V.current=null,document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",fe);},"onMouseUp");V.current=fe,document.addEventListener("mousemove",Q),document.addEventListener("mouseup",fe);},[D]),de=D.reduce((_,E)=>_+E,0),se=useCallback(()=>jsx(ia,{children:n.map((_,E)=>jsxs(sa,{style:{width:D[E]},children:[_,jsx(la,{onMouseDown:G=>ce(G,E)})]},E))}),[n,D,ce]),ye=useCallback(_=>{if(T&&k){let E=1/0,G=-1/0,F=new Set,Q=Math.min(_.endIndex,k.length-1);for(let fe=_.startIndex;fe<=Q;fe++){let le=k[fe];le<E&&(E=le),le>G&&(G=le),F.add(Math.floor(le/1e3));}C(Array.from(F)),E!==1/0&&b(E,G);}else C([]),b(_.startIndex,_.endIndex);},[b,C,T,k]),pe=useCallback(_=>{let E=T&&k?k[_]:_,G=l(E);return G?n.map((F,Q)=>jsx(oo,{style:{width:D[Q]},children:G[F]??""},Q)):n.map((F,Q)=>jsx(oo,{style:{width:D[Q]},children:jsx(ua,{})},Q))},[l,n,D,T,k]);return useEffect(()=>{if(S>0)if(T&&k){let{min:_,max:E}=ra(k,0,50);_!==1/0&&b(_,E);}else b(0,50);},[S,T,k,b]),o==="idle"||o==="loading"||o==="streaming"?jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[jsx("div",{className:"h-10 w-10 rounded-full border-2 border-gray-200 dark:border-neutral-700 animate-spin border-s-transparent"}),o==="streaming"&&a$1>0&&jsxs(_a,{variant:"body",color:"text.lighter",style:{fontSize:12},children:[h.loading," ",a$1.toLocaleString()," ",h.rows,d>0?` (${Math.round(d*100)}%)`:""]})]}):jsxs("div",{className:"h-full w-full flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-8.5 py-2 gap-2 flex-wrap",children:[jsx(_a,{variant:"body",color:"text.lighter",style:{fontSize:12,whiteSpace:"nowrap"},children:`${S.toLocaleString()} ${T?h.searchFound:h.rows}${T?` / ${a$1.toLocaleString()}`:""}`}),jsxs(pa,{children:[jsx(ha,{type:"text",value:R,onChange:_=>A(_.target.value),placeholder:h.searchPlaceholder}),L==="searching"?jsx(ma,{children:jsx(ba,{})}):R?jsx(fa,{onClick:r,type:"button",children:"\u2715"}):null]})]}),o==="partial_error"&&jsxs(rb,{className:"flex items-center justify-between mx-4 mb-2 px-3 py-2 rounded bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-900",children:[jsx(_a,{variant:"body",className:"text-red-600 dark:text-red-400",style:{fontSize:12},children:i}),e.onRetry&&jsx(z,{onClick:()=>e.onRetry(i??""),variant:"outlined",size:"small",children:h.retry})]}),jsx("div",{className:"flex-1 min-h-0",children:n.length>0&&jsx(TableVirtuoso,{totalCount:S,increaseViewportBy:300,fixedHeaderContent:se,itemContent:pe,rangeChanged:ye,style:{height:"100%"},components:{Table:a(({style:_,context:E,...G})=>jsx(na,{style:{..._,minWidth:"100%",width:de},...G}),"Table"),TableHead:aa,TableRow:a(({context:_,...E})=>jsx(ca,{...E}),"TableRow")}},T?"filtered":"all")})]})},"CsvDriver"),na=styled.table(({theme:e})=>`
|
|
173
173
|
border-collapse: separate;
|
|
174
174
|
border-spacing: 0;
|
|
175
175
|
table-layout: fixed;
|
|
176
176
|
font-size: 13px;
|
|
177
|
-
background-color: ${
|
|
178
|
-
`),
|
|
179
|
-
background-color: ${
|
|
177
|
+
background-color: ${e.colors.background};
|
|
178
|
+
`),aa=styled.thead(({theme:e})=>`
|
|
179
|
+
background-color: ${e.colors.background};
|
|
180
180
|
z-index: 1;
|
|
181
|
-
`),
|
|
181
|
+
`),ia=styled.tr``,sa=styled.th(({theme:e})=>`
|
|
182
182
|
position: relative;
|
|
183
183
|
text-align: left;
|
|
184
184
|
padding: 8px 12px;
|
|
185
185
|
font-weight: 600;
|
|
186
186
|
font-size: 12px;
|
|
187
|
-
color: ${
|
|
187
|
+
color: ${e.colors.text?.light};
|
|
188
188
|
word-wrap: break-word;
|
|
189
189
|
overflow-wrap: break-word;
|
|
190
190
|
word-break: break-all;
|
|
191
|
-
border-right: 1px solid ${
|
|
192
|
-
border-bottom: 1px solid ${
|
|
191
|
+
border-right: 1px solid ${e.colors.stroke.light};
|
|
192
|
+
border-bottom: 1px solid ${e.colors.stroke.light};
|
|
193
193
|
&:last-child {
|
|
194
194
|
border-right: none;
|
|
195
195
|
}
|
|
196
|
-
`)
|
|
196
|
+
`),la=styled.div(({theme:e})=>`
|
|
197
197
|
position: absolute;
|
|
198
198
|
right: 0;
|
|
199
199
|
top: 0;
|
|
@@ -202,47 +202,47 @@ self.onmessage = async (e) => {
|
|
|
202
202
|
cursor: col-resize;
|
|
203
203
|
user-select: none;
|
|
204
204
|
&:hover, &:active {
|
|
205
|
-
background-color: ${
|
|
205
|
+
background-color: ${e.colors.primary?.light};
|
|
206
206
|
opacity: 0.4;
|
|
207
207
|
}
|
|
208
|
-
`),
|
|
208
|
+
`),ca=styled.tr(({theme:e})=>`
|
|
209
209
|
&:hover {
|
|
210
|
-
background-color: ${
|
|
210
|
+
background-color: ${e.colors.backgroundBase};
|
|
211
211
|
}
|
|
212
|
-
`),
|
|
212
|
+
`),oo=styled.td(({theme:e})=>`
|
|
213
213
|
padding: 6px 12px;
|
|
214
214
|
word-wrap: break-word;
|
|
215
215
|
overflow-wrap: break-word;
|
|
216
216
|
word-break: break-all;
|
|
217
|
-
border-bottom: 1px solid ${
|
|
218
|
-
border-right: 1px solid ${
|
|
217
|
+
border-bottom: 1px solid ${e.colors.stroke.light};
|
|
218
|
+
border-right: 1px solid ${e.colors.stroke.light};
|
|
219
219
|
&:last-child {
|
|
220
220
|
border-right: none;
|
|
221
221
|
}
|
|
222
|
-
`),
|
|
222
|
+
`),da=keyframes`
|
|
223
223
|
0%, 100% { opacity: 0.4; }
|
|
224
224
|
50% { opacity: 1; }
|
|
225
|
-
`,
|
|
225
|
+
`,ua=styled.div(({theme:e})=>css$1`
|
|
226
226
|
height: 12px;
|
|
227
227
|
width: 60%;
|
|
228
|
-
background: ${
|
|
228
|
+
background: ${e.colors.stroke.light};
|
|
229
229
|
border-radius: 4px;
|
|
230
|
-
animation: ${
|
|
231
|
-
`),
|
|
230
|
+
animation: ${da} 1.5s ease-in-out infinite;
|
|
231
|
+
`),pa=styled.div`
|
|
232
232
|
position: relative;
|
|
233
233
|
width: 200px;
|
|
234
234
|
flex-shrink: 0;
|
|
235
|
-
`,
|
|
235
|
+
`,ha=styled.input(({theme:e})=>`
|
|
236
236
|
padding: 4px 24px 4px 8px;
|
|
237
237
|
font-size: 12px;
|
|
238
|
-
border: 1px solid ${
|
|
238
|
+
border: 1px solid ${e.colors.stroke.light};
|
|
239
239
|
border-radius: 4px;
|
|
240
240
|
outline: none;
|
|
241
241
|
width: 100%;
|
|
242
242
|
&:focus {
|
|
243
|
-
border-color: ${
|
|
243
|
+
border-color: ${e.colors.primary?.main};
|
|
244
244
|
}
|
|
245
|
-
`),
|
|
245
|
+
`),fa=styled.button(({theme:e})=>`
|
|
246
246
|
position: absolute;
|
|
247
247
|
right: 6px;
|
|
248
248
|
top: 50%;
|
|
@@ -251,29 +251,31 @@ self.onmessage = async (e) => {
|
|
|
251
251
|
border: none;
|
|
252
252
|
cursor: pointer;
|
|
253
253
|
font-size: 11px;
|
|
254
|
-
color: ${
|
|
254
|
+
color: ${e.colors.text?.lighter};
|
|
255
255
|
padding: 0 2px;
|
|
256
256
|
line-height: 1;
|
|
257
257
|
&:hover {
|
|
258
|
-
color: ${
|
|
258
|
+
color: ${e.colors.text?.main};
|
|
259
259
|
}
|
|
260
|
-
`),
|
|
260
|
+
`),ma=styled.div`
|
|
261
261
|
position: absolute;
|
|
262
262
|
right: 6px;
|
|
263
263
|
top: 50%;
|
|
264
264
|
transform: translateY(-50%);
|
|
265
265
|
display: flex;
|
|
266
266
|
align-items: center;
|
|
267
|
-
`,
|
|
267
|
+
`,ga=keyframes`
|
|
268
268
|
to { transform: rotate(360deg); }
|
|
269
|
-
`,
|
|
269
|
+
`,ba=styled.div(({theme:e})=>css$1`
|
|
270
270
|
width: 14px;
|
|
271
271
|
height: 14px;
|
|
272
|
-
border: 2px solid ${
|
|
273
|
-
border-top-color: ${
|
|
272
|
+
border: 2px solid ${e.colors.stroke.light};
|
|
273
|
+
border-top-color: ${e.colors.text?.light};
|
|
274
274
|
border-radius: 50%;
|
|
275
|
-
animation: ${
|
|
276
|
-
`);var
|
|
275
|
+
animation: ${ga} 0.6s linear infinite;
|
|
276
|
+
`);var pr={...darkStyles,container:darkStyles.container+" bg-neutral-900!",label:darkStyles.label+" text-blue-400! font-medium!",clickableLabel:darkStyles.clickableLabel+" text-blue-400! font-medium!",nullValue:darkStyles.nullValue+" text-orange-400!",undefinedValue:darkStyles.undefinedValue+" text-orange-400!",numberValue:darkStyles.numberValue+" text-green-400!",stringValue:darkStyles.stringValue+" text-red-400!",booleanValue:darkStyles.booleanValue+" text-violet-400!",punctuation:darkStyles.punctuation+" text-neutral-500! font-medium!",quotesForFieldNames:true},hr={...defaultStyles,container:defaultStyles.container+" bg-gray-50!",label:defaultStyles.label+" text-blue-700! font-medium!",clickableLabel:defaultStyles.clickableLabel+" text-blue-700! font-medium!",nullValue:defaultStyles.nullValue+" text-orange-500!",undefinedValue:defaultStyles.undefinedValue+" text-orange-500!",numberValue:defaultStyles.numberValue+" text-green-700!",stringValue:defaultStyles.stringValue+" text-red-800!",booleanValue:defaultStyles.booleanValue+" text-violet-500!",punctuation:defaultStyles.punctuation+" text-gray-500! font-medium!",quotesForFieldNames:true},lo=a(({url:e})=>{let[o,n]=useState(null),[a,l]=useState(true),[i,d]=useState(null),{mode:b}=useTheme();return useEffect(()=>{let v=new AbortController;return l(true),d(null),n(null),fetch(e,{signal:v.signal}).then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}: ${x.statusText}`);return x.text()}).then(x=>{try{n(JSON.parse(x));}catch{d("Invalid JSON");}}).catch(x=>{x instanceof Error&&x.name==="AbortError"||d(x instanceof Error?x.message:"Failed to load");}).finally(()=>{v.signal.aborted||l(false);}),()=>v.abort()},[e]),a?jsx("div",{className:"flex items-center justify-center h-full",children:jsx("div",{className:"h-10 w-10 rounded-full border-2 border-gray-200 dark:border-neutral-700 animate-spin border-s-transparent"})}):i?jsx("div",{className:"flex items-center justify-center h-full",children:jsx("div",{className:"text-sm text-red-500 dark:text-red-400",children:i})}):jsx("div",{className:"h-full w-full overflow-auto select-text",children:jsx(JsonView,{data:o,style:b==="dark"?pr:hr,shouldExpandNode:collapseAllNested,clickToExpandNode:true})})},"JsonDriver");function Sa(e){let o=[],n=0;for(let a=0;a<e.length;a++){let l=e[a];if(l===`
|
|
277
|
+
`){let i=e.slice(n,a).replace(/\r$/,"");i.trim()&&o.push(i),n=a+1;}else if(l==="\r"&&e[a+1]!==`
|
|
278
|
+
`){let i=e.slice(n,a);i.trim()&&o.push(i),n=a+1;}}return [o,e.slice(n)]}a(Sa,"splitLines");function Ca(e,o){return e.stream?Promise.resolve(e.stream):e.blob?Promise.resolve(e.blob.stream()):e.url?fetch(e.url,{signal:o}).then(n=>{if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.body}):Promise.reject(new Error("No source provided"))}a(Ca,"resolveStream");function co(e){let[o,n]=useState("idle"),[a,l]=useState(0),[i,d]=useState(null),[b,v]=useState(0),[x,C]=useState(0),h=useRef(e),R=useRef(0),A=useRef(0),r=useRef(new dt(10)),L=useRef(null),k=useRef(null),T=useRef(new Set),S=useRef(null),D=useRef(false),P=useCallback(async(q,ce)=>{let de=L.current;if(!de)return;let se=Math.max(0,Math.floor(q/1e3)-2),ye=Math.min(R.current-1,Math.floor(ce/1e3)+2),pe=false;for(let _=se;_<=ye;_++)if(r.current.get(_)===void 0&&!T.current.has(_)){T.current.add(_);try{let E=await de.get(_);E&&(r.current.set(_,E),pe=!0);}finally{T.current.delete(_);}}pe&&C(_=>_+1);},[]),W=useCallback(q=>{let ce=Math.floor(q/1e3),de=q%1e3;return r.current.get(ce)?.[de]},[x]),V=useCallback(async()=>{D.current=true;let q=new AbortController;k.current=q,await L.current?.destroy();let ce=await Ot();L.current=ce,R.current=0,A.current=0,r.current.clear(),l(0),d(null),v(0),n("loading");let de=h.current;try{let se=await Ca(de,q.signal);n("streaming");let ye=se.getReader(),pe=new TextDecoder("utf-8"),_="",E=[],G=0,F=0,Q=de.blob?.size||0;for(;;){if(q.signal.aborted)return;let{done:fe,value:le}=await ye.read();if(fe)break;G+=le.byteLength,Q&&v(G/Q),_+=pe.decode(le,{stream:!0});let[J,re]=Sa(_);_=re;for(let De of J)if(E.push(De),E.length>=1e3){let ue=R.current;await ce.set(ue,E),ue<3&&r.current.set(ue,E),R.current+=1,F+=E.length,E=[],A.current=F,S.current||(S.current=requestAnimationFrame(()=>{l(A.current),S.current=null;}));}}_.trim()&&E.push(_.trim()),E.length>0&&(await ce.set(R.current,E),R.current+=1,F+=E.length),S.current&&(cancelAnimationFrame(S.current),S.current=null),l(F),v(1),n("done");}catch(se){if(q.signal.aborted)return;let ye=se instanceof Error?se.message:"Unknown error";d(ye),n("partial_error");}finally{D.current=false;}},[]),X=useRef(false);return useEffect(()=>(X.current=true,D.current||V(),()=>{X.current=false,queueMicrotask(()=>{X.current||(k.current?.abort(),L.current?.destroy(),S.current&&cancelAnimationFrame(S.current));});}),[V]),{state:o,totalLines:a,getLine:W,error:i,progress:b,prefetchRange:P}}a(co,"useNdjsonStream");var gr=a(e=>{let{state:o,totalLines:n,getLine:a,error:l,progress:i,prefetchRange:d}=co(e),{mode:b}=useTheme(),v=useCallback(h=>{d(h.startIndex,h.endIndex);},[d]),x=useCallback(h=>{let R=a(h);if(!R)return jsx("div",{className:"px-4 py-2 border-b border-gray-200 dark:border-neutral-700",children:jsx("div",{className:"h-4 w-48 bg-gray-200 dark:bg-neutral-700 rounded animate-pulse"})});let A,r=false;try{A=JSON.parse(R);}catch{r=true;}return r?jsx("div",{className:"py-2 px-4 max-w-full font-mono text-xs text-zinc-900 dark:text-gray-300 break-all text-wrap whitespace-pre-wrap select-text",children:R}):jsx("div",{className:"select-text",children:jsx(JsonView,{data:A,style:b==="dark"?pr:hr,shouldExpandNode:collapseAllNested,clickToExpandNode:true})})},[a,b]),C=useRef(false);return useEffect(()=>{n>0&&!C.current&&(C.current=true,d(0,50));},[n,d]),o==="idle"||o==="loading"||o==="streaming"?jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[jsx("div",{className:"h-10 w-10 rounded-full border-2 border-gray-200 dark:border-neutral-700 animate-spin border-s-transparent"}),o==="streaming"&&n>0&&jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[n.toLocaleString()," records",i>0?` (${Math.round(i*100)}%)`:""]})]}):jsxs("div",{className:"h-full w-full flex flex-col",children:[o==="partial_error"&&jsx("div",{className:"px-8.5 py-2 border-b border-gray-200 dark:border-neutral-700 flex items-center justify-between",children:jsx("span",{className:"text-xs text-red-500 dark:text-red-400",children:l})}),jsx("div",{className:"flex-1 min-h-0",children:jsx(Virtuoso,{totalCount:n,itemContent:x,rangeChanged:v,increaseViewportBy:300,defaultItemHeight:40,style:{height:"100%"}})})]})},"NdjsonDriver");var po=memo(a(function({extension:o,blob:n,path:a,buffer:l,stream:i,csvLabels:d,onCsvRetry:b,not_supported_message:v=" Sorry, this file type isn\u2019t supported yet."}){let x=o.toLocaleLowerCase().trim(),C;if(a?C=a:n&&(C=URL.createObjectURL(n)),["csv","tsv"].includes(x))return jsx(dr,{url:C,blob:n,stream:i,labels:d,onRetry:b});if(["ndjson","jsonl"].includes(x))return jsx(gr,{url:C,blob:n,stream:i});if(C){if(["jpeg","jpg","png","gif","bmp","ico","svg","tiff","webp"].includes(x))return jsx(Br,{url:C});if(["aac","ac3","aiff","amr","dts","flac","m4a","mp3","ogg","opus","wav","wma"].includes(x))return jsx(Wr,{url:C});if(["3gp","avi","dv","flv","m2ts","m4v","mkv","mov","mp4","mpeg","mpg","mts","ogv","vob","webm"].includes(x))return jsx(Kr,{url:C});if(o==="pdf")return jsx(Qt,{url:C});if(x==="json")return jsx(lo,{url:C});if(["txt","js","jsx","ts","tsx","html","css","scss","py","java","cpp","c","cs","php","rb","go","rs","swift","kt","xml","yaml","yml","md","sql","sh","bash","cfg","conf","env","htm","ini","log","markdown","properties","rst","toml"].includes(x))return jsx(Gr,{url:C,extension:x})}return x==="docx"?jsx(qr,{url:C,blob:n}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(rb,{className:"mx-5",children:jsx(_a,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:v})})})},"Driver"));var Ju=a(e=>jsx("div",{className:"h-full w-full",children:jsx(po,{...e})}),"FileViewer");var mo=250,cp=a(({text:e,speed:o=50,onDone:n,markdown:a$1=false,markdownComponents:l={},className:i,...d})=>{let[b,v]=useState(""),x=useRef(null),C=useRef(null);return useEffect(()=>{let h=false;if(o>0){v(""),x.current=performance.now();let R=a(A=>{if(h||!x.current)return;let r=A-x.current,L=r/o>mo?o/2:o,k=r/o>mo?1.5:1,T=Math.floor(r/L*k);if(T>=e.length){v(e),h=true,n?.();return}v(e.slice(0,T)),C.current=requestAnimationFrame(R);},"tick");C.current=requestAnimationFrame(R);}else v(e),n?.();return ()=>{C.current&&cancelAnimationFrame(C.current);}},[e,o,n]),a$1?jsx("div",{className:i,children:jsx(Fn,{remarkPlugins:[On],components:l,...d,children:b})}):jsx(_a,{className:i,...d,children:b})},"Typewriter");var Ha={timeout:2e3,message:"Copied!"},xp=a(({text:e,children:o,format:n="text/plain",tooltip:a$1,positions:l=["top"],className:i})=>{let[d,b]=useState(false),v=useRef(null),x={...Ha,...a$1},C=Array.isArray(l)?l[0]:l,h=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(e):_a$1(e,{format:n}),b(true),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>b(false),x.timeout);},"handleCopy");return useEffect(()=>()=>{v.current&&clearTimeout(v.current);},[]),jsx(Popover,{padding:6,positions:l,isOpen:d,align:"center",onClickOutside:()=>b(false),content:!!a$1?.message&&jsx(Eb,{className:i,$position:C,$offset:6,children:a$1.message}),containerStyle:{zIndex:"9999"},children:jsx("div",{className:"inline-block",onMouseLeave:()=>b(false),children:o({copy:h})})})},"CopyToClipboard");var bo=a(e=>new Date(e?Array.isArray(e)?e[1]||e[0]||new Date:e:new Date),"getInitValue"),Yt=a((e,o)=>{let n;if(o){let l=parse(e||"",o,new Date);if(isValid(l)&&getYear(l)>=1970)return l}let a=new Date(e||"");return isNaN(a.getTime())?n:a},"parseDate"),Ga=a((e,o)=>{let n=e?Yt(e,o):void 0;return n&&o?format(n,o):e},"renderDate"),zp=a(({value:e,range:o,inline:n=false,minDate:a=new Date(getYear(new Date)-5,0,1),maxDate:l=new Date(getYear(new Date)+5,11,31),format:i="dd.MM.yyyy",onChange:d,...b})=>{let[v,x]=useState(getMonth(bo(e))),[C,h]=useState(getYear(bo(e))),R=useMemo(()=>{if(e){if(Array.isArray(e)){let r=Yt(e[0],i),L=Yt(e[1],i);return [r,L]}return Yt(e,i)}},[e]),A=useCallback(r=>{if(o){let L=!!(R&&Array.isArray(R)&&R[0]),k=!!(R&&Array.isArray(R)&&R[1]);!L||L&&k?d?.([r.toString(),""]):L&&!k&&(r<R[0]?d?.([r.toString(),R[0].toString()]):d?.([R[0].toString(),r.toString()]));}else d?.(r.toString());},[o,R,d]);return n?jsx(vo,{month:v,year:C,minDate:a,maxDate:l,selectedDate:R,onSelectDate:A,onChangeMonth:x,onChangeYear:h}):o?jsx(Ja,{range:true,value:e,onChange:d,...b}):jsx(Ka,{value:e,onChange:d,minDate:a,maxDate:l,month:v,year:C,selectedDate:R,onChangeMonth:x,onChangeYear:h,onSelectDate:A,formatStr:i,...b})},"DatePicker"),Ja=a(({minDate:e,maxDate:o,value:n,onChange:a})=>null,"DatePickerGroupInput"),Ka=a(({placeholder:e,value:o,onChange:n,inputProps:a,...l})=>{let[i,d]=useState(false),b=y(),v=useCallback(()=>{d(false);},[]);return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:i,onClickOutside:()=>d(false),content:jsx(rb,{children:jsx(vo,{...l,onClose:v})}),containerStyle:{zIndex:`${b.zIndex.popover}`},children:jsx("div",{onClick:()=>d(true),children:jsx(mb,{...a,placeholder:e,value:Ga(o,l.formatStr),onChange:x=>n?.(x.target.value)})})})},"DatePickerInput"),vo=a(({month:e,year:o,selectedDate:n,minDate:a,maxDate:l,onSelectDate:i,onChangeMonth:d,onChangeYear:b,onClose:v})=>{let x=useMemo(()=>new Array(12).fill(null).map((S,D)=>{let P=new Date(0,D);return {value:D+1,inputDisplay:format(P,"MMMM")}}),[]),C=useMemo(()=>{let S=getYear(a),P=getYear(l)-S+1;return new Array(P).fill(null).map((W,V)=>{let X=S+V;return {value:X,inputDisplay:X.toString()}})},[a,l]),h=useMemo(()=>new Array(7).fill(null).map((S,D)=>{let P=startOfWeek(new Date,{weekStartsOn:D});return format(P,"EEE")}),[]),R=useMemo(()=>{let S=startOfMonth(new Date(o,e)),D=endOfMonth(new Date(o,e)),P=getDay(S)===0?S:previousSunday(S),W=getDay(D)===6?D:nextSaturday(D),V=differenceInDays(W,P),X=differenceInDays(S,P);return new Array(V+1).fill(null).map((q,ce)=>new Date(o,e,ce-X+1))},[e,o]),A=useCallback(()=>{e===0?(b(o-1),d(11)):d(e-1);},[e,o]),r=useCallback(()=>{e===11?(b(o+1),d(0)):d(e+1);},[e,o]),L=useMemo(()=>a?!(o<getYear(a)||o===getYear(a)&&e<=getMonth(a)):true,[e,o,a]),k=useMemo(()=>l?!(o>getYear(l)||o===getYear(l)&&e>=getMonth(l)):true,[e,o,l]),T=useCallback(S=>{S.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:T,children:[jsxs("div",{className:"flex justify-center items-center gap-2 pb-3",children:[L&&jsx(z,{size:"small",variant:"empty",icon:jsx(G,{}),onClick:A}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(kb,{placeholder:"",hasBorder:false,selected:e+1,options:x,onSelect:S=>d(S-1),maxWidth:150,maxHeight:300}),jsx(kb,{placeholder:"",hasBorder:false,selected:o,options:C,onSelect:S=>b(S),maxWidth:100,maxHeight:300})]}),k&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:r})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:h.map(S=>jsx("div",{className:"text-center",children:S},S))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:R.map(S=>{let D=getMonth(S)===e,P=format(S,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),W=n&&(Array.isArray(n)&&(n[0]&&format(S,"yyyy-MM-dd")===format(n[0],"yyyy-MM-dd")||n[1]&&format(S,"yyyy-MM-dd")===format(n[1],"yyyy-MM-dd"))||!Array.isArray(n)&&format(S,"yyyy-MM-dd")===format(n,"yyyy-MM-dd")),V=n&&Array.isArray(n)&&n[0]&&n[1]&&S>n[0]&&S<n[1],X=a&&differenceInDays(S,a)<0||l&&differenceInDays(S,l)>0||!D;return jsx(Qa,{date:S,isCurrentMonth:D,isCurrentDay:P,isSelected:!!W,isInRange:!!V,isDisabled:!!X,onSelectDate:q=>{i(q),v?.();}},S.toISOString())})})]})},"DatePickerCalendar"),Qa=a(({date:e,isCurrentMonth:o,isCurrentDay:n,isSelected:a$1,isInRange:l,isDisabled:i,onSelectDate:d})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${i?"text-gray-400 dark:text-neutral-600 cursor-not-allowed":a$1?"bg-blue-500 text-white":l?"bg-blue-100 dark:bg-blue-900/30":n?"text-blue-500":o?"text-black dark:text-white":"text-gray-400 dark:text-neutral-600"} ${i?"":a$1?"hover:bg-blue-600":"hover:bg-gray-100 dark:hover:bg-neutral-700"}`,onClick:a(v=>{i||d(e);},"handleClick"),children:format(e,"d")}),"CalendarDay");var ri=a(e=>{switch(e){case "primary":return "bg-blue-100 border-blue-200 dark:bg-blue-950 dark:border-blue-900";case "error":return "bg-red-100 border-red-200 dark:bg-red-950 dark:border-red-900";case "warning":return "bg-yellow-100 border-yellow-200 dark:bg-amber-950 dark:border-amber-900";case "success":return "bg-teal-100 border-teal-200 dark:bg-teal-950 dark:border-teal-900";case "default":default:return "bg-white border border-gray-200 dark:bg-neutral-900 dark:border-neutral-700"}},"getColorStyle"),oi=a(e=>{switch(e){case "primary":return "text-blue-800 dark:text-blue-500";case "error":return "text-red-800 dark:text-red-500";case "warning":return "text-yellow-800 dark:text-yellow-500";case "success":return "text-teal-800 dark:text-teal-500";case "default":default:return "text-gray-800 dark:text-white"}},"getTextColor"),ni=a(e=>{switch(e){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),ko=a(({id:e,color:o="default",message:n,duration:a,transitionDirection:l,cancelable:i=true,onClose:d})=>{let[b,v]=useState(false),[x,C]=useState(false),h=useRef(null),R=useCallback(()=>{v(true),h.current=setTimeout(()=>{d(e);},300);},[e,d]);return useEffect(()=>{if(C(true),a&&a<1/0){let A=setTimeout(()=>{R();},a);return ()=>clearTimeout(A)}},[a,R]),useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]),jsx("div",{className:`max-w-xs
|
|
277
279
|
border
|
|
278
280
|
w-full
|
|
279
281
|
text-sm
|
|
@@ -281,8 +283,8 @@ self.onmessage = async (e) => {
|
|
|
281
283
|
transition-all
|
|
282
284
|
ease-in-out
|
|
283
285
|
duration-300
|
|
284
|
-
${
|
|
285
|
-
${
|
|
286
|
-
${
|
|
287
|
-
export{
|
|
286
|
+
${b||!x?"opacity-0":"opacity-100"}
|
|
287
|
+
${x?"translate-y-0":ni(l)}
|
|
288
|
+
${ri(o)} ${oi(o)}`,children:jsxs("div",{className:"flex p-4 items-center",style:{wordBreak:"break-word"},children:[n,i&&jsx("div",{className:"ms-auto self-start flex",children:jsx("button",{type:"button",className:"inline-flex shrink-0 justify-center items-center size-5 rounded-lg opacity-50 hover:opacity-100 focus:outline-hidden focus:opacity-100 cursor-pointer border-none","aria-label":"Close",onClick:R,children:jsxs("svg",{className:"shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]})})})]})})},"Toast");var ii=a((e,o)=>{switch(e){case "top-right":return `top-${o} right-${o}`;case "top-left":return `top-${o} left-${o}`;case "bottom-right":return `bottom-${o} right-${o}`;case "bottom-left":return `bottom-${o} left-${o}`;default:return `top-${o} right-${o}`}},"getPosition"),Yp=a(({items:e,onClose:o,position:n="top-right",offset:a=4})=>{let l=useMemo(()=>n.startsWith("top")?"top":"bottom",[n]);return jsx("div",{className:`fixed flex min-w-0 max-w-xs w-full flex-col z-50 gap-2 ${ii(n,a)}`,children:e.map(i=>jsx(ko,{transitionDirection:l,...i,onClose:o},i.id))})},"ToastsList");var o0=a(({onChange:e,disabled:o,multiple:n,dragText:a$1="Drop file to upload",className:l})=>{let[i,d]=useState(false),[b,v]=useState(false),[x,C]=useState(false);return useEffect(()=>{if(o)return;let h=0,R=a(k=>{k.preventDefault(),k.dataTransfer?.types.includes("Files")&&(h++,h===1&&d(true));},"handleDragEnter"),A=a(k=>{k.preventDefault(),k.dataTransfer?.types.includes("Files")&&(h--,h===0&&d(false));},"handleDragLeave"),r=a(k=>{k.preventDefault();},"handleDragOver"),L=a(async k=>{if(k.preventDefault(),h=0,d(false),!!k.dataTransfer?.types.includes("Files")&&!b)try{v(!0);let T=await nb(k.dataTransfer.items);e(n?T:T.length>0?[T[0]]:[]);}catch(T){console.error("\u041F\u043E\u043C\u0438\u043B\u043A\u0430 \u043F\u0440\u0438 \u0447\u0438\u0442\u0430\u043D\u043D\u0456 \u0444\u0430\u0439\u043B\u0456\u0432:",T);}finally{v(false);}},"handleDrop");return document.addEventListener("dragenter",R),document.addEventListener("dragleave",A),document.addEventListener("dragover",r),document.addEventListener("drop",L),()=>{document.removeEventListener("dragenter",R),document.removeEventListener("dragleave",A),document.removeEventListener("dragover",r),document.removeEventListener("drop",L);}},[o,b,n,e]),useEffect(()=>{C(true);},[]),x&&i?createPortal(jsx("div",{className:`fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center bg-[rgba(251,250,250,0.9)] dark:bg-[rgba(12,10,18,0.9)] z-9999 ${l}`,children:jsx(_a,{variant:"h3",className:"px-3 py-2 bg-white dark:bg-neutral-800 rounded-md border border-gray-200 dark:border-neutral-700",children:a$1})}),document.body):null},"GlobalDropZone");
|
|
289
|
+
export{Kl as Container,xp as CopyToClipboard,zp as DatePicker,vo as DatePickerCalendar,Ju as FileViewer,Ac as FullscreenCard,o0 as GlobalDropZone,pn as Graph2D,_l as PageContent,El as PageLayout,nc as SplitterLayout,Io as Styled,Mo as StyledContainer,Ro as StyledMain,Hl as SubNav,Yp as ToastsList,cp as Typewriter};//# sourceMappingURL=index.mjs.map
|
|
288
290
|
//# sourceMappingURL=index.mjs.map
|