@cyber-harbour/ui 2.2.9-beta.0 → 2.2.9
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 +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63,7 +63,7 @@ ${r?`
|
|
|
63
63
|
`:""}
|
|
64
64
|
|
|
65
65
|
min-width: 0;
|
|
66
|
-
`);var Kn=[.1,.25,.5,.75,1,1.5,2,3,4,5],Jn=5,Qn=.1,eo=140;function gt(r,n,o,a){return {x:r<o?(o-r)/2:0,y:n<a?(a-n)/2:0}}chunkVNCKTJME_js.a(gt,"computePadding");var br=chunkVNCKTJME_js.a(({url:r,alt:n="image",naturalWidth:o,naturalHeight:a,zoomSteps:d=Kn,maxZoom:i=Jn,minZoom:h=Qn,showMinimap:x=true,minimapWidth:k=eo,className:L,onZoomChange:P})=>{let[m,R]=react.useState("adaptive"),[_,t]=react.useState(1),[B,S]=react.useState(false),p=react.useRef(false),[O,M]=react.useState(false),[T,X]=react.useState(false),[q,ae]=react.useState({left:0,top:0}),ne=react.useRef(0),[ce,we]=react.useState({width:0,height:0}),de=react.useRef({width:0,height:0}),xe=react.useRef(null),ye=react.useRef(null),U=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),H=react.useRef(m),V=react.useRef(_),$=react.useRef(P);H.current=m,V.current=_,$.current=P;let G=o||de.current.width,oe=a||de.current.height,ie=react.useMemo(()=>[...d].sort((y,C)=>y-C),[d]),Y=react.useCallback(()=>ce.width===0||G===0?1:Math.min(ce.width/G,ce.height/oe,1),[ce,G,oe]),ee=react.useCallback((y,C)=>{if(C==="in"){let I=ie.find(A=>A>y+.001);return I!==void 0?Math.min(I,i):y}let j=ie.findLast(I=>I<y-.001);return j!==void 0?Math.max(j,h):y},[ie,i,h]),ue=react.useCallback(()=>H.current==="adaptive"?Y():V.current,[Y]),le=react.useCallback(y=>{R("manual"),t(y),$.current?.(y,"manual");},[]),pe=react.useCallback(()=>{R("adaptive"),$.current?.(Y(),"adaptive");},[Y]),De=react.useCallback(y=>{requestAnimationFrame(()=>{let C=ye.current;if(!C)return;let j=C.getBoundingClientRect(),I=G*y,A=oe*y,v=gt(I,A,j.width,j.height);C.scrollLeft=I/2+v.x-j.width/2,C.scrollTop=A/2+v.y-j.height/2;});},[G,oe]);react.useEffect(()=>{R("adaptive"),t(1),M(false),X(false),de.current={width:0,height:0};},[r]),react.useEffect(()=>{let y=ye.current;if(!y)return;let C=new ResizeObserver(j=>{let I=j[0];if(!I)return;let{width:A,height:v}=I.contentRect;we(F=>F.width===A&&F.height===v?F:{width:A,height:v});});return C.observe(y),()=>C.disconnect()},[]),react.useEffect(()=>{let y=ye.current;if(!y)return;let C=chunkVNCKTJME_js.a(()=>{cancelAnimationFrame(ne.current),ne.current=requestAnimationFrame(()=>{let j=y.scrollLeft,I=y.scrollTop;ae(A=>A.left===j&&A.top===I?A:{left:j,top:I});});},"handleScroll");return y.addEventListener("scroll",C,{passive:true}),()=>{y.removeEventListener("scroll",C),cancelAnimationFrame(ne.current);}},[]),react.useEffect(()=>{let y=ye.current;if(!y||!O)return;let C=chunkVNCKTJME_js.a(j=>{if(!(j.ctrlKey||j.metaKey))return;j.preventDefault();let I=ue(),A=j.deltaY>0?"out":"in",v=ee(I,A),F=Y();if(A==="out"&&v<=F){pe();return}let E=y.getBoundingClientRect(),K,J,te=de.current.width||1,be=de.current.height||1;if(H.current==="adaptive"){let he=xe.current;if(!he)return;let fe=he.getBoundingClientRect();K=(j.clientX-fe.left)/(fe.width/te),J=(j.clientY-fe.top)/(fe.height/be);}else {let he=te*I,fe=be*I,We=gt(he,fe,E.width,E.height);K=(y.scrollLeft+j.clientX-E.left-We.x)/I,J=(y.scrollTop+j.clientY-E.top-We.y)/I;}le(v),requestAnimationFrame(()=>{let he=y.getBoundingClientRect(),fe=gt(te*v,be*v,he.width,he.height);y.scrollLeft=K*v+fe.x-(j.clientX-he.left),y.scrollTop=J*v+fe.y-(j.clientY-he.top);});},"handleWheel");return y.addEventListener("wheel",C,{passive:false}),()=>y.removeEventListener("wheel",C)},[O,ue,ee,Y,le,pe]),react.useEffect(()=>{if(m!=="manual")return;let y=ye.current;if(!y)return;let C=chunkVNCKTJME_js.a(A=>{A.button===0&&(A.preventDefault(),p.current=true,S(true),U.current={x:A.clientX,y:A.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop});},"handleMouseDown"),j=chunkVNCKTJME_js.a(A=>{if(!p.current)return;let{x:v,y:F,scrollLeft:E,scrollTop:K}=U.current;y.scrollLeft=E-(A.clientX-v),y.scrollTop=K-(A.clientY-F);},"handleMouseMove"),I=chunkVNCKTJME_js.a(()=>{p.current=false,S(false);},"handleMouseUp");return y.addEventListener("mousedown",C),window.addEventListener("mousemove",j),window.addEventListener("mouseup",I),()=>{y.removeEventListener("mousedown",C),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",I);}},[m]);let _e=react.useCallback(()=>{m==="manual"&&pe();},[m,pe]),Ue=react.useCallback(()=>{let y=ue(),C=ee(y,"in");C!==y&&(le(C),De(C));},[ue,ee,le,De]),Le=react.useCallback(()=>{let y=ue(),C=ee(y,"out");if(C<=Y()){pe();return}le(C),De(C);},[ue,ee,Y,pe,le,De]),Be=react.useCallback(()=>{le(1),De(1);},[le,De]),Pe=react.useCallback(()=>{let y=xe.current;y&&(de.current={width:y.naturalWidth,height:y.naturalHeight},M(true),X(false));},[]),Me=m==="adaptive"?Y():_,Re=G*Me,Ze=oe*Me,Fe=ce.width,tt=ce.height,He=m==="manual"?gt(Re,Ze,Fe,tt):{x:0,y:0},It=x&&m==="manual"&&(Re>Fe||Ze>tt),e=G>0?k/G:0,l=oe*e,c=Fe>0?Fe/_*e:0,u=tt>0?tt/_*e:0,f=Math.max(0,q.left-He.x)/_*e,w=Math.max(0,q.top-He.y)/_*e,g=m==="adaptive"?"Fit":`${Math.round(_*100)}%`,b=ee(Me,"in")!==Me,D=m==="manual"||Me>h,N=m==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{width:Re,height:Ze,maxWidth:"none",maxHeight:"none",marginLeft:He.x,marginTop:He.y,flexShrink:0},z={cursor:m==="manual"?B?"grabbing":"grab":"default"};return jsxRuntime.jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${L??""}`,children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center px-8.5 py-3 gap-1 shrink-0",children:[jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsxRuntime.jsx(chunkVNCKTJME_js.Pa,{style:{width:20,height:20}}),onClick:Le,disabled:!D,p:7,className:"bg-white! hover:bg-blue-50! h-[38px]!"}),jsxRuntime.jsx("button",{type:"button",onClick:m==="manual"?pe:void 0,className:"flex items-center justify-center bg-white h-[38px] min-w-16 px-3 select-none border border-gray-300 rounded-md","aria-label":g,children:jsxRuntime.jsx(chunkVNCKTJME_js.Ya,{style:{fontSize:12,fontWeight:500},children:g})}),jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsxRuntime.jsx(chunkVNCKTJME_js.ma,{style:{width:14,height:14}}),onClick:Ue,disabled:!b,className:"bg-white! hover:bg-blue-50! h-[38px]!",p:10}),jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"fit-to-container",size:"small",color:m==="adaptive"?"primary":"default",icon:jsxRuntime.jsx(chunkVNCKTJME_js.ra,{style:{width:14,height:14}}),onClick:pe,className:`${m==="adaptive"?"bg-blue-50!":"bg-white! hover:bg-blue-50!"} ml-auto h-[38px]!`,p:10}),jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"original-size",size:"small",color:m==="manual"&&_===1?"primary":"default",onClick:Be,className:`${m==="manual"&&_===1?"bg-blue-50!":"bg-white! hover:bg-blue-50!"} h-[38px]!`,p:10,children:jsxRuntime.jsx(chunkVNCKTJME_js.Ya,{style:{fontSize:12,fontWeight:500,lineHeight:1},children:"1:1"})})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 min-w-0 relative",children:[jsxRuntime.jsx("div",{ref:ye,className:`h-full w-full ${m==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:z,onDoubleClick:_e,children:T?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx(chunkVNCKTJME_js.Ya,{color:"text.lighter",children:"Failed to load image"})}):jsxRuntime.jsx("img",{ref:xe,src:r,alt:n,draggable:false,className:"block select-none",style:N,onLoad:Pe,onError:()=>X(true)})}),It&&jsxRuntime.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:[jsxRuntime.jsx("img",{src:r,alt:"",draggable:false,className:"block w-full h-full object-contain"}),jsxRuntime.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(f,k-c)),top:Math.max(0,Math.min(w,l-u)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var yr=chunkVNCKTJME_js.a(({url:r})=>jsxRuntime.jsx("div",{className:"flex flex-col justify-center items-center w-full h-full py-5.5 px-8.5",children:jsxRuntime.jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var jt=chunkVNCKTJME_js.a(({url:r})=>{let[n,o]=react.useState(null),[a,d]=react.useState(false),[i,h]=react.useState(true),[x,k]=react.useState(null);return react.useEffect(()=>{d(true);},[]),react.useEffect(()=>{if(!a)return;chunkVNCKTJME_js.a(async()=>{try{let P=await import('./PdfDriver-FBZLULAL.js');o(()=>P.PdfDriver),h(!1);}catch(P){console.error("Failed to load PDF driver:",P),k("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[a]),a?i?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):x||!n?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx("div",{className:"text-red-500 text-center",children:jsxRuntime.jsx("p",{children:x||"PDF viewer unavailable"})})}):jsxRuntime.jsx(n,{url:r}):jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var kr=50,no=1e4,Sr=chunkVNCKTJME_js.a(({url:r,blob:n})=>{let o=react.useRef(null),a=react.useRef(null),[d,i]=react.useState(null),[h,x]=react.useState(true),[k,L]=react.useState(1),P=react.useRef(false),[m,R]=react.useState({width:0,height:0}),_=react.useRef(0),t=chunkVNCKTJME_js.a(()=>{P.current=true,L(S=>Math.min(S+.25,4));},"handleZoomIn"),B=chunkVNCKTJME_js.a(()=>{P.current=true,L(S=>Math.max(S-.25,.25));},"handleZoomOut");return react.useEffect(()=>{chunkVNCKTJME_js.a(async()=>{if(a.current)try{x(!0),i(null);let p=n;if(!p&&r&&(p=await(await fetch(r)).blob()),!p){i("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(p.size/(1024*1024)>kr){i(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${kr} \u041C\u0411)`);return}a.current.innerHTML="";let M=docxPreview.renderAsync(p,a.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),T=new Promise((q,ae)=>setTimeout(()=>ae(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([M,T]),await new Promise(q=>requestAnimationFrame(q));let X=a.current.querySelector(".docx-wrapper");if(X&&(_.current=X.offsetWidth,R({width:X.offsetWidth,height:X.offsetHeight})),o.current&&_.current>0){let q=o.current.clientWidth,ae=Math.min(q/_.current,1);L(ae);}x(!1);}catch(p){i(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,n]),react.useEffect(()=>{if(!o.current)return;let S=ro__default.default(O=>{if(!(P.current||_.current===0))for(let M of O){let T=M.contentRect.width,X=Math.min(T/_.current,1);L(X);}},150),p=new ResizeObserver(S);return p.observe(o.current),()=>{p.disconnect(),S.cancel();}},[]),jsxRuntime.jsxs("div",{className:"h-full w-full flex flex-col px-0.5",children:[jsxRuntime.jsxs("div",{className:"flex justify-center items-stretch px-8 py-3 gap-1 border-b border-gray-200",children:[jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsxRuntime.jsx(chunkVNCKTJME_js.Pa,{style:{width:20,height:20}}),onClick:B,disabled:k<=.25,className:"bg-white! hover:bg-blue-50!",p:7}),jsxRuntime.jsxs(chunkVNCKTJME_js.pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsxRuntime.jsx(chunkVNCKTJME_js.Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxRuntime.jsxs(chunkVNCKTJME_js.Ya,{children:[Math.round(k*100),"%"]})]}),jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsxRuntime.jsx(chunkVNCKTJME_js.ma,{style:{width:14,height:14}}),onClick:t,disabled:k>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),!!d&&!h&&jsxRuntime.jsx("div",{className:"text-red-500 p-8",children:d}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsxRuntime.jsx("div",{ref:o,className:"w-full h-full overflow-auto [&::-webkit-scrollbar-thumb]:bg-gray-100 [&::-webkit-scrollbar-track]:bg-[gray]",style:{backgroundColor:"gray",scrollbarGutter:"stable both-edges",scrollbarColor:"#f1f1f1 gray"},children:jsxRuntime.jsx("div",{style:{width:m.width>0?m.width*k:void 0,height:m.height>0?m.height*k:void 0,overflow:"hidden",margin:"0 auto"},children:jsxRuntime.jsx("div",{ref:a,className:`[&>div.docx-wrapper_table_*]:wrap-break-word!
|
|
66
|
+
`);var Kn=[.1,.25,.5,.75,1,1.5,2,3,4,5],Jn=5,Qn=.1,eo=140;function gt(r,n,o,a){return {x:r<o?(o-r)/2:0,y:n<a?(a-n)/2:0}}chunkVNCKTJME_js.a(gt,"computePadding");var br=chunkVNCKTJME_js.a(({url:r,alt:n="image",naturalWidth:o,naturalHeight:a,zoomSteps:d=Kn,maxZoom:i=Jn,minZoom:h=Qn,showMinimap:x=true,minimapWidth:k=eo,className:L,onZoomChange:P})=>{let[m,R]=react.useState("adaptive"),[_,t]=react.useState(1),[B,S]=react.useState(false),p=react.useRef(false),[O,M]=react.useState(false),[T,X]=react.useState(false),[q,ae]=react.useState({left:0,top:0}),ne=react.useRef(0),[ce,we]=react.useState({width:0,height:0}),de=react.useRef({width:0,height:0}),xe=react.useRef(null),ye=react.useRef(null),U=react.useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),H=react.useRef(m),V=react.useRef(_),$=react.useRef(P);H.current=m,V.current=_,$.current=P;let G=o||de.current.width,oe=a||de.current.height,ie=react.useMemo(()=>[...d].sort((y,C)=>y-C),[d]),Y=react.useCallback(()=>ce.width===0||G===0?1:Math.min(ce.width/G,ce.height/oe,1),[ce,G,oe]),ee=react.useCallback((y,C)=>{if(C==="in"){let I=ie.find(A=>A>y+.001);return I!==void 0?Math.min(I,i):y}let j=ie.findLast(I=>I<y-.001);return j!==void 0?Math.max(j,h):y},[ie,i,h]),ue=react.useCallback(()=>H.current==="adaptive"?Y():V.current,[Y]),le=react.useCallback(y=>{R("manual"),t(y),$.current?.(y,"manual");},[]),pe=react.useCallback(()=>{R("adaptive"),$.current?.(Y(),"adaptive");},[Y]),De=react.useCallback(y=>{requestAnimationFrame(()=>{let C=ye.current;if(!C)return;let j=C.getBoundingClientRect(),I=G*y,A=oe*y,v=gt(I,A,j.width,j.height);C.scrollLeft=I/2+v.x-j.width/2,C.scrollTop=A/2+v.y-j.height/2;});},[G,oe]);react.useEffect(()=>{R("adaptive"),t(1),M(false),X(false),de.current={width:0,height:0};},[r]),react.useEffect(()=>{let y=ye.current;if(!y)return;let C=new ResizeObserver(j=>{let I=j[0];if(!I)return;let{width:A,height:v}=I.contentRect;we(F=>F.width===A&&F.height===v?F:{width:A,height:v});});return C.observe(y),()=>C.disconnect()},[]),react.useEffect(()=>{let y=ye.current;if(!y)return;let C=chunkVNCKTJME_js.a(()=>{cancelAnimationFrame(ne.current),ne.current=requestAnimationFrame(()=>{let j=y.scrollLeft,I=y.scrollTop;ae(A=>A.left===j&&A.top===I?A:{left:j,top:I});});},"handleScroll");return y.addEventListener("scroll",C,{passive:true}),()=>{y.removeEventListener("scroll",C),cancelAnimationFrame(ne.current);}},[]),react.useEffect(()=>{let y=ye.current;if(!y||!O)return;let C=chunkVNCKTJME_js.a(j=>{if(!(j.ctrlKey||j.metaKey))return;j.preventDefault();let I=ue(),A=j.deltaY>0?"out":"in",v=ee(I,A),F=Y();if(A==="out"&&v<=F){pe();return}let E=y.getBoundingClientRect(),K,J,te=de.current.width||1,be=de.current.height||1;if(H.current==="adaptive"){let he=xe.current;if(!he)return;let fe=he.getBoundingClientRect();K=(j.clientX-fe.left)/(fe.width/te),J=(j.clientY-fe.top)/(fe.height/be);}else {let he=te*I,fe=be*I,We=gt(he,fe,E.width,E.height);K=(y.scrollLeft+j.clientX-E.left-We.x)/I,J=(y.scrollTop+j.clientY-E.top-We.y)/I;}le(v),requestAnimationFrame(()=>{let he=y.getBoundingClientRect(),fe=gt(te*v,be*v,he.width,he.height);y.scrollLeft=K*v+fe.x-(j.clientX-he.left),y.scrollTop=J*v+fe.y-(j.clientY-he.top);});},"handleWheel");return y.addEventListener("wheel",C,{passive:false}),()=>y.removeEventListener("wheel",C)},[O,ue,ee,Y,le,pe]),react.useEffect(()=>{if(m!=="manual")return;let y=ye.current;if(!y)return;let C=chunkVNCKTJME_js.a(A=>{A.button===0&&(A.preventDefault(),p.current=true,S(true),U.current={x:A.clientX,y:A.clientY,scrollLeft:y.scrollLeft,scrollTop:y.scrollTop});},"handleMouseDown"),j=chunkVNCKTJME_js.a(A=>{if(!p.current)return;let{x:v,y:F,scrollLeft:E,scrollTop:K}=U.current;y.scrollLeft=E-(A.clientX-v),y.scrollTop=K-(A.clientY-F);},"handleMouseMove"),I=chunkVNCKTJME_js.a(()=>{p.current=false,S(false);},"handleMouseUp");return y.addEventListener("mousedown",C),window.addEventListener("mousemove",j),window.addEventListener("mouseup",I),()=>{y.removeEventListener("mousedown",C),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",I);}},[m]);let _e=react.useCallback(()=>{m==="manual"&&pe();},[m,pe]),Ue=react.useCallback(()=>{let y=ue(),C=ee(y,"in");C!==y&&(le(C),De(C));},[ue,ee,le,De]),Le=react.useCallback(()=>{let y=ue(),C=ee(y,"out");if(C<=Y()){pe();return}le(C),De(C);},[ue,ee,Y,pe,le,De]),Be=react.useCallback(()=>{le(1),De(1);},[le,De]),Pe=react.useCallback(()=>{let y=xe.current;y&&(de.current={width:y.naturalWidth,height:y.naturalHeight},M(true),X(false));},[]),Me=m==="adaptive"?Y():_,Re=G*Me,Ze=oe*Me,Fe=ce.width,tt=ce.height,He=m==="manual"?gt(Re,Ze,Fe,tt):{x:0,y:0},It=x&&m==="manual"&&(Re>Fe||Ze>tt),e=G>0?k/G:0,l=oe*e,c=Fe>0?Fe/_*e:0,u=tt>0?tt/_*e:0,f=Math.max(0,q.left-He.x)/_*e,w=Math.max(0,q.top-He.y)/_*e,g=m==="adaptive"?"Fit":`${Math.round(_*100)}%`,b=ee(Me,"in")!==Me,D=m==="manual"||Me>h,N=m==="adaptive"?{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}:{width:Re,height:Ze,maxWidth:"none",maxHeight:"none",marginLeft:He.x,marginTop:He.y,flexShrink:0},z={cursor:m==="manual"?B?"grabbing":"grab":"default"};return jsxRuntime.jsxs("div",{className:`h-full w-full flex flex-col min-h-0 min-w-0 overflow-hidden ${L??""}`,children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center px-8.5 py-3 gap-1 shrink-0",children:[jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsxRuntime.jsx(chunkVNCKTJME_js.Pa,{style:{width:20,height:20}}),onClick:Le,disabled:!D,p:7,className:"bg-white! hover:bg-blue-50! h-[38px]!"}),jsxRuntime.jsx("button",{type:"button",onClick:m==="manual"?pe:void 0,className:"flex items-center justify-center bg-white h-[38px] min-w-16 px-3 select-none border border-gray-300 rounded-md","aria-label":g,children:jsxRuntime.jsx(chunkVNCKTJME_js.Ya,{style:{fontSize:12,fontWeight:500},children:g})}),jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsxRuntime.jsx(chunkVNCKTJME_js.ma,{style:{width:14,height:14}}),onClick:Ue,disabled:!b,className:"bg-white! hover:bg-blue-50! h-[38px]!",p:10}),jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"fit-to-container",size:"small",color:m==="adaptive"?"primary":"default",icon:jsxRuntime.jsx(chunkVNCKTJME_js.ra,{style:{width:14,height:14}}),onClick:pe,className:`${m==="adaptive"?"bg-blue-50!":"bg-white! hover:bg-blue-50!"} ml-auto h-[38px]!`,p:10}),jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"original-size",size:"small",color:m==="manual"&&_===1?"primary":"default",onClick:Be,className:`${m==="manual"&&_===1?"bg-blue-50!":"bg-white! hover:bg-blue-50!"} h-[38px]!`,py:10,px:11,children:jsxRuntime.jsx(chunkVNCKTJME_js.Ya,{style:{fontSize:12,fontWeight:500,lineHeight:1},children:"1:1"})})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 min-w-0 relative",children:[jsxRuntime.jsx("div",{ref:ye,className:`h-full w-full ${m==="adaptive"?"flex items-center justify-center overflow-hidden":"overflow-auto"}`,style:z,onDoubleClick:_e,children:T?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx(chunkVNCKTJME_js.Ya,{color:"text.lighter",children:"Failed to load image"})}):jsxRuntime.jsx("img",{ref:xe,src:r,alt:n,draggable:false,className:"block select-none",style:N,onLoad:Pe,onError:()=>X(true)})}),It&&jsxRuntime.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:[jsxRuntime.jsx("img",{src:r,alt:"",draggable:false,className:"block w-full h-full object-contain"}),jsxRuntime.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(f,k-c)),top:Math.max(0,Math.min(w,l-u)),background:"rgba(59,130,246,0.1)"}})]})]})]})},"ImageDriver");var yr=chunkVNCKTJME_js.a(({url:r})=>jsxRuntime.jsx("div",{className:"flex flex-col justify-center items-center w-full h-full py-5.5 px-8.5",children:jsxRuntime.jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var jt=chunkVNCKTJME_js.a(({url:r})=>{let[n,o]=react.useState(null),[a,d]=react.useState(false),[i,h]=react.useState(true),[x,k]=react.useState(null);return react.useEffect(()=>{d(true);},[]),react.useEffect(()=>{if(!a)return;chunkVNCKTJME_js.a(async()=>{try{let P=await import('./PdfDriver-FBZLULAL.js');o(()=>P.PdfDriver),h(!1);}catch(P){console.error("Failed to load PDF driver:",P),k("Failed to load PDF viewer"),h(false);}},"loadPdfDriver")();},[a]),a?i?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})}):x||!n?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx("div",{className:"text-red-500 text-center",children:jsxRuntime.jsx("p",{children:x||"PDF viewer unavailable"})})}):jsxRuntime.jsx(n,{url:r}):jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx("div",{className:"text-gray-500",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var kr=50,no=1e4,Sr=chunkVNCKTJME_js.a(({url:r,blob:n})=>{let o=react.useRef(null),a=react.useRef(null),[d,i]=react.useState(null),[h,x]=react.useState(true),[k,L]=react.useState(1),P=react.useRef(false),[m,R]=react.useState({width:0,height:0}),_=react.useRef(0),t=chunkVNCKTJME_js.a(()=>{P.current=true,L(S=>Math.min(S+.25,4));},"handleZoomIn"),B=chunkVNCKTJME_js.a(()=>{P.current=true,L(S=>Math.max(S-.25,.25));},"handleZoomOut");return react.useEffect(()=>{chunkVNCKTJME_js.a(async()=>{if(a.current)try{x(!0),i(null);let p=n;if(!p&&r&&(p=await(await fetch(r)).blob()),!p){i("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(p.size/(1024*1024)>kr){i(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${kr} \u041C\u0411)`);return}a.current.innerHTML="";let M=docxPreview.renderAsync(p,a.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),T=new Promise((q,ae)=>setTimeout(()=>ae(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([M,T]),await new Promise(q=>requestAnimationFrame(q));let X=a.current.querySelector(".docx-wrapper");if(X&&(_.current=X.offsetWidth,R({width:X.offsetWidth,height:X.offsetHeight})),o.current&&_.current>0){let q=o.current.clientWidth,ae=Math.min(q/_.current,1);L(ae);}x(!1);}catch(p){i(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,n]),react.useEffect(()=>{if(!o.current)return;let S=ro__default.default(O=>{if(!(P.current||_.current===0))for(let M of O){let T=M.contentRect.width,X=Math.min(T/_.current,1);L(X);}},150),p=new ResizeObserver(S);return p.observe(o.current),()=>{p.disconnect(),S.cancel();}},[]),jsxRuntime.jsxs("div",{className:"h-full w-full flex flex-col px-0.5",children:[jsxRuntime.jsxs("div",{className:"flex justify-center items-stretch px-8 py-3 gap-1 border-b border-gray-200",children:[jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsxRuntime.jsx(chunkVNCKTJME_js.Pa,{style:{width:20,height:20}}),onClick:B,disabled:k<=.25,className:"bg-white! hover:bg-blue-50!",p:7}),jsxRuntime.jsxs(chunkVNCKTJME_js.pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21 rounded-[5px]!",children:[jsxRuntime.jsx(chunkVNCKTJME_js.Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxRuntime.jsxs(chunkVNCKTJME_js.Ya,{children:[Math.round(k*100),"%"]})]}),jsxRuntime.jsx(chunkVNCKTJME_js.z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsxRuntime.jsx(chunkVNCKTJME_js.ma,{style:{width:14,height:14}}),onClick:t,disabled:k>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),!!d&&!h&&jsxRuntime.jsx("div",{className:"text-red-500 p-8",children:d}),h&&jsxRuntime.jsx("div",{className:"flex items-center justify-center p-8",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsxRuntime.jsx("div",{ref:o,className:"w-full h-full overflow-auto [&::-webkit-scrollbar-thumb]:bg-gray-100 [&::-webkit-scrollbar-track]:bg-[gray]",style:{backgroundColor:"gray",scrollbarGutter:"stable both-edges",scrollbarColor:"#f1f1f1 gray"},children:jsxRuntime.jsx("div",{style:{width:m.width>0?m.width*k:void 0,height:m.height>0?m.height*k:void 0,overflow:"hidden",margin:"0 auto"},children:jsxRuntime.jsx("div",{ref:a,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!
|