@cyber-harbour/ui 2.1.16 → 2.1.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/index.css +1 -1
- package/dist/index.css.map +1 -1
- 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/dist/styles/tailwind.css +1 -1
- package/dist/styles/tailwind.css.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -63,7 +63,7 @@ ${r?`
|
|
|
63
63
|
`:""}
|
|
64
64
|
|
|
65
65
|
min-width: 0;
|
|
66
|
-
`);var $t=a(({url:r})=>{let[o,s]=useState(1),[h,g]=useState(),b=At.useRef(null),f=At.useRef(null),x=a(()=>{s(L=>Math.min(L+.25,4));},"handleZoomIn");return jsxs("div",{ref:f,className:"h-full w-full flex flex-col",children:[jsxs("div",{className:"flex justify-center items-stretch p-5.5 gap-1 border-b border-gray-200 relative ",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:a(()=>{s(L=>Math.max(L-.25,.25));},"handleZoomOut"),disabled:o<=.25,className:"bg-white! hover:bg-blue-50!",p:7}),jsxs(pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[o*100,"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:x,disabled:o>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),jsx("div",{className:"h-full w-full overflow-auto",children:jsx("img",{src:r,ref:b,alt:"image",className:"block w-auto max-w-none object-contain",style:{transition:"all 0.2s ease-in-out",marginInline:"auto",marginBlock:10,flexShrink:0,...h==="width"&&{width:`calc(${o*100}% - 20px)`},...h==="height"&&{height:`calc(${o*100}% - 20px)`}},onLoad:()=>{if(b.current&&f.current){let L=b.current.width,I=b.current.height,k=L<I?"height":"width";g(k);}}})})]})},"ImageDriver");var Ht=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full p-5.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var rt=a(({url:r})=>{let[o,s]=useState(null),[h,g]=useState(false),[b,f]=useState(true),[x,T]=useState(null);return useEffect(()=>{g(true);},[]),useEffect(()=>{if(!h)return;a(async()=>{try{let I=await import('./PdfDriver-PM4M3WEK.mjs');s(()=>I.PdfDriver),f(!1);}catch(I){console.error("Failed to load PDF driver:",I),T("Failed to load PDF viewer"),f(false);}},"loadPdfDriver")();},[h]),h?b?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",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",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var Yt=50,po=1e4,Gt=a(({url:r,blob:o})=>{let s=useRef(null),h=useRef(null),[g,b]=useState(null),[f,x]=useState(true),[T,L]=useState(1),I=useRef(false),[k,C]=useState({width:0,height:0}),F=useRef(0),t=a(()=>{I.current=true,L(B=>Math.min(B+.25,4));},"handleZoomIn"),j=a(()=>{I.current=true,L(B=>Math.max(B-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(h.current)try{x(!0),b(null);let m=o;if(!m&&r&&(m=await(await fetch(r)).blob()),!m){b("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(m.size/(1024*1024)>Yt){b(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Yt} \u041C\u0411)`);return}h.current.innerHTML="";let P=renderAsync(m,h.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),D=new Promise((G,te)=>setTimeout(()=>te(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")),po));await Promise.race([P,D]),await new Promise(G=>requestAnimationFrame(G));let V=h.current.querySelector(".docx-wrapper");if(V&&(F.current=V.offsetWidth,C({width:V.offsetWidth,height:V.offsetHeight})),s.current&&F.current>0){let G=s.current.clientWidth,te=Math.min(G/F.current,1);L(te);}x(!1);}catch(m){b(m?.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(!s.current)return;let B=uo(R=>{if(!(I.current||F.current===0))for(let P of R){let D=P.contentRect.width,V=Math.min(D/F.current,1);L(V);}},150),m=new ResizeObserver(B);return m.observe(s.current),()=>{m.disconnect(),B.cancel();}},[]),jsxs("div",{className:"h-full w-full flex flex-col",children:[jsxs("div",{className:"flex justify-center items-stretch p-5.5 gap-1 border-b border-gray-200",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:j,disabled:T<=.25,className:"bg-white! hover:bg-blue-50!",p:7}),jsxs(pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[Math.round(T*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:t,disabled:T>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),!!g&&!f&&jsx("div",{className:"text-red-500 p-5",children:g}),f&&jsx("div",{className:"flex items-center justify-center p-5",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:s,className:"w-full h-full overflow-auto",style:{backgroundColor:"gray"},children:jsx("div",{style:{width:k.width>0?k.width*T:void 0,height:k.height>0?k.height*T:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:h,className:"[&>div.docx-wrapper_table_*]:wrap-break-word! [&>div.docx-wrapper_table]:table-fixed! [&>div.docx-wrapper_table]:max-w-full! [&>div.docx-wrapper_table]:w-full! [&>div.docx-wrapper_img]:max-w-full! [&>div.docx-wrapper_img]:h-auto! [&>div.docx-wrapper_table]:border-collapse! [&>div.docx-wrapper]:box-border [&>div.docx-wrapper]:min-w-fit [&>div.docx-wrapper>section]:min-w-fit [&>div.docx-wrapper]:min-h-full",style:{boxSizing:"border-box",wordBreak:"break-word",overflowWrap:"break-word",transform:`scale(${T})`,transformOrigin:"top left"}})})})]})},"DocxDriver");var Mo=a(r=>({js:[javascript({jsx:false})],jsx:[javascript({jsx:true})],ts:[javascript({typescript:true,jsx:false})],tsx:[javascript({typescript:true,jsx:true})],json:[json()],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()]})[r]||[],"getLanguageExtension"),Jt=a(({url:r,extension:o})=>{let[s,h]=useState(""),[g,b]=useState(true),[f,x]=useState(null),[T,L]=useState(0),I=useRef(null);if(useEffect(()=>{a(async()=>{try{b(!0),x(null);let t=await fetch(r);if(!t.ok)throw new Error(`Failed to load file: ${t.statusText}`);let j=await t.text();h(j);}catch(t){x(t instanceof Error?t.message:"Failed to load text content");}finally{b(false);}},"loadTextContent")();},[r]),useEffect(()=>{let F=a(()=>{if(I.current){let t=I.current.clientHeight;L(t);}},"updateHeight");return F(),window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F);}},[g]),g)return jsx("div",{className:"flex items-center justify-center p-8",children:jsx("div",{className:"text-gray-500",children:"Loading text content..."})});if(f)return jsx("div",{className:"flex items-center justify-center p-8",children:jsxs("div",{className:"text-red-500",children:["Error: ",f]})});if(o==="md")return jsx("div",{ref:I,className:"h-full w-full overflow-auto p-5 prose max-w-[100%] select-text prose-table",style:{wordBreak:"break-word"},children:jsx(So,{remarkPlugins:[Po],children:s})});let C=Mo(o);return jsx("div",{ref:I,className:"h-full w-full",children:T>0&&jsx(fo,{value:s,theme:vscodeLight,extensions:C,editable:false,height:`${T}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 Qt=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full",children:jsx("video",{controls:true,src:r,className:"w-full max-h-full"})}),"VideoDriver");var er=memo(a(function({extension:o,blob:s,path:h,buffer:g,not_supported_message:b=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:o,blob:s,path:h,buffer:g});let f=o.toLocaleLowerCase().trim(),x;if(h?x=h:s&&(x=URL.createObjectURL(s)),x){if(["jpeg","jpg","png","gif","bmp","webp"].includes(f))return jsx($t,{url:x});if(["mp3","wav","ogg","flac"].includes(f))return jsx(Ht,{url:x});if(["mp4","webm"].includes(f))return jsx(Qt,{url:x});if(o==="pdf")return jsx(rt,{url:x});if(["txt","js","jsx","ts","tsx","json","html","css","scss","py","java","cpp","c","cs","php","rb","go","rs","swift","kt","xml","yaml","yml","md","sql","sh","bash"].includes(f))return jsx(Jt,{url:x,extension:f})}return f==="docx"?jsx(Gt,{url:x,blob:s}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(pb,{className:"mx-5",children:jsx(Ya,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:b})})})},"Driver"));var Hc=a(r=>jsx("div",{className:"h-full w-full",children:jsx(er,{...r})}),"FileViewer");var or=250,el=a(({text:r,speed:o=50,onDone:s,markdown:h=false,markdownComponents:g={},className:b,...f})=>{let[x,T]=useState(""),L=useRef(null),I=useRef(null);return useEffect(()=>{let k=false;if(o>0){T(""),L.current=performance.now();let C=a(F=>{if(k||!L.current)return;let t=F-L.current,j=t/o>or?o/2:o,B=t/o>or?1.5:1,m=Math.floor(t/j*B);if(m>=r.length){T(r),k=true,s?.();return}T(r.slice(0,m)),I.current=requestAnimationFrame(C);},"tick");I.current=requestAnimationFrame(C);}else T(r),s?.();return ()=>{I.current&&cancelAnimationFrame(I.current);}},[r,o,s]),h?jsx("div",{className:b,children:jsx(So,{remarkPlugins:[Po],components:g,...f,children:x})}):jsx(Ya,{className:b,...f,children:x})},"Typewriter");var Fo={timeout:2e3,message:"Copied!"},dl=a(({text:r,children:o,format:s="text/plain",tooltip:h})=>{let[g,b]=useState(false),f=useRef(null),x={...Fo,...h},T=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):Ro(r,{format:s}),b(true),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>b(false),x.timeout);},"handleCopy");return useEffect(()=>()=>{f.current&&clearTimeout(f.current);},[]),jsx(Bb,{onMouseLeave:()=>b(false),className:g?"visible":"hidden",content:x.message,children:o({copy:T})})},"CopyToClipboard");var ar=a(r=>new Date(r?Array.isArray(r)?r[1]||r[0]||new Date:r:new Date),"getInitValue"),qe=a((r,o)=>{let s;if(o){let g=parse(r||"",o,new Date);if(isValid(g)&&getYear(g)>=1970)return g}let h=new Date(r||"");return isNaN(h.getTime())?s:h},"parseDate"),qo=a((r,o)=>{let s=r?qe(r,o):void 0;return s&&o?format(s,o):r},"renderDate"),Dl=a(({value:r,range:o,inline:s=false,minDate:h=new Date(getYear(new Date)-5,0,1),maxDate:g=new Date(getYear(new Date)+5,11,31),format:b="dd.MM.yyyy",onChange:f,...x})=>{let[T,L]=useState(getMonth(ar(r))),[I,k]=useState(getYear(ar(r))),C=useMemo(()=>{if(r){if(Array.isArray(r)){let t=qe(r[0],b),j=qe(r[1],b);return [t,j]}return qe(r,b)}},[r]),F=useCallback(t=>{if(o){let j=!!(C&&Array.isArray(C)&&C[0]),B=!!(C&&Array.isArray(C)&&C[1]);!j||j&&B?f?.([t.toString(),""]):j&&!B&&(t<C[0]?f?.([t.toString(),C[0].toString()]):f?.([C[0].toString(),t.toString()]));}else f?.(t.toString());},[o,C,f]);return s?jsx(ir,{month:T,year:I,minDate:h,maxDate:g,selectedDate:C,onSelectDate:F,onChangeMonth:L,onChangeYear:k}):o?jsx(Vo,{range:true,value:r,onChange:f,...x}):jsx(Zo,{value:r,onChange:f,minDate:h,maxDate:g,month:T,year:I,selectedDate:C,onChangeMonth:L,onChangeYear:k,onSelectDate:F,formatStr:b,...x})},"DatePicker"),Vo=a(({minDate:r,maxDate:o,value:s,onChange:h})=>null,"DatePickerGroupInput"),Zo=a(({placeholder:r,value:o,onChange:s,inputProps:h,...g})=>{let[b,f]=useState(false),x=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:b,onClickOutside:()=>f(false),content:jsx(pb,{children:jsx(ir,{...g})}),containerStyle:{zIndex:`${x.zIndex.popover}`},children:jsx("div",{onClick:()=>f(true),children:jsx(kb,{...h,placeholder:r,value:qo(o,g.formatStr),onChange:T=>s?.(T.target.value)})})})},"DatePickerInput"),ir=a(({month:r,year:o,selectedDate:s,minDate:h,maxDate:g,onSelectDate:b,onChangeMonth:f,onChangeYear:x})=>{let T=useMemo(()=>new Array(12).fill(null).map((m,R)=>{let P=new Date(0,R);return {value:R+1,inputDisplay:format(P,"MMMM")}}),[]),L=useMemo(()=>{let m=getYear(h),P=getYear(g)-m+1;return new Array(P).fill(null).map((D,V)=>{let G=m+V;return {value:G,inputDisplay:G.toString()}})},[h,g]),I=useMemo(()=>new Array(7).fill(null).map((m,R)=>{let P=startOfWeek(new Date,{weekStartsOn:R});return format(P,"EEE")}),[]),k=useMemo(()=>{let m=startOfMonth(new Date(o,r)),R=endOfMonth(new Date(o,r)),P=getDay(m)===0?m:previousSunday(m),D=getDay(R)===6?R:nextSaturday(R),V=differenceInDays(D,P),G=differenceInDays(m,P);return new Array(V+1).fill(null).map((te,J)=>new Date(o,r,J-G+1))},[r,o]),C=useCallback(()=>{r===0?(x(o-1),f(11)):f(r-1);},[r,o]),F=useCallback(()=>{r===11?(x(o+1),f(0)):f(r+1);},[r,o]),t=useMemo(()=>h?!(o<getYear(h)||o===getYear(h)&&r<=getMonth(h)):true,[r,o,h]),j=useMemo(()=>g?!(o>getYear(g)||o===getYear(g)&&r>=getMonth(g)):true,[r,o,g]),B=useCallback(m=>{m.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:B,children:[jsxs("div",{className:"flex justify-center items-center gap-2 pb-3",children:[t&&jsx(z,{size:"small",variant:"empty",icon:jsx(G,{}),onClick:C}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(ib,{placeholder:"",hasBorder:false,selected:r+1,options:T,onSelect:m=>f(m-1),maxWidth:150,maxHeight:300}),jsx(ib,{placeholder:"",hasBorder:false,selected:o,options:L,onSelect:m=>x(m),maxWidth:100,maxHeight:300})]}),j&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:F})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:I.map(m=>jsx("div",{className:"text-center",children:m},m))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:k.map(m=>{let R=getMonth(m)===r,P=format(m,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),D=s&&(Array.isArray(s)&&(s[0]&&format(m,"yyyy-MM-dd")===format(s[0],"yyyy-MM-dd")||s[1]&&format(m,"yyyy-MM-dd")===format(s[1],"yyyy-MM-dd"))||!Array.isArray(s)&&format(m,"yyyy-MM-dd")===format(s,"yyyy-MM-dd")),V=s&&Array.isArray(s)&&s[0]&&s[1]&&m>s[0]&&m<s[1],G=h&&differenceInDays(m,h)<0||g&&differenceInDays(m,g)>0||!R;return jsx(Uo,{date:m,isCurrentMonth:R,isCurrentDay:P,isSelected:!!D,isInRange:!!V,isDisabled:!!G,onSelectDate:b},m.toISOString())})})]})},"DatePickerCalendar"),Uo=a(({date:r,isCurrentMonth:o,isCurrentDay:s,isSelected:h,isInRange:g,isDisabled:b,onSelectDate:f})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${b?"text-gray-400 cursor-not-allowed":h?"bg-blue-500 text-white":g?"bg-blue-100":s?"text-blue-500":o?"text-black":"text-gray-400"} ${b?"":h?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(T=>{b||f(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");var Qo=a(r=>{switch(r){case "primary":return "bg-blue-100 border-blue-200 dark:bg-blue-800/10 dark:border-blue-900";case "error":return "bg-red-100 border-red-200 dark:bg-red-800/10 dark:border-red-900";case "warning":return "bg-yellow-100 border-yellow-200 dark:bg-yellow-800/10 dark:border-yellow-900";case "success":return "bg-teal-100 border-teal-200 dark:bg-teal-800/10 dark:border-teal-900";case "default":default:return "bg-white border border-gray-200 dark:bg-neutral-800 dark:border-neutral-700"}},"getColorStyle"),en=a(r=>{switch(r){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"),tn=a(r=>{switch(r){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),dr=a(({id:r,color:o="default",message:s,duration:h,transitionDirection:g,cancelable:b=true,onClose:f})=>{let[x,T]=useState(false),[L,I]=useState(false),k=useRef(null),C=useCallback(()=>{T(true),k.current=setTimeout(()=>{f(r);},300);},[r,f]);return useEffect(()=>{if(I(true),h&&h<1/0){let F=setTimeout(()=>{C();},h);return ()=>clearTimeout(F)}},[h,C]),useEffect(()=>()=>{k.current&&clearTimeout(k.current);},[]),jsx("div",{className:`max-w-xs
|
|
66
|
+
`);var $t=a(({url:r})=>{let[o,s]=useState(1),[h,g]=useState(),b=At.useRef(null),f=At.useRef(null),x=a(()=>{s(L=>Math.min(L+.25,4));},"handleZoomIn");return jsxs("div",{ref:f,className:"h-full w-full flex flex-col",children:[jsxs("div",{className:"flex justify-center items-stretch p-4 gap-1 border-b border-gray-200 relative ",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:a(()=>{s(L=>Math.max(L-.25,.25));},"handleZoomOut"),disabled:o<=.25,className:"bg-white! hover:bg-blue-50!",p:7}),jsxs(pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[o*100,"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:x,disabled:o>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),jsx("div",{className:"h-full w-full overflow-auto",children:jsx("img",{src:r,ref:b,alt:"image",className:"block w-auto max-w-none object-contain",style:{transition:"all 0.2s ease-in-out",marginInline:"auto",marginBlock:10,flexShrink:0,...h==="width"&&{width:`calc(${o*100}% - 20px)`},...h==="height"&&{height:`calc(${o*100}% - 20px)`}},onLoad:()=>{if(b.current&&f.current){let L=b.current.width,I=b.current.height,k=L<I?"height":"width";g(k);}}})})]})},"ImageDriver");var Ht=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full p-5.5",children:jsx("audio",{controls:true,src:r,className:"w-full"})}),"AudioDriver");var rt=a(({url:r})=>{let[o,s]=useState(null),[h,g]=useState(false),[b,f]=useState(true),[x,T]=useState(null);return useEffect(()=>{g(true);},[]),useEffect(()=>{if(!h)return;a(async()=>{try{let I=await import('./PdfDriver-PM4M3WEK.mjs');s(()=>I.PdfDriver),f(!1);}catch(I){console.error("Failed to load PDF driver:",I),T("Failed to load PDF viewer"),f(false);}},"loadPdfDriver")();},[h]),h?b?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-gray-500",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",children:"Loading PDF viewer..."})})},"PdfDriverWrapper");var Yt=50,po=1e4,Gt=a(({url:r,blob:o})=>{let s=useRef(null),h=useRef(null),[g,b]=useState(null),[f,x]=useState(true),[T,L]=useState(1),I=useRef(false),[k,C]=useState({width:0,height:0}),F=useRef(0),t=a(()=>{I.current=true,L(B=>Math.min(B+.25,4));},"handleZoomIn"),j=a(()=>{I.current=true,L(B=>Math.max(B-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(h.current)try{x(!0),b(null);let m=o;if(!m&&r&&(m=await(await fetch(r)).blob()),!m){b("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(m.size/(1024*1024)>Yt){b(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Yt} \u041C\u0411)`);return}h.current.innerHTML="";let P=renderAsync(m,h.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0}),D=new Promise((G,te)=>setTimeout(()=>te(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")),po));await Promise.race([P,D]),await new Promise(G=>requestAnimationFrame(G));let V=h.current.querySelector(".docx-wrapper");if(V&&(F.current=V.offsetWidth,C({width:V.offsetWidth,height:V.offsetHeight})),s.current&&F.current>0){let G=s.current.clientWidth,te=Math.min(G/F.current,1);L(te);}x(!1);}catch(m){b(m?.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(!s.current)return;let B=uo(R=>{if(!(I.current||F.current===0))for(let P of R){let D=P.contentRect.width,V=Math.min(D/F.current,1);L(V);}},150),m=new ResizeObserver(B);return m.observe(s.current),()=>{m.disconnect(),B.cancel();}},[]),jsxs("div",{className:"h-full w-full flex flex-col",children:[jsxs("div",{className:"flex justify-center items-stretch p-4 gap-1 border-b border-gray-200",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:j,disabled:T<=.25,className:"bg-white! hover:bg-blue-50!",p:7}),jsxs(pb,{py:8,px:8,className:"flex items-center justify-between gap-1.5 min-w-21",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[Math.round(T*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:t,disabled:T>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),!!g&&!f&&jsx("div",{className:"text-red-500 p-5",children:g}),f&&jsx("div",{className:"flex items-center justify-center p-5",children:"\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F..."}),jsx("div",{ref:s,className:"w-full h-full overflow-auto",style:{backgroundColor:"gray"},children:jsx("div",{style:{width:k.width>0?k.width*T:void 0,height:k.height>0?k.height*T:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:h,className:"[&>div.docx-wrapper_table_*]:wrap-break-word! [&>div.docx-wrapper_table]:table-fixed! [&>div.docx-wrapper_table]:max-w-full! [&>div.docx-wrapper_table]:w-full! [&>div.docx-wrapper_img]:max-w-full! [&>div.docx-wrapper_img]:h-auto! [&>div.docx-wrapper_table]:border-collapse! [&>div.docx-wrapper]:box-border [&>div.docx-wrapper]:min-w-fit [&>div.docx-wrapper>section]:min-w-fit [&>div.docx-wrapper]:min-h-full",style:{boxSizing:"border-box",wordBreak:"break-word",overflowWrap:"break-word",transform:`scale(${T})`,transformOrigin:"top left"}})})})]})},"DocxDriver");var Mo=a(r=>({js:[javascript({jsx:false})],jsx:[javascript({jsx:true})],ts:[javascript({typescript:true,jsx:false})],tsx:[javascript({typescript:true,jsx:true})],json:[json()],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()]})[r]||[],"getLanguageExtension"),Jt=a(({url:r,extension:o})=>{let[s,h]=useState(""),[g,b]=useState(true),[f,x]=useState(null),[T,L]=useState(0),I=useRef(null);if(useEffect(()=>{a(async()=>{try{b(!0),x(null);let t=await fetch(r);if(!t.ok)throw new Error(`Failed to load file: ${t.statusText}`);let j=await t.text();h(j);}catch(t){x(t instanceof Error?t.message:"Failed to load text content");}finally{b(false);}},"loadTextContent")();},[r]),useEffect(()=>{let F=a(()=>{if(I.current){let t=I.current.clientHeight;L(t);}},"updateHeight");return F(),window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F);}},[g]),g)return jsx("div",{className:"flex items-center justify-center p-8",children:jsx("div",{className:"text-gray-500",children:"Loading text content..."})});if(f)return jsx("div",{className:"flex items-center justify-center p-8",children:jsxs("div",{className:"text-red-500",children:["Error: ",f]})});if(o==="md")return jsx("div",{ref:I,className:"h-full w-full overflow-auto p-5 prose max-w-[100%] select-text prose-table whitespace-pre-wrap",style:{wordBreak:"break-word"},children:jsx(So,{remarkPlugins:[Po],children:s})});let C=Mo(o);return jsx("div",{ref:I,className:"h-full w-full",children:T>0&&jsx(fo,{value:s,theme:vscodeLight,extensions:C,editable:false,height:`${T}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 Qt=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full",children:jsx("video",{controls:true,src:r,className:"w-full max-h-full"})}),"VideoDriver");var er=memo(a(function({extension:o,blob:s,path:h,buffer:g,not_supported_message:b=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:o,blob:s,path:h,buffer:g});let f=o.toLocaleLowerCase().trim(),x;if(h?x=h:s&&(x=URL.createObjectURL(s)),x){if(["jpeg","jpg","png","gif","bmp","webp"].includes(f))return jsx($t,{url:x});if(["mp3","wav","ogg","flac"].includes(f))return jsx(Ht,{url:x});if(["mp4","webm"].includes(f))return jsx(Qt,{url:x});if(o==="pdf")return jsx(rt,{url:x});if(["txt","js","jsx","ts","tsx","json","html","css","scss","py","java","cpp","c","cs","php","rb","go","rs","swift","kt","xml","yaml","yml","md","sql","sh","bash"].includes(f))return jsx(Jt,{url:x,extension:f})}return f==="docx"?jsx(Gt,{url:x,blob:s}):jsx("div",{className:"h-full flex flex-col justify-center items-center",children:jsx(pb,{className:"mx-5",children:jsx(Ya,{variant:"h2",color:"text.light",weight:500,className:"text-center",children:b})})})},"Driver"));var Hc=a(r=>jsx("div",{className:"h-full w-full",children:jsx(er,{...r})}),"FileViewer");var or=250,el=a(({text:r,speed:o=50,onDone:s,markdown:h=false,markdownComponents:g={},className:b,...f})=>{let[x,T]=useState(""),L=useRef(null),I=useRef(null);return useEffect(()=>{let k=false;if(o>0){T(""),L.current=performance.now();let C=a(F=>{if(k||!L.current)return;let t=F-L.current,j=t/o>or?o/2:o,B=t/o>or?1.5:1,m=Math.floor(t/j*B);if(m>=r.length){T(r),k=true,s?.();return}T(r.slice(0,m)),I.current=requestAnimationFrame(C);},"tick");I.current=requestAnimationFrame(C);}else T(r),s?.();return ()=>{I.current&&cancelAnimationFrame(I.current);}},[r,o,s]),h?jsx("div",{className:b,children:jsx(So,{remarkPlugins:[Po],components:g,...f,children:x})}):jsx(Ya,{className:b,...f,children:x})},"Typewriter");var Fo={timeout:2e3,message:"Copied!"},dl=a(({text:r,children:o,format:s="text/plain",tooltip:h})=>{let[g,b]=useState(false),f=useRef(null),x={...Fo,...h},T=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):Ro(r,{format:s}),b(true),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>b(false),x.timeout);},"handleCopy");return useEffect(()=>()=>{f.current&&clearTimeout(f.current);},[]),jsx(Bb,{onMouseLeave:()=>b(false),className:g?"visible":"hidden",content:x.message,children:o({copy:T})})},"CopyToClipboard");var ar=a(r=>new Date(r?Array.isArray(r)?r[1]||r[0]||new Date:r:new Date),"getInitValue"),qe=a((r,o)=>{let s;if(o){let g=parse(r||"",o,new Date);if(isValid(g)&&getYear(g)>=1970)return g}let h=new Date(r||"");return isNaN(h.getTime())?s:h},"parseDate"),qo=a((r,o)=>{let s=r?qe(r,o):void 0;return s&&o?format(s,o):r},"renderDate"),Dl=a(({value:r,range:o,inline:s=false,minDate:h=new Date(getYear(new Date)-5,0,1),maxDate:g=new Date(getYear(new Date)+5,11,31),format:b="dd.MM.yyyy",onChange:f,...x})=>{let[T,L]=useState(getMonth(ar(r))),[I,k]=useState(getYear(ar(r))),C=useMemo(()=>{if(r){if(Array.isArray(r)){let t=qe(r[0],b),j=qe(r[1],b);return [t,j]}return qe(r,b)}},[r]),F=useCallback(t=>{if(o){let j=!!(C&&Array.isArray(C)&&C[0]),B=!!(C&&Array.isArray(C)&&C[1]);!j||j&&B?f?.([t.toString(),""]):j&&!B&&(t<C[0]?f?.([t.toString(),C[0].toString()]):f?.([C[0].toString(),t.toString()]));}else f?.(t.toString());},[o,C,f]);return s?jsx(ir,{month:T,year:I,minDate:h,maxDate:g,selectedDate:C,onSelectDate:F,onChangeMonth:L,onChangeYear:k}):o?jsx(Vo,{range:true,value:r,onChange:f,...x}):jsx(Zo,{value:r,onChange:f,minDate:h,maxDate:g,month:T,year:I,selectedDate:C,onChangeMonth:L,onChangeYear:k,onSelectDate:F,formatStr:b,...x})},"DatePicker"),Vo=a(({minDate:r,maxDate:o,value:s,onChange:h})=>null,"DatePickerGroupInput"),Zo=a(({placeholder:r,value:o,onChange:s,inputProps:h,...g})=>{let[b,f]=useState(false),x=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:b,onClickOutside:()=>f(false),content:jsx(pb,{children:jsx(ir,{...g})}),containerStyle:{zIndex:`${x.zIndex.popover}`},children:jsx("div",{onClick:()=>f(true),children:jsx(kb,{...h,placeholder:r,value:qo(o,g.formatStr),onChange:T=>s?.(T.target.value)})})})},"DatePickerInput"),ir=a(({month:r,year:o,selectedDate:s,minDate:h,maxDate:g,onSelectDate:b,onChangeMonth:f,onChangeYear:x})=>{let T=useMemo(()=>new Array(12).fill(null).map((m,R)=>{let P=new Date(0,R);return {value:R+1,inputDisplay:format(P,"MMMM")}}),[]),L=useMemo(()=>{let m=getYear(h),P=getYear(g)-m+1;return new Array(P).fill(null).map((D,V)=>{let G=m+V;return {value:G,inputDisplay:G.toString()}})},[h,g]),I=useMemo(()=>new Array(7).fill(null).map((m,R)=>{let P=startOfWeek(new Date,{weekStartsOn:R});return format(P,"EEE")}),[]),k=useMemo(()=>{let m=startOfMonth(new Date(o,r)),R=endOfMonth(new Date(o,r)),P=getDay(m)===0?m:previousSunday(m),D=getDay(R)===6?R:nextSaturday(R),V=differenceInDays(D,P),G=differenceInDays(m,P);return new Array(V+1).fill(null).map((te,J)=>new Date(o,r,J-G+1))},[r,o]),C=useCallback(()=>{r===0?(x(o-1),f(11)):f(r-1);},[r,o]),F=useCallback(()=>{r===11?(x(o+1),f(0)):f(r+1);},[r,o]),t=useMemo(()=>h?!(o<getYear(h)||o===getYear(h)&&r<=getMonth(h)):true,[r,o,h]),j=useMemo(()=>g?!(o>getYear(g)||o===getYear(g)&&r>=getMonth(g)):true,[r,o,g]),B=useCallback(m=>{m.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:B,children:[jsxs("div",{className:"flex justify-center items-center gap-2 pb-3",children:[t&&jsx(z,{size:"small",variant:"empty",icon:jsx(G,{}),onClick:C}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(ib,{placeholder:"",hasBorder:false,selected:r+1,options:T,onSelect:m=>f(m-1),maxWidth:150,maxHeight:300}),jsx(ib,{placeholder:"",hasBorder:false,selected:o,options:L,onSelect:m=>x(m),maxWidth:100,maxHeight:300})]}),j&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:F})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:I.map(m=>jsx("div",{className:"text-center",children:m},m))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:k.map(m=>{let R=getMonth(m)===r,P=format(m,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),D=s&&(Array.isArray(s)&&(s[0]&&format(m,"yyyy-MM-dd")===format(s[0],"yyyy-MM-dd")||s[1]&&format(m,"yyyy-MM-dd")===format(s[1],"yyyy-MM-dd"))||!Array.isArray(s)&&format(m,"yyyy-MM-dd")===format(s,"yyyy-MM-dd")),V=s&&Array.isArray(s)&&s[0]&&s[1]&&m>s[0]&&m<s[1],G=h&&differenceInDays(m,h)<0||g&&differenceInDays(m,g)>0||!R;return jsx(Uo,{date:m,isCurrentMonth:R,isCurrentDay:P,isSelected:!!D,isInRange:!!V,isDisabled:!!G,onSelectDate:b},m.toISOString())})})]})},"DatePickerCalendar"),Uo=a(({date:r,isCurrentMonth:o,isCurrentDay:s,isSelected:h,isInRange:g,isDisabled:b,onSelectDate:f})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${b?"text-gray-400 cursor-not-allowed":h?"bg-blue-500 text-white":g?"bg-blue-100":s?"text-blue-500":o?"text-black":"text-gray-400"} ${b?"":h?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(T=>{b||f(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");var Qo=a(r=>{switch(r){case "primary":return "bg-blue-100 border-blue-200 dark:bg-blue-800/10 dark:border-blue-900";case "error":return "bg-red-100 border-red-200 dark:bg-red-800/10 dark:border-red-900";case "warning":return "bg-yellow-100 border-yellow-200 dark:bg-yellow-800/10 dark:border-yellow-900";case "success":return "bg-teal-100 border-teal-200 dark:bg-teal-800/10 dark:border-teal-900";case "default":default:return "bg-white border border-gray-200 dark:bg-neutral-800 dark:border-neutral-700"}},"getColorStyle"),en=a(r=>{switch(r){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"),tn=a(r=>{switch(r){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),dr=a(({id:r,color:o="default",message:s,duration:h,transitionDirection:g,cancelable:b=true,onClose:f})=>{let[x,T]=useState(false),[L,I]=useState(false),k=useRef(null),C=useCallback(()=>{T(true),k.current=setTimeout(()=>{f(r);},300);},[r,f]);return useEffect(()=>{if(I(true),h&&h<1/0){let F=setTimeout(()=>{C();},h);return ()=>clearTimeout(F)}},[h,C]),useEffect(()=>()=>{k.current&&clearTimeout(k.current);},[]),jsx("div",{className:`max-w-xs
|
|
67
67
|
border
|
|
68
68
|
w-full
|
|
69
69
|
text-sm
|