@cyber-harbour/ui 2.2.16 → 2.2.17
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/{PdfDriver-PEODYTP4.js → PdfDriver-FZC4EDGW.js} +2 -2
- package/dist/{PdfDriver-PEODYTP4.js.map → PdfDriver-FZC4EDGW.js.map} +1 -1
- package/dist/{PdfDriver-NHJHMC53.mjs → PdfDriver-MYEDFGO3.mjs} +2 -2
- package/dist/{PdfDriver-NHJHMC53.mjs.map → PdfDriver-MYEDFGO3.mjs.map} +1 -1
- package/dist/chunk-4AIWL7CV.mjs +1385 -0
- package/dist/chunk-4AIWL7CV.mjs.map +1 -0
- package/dist/chunk-72BA4VF6.js +1385 -0
- package/dist/chunk-72BA4VF6.js.map +1 -0
- package/dist/index.js +21 -21
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-2SG3RPTE.mjs +0 -1385
- package/dist/chunk-2SG3RPTE.mjs.map +0 -1
- package/dist/chunk-7IYFMGPP.js +0 -1385
- package/dist/chunk-7IYFMGPP.js.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a,w,x,u,c,l,z,Ra,_a,na,sa,rb,Eb,y,mb,G,kb,H,nb}from'./chunk-
|
|
1
|
+
import {a,w,x,u,c,l,z,Ra,_a,na,sa,rb,Eb,y,mb,G,kb,H,nb}from'./chunk-4AIWL7CV.mjs';export{vb as Alert,A as AlertIcon,Ba as AndroidIcon,B as ApiIcon,C as ArrowCircleTopRightIcon,D as ArrowRightIcon,ja as BallsMenu,rb as Box,q as BreakpointProvider,E as BugReportIcon,Pa as BurgerMenuIcon,ta as BusIcon,z as Button,F as CalendarIcon,ua as CarIcon,Mb as ChatField,ka as CheckIcon,xb as Checkbox,la as ChevronDownIcon,G as ChevronLeftIcon,H as ChevronRightIcon,ma as ChevronUpIcon,Qa as ClockIcon,I as CloseCircleIcon,J as ClosedLockIcon,Fb as ContentLoader,hb as ContextMenu,ib as ContextMenuDelimiter,ra as CrossIcon,K as DataSetsIcon,L as DeepSearchIcon,M as DisabledVisibleIcon,N as DocsIcon,O as DownloadIcon,Ab as Drawer,Cb as DrawerBody,Bb as DrawerHeader,P as EditUserIcon,tb as EmptyData,Q as EnableVisibleIcon,R as EnterArrowLeftIcon,Ta as FaceSearchIcon,za as File2Icon,ob as FileField,ya as FileIcon,S as FiltersIcon,Ka as FlashIcon,pb as FlexContainer,qb as FlexItem,Da as FolderAlertIcon,T as FolderIcon,La as FolderInfoIcon,cb as Header,db as HeaderDelimeter,eb as HeaderSection,U as HomepageIcon,Sa as ImageIcon,pa as InfoCircleFilledIcon,V as InfoCircleIcon,mb as Input,Aa as IosIcon,wb as Label,sb as Line,yb as LinerProgress,$a as ListMenu,ab as ListMenuItem,bb as ListMenuSection,W as MapRadarIcon,sa as MaximizeIcon,Ua as MessageAsteriskIcon,Ca as MicrosoftIcon,Ra as MinusIcon,Hb as Modal,Jb as ModalBody,Kb as ModalFooter,Ib as ModalHeader,X as MoonIcon,Y as OpenLockIcon,Z as OrganizationIcon,Gb as Overlay,gb as Pagination,Ga as PassportIcon,_ as PasswordFinderIcon,Ia as PencilIcon,$ as PhonebookIcon,wa as PlaneIcon,na as PlusIcon,Ha as PointIcon,aa as PrintIcon,ba as Profiler2Icon,ca as ProfilerIcon,Nb as ProgressLoader,Ea as RelationIcon,Fa as RelationPointsIcon,Ma as RotateLeftIcon,Na as RotateRightIcon,lb as RowActionsMenu,da as SandBoxIcon,ea as SearchIcon,kb as Select,xa as ShipIcon,Wa as Sidebar,Va as SidebarContext,Ya as SidebarDelimeter,Xa as SidebarItem,Za as SidebarSection,fa as StatisticIcon,Eb as StyledTooltipContent,ga as SunIcon,zb as Switch,fb as Table,ub as Tag,Lb as TailwindExample,s as ThemeProvider,Db as Tooltip,_a as Typography,qa as UnfoldIcon,ha as UpRightArrowCircleIcon,Oa as UploadImageIcon,Ja as UserInCircleIcon,oa as UsersIcon,ia as VectorIcon,va as WayIcon,f as convertPaletteToRem,w as createComponent,x as createStyledComponent,p as darkTheme,o as darkThemePx,t as destructSpaceProps,u as generatePropertySpaceStyle,k as getBreakpoint,h as getButtonSizeStyles,g as getButtonStyles,i as getInputStyles,v as getResponsiveProps,j as getTypographyStyles,l as hexToRgba,n as lightTheme,m as lightThemePx,e as propToRem,c as pxToRem,d as remToPx,b as resolveThemeColor,r as useBreakpoint,jb as useContextMenuControl,y as useTheme}from'./chunk-4AIWL7CV.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 Qs=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 bt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(bt,"computePadding");var br=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:d=Go,maxZoom:s=Ko,minZoom:p=Jo,showMinimap:w=true,minimapWidth:x=Qo,className:R,onZoomChange:E})=>{let[g,I]=useState("adaptive"),[B,t]=useState(1),[z$1,k]=useState(false),P=useRef(false),[S,C]=useState(false),[D,$]=useState(false),[U,Q]=useState({left:0,top:0}),oe=useRef(0),[ie,ye]=useState({width:0,height:0}),le=useRef({width:0,height:0}),we=useRef(null),ve=useRef(null),Y=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),H=useRef(g),V=useRef(B),W=useRef(E);H.current=g,V.current=B,W.current=E;let Z=n||le.current.width,ne=a$1||le.current.height,ae=useMemo(()=>[...d].sort((v,T)=>v-T),[d]),X=useCallback(()=>ie.width===0||Z===0?1:Math.min(ie.width/Z,ie.height/ne,1),[ie,Z,ne]),ee=useCallback((v,T)=>{if(T==="in"){let _=ae.find(F=>F>v+.001);return _!==void 0?Math.min(_,s):v}let j=ae.findLast(_=>_<v-.001);return j!==void 0?Math.max(j,p):v},[ae,s,p]),de=useCallback(()=>H.current==="adaptive"?X():V.current,[X]),ce=useCallback(v=>{I("manual"),t(v),W.current?.(v,"manual");},[]),ue=useCallback(()=>{I("adaptive"),W.current?.(X(),"adaptive");},[X]),Se=useCallback(v=>{requestAnimationFrame(()=>{let T=ve.current;if(!T)return;let j=T.getBoundingClientRect(),_=Z*v,F=ne*v,b=bt(_,F,j.width,j.height);T.scrollLeft=_/2+b.x-j.width/2,T.scrollTop=F/2+b.y-j.height/2;});},[Z,ne]);useEffect(()=>{I("adaptive"),t(1),C(false),$(false),le.current={width:0,height:0};},[r]),useEffect(()=>{let v=ve.current;if(!v)return;let T=new ResizeObserver(j=>{let _=j[0];if(!_)return;let{width:F,height:b}=_.contentRect;ye(O=>O.width===F&&O.height===b?O:{width:F,height:b});});return T.observe(v),()=>T.disconnect()},[]),useEffect(()=>{let v=ve.current;if(!v)return;let T=a(()=>{cancelAnimationFrame(oe.current),oe.current=requestAnimationFrame(()=>{let j=v.scrollLeft,_=v.scrollTop;Q(F=>F.left===j&&F.top===_?F:{left:j,top:_});});},"handleScroll");return v.addEventListener("scroll",T,{passive:true}),()=>{v.removeEventListener("scroll",T),cancelAnimationFrame(oe.current);}},[]),useEffect(()=>{let v=ve.current;if(!v||!S)return;let T=a(j=>{if(!(j.ctrlKey||j.metaKey))return;j.preventDefault();let _=de(),F=j.deltaY>0?"out":"in",b=ee(_,F),O=X();if(F==="out"&&b<=O){ue();return}let L=v.getBoundingClientRect(),G,K,te=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=(j.clientX-he.left)/(he.width/te),K=(j.clientY-he.top)/(he.height/me);}else {let pe=te*_,he=me*_,He=bt(pe,he,L.width,L.height);G=(v.scrollLeft+j.clientX-L.left-He.x)/_,K=(v.scrollTop+j.clientY-L.top-He.y)/_;}ce(b),requestAnimationFrame(()=>{let pe=v.getBoundingClientRect(),he=bt(te*b,me*b,pe.width,pe.height);v.scrollLeft=G*b+he.x-(j.clientX-pe.left),v.scrollTop=K*b+he.y-(j.clientY-pe.top);});},"handleWheel");return v.addEventListener("wheel",T,{passive:false}),()=>v.removeEventListener("wheel",T)},[S,de,ee,X,ce,ue]),useEffect(()=>{if(g!=="manual")return;let v=ve.current;if(!v)return;let T=a(F=>{F.button===0&&(F.preventDefault(),P.current=true,k(true),Y.current={x:F.clientX,y:F.clientY,scrollLeft:v.scrollLeft,scrollTop:v.scrollTop});},"handleMouseDown"),j=a(F=>{if(!P.current)return;let{x:b,y:O,scrollLeft:L,scrollTop:G}=Y.current;v.scrollLeft=L-(F.clientX-b),v.scrollTop=G-(F.clientY-O);},"handleMouseMove"),_=a(()=>{P.current=false,k(false);},"handleMouseUp");return v.addEventListener("mousedown",T),window.addEventListener("mousemove",j),window.addEventListener("mouseup",_),()=>{v.removeEventListener("mousedown",T),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",_);}},[g]);let _e=useCallback(()=>{g==="manual"&&ue();},[g,ue]),qe=useCallback(()=>{let v=de(),T=ee(v,"in");T!==v&&(ce(T),Se(T));},[de,ee,ce,Se]),Ee=useCallback(()=>{let v=de(),T=ee(v,"out");if(T<=X()){ue();return}ce(T),Se(T);},[de,ee,X,ue,ce,Se]),Fe=useCallback(()=>{ce(1),Se(1);},[ce,Se]),Ce=useCallback(()=>{let v=we.current;v&&(le.current={width:v.naturalWidth,height:v.naturalHeight},C(true),$(false));},[]),Me=g==="adaptive"?X():B,Ne=Z*Me,Ue=ne*Me,Be=ie.width,et=ie.height,Oe=g==="manual"?bt(Ne,Ue,Be,et):{x:0,y:0},Lt=w&&g==="manual"&&(Ne>Be||Ue>et),e=Z>0?x/Z:0,l=ne*e,c=Be>0?Be/B*e:0,u=et>0?et/B*e:0,h=Math.max(0,U.left-Oe.x)/B*e,y=Math.max(0,U.top-Oe.y)/B*e,f=g==="adaptive"?"Fit":`${Math.round(B*100)}%`,m=ee(Me,"in")!==Me,M=g==="manual"||Me>p,N=g==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{width:Ne,height:Ue,maxWidth:"none",maxHeight:"none",marginLeft:Oe.x,marginTop:Oe.y,flexShrink:0},A={cursor:g==="manual"?z$1?"grabbing":"grab":"default"};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${R??""}`,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(Ra,{style:{width:20,height:20}}),onClick:Ee,disabled:!M,p:7,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!"}),jsx("button",{type:"button",onClick:g==="manual"?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":f,children:jsx(_a,{style:{fontSize:12,fontWeight:500},children:f})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:qe,disabled:!m,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:g==="adaptive"?"primary":"default",icon:jsx(sa,{style:{width:14,height:14}}),onClick:ue,className:`${g==="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:g==="manual"&&B===1?"primary":"default",onClick:Fe,className:`${g==="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(_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:ve,className:`h-full w-full ${g==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:A,onDoubleClick:_e,children:D?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(_a,{color:"text.lighter",children:"Failed to load image"})}):jsx("img",{ref:we,src:r,alt:o,draggable:false,className:"block select-none",style:N,onLoad:Ce,onError:()=>$(true)})}),Lt&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:x,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,x),height:Math.min(u,l),left:Math.max(0,Math.min(h,x-c)),top:Math.max(0,Math.min(y,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,p]=useState(true),[w,x]=useState(null);return useEffect(()=>{d(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let E=await import('./PdfDriver-NHJHMC53.mjs');n(()=>E.PdfDriver),p(!1);}catch(E){console.error("Failed to load PDF driver:",E),x("Failed to load PDF viewer"),p(false);}},"loadPdfDriver")();},[a$1]),a$1?s?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})}):w||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:w||"PDF viewer unavailable"})})}):jsx(o,{url:r}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var kr=50,rn=1e4,Sr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[d,s]=useState(null),[p,w]=useState(true),[x,R]=useState(1),E=useRef(false),[g,I]=useState({width:0,height:0}),B=useRef(0),t=a(()=>{E.current=true,R(k=>Math.min(k+.25,4));},"handleZoomIn"),z$1=a(()=>{E.current=true,R(k=>Math.max(k-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{w(!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 C=renderAsync(P,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),D=new Promise((U,Q)=>setTimeout(()=>Q(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([C,D]),await new Promise(U=>requestAnimationFrame(U));let $=a$1.current.querySelector(".docx-wrapper");if($&&(B.current=$.offsetWidth,I({width:$.offsetWidth,height:$.offsetHeight})),n.current&&B.current>0){let U=n.current.clientWidth,Q=Math.min(U/B.current,1);R(Q);}w(!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"),w(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let k=tn(S=>{if(!(E.current||B.current===0))for(let C of S){let D=C.contentRect.width,$=Math.min(D/B.current,1);R($);}},150),P=new ResizeObserver(k);return P.observe(n.current),()=>{P.disconnect(),k.cancel();}},[]),jsxs("div",{className:"h-full w-full flex flex-col px-0.5",children:[jsxs("div",{className:"flex justify-center items-stretch px-8 py-3 gap-1 border-b border-gray-200 dark:border-neutral-700",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:z$1,disabled:x<=.25,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:7}),jsxs(rb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(_a,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(_a,{children:[Math.round(x*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:t,disabled:x>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!d&&!p&&jsx("div",{className:"text-red-500 p-8",children:d}),p&&jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:n,className:"w-full h-full overflow-auto bg-gray-400 dark:bg-neutral-700 [&::-webkit-scrollbar-thumb]:bg-gray-100 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-600 [&::-webkit-scrollbar-track]:bg-gray-400 dark:[&::-webkit-scrollbar-track]:bg-neutral-700",style:{scrollbarGutter:"stable both-edges"},children:jsx("div",{style:{width:g.width>0?g.width*x:void 0,height:g.height>0?g.height*x:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:a$1,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
|
|
66
|
+
`);var Go=[.1,.25,.5,.75,1,1.5,2,3,4,5],Ko=5,Jo=.1,Qo=140;function bt(r,o,n,a){return {x:r<n?(n-r)/2:0,y:o<a?(a-o)/2:0}}a(bt,"computePadding");var br=a(({url:r,alt:o="image",naturalWidth:n,naturalHeight:a$1,zoomSteps:d=Go,maxZoom:s=Ko,minZoom:p=Jo,showMinimap:w=true,minimapWidth:x=Qo,className:R,onZoomChange:E})=>{let[g,I]=useState("adaptive"),[B,t]=useState(1),[z$1,k]=useState(false),P=useRef(false),[S,C]=useState(false),[D,$]=useState(false),[U,Q]=useState({left:0,top:0}),oe=useRef(0),[ie,ye]=useState({width:0,height:0}),le=useRef({width:0,height:0}),we=useRef(null),ve=useRef(null),Y=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),H=useRef(g),V=useRef(B),W=useRef(E);H.current=g,V.current=B,W.current=E;let Z=n||le.current.width,ne=a$1||le.current.height,ae=useMemo(()=>[...d].sort((v,T)=>v-T),[d]),X=useCallback(()=>ie.width===0||Z===0?1:Math.min(ie.width/Z,ie.height/ne,1),[ie,Z,ne]),ee=useCallback((v,T)=>{if(T==="in"){let _=ae.find(F=>F>v+.001);return _!==void 0?Math.min(_,s):v}let j=ae.findLast(_=>_<v-.001);return j!==void 0?Math.max(j,p):v},[ae,s,p]),de=useCallback(()=>H.current==="adaptive"?X():V.current,[X]),ce=useCallback(v=>{I("manual"),t(v),W.current?.(v,"manual");},[]),ue=useCallback(()=>{I("adaptive"),W.current?.(X(),"adaptive");},[X]),Se=useCallback(v=>{requestAnimationFrame(()=>{let T=ve.current;if(!T)return;let j=T.getBoundingClientRect(),_=Z*v,F=ne*v,b=bt(_,F,j.width,j.height);T.scrollLeft=_/2+b.x-j.width/2,T.scrollTop=F/2+b.y-j.height/2;});},[Z,ne]);useEffect(()=>{I("adaptive"),t(1),C(false),$(false),le.current={width:0,height:0};},[r]),useEffect(()=>{let v=ve.current;if(!v)return;let T=new ResizeObserver(j=>{let _=j[0];if(!_)return;let{width:F,height:b}=_.contentRect;ye(O=>O.width===F&&O.height===b?O:{width:F,height:b});});return T.observe(v),()=>T.disconnect()},[]),useEffect(()=>{let v=ve.current;if(!v)return;let T=a(()=>{cancelAnimationFrame(oe.current),oe.current=requestAnimationFrame(()=>{let j=v.scrollLeft,_=v.scrollTop;Q(F=>F.left===j&&F.top===_?F:{left:j,top:_});});},"handleScroll");return v.addEventListener("scroll",T,{passive:true}),()=>{v.removeEventListener("scroll",T),cancelAnimationFrame(oe.current);}},[]),useEffect(()=>{let v=ve.current;if(!v||!S)return;let T=a(j=>{if(!(j.ctrlKey||j.metaKey))return;j.preventDefault();let _=de(),F=j.deltaY>0?"out":"in",b=ee(_,F),O=X();if(F==="out"&&b<=O){ue();return}let L=v.getBoundingClientRect(),G,K,te=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=(j.clientX-he.left)/(he.width/te),K=(j.clientY-he.top)/(he.height/me);}else {let pe=te*_,he=me*_,He=bt(pe,he,L.width,L.height);G=(v.scrollLeft+j.clientX-L.left-He.x)/_,K=(v.scrollTop+j.clientY-L.top-He.y)/_;}ce(b),requestAnimationFrame(()=>{let pe=v.getBoundingClientRect(),he=bt(te*b,me*b,pe.width,pe.height);v.scrollLeft=G*b+he.x-(j.clientX-pe.left),v.scrollTop=K*b+he.y-(j.clientY-pe.top);});},"handleWheel");return v.addEventListener("wheel",T,{passive:false}),()=>v.removeEventListener("wheel",T)},[S,de,ee,X,ce,ue]),useEffect(()=>{if(g!=="manual")return;let v=ve.current;if(!v)return;let T=a(F=>{F.button===0&&(F.preventDefault(),P.current=true,k(true),Y.current={x:F.clientX,y:F.clientY,scrollLeft:v.scrollLeft,scrollTop:v.scrollTop});},"handleMouseDown"),j=a(F=>{if(!P.current)return;let{x:b,y:O,scrollLeft:L,scrollTop:G}=Y.current;v.scrollLeft=L-(F.clientX-b),v.scrollTop=G-(F.clientY-O);},"handleMouseMove"),_=a(()=>{P.current=false,k(false);},"handleMouseUp");return v.addEventListener("mousedown",T),window.addEventListener("mousemove",j),window.addEventListener("mouseup",_),()=>{v.removeEventListener("mousedown",T),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",_);}},[g]);let _e=useCallback(()=>{g==="manual"&&ue();},[g,ue]),qe=useCallback(()=>{let v=de(),T=ee(v,"in");T!==v&&(ce(T),Se(T));},[de,ee,ce,Se]),Ee=useCallback(()=>{let v=de(),T=ee(v,"out");if(T<=X()){ue();return}ce(T),Se(T);},[de,ee,X,ue,ce,Se]),Fe=useCallback(()=>{ce(1),Se(1);},[ce,Se]),Ce=useCallback(()=>{let v=we.current;v&&(le.current={width:v.naturalWidth,height:v.naturalHeight},C(true),$(false));},[]),Me=g==="adaptive"?X():B,Ne=Z*Me,Ue=ne*Me,Be=ie.width,et=ie.height,Oe=g==="manual"?bt(Ne,Ue,Be,et):{x:0,y:0},Lt=w&&g==="manual"&&(Ne>Be||Ue>et),e=Z>0?x/Z:0,l=ne*e,c=Be>0?Be/B*e:0,u=et>0?et/B*e:0,h=Math.max(0,U.left-Oe.x)/B*e,y=Math.max(0,U.top-Oe.y)/B*e,f=g==="adaptive"?"Fit":`${Math.round(B*100)}%`,m=ee(Me,"in")!==Me,M=g==="manual"||Me>p,N=g==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{width:Ne,height:Ue,maxWidth:"none",maxHeight:"none",marginLeft:Oe.x,marginTop:Oe.y,flexShrink:0},A={cursor:g==="manual"?z$1?"grabbing":"grab":"default"};return jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${R??""}`,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(Ra,{style:{width:20,height:20}}),onClick:Ee,disabled:!M,p:7,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700! h-[38px]!"}),jsx("button",{type:"button",onClick:g==="manual"?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":f,children:jsx(_a,{style:{fontSize:12,fontWeight:500},children:f})}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:qe,disabled:!m,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:g==="adaptive"?"primary":"default",icon:jsx(sa,{style:{width:14,height:14}}),onClick:ue,className:`${g==="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:g==="manual"&&B===1?"primary":"default",onClick:Fe,className:`${g==="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(_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:ve,className:`h-full w-full ${g==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:A,onDoubleClick:_e,children:D?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx(_a,{color:"text.lighter",children:"Failed to load image"})}):jsx("img",{ref:we,src:r,alt:o,draggable:false,className:"block select-none",style:N,onLoad:Ce,onError:()=>$(true)})}),Lt&&jsxs("div",{className:"absolute bottom-3 right-3 rounded-lg overflow-hidden shadow-lg pointer-events-none",style:{width:x,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,x),height:Math.min(u,l),left:Math.max(0,Math.min(h,x-c)),top:Math.max(0,Math.min(y,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,p]=useState(true),[w,x]=useState(null);return useEffect(()=>{d(true);},[]),useEffect(()=>{if(!a$1)return;a(async()=>{try{let E=await import('./PdfDriver-MYEDFGO3.mjs');n(()=>E.PdfDriver),p(!1);}catch(E){console.error("Failed to load PDF driver:",E),x("Failed to load PDF viewer"),p(false);}},"loadPdfDriver")();},[a$1]),a$1?s?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})}):w||!o?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:w||"PDF viewer unavailable"})})}):jsx(o,{url:r}):jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var kr=50,rn=1e4,Sr=a(({url:r,blob:o})=>{let n=useRef(null),a$1=useRef(null),[d,s]=useState(null),[p,w]=useState(true),[x,R]=useState(1),E=useRef(false),[g,I]=useState({width:0,height:0}),B=useRef(0),t=a(()=>{E.current=true,R(k=>Math.min(k+.25,4));},"handleZoomIn"),z$1=a(()=>{E.current=true,R(k=>Math.max(k-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(a$1.current)try{w(!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 C=renderAsync(P,a$1.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),D=new Promise((U,Q)=>setTimeout(()=>Q(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([C,D]),await new Promise(U=>requestAnimationFrame(U));let $=a$1.current.querySelector(".docx-wrapper");if($&&(B.current=$.offsetWidth,I({width:$.offsetWidth,height:$.offsetHeight})),n.current&&B.current>0){let U=n.current.clientWidth,Q=Math.min(U/B.current,1);R(Q);}w(!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"),w(false);}},"renderDocument")();},[r,o]),useEffect(()=>{if(!n.current)return;let k=tn(S=>{if(!(E.current||B.current===0))for(let C of S){let D=C.contentRect.width,$=Math.min(D/B.current,1);R($);}},150),P=new ResizeObserver(k);return P.observe(n.current),()=>{P.disconnect(),k.cancel();}},[]),jsxs("div",{className:"h-full w-full flex flex-col px-0.5",children:[jsxs("div",{className:"flex justify-center items-stretch px-8 py-3 gap-1 border-b border-gray-200 dark:border-neutral-700",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Ra,{style:{width:20,height:20}}),onClick:z$1,disabled:x<=.25,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:7}),jsxs(rb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsx(_a,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(_a,{children:[Math.round(x*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(na,{style:{width:14,height:14}}),onClick:t,disabled:x>=4,className:"bg-white! dark:bg-neutral-800! hover:bg-blue-50! dark:hover:bg-neutral-700!",p:10})]}),!!d&&!p&&jsx("div",{className:"text-red-500 p-8",children:d}),p&&jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:n,className:"w-full h-full overflow-auto bg-gray-400 dark:bg-neutral-700 [&::-webkit-scrollbar-thumb]:bg-gray-100 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-600 [&::-webkit-scrollbar-track]:bg-gray-400 dark:[&::-webkit-scrollbar-track]:bg-neutral-700",style:{scrollbarGutter:"stable both-edges"},children:jsx("div",{style:{width:g.width>0?g.width*x:void 0,height:g.height>0?g.height*x:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:a$1,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
|
|
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!
|