@cyber-harbour/ui 2.2.10 → 2.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import {a,w,x,u,c,l,z,Pa as Pa$1,Ya,ma,ra,pb,Cb,y,kb,G,ib,H,lb}from'./chunk-QGB7ELQG.mjs';export{tb as Alert,A as AlertIcon,za as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ia as BallsMenu,pb as Box,q as BreakpointProvider,E as BugReportIcon,Na as BurgerMenuIcon,sa as BusIcon,z as Button,F as CalendarIcon,ta as CarIcon,Kb as ChatField,ja as CheckIcon,vb as Checkbox,ka as ChevronDownIcon,G as ChevronLeftIcon,H as ChevronRightIcon,la as ChevronUpIcon,Oa as ClockIcon,I as CloseCircleIcon,J as ClosedLockIcon,Db as ContentLoader,fb as ContextMenu,gb as ContextMenuDelimiter,qa as CrossIcon,K as DataSetsIcon,L as DeepSearchIcon,M as DisabledVisibleIcon,N as DocsIcon,O as DownloadIcon,yb as Drawer,Ab as DrawerBody,zb as DrawerHeader,P as EditUserIcon,rb as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,Ra as FaceSearchIcon,mb as FileField,xa as FileIcon,S as FiltersIcon,Ia as FlashIcon,nb as FlexContainer,ob as FlexItem,Ba as FolderAlertIcon,Ja as FolderInfoIcon,ab as Header,bb as HeaderDelimeter,cb as HeaderSection,T as HomepageIcon,Qa as ImageIcon,oa as InfoCircleFilledIcon,U as InfoCircleIcon,kb as Input,ya as IosIcon,ub as Label,qb as Line,wb as LinerProgress,Za as ListMenu,_a as ListMenuItem,$a as ListMenuSection,V as MapRadarIcon,ra as MaximizeIcon,Sa as MessageAsteriskIcon,Aa as MicrosoftIcon,Pa as MinusIcon,Fb as Modal,Hb as ModalBody,Ib as ModalFooter,Gb as ModalHeader,W as MoonIcon,X as OpenLockIcon,Y as OrganizationIcon,Eb as Overlay,eb as Pagination,Ea as PassportIcon,Z as PasswordFinderIcon,Ga as PencilIcon,_ as PhonebookIcon,va as PlaneIcon,ma as PlusIcon,Fa as PointIcon,$ as PrintIcon,aa as Profiler2Icon,ba as ProfilerIcon,Lb as ProgressLoader,Ca as RelationIcon,Da as RelationPointsIcon,Ka as RotateLeftIcon,La as RotateRightIcon,jb as RowActionsMenu,ca as SandBoxIcon,da as SearchIcon,ib as Select,wa as ShipIcon,Ua as Sidebar,Ta as SidebarContext,Wa as SidebarDelimeter,Va as SidebarItem,Xa as SidebarSection,ea as StatisticIcon,Cb as StyledTooltipContent,fa as SunIcon,xb as Switch,db as Table,sb as Tag,Jb as TailwindExample,s as ThemeProvider,Bb as Tooltip,Ya as Typography,pa as UnfoldIcon,ga as UpRightArrowCircleIcon,Ma as UploadImageIcon,Ha as UserInCircleIcon,na as UsersIcon,ha as VectorIcon,ua as WayIcon,f as convertPaletteToRem,w as createComponent,x as createStyledComponent,p as darkTheme,o as darkThemePx,t as destructSpaceProps,u as generatePropertySpaceStyle,k as getBreakpoint,h as getButtonSizeStyles,g as getButtonStyles,i as getInputStyles,v as getResponsiveProps,j as getTypographyStyles,l as hexToRgba,n as lightTheme,m as lightThemePx,e as propToRem,c as pxToRem,d as remToPx,b as resolveThemeColor,r as useBreakpoint,hb as useContextMenuControl,y as useTheme}from'./chunk-QGB7ELQG.mjs';import xo,{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 No from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import wo from'react-content-loader';import {renderAsync}from'docx-preview';import tn from'lodash.throttle';import nn from'@uiw/react-codemirror';import {vscodeDark,vscodeLight}from'@uiw/codemirror-theme-vscode';import {javascript}from'@codemirror/lang-javascript';import {json}from'@codemirror/lang-json';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 mn from'react-markdown';import bn from'remark-gfm';import {TableVirtuoso}from'react-virtuoso';import Bt from'papaparse';import oa 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 Ks=a(({children:r,className:o})=>jsx(oo,{className:o,children:r}),"PageLayout"),oo=styled.div`
1
+ import {a,w,x,u,c,l,z,Pa as Pa$1,Ya,ma,ra,pb,Cb,y,kb,G,ib,H,lb}from'./chunk-2JO77E5F.mjs';export{tb as Alert,A as AlertIcon,za as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ia as BallsMenu,pb as Box,q as BreakpointProvider,E as BugReportIcon,Na as BurgerMenuIcon,sa as BusIcon,z as Button,F as CalendarIcon,ta as CarIcon,Kb as ChatField,ja as CheckIcon,vb as Checkbox,ka as ChevronDownIcon,G as ChevronLeftIcon,H as ChevronRightIcon,la as ChevronUpIcon,Oa as ClockIcon,I as CloseCircleIcon,J as ClosedLockIcon,Db as ContentLoader,fb as ContextMenu,gb as ContextMenuDelimiter,qa as CrossIcon,K as DataSetsIcon,L as DeepSearchIcon,M as DisabledVisibleIcon,N as DocsIcon,O as DownloadIcon,yb as Drawer,Ab as DrawerBody,zb as DrawerHeader,P as EditUserIcon,rb as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,Ra as FaceSearchIcon,mb as FileField,xa as FileIcon,S as FiltersIcon,Ia as FlashIcon,nb as FlexContainer,ob as FlexItem,Ba as FolderAlertIcon,Ja as FolderInfoIcon,ab as Header,bb as HeaderDelimeter,cb as HeaderSection,T as HomepageIcon,Qa as ImageIcon,oa as InfoCircleFilledIcon,U as InfoCircleIcon,kb as Input,ya as IosIcon,ub as Label,qb as Line,wb as LinerProgress,Za as ListMenu,_a as ListMenuItem,$a as ListMenuSection,V as MapRadarIcon,ra as MaximizeIcon,Sa as MessageAsteriskIcon,Aa as MicrosoftIcon,Pa as MinusIcon,Fb as Modal,Hb as ModalBody,Ib as ModalFooter,Gb as ModalHeader,W as MoonIcon,X as OpenLockIcon,Y as OrganizationIcon,Eb as Overlay,eb as Pagination,Ea as PassportIcon,Z as PasswordFinderIcon,Ga as PencilIcon,_ as PhonebookIcon,va as PlaneIcon,ma as PlusIcon,Fa as PointIcon,$ as PrintIcon,aa as Profiler2Icon,ba as ProfilerIcon,Lb as ProgressLoader,Ca as RelationIcon,Da as RelationPointsIcon,Ka as RotateLeftIcon,La as RotateRightIcon,jb as RowActionsMenu,ca as SandBoxIcon,da as SearchIcon,ib as Select,wa as ShipIcon,Ua as Sidebar,Ta as SidebarContext,Wa as SidebarDelimeter,Va as SidebarItem,Xa as SidebarSection,ea as StatisticIcon,Cb as StyledTooltipContent,fa as SunIcon,xb as Switch,db as Table,sb as Tag,Jb as TailwindExample,s as ThemeProvider,Bb as Tooltip,Ya as Typography,pa as UnfoldIcon,ga as UpRightArrowCircleIcon,Ma as UploadImageIcon,Ha as UserInCircleIcon,na as UsersIcon,ha as VectorIcon,ua as WayIcon,f as convertPaletteToRem,w as createComponent,x as createStyledComponent,p as darkTheme,o as darkThemePx,t as destructSpaceProps,u as generatePropertySpaceStyle,k as getBreakpoint,h as getButtonSizeStyles,g as getButtonStyles,i as getInputStyles,v as getResponsiveProps,j as getTypographyStyles,l as hexToRgba,n as lightTheme,m as lightThemePx,e as propToRem,c as pxToRem,d as remToPx,b as resolveThemeColor,r as useBreakpoint,hb as useContextMenuControl,y as useTheme}from'./chunk-2JO77E5F.mjs';import xo,{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 No from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import wo from'react-content-loader';import {renderAsync}from'docx-preview';import tn from'lodash.throttle';import nn from'@uiw/react-codemirror';import {vscodeDark,vscodeLight}from'@uiw/codemirror-theme-vscode';import {javascript}from'@codemirror/lang-javascript';import {json}from'@codemirror/lang-json';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 mn from'react-markdown';import bn from'remark-gfm';import {TableVirtuoso}from'react-virtuoso';import Bt from'papaparse';import oa 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 Ks=a(({children:r,className:o})=>jsx(oo,{className:o,children:r}),"PageLayout"),oo=styled.div`
2
2
  display: grid;
3
3
  min-height: 100dvh;
4
4
  position: relative;
@@ -63,7 +63,7 @@ ${r?`
63
63
  `:""}
64
64
 
65
65
  min-width: 0;
66
- `);var Go=[.1,.25,.5,.75,1,1.5,2,3,4,5],Ko=5,Jo=.1,Qo=140;function mt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(mt,"computePadding");var br=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:d=Go,maxZoom:s=Ko,minZoom:h=Jo,showMinimap:x=true,minimapWidth:k=Qo,className:N,onZoomChange:M})=>{let[f,L]=useState("adaptive"),[B,t]=useState(1),[I,S]=useState(false),p=useRef(false),[F,P]=useState(false),[T,$]=useState(false),[Y,ne]=useState({left:0,top:0}),re=useRef(0),[se,ye]=useState({width:0,height:0}),le=useRef({width:0,height:0}),we=useRef(null),ve=useRef(null),q=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),H=useRef(f),V=useRef(B),W=useRef(M);H.current=f,V.current=B,W.current=M;let Z=n||le.current.width,oe=a$1||le.current.height,ae=useMemo(()=>[...d].sort((y,C)=>y-C),[d]),X=useCallback(()=>se.width===0||Z===0?1:Math.min(se.width/Z,se.height/oe,1),[se,Z,oe]),Q=useCallback((y,C)=>{if(C==="in"){let z=ae.find(j=>j>y+.001);return z!==void 0?Math.min(z,s):y}let A=ae.findLast(z=>z<y-.001);return A!==void 0?Math.max(A,h):y},[ae,s,h]),de=useCallback(()=>H.current==="adaptive"?X():V.current,[X]),ce=useCallback(y=>{L("manual"),t(y),W.current?.(y,"manual");},[]),ue=useCallback(()=>{L("adaptive"),W.current?.(X(),"adaptive");},[X]),Se=useCallback(y=>{requestAnimationFrame(()=>{let C=ve.current;if(!C)return;let A=C.getBoundingClientRect(),z=Z*y,j=oe*y,v=mt(z,j,A.width,A.height);C.scrollLeft=z/2+v.x-A.width/2,C.scrollTop=j/2+v.y-A.height/2;});},[Z,oe]);useEffect(()=>{L("adaptive"),t(1),P(false),$(false),le.current={width:0,height:0};},[r]),useEffect(()=>{let y=ve.current;if(!y)return;let C=new ResizeObserver(A=>{let z=A[0];if(!z)return;let{width:j,height:v}=z.contentRect;ye(O=>O.width===j&&O.height===v?O:{width:j,height:v});});return C.observe(y),()=>C.disconnect()},[]),useEffect(()=>{let y=ve.current;if(!y)return;let C=a(()=>{cancelAnimationFrame(re.current),re.current=requestAnimationFrame(()=>{let A=y.scrollLeft,z=y.scrollTop;ne(j=>j.left===A&&j.top===z?j:{left:A,top:z});});},"handleScroll");return y.addEventListener("scroll",C,{passive:true}),()=>{y.removeEventListener("scroll",C),cancelAnimationFrame(re.current);}},[]),useEffect(()=>{let y=ve.current;if(!y||!F)return;let C=a(A=>{if(!(A.ctrlKey||A.metaKey))return;A.preventDefault();let z=de(),j=A.deltaY>0?"out":"in",v=Q(z,j),O=X();if(j==="out"&&v<=O){ue();return}let R=y.getBoundingClientRect(),G,K,ee=le.current.width||1,me=le.current.height||1;if(H.current==="adaptive"){let pe=we.current;if(!pe)return;let he=pe.getBoundingClientRect();G=(A.clientX-he.left)/(he.width/ee),K=(A.clientY-he.top)/(he.height/me);}else {let pe=ee*z,he=me*z,He=mt(pe,he,R.width,R.height);G=(y.scrollLeft+A.clientX-R.left-He.x)/z,K=(y.scrollTop+A.clientY-R.top-He.y)/z;}ce(v),requestAnimationFrame(()=>{let pe=y.getBoundingClientRect(),he=mt(ee*v,me*v,pe.width,pe.height);y.scrollLeft=G*v+he.x-(A.clientX-pe.left),y.scrollTop=K*v+he.y-(A.clientY-pe.top);});},"handleWheel");return y.addEventListener("wheel",C,{passive:false}),()=>y.removeEventListener("wheel",C)},[F,de,Q,X,ce,ue]),useEffect(()=>{if(f!=="manual")return;let y=ve.current;if(!y)return;let C=a(j=>{j.button===0&&(j.preventDefault(),p.current=true,S(true),q.current={x:j.clientX,y:j.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop});},"handleMouseDown"),A=a(j=>{if(!p.current)return;let{x:v,y:O,scrollLeft:R,scrollTop:G}=q.current;y.scrollLeft=R-(j.clientX-v),y.scrollTop=G-(j.clientY-O);},"handleMouseMove"),z=a(()=>{p.current=false,S(false);},"handleMouseUp");return y.addEventListener("mousedown",C),window.addEventListener("mousemove",A),window.addEventListener("mouseup",z),()=>{y.removeEventListener("mousedown",C),window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",z);}},[f]);let _e=useCallback(()=>{f==="manual"&&ue();},[f,ue]),qe=useCallback(()=>{let y=de(),C=Q(y,"in");C!==y&&(ce(C),Se(C));},[de,Q,ce,Se]),Ee=useCallback(()=>{let y=de(),C=Q(y,"out");if(C<=X()){ue();return}ce(C),Se(C);},[de,Q,X,ue,ce,Se]),Fe=useCallback(()=>{ce(1),Se(1);},[ce,Se]),Ce=useCallback(()=>{let y=we.current;y&&(le.current={width:y.naturalWidth,height:y.naturalHeight},P(true),$(false));},[]),Me=f==="adaptive"?X():B,Ne=Z*Me,Ue=oe*Me,Be=se.width,et=se.height,Oe=f==="manual"?mt(Ne,Ue,Be,et):{x:0,y:0},Lt=x&&f==="manual"&&(Ne>Be||Ue>et),e=Z>0?k/Z:0,l=oe*e,c=Be>0?Be/B*e:0,u=et>0?et/B*e:0,g=Math.max(0,Y.left-Oe.x)/B*e,w=Math.max(0,Y.top-Oe.y)/B*e,m=f==="adaptive"?"Fit":`${Math.round(B*100)}%`,b=Q(Me,"in")!==Me,D=f==="manual"||Me>h,E=f==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{width:Ne,height:Ue,maxWidth:"none",maxHeight:"none",marginLeft:Oe.x,marginTop:Oe.y,flexShrink:0},_={cursor:f==="manual"?I?"grabbing":"grab":"default"};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${N??""}`,children:[jsxs("div",{className:"flex w-full items-center px-8.5 py-3 gap-1 shrink-0",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa$1,{style:{width:20,height:20}}),onClick:Ee,disabled:!D,p:7,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!"}),jsx("button",{type:"button",onClick:f==="manual"?ue: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":m,children:jsx(Ya,{style:{fontSize:12,fontWeight:500},children:m})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:qe,disabled:!b,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":"fit-to-container",size:"small",color:f==="adaptive"?"primary":"default",icon:jsx(ra,{style:{width:14,height:14}}),onClick:ue,className:`${f==="adaptive"?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} ml-auto h-[38px]!`,p:10}),jsx(z,{variant:"outlined","aria-label":"original-size",size:"small",color:f==="manual"&&B===1?"primary":"default",onClick:Fe,className:`${f==="manual"&&B===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(Ya,{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:ve,className:`h-full w-full ${f==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:_,onDoubleClick:_e,children:T?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(Ya,{color:"text.lighter",children:"Failed to load image"})}):jsx("img",{ref:we,src:r,alt:o,draggable:false,className:"block select-none",style:E,onLoad:Ce,onError:()=>$(true)})}),Lt&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:k,height:l,backdropFilter:"blur(8px)",background:"rgba(255,255,255,0.75)"},children:[jsx("img",{src:r,alt:"",draggable:false,className:"block w-full h-full object-contain"}),jsx("div",{className:"absolute border-2 border-blue-500 rounded-sm",style:{width:Math.min(c,k),height:Math.min(u,l),left:Math.max(0,Math.min(g,k-c)),top:Math.max(0,Math.min(w,l-u)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var yr=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full py-5.5 px-8.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var zt=a(({url:r})=>{let[o,n]=useState(null),[a$1,d]=useState(false),[s,h]=useState(true),[x,k]=useState(null);return useEffect(()=>{d(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let M=await import('./PdfDriver-BYZATCUO.mjs');n(()=>M.PdfDriver),h(!1);}catch(M){console.error("Failed to load PDF driver:",M),k("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[a$1]),a$1?s?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})}):x||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:x||"PDF viewer unavailable"})})}):jsx(o,{url:r}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var kr=50,rn=1e4,Sr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[d,s]=useState(null),[h,x]=useState(true),[k,N]=useState(1),M=useRef(false),[f,L]=useState({width:0,height:0}),B=useRef(0),t=a(()=>{M.current=true,N(S=>Math.min(S+.25,4));},"handleZoomIn"),I=a(()=>{M.current=true,N(S=>Math.max(S-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{x(!0),s(null);let p=o;if(!p&&r&&(p=await(await fetch(r)).blob()),!p){s("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(p.size/(1024*1024)>kr){s(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${kr} \u041C\u0411)`);return}a$1.current.innerHTML="";let P=renderAsync(p,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),T=new Promise((Y,ne)=>setTimeout(()=>ne(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")),rn));await Promise.race([P,T]),await new Promise(Y=>requestAnimationFrame(Y));let $=a$1.current.querySelector(".docx-wrapper");if($&&(B.current=$.offsetWidth,L({width:$.offsetWidth,height:$.offsetHeight})),n.current&&B.current>0){let Y=n.current.clientWidth,ne=Math.min(Y/B.current,1);N(ne);}x(!1);}catch(p){s(p?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),x(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let S=tn(F=>{if(!(M.current||B.current===0))for(let P of F){let T=P.contentRect.width,$=Math.min(T/B.current,1);N($);}},150),p=new ResizeObserver(S);return p.observe(n.current),()=>{p.disconnect(),S.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(Pa$1,{style:{width:20,height:20}}),onClick:I,disabled:k<=.25,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:7}),jsxs(pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[Math.round(k*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:t,disabled:k>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!d&&!h&&jsx("div",{className:"text-red-500 p-8",children:d}),h&&jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:n,className:"w-full h-full overflow-auto bg-gray-400 dark:bg-neutral-700 [&::-webkit-scrollbar-thumb]:bg-gray-100 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-600 [&::-webkit-scrollbar-track]:bg-gray-400 dark:[&::-webkit-scrollbar-track]:bg-neutral-700",style:{scrollbarGutter:"stable both-edges"},children:jsx("div",{style:{width:f.width>0?f.width*k:void 0,height:f.height>0?f.height*k:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:a$1,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
66
+ `);var Go=[.1,.25,.5,.75,1,1.5,2,3,4,5],Ko=5,Jo=.1,Qo=140;function mt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(mt,"computePadding");var br=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:d=Go,maxZoom:s=Ko,minZoom:h=Jo,showMinimap:x=true,minimapWidth:k=Qo,className:N,onZoomChange:M})=>{let[f,L]=useState("adaptive"),[B,t]=useState(1),[I,S]=useState(false),p=useRef(false),[F,P]=useState(false),[T,$]=useState(false),[Y,ne]=useState({left:0,top:0}),re=useRef(0),[se,ye]=useState({width:0,height:0}),le=useRef({width:0,height:0}),we=useRef(null),ve=useRef(null),q=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),H=useRef(f),V=useRef(B),W=useRef(M);H.current=f,V.current=B,W.current=M;let Z=n||le.current.width,oe=a$1||le.current.height,ae=useMemo(()=>[...d].sort((y,C)=>y-C),[d]),X=useCallback(()=>se.width===0||Z===0?1:Math.min(se.width/Z,se.height/oe,1),[se,Z,oe]),Q=useCallback((y,C)=>{if(C==="in"){let z=ae.find(j=>j>y+.001);return z!==void 0?Math.min(z,s):y}let A=ae.findLast(z=>z<y-.001);return A!==void 0?Math.max(A,h):y},[ae,s,h]),de=useCallback(()=>H.current==="adaptive"?X():V.current,[X]),ce=useCallback(y=>{L("manual"),t(y),W.current?.(y,"manual");},[]),ue=useCallback(()=>{L("adaptive"),W.current?.(X(),"adaptive");},[X]),Se=useCallback(y=>{requestAnimationFrame(()=>{let C=ve.current;if(!C)return;let A=C.getBoundingClientRect(),z=Z*y,j=oe*y,v=mt(z,j,A.width,A.height);C.scrollLeft=z/2+v.x-A.width/2,C.scrollTop=j/2+v.y-A.height/2;});},[Z,oe]);useEffect(()=>{L("adaptive"),t(1),P(false),$(false),le.current={width:0,height:0};},[r]),useEffect(()=>{let y=ve.current;if(!y)return;let C=new ResizeObserver(A=>{let z=A[0];if(!z)return;let{width:j,height:v}=z.contentRect;ye(O=>O.width===j&&O.height===v?O:{width:j,height:v});});return C.observe(y),()=>C.disconnect()},[]),useEffect(()=>{let y=ve.current;if(!y)return;let C=a(()=>{cancelAnimationFrame(re.current),re.current=requestAnimationFrame(()=>{let A=y.scrollLeft,z=y.scrollTop;ne(j=>j.left===A&&j.top===z?j:{left:A,top:z});});},"handleScroll");return y.addEventListener("scroll",C,{passive:true}),()=>{y.removeEventListener("scroll",C),cancelAnimationFrame(re.current);}},[]),useEffect(()=>{let y=ve.current;if(!y||!F)return;let C=a(A=>{if(!(A.ctrlKey||A.metaKey))return;A.preventDefault();let z=de(),j=A.deltaY>0?"out":"in",v=Q(z,j),O=X();if(j==="out"&&v<=O){ue();return}let R=y.getBoundingClientRect(),G,K,ee=le.current.width||1,me=le.current.height||1;if(H.current==="adaptive"){let pe=we.current;if(!pe)return;let he=pe.getBoundingClientRect();G=(A.clientX-he.left)/(he.width/ee),K=(A.clientY-he.top)/(he.height/me);}else {let pe=ee*z,he=me*z,He=mt(pe,he,R.width,R.height);G=(y.scrollLeft+A.clientX-R.left-He.x)/z,K=(y.scrollTop+A.clientY-R.top-He.y)/z;}ce(v),requestAnimationFrame(()=>{let pe=y.getBoundingClientRect(),he=mt(ee*v,me*v,pe.width,pe.height);y.scrollLeft=G*v+he.x-(A.clientX-pe.left),y.scrollTop=K*v+he.y-(A.clientY-pe.top);});},"handleWheel");return y.addEventListener("wheel",C,{passive:false}),()=>y.removeEventListener("wheel",C)},[F,de,Q,X,ce,ue]),useEffect(()=>{if(f!=="manual")return;let y=ve.current;if(!y)return;let C=a(j=>{j.button===0&&(j.preventDefault(),p.current=true,S(true),q.current={x:j.clientX,y:j.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop});},"handleMouseDown"),A=a(j=>{if(!p.current)return;let{x:v,y:O,scrollLeft:R,scrollTop:G}=q.current;y.scrollLeft=R-(j.clientX-v),y.scrollTop=G-(j.clientY-O);},"handleMouseMove"),z=a(()=>{p.current=false,S(false);},"handleMouseUp");return y.addEventListener("mousedown",C),window.addEventListener("mousemove",A),window.addEventListener("mouseup",z),()=>{y.removeEventListener("mousedown",C),window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",z);}},[f]);let _e=useCallback(()=>{f==="manual"&&ue();},[f,ue]),qe=useCallback(()=>{let y=de(),C=Q(y,"in");C!==y&&(ce(C),Se(C));},[de,Q,ce,Se]),Ee=useCallback(()=>{let y=de(),C=Q(y,"out");if(C<=X()){ue();return}ce(C),Se(C);},[de,Q,X,ue,ce,Se]),Fe=useCallback(()=>{ce(1),Se(1);},[ce,Se]),Ce=useCallback(()=>{let y=we.current;y&&(le.current={width:y.naturalWidth,height:y.naturalHeight},P(true),$(false));},[]),Me=f==="adaptive"?X():B,Ne=Z*Me,Ue=oe*Me,Be=se.width,et=se.height,Oe=f==="manual"?mt(Ne,Ue,Be,et):{x:0,y:0},Lt=x&&f==="manual"&&(Ne>Be||Ue>et),e=Z>0?k/Z:0,l=oe*e,c=Be>0?Be/B*e:0,u=et>0?et/B*e:0,g=Math.max(0,Y.left-Oe.x)/B*e,w=Math.max(0,Y.top-Oe.y)/B*e,m=f==="adaptive"?"Fit":`${Math.round(B*100)}%`,b=Q(Me,"in")!==Me,D=f==="manual"||Me>h,E=f==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{width:Ne,height:Ue,maxWidth:"none",maxHeight:"none",marginLeft:Oe.x,marginTop:Oe.y,flexShrink:0},_={cursor:f==="manual"?I?"grabbing":"grab":"default"};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${N??""}`,children:[jsxs("div",{className:"flex w-full items-center px-8.5 py-3 gap-1 shrink-0",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa$1,{style:{width:20,height:20}}),onClick:Ee,disabled:!D,p:7,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!"}),jsx("button",{type:"button",onClick:f==="manual"?ue: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":m,children:jsx(Ya,{style:{fontSize:12,fontWeight:500},children:m})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:qe,disabled:!b,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":"fit-to-container",size:"small",color:f==="adaptive"?"primary":"default",icon:jsx(ra,{style:{width:14,height:14}}),onClick:ue,className:`${f==="adaptive"?"bg-blue-50!":"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!"} ml-auto h-[38px]!`,p:10}),jsx(z,{variant:"outlined","aria-label":"original-size",size:"small",color:f==="manual"&&B===1?"primary":"default",onClick:Fe,className:`${f==="manual"&&B===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(Ya,{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:ve,className:`h-full w-full ${f==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:_,onDoubleClick:_e,children:T?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(Ya,{color:"text.lighter",children:"Failed to load image"})}):jsx("img",{ref:we,src:r,alt:o,draggable:false,className:"block select-none",style:E,onLoad:Ce,onError:()=>$(true)})}),Lt&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:k,height:l,backdropFilter:"blur(8px)",background:"rgba(255,255,255,0.75)"},children:[jsx("img",{src:r,alt:"",draggable:false,className:"block w-full h-full object-contain"}),jsx("div",{className:"absolute border-2 border-blue-500 rounded-sm",style:{width:Math.min(c,k),height:Math.min(u,l),left:Math.max(0,Math.min(g,k-c)),top:Math.max(0,Math.min(w,l-u)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var yr=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full py-5.5 px-8.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var zt=a(({url:r})=>{let[o,n]=useState(null),[a$1,d]=useState(false),[s,h]=useState(true),[x,k]=useState(null);return useEffect(()=>{d(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let M=await import('./PdfDriver-JSG62TPD.mjs');n(()=>M.PdfDriver),h(!1);}catch(M){console.error("Failed to load PDF driver:",M),k("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[a$1]),a$1?s?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})}):x||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:x||"PDF viewer unavailable"})})}):jsx(o,{url:r}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var kr=50,rn=1e4,Sr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[d,s]=useState(null),[h,x]=useState(true),[k,N]=useState(1),M=useRef(false),[f,L]=useState({width:0,height:0}),B=useRef(0),t=a(()=>{M.current=true,N(S=>Math.min(S+.25,4));},"handleZoomIn"),I=a(()=>{M.current=true,N(S=>Math.max(S-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{x(!0),s(null);let p=o;if(!p&&r&&(p=await(await fetch(r)).blob()),!p){s("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(p.size/(1024*1024)>kr){s(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${kr} \u041C\u0411)`);return}a$1.current.innerHTML="";let P=renderAsync(p,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),T=new Promise((Y,ne)=>setTimeout(()=>ne(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")),rn));await Promise.race([P,T]),await new Promise(Y=>requestAnimationFrame(Y));let $=a$1.current.querySelector(".docx-wrapper");if($&&(B.current=$.offsetWidth,L({width:$.offsetWidth,height:$.offsetHeight})),n.current&&B.current>0){let Y=n.current.clientWidth,ne=Math.min(Y/B.current,1);N(ne);}x(!1);}catch(p){s(p?.message||"\u041D\u0435 \u0432\u0434\u0430\u043B\u043E\u0441\u044F \u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438 DOCX \u0444\u0430\u0439\u043B"),x(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let S=tn(F=>{if(!(M.current||B.current===0))for(let P of F){let T=P.contentRect.width,$=Math.min(T/B.current,1);N($);}},150),p=new ResizeObserver(S);return p.observe(n.current),()=>{p.disconnect(),S.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(Pa$1,{style:{width:20,height:20}}),onClick:I,disabled:k<=.25,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:7}),jsxs(pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[Math.round(k*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:t,disabled:k>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!d&&!h&&jsx("div",{className:"text-red-500 p-8",children:d}),h&&jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:n,className:"w-full h-full overflow-auto bg-gray-400 dark:bg-neutral-700 [&::-webkit-scrollbar-thumb]:bg-gray-100 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-600 [&::-webkit-scrollbar-track]:bg-gray-400 dark:[&::-webkit-scrollbar-track]:bg-neutral-700",style:{scrollbarGutter:"stable both-edges"},children:jsx("div",{style:{width:f.width>0?f.width*k:void 0,height:f.height>0?f.height*k:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:a$1,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
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!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyber-harbour/ui",
3
- "version": "2.2.10",
3
+ "version": "2.2.12",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",