@cyber-harbour/ui 2.2.31 → 2.2.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +43 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,w,x,u,c,l,z,Ra
|
|
1
|
+
import {a,w,x,u,c,l,z,Ra as Ra$1,_a,na as na$1,Na as Na$1,sa as sa$1,tb,nb,y,ob,G,kb,H,pb}from'./chunk-Q4NZZVS4.mjs';export{xb as Alert,A as AlertIcon,Ba as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ja as BallsMenu,tb 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,zb 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,Cb as Drawer,Eb as DrawerBody,Db as DrawerHeader,P as EditUserIcon,vb as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,Ta as FaceSearchIcon,za as File2Icon,qb as FileField,ya as FileIcon,S as FiltersIcon,Ka as FlashIcon,rb as FlexContainer,sb 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,ob as Input,Aa as IosIcon,yb as Label,ub as Line,Ab 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,nb as StyledTooltipContent,ga as SunIcon,Bb as Switch,fb as Table,wb as Tag,Lb as TailwindExample,s as ThemeProvider,mb 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-Q4NZZVS4.mjs';import Gn,{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 ao from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import Zn from'react-content-loader';import {renderAsync}from'docx-preview';import Lo from'lodash.throttle';import Ao 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 Xo from'react-markdown';import Vo from'remark-gfm';import {TableVirtuoso,Virtuoso}from'react-virtuoso';import St from'papaparse';import ea from'chardet';import {darkStyles,defaultStyles,JsonView,allExpanded}from'react-json-view-lite';import'react-json-view-lite/dist/index.css';import Ka 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 ql=a(({children:e,className:r})=>jsx(In,{className:r,children:e}),"PageLayout"),In=styled.div`
|
|
2
2
|
display: grid;
|
|
3
3
|
min-height: 100dvh;
|
|
4
4
|
position: relative;
|
|
@@ -9,11 +9,11 @@ import {a,w,x,u,c,l,z,Ra,_a as _a$1,na as na$1,Na as Na$1,sa,tb,nb,y,ob,G,kb,H,p
|
|
|
9
9
|
& > header {
|
|
10
10
|
grid-area: header;
|
|
11
11
|
}
|
|
12
|
-
`;var
|
|
12
|
+
`;var Kl=a(({children:e,className:r})=>jsx(_n,{className:r,children:e}),"PageContent"),_n=styled.main`
|
|
13
13
|
grid-area: content;
|
|
14
14
|
min-width: 0;
|
|
15
15
|
background: ${({theme:e})=>e.colors.backgroundBase};
|
|
16
|
-
`;var
|
|
16
|
+
`;var nc=a(({children:e,className:r,top:o=0})=>jsx(On,{className:r,$top:o,onClick:a=>a.stopPropagation(),children:e}),"SubNav"),On=styled.div(({theme:e,$top:r})=>`
|
|
17
17
|
display: flex;
|
|
18
18
|
flex-direction: column;
|
|
19
19
|
justify-content: space-between;
|
|
@@ -24,46 +24,46 @@ import {a,w,x,u,c,l,z,Ra,_a as _a$1,na as na$1,Na as Na$1,sa,tb,nb,y,ob,G,kb,H,p
|
|
|
24
24
|
grid-area: sub-nav;
|
|
25
25
|
min-width: 0;
|
|
26
26
|
background: ${e.colors.background};
|
|
27
|
-
max-height: calc(100dvh - ${
|
|
27
|
+
max-height: calc(100dvh - ${r}px);
|
|
28
28
|
height: 100%;
|
|
29
29
|
z-index: 1001;
|
|
30
|
-
top: ${
|
|
30
|
+
top: ${r}px;
|
|
31
31
|
overflow: auto;
|
|
32
32
|
@media (min-width: ${e.breakpoints.xl}px){
|
|
33
33
|
position: sticky;
|
|
34
34
|
border-right: 1px solid ${e.colors.stroke.light};
|
|
35
35
|
}
|
|
36
|
-
`);var
|
|
36
|
+
`);var hc=w(({maxWidth:e,...r})=>jsx(Wn,{...r,$maxWidth:e})),Wn=x(styled.div(({theme:e,$maxWidth:r,px:o=20})=>`
|
|
37
37
|
${u(e,"padding-inline",o)}
|
|
38
38
|
width: 100%;
|
|
39
39
|
min-width: 0;
|
|
40
|
-
max-width: ${typeof
|
|
41
|
-
`),{ignoreStyles:["padding-inline"]});var
|
|
40
|
+
max-width: ${typeof r=="number"?c(r,e.baseSize):r||"100%"};
|
|
41
|
+
`),{ignoreStyles:["padding-inline"]});var qn=20,Yn="splitter_columns_widths",zr=a((e,r,o)=>{let a=localStorage.getItem(e);if(a)try{let s=JSON.parse(a);if(Array.isArray(s)&&s.length===r)return s}catch{}else if(o.length===r)return o;return Array(r).fill(100/r)},"getSavedWidths"),yc=a(({columns:e,initialWidths:r,layoutClassname:o="",splitterClassname:a="",minWidth:s=qn,storageKey:i=Yn})=>{let[l,f]=useState(()=>zr(i,e.length,r)),m=useRef(null),S=useRef(null),D=useRef(s),b=useRef(l),E=useCallback(v=>{if(S.current===null||!m.current)return;let P=m.current.getBoundingClientRect(),k=P.width,Q=v-P.left,U=[...b.current],H=S.current,$=H+1,ae=U.slice(0,H).reduce((ke,ue)=>ke+ue,0),pe=Q/k*100-ae,ge=U[H]+U[$]-pe;pe>=D.current&&ge>=D.current&&(U[H]=pe,U[$]=ge,f(U),b.current=U);},[]),z=useCallback(v=>E(v.clientX),[E]),n=useCallback(v=>{v.preventDefault(),E(v.touches[0].clientX);},[E]),L=useCallback(()=>{S.current=null,localStorage.setItem(i,JSON.stringify(b.current)),document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",n),document.removeEventListener("touchend",L);},[z,n,i]),M=useCallback(v=>P=>{P.preventDefault(),S.current=v,document.addEventListener("mousemove",z,{passive:false}),document.addEventListener("mouseup",L);},[z,L]),C=useCallback(v=>P=>{P.preventDefault(),S.current=v,document.addEventListener("touchmove",n,{passive:false}),document.addEventListener("touchend",L);},[n,L]);return useEffect(()=>{let v=zr(i,e.length,r);b.current=v,f(v);},[e.length,r,i]),jsx("div",{ref:m,className:`flex select-none ${o}`,children:e.map(({content:v,className:P},k)=>jsxs(Fragment,{children:[jsx("div",{className:P,style:{flex:`${l[k]} 1 0%`},children:v}),k<e.length-1&&jsx("div",{onMouseDown:M(k),onTouchStart:C(k),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"})]})})})]},`${k}`))})},"SplitterLayout");var Kn=Gn.div`
|
|
42
42
|
width: 100%;
|
|
43
43
|
height: 100%;
|
|
44
44
|
display: flex;
|
|
45
45
|
align-items: center;
|
|
46
46
|
justify-content: center;
|
|
47
|
-
`,Gn=a(({width:e=280,height:n=280})=>{let o=useTheme();return jsx(Zn,{children:jsxs(Un,{foregroundColor:o.contentLoader.foreground,backgroundColor:o.contentLoader.background,width:e,height:n,viewBox:"0 0 280 280",children:[jsx("path",{d:"m55 38-0.97266 0.22852 7.0801 30.092-18.355-20.979-0.75195 0.6582 19.596 22.395 0.43164 1.834 0.97266-0.22852 0.75195-0.6582-0.37695-0.42969 9.625-27.912-0.94531-0.32617-9.4375 27.371-0.10547-0.12109zm8 34-0.78516 0.61914 0.0957 0.12305-12.311 13.258 0.73242 0.67969 12.205-13.145 14.277 18.084 0.78516-0.61914-14.373-18.207 0.10547-0.11328zm15 19-0.48438 0.875 46.992 25.996 8e-3 4e-3 20.506 11.592-28.182 4.5449 0.15998 0.98819 29.418-4.7441 0.25 0.14062-12.555 24.143 0.88672 0.46094 13-25 15 25 26 30v18l-11 18 0.85352 0.52148 9.8008-16.039-4.6543 33.518 0.99023 0.13867 4.7793-34.408 7.2305 16.27 0.91406-0.40625-7.9141-17.807v-17.104l18 12.316 0.56445-0.82617-18.896-12.928-25.855-29.836-14.633-24.387 0.01562-0.02344h23.805v-1h-23.152l13.848-21.234 55.201-28.791-0.45898-0.88476 0.77734 0.62305 11.402-14.25 16.668-11.842-0.58008-0.81641-16.785 11.928-11.486 14.355-55.434 28.912-14.277 21.893-7.7617-27.166-0.96094 0.27344 7.7227 27.031-1.1191 0.17969-21.604-12.211zm140.43-12.912-6.957-17.338-0.92773 0.37305 6.957 17.338zm-6.957-17.338 0.72266 0.69336 16.232-16.896-0.7207-0.69336zm-3.4766 137.25 5 15 0.94922-0.31641-5-15zm-91-63-0.48047-0.87695-31 17 0.48047 0.87695zm-31 17 5 18 0.96289-0.26758-5-18zm0 0-0.70703-0.70703-12.898 12.898-17.881 9.9336 0.48633 0.875 18-10zm5 18-0.64062-0.76758-18 15 0.64062 0.76758z"}),jsx("circle",{cx:"229.92",cy:"63.7318",r:"5",transform:"rotate(173.661 229.92 63.7318)"}),jsx("circle",{cx:"227.711",cy:"43.8541",r:"5",transform:"rotate(173.661 227.711 43.8541)"}),jsx("circle",{cx:"211.478",cy:"60.7499",r:"5",transform:"rotate(173.661 211.478 60.7499)"}),jsx("circle",{cx:"218.434",cy:"78.0877",r:"5",transform:"rotate(173.661 218.434 78.0877)"}),jsx("circle",{cx:"246.705",cy:"51.8054",r:"5",transform:"rotate(173.661 246.705 51.8054)"}),jsx("circle",{cx:"42",cy:"48",r:"5"}),jsx("circle",{cx:"55",cy:"38",r:"5"}),jsx("circle",{cx:"73",cy:"43",r:"5"}),jsx("circle",{cx:"63",cy:"72",r:"5"}),jsx("circle",{cx:"50",cy:"86",r:"5"}),jsx("circle",{cx:"78",cy:"91",r:"5"}),jsx("circle",{cx:"73",cy:"165",r:"5"}),jsx("circle",{cx:"73",cy:"185",r:"5"}),jsx("circle",{cx:"91",cy:"170",r:"5"}),jsx("circle",{cx:"86",cy:"152",r:"5"}),jsx("circle",{cx:"148",cy:"130",r:"5"}),jsx("circle",{cx:"189",cy:"185",r:"5"}),jsx("circle",{cx:"163",cy:"107",r:"5"}),jsx("circle",{cx:"140",cy:"102",r:"5"}),jsx("circle",{cx:"117",cy:"135",r:"5"}),jsx("circle",{cx:"125",cy:"117",r:"5"}),jsx("circle",{cx:"208",cy:"198",r:"5"}),jsx("circle",{cx:"189",cy:"203",r:"5"}),jsx("circle",{cx:"198",cy:"221",r:"5"}),jsx("circle",{cx:"178",cy:"221",r:"5"}),jsx("circle",{cx:"184",cy:"239",r:"5"}),jsx("circle",{cx:"213",cy:"213",r:"5"}),jsx("circle",{cx:"173",cy:"130",r:"5"}),jsx("circle",{cx:"163",cy:"155",r:"5"}),jsx("circle",{cx:"135",cy:"155",r:"5"}),jsx("circle",{cx:"55",cy:"175",r:"5"})]})})},"GraphLoader"),jr=Gn;var zt=typeof window<"u"&&window.devicePixelRatio||1;function ho(e){return !e||e.length===0?[]:e.map(n=>{let o=new Image;o.src=n.img;let a=new Image;return a.src=n.hoverImg,{...n,normalImg:o,hoverImg:a}})}a(ho,"prepareButtonImages");var se={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},go=forwardRef(({loading:e,width:n,height:o,graphData:a$1,buttons:s=[],onNodeClick:i,onBackgroundClick:c,onNodeHover:p,onLinkHover:v,onLinkClick:S},P)=>{let h=useTheme(),[T,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:n*zt,height:o*zt,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:L,links:y}=useMemo(()=>ro(a$1),[a$1]),[M,w]=useState([]),C=useRef(null),D=useRef(null),K=useRef(null),U=scaleOrdinal(schemeCategory10),W=useCallback(()=>{if(!C.current)return false;try{let t=C.current.getContext("2d");return t?(K.current=t,!0):(console.error("Failed to get 2D context"),!1)}catch(t){return console.error("Error initializing Canvas 2D context:",t),false}},[]),V=useCallback(()=>D.current?D.current.nodes():null,[]),ae=useCallback(()=>{if(!D.current)return null;let t=D.current.force("link");return t?t.links():null},[]),pe=useCallback(t=>{t.save(),t.setTransform(1,0,0,1,0,0);let{width:d,height:u}=r.current,f=se.gridSpacing,g=se.dotSize;t.fillStyle=h.graph2D.grid.dotColor;for(let x=f/2;x<=d;x+=f)for(let b=f/2;b<=u;b+=f)t.beginPath(),t.arc(x,b,g,0,2*Math.PI),t.fill();t.restore();},[h.graph2D.grid.dotColor,se.gridSpacing,se.dotSize]),fe=useCallback((t,d,u)=>{if(!t)return "";if(u.measureText(t).width<=d)return t;let g=t,x="...";for(;u.measureText(g+x).width>d&&g.length>0;)g=g.slice(0,-1);return g+x},[]),ke=a(t=>{let u=Math.min(t,se.maxZoom)/se.maxZoom;return Math.max(se.fontSize*u,se.fontSize)},"calculateFontSize"),ce=useCallback(t=>{let d=ae(),u=V();!d||d.length===0||!u||u.length===0||(t.lineWidth=.5,t.globalAlpha=1,d.forEach(f=>{let g=typeof f.source=="object"?f.source:u.find(Se=>Se.id===f.source),x=typeof f.target=="object"?f.target:u.find(Se=>Se.id===f.target);if(!g||!x)return;let b={x:g.x||0,y:g.y||0},m={x:x.x||0,y:x.y||0},E=m.x-b.x,R=m.y-b.y,_=Math.sqrt(E*E+R*R),J=E/_,X=R/_,ie=se.nodeSizeBase/2,te=se.nodeSizeBase/2,oe=4,N={x:b.x+J*ie,y:b.y+X*ie},$={x:m.x-J*(te+oe),y:m.y-X*(te+oe)},O={x:m.x-J*(te+1),y:m.y-X*(te+1)},le=r.current.highlightLinks.has(f),k=le?h.graph2D.link.highlighted:h.graph2D.link.normal,I=le?1.5:.5,H=b.x+(m.x-b.x)/2,q=b.y+(m.y-b.y)/2,Y=Math.atan2(R,E);if(f.label){let Se=r.current.transform.k,Pe=ke(Se);t.font=`${Pe}px Sans-Serif`;let Fe=t.measureText(f.label).width,Ve=10;t.beginPath(),t.moveTo(N.x,N.y);let rt=_/2-(Fe+Ve)/2,nt={x:b.x+J*rt,y:b.y+X*rt};t.lineTo(nt.x,nt.y),t.strokeStyle=k,t.lineWidth=I,t.stroke(),t.beginPath();let Qe=_/2+(Fe+Ve)/2,pt={x:b.x+J*Qe,y:b.y+X*Qe};t.moveTo(pt.x,pt.y),t.lineTo($.x,$.y),t.strokeStyle=k,t.lineWidth=I,t.stroke();}else t.beginPath(),t.moveTo(N.x,N.y),t.lineTo($.x,$.y),t.strokeStyle=k,t.lineWidth=I,t.stroke();let ge=2;if(t.save(),t.translate(O.x,O.y),t.rotate(Y),t.beginPath(),t.moveTo(0,0),t.lineTo(-oe,ge),t.lineTo(-oe,0),t.lineTo(-oe,-ge),t.closePath(),t.fillStyle=k,t.fill(),t.restore(),f.label){let Se=r.current.transform.k,Pe=ke(Se);t.font=`${Pe}px Sans-Serif`,t.textAlign="center",t.textBaseline="middle",t.save(),t.translate(H,q),Math.abs(Y)>Math.PI/2?t.rotate(Y+Math.PI):t.rotate(Y),t.fillStyle=le?h.graph2D.link.highlightedTextColor:h.graph2D.link.textColor,t.fillText(f.label,0,0),t.restore();}}));},[se,h.graph2D.link]),z=a((t,d,u,f,g,x,b)=>{try{if(x!=null){let m=g*.8;t.font=`${m}px sans-serif`,t.textBaseline="middle",t.textAlign="left";let E=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(x),R=t.measureText(E).width,_=g*.3,X=(g+_+R)/2;t.drawImage(d,u-X,f-g/2,g,g),t.fillStyle=b||"#99989C",t.fillText(E,u-X+g+_,f);}else t.drawImage(d,u-g/2,f-g/2,g,g);}catch(m){console.warn("Error rendering icon:",m);}},"drawIconWithOptionalCounter"),F=useCallback((t,d)=>{if(!M||M.length===0||!t||!t.x||!t.y)return;let{x:u,y:f}=t,g=se.nodeSizeBase*se.nodeAreaFactor/2;d.save();let x=Math.min(M.length,8),b=Math.min(Math.PI*2/x,Math.PI);for(let m=0;m<x;m++){let E=m*b,R=(m+1)*b,_=r.current.hoveredButtonIndex===m;d.beginPath(),d.arc(u,f,g,E,R,false),d.lineTo(u,f),d.closePath(),d.lineWidth=1,d.strokeStyle=h.graph2D?.button?.stroke||"#FFFFFF",d.stroke(),d.fillStyle=_?h.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":h.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",d.fill();let J=g*.2,X=(E+R)/2,ie=g-se.nodeSizeBase/2+J,te=u+Math.cos(X)*ie,oe=f+Math.sin(X)*ie,N=M[m];if(N.loading){let $=J/2,O=J/12;d.save(),d.translate(te,oe),d.rotate(r.current.spinnerAngle);for(let le=0;le<12;le++){let k=Math.PI*2*le/12,I=le/12,H=Math.cos(k)*$,q=Math.sin(k)*$;d.beginPath(),d.fillStyle=l(h.graph2D?.button?.spinnerColor,I),d.arc(H,q,O,0,Math.PI*2),d.fill();}d.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(j),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 $=_?N.hoverImg:N.normalImg,O=N.getCount?N.getCount(t):null;$.complete?z(d,$,te,oe,J,O,h.graph2D?.button?.textColor):$.onload=()=>{K.current&&z(d,$,te,oe,J,O,h.graph2D?.button?.textColor);};}}d.restore();},[M,h.graph2D?.button]),de=useCallback(t=>{let d=V();!d||d.length===0||(t.globalAlpha=1,d.forEach(u=>{let{x:f,y:g,color:x,fontColor:b,label:m}=u,E=r.current.highlightNodes.has(u)||u===r.current.hoveredNode||u===r.current.draggedNode,R=u===r.current.selectedNode,_=se.nodeSizeBase,J=se.nodeSizeBase/2;if(E&&!R){let X=se.nodeSizeBase*se.nodeAreaFactor*.75/2;t.beginPath(),t.arc(f,g,X,0,2*Math.PI,false),t.fillStyle=h.graph2D.ring.highlightFill,t.fill();}if(R)if(s&&s.length>0)F(u,t);else {let X=se.nodeSizeBase*se.nodeAreaFactor/2;t.beginPath(),t.arc(f,g,X,0,2*Math.PI,false),t.fillStyle=h.graph2D.ring.selectionFill||h.graph2D.ring.highlightFill,t.fill();}if(t.beginPath(),t.arc(f,g,J,0,2*Math.PI),t.fillStyle=x||U(u.group||"0"),t.fill(),m){t.save(),t.translate(f,g);let X=r.current.transform.k,ie=ke(X),te=_*se.textPaddingFactor;t.font=`${ie}px Sans-Serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle=b||"#000";let oe=fe(m,te,t);t.fillText(oe,0,0),t.restore();}}));},[h.graph2D.ring,s,F]),j=useCallback(()=>{let t=K.current;t&&(t.clearRect(0,0,r.current.width,r.current.height),pe(t),t.save(),t.setTransform(r.current.transform.k,0,0,r.current.transform.k,r.current.transform.x,r.current.transform.y),ce(t),de(t),t.restore());},[ce,de,pe]),G=useCallback((t,d=[],u)=>{let f=ae()||[],g=V()||[];if(!D.current||!t.length)return;let{width:x,height:b}=r.current,m=u?.smoothAppearance??false,E=u?.transitionDuration??1e3,R=new Set(g.map(N=>N.id)),_=t.filter(N=>!R.has(N.id)),J=new Set(f.map(N=>`${typeof N.source=="object"?N.source.id:N.source}-${typeof N.target=="object"?N.target.id:N.target}`)),X=d.filter(N=>{let $=`${typeof N.source=="object"?N.source.id:N.source}-${typeof N.target=="object"?N.target.id:N.target}`;return !J.has($)});if(_.length===0&&X.length===0)return;let ie=[...g,..._],te=[...f,...X];m&&(_.forEach(N=>{let $=X.filter(O=>{let le=typeof O.source=="object"?O.source.id:O.source,k=typeof O.target=="object"?O.target.id:O.target;return le===N.id&&R.has(k)||k===N.id&&R.has(le)});if($.length>0){let O=$[0],le=typeof O.source=="object"?O.source.id===N.id?O.target:O.source.id:O.source===N.id?O.target:O.source,k=ie.find(I=>I.id===le);if(k&&k.x!==void 0&&k.y!==void 0){let I=30+Math.random()*20,H=Math.random()*Math.PI*2;N.x=k.x+Math.cos(H)*I,N.y=k.y+Math.sin(H)*I,N.vx=0,N.vy=0;}}else {let O=x/2,le=b/2,k=Math.min(x,b)/4,I=Math.random()*Math.PI*2;N.x=O+Math.cos(I)*(k*Math.random()),N.y=le+Math.sin(I)*(k*Math.random()),N.vx=0,N.vy=0;}}),g.forEach(N=>{N.fx=N.x,N.fy=N.y;})),D.current.nodes(ie);let oe=D.current.force("link");oe&&oe.links(te),X.forEach(N=>{let $=typeof N.source=="object"?N.source:ie.find(le=>le.id===N.source),O=typeof N.target=="object"?N.target:ie.find(le=>le.id===N.target);!$||!O||(!$.neighbors&&($.neighbors=[]),!O.neighbors&&(O.neighbors=[]),$.neighbors.push(O),O.neighbors.push($),!$.links&&($.links=[]),!O.links&&(O.links=[]),$.links.push(N),O.links.push(N));}),m?(D.current.alphaTarget(.3),D.current.alpha(.3),D.current.velocityDecay(.7),D.current.restart(),setTimeout(()=>{g.forEach(N=>{N.fx=void 0,N.fy=void 0;}),D.current?.alphaTarget(0),D.current?.alpha(.1),D.current?.velocityDecay(.6);},E)):D.current.alpha(.1).restart(),j();},[L,j]),re=useCallback(t=>{let d=V(),u=ae();if(!D.current||!t.length||!d||d.length===0||!u||u.length===0)return;let f=new Set(t);if(r.current.selectedNode&&r.current.selectedNode.id!==void 0&&f.has(r.current.selectedNode.id)&&(r.current.selectedNode=null),r.current.hoveredNode&&r.current.hoveredNode.id!==void 0&&f.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,E=typeof r.current.hoveredLink.target=="object"?r.current.hoveredLink.target.id:r.current.hoveredLink.target;(m!==void 0&&f.has(m)||E!==void 0&&f.has(E))&&(r.current.hoveredLink=null,r.current.highlightNodes=new Set,r.current.highlightLinks=new Set);}r.current.draggedNode&&r.current.draggedNode.id!==void 0&&f.has(r.current.draggedNode.id)&&(r.current.draggedNode=null);let g=d.filter(m=>m.id!==void 0&&!f.has(m.id)),x=u.filter(m=>{let E=typeof m.source=="object"?m.source.id:m.source,R=typeof m.target=="object"?m.target.id:m.target;return E!==void 0&&!f.has(E)&&R!==void 0&&!f.has(R)});g.forEach(m=>{m.neighbors=[],m.links=[];}),x.forEach(m=>{let E=typeof m.source=="object"?m.source:g.find(_=>_.id===m.source),R=typeof m.target=="object"?m.target:g.find(_=>_.id===m.target);!E||!R||(E.neighbors=E.neighbors||[],R.neighbors=R.neighbors||[],E.neighbors.push(R),R.neighbors.push(E),E.links=E.links||[],R.links=R.links||[],E.links.push(m),R.links.push(m));}),D.current.nodes(g);let b=D.current.force("link");b&&b.links(x),j();},[j]),Q=useCallback((t=0,d=20)=>{let u=V();if(!K.current||!C.current||!u||!u.length)return;let g=1/0,x=1/0,b=-1/0,m=-1/0;if(u.forEach(E=>{if(E.x===void 0||E.y===void 0)return;let R=E.x,_=E.y;g=Math.min(g,R),x=Math.min(x,_),b=Math.max(b,R),m=Math.max(m,_);}),isFinite(g)&&isFinite(b)&&isFinite(x)&&isFinite(m)){let{width:E,height:R}=r.current;g-=d,x-=d,b+=d,m+=d;let _=b-g,J=m-x,X=_>0?E/_:1,ie=J>0?R/J:1,te=Math.min(X,ie,10),oe=g+_/2,N=x+J/2,$={k:te,x:E/2-oe*te,y:R/2-N*te};if(t>0){let O={...r.current.transform},le=Date.now(),k=a(()=>{let I=Math.min(1,(Date.now()-le)/t),H=I===1?1:1-Math.pow(1-I,3),q={k:O.k+($.k-O.k)*H,x:O.x+($.x-O.x)*H,y:O.y+($.y-O.y)*H};r.current.transform=q,j(),I<1&&requestAnimationFrame(k);},"animateZoom");requestAnimationFrame(k);}else r.current.transform=$,j();}},[]),he=useCallback((t,d)=>{let u=V();if(!u||u.length===0)return null;let f=se.nodeSizeBase/2,g=typeof window<"u"&&window.devicePixelRatio||1,x=(t*g-r.current.transform.x)/r.current.transform.k,b=(d*g-r.current.transform.y)/r.current.transform.k;return u.find(m=>{let E=(m.x||0)-x,R=(m.y||0)-b;return Math.sqrt(E*E+R*R)<=f})||null},[]),ue=useCallback((t,d)=>{let u=ae(),f=V();if(!u||u.length===0||!f||f.length===0)return null;let g=typeof window<"u"&&window.devicePixelRatio||1,x=(t*g-r.current.transform.x)/r.current.transform.k,b=(d*g-r.current.transform.y)/r.current.transform.k,m=5;return u.find(E=>{let R=typeof E.source=="object"?E.source:f.find(Pe=>Pe.id===E.source),_=typeof E.target=="object"?E.target:f.find(Pe=>Pe.id===E.target);if(!R||!_)return false;let J=R.x||0,X=R.y||0,ie=_.x||0,te=_.y||0,oe=x-J,N=b-X,$=ie-J,O=te-X,le=oe*$+N*O,k=$*$+O*O;if(k===0)return false;let I=le/k;I=Math.max(0,Math.min(1,I));let H=J+I*$,q=X+I*O,Y=x-H,ge=b-q;return Math.sqrt(Y*Y+ge*ge)<=m})||null},[]),ee=useCallback((t,d,u,f,g,x,b)=>{let m=t-u,E=d-f,R=Math.sqrt(m*m+E*E),_=Math.atan2(E,m);_<0&&(_+=2*Math.PI);let ie=R>=g*.5&&R<=g*1,te=false;return x===Math.PI&&b===Math.PI*2?te=_>=Math.PI&&_<=Math.PI*2:x===0&&b===Math.PI?te=_>=0&&_<=Math.PI:te=x<=b&&_>=x&&_<=b||x>b&&(_>=x||_<=b),ie&&te},[]),B=useCallback(t=>{if(t===r.current.hoveredNode)return;let d=new Set,u=new Set;t&&(d.add(t),t.neighbors&&t.neighbors.forEach(f=>d.add(f)),t.links&&t.links.forEach(f=>u.add(f))),r.current.hoveredNode=t,p&&p(t),r.current.highlightNodes=d,r.current.highlightLinks=u;},[p]),be=useCallback(t=>{if(t===r.current.hoveredLink)return;let d=new Set,u=new Set;if(t){u.add(t);let f=V();if(f){let g=typeof t.source=="object"?t.source:f.find(b=>b.id===t.source),x=typeof t.target=="object"?t.target:f.find(b=>b.id===t.target);g&&d.add(g),x&&d.add(x);}}r.current.hoveredLink=t,v&&v(t),r.current.highlightNodes=d,r.current.highlightLinks=u;},[v,V]),Te=useCallback(t=>{S&&S(t);},[S]),Le=useCallback(t=>{r.current.selectedNode=t,i&&i(t);},[i]),Re=useCallback(()=>{r.current.selectedNode=null,c&&c();},[c]),ze=useCallback(t=>{if(!C.current||!D.current)return;let d=C.current.getBoundingClientRect(),u=t.clientX-d.left,f=t.clientY-d.top;r.current.mouseStartPos={x:u,y:f},r.current.isDragging=false;let g=he(u,f);g?(r.current.draggedNode=g,g.fx=g.x,g.fy=g.y):(r.current.isPanning=true,r.current.lastMousePos={x:u,y:f});},[he]),Ce=useCallback((t,d)=>{let u=null;if(C.current&&r.current&&M.length>0){let f=se.nodeSizeBase*se.nodeAreaFactor/2,g=C.current.getBoundingClientRect(),x=C.current.width/g.width,b=C.current.height/g.height,m=t*x,E=d*b,R=(m-r.current.transform.x)/r.current.transform.k,_=(E-r.current.transform.y)/r.current.transform.k,J=r.current.selectedNode?.x||0,X=r.current.selectedNode?.y||0,ie=Math.min(M.length,8),te=Math.min(Math.PI*2/ie,Math.PI);for(let oe=0;oe<ie;oe++){let N=oe*te,$=(oe+1)*te;if(ee(R,_,J,X,f,N,$)){u=oe;break}}}return u},[M]),ve=useCallback(t=>{if(!C.current)return;let d=C.current.getBoundingClientRect(),u=t.clientX-d.left,f=t.clientY-d.top;if(r.current.draggedNode&&r.current.mouseStartPos&&D.current){let b=r.current.mouseStartPos.x,m=r.current.mouseStartPos.y,E=u-b,R=f-m;Math.sqrt(E*E+R*R)>3&&(r.current.isDragging=true,D.current.alphaTarget()===0&&D.current.alphaTarget(0).restart());let X=typeof window<"u"&&window.devicePixelRatio||1,ie=(u*X-r.current.transform.x)/r.current.transform.k,te=(f*X-r.current.transform.y)/r.current.transform.k;r.current.draggedNode.fx=ie,r.current.draggedNode.fy=te;return}if(r.current.isPanning&&r.current.mouseStartPos){let b=u-r.current.lastMousePos.x,m=f-r.current.lastMousePos.y,E=r.current.mouseStartPos.x,R=r.current.mouseStartPos.y;Math.sqrt(Math.pow(u-E,2)+Math.pow(f-R,2))>3&&(r.current.isDragging=true),r.current.transform={...r.current.transform,x:r.current.transform.x+b,y:r.current.transform.y+m},r.current.lastMousePos={x:u,y:f},j();return}let g,x;if(r.current.selectedNode&&C.current&&M.length>0){let b=Ce(u,f);b!==null&&(x=r.current.selectedNode),b!==r.current.hoveredButtonIndex&&(g=true),r.current.hoveredButtonIndex=b;}else r.current.hoveredButtonIndex!==null&&(r.current.hoveredButtonIndex=null);if(!x&&(x=he(u,f),!x)){let b=ue(u,f),m=b!==r.current.hoveredLink;if(b&&r.current.hoveredNode&&B(null),be(b),C.current&&(C.current.style.cursor=b?"pointer":"default"),m){j();return}}x&&r.current.hoveredLink&&be(null),x!==r.current.hoveredNode&&(g=true),B(x),C.current&&(C.current.style.cursor=x?"pointer":"default"),g&&j();},[M,he,ue,B,be,j,ee,Ce]),we=useCallback(t=>{r.current.mustBeStoppedPropagation&&(t.stopPropagation(),t.preventDefault()),r.current.mustBeStoppedPropagation=false;},[]),me=useCallback(t=>{let d=r.current.isDragging;if(d&&(r.current.mustBeStoppedPropagation=true),!d&&r.current.mouseStartPos){let u=C.current?.getBoundingClientRect();if(u){let f=t.clientX-u.left,g=t.clientY-u.top;M.length>0&&r.current.hoveredButtonIndex===null&&(r.current.hoveredButtonIndex=Ce(f,g));let x=false;if(r.current.selectedNode&&r.current.hoveredButtonIndex!==null&&s[r.current.hoveredButtonIndex]){let b=s[r.current.hoveredButtonIndex];b&&b.onClick&&(b.onClick(r.current.selectedNode),x=true,r.current.hoveredButtonIndex=null);}if(!x&&r.current.draggedNode)Le(r.current.draggedNode);else if(!x&&!r.current.draggedNode){let b=ue(f,g);b?Te(b):Re();}}}if(r.current.draggedNode&&D.current){if(d){D.current.alphaTarget(0);let u=.05,f=.04,g=.6;D.current.alpha(u).alphaDecay(f),D.current.velocityDecay(g);}else D.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),j();},[s,j,Le,Re,ue,Te,Ce,M]),We=useCallback(t=>{if(t.stopPropagation(),t.preventDefault(),!C.current)return;let d=C.current.getBoundingClientRect(),u=t.clientX-d.left,f=t.clientY-d.top,x=-t.deltaY>0?1.1:1/1.1,b=r.current.transform,m=b.k*x;if(m<.01||m>10)return;let E=b.k*x,R=u-(u-b.x)*x,_=f-(f-b.y)*x;r.current.transform={k:E,x:R,y:_},j();},[j]),$e=a((t,d)=>{let u=t.touches[0];if(u){let f={clientX:u.clientX,clientY:u.clientY};d(f);}},"convertTouchToMouseEvent"),vt=useCallback(t=>{$e(t,ze);},[ze]),Ne=useCallback(t=>{r.current.mustBeStoppedPropagation&&(t.preventDefault(),t.stopPropagation()),r.current.mustBeStoppedPropagation=false,$e(t,me);},[me]),De=useCallback(t=>{$e(t,ve);},[ve]);return useImperativeHandle(P,()=>({zoomToFit:Q,addNodes:G,removeNodes:re}),[Q,G,re]),useEffect(()=>{let t=C.current,{width:d,height:u}=r.current;if(!t)return;W(),A(true);let f=d/2,g=u/2,x=se.nodeSizeBase,b=x/2,m=x*2.5;D.current&&D.current.stop();let E=D.current=forceSimulation(L).force("link",forceLink(y).id(R=>R.id).distance(m).strength(.9)).force("charge",forceManyBody().strength(-x/10*200).theta(.5).distanceMin(x*2)).force("x",forceX().strength(.03)).force("y",forceY().strength(.03)).force("center",forceCenter(f,g).strength(.05)).force("collide",forceCollide().radius(b*2).iterations(2).strength(1)).velocityDecay(.6);return ()=>{E.stop();}},[L,y]),useLayoutEffect(()=>{let t=C.current;t&&(r.current.width=n*zt,r.current.height=o*zt,t.width=r.current.width,t.height=r.current.height);},[n,o]),useEffect(()=>{if(D.current){let t=D.current;t.on("tick",()=>{j();}),t.on("end",()=>{T&&(Q(0,20),setTimeout(()=>{A(false);},200));});}T||j();},[L,y,T,j,Q]),useEffect(()=>{!L||!y||y.forEach(t=>{let d=typeof t.source=="object"?t.source:L.find(f=>f.id===t.source),u=typeof t.target=="object"?t.target:L.find(f=>f.id===t.target);!d||!u||(!d.neighbors&&(d.neighbors=[]),!u.neighbors&&(u.neighbors=[]),d.neighbors.push(u),u.neighbors.push(d),!d.links&&(d.links=[]),!u.links&&(u.links=[]),d.links.push(t),u.links.push(t));});},[L,y]),useEffect(()=>{s&&s.length>0&&w(ho(s));},[s]),useEffect(()=>{let t=C.current;if(!(!t||typeof window>"u"))return t.addEventListener("wheel",We,{passive:false}),t.addEventListener("touchend",Ne,{passive:false}),()=>{t.removeEventListener("wheel",We),t.removeEventListener("touchend",Ne);}},[We,Ne]),jsxs(mo,{children:[(e||T)&&jsx(jr,{width:n,height:o}),jsx(bo,{ref:C,style:{width:n,height:o,display:e||T?"none":"block"},onMouseDown:ze,onMouseMove:ve,onMouseUp:me,onMouseLeave:me,onClick:we,onTouchStart:vt,onTouchMove:De})]})}),mo=styled.div`
|
|
47
|
+
`,Qn=a(({width:e=280,height:r=280})=>{let o=useTheme();return jsx(Kn,{children:jsxs(Zn,{foregroundColor:o.contentLoader.foreground,backgroundColor:o.contentLoader.background,width:e,height:r,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"),jr=Qn;var zt=typeof window<"u"&&window.devicePixelRatio||1;function bo(e){return !e||e.length===0?[]:e.map(r=>{let o=new Image;o.src=r.img;let a=new Image;return a.src=r.hoverImg,{...r,normalImg:o,hoverImg:a}})}a(bo,"prepareButtonImages");var ce={fontSize:3,nodeSizeBase:30,nodeAreaFactor:2,textPaddingFactor:.9,gridSpacing:20,dotSize:1,maxZoom:4},vo=forwardRef(({loading:e,width:r,height:o,graphData:a$1,buttons:s=[],onNodeClick:i,onBackgroundClick:l$1,onNodeHover:f,onLinkHover:m,onLinkClick:S},D)=>{let b=useTheme(),[E,z]=useState(true),n=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:r*zt,height:o*zt,animation:{id:null,buttonIndex:null},spinnerAngle:0}),{nodes:L,links:M}=useMemo(()=>ao(a$1),[a$1]),[C,v]=useState([]),P=useRef(null),k=useRef(null),Q=useRef(null),U=scaleOrdinal(schemeCategory10),H=useCallback(()=>{if(!P.current)return false;try{let t=P.current.getContext("2d");return t?(Q.current=t,!0):(console.error("Failed to get 2D context"),!1)}catch(t){return console.error("Error initializing Canvas 2D context:",t),false}},[]),$=useCallback(()=>k.current?k.current.nodes():null,[]),ae=useCallback(()=>{if(!k.current)return null;let t=k.current.force("link");return t?t.links():null},[]),pe=useCallback(t=>{t.save(),t.setTransform(1,0,0,1,0,0);let{width:d,height:u}=n.current,p=ce.gridSpacing,h=ce.dotSize;t.fillStyle=b.graph2D.grid.dotColor;for(let y=p/2;y<=d;y+=p)for(let w=p/2;w<=u;w+=p)t.beginPath(),t.arc(y,w,h,0,2*Math.PI),t.fill();t.restore();},[b.graph2D.grid.dotColor,ce.gridSpacing,ce.dotSize]),ge=useCallback((t,d,u)=>{if(!t)return "";if(u.measureText(t).width<=d)return t;let h=t,y="...";for(;u.measureText(h+y).width>d&&h.length>0;)h=h.slice(0,-1);return h+y},[]),ke=a(t=>{let u=Math.min(t,ce.maxZoom)/ce.maxZoom;return Math.max(ce.fontSize*u,ce.fontSize)},"calculateFontSize"),ue=useCallback(t=>{let d=ae(),u=$();!d||d.length===0||!u||u.length===0||(t.lineWidth=.5,t.globalAlpha=1,d.forEach(p=>{let h=typeof p.source=="object"?p.source:u.find(Se=>Se.id===p.source),y=typeof p.target=="object"?p.target:u.find(Se=>Se.id===p.target);if(!h||!y)return;let w={x:h.x||0,y:h.y||0},g={x:y.x||0,y:y.y||0},N=g.x-w.x,R=g.y-w.y,j=Math.sqrt(N*N+R*R),K=N/j,X=R/j,le=ce.nodeSizeBase/2,re=ce.nodeSizeBase/2,se=4,T={x:w.x+K*le,y:w.y+X*le},W={x:g.x-K*(re+se),y:g.y-X*(re+se)},F={x:g.x-K*(re+1),y:g.y-X*(re+1)},de=n.current.highlightLinks.has(p),x=de?b.graph2D.link.highlighted:b.graph2D.link.normal,A=de?1.5:.5,B=w.x+(g.x-w.x)/2,q=w.y+(g.y-w.y)/2,Y=Math.atan2(R,N);if(p.label){let Se=n.current.transform.k,Pe=ke(Se);t.font=`${Pe}px Sans-Serif`;let Be=t.measureText(p.label).width,Xe=10;t.beginPath(),t.moveTo(T.x,T.y);let rt=j/2-(Be+Xe)/2,nt={x:w.x+K*rt,y:w.y+X*rt};t.lineTo(nt.x,nt.y),t.strokeStyle=x,t.lineWidth=A,t.stroke(),t.beginPath();let Qe=j/2+(Be+Xe)/2,ft={x:w.x+K*Qe,y:w.y+X*Qe};t.moveTo(ft.x,ft.y),t.lineTo(W.x,W.y),t.strokeStyle=x,t.lineWidth=A,t.stroke();}else t.beginPath(),t.moveTo(T.x,T.y),t.lineTo(W.x,W.y),t.strokeStyle=x,t.lineWidth=A,t.stroke();let be=2;if(t.save(),t.translate(F.x,F.y),t.rotate(Y),t.beginPath(),t.moveTo(0,0),t.lineTo(-se,be),t.lineTo(-se,0),t.lineTo(-se,-be),t.closePath(),t.fillStyle=x,t.fill(),t.restore(),p.label){let Se=n.current.transform.k,Pe=ke(Se);t.font=`${Pe}px Sans-Serif`,t.textAlign="center",t.textBaseline="middle",t.save(),t.translate(B,q),Math.abs(Y)>Math.PI/2?t.rotate(Y+Math.PI):t.rotate(Y),t.fillStyle=de?b.graph2D.link.highlightedTextColor:b.graph2D.link.textColor,t.fillText(p.label,0,0),t.restore();}}));},[ce,b.graph2D.link]),ie=a((t,d,u,p,h,y,w)=>{try{if(y!=null){let g=h*.8;t.font=`${g}px sans-serif`,t.textBaseline="middle",t.textAlign="left";let N=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0,compactDisplay:"short"}).format(y),R=t.measureText(N).width,j=h*.3,X=(h+j+R)/2;t.drawImage(d,u-X,p-h/2,h,h),t.fillStyle=w||"#99989C",t.fillText(N,u-X+h+j,p);}else t.drawImage(d,u-h/2,p-h/2,h,h);}catch(g){console.warn("Error rendering icon:",g);}},"drawIconWithOptionalCounter"),_=useCallback((t,d)=>{if(!C||C.length===0||!t||!t.x||!t.y)return;let{x:u,y:p}=t,h=ce.nodeSizeBase*ce.nodeAreaFactor/2;d.save();let y=Math.min(C.length,8),w=Math.min(Math.PI*2/y,Math.PI);for(let g=0;g<y;g++){let N=g*w,R=(g+1)*w,j=n.current.hoveredButtonIndex===g;d.beginPath(),d.arc(u,p,h,N,R,false),d.lineTo(u,p),d.closePath(),d.lineWidth=1,d.strokeStyle=b.graph2D?.button?.stroke||"#FFFFFF",d.stroke(),d.fillStyle=j?b.graph2D?.button?.hoverFill||"rgba(255, 255, 255, 0.3)":b.graph2D?.button?.normalFill||"rgba(255, 255, 255, 0.1)",d.fill();let K=h*.2,X=(N+R)/2,le=h-ce.nodeSizeBase/2+K,re=u+Math.cos(X)*le,se=p+Math.sin(X)*le,T=C[g];if(T.loading){let W=K/2,F=K/12;d.save(),d.translate(re,se),d.rotate(n.current.spinnerAngle);for(let de=0;de<12;de++){let x=Math.PI*2*de/12,A=de/12,B=Math.cos(x)*W,q=Math.sin(x)*W;d.beginPath(),d.fillStyle=l(b.graph2D?.button?.spinnerColor,A),d.arc(B,q,F,0,Math.PI*2),d.fill();}d.restore(),n.current.spinnerAngle+=.1,n.current.spinnerAngle>Math.PI*2&&(n.current.spinnerAngle-=Math.PI*2),n.current.animation.id!==null&&(cancelAnimationFrame(n.current.animation.id),n.current.animation.id=null,n.current.animation.buttonIndex=null),n.current.animation.id=requestAnimationFrame(I),n.current.animation.buttonIndex=g;}else {n.current.animation.id&&n.current.animation.buttonIndex===g&&(cancelAnimationFrame(n.current.animation.id),n.current.animation.id=null,n.current.animation.buttonIndex=null);let W=j?T.hoverImg:T.normalImg,F=T.getCount?T.getCount(t):null;W.complete?ie(d,W,re,se,K,F,b.graph2D?.button?.textColor):W.onload=()=>{Q.current&&ie(d,W,re,se,K,F,b.graph2D?.button?.textColor);};}}d.restore();},[C,b.graph2D?.button]),G=useCallback(t=>{let d=$();!d||d.length===0||(t.globalAlpha=1,d.forEach(u=>{let{x:p,y:h,color:y,fontColor:w,label:g}=u,N=n.current.highlightNodes.has(u)||u===n.current.hoveredNode||u===n.current.draggedNode,R=u===n.current.selectedNode,j=ce.nodeSizeBase,K=ce.nodeSizeBase/2;if(N&&!R){let X=ce.nodeSizeBase*ce.nodeAreaFactor*.75/2;t.beginPath(),t.arc(p,h,X,0,2*Math.PI,false),t.fillStyle=b.graph2D.ring.highlightFill,t.fill();}if(R)if(s&&s.length>0)_(u,t);else {let X=ce.nodeSizeBase*ce.nodeAreaFactor/2;t.beginPath(),t.arc(p,h,X,0,2*Math.PI,false),t.fillStyle=b.graph2D.ring.selectionFill||b.graph2D.ring.highlightFill,t.fill();}if(t.beginPath(),t.arc(p,h,K,0,2*Math.PI),t.fillStyle=y||U(u.group||"0"),t.fill(),g){t.save(),t.translate(p,h);let X=n.current.transform.k,le=ke(X),re=j*ce.textPaddingFactor;t.font=`${le}px Sans-Serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle=w||"#000";let se=ge(g,re,t);t.fillText(se,0,0),t.restore();}}));},[b.graph2D.ring,s,_]),I=useCallback(()=>{let t=Q.current;t&&(t.clearRect(0,0,n.current.width,n.current.height),pe(t),t.save(),t.setTransform(n.current.transform.k,0,0,n.current.transform.k,n.current.transform.x,n.current.transform.y),ue(t),G(t),t.restore());},[ue,G,pe]),oe=useCallback((t,d=[],u)=>{let p=ae()||[],h=$()||[];if(!k.current||!t.length)return;let{width:y,height:w}=n.current,g=u?.smoothAppearance??false,N=u?.transitionDuration??1e3,R=new Set(h.map(T=>T.id)),j=t.filter(T=>!R.has(T.id)),K=new Set(p.map(T=>`${typeof T.source=="object"?T.source.id:T.source}-${typeof T.target=="object"?T.target.id:T.target}`)),X=d.filter(T=>{let W=`${typeof T.source=="object"?T.source.id:T.source}-${typeof T.target=="object"?T.target.id:T.target}`;return !K.has(W)});if(j.length===0&&X.length===0)return;let le=[...h,...j],re=[...p,...X];g&&(j.forEach(T=>{let W=X.filter(F=>{let de=typeof F.source=="object"?F.source.id:F.source,x=typeof F.target=="object"?F.target.id:F.target;return de===T.id&&R.has(x)||x===T.id&&R.has(de)});if(W.length>0){let F=W[0],de=typeof F.source=="object"?F.source.id===T.id?F.target:F.source.id:F.source===T.id?F.target:F.source,x=le.find(A=>A.id===de);if(x&&x.x!==void 0&&x.y!==void 0){let A=30+Math.random()*20,B=Math.random()*Math.PI*2;T.x=x.x+Math.cos(B)*A,T.y=x.y+Math.sin(B)*A,T.vx=0,T.vy=0;}}else {let F=y/2,de=w/2,x=Math.min(y,w)/4,A=Math.random()*Math.PI*2;T.x=F+Math.cos(A)*(x*Math.random()),T.y=de+Math.sin(A)*(x*Math.random()),T.vx=0,T.vy=0;}}),h.forEach(T=>{T.fx=T.x,T.fy=T.y;})),k.current.nodes(le);let se=k.current.force("link");se&&se.links(re),X.forEach(T=>{let W=typeof T.source=="object"?T.source:le.find(de=>de.id===T.source),F=typeof T.target=="object"?T.target:le.find(de=>de.id===T.target);!W||!F||(!W.neighbors&&(W.neighbors=[]),!F.neighbors&&(F.neighbors=[]),W.neighbors.push(F),F.neighbors.push(W),!W.links&&(W.links=[]),!F.links&&(F.links=[]),W.links.push(T),F.links.push(T));}),g?(k.current.alphaTarget(.3),k.current.alpha(.3),k.current.velocityDecay(.7),k.current.restart(),setTimeout(()=>{h.forEach(T=>{T.fx=void 0,T.fy=void 0;}),k.current?.alphaTarget(0),k.current?.alpha(.1),k.current?.velocityDecay(.6);},N)):k.current.alpha(.1).restart(),I();},[L,I]),V=useCallback(t=>{let d=$(),u=ae();if(!k.current||!t.length||!d||d.length===0||!u||u.length===0)return;let p=new Set(t);if(n.current.selectedNode&&n.current.selectedNode.id!==void 0&&p.has(n.current.selectedNode.id)&&(n.current.selectedNode=null),n.current.hoveredNode&&n.current.hoveredNode.id!==void 0&&p.has(n.current.hoveredNode.id)&&(n.current.hoveredNode=null,n.current.highlightNodes=new Set,n.current.highlightLinks=new Set),n.current.hoveredLink){let g=typeof n.current.hoveredLink.source=="object"?n.current.hoveredLink.source.id:n.current.hoveredLink.source,N=typeof n.current.hoveredLink.target=="object"?n.current.hoveredLink.target.id:n.current.hoveredLink.target;(g!==void 0&&p.has(g)||N!==void 0&&p.has(N))&&(n.current.hoveredLink=null,n.current.highlightNodes=new Set,n.current.highlightLinks=new Set);}n.current.draggedNode&&n.current.draggedNode.id!==void 0&&p.has(n.current.draggedNode.id)&&(n.current.draggedNode=null);let h=d.filter(g=>g.id!==void 0&&!p.has(g.id)),y=u.filter(g=>{let N=typeof g.source=="object"?g.source.id:g.source,R=typeof g.target=="object"?g.target.id:g.target;return N!==void 0&&!p.has(N)&&R!==void 0&&!p.has(R)});h.forEach(g=>{g.neighbors=[],g.links=[];}),y.forEach(g=>{let N=typeof g.source=="object"?g.source:h.find(j=>j.id===g.source),R=typeof g.target=="object"?g.target:h.find(j=>j.id===g.target);!N||!R||(N.neighbors=N.neighbors||[],R.neighbors=R.neighbors||[],N.neighbors.push(R),R.neighbors.push(N),N.links=N.links||[],R.links=R.links||[],N.links.push(g),R.links.push(g));}),k.current.nodes(h);let w=k.current.force("link");w&&w.links(y),I();},[I]),J=useCallback((t=0,d=20)=>{let u=$();if(!Q.current||!P.current||!u||!u.length)return;let h=1/0,y=1/0,w=-1/0,g=-1/0;if(u.forEach(N=>{if(N.x===void 0||N.y===void 0)return;let R=N.x,j=N.y;h=Math.min(h,R),y=Math.min(y,j),w=Math.max(w,R),g=Math.max(g,j);}),isFinite(h)&&isFinite(w)&&isFinite(y)&&isFinite(g)){let{width:N,height:R}=n.current;h-=d,y-=d,w+=d,g+=d;let j=w-h,K=g-y,X=j>0?N/j:1,le=K>0?R/K:1,re=Math.min(X,le,10),se=h+j/2,T=y+K/2,W={k:re,x:N/2-se*re,y:R/2-T*re};if(t>0){let F={...n.current.transform},de=Date.now(),x=a(()=>{let A=Math.min(1,(Date.now()-de)/t),B=A===1?1:1-Math.pow(1-A,3),q={k:F.k+(W.k-F.k)*B,x:F.x+(W.x-F.x)*B,y:F.y+(W.y-F.y)*B};n.current.transform=q,I(),A<1&&requestAnimationFrame(x);},"animateZoom");requestAnimationFrame(x);}else n.current.transform=W,I();}},[]),ee=useCallback((t,d)=>{let u=$();if(!u||u.length===0)return null;let p=ce.nodeSizeBase/2,h=typeof window<"u"&&window.devicePixelRatio||1,y=(t*h-n.current.transform.x)/n.current.transform.k,w=(d*h-n.current.transform.y)/n.current.transform.k;return u.find(g=>{let N=(g.x||0)-y,R=(g.y||0)-w;return Math.sqrt(N*N+R*R)<=p})||null},[]),fe=useCallback((t,d)=>{let u=ae(),p=$();if(!u||u.length===0||!p||p.length===0)return null;let h=typeof window<"u"&&window.devicePixelRatio||1,y=(t*h-n.current.transform.x)/n.current.transform.k,w=(d*h-n.current.transform.y)/n.current.transform.k,g=5;return u.find(N=>{let R=typeof N.source=="object"?N.source:p.find(Pe=>Pe.id===N.source),j=typeof N.target=="object"?N.target:p.find(Pe=>Pe.id===N.target);if(!R||!j)return false;let K=R.x||0,X=R.y||0,le=j.x||0,re=j.y||0,se=y-K,T=w-X,W=le-K,F=re-X,de=se*W+T*F,x=W*W+F*F;if(x===0)return false;let A=de/x;A=Math.max(0,Math.min(1,A));let B=K+A*W,q=X+A*F,Y=y-B,be=w-q;return Math.sqrt(Y*Y+be*be)<=g})||null},[]),te=useCallback((t,d,u,p,h,y,w)=>{let g=t-u,N=d-p,R=Math.sqrt(g*g+N*N),j=Math.atan2(N,g);j<0&&(j+=2*Math.PI);let le=R>=h*.5&&R<=h*1,re=false;return y===Math.PI&&w===Math.PI*2?re=j>=Math.PI&&j<=Math.PI*2:y===0&&w===Math.PI?re=j>=0&&j<=Math.PI:re=y<=w&&j>=y&&j<=w||y>w&&(j>=y||j<=w),le&&re},[]),O=useCallback(t=>{if(t===n.current.hoveredNode)return;let d=new Set,u=new Set;t&&(d.add(t),t.neighbors&&t.neighbors.forEach(p=>d.add(p)),t.links&&t.links.forEach(p=>u.add(p))),n.current.hoveredNode=t,f&&f(t),n.current.highlightNodes=d,n.current.highlightLinks=u;},[f]),he=useCallback(t=>{if(t===n.current.hoveredLink)return;let d=new Set,u=new Set;if(t){u.add(t);let p=$();if(p){let h=typeof t.source=="object"?t.source:p.find(w=>w.id===t.source),y=typeof t.target=="object"?t.target:p.find(w=>w.id===t.target);h&&d.add(h),y&&d.add(y);}}n.current.hoveredLink=t,m&&m(t),n.current.highlightNodes=d,n.current.highlightLinks=u;},[m,$]),Te=useCallback(t=>{S&&S(t);},[S]),Le=useCallback(t=>{n.current.selectedNode=t,i&&i(t);},[i]),Re=useCallback(()=>{n.current.selectedNode=null,l$1&&l$1();},[l$1]),ze=useCallback(t=>{if(!P.current||!k.current)return;let d=P.current.getBoundingClientRect(),u=t.clientX-d.left,p=t.clientY-d.top;n.current.mouseStartPos={x:u,y:p},n.current.isDragging=false;let h=ee(u,p);h?(n.current.draggedNode=h,h.fx=h.x,h.fy=h.y):(n.current.isPanning=true,n.current.lastMousePos={x:u,y:p});},[ee]),Ce=useCallback((t,d)=>{let u=null;if(P.current&&n.current&&C.length>0){let p=ce.nodeSizeBase*ce.nodeAreaFactor/2,h=P.current.getBoundingClientRect(),y=P.current.width/h.width,w=P.current.height/h.height,g=t*y,N=d*w,R=(g-n.current.transform.x)/n.current.transform.k,j=(N-n.current.transform.y)/n.current.transform.k,K=n.current.selectedNode?.x||0,X=n.current.selectedNode?.y||0,le=Math.min(C.length,8),re=Math.min(Math.PI*2/le,Math.PI);for(let se=0;se<le;se++){let T=se*re,W=(se+1)*re;if(te(R,j,K,X,p,T,W)){u=se;break}}}return u},[C]),me=useCallback(t=>{if(!P.current)return;let d=P.current.getBoundingClientRect(),u=t.clientX-d.left,p=t.clientY-d.top;if(n.current.draggedNode&&n.current.mouseStartPos&&k.current){let w=n.current.mouseStartPos.x,g=n.current.mouseStartPos.y,N=u-w,R=p-g;Math.sqrt(N*N+R*R)>3&&(n.current.isDragging=true,k.current.alphaTarget()===0&&k.current.alphaTarget(0).restart());let X=typeof window<"u"&&window.devicePixelRatio||1,le=(u*X-n.current.transform.x)/n.current.transform.k,re=(p*X-n.current.transform.y)/n.current.transform.k;n.current.draggedNode.fx=le,n.current.draggedNode.fy=re;return}if(n.current.isPanning&&n.current.mouseStartPos){let w=u-n.current.lastMousePos.x,g=p-n.current.lastMousePos.y,N=n.current.mouseStartPos.x,R=n.current.mouseStartPos.y;Math.sqrt(Math.pow(u-N,2)+Math.pow(p-R,2))>3&&(n.current.isDragging=true),n.current.transform={...n.current.transform,x:n.current.transform.x+w,y:n.current.transform.y+g},n.current.lastMousePos={x:u,y:p},I();return}let h,y;if(n.current.selectedNode&&P.current&&C.length>0){let w=Ce(u,p);w!==null&&(y=n.current.selectedNode),w!==n.current.hoveredButtonIndex&&(h=true),n.current.hoveredButtonIndex=w;}else n.current.hoveredButtonIndex!==null&&(n.current.hoveredButtonIndex=null);if(!y&&(y=ee(u,p),!y)){let w=fe(u,p),g=w!==n.current.hoveredLink;if(w&&n.current.hoveredNode&&O(null),he(w),P.current&&(P.current.style.cursor=w?"pointer":"default"),g){I();return}}y&&n.current.hoveredLink&&he(null),y!==n.current.hoveredNode&&(h=true),O(y),P.current&&(P.current.style.cursor=y?"pointer":"default"),h&&I();},[C,ee,fe,O,he,I,te,Ce]),ve=useCallback(t=>{n.current.mustBeStoppedPropagation&&(t.stopPropagation(),t.preventDefault()),n.current.mustBeStoppedPropagation=false;},[]),ye=useCallback(t=>{let d=n.current.isDragging;if(d&&(n.current.mustBeStoppedPropagation=true),!d&&n.current.mouseStartPos){let u=P.current?.getBoundingClientRect();if(u){let p=t.clientX-u.left,h=t.clientY-u.top;C.length>0&&n.current.hoveredButtonIndex===null&&(n.current.hoveredButtonIndex=Ce(p,h));let y=false;if(n.current.selectedNode&&n.current.hoveredButtonIndex!==null&&s[n.current.hoveredButtonIndex]){let w=s[n.current.hoveredButtonIndex];w&&w.onClick&&(w.onClick(n.current.selectedNode),y=true,n.current.hoveredButtonIndex=null);}if(!y&&n.current.draggedNode)Le(n.current.draggedNode);else if(!y&&!n.current.draggedNode){let w=fe(p,h);w?Te(w):Re();}}}if(n.current.draggedNode&&k.current){if(d){k.current.alphaTarget(0);let u=.05,p=.04,h=.6;k.current.alpha(u).alphaDecay(p),k.current.velocityDecay(h);}else k.current.alphaTarget(0);n.current.draggedNode.fx=void 0,n.current.draggedNode.fy=void 0,n.current.draggedNode=null;}n.current.isDragging=false,n.current.mouseStartPos=null,n.current.isPanning&&(n.current.isPanning=false),I();},[s,I,Le,Re,fe,Te,Ce,C]),Fe=useCallback(t=>{if(t.stopPropagation(),t.preventDefault(),!P.current)return;let d=P.current.getBoundingClientRect(),u=t.clientX-d.left,p=t.clientY-d.top,y=-t.deltaY>0?1.1:1/1.1,w=n.current.transform,g=w.k*y;if(g<.01||g>10)return;let N=w.k*y,R=u-(u-w.x)*y,j=p-(p-w.y)*y;n.current.transform={k:N,x:R,y:j},I();},[I]),Oe=a((t,d)=>{let u=t.touches[0];if(u){let p={clientX:u.clientX,clientY:u.clientY};d(p);}},"convertTouchToMouseEvent"),bt=useCallback(t=>{Oe(t,ze);},[ze]),Ne=useCallback(t=>{n.current.mustBeStoppedPropagation&&(t.preventDefault(),t.stopPropagation()),n.current.mustBeStoppedPropagation=false,Oe(t,ye);},[ye]),De=useCallback(t=>{Oe(t,me);},[me]);return useImperativeHandle(D,()=>({zoomToFit:J,addNodes:oe,removeNodes:V}),[J,oe,V]),useEffect(()=>{let t=P.current,{width:d,height:u}=n.current;if(!t)return;H(),z(true);let p=d/2,h=u/2,y=ce.nodeSizeBase,w=y/2,g=y*2.5;k.current&&k.current.stop();let N=k.current=forceSimulation(L).force("link",forceLink(M).id(R=>R.id).distance(g).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,h).strength(.05)).force("collide",forceCollide().radius(w*2).iterations(2).strength(1)).velocityDecay(.6);return ()=>{N.stop();}},[L,M]),useLayoutEffect(()=>{let t=P.current;t&&(n.current.width=r*zt,n.current.height=o*zt,t.width=n.current.width,t.height=n.current.height);},[r,o]),useEffect(()=>{if(k.current){let t=k.current;t.on("tick",()=>{I();}),t.on("end",()=>{E&&(J(0,20),setTimeout(()=>{z(false);},200));});}E||I();},[L,M,E,I,J]),useEffect(()=>{!L||!M||M.forEach(t=>{let d=typeof t.source=="object"?t.source:L.find(p=>p.id===t.source),u=typeof t.target=="object"?t.target:L.find(p=>p.id===t.target);!d||!u||(!d.neighbors&&(d.neighbors=[]),!u.neighbors&&(u.neighbors=[]),d.neighbors.push(u),u.neighbors.push(d),!d.links&&(d.links=[]),!u.links&&(u.links=[]),d.links.push(t),u.links.push(t));});},[L,M]),useEffect(()=>{s&&s.length>0&&v(bo(s));},[s]),useEffect(()=>{let t=P.current;if(!(!t||typeof window>"u"))return t.addEventListener("wheel",Fe,{passive:false}),t.addEventListener("touchend",Ne,{passive:false}),()=>{t.removeEventListener("wheel",Fe),t.removeEventListener("touchend",Ne);}},[Fe,Ne]),jsxs(wo,{children:[(e||E)&&jsx(jr,{width:r,height:o}),jsx(yo,{ref:P,style:{width:r,height:o,display:e||E?"none":"block"},onMouseDown:ze,onMouseMove:me,onMouseUp:ye,onMouseLeave:ye,onClick:ve,onTouchStart:bt,onTouchMove:De})]})}),wo=styled.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
align-items: center;
|
|
50
50
|
justify-content: center;
|
|
51
51
|
width: 100%;
|
|
52
52
|
min-width: 0;
|
|
53
53
|
position: relative;
|
|
54
|
-
`,
|
|
54
|
+
`,yo=styled.canvas``;vo.displayName="Graph2D";var Jc=w(({isActive:e,position:r,top:o=0,left:a=0,right:s,bottom:i,...l})=>jsx(So,{$isActive:e,$position:r,$top:o,$left:a,$right:s,$bottom:i,...l})),So=Gn.div(({$isActive:e,$top:r,$left:o,$right:a,$bottom:s,$position:i,theme:l})=>`
|
|
55
55
|
${e?`
|
|
56
56
|
position: ${i};
|
|
57
57
|
z-index: 1000;
|
|
58
|
-
${typeof
|
|
59
|
-
${typeof o=="number"?`left: ${c(o,
|
|
60
|
-
${typeof a=="number"?`right: ${c(a,
|
|
61
|
-
${typeof s=="number"?`bottom: ${c(s,
|
|
58
|
+
${typeof r=="number"?`top: ${c(r,l.baseSize)};`:""}
|
|
59
|
+
${typeof o=="number"?`left: ${c(o,l.baseSize)};`:""}
|
|
60
|
+
${typeof a=="number"?`right: ${c(a,l.baseSize)};`:""}
|
|
61
|
+
${typeof s=="number"?`bottom: ${c(s,l.baseSize)};`:""}
|
|
62
62
|
|
|
63
63
|
`:""}
|
|
64
64
|
|
|
65
65
|
min-width: 0;
|
|
66
|
-
`);var So=[.1,.25,.5,.75,1,1.5,2,3,4,5],Co=5,Do=.1,Po=120;function xt(e,n,o,a){return {x:e<o?(o-e)/2:0,y:n<a?(a-n)/2:0}}a(xt,"computePadding");var Hr=a(({url:e,alt:n="image",naturalWidth:o,naturalHeight:a$1,zoomSteps:s=So,maxZoom:i=Co,minZoom:c=Do,showMinimap:p=true,minimapWidth:v=Po,className:S,onZoomChange:P})=>{let[h,T]=useState("adaptive"),[A,r]=useState(1),[L,y]=useState(0),[M,w]=useState(false),C=useRef(false),[D,K]=useState(false),[U,W]=useState(false),[V,ae]=useState({left:0,top:0}),pe=useRef(0),[fe,ke]=useState({width:0,height:0}),ce=useRef({width:0,height:0}),z$1=useRef(null),F=useRef(null),de=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),j=useRef(h),G=useRef(A),re=useRef(L),Q=useRef(P);j.current=h,G.current=A,re.current=L,Q.current=P;let he=o||ce.current.width,ue=a$1||ce.current.height,ee=L===90||L===270,B=ee?ue:he,be=ee?he:ue,Te=useMemo(()=>[...s].sort((k,I)=>k-I),[s]),Le=useCallback(()=>fe.width===0||B===0?1:Math.min(fe.width/B,fe.height/be,1),[fe,B,be]),Re=useCallback((k,I)=>{if(I==="in"){let q=Te.find(Y=>Y>k+.001);return q!==void 0?Math.min(q,i):k}let H=Te.findLast(q=>q<k-.001);return H!==void 0?Math.max(H,c):k},[Te,i,c]),ze=useCallback(()=>j.current==="adaptive"?Le():G.current,[Le]),Ce=useCallback(k=>{T("manual"),r(k),Q.current?.(k,"manual");},[]),ve=useCallback(()=>{T("adaptive"),Q.current?.(Le(),"adaptive");},[Le]),we=useCallback(k=>{requestAnimationFrame(()=>{let I=F.current;if(!I)return;let H=I.getBoundingClientRect(),q=B*k,Y=be*k,ge=xt(q,Y,H.width,H.height);I.scrollLeft=q/2+ge.x-H.width/2,I.scrollTop=Y/2+ge.y-H.height/2;});},[B,be]);useEffect(()=>{T("adaptive"),r(1),y(0),K(false),W(false),ce.current={width:0,height:0};},[e]),useEffect(()=>{let k=F.current;if(!k)return;let I=new ResizeObserver(H=>{let q=H[0];if(!q)return;let{width:Y,height:ge}=q.contentRect;ke(Se=>Se.width===Y&&Se.height===ge?Se:{width:Y,height:ge});});return I.observe(k),()=>I.disconnect()},[]),useEffect(()=>{let k=F.current;if(!k)return;let I=a(()=>{cancelAnimationFrame(pe.current),pe.current=requestAnimationFrame(()=>{let H=k.scrollLeft,q=k.scrollTop;ae(Y=>Y.left===H&&Y.top===q?Y:{left:H,top:q});});},"handleScroll");return k.addEventListener("scroll",I,{passive:true}),()=>{k.removeEventListener("scroll",I),cancelAnimationFrame(pe.current);}},[]),useEffect(()=>{let k=F.current;if(!k||!D)return;let I=a(H=>{if(!(H.ctrlKey||H.metaKey))return;H.preventDefault();let q=ze(),Y=H.deltaY>0?"out":"in",ge=Re(q,Y),Se=Le();if(Y==="out"&&ge<=Se){ve();return}let Pe=k.getBoundingClientRect(),Fe=re.current,Ve=Fe===90||Fe===270,rt=ce.current.width||1,nt=ce.current.height||1,Qe=Ve?nt:rt,pt=Ve?rt:nt,Kt,Qt;if(j.current==="adaptive"){let et=z$1.current;if(!et)return;let tt=et.getBoundingClientRect();Kt=(H.clientX-tt.left)/(tt.width/Qe),Qt=(H.clientY-tt.top)/(tt.height/pt);}else {let et=Qe*q,tt=pt*q,Sr=xt(et,tt,Pe.width,Pe.height);Kt=(k.scrollLeft+H.clientX-Pe.left-Sr.x)/q,Qt=(k.scrollTop+H.clientY-Pe.top-Sr.y)/q;}Ce(ge),requestAnimationFrame(()=>{let et=k.getBoundingClientRect(),tt=xt(Qe*ge,pt*ge,et.width,et.height);k.scrollLeft=Kt*ge+tt.x-(H.clientX-et.left),k.scrollTop=Qt*ge+tt.y-(H.clientY-et.top);});},"handleWheel");return k.addEventListener("wheel",I,{passive:false}),()=>k.removeEventListener("wheel",I)},[D,ze,Re,Le,Ce,ve]),useEffect(()=>{if(h!=="manual")return;let k=F.current;if(!k)return;let I=a(Y=>{Y.button===0&&(Y.preventDefault(),C.current=true,w(true),de.current={x:Y.clientX,y:Y.clientY,scrollLeft:k.scrollLeft,scrollTop:k.scrollTop});},"handleMouseDown"),H=a(Y=>{if(!C.current)return;let{x:ge,y:Se,scrollLeft:Pe,scrollTop:Fe}=de.current;k.scrollLeft=Pe-(Y.clientX-ge),k.scrollTop=Fe-(Y.clientY-Se);},"handleMouseMove"),q=a(()=>{C.current=false,w(false);},"handleMouseUp");return k.addEventListener("mousedown",I),window.addEventListener("mousemove",H),window.addEventListener("mouseup",q),()=>{k.removeEventListener("mousedown",I),window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",q);}},[h]);let me=useCallback(()=>{h==="manual"&&ve();},[h,ve]),We=useCallback(()=>{let k=ze(),I=Re(k,"in");I!==k&&(Ce(I),we(I));},[ze,Re,Ce,we]),$e=useCallback(()=>{let k=ze(),I=Re(k,"out");if(I<=Le()){ve();return}Ce(I),we(I);},[ze,Re,Le,ve,Ce,we]),vt=useCallback(()=>{Ce(1),we(1);},[Ce,we]),Ne=useCallback(()=>{y(k=>{let I=(k+90)%360;if(j.current==="manual"){let H=ce.current.width,q=ce.current.height,Y=I===90||I===270,ge=Y?q:H,Se=Y?H:q,Pe=G.current;requestAnimationFrame(()=>{let Fe=F.current;if(!Fe)return;let Ve=Fe.getBoundingClientRect(),rt=ge*Pe,nt=Se*Pe,Qe=xt(rt,nt,Ve.width,Ve.height);Fe.scrollLeft=rt/2+Qe.x-Ve.width/2,Fe.scrollTop=nt/2+Qe.y-Ve.height/2;});}return I});},[]),De=useCallback(()=>{let k=z$1.current;k&&(ce.current={width:k.naturalWidth,height:k.naturalHeight},K(true),W(false));},[]),t=h==="adaptive"?Le():A,d=B*t,u=be*t,f=fe.width,g=fe.height,x=h==="manual"?xt(d,u,f,g):{x:0,y:0},b=p&&h==="manual"&&(d>f||u>g),m=B>0?v/B:0,E=be*m,R=f>0?f/A*m:0,_=g>0?g/A*m:0,J=Math.max(0,V.left-x.x)/A*m,X=Math.max(0,V.top-x.y)/A*m,ie=h==="adaptive"?"Fit":`${Math.round(A*100)}%`,te=Re(t,"in")!==t,oe=h==="manual"||t>c,N=h==="adaptive"?{width:B?d:void 0,height:be?u:void 0,position:"relative",flexShrink:0}:{width:d,height:u,marginLeft:x.x,marginTop:x.y,flexShrink:0,position:"relative"},$={width:he*t,height:ue*t,maxWidth:"none",maxHeight:"none",position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) rotate(${L}deg)`},O={cursor:h==="manual"?M?"grabbing":"grab":"default"},le={width:he*m,height:ue*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 ${S??""}`,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:$e,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"?ve: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":ie,children:jsx(_a$1,{style:{fontSize:12,fontWeight:500},children:ie})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na$1,{style:{width:14,height:14}}),onClick:We,disabled:!te,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:Ne,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,{style:{width:14,height:14}}),onClick:ve,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:vt,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$1,{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:F,className:`h-full w-full ${h==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:O,onDoubleClick:me,children:U?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(_a$1,{color:"text.lighter",children:"Failed to load image"})}):jsx("div",{style:N,children:jsx("img",{ref:z$1,src:e,alt:n,draggable:false,className:"block select-none",style:$,onLoad:De,onError:()=>W(true)})})}),b&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:v,height:E,backdropFilter:"blur(8px)",background:"rgba(255,255,255,0.75)"},children:[jsx("div",{style:le,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(R,v),height:Math.min(_,E),left:Math.max(0,Math.min(J,v-R)),top:Math.max(0,Math.min(X,E-_)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var $r=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 tr=a(({url:e})=>{let[n,o]=useState(null),[a$1,s]=useState(false),[i,c]=useState(true),[p,v]=useState(null);return useEffect(()=>{s(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let P=await import('./PdfDriver-6PMCM56Q.mjs');o(()=>P.PdfDriver),c(!1);}catch(P){console.error("Failed to load PDF driver:",P),v("Failed to load PDF viewer"),c(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..."})}):p||!n?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:p||"PDF viewer unavailable"})})}):jsx(n,{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 Ur=50,No=1e4,qr=a(({url:e,blob:n})=>{let o=useRef(null),a$1=useRef(null),[s,i]=useState(null),[c,p]=useState(true),[v,S]=useState(1),P=useRef(false),[h,T]=useState({width:0,height:0}),A=useRef(0),r=a(()=>{P.current=true,S(y=>Math.min(y+.25,4));},"handleZoomIn"),L=a(()=>{P.current=true,S(y=>Math.max(y-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{p(!0),i(null);let M=n;if(!M&&e&&(M=await(await fetch(e)).blob()),!M){i("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(M.size/(1024*1024)>Ur){i(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Ur} \u041C\u0411)`);return}a$1.current.innerHTML="";let C=renderAsync(M,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),D=new Promise((U,W)=>setTimeout(()=>W(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")),No));await Promise.race([C,D]),await new Promise(U=>requestAnimationFrame(U));let K=a$1.current.querySelector(".docx-wrapper");if(K&&(A.current=K.offsetWidth,T({width:K.offsetWidth,height:K.offsetHeight})),o.current&&A.current>0){let U=o.current.clientWidth,W=Math.min(U/A.current,1);S(W);}p(!1);}catch(M){i(M?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),p(false);}},"renderDocument")();},[e,n]),useEffect(()=>{if(!o.current)return;let y=Eo(w=>{if(!(P.current||A.current===0))for(let C of w){let D=C.contentRect.width,K=Math.min(D/A.current,1);S(K);}},150),M=new ResizeObserver(y);return M.observe(o.current),()=>{M.disconnect(),y.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(tb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(_a$1,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(_a$1,{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})]}),!!s&&!c&&jsx("div",{className:"text-red-500 p-8",children:s}),c&&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:o,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!
|
|
66
|
+
`);var Po=[.1,.25,.5,.75,1,1.5,2,3,4,5],Mo=5,Eo=.1,No=120;function yt(e,r,o,a){return {x:e<o?(o-e)/2:0,y:r<a?(a-r)/2:0}}a(yt,"computePadding");var Hr=a(({url:e,alt:r="image",naturalWidth:o,naturalHeight:a$1,zoomSteps:s=Po,maxZoom:i=Mo,minZoom:l=Eo,showMinimap:f=true,minimapWidth:m=No,className:S,onZoomChange:D})=>{let[b,E]=useState("adaptive"),[z$1,n]=useState(1),[L,M]=useState(0),[C,v]=useState(false),P=useRef(false),[k,Q]=useState(false),[U,H]=useState(false),[$,ae]=useState({left:0,top:0}),pe=useRef(0),[ge,ke]=useState({width:0,height:0}),ue=useRef({width:0,height:0}),ie=useRef(null),_=useRef(null),G=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),I=useRef(b),oe=useRef(z$1),V=useRef(L),J=useRef(D);I.current=b,oe.current=z$1,V.current=L,J.current=D;let ee=o||ue.current.width,fe=a$1||ue.current.height,te=L===90||L===270,O=te?fe:ee,he=te?ee:fe,Te=useMemo(()=>[...s].sort((x,A)=>x-A),[s]),Le=useCallback(()=>ge.width===0||O===0?1:Math.min(ge.width/O,ge.height/he,1),[ge,O,he]),Re=useCallback((x,A)=>{if(A==="in"){let q=Te.find(Y=>Y>x+.001);return q!==void 0?Math.min(q,i):x}let B=Te.findLast(q=>q<x-.001);return B!==void 0?Math.max(B,l):x},[Te,i,l]),ze=useCallback(()=>I.current==="adaptive"?Le():oe.current,[Le]),Ce=useCallback(x=>{E("manual"),n(x),J.current?.(x,"manual");},[]),me=useCallback(()=>{E("adaptive"),J.current?.(Le(),"adaptive");},[Le]),ve=useCallback(x=>{requestAnimationFrame(()=>{let A=_.current;if(!A)return;let B=A.getBoundingClientRect(),q=O*x,Y=he*x,be=yt(q,Y,B.width,B.height);A.scrollLeft=q/2+be.x-B.width/2,A.scrollTop=Y/2+be.y-B.height/2;});},[O,he]);useEffect(()=>{E("adaptive"),n(1),M(0),Q(false),H(false),ue.current={width:0,height:0};},[e]),useEffect(()=>{let x=_.current;if(!x)return;let A=new ResizeObserver(B=>{let q=B[0];if(!q)return;let{width:Y,height:be}=q.contentRect;ke(Se=>Se.width===Y&&Se.height===be?Se:{width:Y,height:be});});return A.observe(x),()=>A.disconnect()},[]),useEffect(()=>{let x=_.current;if(!x)return;let A=a(()=>{cancelAnimationFrame(pe.current),pe.current=requestAnimationFrame(()=>{let B=x.scrollLeft,q=x.scrollTop;ae(Y=>Y.left===B&&Y.top===q?Y:{left:B,top:q});});},"handleScroll");return x.addEventListener("scroll",A,{passive:true}),()=>{x.removeEventListener("scroll",A),cancelAnimationFrame(pe.current);}},[]),useEffect(()=>{let x=_.current;if(!x||!k)return;let A=a(B=>{if(!(B.ctrlKey||B.metaKey))return;B.preventDefault();let q=ze(),Y=B.deltaY>0?"out":"in",be=Re(q,Y),Se=Le();if(Y==="out"&&be<=Se){me();return}let Pe=x.getBoundingClientRect(),Be=V.current,Xe=Be===90||Be===270,rt=ue.current.width||1,nt=ue.current.height||1,Qe=Xe?nt:rt,ft=Xe?rt:nt,Kt,Qt;if(I.current==="adaptive"){let et=ie.current;if(!et)return;let tt=et.getBoundingClientRect();Kt=(B.clientX-tt.left)/(tt.width/Qe),Qt=(B.clientY-tt.top)/(tt.height/ft);}else {let et=Qe*q,tt=ft*q,Sr=yt(et,tt,Pe.width,Pe.height);Kt=(x.scrollLeft+B.clientX-Pe.left-Sr.x)/q,Qt=(x.scrollTop+B.clientY-Pe.top-Sr.y)/q;}Ce(be),requestAnimationFrame(()=>{let et=x.getBoundingClientRect(),tt=yt(Qe*be,ft*be,et.width,et.height);x.scrollLeft=Kt*be+tt.x-(B.clientX-et.left),x.scrollTop=Qt*be+tt.y-(B.clientY-et.top);});},"handleWheel");return x.addEventListener("wheel",A,{passive:false}),()=>x.removeEventListener("wheel",A)},[k,ze,Re,Le,Ce,me]),useEffect(()=>{if(b!=="manual")return;let x=_.current;if(!x)return;let A=a(Y=>{Y.button===0&&(Y.preventDefault(),P.current=true,v(true),G.current={x:Y.clientX,y:Y.clientY,scrollLeft:x.scrollLeft,scrollTop:x.scrollTop});},"handleMouseDown"),B=a(Y=>{if(!P.current)return;let{x:be,y:Se,scrollLeft:Pe,scrollTop:Be}=G.current;x.scrollLeft=Pe-(Y.clientX-be),x.scrollTop=Be-(Y.clientY-Se);},"handleMouseMove"),q=a(()=>{P.current=false,v(false);},"handleMouseUp");return x.addEventListener("mousedown",A),window.addEventListener("mousemove",B),window.addEventListener("mouseup",q),()=>{x.removeEventListener("mousedown",A),window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",q);}},[b]);let ye=useCallback(()=>{b==="manual"&&me();},[b,me]),Fe=useCallback(()=>{let x=ze(),A=Re(x,"in");A!==x&&(Ce(A),ve(A));},[ze,Re,Ce,ve]),Oe=useCallback(()=>{let x=ze(),A=Re(x,"out");if(A<=Le()){me();return}Ce(A),ve(A);},[ze,Re,Le,me,Ce,ve]),bt=useCallback(()=>{Ce(1),ve(1);},[Ce,ve]),Ne=useCallback(()=>{M(x=>{let A=(x+90)%360;if(I.current==="manual"){let B=ue.current.width,q=ue.current.height,Y=A===90||A===270,be=Y?q:B,Se=Y?B:q,Pe=oe.current;requestAnimationFrame(()=>{let Be=_.current;if(!Be)return;let Xe=Be.getBoundingClientRect(),rt=be*Pe,nt=Se*Pe,Qe=yt(rt,nt,Xe.width,Xe.height);Be.scrollLeft=rt/2+Qe.x-Xe.width/2,Be.scrollTop=nt/2+Qe.y-Xe.height/2;});}return A});},[]),De=useCallback(()=>{let x=ie.current;x&&(ue.current={width:x.naturalWidth,height:x.naturalHeight},Q(true),H(false));},[]),t=b==="adaptive"?Le():z$1,d=O*t,u=he*t,p=ge.width,h=ge.height,y=b==="manual"?yt(d,u,p,h):{x:0,y:0},w=f&&b==="manual"&&(d>p||u>h),g=O>0?m/O:0,N=he*g,R=p>0?p/z$1*g:0,j=h>0?h/z$1*g:0,K=Math.max(0,$.left-y.x)/z$1*g,X=Math.max(0,$.top-y.y)/z$1*g,le=b==="adaptive"?"Fit":`${Math.round(z$1*100)}%`,re=Re(t,"in")!==t,se=b==="manual"||t>l,T=b==="adaptive"?{width:O?d:void 0,height:he?u:void 0,position:"relative",flexShrink:0}:{width:d,height:u,marginLeft:y.x,marginTop:y.y,flexShrink:0,position:"relative"},W={width:ee*t,height:fe*t,maxWidth:"none",maxHeight:"none",position:"absolute",top:"50%",left:"50%",transform:`translate(-50%, -50%) rotate(${L}deg)`},F={cursor:b==="manual"?C?"grabbing":"grab":"default"},de={width:ee*g,height:fe*g,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 ${S??""}`,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:Oe,disabled:!se,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:b==="manual"?me: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":le,children:jsx(_a,{style:{fontSize:12,fontWeight:500},children:le})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na$1,{style:{width:14,height:14}}),onClick:Fe,disabled:!re,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:Ne,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:b==="adaptive"?"primary":"default",icon:jsx(sa$1,{style:{width:14,height:14}}),onClick:me,className:`${b==="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:b==="manual"&&z$1===1?"primary":"default",onClick:bt,className:`${b==="manual"&&z$1===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 ${b==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:F,onDoubleClick:ye,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:T,children:jsx("img",{ref:ie,src:e,alt:r,draggable:false,className:"block select-none",style:W,onLoad:De,onError:()=>H(true)})})}),w&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:m,height:N,backdropFilter:"blur(8px)",background:"rgba(255,255,255,0.75)"},children:[jsx("div",{style:de,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(R,m),height:Math.min(j,N),left:Math.max(0,Math.min(K,m-R)),top:Math.max(0,Math.min(X,N-j)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var $r=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 tr=a(({url:e})=>{let[r,o]=useState(null),[a$1,s]=useState(false),[i,l]=useState(true),[f,m]=useState(null);return useEffect(()=>{s(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let D=await import('./PdfDriver-6PMCM56Q.mjs');o(()=>D.PdfDriver),l(!1);}catch(D){console.error("Failed to load PDF driver:",D),m("Failed to load PDF viewer"),l(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..."})}):f||!r?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:f||"PDF viewer unavailable"})})}):jsx(r,{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 Ur=50,Ro=1e4,qr=a(({url:e,blob:r})=>{let o=useRef(null),a$1=useRef(null),[s,i]=useState(null),[l,f]=useState(true),[m,S]=useState(1),D=useRef(false),[b,E]=useState({width:0,height:0}),z$1=useRef(0),n=a(()=>{D.current=true,S(M=>Math.min(M+.25,4));},"handleZoomIn"),L=a(()=>{D.current=true,S(M=>Math.max(M-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{f(!0),i(null);let C=r;if(!C&&e&&(C=await(await fetch(e)).blob()),!C){i("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(C.size/(1024*1024)>Ur){i(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Ur} \u041C\u0411)`);return}a$1.current.innerHTML="";let P=renderAsync(C,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),k=new Promise((U,H)=>setTimeout(()=>H(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")),Ro));await Promise.race([P,k]),await new Promise(U=>requestAnimationFrame(U));let Q=a$1.current.querySelector(".docx-wrapper");if(Q&&(z$1.current=Q.offsetWidth,E({width:Q.offsetWidth,height:Q.offsetHeight})),o.current&&z$1.current>0){let U=o.current.clientWidth,H=Math.min(U/z$1.current,1);S(H);}f(!1);}catch(C){i(C?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),f(false);}},"renderDocument")();},[e,r]),useEffect(()=>{if(!o.current)return;let M=Lo(v=>{if(!(D.current||z$1.current===0))for(let P of v){let k=P.contentRect.width,Q=Math.min(k/z$1.current,1);S(Q);}},150),C=new ResizeObserver(M);return C.observe(o.current),()=>{C.disconnect(),M.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:L,disabled:m<=.25,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:7}),jsxs(tb,{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(m*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na$1,{style:{width:14,height:14}}),onClick:n,disabled:m>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!s&&!l&&jsx("div",{className:"text-red-500 p-8",children:s}),l&&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:o,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:b.width>0?b.width*m:void 0,height:b.height>0?b.height*m: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,12 @@ ${e?`
|
|
|
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
|
-
|
|
82
|
+
[&>div.docx-wrapper]:min-h-full`,style:{boxSizing:"border-box",wordBreak:"break-word",overflowWrap:"break-word",transform:`scale(${m})`,transformOrigin:"top left"}})})})]})},"DocxDriver");var Uo=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 qo(){let[e,r]=useState(()=>typeof document<"u"?document.documentElement.classList.contains("dark"):false);return useEffect(()=>{let o=new MutationObserver(()=>{r(document.documentElement.classList.contains("dark"));});return o.observe(document.documentElement,{attributes:true,attributeFilter:["class"]}),()=>o.disconnect()},[]),e}a(qo,"useIsDarkMode");var Jr=a(({url:e,extension:r})=>{let[o,a$1]=useState(""),[s,i]=useState(true),[l,f]=useState(null),[m,S]=useState(0),D=useRef(null),b=qo();if(useEffect(()=>{a(async()=>{try{i(!0),f(null);let L=await fetch(e);if(!L.ok)throw new Error(`Failed to load file: ${L.statusText}`);let M=await L.text();if(r==="json")try{M=JSON.stringify(JSON.parse(M),null,2);}catch{}a$1(M);}catch(L){f(L instanceof Error?L.message:"Failed to load text content");}finally{i(false);}},"loadTextContent")();},[e]),useEffect(()=>{let n=a(()=>{if(D.current){let L=D.current.clientHeight;S(L);}},"updateHeight");return n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n);}},[s]),s)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(l)return jsx("div",{className:"flex items-center justify-center p-8.5",children:jsxs("div",{className:"text-red-500",children:["Error: ",l]})});if(r==="md")return jsx("div",{ref:D,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(Xo,{remarkPlugins:[Vo],children:o})});let z=Uo(r);return jsx("div",{ref:D,className:"h-full w-full",children:m>0&&jsx(Ao,{value:o,theme:b?vscodeDark:vscodeLight,extensions:z,editable:false,height:`${m}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 Qr=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 ht=class{static{a(this,"LruChunkCache");}cache=new Map;pinned=new Set;maxSize;constructor(r=8){this.maxSize=r;}get(r){let o=this.cache.get(r);return o!==void 0&&(this.cache.delete(r),this.cache.set(r,o)),o}set(r,o){if(this.cache.delete(r),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(r,o);}pin(r){this.pinned.clear();for(let o of r)this.pinned.add(o);this.pinned.size>this.maxSize&&(this.maxSize=this.pinned.size+4);}clear(){this.cache.clear(),this.pinned.clear();}};var st="chunks",or=class{static{a(this,"IndexedDBStore");}db;sessionId;dbName;constructor(r,o,a){this.db=r,this.sessionId=o,this.dbName=a;}async set(r,o){return new Promise((a,s)=>{let i=this.db.transaction(st,"readwrite");i.objectStore(st).put(o,r),i.oncomplete=()=>a(),i.onerror=()=>s(i.error);})}async get(r){return new Promise((o,a)=>{let i=this.db.transaction(st,"readonly").objectStore(st).get(r);i.onsuccess=()=>o(i.result??void 0),i.onerror=()=>a(i.error);})}async clear(){return new Promise((r,o)=>{let a=this.db.transaction(st,"readwrite");a.objectStore(st).clear(),a.oncomplete=()=>r(),a.onerror=()=>o(a.error);})}async destroy(){return this.db.close(),new Promise((r,o)=>{let a=indexedDB.deleteDatabase(this.dbName);a.onsuccess=()=>r(),a.onerror=()=>o(a.error),a.onblocked=()=>r();})}},ar=class{static{a(this,"MemoryStore");}sessionId=null;chunks=new Map;async set(r,o){this.chunks.set(r,o);}async get(r){return this.chunks.get(r)}async clear(){this.chunks.clear();}async destroy(){this.chunks.clear();}};async function Wt(){let e=`${Date.now()}_${Math.random().toString(36).slice(2)}`,r=`csv-chunks-${e}`;try{let o=await new Promise((a,s)=>{let i=indexedDB.open(r,1);i.onupgradeneeded=()=>{let l=i.result;l.objectStoreNames.contains(st)||l.createObjectStore(st);},i.onsuccess=()=>a(i.result),i.onerror=()=>s(i.error);});return new or(o,e,r)}catch{return console.warn("IndexedDB unavailable, falling back to in-memory storage"),new ar}}a(Wt,"createChunkStore");function ta(e){let r=[],o=false,a=0,s=0;for(let i=0;i<e.length;i++){let l=e[i];if(l==='"')o=!o;else if(!o&&(l===`
|
|
83
|
+
`||l==="\r"&&e[i+1]!==`
|
|
84
|
+
`)){let f=e.slice(a,i).replace(/\r$/,"");f&&r.push(f),a=i+1,s=i+1;}}return [r,e.slice(s)]}a(ta,"splitCsvRows");function ra(e,r){let o=false;for(let a=0;a<e.length;a++)if(e[a]==='"')o=!o;else if(!o&&e.startsWith(r,a))return true;return false}a(ra,"hasDelimiter");var na=[",",";"," ","|"];function on(e,r){let o=false,a=1,s=r[0],i=r.length;for(let l=0;l<e.length;l++){let f=e[l];f==='"'?o=!o:!o&&f===s&&e.startsWith(r,l)&&(a++,l+=i-1);}return a}a(on,"countFields");function en(e,r){let o=new Map;for(let i of e){let l=on(i,r);o.set(l,(o.get(l)??0)+1);}let a=0,s=1;for(let[i,l]of o)l>a&&(a=l,s=i);return s===1?0:a/e.length}a(en,"delimiterModeScore");function tn(e,r){if(e.length===0)return null;let o=r,a=en(e,r);for(let s of na){if(s===r)continue;let i=en(e,s);i>a&&(a=i,o=s);}return a>=.75&&o!==r?o:null}a(tn,"detectBodyDelimiter");function rn(e,r,o){let{data:a}=St.parse(e,{delimiter:r});return (a[0]??[""]).map(i=>i.includes(o)||i.includes('"')||i.includes(`
|
|
85
|
+
`)||i.includes("\r")?'"'+i.replace(/"/g,'""')+'"':i).join(o)}a(rn,"reformatHeader");function nn(e,r,o){if(e.length===0)return null;let a=0,s=new Map;for(let f of e){let m=on(f,r);m>o&&(a++,s.set(m,(s.get(m)??0)+1));}if(a/e.length<.55)return null;let i=o,l=0;for(let[f,m]of s)m>l&&(l=m,i=f);return i>o?i:null}a(nn,"detectExtraBodyColumns");var $t=class{static{a(this,"Utf32Decoder");}isLE;leftover=new Uint8Array(0);constructor(r){this.isLE=r==="le";}decode(r,o){let a=r;if(this.leftover.length>0){let f=new Uint8Array(this.leftover.length+r.length);f.set(this.leftover),f.set(r,this.leftover.length),a=f;}let s=Math.floor(a.length/4),i="";for(let f=0;f<s*4;f+=4){let m=this.isLE?(a[f]|a[f+1]<<8|a[f+2]<<16|a[f+3]<<24)>>>0:(a[f]<<24|a[f+1]<<16|a[f+2]<<8|a[f+3])>>>0;m>1114111||m>=55296&&m<=57343?i+="\uFFFD":i+=String.fromCodePoint(m);}let l=a.length%4;return o?.stream?this.leftover=l>0?a.slice(s*4):new Uint8Array(0):(l>0&&(i+="\uFFFD"),this.leftover=new Uint8Array(0)),i}};function oa(e){if(e==="utf-32le"||e==="utf-32")return new $t("le");if(e==="utf-32be")return new $t("be");try{return new TextDecoder(e)}catch{return new TextDecoder("utf-8")}}a(oa,"createDecoder");function aa(e){let r=Math.min(e.length,512);if(r<8)return null;let o=0,a=0;for(let i=0;i<r;i++)e[i]===0&&(i%2===1?o++:a++);let s=r/4;return o>=s&&o>a*2?"utf-16le":a>=s&&a>o*2?"utf-16be":null}a(aa,"detectUtf16NoBom");function ia(e){if(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191)return {encoding:"utf-8",bomLength:3};if(e.length>=4&&e[0]===0&&e[1]===0&&e[2]===254&&e[3]===255)return {encoding:"utf-32be",bomLength:4};if(e.length>=4&&e[0]===255&&e[1]===254&&e[2]===0&&e[3]===0)return {encoding:"utf-32le",bomLength:4};if(e.length>=2&&e[0]===255&&e[1]===254)return {encoding:"utf-16le",bomLength:2};if(e.length>=2&&e[0]===254&&e[1]===255)return {encoding:"utf-16be",bomLength:2};let r=aa(e.slice(0,512));if(r)return {encoding:r,bomLength:0};let o=(ea.detect(e.slice(0,4096))??"utf-8").toLowerCase();return o==="utf-8-sig"?{encoding:"utf-8",bomLength:3}:{encoding:o,bomLength:0}}a(ia,"detectEncodingFromBom");function sa(e,r){return e.stream?Promise.resolve(e.stream):e.blob?Promise.resolve(e.blob.stream()):e.url?fetch(e.url,{signal:r}).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.body}):Promise.reject(new Error("No source provided"))}a(sa,"resolveStream");function an(e){let[r,o]=useState("idle"),[a,s]=useState(0),[i,l]=useState([]),[f,m]=useState(null),[S,D]=useState(0),[b,E]=useState(0),z=useRef(e),n=useRef(0),L=useRef(0),M=useRef(""),C=useRef(""),v=useRef(0),P=useRef(new ht(10)),k=useRef(null),Q=useRef(null),U=useRef(new Set),H=useRef(null),$=useRef(false),ae=useCallback((I,oe)=>{let V=C.current,J=v.current,ee=V&&J>1?oe.map(O=>ra(O,V)?O:'"'+O.replace(/"/g,'""')+'"'+V.repeat(J-1)):oe,fe=I+`
|
|
86
|
+
`+ee.join(`
|
|
87
|
+
`),{data:te}=St.parse(fe,{header:false,dynamicTyping:false,skipEmptyLines:true,...V?{delimiter:V}:{}});return te.slice(1)},[]),pe=useCallback(async(I,oe)=>{let V=k.current;if(!V)return;let J=Math.max(0,Math.floor(I/1e3)-2),ee=Math.min(n.current-1,Math.floor(oe/1e3)+2),fe=false;for(let te=J;te<=ee;te++)if(P.current.get(te)===void 0&&!U.current.has(te)){U.current.add(te);try{let O=await V.get(te);if(O&&M.current){let he=ae(M.current,O);P.current.set(te,he),fe=!0;}}finally{U.current.delete(te);}}fe&&E(te=>te+1);},[ae]),ge=useCallback(I=>{let oe=Math.floor(I/1e3),V=I%1e3;return P.current.get(oe)?.[V]},[b]),ke=useCallback(async()=>{$.current=true;let I=new AbortController;Q.current=I,await k.current?.destroy();let oe=await Wt();k.current=oe,n.current=0,L.current=0,M.current="",C.current="",v.current=0,P.current.clear(),l([]),s(0),m(null),D(0),o("loading");let V=z.current,J=null;try{let ee=await sa(V,I.signal);o("streaming"),J=ee.getReader();let fe=null,te="",O=[],he=!0,Te=[],Le=0,Re=0,ze=V.blob?.size||0,Ce=!1,me=[];for(;;){if(I.signal.aborted)return;let{done:ve,value:ye}=await J.read();if(ve)break;Le+=ye.byteLength,ze&&D(Le/ze);let Fe=ye;if(!fe){let{encoding:Ne,bomLength:De}=ia(ye);fe=oa(Ne),De>0&&(Fe=ye.slice(De));}te+=fe.decode(Fe,{stream:!0});let[Oe,bt]=ta(te);if(Oe.length!==0){for(te=bt;he&&Oe.length>0;){let Ne=Oe.shift(),{data:De,meta:t}=St.parse(Ne,{}),d=De[0]?.length??0;if(d>1)M.current=Ne,C.current=t.delimiter,v.current=d,l(De[0]),O=[...Te],Te=[],he=!1;else if(Te.length<50)Te.push(Ne);else {M.current=Te.shift();let{data:u}=St.parse(M.current,{});u[0]&&l(u[0]),v.current=1,O=[...Te,Ne],Te=[],he=!1;}}for(let Ne of Oe)if(Ne.trim()){if(!Ce){if(me.push(Ne),me.length<20)continue;let De=tn(me,C.current);De&&(M.current=rn(M.current,C.current,De),C.current=De);let t=nn(me,C.current,v.current);if(t!==null){let d=t-v.current;v.current=t,l(u=>[...u,...Array(d).fill("")]);}Ce=!0;for(let d of me)O.push(d);me.length=0;continue}if(O.push(Ne),O.length>=1e3){let De=n.current;if(await oe.set(De,O),De<3){let t=ae(M.current,O);P.current.set(De,t);}n.current+=1,Re+=O.length,O=[],L.current=Re,H.current||(H.current=requestAnimationFrame(()=>{s(L.current),H.current=null;}));}}}}if(!he&&!Ce){let ve=tn(me,C.current);ve&&(M.current=rn(M.current,C.current,ve),C.current=ve);let ye=nn(me,C.current,v.current);if(ye!==null){let Fe=ye-v.current;v.current=ye,l(Oe=>[...Oe,...Array(Fe).fill("")]);}for(let Fe of me)O.push(Fe);}if(he){let ve=[...Te];if(te.trim()&&ve.push(te),ve.length>0){M.current=ve[0];let{data:ye}=St.parse(M.current,{});ye[0]&&l(ye[0]),v.current=ye[0]?.length??1,ve.length>1&&(O=[...O,...ve.slice(1)]);}}else te.trim()&&O.push(te);O.length>0&&(await oe.set(n.current,O),n.current+=1,Re+=O.length),H.current&&(cancelAnimationFrame(H.current),H.current=null),s(Re),D(1),o("done");}catch(ee){if(I.signal.aborted)return;let fe=ee instanceof Error?ee.message:"Unknown error";m(fe),o("partial_error");}finally{J?.cancel().catch(()=>{}),J?.releaseLock(),H.current&&(cancelAnimationFrame(H.current),H.current=null),$.current=false;}},[ae]),ue=useRef(false);useEffect(()=>(ue.current=true,$.current||ke(),()=>{ue.current=false,queueMicrotask(()=>{ue.current||(Q.current?.abort(),k.current?.destroy(),H.current&&cancelAnimationFrame(H.current));});}),[ke]);let ie=k.current?.sessionId??null,_=n.current,G=useCallback(I=>{P.current.pin(I);},[]);return {state:r,headers:i,totalRows:a,getRow:ge,error:f,progress:S,prefetchRange:pe,sessionId:ie,chunkCount:_,pinChunks:G,delimiter:C.current}}a(an,"useCsvStream");var la=`
|
|
87
88
|
const DB_VERSION = 1;
|
|
88
89
|
const STORE_NAME = 'chunks';
|
|
89
90
|
|
|
@@ -169,16 +170,16 @@ self.onmessage = async (e) => {
|
|
|
169
170
|
}
|
|
170
171
|
}
|
|
171
172
|
};
|
|
172
|
-
`,Dt=null,Pt=null;function lr(){if(!Dt){let e=new Blob([
|
|
173
|
+
`,Dt=null,Pt=null;function lr(){if(!Dt){let e=new Blob([la],{type:"application/javascript"});Pt=URL.createObjectURL(e),Dt=new Worker(Pt);}return Dt}a(lr,"getSearchWorker");function sn(){Dt?.terminate(),Dt=null,Pt&&(URL.revokeObjectURL(Pt),Pt=null);}a(sn,"terminateSearchWorker");function ln(e,r){let[o,a]=useState(""),[s,i]=useState("idle"),[l,f]=useState(null),[m,S]=useState({searched:0,total:0,found:0}),D=useRef(null),b=useCallback(n=>{if(!e||r===0)return;if(!n.trim()){f(null),i("idle"),S({searched:0,total:0,found:0});return}i("searching"),S({searched:0,total:r,found:0});let L=lr();L.onmessage=M=>{let{type:C}=M.data;C==="progress"&&S({searched:M.data.searched,total:M.data.total,found:M.data.found}),C==="done"&&(f(M.data.matchedIndices),i("done")),C==="cancelled"&&i("idle"),C==="error"&&(i("idle"),console.error("Search worker error:",M.data.message));},L.postMessage({type:"cancel"}),L.postMessage({type:"search",sessionId:e,query:n,chunkCount:r,chunkSize:1e3});},[e,r]),E=useCallback(n=>{a(n),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{b(n);},300);},[b]),z=useCallback(()=>{a(""),f(null),i("idle"),S({searched:0,total:0,found:0}),lr().postMessage({type:"cancel"});},[]);return useEffect(()=>()=>{D.current&&clearTimeout(D.current),sn();},[]),{query:o,onQueryChange:E,clearSearch:z,searchState:s,matchedIndices:l,searchProgress:m}}a(ln,"useCsvSearch");var ba={loading:"Loading...",rows:"rows",retry:"Retry",searchPlaceholder:"Search...",searchFound:"found",searching:"Searching..."};function va(e,r,o){let a=1/0,s=-1/0,i=Math.min(o,e.length-1);for(let l=r;l<=i;l++){let f=e[l];f<a&&(a=f),f>s&&(s=f);}return {min:a,max:s}}a(va,"getMinMax");function wa(e,r,o){let a=Math.min(100,o),s=e.map(()=>[]);for(let i=0;i<a;i++){let l=r(i);if(l)for(let f=0;f<e.length;f++){let m=l[f]??"";s[f].push(m.length);}}return e.map((i,l)=>{let f=i.length*9,m=s[l];if(m.length===0)return Math.min(Math.max(150,f+24),800);m.sort((z,n)=>z-n);let S=Math.floor(m.length*.9),b=m[S]*7.5+24,E=Math.max(f+24,b);return Math.min(Math.max(50,E),800)})}a(wa,"estimateColumnWidths");var ur=a(e=>{let{state:r,headers:o,totalRows:a$1,getRow:s,error:i,progress:l,prefetchRange:f,sessionId:m,chunkCount:S,pinChunks:D,delimiter:b}=an(e),E={...ba,...e.labels},{query:z$1,onQueryChange:n,clearSearch:L,searchState:M,matchedIndices:C}=ln(m,S),v=C!==null,P=v?C.length:a$1,[k,Q]=useState([]),U=useRef(null),H=useRef(null),$=useRef(false),ae=useRef(false);useEffect(()=>{ae.current=false,$.current=false,Q([]);},[m]),useEffect(()=>{if(o.length===0||$.current||ae.current||a$1===0)return;let _=s(0);!_||_.length===0||(ae.current=true,Q(wa(o,s,a$1)));},[o,a$1,s]),useEffect(()=>()=>H.current?.(),[]);let pe=useCallback((_,G)=>{_.preventDefault(),$.current=true;let I=_.clientX,oe=k[G]??150;U.current={index:G,startX:I,startWidth:oe};let V=a(ee=>{if(!U.current)return;let fe=ee.clientX-I,te=Math.max(50,oe+fe);Q(O=>{let he=[...O];return he[G]=te,he});},"onMouseMove"),J=a(()=>{U.current=null,H.current=null,document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",J);},"onMouseUp");H.current=J,document.addEventListener("mousemove",V),document.addEventListener("mouseup",J);},[k]),ge=k.reduce((_,G)=>_+G,0),ke=useCallback(()=>jsx(ka,{children:o.map((_,G)=>jsxs(Sa,{style:{width:k[G]},children:[_,jsx(Ca,{onMouseDown:I=>pe(I,G)})]},G))}),[o,k,pe]),ue=useCallback(_=>{if(v&&C){let G=1/0,I=-1/0,oe=new Set,V=Math.min(_.endIndex,C.length-1);for(let J=_.startIndex;J<=V;J++){let ee=C[J];ee<G&&(G=ee),ee>I&&(I=ee),oe.add(Math.floor(ee/1e3));}D(Array.from(oe)),G!==1/0&&f(G,I);}else D([]),f(_.startIndex,_.endIndex);},[f,D,v,C]),ie=useCallback(_=>{let G=v&&C?C[_]:_,I=s(G);return I?o.map((oe,V)=>{let ee=V===o.length-1&&I.length>o.length?I.slice(V).join(b):I[V]??"";return jsx(dn,{style:{width:k[V]},children:ee},V)}):o.map((oe,V)=>jsx(dn,{style:{width:k[V]},children:jsx(Ma,{})},V))},[s,o,k,v,C,b]);return useEffect(()=>{if(P>0)if(v&&C){let{min:_,max:G}=va(C,0,50);_!==1/0&&f(_,G);}else f(0,50);},[P,v,C,f]),r==="idle"||r==="loading"||r==="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"}),r==="streaming"&&a$1>0&&jsxs(_a,{variant:"body",color:"text.lighter",style:{fontSize:12},children:[E.loading," ",a$1.toLocaleString()," ",E.rows,l>0?` (${Math.round(l*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:`${P.toLocaleString()} ${v?E.searchFound:E.rows}${v?` / ${a$1.toLocaleString()}`:""}`}),jsxs(Ea,{children:[jsx(Na,{type:"text",value:z$1,onChange:_=>n(_.target.value),placeholder:E.searchPlaceholder}),M==="searching"?jsx(La,{children:jsx(Ia,{})}):z$1?jsx(Ta,{onClick:L,type:"button",children:"\u2715"}):null]})]}),r==="partial_error"&&jsxs(tb,{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:E.retry})]}),jsx("div",{className:"flex-1 min-h-0",children:o.length>0&&jsx(TableVirtuoso,{totalCount:P,increaseViewportBy:300,fixedHeaderContent:ke,itemContent:ie,rangeChanged:ue,style:{height:"100%"},components:{Table:a(({style:_,context:G,...I})=>jsx(ya,{style:{..._,minWidth:"100%",width:ge},...I}),"Table"),TableHead:xa,TableRow:a(({context:_,...G})=>jsx(Da,{...G}),"TableRow")}},v?"filtered":"all")})]})},"CsvDriver"),ya=styled.table(({theme:e})=>`
|
|
173
174
|
border-collapse: separate;
|
|
174
175
|
border-spacing: 0;
|
|
175
176
|
table-layout: fixed;
|
|
176
177
|
font-size: 13px;
|
|
177
178
|
background-color: ${e.colors.background};
|
|
178
|
-
`),
|
|
179
|
+
`),xa=styled.thead(({theme:e})=>`
|
|
179
180
|
background-color: ${e.colors.background};
|
|
180
181
|
z-index: 1;
|
|
181
|
-
`),
|
|
182
|
+
`),ka=styled.tr``,Sa=styled.th(({theme:e})=>`
|
|
182
183
|
position: relative;
|
|
183
184
|
text-align: left;
|
|
184
185
|
padding: 8px 12px;
|
|
@@ -193,7 +194,7 @@ self.onmessage = async (e) => {
|
|
|
193
194
|
&:last-child {
|
|
194
195
|
border-right: none;
|
|
195
196
|
}
|
|
196
|
-
`),
|
|
197
|
+
`),Ca=styled.div(({theme:e})=>`
|
|
197
198
|
position: absolute;
|
|
198
199
|
right: 0;
|
|
199
200
|
top: 0;
|
|
@@ -205,11 +206,11 @@ self.onmessage = async (e) => {
|
|
|
205
206
|
background-color: ${e.colors.primary?.light};
|
|
206
207
|
opacity: 0.4;
|
|
207
208
|
}
|
|
208
|
-
`),
|
|
209
|
+
`),Da=styled.tr(({theme:e})=>`
|
|
209
210
|
&:hover {
|
|
210
211
|
background-color: ${e.colors.backgroundBase};
|
|
211
212
|
}
|
|
212
|
-
`),
|
|
213
|
+
`),dn=styled.td(({theme:e})=>`
|
|
213
214
|
padding: 6px 12px;
|
|
214
215
|
word-wrap: break-word;
|
|
215
216
|
overflow-wrap: break-word;
|
|
@@ -219,20 +220,20 @@ self.onmessage = async (e) => {
|
|
|
219
220
|
&:last-child {
|
|
220
221
|
border-right: none;
|
|
221
222
|
}
|
|
222
|
-
`),
|
|
223
|
+
`),Pa=keyframes`
|
|
223
224
|
0%, 100% { opacity: 0.4; }
|
|
224
225
|
50% { opacity: 1; }
|
|
225
|
-
`,
|
|
226
|
+
`,Ma=styled.div(({theme:e})=>css$1`
|
|
226
227
|
height: 12px;
|
|
227
228
|
width: 60%;
|
|
228
229
|
background: ${e.colors.stroke.light};
|
|
229
230
|
border-radius: 4px;
|
|
230
|
-
animation: ${
|
|
231
|
-
`),
|
|
231
|
+
animation: ${Pa} 1.5s ease-in-out infinite;
|
|
232
|
+
`),Ea=styled.div`
|
|
232
233
|
position: relative;
|
|
233
234
|
width: 200px;
|
|
234
235
|
flex-shrink: 0;
|
|
235
|
-
`,
|
|
236
|
+
`,Na=styled.input(({theme:e})=>`
|
|
236
237
|
padding: 4px 24px 4px 8px;
|
|
237
238
|
font-size: 12px;
|
|
238
239
|
border: 1px solid ${e.colors.stroke.light};
|
|
@@ -242,7 +243,7 @@ self.onmessage = async (e) => {
|
|
|
242
243
|
&:focus {
|
|
243
244
|
border-color: ${e.colors.primary?.main};
|
|
244
245
|
}
|
|
245
|
-
`),
|
|
246
|
+
`),Ta=styled.button(({theme:e})=>`
|
|
246
247
|
position: absolute;
|
|
247
248
|
right: 6px;
|
|
248
249
|
top: 50%;
|
|
@@ -257,25 +258,25 @@ self.onmessage = async (e) => {
|
|
|
257
258
|
&:hover {
|
|
258
259
|
color: ${e.colors.text?.main};
|
|
259
260
|
}
|
|
260
|
-
`),
|
|
261
|
+
`),La=styled.div`
|
|
261
262
|
position: absolute;
|
|
262
263
|
right: 6px;
|
|
263
264
|
top: 50%;
|
|
264
265
|
transform: translateY(-50%);
|
|
265
266
|
display: flex;
|
|
266
267
|
align-items: center;
|
|
267
|
-
`,
|
|
268
|
+
`,Ra=keyframes`
|
|
268
269
|
to { transform: rotate(360deg); }
|
|
269
|
-
`,
|
|
270
|
+
`,Ia=styled.div(({theme:e})=>css$1`
|
|
270
271
|
width: 14px;
|
|
271
272
|
height: 14px;
|
|
272
273
|
border: 2px solid ${e.colors.stroke.light};
|
|
273
274
|
border-top-color: ${e.colors.text?.light};
|
|
274
275
|
border-radius: 50%;
|
|
275
|
-
animation: ${
|
|
276
|
-
`);var
|
|
277
|
-
`){let i=e.slice(o,a).replace(/\r$/,"");i.trim()&&
|
|
278
|
-
`){let i=e.slice(o,a);i.trim()&&n.push(i),o=a+1;}}return [n,e.slice(o)]}a(_a,"splitLines");function ja(e,n){return e.stream?Promise.resolve(e.stream):e.blob?Promise.resolve(e.blob.stream()):e.url?fetch(e.url,{signal:n}).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.body}):Promise.reject(new Error("No source provided"))}a(ja,"resolveStream");function fn(e){let[n,o]=useState("idle"),[a,s]=useState(0),[i,c]=useState(null),[p,v]=useState(0),[S,P]=useState(0),h=useRef(e),T=useRef(0),A=useRef(0),r=useRef(new ht(10)),L=useRef(null),y=useRef(null),M=useRef(new Set),w=useRef(null),C=useRef(false),D=useCallback(async(V,ae)=>{let pe=L.current;if(!pe)return;let fe=Math.max(0,Math.floor(V/1e3)-2),ke=Math.min(T.current-1,Math.floor(ae/1e3)+2),ce=false;for(let z=fe;z<=ke;z++)if(r.current.get(z)===void 0&&!M.current.has(z)){M.current.add(z);try{let F=await pe.get(z);F&&(r.current.set(z,F),ce=!0);}finally{M.current.delete(z);}}ce&&P(z=>z+1);},[]),K=useCallback(V=>{let ae=Math.floor(V/1e3),pe=V%1e3;return r.current.get(ae)?.[pe]},[S]),U=useCallback(async()=>{C.current=true;let V=new AbortController;y.current=V,await L.current?.destroy();let ae=await Wt();L.current=ae,T.current=0,A.current=0,r.current.clear(),s(0),c(null),v(0),o("loading");let pe=h.current;try{let fe=await ja(pe,V.signal);o("streaming");let ke=fe.getReader(),ce=new TextDecoder("utf-8"),z="",F=[],de=0,j=0,G=pe.blob?.size||0;for(;;){if(V.signal.aborted)return;let{done:re,value:Q}=await ke.read();if(re)break;de+=Q.byteLength,G&&v(de/G),z+=ce.decode(Q,{stream:!0});let[he,ue]=_a(z);z=ue;for(let ee of he)if(F.push(ee),F.length>=1e3){let B=T.current;await ae.set(B,F),B<3&&r.current.set(B,F),T.current+=1,j+=F.length,F=[],A.current=j,w.current||(w.current=requestAnimationFrame(()=>{s(A.current),w.current=null;}));}}z.trim()&&F.push(z.trim()),F.length>0&&(await ae.set(T.current,F),T.current+=1,j+=F.length),w.current&&(cancelAnimationFrame(w.current),w.current=null),s(j),v(1),o("done");}catch(fe){if(V.signal.aborted)return;let ke=fe instanceof Error?fe.message:"Unknown error";c(ke),o("partial_error");}finally{C.current=false;}},[]),W=useRef(false);return useEffect(()=>(W.current=true,C.current||U(),()=>{W.current=false,queueMicrotask(()=>{W.current||(y.current?.abort(),L.current?.destroy(),w.current&&cancelAnimationFrame(w.current));});}),[U]),{state:n,totalLines:a,getLine:K,error:i,progress:p,prefetchRange:D}}a(fn,"useNdjsonStream");var br=a(e=>{let{state:n,totalLines:o,getLine:a,error:s,progress:i,prefetchRange:c}=fn(e),{mode:p}=useTheme(),v=useCallback(h=>{c(h.startIndex,h.endIndex);},[c]),S=useCallback(h=>{let T=a(h);if(!T)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(T);}catch{r=true;}return r?jsx("div",{className:"py-2 px-4 max-w-full font-sans text-base text-zinc-900 dark:text-gray-300 break-all text-wrap whitespace-pre-wrap select-text",children:T}):jsx("div",{className:"select-text",children:jsx(JsonView,{data:A,style:p==="dark"?fr:hr,shouldExpandNode:allExpanded,clickToExpandNode:true})})},[a,p]),P=useRef(false);return useEffect(()=>{o>0&&!P.current&&(P.current=true,c(0,50));},[o,c]),n==="idle"||n==="loading"||n==="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"}),n==="streaming"&&o>0&&jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[o.toLocaleString()," records",i>0?` (${Math.round(i*100)}%)`:""]})]}):jsxs("div",{className:"h-full w-full flex flex-col",children:[n==="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:s})}),jsx("div",{className:"flex-1 min-h-0",children:jsx(Virtuoso,{totalCount:o,itemContent:S,rangeChanged:v,increaseViewportBy:300,defaultItemHeight:40,style:{height:"100%"}})})]})},"NdjsonDriver");var gn=memo(a(function({extension:n,blob:o,path:a,buffer:s,stream:i,csvLabels:c,onCsvRetry:p,not_supported_message:v=" Sorry, this file type isn\u2019t supported yet."}){let S=n.toLocaleLowerCase().trim(),P;if(a?P=a:o&&(P=URL.createObjectURL(o)),["csv","tsv","psv","dsv"].includes(S))return jsx(ur,{url:P,blob:o,stream:i,labels:c,onRetry:p});if(["ndjson","jsonl"].includes(S))return jsx(br,{url:P,blob:o,stream:i});if(P){if(["jpeg","jpg","png","gif","bmp","ico","svg","tiff","webp"].includes(S))return jsx(Hr,{url:P});if(["aac","ac3","aiff","amr","dts","flac","m4a","mp3","ogg","opus","wav","wma"].includes(S))return jsx($r,{url:P});if(["3gp","avi","dv","flv","m2ts","m4v","mkv","mov","mp4","mpeg","mpg","mts","ogv","vob","webm"].includes(S))return jsx(Qr,{url:P});if(n==="pdf")return jsx(tr,{url:P});if(S==="json")return jsx(pn,{url:P});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(S))return jsx(Jr,{url:P,extension:S})}return S==="docx"?jsx(qr,{url:P,blob:o}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(tb,{className:"mx-5",children:jsx(_a$1,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:v})})})},"Driver"));var up=a(e=>jsx("div",{className:"h-full w-full",children:jsx(gn,{...e})}),"FileViewer");var vn=250,Sp=a(({text:e,speed:n=50,onDone:o,markdown:a$1=false,markdownComponents:s={},className:i,...c})=>{let[p,v]=useState(""),S=useRef(null),P=useRef(null);return useEffect(()=>{let h=false;if(n>0){v(""),S.current=performance.now();let T=a(A=>{if(h||!S.current)return;let r=A-S.current,L=r/n>vn?n/2:n,y=r/n>vn?1.5:1,M=Math.floor(r/L*y);if(M>=e.length){v(e),h=true,o?.();return}v(e.slice(0,M)),P.current=requestAnimationFrame(T);},"tick");P.current=requestAnimationFrame(T);}else v(e),o?.();return ()=>{P.current&&cancelAnimationFrame(P.current);}},[e,n,o]),a$1?jsx("div",{className:i,children:jsx(Ho,{remarkPlugins:[Wo],components:s,...c,children:p})}):jsx(_a$1,{className:i,...c,children:p})},"Typewriter");var ei={timeout:2e3,message:"Copied!"},zp=a(({text:e,children:n,format:o="text/plain",tooltip:a$1,positions:s=["top"],className:i})=>{let[c,p]=useState(false),v=useRef(null),S={...ei,...a$1},P=Array.isArray(s)?s[0]:s,h=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(e):Za(e,{format:o}),p(true),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>p(false),S.timeout);},"handleCopy");return useEffect(()=>()=>{v.current&&clearTimeout(v.current);},[]),jsx(Popover,{padding:6,positions:s,isOpen:c,align:"center",onClickOutside:()=>p(false),content:!!a$1?.message&&jsx(nb,{className:i,$position:P,$offset:6,children:a$1.message}),containerStyle:{zIndex:"9999"},children:jsx("div",{className:"inline-block",onMouseLeave:()=>p(false),children:n({copy:h})})})},"CopyToClipboard");var yn=a(e=>new Date(e?Array.isArray(e)?e[1]||e[0]||new Date:e:new Date),"getInitValue"),Jt=a((e,n)=>{let o;if(n){let s=parse(e||"",n,new Date);if(isValid(s)&&getYear(s)>=1970)return s}let a=new Date(e||"");return isNaN(a.getTime())?o:a},"parseDate"),ci=a((e,n)=>{let o=e?Jt(e,n):void 0;return o&&n?format(o,n):e},"renderDate"),Yp=a(({value:e,range:n,inline:o=false,minDate:a=new Date(getYear(new Date)-5,0,1),maxDate:s=new Date(getYear(new Date)+5,11,31),format:i="dd.MM.yyyy",onChange:c,...p})=>{let[v,S]=useState(getMonth(yn(e))),[P,h]=useState(getYear(yn(e))),T=useMemo(()=>{if(e){if(Array.isArray(e)){let r=Jt(e[0],i),L=Jt(e[1],i);return [r,L]}return Jt(e,i)}},[e]),A=useCallback(r=>{if(n){let L=!!(T&&Array.isArray(T)&&T[0]),y=!!(T&&Array.isArray(T)&&T[1]);!L||L&&y?c?.([r.toString(),""]):L&&!y&&(r<T[0]?c?.([r.toString(),T[0].toString()]):c?.([T[0].toString(),r.toString()]));}else c?.(r.toString());},[n,T,c]);return o?jsx(xn,{month:v,year:P,minDate:a,maxDate:s,selectedDate:T,onSelectDate:A,onChangeMonth:S,onChangeYear:h}):n?jsx(di,{range:true,value:e,onChange:c,...p}):jsx(ui,{value:e,onChange:c,minDate:a,maxDate:s,month:v,year:P,selectedDate:T,onChangeMonth:S,onChangeYear:h,onSelectDate:A,formatStr:i,...p})},"DatePicker"),di=a(({minDate:e,maxDate:n,value:o,onChange:a})=>null,"DatePickerGroupInput"),ui=a(({placeholder:e,value:n,onChange:o,inputProps:a,...s})=>{let[i,c]=useState(false),p=y(),v=useCallback(()=>{c(false);},[]);return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:i,onClickOutside:()=>c(false),content:jsx(tb,{children:jsx(xn,{...s,onClose:v})}),containerStyle:{zIndex:`${p.zIndex.popover}`},children:jsx("div",{onClick:()=>c(true),children:jsx(ob,{...a,placeholder:e,value:ci(n,s.formatStr),onChange:S=>o?.(S.target.value)})})})},"DatePickerInput"),xn=a(({month:e,year:n,selectedDate:o,minDate:a,maxDate:s,onSelectDate:i,onChangeMonth:c,onChangeYear:p,onClose:v})=>{let S=useMemo(()=>new Array(12).fill(null).map((w,C)=>{let D=new Date(0,C);return {value:C+1,inputDisplay:format(D,"MMMM")}}),[]),P=useMemo(()=>{let w=getYear(a),D=getYear(s)-w+1;return new Array(D).fill(null).map((K,U)=>{let W=w+U;return {value:W,inputDisplay:W.toString()}})},[a,s]),h=useMemo(()=>new Array(7).fill(null).map((w,C)=>{let D=startOfWeek(new Date,{weekStartsOn:C});return format(D,"EEE")}),[]),T=useMemo(()=>{let w=startOfMonth(new Date(n,e)),C=endOfMonth(new Date(n,e)),D=getDay(w)===0?w:previousSunday(w),K=getDay(C)===6?C:nextSaturday(C),U=differenceInDays(K,D),W=differenceInDays(w,D);return new Array(U+1).fill(null).map((V,ae)=>new Date(n,e,ae-W+1))},[e,n]),A=useCallback(()=>{e===0?(p(n-1),c(11)):c(e-1);},[e,n]),r=useCallback(()=>{e===11?(p(n+1),c(0)):c(e+1);},[e,n]),L=useMemo(()=>a?!(n<getYear(a)||n===getYear(a)&&e<=getMonth(a)):true,[e,n,a]),y=useMemo(()=>s?!(n>getYear(s)||n===getYear(s)&&e>=getMonth(s)):true,[e,n,s]),M=useCallback(w=>{w.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:M,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:S,onSelect:w=>c(w-1),maxWidth:150,maxHeight:300}),jsx(kb,{placeholder:"",hasBorder:false,selected:n,options:P,onSelect:w=>p(w),maxWidth:100,maxHeight:300})]}),y&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:r})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:h.map(w=>jsx("div",{className:"text-center",children:w},w))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:T.map(w=>{let C=getMonth(w)===e,D=format(w,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),K=o&&(Array.isArray(o)&&(o[0]&&format(w,"yyyy-MM-dd")===format(o[0],"yyyy-MM-dd")||o[1]&&format(w,"yyyy-MM-dd")===format(o[1],"yyyy-MM-dd"))||!Array.isArray(o)&&format(w,"yyyy-MM-dd")===format(o,"yyyy-MM-dd")),U=o&&Array.isArray(o)&&o[0]&&o[1]&&w>o[0]&&w<o[1],W=a&&differenceInDays(w,a)<0||s&&differenceInDays(w,s)>0||!C;return jsx(pi,{date:w,isCurrentMonth:C,isCurrentDay:D,isSelected:!!K,isInRange:!!U,isDisabled:!!W,onSelectDate:V=>{i(V),v?.();}},w.toISOString())})})]})},"DatePickerCalendar"),pi=a(({date:e,isCurrentMonth:n,isCurrentDay:o,isSelected:a$1,isInRange:s,isDisabled:i,onSelectDate:c})=>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":s?"bg-blue-100 dark:bg-blue-900/30":o?"text-blue-500":n?"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||c(e);},"handleClick"),children:format(e,"d")}),"CalendarDay");var gi=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"),mi=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"),bi=a(e=>{switch(e){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),Dn=a(({id:e,color:n="default",message:o,duration:a,transitionDirection:s,cancelable:i=true,onClose:c})=>{let[p,v]=useState(false),[S,P]=useState(false),h=useRef(null),T=useCallback(()=>{v(true),h.current=setTimeout(()=>{c(e);},300);},[e,c]);return useEffect(()=>{if(P(true),a&&a<1/0){let A=setTimeout(()=>{T();},a);return ()=>clearTimeout(A)}},[a,T]),useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]),jsx("div",{className:`max-w-xs
|
|
276
|
+
animation: ${Ra} 0.6s linear infinite;
|
|
277
|
+
`);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},gn=a(({url:e})=>{let[r,o]=useState(null),[a,s]=useState(true),[i,l]=useState(null),{mode:f}=useTheme();return useEffect(()=>{let m=new AbortController;return s(true),l(null),o(null),fetch(e,{signal:m.signal}).then(S=>{if(!S.ok)throw new Error(`HTTP ${S.status}: ${S.statusText}`);return S.text()}).then(S=>{try{o(JSON.parse(S));}catch{l("Invalid JSON");}}).catch(S=>{S instanceof Error&&S.name==="AbortError"||l(S instanceof Error?S.message:"Failed to load");}).finally(()=>{m.signal.aborted||s(false);}),()=>m.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:r,style:f==="dark"?pr:hr,shouldExpandNode:allExpanded,clickToExpandNode:true})})},"JsonDriver");function Oa(e){let r=[],o=0;for(let a=0;a<e.length;a++){let s=e[a];if(s===`
|
|
278
|
+
`){let i=e.slice(o,a).replace(/\r$/,"");i.trim()&&r.push(i),o=a+1;}else if(s==="\r"&&e[a+1]!==`
|
|
279
|
+
`){let i=e.slice(o,a);i.trim()&&r.push(i),o=a+1;}}return [r,e.slice(o)]}a(Oa,"splitLines");function Ba(e,r){return e.stream?Promise.resolve(e.stream):e.blob?Promise.resolve(e.blob.stream()):e.url?fetch(e.url,{signal:r}).then(o=>{if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.body}):Promise.reject(new Error("No source provided"))}a(Ba,"resolveStream");function mn(e){let[r,o]=useState("idle"),[a,s]=useState(0),[i,l]=useState(null),[f,m]=useState(0),[S,D]=useState(0),b=useRef(e),E=useRef(0),z=useRef(0),n=useRef(new ht(10)),L=useRef(null),M=useRef(null),C=useRef(new Set),v=useRef(null),P=useRef(false),k=useCallback(async($,ae)=>{let pe=L.current;if(!pe)return;let ge=Math.max(0,Math.floor($/1e3)-2),ke=Math.min(E.current-1,Math.floor(ae/1e3)+2),ue=false;for(let ie=ge;ie<=ke;ie++)if(n.current.get(ie)===void 0&&!C.current.has(ie)){C.current.add(ie);try{let _=await pe.get(ie);_&&(n.current.set(ie,_),ue=!0);}finally{C.current.delete(ie);}}ue&&D(ie=>ie+1);},[]),Q=useCallback($=>{let ae=Math.floor($/1e3),pe=$%1e3;return n.current.get(ae)?.[pe]},[S]),U=useCallback(async()=>{P.current=true;let $=new AbortController;M.current=$,await L.current?.destroy();let ae=await Wt();L.current=ae,E.current=0,z.current=0,n.current.clear(),s(0),l(null),m(0),o("loading");let pe=b.current;try{let ge=await Ba(pe,$.signal);o("streaming");let ke=ge.getReader(),ue=new TextDecoder("utf-8"),ie="",_=[],G=0,I=0,oe=pe.blob?.size||0;for(;;){if($.signal.aborted)return;let{done:V,value:J}=await ke.read();if(V)break;G+=J.byteLength,oe&&m(G/oe),ie+=ue.decode(J,{stream:!0});let[ee,fe]=Oa(ie);ie=fe;for(let te of ee)if(_.push(te),_.length>=1e3){let O=E.current;await ae.set(O,_),O<3&&n.current.set(O,_),E.current+=1,I+=_.length,_=[],z.current=I,v.current||(v.current=requestAnimationFrame(()=>{s(z.current),v.current=null;}));}}ie.trim()&&_.push(ie.trim()),_.length>0&&(await ae.set(E.current,_),E.current+=1,I+=_.length),v.current&&(cancelAnimationFrame(v.current),v.current=null),s(I),m(1),o("done");}catch(ge){if($.signal.aborted)return;let ke=ge instanceof Error?ge.message:"Unknown error";l(ke),o("partial_error");}finally{P.current=false;}},[]),H=useRef(false);return useEffect(()=>(H.current=true,P.current||U(),()=>{H.current=false,queueMicrotask(()=>{H.current||(M.current?.abort(),L.current?.destroy(),v.current&&cancelAnimationFrame(v.current));});}),[U]),{state:r,totalLines:a,getLine:Q,error:i,progress:f,prefetchRange:k}}a(mn,"useNdjsonStream");var br=a(e=>{let{state:r,totalLines:o,getLine:a,error:s,progress:i,prefetchRange:l}=mn(e),{mode:f}=useTheme(),m=useCallback(b=>{l(b.startIndex,b.endIndex);},[l]),S=useCallback(b=>{let E=a(b);if(!E)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 z,n=false;try{z=JSON.parse(E);}catch{n=true;}return n?jsx("div",{className:"py-2 px-4 max-w-full font-sans text-base text-zinc-900 dark:text-gray-300 break-all text-wrap whitespace-pre-wrap select-text",children:E}):jsx("div",{className:"select-text",children:jsx(JsonView,{data:z,style:f==="dark"?pr:hr,shouldExpandNode:allExpanded,clickToExpandNode:true})})},[a,f]),D=useRef(false);return useEffect(()=>{o>0&&!D.current&&(D.current=true,l(0,50));},[o,l]),r==="idle"||r==="loading"||r==="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"}),r==="streaming"&&o>0&&jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:[o.toLocaleString()," records",i>0?` (${Math.round(i*100)}%)`:""]})]}):jsxs("div",{className:"h-full w-full flex flex-col",children:[r==="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:s})}),jsx("div",{className:"flex-1 min-h-0",children:jsx(Virtuoso,{totalCount:o,itemContent:S,rangeChanged:m,increaseViewportBy:300,defaultItemHeight:40,style:{height:"100%"}})})]})},"NdjsonDriver");var vn=memo(a(function({extension:r,blob:o,path:a,buffer:s,stream:i,csvLabels:l,onCsvRetry:f,not_supported_message:m=" Sorry, this file type isn\u2019t supported yet."}){let S=r.toLocaleLowerCase().trim(),D;if(a?D=a:o&&(D=URL.createObjectURL(o)),["csv","tsv","psv","dsv"].includes(S))return jsx(ur,{url:D,blob:o,stream:i,labels:l,onRetry:f});if(["ndjson","jsonl"].includes(S))return jsx(br,{url:D,blob:o,stream:i});if(D){if(["jpeg","jpg","png","gif","bmp","ico","svg","tiff","webp"].includes(S))return jsx(Hr,{url:D});if(["aac","ac3","aiff","amr","dts","flac","m4a","mp3","ogg","opus","wav","wma"].includes(S))return jsx($r,{url:D});if(["3gp","avi","dv","flv","m2ts","m4v","mkv","mov","mp4","mpeg","mpg","mts","ogv","vob","webm"].includes(S))return jsx(Qr,{url:D});if(r==="pdf")return jsx(tr,{url:D});if(S==="json")return jsx(gn,{url:D});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(S))return jsx(Jr,{url:D,extension:S})}return S==="docx"?jsx(qr,{url:D,blob:o}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(tb,{className:"mx-5",children:jsx(_a,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:m})})})},"Driver"));var gf=a(e=>jsx("div",{className:"h-full w-full",children:jsx(vn,{...e})}),"FileViewer");var xn=250,Mf=a(({text:e,speed:r=50,onDone:o,markdown:a$1=false,markdownComponents:s={},className:i,...l})=>{let[f,m]=useState(""),S=useRef(null),D=useRef(null);return useEffect(()=>{let b=false;if(r>0){m(""),S.current=performance.now();let E=a(z=>{if(b||!S.current)return;let n=z-S.current,L=n/r>xn?r/2:r,M=n/r>xn?1.5:1,C=Math.floor(n/L*M);if(C>=e.length){m(e),b=true,o?.();return}m(e.slice(0,C)),D.current=requestAnimationFrame(E);},"tick");D.current=requestAnimationFrame(E);}else m(e),o?.();return ()=>{D.current&&cancelAnimationFrame(D.current);}},[e,r,o]),a$1?jsx("div",{className:i,children:jsx(Xo,{remarkPlugins:[Vo],components:s,...l,children:f})}):jsx(_a,{className:i,...l,children:f})},"Typewriter");var ni={timeout:2e3,message:"Copied!"},Of=a(({text:e,children:r,format:o="text/plain",tooltip:a$1,positions:s=["top"],className:i})=>{let[l,f]=useState(false),m=useRef(null),S={...ni,...a$1},D=Array.isArray(s)?s[0]:s,b=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(e):Ka(e,{format:o}),f(true),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>f(false),S.timeout);},"handleCopy");return useEffect(()=>()=>{m.current&&clearTimeout(m.current);},[]),jsx(Popover,{padding:6,positions:s,isOpen:l,align:"center",onClickOutside:()=>f(false),content:!!a$1?.message&&jsx(nb,{className:i,$position:D,$offset:6,children:a$1.message}),containerStyle:{zIndex:"9999"},children:jsx("div",{className:"inline-block",onMouseLeave:()=>f(false),children:r({copy:b})})})},"CopyToClipboard");var Sn=a(e=>new Date(e?Array.isArray(e)?e[1]||e[0]||new Date:e:new Date),"getInitValue"),Jt=a((e,r)=>{let o;if(r){let s=parse(e||"",r,new Date);if(isValid(s)&&getYear(s)>=1970)return s}let a=new Date(e||"");return isNaN(a.getTime())?o:a},"parseDate"),fi=a((e,r)=>{let o=e?Jt(e,r):void 0;return o&&r?format(o,r):e},"renderDate"),Kf=a(({value:e,range:r,inline:o=false,minDate:a=new Date(getYear(new Date)-5,0,1),maxDate:s=new Date(getYear(new Date)+5,11,31),format:i="dd.MM.yyyy",onChange:l,...f})=>{let[m,S]=useState(getMonth(Sn(e))),[D,b]=useState(getYear(Sn(e))),E=useMemo(()=>{if(e){if(Array.isArray(e)){let n=Jt(e[0],i),L=Jt(e[1],i);return [n,L]}return Jt(e,i)}},[e]),z=useCallback(n=>{if(r){let L=!!(E&&Array.isArray(E)&&E[0]),M=!!(E&&Array.isArray(E)&&E[1]);!L||L&&M?l?.([n.toString(),""]):L&&!M&&(n<E[0]?l?.([n.toString(),E[0].toString()]):l?.([E[0].toString(),n.toString()]));}else l?.(n.toString());},[r,E,l]);return o?jsx(Cn,{month:m,year:D,minDate:a,maxDate:s,selectedDate:E,onSelectDate:z,onChangeMonth:S,onChangeYear:b}):r?jsx(pi,{range:true,value:e,onChange:l,...f}):jsx(hi,{value:e,onChange:l,minDate:a,maxDate:s,month:m,year:D,selectedDate:E,onChangeMonth:S,onChangeYear:b,onSelectDate:z,formatStr:i,...f})},"DatePicker"),pi=a(({minDate:e,maxDate:r,value:o,onChange:a})=>null,"DatePickerGroupInput"),hi=a(({placeholder:e,value:r,onChange:o,inputProps:a,...s})=>{let[i,l]=useState(false),f=y(),m=useCallback(()=>{l(false);},[]);return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:i,onClickOutside:()=>l(false),content:jsx(tb,{children:jsx(Cn,{...s,onClose:m})}),containerStyle:{zIndex:`${f.zIndex.popover}`},children:jsx("div",{onClick:()=>l(true),children:jsx(ob,{...a,placeholder:e,value:fi(r,s.formatStr),onChange:S=>o?.(S.target.value)})})})},"DatePickerInput"),Cn=a(({month:e,year:r,selectedDate:o,minDate:a,maxDate:s,onSelectDate:i,onChangeMonth:l,onChangeYear:f,onClose:m})=>{let S=useMemo(()=>new Array(12).fill(null).map((v,P)=>{let k=new Date(0,P);return {value:P+1,inputDisplay:format(k,"MMMM")}}),[]),D=useMemo(()=>{let v=getYear(a),k=getYear(s)-v+1;return new Array(k).fill(null).map((Q,U)=>{let H=v+U;return {value:H,inputDisplay:H.toString()}})},[a,s]),b=useMemo(()=>new Array(7).fill(null).map((v,P)=>{let k=startOfWeek(new Date,{weekStartsOn:P});return format(k,"EEE")}),[]),E=useMemo(()=>{let v=startOfMonth(new Date(r,e)),P=endOfMonth(new Date(r,e)),k=getDay(v)===0?v:previousSunday(v),Q=getDay(P)===6?P:nextSaturday(P),U=differenceInDays(Q,k),H=differenceInDays(v,k);return new Array(U+1).fill(null).map(($,ae)=>new Date(r,e,ae-H+1))},[e,r]),z$1=useCallback(()=>{e===0?(f(r-1),l(11)):l(e-1);},[e,r]),n=useCallback(()=>{e===11?(f(r+1),l(0)):l(e+1);},[e,r]),L=useMemo(()=>a?!(r<getYear(a)||r===getYear(a)&&e<=getMonth(a)):true,[e,r,a]),M=useMemo(()=>s?!(r>getYear(s)||r===getYear(s)&&e>=getMonth(s)):true,[e,r,s]),C=useCallback(v=>{v.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:C,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:z$1}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(kb,{placeholder:"",hasBorder:false,selected:e+1,options:S,onSelect:v=>l(v-1),maxWidth:150,maxHeight:300}),jsx(kb,{placeholder:"",hasBorder:false,selected:r,options:D,onSelect:v=>f(v),maxWidth:100,maxHeight:300})]}),M&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:n})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:b.map(v=>jsx("div",{className:"text-center",children:v},v))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:E.map(v=>{let P=getMonth(v)===e,k=format(v,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),Q=o&&(Array.isArray(o)&&(o[0]&&format(v,"yyyy-MM-dd")===format(o[0],"yyyy-MM-dd")||o[1]&&format(v,"yyyy-MM-dd")===format(o[1],"yyyy-MM-dd"))||!Array.isArray(o)&&format(v,"yyyy-MM-dd")===format(o,"yyyy-MM-dd")),U=o&&Array.isArray(o)&&o[0]&&o[1]&&v>o[0]&&v<o[1],H=a&&differenceInDays(v,a)<0||s&&differenceInDays(v,s)>0||!P;return jsx(gi,{date:v,isCurrentMonth:P,isCurrentDay:k,isSelected:!!Q,isInRange:!!U,isDisabled:!!H,onSelectDate:$=>{i($),m?.();}},v.toISOString())})})]})},"DatePickerCalendar"),gi=a(({date:e,isCurrentMonth:r,isCurrentDay:o,isSelected:a$1,isInRange:s,isDisabled:i,onSelectDate:l})=>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":s?"bg-blue-100 dark:bg-blue-900/30":o?"text-blue-500":r?"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(m=>{i||l(e);},"handleClick"),children:format(e,"d")}),"CalendarDay");var vi=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"),wi=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"),yi=a(e=>{switch(e){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),En=a(({id:e,color:r="default",message:o,duration:a,transitionDirection:s,cancelable:i=true,onClose:l})=>{let[f,m]=useState(false),[S,D]=useState(false),b=useRef(null),E=useCallback(()=>{m(true),b.current=setTimeout(()=>{l(e);},300);},[e,l]);return useEffect(()=>{if(D(true),a&&a<1/0){let z=setTimeout(()=>{E();},a);return ()=>clearTimeout(z)}},[a,E]),useEffect(()=>()=>{b.current&&clearTimeout(b.current);},[]),jsx("div",{className:`max-w-xs
|
|
279
280
|
border
|
|
280
281
|
w-full
|
|
281
282
|
text-sm
|
|
@@ -283,8 +284,8 @@ self.onmessage = async (e) => {
|
|
|
283
284
|
transition-all
|
|
284
285
|
ease-in-out
|
|
285
286
|
duration-300
|
|
286
|
-
${
|
|
287
|
-
${S?"translate-y-0":
|
|
288
|
-
${
|
|
289
|
-
export{
|
|
287
|
+
${f||!S?"opacity-0":"opacity-100"}
|
|
288
|
+
${S?"translate-y-0":yi(s)}
|
|
289
|
+
${vi(r)} ${wi(r)}`,children:jsxs("div",{className:"flex p-4 items-center",style:{wordBreak:"break-word"},children:[o,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:E,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 ki=a((e,r)=>{switch(e){case "top-right":return `top-${r} right-${r}`;case "top-left":return `top-${r} left-${r}`;case "bottom-right":return `bottom-${r} right-${r}`;case "bottom-left":return `bottom-${r} left-${r}`;default:return `top-${r} right-${r}`}},"getPosition"),up=a(({items:e,onClose:r,position:o="top-right",offset:a=4})=>{let s=useMemo(()=>o.startsWith("top")?"top":"bottom",[o]);return jsx("div",{className:`fixed flex min-w-0 max-w-xs w-full flex-col z-50 gap-2 ${ki(o,a)}`,children:e.map(i=>jsx(En,{transitionDirection:s,...i,onClose:r},i.id))})},"ToastsList");var xp=a(({onChange:e,disabled:r,multiple:o,dragText:a$1="Drop file to upload",className:s})=>{let[i,l]=useState(false),[f,m]=useState(false),[S,D]=useState(false);return useEffect(()=>{if(r)return;let b=0,E=a(M=>{M.preventDefault(),M.dataTransfer?.types.includes("Files")&&(b++,b===1&&l(true));},"handleDragEnter"),z=a(M=>{M.preventDefault(),M.dataTransfer?.types.includes("Files")&&(b--,b===0&&l(false));},"handleDragLeave"),n=a(M=>{M.preventDefault();},"handleDragOver"),L=a(async M=>{if(M.preventDefault(),b=0,l(false),!!M.dataTransfer?.types.includes("Files")&&!f)try{m(!0);let C=await pb(M.dataTransfer.items);e(o?C:C.length>0?[C[0]]:[]);}catch(C){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:",C);}finally{m(false);}},"handleDrop");return document.addEventListener("dragenter",E),document.addEventListener("dragleave",z),document.addEventListener("dragover",n),document.addEventListener("drop",L),()=>{document.removeEventListener("dragenter",E),document.removeEventListener("dragleave",z),document.removeEventListener("dragover",n),document.removeEventListener("drop",L);}},[r,f,o,e]),useEffect(()=>{D(true);},[]),S&&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 ${s}`,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");
|
|
290
|
+
export{hc as Container,Of as CopyToClipboard,Kf as DatePicker,Cn as DatePickerCalendar,gf as FileViewer,Jc as FullscreenCard,xp as GlobalDropZone,vo as Graph2D,Kl as PageContent,ql as PageLayout,yc as SplitterLayout,On as Styled,In as StyledContainer,_n as StyledMain,nc as SubNav,up as ToastsList,Mf as Typewriter};//# sourceMappingURL=index.mjs.map
|
|
290
291
|
//# sourceMappingURL=index.mjs.map
|