@cyber-harbour/ui 2.2.22 → 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 as
|
|
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 as Ra$1,_a,na,Na as Na$1,sa,rb,Eb,y,mb,G,kb,H,nb}from'.
|
|
|
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 as Ra$1,_a,na,Na as Na$1,sa,rb,Eb,y,mb,G,kb,H,nb}from'.
|
|
|
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
|
-
`,No=a(({width:r=280,height:o=280})=>{let n=useTheme();return jsx(Ro,{children:jsxs(Po,{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"),yr=No;var Dt=typeof window<"u"&&window.devicePixelRatio||1;function Uo(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(Uo,"prepareButtonImages");var oe={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},Zo=forwardRef(({loading:r,width:o,height:n,graphData:a$1,buttons:u=[],onNodeClick:s,onBackgroundClick:f,onNodeHover:y,onLinkHover:x,onLinkClick:N},M)=>{let g=useTheme(),[I,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*Dt,height:n*Dt,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:E,links:w}=useMemo(()=>Ao(a$1),[a$1]),[T,C]=useState([]),P=useRef(null),k=useRef(null),W=useRef(null),U=scaleOrdinal(schemeCategory10),V=useCallback(()=>{if(!P.current)return false;try{let e=P.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}},[]),ie=useCallback(()=>k.current?k.current.nodes():null,[]),ke=useCallback(()=>{if(!k.current)return null;let e=k.current.force("link");return e?e.links():null},[]),Se=useCallback(e=>{e.save(),e.setTransform(1,0,0,1,0,0);let{width:l,height:c}=t.current,d=oe.gridSpacing,p=oe.dotSize;e.fillStyle=g.graph2D.grid.dotColor;for(let b=d/2;b<=l;b+=d)for(let m=d/2;m<=c;m+=d)e.beginPath(),e.arc(b,m,p,0,2*Math.PI),e.fill();e.restore();},[g.graph2D.grid.dotColor,oe.gridSpacing,oe.dotSize]),ge=useCallback((e,l,c)=>{if(!e)return "";if(c.measureText(e).width<=l)return e;let p=e,b="...";for(;c.measureText(p+b).width>l&&p.length>0;)p=p.slice(0,-1);return p+b},[]),ze=a(e=>{let c=Math.min(e,oe.maxZoom)/oe.maxZoom;return Math.max(oe.fontSize*c,oe.fontSize)},"calculateFontSize"),me=useCallback(e=>{let l=ke(),c=ie();!l||l.length===0||!c||c.length===0||(e.lineWidth=.5,e.globalAlpha=1,l.forEach(d=>{let p=typeof d.source=="object"?d.source:c.find(fe=>fe.id===d.source),b=typeof d.target=="object"?d.target:c.find(fe=>fe.id===d.target);if(!p||!b)return;let m={x:p.x||0,y:p.y||0},h={x:b.x||0,y:b.y||0},S=h.x-m.x,R=h.y-m.y,z=Math.sqrt(S*S+R*R),Z=S/z,H=R/z,re=oe.nodeSizeBase/2,G=oe.nodeSizeBase/2,te=4,D={x:m.x+Z*re,y:m.y+H*re},O={x:h.x-Z*(G+te),y:h.y-H*(G+te)},A={x:h.x-Z*(G+1),y:h.y-H*(G+1)},ae=t.current.highlightLinks.has(d),v=ae?g.graph2D.link.highlighted:g.graph2D.link.normal,L=ae?1.5:.5,B=m.x+(h.x-m.x)/2,X=m.y+(h.y-m.y)/2,Y=Math.atan2(R,S);if(d.label){let fe=t.current.transform.k,ve=ze(fe);e.font=`${ve}px Sans-Serif`;let Ee=e.measureText(d.label).width,Ae=10;e.beginPath(),e.moveTo(D.x,D.y);let Ze=z/2-(Ee+Ae)/2,Ve={x:m.x+Z*Ze,y:m.y+H*Ze};e.lineTo(Ve.x,Ve.y),e.strokeStyle=v,e.lineWidth=L,e.stroke(),e.beginPath();let $e=z/2+(Ee+Ae)/2,nt={x:m.x+Z*$e,y:m.y+H*$e};e.moveTo(nt.x,nt.y),e.lineTo(O.x,O.y),e.strokeStyle=v,e.lineWidth=L,e.stroke();}else e.beginPath(),e.moveTo(D.x,D.y),e.lineTo(O.x,O.y),e.strokeStyle=v,e.lineWidth=L,e.stroke();let se=2;if(e.save(),e.translate(A.x,A.y),e.rotate(Y),e.beginPath(),e.moveTo(0,0),e.lineTo(-te,se),e.lineTo(-te,0),e.lineTo(-te,-se),e.closePath(),e.fillStyle=v,e.fill(),e.restore(),d.label){let fe=t.current.transform.k,ve=ze(fe);e.font=`${ve}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.save(),e.translate(B,X),Math.abs(Y)>Math.PI/2?e.rotate(Y+Math.PI):e.rotate(Y),e.fillStyle=ae?g.graph2D.link.highlightedTextColor:g.graph2D.link.textColor,e.fillText(d.label,0,0),e.restore();}}));},[oe,g.graph2D.link]),$=a((e,l,c,d,p,b,m)=>{try{if(b!=null){let h=p*.8;e.font=`${h}px sans-serif`,e.textBaseline="middle",e.textAlign="left";let S=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(b),R=e.measureText(S).width,z=p*.3,H=(p+z+R)/2;e.drawImage(l,c-H,d-p/2,p,p),e.fillStyle=m||"#99989C",e.fillText(S,c-H+p+z,d);}else e.drawImage(l,c-p/2,d-p/2,p,p);}catch(h){console.warn("Error rendering icon:",h);}},"drawIconWithOptionalCounter"),_=useCallback((e,l$1)=>{if(!T||T.length===0||!e||!e.x||!e.y)return;let{x:c,y:d}=e,p=oe.nodeSizeBase*oe.nodeAreaFactor/2;l$1.save();let b=Math.min(T.length,8),m=Math.min(Math.PI*2/b,Math.PI);for(let h=0;h<b;h++){let S=h*m,R=(h+1)*m,z=t.current.hoveredButtonIndex===h;l$1.beginPath(),l$1.arc(c,d,p,S,R,false),l$1.lineTo(c,d),l$1.closePath(),l$1.lineWidth=1,l$1.strokeStyle=g.graph2D?.button?.stroke||"#FFFFFF",l$1.stroke(),l$1.fillStyle=z?g.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":g.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",l$1.fill();let Z=p*.2,H=(S+R)/2,re=p-oe.nodeSizeBase/2+Z,G=c+Math.cos(H)*re,te=d+Math.sin(H)*re,D=T[h];if(D.loading){let O=Z/2,A=Z/12;l$1.save(),l$1.translate(G,te),l$1.rotate(t.current.spinnerAngle);for(let ae=0;ae<12;ae++){let v=Math.PI*2*ae/12,L=ae/12,B=Math.cos(v)*O,X=Math.sin(v)*O;l$1.beginPath(),l$1.fillStyle=l(g.graph2D?.button?.spinnerColor,L),l$1.arc(B,X,A,0,Math.PI*2),l$1.fill();}l$1.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(j),t.current.animation.buttonIndex=h;}else {t.current.animation.id&&t.current.animation.buttonIndex===h&&(cancelAnimationFrame(t.current.animation.id),t.current.animation.id=null,t.current.animation.buttonIndex=null);let O=z?D.hoverImg:D.normalImg,A=D.getCount?D.getCount(e):null;O.complete?$(l$1,O,G,te,Z,A,g.graph2D?.button?.textColor):O.onload=()=>{W.current&&$(l$1,O,G,te,Z,A,g.graph2D?.button?.textColor);};}}l$1.restore();},[T,g.graph2D?.button]),K=useCallback(e=>{let l=ie();!l||l.length===0||(e.globalAlpha=1,l.forEach(c=>{let{x:d,y:p,color:b,fontColor:m,label:h}=c,S=t.current.highlightNodes.has(c)||c===t.current.hoveredNode||c===t.current.draggedNode,R=c===t.current.selectedNode,z=oe.nodeSizeBase,Z=oe.nodeSizeBase/2;if(S&&!R){let H=oe.nodeSizeBase*oe.nodeAreaFactor*.75/2;e.beginPath(),e.arc(d,p,H,0,2*Math.PI,false),e.fillStyle=g.graph2D.ring.highlightFill,e.fill();}if(R)if(u&&u.length>0)_(c,e);else {let H=oe.nodeSizeBase*oe.nodeAreaFactor/2;e.beginPath(),e.arc(d,p,H,0,2*Math.PI,false),e.fillStyle=g.graph2D.ring.selectionFill||g.graph2D.ring.highlightFill,e.fill();}if(e.beginPath(),e.arc(d,p,Z,0,2*Math.PI),e.fillStyle=b||U(c.group||"0"),e.fill(),h){e.save(),e.translate(d,p);let H=t.current.transform.k,re=ze(H),G=z*oe.textPaddingFactor;e.font=`${re}px Sans-Serif`,e.textAlign="center",e.textBaseline="middle",e.fillStyle=m||"#000";let te=ge(h,G,e);e.fillText(te,0,0),e.restore();}}));},[g.graph2D.ring,u,_]),j=useCallback(()=>{let e=W.current;e&&(e.clearRect(0,0,t.current.width,t.current.height),Se(e),e.save(),e.setTransform(t.current.transform.k,0,0,t.current.transform.k,t.current.transform.x,t.current.transform.y),me(e),K(e),e.restore());},[me,K,Se]),ee=useCallback((e,l=[],c)=>{let d=ke()||[],p=ie()||[];if(!k.current||!e.length)return;let{width:b,height:m}=t.current,h=c?.smoothAppearance??false,S=c?.transitionDuration??1e3,R=new Set(p.map(D=>D.id)),z=e.filter(D=>!R.has(D.id)),Z=new Set(d.map(D=>`${typeof D.source=="object"?D.source.id:D.source}-${typeof D.target=="object"?D.target.id:D.target}`)),H=l.filter(D=>{let O=`${typeof D.source=="object"?D.source.id:D.source}-${typeof D.target=="object"?D.target.id:D.target}`;return !Z.has(O)});if(z.length===0&&H.length===0)return;let re=[...p,...z],G=[...d,...H];h&&(z.forEach(D=>{let O=H.filter(A=>{let ae=typeof A.source=="object"?A.source.id:A.source,v=typeof A.target=="object"?A.target.id:A.target;return ae===D.id&&R.has(v)||v===D.id&&R.has(ae)});if(O.length>0){let A=O[0],ae=typeof A.source=="object"?A.source.id===D.id?A.target:A.source.id:A.source===D.id?A.target:A.source,v=re.find(L=>L.id===ae);if(v&&v.x!==void 0&&v.y!==void 0){let L=30+Math.random()*20,B=Math.random()*Math.PI*2;D.x=v.x+Math.cos(B)*L,D.y=v.y+Math.sin(B)*L,D.vx=0,D.vy=0;}}else {let A=b/2,ae=m/2,v=Math.min(b,m)/4,L=Math.random()*Math.PI*2;D.x=A+Math.cos(L)*(v*Math.random()),D.y=ae+Math.sin(L)*(v*Math.random()),D.vx=0,D.vy=0;}}),p.forEach(D=>{D.fx=D.x,D.fy=D.y;})),k.current.nodes(re);let te=k.current.force("link");te&&te.links(G),H.forEach(D=>{let O=typeof D.source=="object"?D.source:re.find(ae=>ae.id===D.source),A=typeof D.target=="object"?D.target:re.find(ae=>ae.id===D.target);!O||!A||(!O.neighbors&&(O.neighbors=[]),!A.neighbors&&(A.neighbors=[]),O.neighbors.push(A),A.neighbors.push(O),!O.links&&(O.links=[]),!A.links&&(A.links=[]),O.links.push(D),A.links.push(D));}),h?(k.current.alphaTarget(.3),k.current.alpha(.3),k.current.velocityDecay(.7),k.current.restart(),setTimeout(()=>{p.forEach(D=>{D.fx=void 0,D.fy=void 0;}),k.current?.alphaTarget(0),k.current?.alpha(.1),k.current?.velocityDecay(.6);},S)):k.current.alpha(.1).restart(),j();},[E,j]),de=useCallback(e=>{let l=ie(),c=ke();if(!k.current||!e.length||!l||l.length===0||!c||c.length===0)return;let d=new Set(e);if(t.current.selectedNode&&t.current.selectedNode.id!==void 0&&d.has(t.current.selectedNode.id)&&(t.current.selectedNode=null),t.current.hoveredNode&&t.current.hoveredNode.id!==void 0&&d.has(t.current.hoveredNode.id)&&(t.current.hoveredNode=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set),t.current.hoveredLink){let h=typeof t.current.hoveredLink.source=="object"?t.current.hoveredLink.source.id:t.current.hoveredLink.source,S=typeof t.current.hoveredLink.target=="object"?t.current.hoveredLink.target.id:t.current.hoveredLink.target;(h!==void 0&&d.has(h)||S!==void 0&&d.has(S))&&(t.current.hoveredLink=null,t.current.highlightNodes=new Set,t.current.highlightLinks=new Set);}t.current.draggedNode&&t.current.draggedNode.id!==void 0&&d.has(t.current.draggedNode.id)&&(t.current.draggedNode=null);let p=l.filter(h=>h.id!==void 0&&!d.has(h.id)),b=c.filter(h=>{let S=typeof h.source=="object"?h.source.id:h.source,R=typeof h.target=="object"?h.target.id:h.target;return S!==void 0&&!d.has(S)&&R!==void 0&&!d.has(R)});p.forEach(h=>{h.neighbors=[],h.links=[];}),b.forEach(h=>{let S=typeof h.source=="object"?h.source:p.find(z=>z.id===h.source),R=typeof h.target=="object"?h.target:p.find(z=>z.id===h.target);!S||!R||(S.neighbors=S.neighbors||[],R.neighbors=R.neighbors||[],S.neighbors.push(R),R.neighbors.push(S),S.links=S.links||[],R.links=R.links||[],S.links.push(h),R.links.push(h));}),k.current.nodes(p);let m=k.current.force("link");m&&m.links(b),j();},[j]),ce=useCallback((e=0,l=20)=>{let c=ie();if(!W.current||!P.current||!c||!c.length)return;let p=1/0,b=1/0,m=-1/0,h=-1/0;if(c.forEach(S=>{if(S.x===void 0||S.y===void 0)return;let R=S.x,z=S.y;p=Math.min(p,R),b=Math.min(b,z),m=Math.max(m,R),h=Math.max(h,z);}),isFinite(p)&&isFinite(m)&&isFinite(b)&&isFinite(h)){let{width:S,height:R}=t.current;p-=l,b-=l,m+=l,h+=l;let z=m-p,Z=h-b,H=z>0?S/z:1,re=Z>0?R/Z:1,G=Math.min(H,re,10),te=p+z/2,D=b+Z/2,O={k:G,x:S/2-te*G,y:R/2-D*G};if(e>0){let A={...t.current.transform},ae=Date.now(),v=a(()=>{let L=Math.min(1,(Date.now()-ae)/e),B=L===1?1:1-Math.pow(1-L,3),X={k:A.k+(O.k-A.k)*B,x:A.x+(O.x-A.x)*B,y:A.y+(O.y-A.y)*B};t.current.transform=X,j(),L<1&&requestAnimationFrame(v);},"animateZoom");requestAnimationFrame(v);}else t.current.transform=O,j();}},[]),J=useCallback((e,l)=>{let c=ie();if(!c||c.length===0)return null;let d=oe.nodeSizeBase/2,p=typeof window<"u"&&window.devicePixelRatio||1,b=(e*p-t.current.transform.x)/t.current.transform.k,m=(l*p-t.current.transform.y)/t.current.transform.k;return c.find(h=>{let S=(h.x||0)-b,R=(h.y||0)-m;return Math.sqrt(S*S+R*R)<=d})||null},[]),ne=useCallback((e,l)=>{let c=ke(),d=ie();if(!c||c.length===0||!d||d.length===0)return null;let p=typeof window<"u"&&window.devicePixelRatio||1,b=(e*p-t.current.transform.x)/t.current.transform.k,m=(l*p-t.current.transform.y)/t.current.transform.k,h=5;return c.find(S=>{let R=typeof S.source=="object"?S.source:d.find(ve=>ve.id===S.source),z=typeof S.target=="object"?S.target:d.find(ve=>ve.id===S.target);if(!R||!z)return false;let Z=R.x||0,H=R.y||0,re=z.x||0,G=z.y||0,te=b-Z,D=m-H,O=re-Z,A=G-H,ae=te*O+D*A,v=O*O+A*A;if(v===0)return false;let L=ae/v;L=Math.max(0,Math.min(1,L));let B=Z+L*O,X=H+L*A,Y=b-B,se=m-X;return Math.sqrt(Y*Y+se*se)<=h})||null},[]),Me=useCallback((e,l,c,d,p,b,m)=>{let h=e-c,S=l-d,R=Math.sqrt(h*h+S*S),z=Math.atan2(S,h);z<0&&(z+=2*Math.PI);let re=R>=p*.5&&R<=p*1,G=false;return b===Math.PI&&m===Math.PI*2?G=z>=Math.PI&&z<=Math.PI*2:b===0&&m===Math.PI?G=z>=0&&z<=Math.PI:G=b<=m&&z>=b&&z<=m||b>m&&(z>=b||z<=m),re&&G},[]),ue=useCallback(e=>{if(e===t.current.hoveredNode)return;let l=new Set,c=new Set;e&&(l.add(e),e.neighbors&&e.neighbors.forEach(d=>l.add(d)),e.links&&e.links.forEach(d=>c.add(d))),t.current.hoveredNode=e,y&&y(e),t.current.highlightNodes=l,t.current.highlightLinks=c;},[y]),xe=useCallback(e=>{if(e===t.current.hoveredLink)return;let l=new Set,c=new Set;if(e){c.add(e);let d=ie();if(d){let p=typeof e.source=="object"?e.source:d.find(m=>m.id===e.source),b=typeof e.target=="object"?e.target:d.find(m=>m.id===e.target);p&&l.add(p),b&&l.add(b);}}t.current.hoveredLink=e,x&&x(e),t.current.highlightNodes=l,t.current.highlightLinks=c;},[x,ie]),We=useCallback(e=>{N&&N(e);},[N]),be=useCallback(e=>{t.current.selectedNode=e,s&&s(e);},[s]),Te=useCallback(()=>{t.current.selectedNode=null,f&&f();},[f]),De=useCallback(e=>{if(!P.current||!k.current)return;let l=P.current.getBoundingClientRect(),c=e.clientX-l.left,d=e.clientY-l.top;t.current.mouseStartPos={x:c,y:d},t.current.isDragging=false;let p=J(c,d);p?(t.current.draggedNode=p,p.fx=p.x,p.fy=p.y):(t.current.isPanning=true,t.current.lastMousePos={x:c,y:d});},[J]),Ce=useCallback((e,l)=>{let c=null;if(P.current&&t.current&&T.length>0){let d=oe.nodeSizeBase*oe.nodeAreaFactor/2,p=P.current.getBoundingClientRect(),b=P.current.width/p.width,m=P.current.height/p.height,h=e*b,S=l*m,R=(h-t.current.transform.x)/t.current.transform.k,z=(S-t.current.transform.y)/t.current.transform.k,Z=t.current.selectedNode?.x||0,H=t.current.selectedNode?.y||0,re=Math.min(T.length,8),G=Math.min(Math.PI*2/re,Math.PI);for(let te=0;te<re;te++){let D=te*G,O=(te+1)*G;if(Me(R,z,Z,H,d,D,O)){c=te;break}}}return c},[T]),he=useCallback(e=>{if(!P.current)return;let l=P.current.getBoundingClientRect(),c=e.clientX-l.left,d=e.clientY-l.top;if(t.current.draggedNode&&t.current.mouseStartPos&&k.current){let m=t.current.mouseStartPos.x,h=t.current.mouseStartPos.y,S=c-m,R=d-h;Math.sqrt(S*S+R*R)>3&&(t.current.isDragging=true,k.current.alphaTarget()===0&&k.current.alphaTarget(0).restart());let H=typeof window<"u"&&window.devicePixelRatio||1,re=(c*H-t.current.transform.x)/t.current.transform.k,G=(d*H-t.current.transform.y)/t.current.transform.k;t.current.draggedNode.fx=re,t.current.draggedNode.fy=G;return}if(t.current.isPanning&&t.current.mouseStartPos){let m=c-t.current.lastMousePos.x,h=d-t.current.lastMousePos.y,S=t.current.mouseStartPos.x,R=t.current.mouseStartPos.y;Math.sqrt(Math.pow(c-S,2)+Math.pow(d-R,2))>3&&(t.current.isDragging=true),t.current.transform={...t.current.transform,x:t.current.transform.x+m,y:t.current.transform.y+h},t.current.lastMousePos={x:c,y:d},j();return}let p,b;if(t.current.selectedNode&&P.current&&T.length>0){let m=Ce(c,d);m!==null&&(b=t.current.selectedNode),m!==t.current.hoveredButtonIndex&&(p=true),t.current.hoveredButtonIndex=m;}else t.current.hoveredButtonIndex!==null&&(t.current.hoveredButtonIndex=null);if(!b&&(b=J(c,d),!b)){let m=ne(c,d),h=m!==t.current.hoveredLink;if(m&&t.current.hoveredNode&&ue(null),xe(m),P.current&&(P.current.style.cursor=m?"pointer":"default"),h){j();return}}b&&t.current.hoveredLink&&xe(null),b!==t.current.hoveredNode&&(p=true),ue(b),P.current&&(P.current.style.cursor=b?"pointer":"default"),p&&j();},[T,J,ne,ue,xe,j,Me,Ce]),Ne=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.stopPropagation(),e.preventDefault()),t.current.mustBeStoppedPropagation=false;},[]),Ue=useCallback(e=>{let l=t.current.isDragging;if(l&&(t.current.mustBeStoppedPropagation=true),!l&&t.current.mouseStartPos){let c=P.current?.getBoundingClientRect();if(c){let d=e.clientX-c.left,p=e.clientY-c.top;T.length>0&&t.current.hoveredButtonIndex===null&&(t.current.hoveredButtonIndex=Ce(d,p));let b=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),b=true,t.current.hoveredButtonIndex=null);}if(!b&&t.current.draggedNode)be(t.current.draggedNode);else if(!b&&!t.current.draggedNode){let m=ne(d,p);m?We(m):Te();}}}if(t.current.draggedNode&&k.current){if(l){k.current.alphaTarget(0);let c=.05,d=.04,p=.6;k.current.alpha(c).alphaDecay(d),k.current.velocityDecay(p);}else k.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),j();},[u,j,be,Te,ne,We,Ce,T]),st=useCallback(e=>{if(e.stopPropagation(),e.preventDefault(),!P.current)return;let l=P.current.getBoundingClientRect(),c=e.clientX-l.left,d=e.clientY-l.top,b=-e.deltaY>0?1.1:1/1.1,m=t.current.transform,h=m.k*b;if(h<.01||h>10)return;let S=m.k*b,R=c-(c-m.x)*b,z=d-(d-m.y)*b;t.current.transform={k:S,x:R,y:z},j();},[j]),ct=a((e,l)=>{let c=e.touches[0];if(c){let d={clientX:c.clientX,clientY:c.clientY};l(d);}},"convertTouchToMouseEvent"),Bt=useCallback(e=>{ct(e,De);},[De]),lt=useCallback(e=>{t.current.mustBeStoppedPropagation&&(e.preventDefault(),e.stopPropagation()),t.current.mustBeStoppedPropagation=false,ct(e,Ue);},[Ue]),Ot=useCallback(e=>{ct(e,he);},[he]);return useImperativeHandle(M,()=>({zoomToFit:ce,addNodes:ee,removeNodes:de}),[ce,ee,de]),useEffect(()=>{let e=P.current,{width:l,height:c}=t.current;if(!e)return;V(),F(true);let d=l/2,p=c/2,b=oe.nodeSizeBase,m=b/2,h=b*2.5;k.current&&k.current.stop();let S=k.current=forceSimulation(E).force("link",forceLink(w).id(R=>R.id).distance(h).strength(.9)).force("charge",forceManyBody().strength(-b/10*200).theta(.5).distanceMin(b*2)).force("x",forceX().strength(.03)).force("y",forceY().strength(.03)).force("center",forceCenter(d,p).strength(.05)).force("collide",forceCollide().radius(m*2).iterations(2).strength(1)).velocityDecay(.6);return ()=>{S.stop();}},[E,w]),useLayoutEffect(()=>{let e=P.current;e&&(t.current.width=o*Dt,t.current.height=n*Dt,e.width=t.current.width,e.height=t.current.height);},[o,n]),useEffect(()=>{if(k.current){let e=k.current;e.on("tick",()=>{j();}),e.on("end",()=>{I&&(ce(0,20),setTimeout(()=>{F(false);},200));});}I||j();},[E,w,I,j,ce]),useEffect(()=>{!E||!w||w.forEach(e=>{let l=typeof e.source=="object"?e.source:E.find(d=>d.id===e.source),c=typeof e.target=="object"?e.target:E.find(d=>d.id===e.target);!l||!c||(!l.neighbors&&(l.neighbors=[]),!c.neighbors&&(c.neighbors=[]),l.neighbors.push(c),c.neighbors.push(l),!l.links&&(l.links=[]),!c.links&&(c.links=[]),l.links.push(e),c.links.push(e));});},[E,w]),useEffect(()=>{u&&u.length>0&&C(Uo(u));},[u]),useEffect(()=>{let e=P.current;if(!(!e||typeof window>"u"))return e.addEventListener("wheel",st,{passive:false}),e.addEventListener("touchend",lt,{passive:false}),()=>{e.removeEventListener("wheel",st),e.removeEventListener("touchend",lt);}},[st,lt]),jsxs(Vo,{children:[(r||I)&&jsx(yr,{width:o,height:n}),jsx(Go,{ref:P,style:{width:o,height:n,display:r||I?"none":"block"},onMouseDown:De,onMouseMove:he,onMouseUp:Ue,onMouseLeave:Ue,onClick:Ne,onTouchStart:Bt,onTouchMove:Ot})]})}),Vo=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 rn=[.1,.25,.5,.75,1,1.5,2,3,4,5],on=5,nn=.1,an=120;function pt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(pt,"computePadding");var Sr=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:u=rn,maxZoom:s=on,minZoom:f=nn,showMinimap:y=true,minimapWidth:x=an,className:N,onZoomChange:M})=>{let[g,I]=useState("adaptive"),[F,t]=useState(1),[E,w]=useState(0),[T,C]=useState(false),P=useRef(false),[k,W]=useState(false),[U,V]=useState(false),[ie,ke]=useState({left:0,top:0}),Se=useRef(0),[ge,ze]=useState({width:0,height:0}),me=useRef({width:0,height:0}),$=useRef(null),_=useRef(null),K=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),j=useRef(g),ee=useRef(F),de=useRef(E),ce=useRef(M);j.current=g,ee.current=F,de.current=E,ce.current=M;let J=n||me.current.width,ne=a$1||me.current.height,Me=E===90||E===270,ue=Me?ne:J,xe=Me?J:ne,We=useMemo(()=>[...u].sort((v,L)=>v-L),[u]),be=useCallback(()=>ge.width===0||ue===0?1:Math.min(ge.width/ue,ge.height/xe,1),[ge,ue,xe]),Te=useCallback((v,L)=>{if(L==="in"){let X=We.find(Y=>Y>v+.001);return X!==void 0?Math.min(X,s):v}let B=We.findLast(X=>X<v-.001);return B!==void 0?Math.max(B,f):v},[We,s,f]),De=useCallback(()=>j.current==="adaptive"?be():ee.current,[be]),Ce=useCallback(v=>{I("manual"),t(v),ce.current?.(v,"manual");},[]),he=useCallback(()=>{I("adaptive"),ce.current?.(be(),"adaptive");},[be]),Ne=useCallback(v=>{requestAnimationFrame(()=>{let L=_.current;if(!L)return;let B=L.getBoundingClientRect(),X=ue*v,Y=xe*v,se=pt(X,Y,B.width,B.height);L.scrollLeft=X/2+se.x-B.width/2,L.scrollTop=Y/2+se.y-B.height/2;});},[ue,xe]);useEffect(()=>{I("adaptive"),t(1),w(0),W(false),V(false),me.current={width:0,height:0};},[r]),useEffect(()=>{let v=_.current;if(!v)return;let L=new ResizeObserver(B=>{let X=B[0];if(!X)return;let{width:Y,height:se}=X.contentRect;ze(fe=>fe.width===Y&&fe.height===se?fe:{width:Y,height:se});});return L.observe(v),()=>L.disconnect()},[]),useEffect(()=>{let v=_.current;if(!v)return;let L=a(()=>{cancelAnimationFrame(Se.current),Se.current=requestAnimationFrame(()=>{let B=v.scrollLeft,X=v.scrollTop;ke(Y=>Y.left===B&&Y.top===X?Y:{left:B,top:X});});},"handleScroll");return v.addEventListener("scroll",L,{passive:true}),()=>{v.removeEventListener("scroll",L),cancelAnimationFrame(Se.current);}},[]),useEffect(()=>{let v=_.current;if(!v||!k)return;let L=a(B=>{if(!(B.ctrlKey||B.metaKey))return;B.preventDefault();let X=De(),Y=B.deltaY>0?"out":"in",se=Te(X,Y),fe=be();if(Y==="out"&&se<=fe){he();return}let ve=v.getBoundingClientRect(),Ee=de.current,Ae=Ee===90||Ee===270,Ze=me.current.width||1,Ve=me.current.height||1,$e=Ae?Ve:Ze,nt=Ae?Ze:Ve,Ht,Wt;if(j.current==="adaptive"){let Xe=$.current;if(!Xe)return;let Ye=Xe.getBoundingClientRect();Ht=(B.clientX-Ye.left)/(Ye.width/$e),Wt=(B.clientY-Ye.top)/(Ye.height/nt);}else {let Xe=$e*X,Ye=nt*X,ar=pt(Xe,Ye,ve.width,ve.height);Ht=(v.scrollLeft+B.clientX-ve.left-ar.x)/X,Wt=(v.scrollTop+B.clientY-ve.top-ar.y)/X;}Ce(se),requestAnimationFrame(()=>{let Xe=v.getBoundingClientRect(),Ye=pt($e*se,nt*se,Xe.width,Xe.height);v.scrollLeft=Ht*se+Ye.x-(B.clientX-Xe.left),v.scrollTop=Wt*se+Ye.y-(B.clientY-Xe.top);});},"handleWheel");return v.addEventListener("wheel",L,{passive:false}),()=>v.removeEventListener("wheel",L)},[k,De,Te,be,Ce,he]),useEffect(()=>{if(g!=="manual")return;let v=_.current;if(!v)return;let L=a(Y=>{Y.button===0&&(Y.preventDefault(),P.current=true,C(true),K.current={x:Y.clientX,y:Y.clientY,scrollLeft:v.scrollLeft,scrollTop:v.scrollTop});},"handleMouseDown"),B=a(Y=>{if(!P.current)return;let{x:se,y:fe,scrollLeft:ve,scrollTop:Ee}=K.current;v.scrollLeft=ve-(Y.clientX-se),v.scrollTop=Ee-(Y.clientY-fe);},"handleMouseMove"),X=a(()=>{P.current=false,C(false);},"handleMouseUp");return v.addEventListener("mousedown",L),window.addEventListener("mousemove",B),window.addEventListener("mouseup",X),()=>{v.removeEventListener("mousedown",L),window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",X);}},[g]);let Ue=useCallback(()=>{g==="manual"&&he();},[g,he]),st=useCallback(()=>{let v=De(),L=Te(v,"in");L!==v&&(Ce(L),Ne(L));},[De,Te,Ce,Ne]),ct=useCallback(()=>{let v=De(),L=Te(v,"out");if(L<=be()){he();return}Ce(L),Ne(L);},[De,Te,be,he,Ce,Ne]),Bt=useCallback(()=>{Ce(1),Ne(1);},[Ce,Ne]),lt=useCallback(()=>{w(v=>{let L=(v+90)%360;if(j.current==="manual"){let B=me.current.width,X=me.current.height,Y=L===90||L===270,se=Y?X:B,fe=Y?B:X,ve=ee.current;requestAnimationFrame(()=>{let Ee=_.current;if(!Ee)return;let Ae=Ee.getBoundingClientRect(),Ze=se*ve,Ve=fe*ve,$e=pt(Ze,Ve,Ae.width,Ae.height);Ee.scrollLeft=Ze/2+$e.x-Ae.width/2,Ee.scrollTop=Ve/2+$e.y-Ae.height/2;});}return L});},[]),Ot=useCallback(()=>{let v=$.current;v&&(me.current={width:v.naturalWidth,height:v.naturalHeight},W(true),V(false));},[]),e=g==="adaptive"?be():F,l=ue*e,c=xe*e,d=ge.width,p=ge.height,b=g==="manual"?pt(l,c,d,p):{x:0,y:0},m=y&&g==="manual"&&(l>d||c>p),h=ue>0?x/ue:0,S=xe*h,R=d>0?d/F*h:0,z$1=p>0?p/F*h:0,Z=Math.max(0,ie.left-b.x)/F*h,H=Math.max(0,ie.top-b.y)/F*h,re=g==="adaptive"?"Fit":`${Math.round(F*100)}%`,G=Te(e,"in")!==e,te=g==="manual"||e>f,D=g==="adaptive"?{width:ue?l:void 0,height:xe?c:void 0,position:"relative",flexShrink:0}:{width:l,height:c,marginLeft:b.x,marginTop:b.y,flexShrink:0,position:"relative"},O={width:J*e,height:ne*e,maxWidth:"none",maxHeight:"none",position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) rotate(${E}deg)`},A={cursor:g==="manual"?T?"grabbing":"grab":"default"},ae={width:J*h,height:ne*h,position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) rotate(${E}deg)`};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${N??""}`,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$1,{style:{width:20,height:20}}),onClick:ct,disabled:!te,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:g==="manual"?he: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":re,children:jsx(_a,{style:{fontSize:12,fontWeight:500},children:re})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:st,disabled:!G,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$1,{style:{width:16,height:16}}),onClick:lt,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:g==="adaptive"?"primary":"default",icon:jsx(sa,{style:{width:14,height:14}}),onClick:he,className:`${g==="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:g==="manual"&&F===1?"primary":"default",onClick:Bt,className:`${g==="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:_,className:`h-full w-full ${g==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:A,onDoubleClick:Ue,children:U?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:D,children:jsx("img",{ref:$,src:r,alt:o,draggable:false,className:"block select-none",style:O,onLoad:Ot,onError:()=>V(true)})})}),m&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:x,height:S,backdropFilter:"blur(8px)",background:"rgba(255,255,255,0.75)"},children:[jsx("div",{style:ae,children:jsx("img",{src:r,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(R,x),height:Math.min(z$1,S),left:Math.max(0,Math.min(Z,x-R)),top:Math.max(0,Math.min(H,S-z$1)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var Cr=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 Xt=a(({url:r})=>{let[o,n]=useState(null),[a$1,u]=useState(false),[s,f]=useState(true),[y,x]=useState(null);return useEffect(()=>{u(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let M=await import('./PdfDriver-MGKDGHEQ.mjs');n(()=>M.PdfDriver),f(!1);}catch(M){console.error("Failed to load PDF driver:",M),x("Failed to load PDF viewer"),f(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..."})}):y||!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:y||"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 Tr=50,ln=1e4,Rr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[u,s]=useState(null),[f,y]=useState(true),[x,N]=useState(1),M=useRef(false),[g,I]=useState({width:0,height:0}),F=useRef(0),t=a(()=>{M.current=true,N(w=>Math.min(w+.25,4));},"handleZoomIn"),E=a(()=>{M.current=true,N(w=>Math.max(w-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{y(!0),s(null);let T=o;if(!T&&r&&(T=await(await fetch(r)).blob()),!T){s("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(T.size/(1024*1024)>Tr){s(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Tr} \u041C\u0411)`);return}a$1.current.innerHTML="";let P=renderAsync(T,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),k=new Promise((U,V)=>setTimeout(()=>V(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")),ln));await Promise.race([P,k]),await new Promise(U=>requestAnimationFrame(U));let W=a$1.current.querySelector(".docx-wrapper");if(W&&(F.current=W.offsetWidth,I({width:W.offsetWidth,height:W.offsetHeight})),n.current&&F.current>0){let U=n.current.clientWidth,V=Math.min(U/F.current,1);N(V);}y(!1);}catch(T){s(T?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),y(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let w=cn(C=>{if(!(M.current||F.current===0))for(let P of C){let k=P.contentRect.width,W=Math.min(k/F.current,1);N(W);}},150),T=new ResizeObserver(w);return T.observe(n.current),()=>{T.disconnect(),w.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$1,{style:{width:20,height:20}}),onClick:E,disabled:x<=.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(x*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:t,disabled:x>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!u&&!f&&jsx("div",{className:"text-red-500 p-8",children:u}),f&&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:g.width>0?g.width*x:void 0,height:g.height>0?g.height*x: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:
|
|
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
|