@cyber-harbour/ui 2.1.22 → 2.1.24

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,pb,Ya,ma,Cb,y,kb,G,ib,H,lb}from'./chunk-IMZOAD2F.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-IMZOAD2F.mjs';import jr,{styled,useTheme}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs}from'react/jsx-runtime';import Ot,{useState,useRef,useCallback,useEffect,Fragment,forwardRef,useMemo,useImperativeHandle,useLayoutEffect,memo}from'react';import Yr from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import Br from'react-content-loader';import {renderAsync}from'docx-preview';import po from'lodash.throttle';import fo from'@uiw/react-codemirror';import {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 So from'react-markdown';import Mo from'remark-gfm';import zo 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 Li=a(({children:r,className:o})=>jsx(vr,{className:o,children:r}),"PageLayout"),vr=styled.div`
1
+ import {a,w,x,u,c,l,z,Pa,pb,Ya,ma,Cb,y,kb,G,ib,H,lb}from'./chunk-5F7EBG5K.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-5F7EBG5K.mjs';import jr,{styled,useTheme}from'styled-components';export{ServerStyleSheet,StyleSheetManager}from'styled-components';import {jsx,jsxs}from'react/jsx-runtime';import Ot,{useState,useRef,useCallback,useEffect,Fragment,forwardRef,useMemo,useImperativeHandle,useLayoutEffect,memo}from'react';import Yr from'lodash.clonedeep';import {scaleOrdinal,schemeCategory10,forceSimulation,forceLink,forceManyBody,forceX,forceY,forceCenter,forceCollide}from'd3';import Br from'react-content-loader';import {renderAsync}from'docx-preview';import po from'lodash.throttle';import fo from'@uiw/react-codemirror';import {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 So from'react-markdown';import Mo from'remark-gfm';import zo 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 Li=a(({children:r,className:o})=>jsx(vr,{className:o,children:r}),"PageLayout"),vr=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 Wt=a(({url:r})=>{let[o,s]=useState(1),[u,h]=useState(),w=Ot.useRef(null),y=Ot.useRef(null),x=a(()=>{s(T=>Math.min(T+.25,4));},"handleZoomIn");return jsxs("div",{ref:y,className:"h-full w-full flex flex-col px-6",children:[jsxs("div",{className:"flex justify-center items-stretch py-3 gap-1 border-b border-gray-200 relative mx-2.5",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:a(()=>{s(T=>Math.max(T-.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 rounded-[5px]!",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:w,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,...u==="width"&&{width:`calc(${o*100}% - 20px)`},...u==="height"&&{height:`calc(${o*100}% - 20px)`}},onLoad:()=>{if(w.current&&y.current){let T=w.current.width,E=w.current.height,k=T<E?"height":"width";h(k);}}})})]})},"ImageDriver");var _t=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 rt=a(({url:r})=>{let[o,s]=useState(null),[u,h]=useState(false),[w,y]=useState(true),[x,C]=useState(null);return useEffect(()=>{h(true);},[]),useEffect(()=>{if(!u)return;a(async()=>{try{let E=await import('./PdfDriver-6VLI6SL6.mjs');s(()=>E.PdfDriver),y(!1);}catch(E){console.error("Failed to load PDF driver:",E),C("Failed to load PDF viewer"),y(false);}},"loadPdfDriver")();},[u]),u?w?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 Gt=50,go=1e4,qt=a(({url:r,blob:o})=>{let s=useRef(null),u=useRef(null),[h,w]=useState(null),[y,x]=useState(true),[C,T]=useState(1),E=useRef(false),[k,N]=useState({width:0,height:0}),F=useRef(0),t=a(()=>{E.current=true,T(j=>Math.min(j+.25,4));},"handleZoomIn"),B=a(()=>{E.current=true,T(j=>Math.max(j-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(u.current)try{x(!0),w(null);let f=o;if(!f&&r&&(f=await(await fetch(r)).blob()),!f){w("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(f.size/(1024*1024)>Gt){w(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Gt} \u041C\u0411)`);return}u.current.innerHTML="";let S=renderAsync(f,u.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),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")),go));await Promise.race([S,D]),await new Promise(G=>requestAnimationFrame(G));let V=u.current.querySelector(".docx-wrapper");if(V&&(F.current=V.offsetWidth,N({width:V.offsetWidth,height:V.offsetHeight})),s.current&&F.current>0){let G=s.current.clientWidth,te=Math.min(G/F.current,1);T(te);}x(!1);}catch(f){w(f?.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 j=po(R=>{if(!(E.current||F.current===0))for(let S of R){let D=S.contentRect.width,V=Math.min(D/F.current,1);T(V);}},150),f=new ResizeObserver(j);return f.observe(s.current),()=>{f.disconnect(),j.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",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:B,disabled:C<=.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 rounded-[5px]!",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[Math.round(C*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:t,disabled:C>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),!!h&&!y&&jsx("div",{className:"text-red-500 p-8",children:h}),y&&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:s,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:jsx("div",{style:{width:k.width>0?k.width*C:void 0,height:k.height>0?k.height*C:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:u,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(${C})`,transformOrigin:"top left"}})})})]})},"DocxDriver");var Co=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"),Kt=a(({url:r,extension:o})=>{let[s,u]=useState(""),[h,w]=useState(true),[y,x]=useState(null),[C,T]=useState(0),E=useRef(null);if(useEffect(()=>{a(async()=>{try{w(!0),x(null);let t=await fetch(r);if(!t.ok)throw new Error(`Failed to load file: ${t.statusText}`);let B=await t.text();u(B);}catch(t){x(t instanceof Error?t.message:"Failed to load text content");}finally{w(false);}},"loadTextContent")();},[r]),useEffect(()=>{let F=a(()=>{if(E.current){let t=E.current.clientHeight;T(t);}},"updateHeight");return F(),window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F);}},[h]),h)return jsx("div",{className:"flex items-center justify-center p-8.5",children:jsx("div",{className:"text-gray-500",children:"Loading text content..."})});if(y)return jsx("div",{className:"flex items-center justify-center p-8.5",children:jsxs("div",{className:"text-red-500",children:["Error: ",y]})});if(o==="md")return jsx("div",{ref:E,className:"h-full w-full overflow-auto p-5 prose max-w-[100%] select-text prose-table px-8.5",style:{wordBreak:"break-word"},children:jsx(So,{remarkPlugins:[Mo],children:s})});let N=Co(o);return jsx("div",{ref:E,className:"h-full w-full",children:C>0&&jsx(fo,{value:s,theme:vscodeLight,extensions:N,editable:false,height:`${C}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 er=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full px-8.5",children:jsx("video",{controls:true,src:r,className:"w-full max-h-full"})}),"VideoDriver");var tr=memo(a(function({extension:o,blob:s,path:u,buffer:h,not_supported_message:w=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:o,blob:s,path:u,buffer:h});let y=o.toLocaleLowerCase().trim(),x;if(u?x=u:s&&(x=URL.createObjectURL(s)),x){if(["jpeg","jpg","png","gif","bmp","webp"].includes(y))return jsx(Wt,{url:x});if(["mp3","wav","ogg","flac"].includes(y))return jsx(_t,{url:x});if(["mp4","webm"].includes(y))return jsx(er,{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(y))return jsx(Kt,{url:x,extension:y})}return y==="docx"?jsx(qt,{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:w})})})},"Driver"));var Xc=a(r=>jsx("div",{className:"h-full w-full",children:jsx(tr,{...r})}),"FileViewer");var nr=250,rl=a(({text:r,speed:o=50,onDone:s,markdown:u=false,markdownComponents:h={},className:w,...y})=>{let[x,C]=useState(""),T=useRef(null),E=useRef(null);return useEffect(()=>{let k=false;if(o>0){C(""),T.current=performance.now();let N=a(F=>{if(k||!T.current)return;let t=F-T.current,B=t/o>nr?o/2:o,j=t/o>nr?1.5:1,f=Math.floor(t/B*j);if(f>=r.length){C(r),k=true,s?.();return}C(r.slice(0,f)),E.current=requestAnimationFrame(N);},"tick");E.current=requestAnimationFrame(N);}else C(r),s?.();return ()=>{E.current&&cancelAnimationFrame(E.current);}},[r,o,s]),u?jsx("div",{className:w,children:jsx(So,{remarkPlugins:[Mo],components:h,...y,children:x})}):jsx(Ya,{className:w,...y,children:x})},"Typewriter");var Oo={timeout:2e3,message:"Copied!"},hl=a(({text:r,children:o,format:s="text/plain",tooltip:u,positions:h=["top"],className:w})=>{let[y,x]=useState(false),C=useRef(null),T={...Oo,...u},E=Array.isArray(h)?h[0]:h,k=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):zo(r,{format:s}),x(true),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>x(false),T.timeout);},"handleCopy");return useEffect(()=>()=>{C.current&&clearTimeout(C.current);},[]),jsx(Popover,{padding:6,positions:h,isOpen:y,align:"center",onClickOutside:()=>x(false),content:!!u?.message&&jsx(Cb,{className:w,$position:E,$offset:6,children:u.message}),containerStyle:{zIndex:"9999"},children:jsx("div",{className:"inline-block",onMouseLeave:()=>x(false),children:o({copy:k})})})},"CopyToClipboard");var ir=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 h=parse(r||"",o,new Date);if(isValid(h)&&getYear(h)>=1970)return h}let u=new Date(r||"");return isNaN(u.getTime())?s:u},"parseDate"),Vo=a((r,o)=>{let s=r?qe(r,o):void 0;return s&&o?format(s,o):r},"renderDate"),Cl=a(({value:r,range:o,inline:s=false,minDate:u=new Date(getYear(new Date)-5,0,1),maxDate:h=new Date(getYear(new Date)+5,11,31),format:w="dd.MM.yyyy",onChange:y,...x})=>{let[C,T]=useState(getMonth(ir(r))),[E,k]=useState(getYear(ir(r))),N=useMemo(()=>{if(r){if(Array.isArray(r)){let t=qe(r[0],w),B=qe(r[1],w);return [t,B]}return qe(r,w)}},[r]),F=useCallback(t=>{if(o){let B=!!(N&&Array.isArray(N)&&N[0]),j=!!(N&&Array.isArray(N)&&N[1]);!B||B&&j?y?.([t.toString(),""]):B&&!j&&(t<N[0]?y?.([t.toString(),N[0].toString()]):y?.([N[0].toString(),t.toString()]));}else y?.(t.toString());},[o,N,y]);return s?jsx(sr,{month:C,year:E,minDate:u,maxDate:h,selectedDate:N,onSelectDate:F,onChangeMonth:T,onChangeYear:k}):o?jsx(Zo,{range:true,value:r,onChange:y,...x}):jsx(Uo,{value:r,onChange:y,minDate:u,maxDate:h,month:C,year:E,selectedDate:N,onChangeMonth:T,onChangeYear:k,onSelectDate:F,formatStr:w,...x})},"DatePicker"),Zo=a(({minDate:r,maxDate:o,value:s,onChange:u})=>null,"DatePickerGroupInput"),Uo=a(({placeholder:r,value:o,onChange:s,inputProps:u,...h})=>{let[w,y$1]=useState(false),x=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:w,onClickOutside:()=>y$1(false),content:jsx(pb,{children:jsx(sr,{...h})}),containerStyle:{zIndex:`${x.zIndex.popover}`},children:jsx("div",{onClick:()=>y$1(true),children:jsx(kb,{...u,placeholder:r,value:Vo(o,h.formatStr),onChange:C=>s?.(C.target.value)})})})},"DatePickerInput"),sr=a(({month:r,year:o,selectedDate:s,minDate:u,maxDate:h,onSelectDate:w,onChangeMonth:y,onChangeYear:x})=>{let C=useMemo(()=>new Array(12).fill(null).map((f,R)=>{let S=new Date(0,R);return {value:R+1,inputDisplay:format(S,"MMMM")}}),[]),T=useMemo(()=>{let f=getYear(u),S=getYear(h)-f+1;return new Array(S).fill(null).map((D,V)=>{let G=f+V;return {value:G,inputDisplay:G.toString()}})},[u,h]),E=useMemo(()=>new Array(7).fill(null).map((f,R)=>{let S=startOfWeek(new Date,{weekStartsOn:R});return format(S,"EEE")}),[]),k=useMemo(()=>{let f=startOfMonth(new Date(o,r)),R=endOfMonth(new Date(o,r)),S=getDay(f)===0?f:previousSunday(f),D=getDay(R)===6?R:nextSaturday(R),V=differenceInDays(D,S),G=differenceInDays(f,S);return new Array(V+1).fill(null).map((te,J)=>new Date(o,r,J-G+1))},[r,o]),N=useCallback(()=>{r===0?(x(o-1),y(11)):y(r-1);},[r,o]),F=useCallback(()=>{r===11?(x(o+1),y(0)):y(r+1);},[r,o]),t=useMemo(()=>u?!(o<getYear(u)||o===getYear(u)&&r<=getMonth(u)):true,[r,o,u]),B=useMemo(()=>h?!(o>getYear(h)||o===getYear(h)&&r>=getMonth(h)):true,[r,o,h]),j=useCallback(f=>{f.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:j,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:N}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(ib,{placeholder:"",hasBorder:false,selected:r+1,options:C,onSelect:f=>y(f-1),maxWidth:150,maxHeight:300}),jsx(ib,{placeholder:"",hasBorder:false,selected:o,options:T,onSelect:f=>x(f),maxWidth:100,maxHeight:300})]}),B&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:F})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:E.map(f=>jsx("div",{className:"text-center",children:f},f))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:k.map(f=>{let R=getMonth(f)===r,S=format(f,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),D=s&&(Array.isArray(s)&&(s[0]&&format(f,"yyyy-MM-dd")===format(s[0],"yyyy-MM-dd")||s[1]&&format(f,"yyyy-MM-dd")===format(s[1],"yyyy-MM-dd"))||!Array.isArray(s)&&format(f,"yyyy-MM-dd")===format(s,"yyyy-MM-dd")),V=s&&Array.isArray(s)&&s[0]&&s[1]&&f>s[0]&&f<s[1],G=u&&differenceInDays(f,u)<0||h&&differenceInDays(f,h)>0||!R;return jsx(Jo,{date:f,isCurrentMonth:R,isCurrentDay:S,isSelected:!!D,isInRange:!!V,isDisabled:!!G,onSelectDate:w},f.toISOString())})})]})},"DatePickerCalendar"),Jo=a(({date:r,isCurrentMonth:o,isCurrentDay:s,isSelected:u,isInRange:h,isDisabled:w,onSelectDate:y})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${w?"text-gray-400 cursor-not-allowed":u?"bg-blue-500 text-white":h?"bg-blue-100":s?"text-blue-500":o?"text-black":"text-gray-400"} ${w?"":u?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(C=>{w||y(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");var en=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"),tn=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"),rn=a(r=>{switch(r){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),ur=a(({id:r,color:o="default",message:s,duration:u,transitionDirection:h,cancelable:w=true,onClose:y})=>{let[x,C]=useState(false),[T,E]=useState(false),k=useRef(null),N=useCallback(()=>{C(true),k.current=setTimeout(()=>{y(r);},300);},[r,y]);return useEffect(()=>{if(E(true),u&&u<1/0){let F=setTimeout(()=>{N();},u);return ()=>clearTimeout(F)}},[u,N]),useEffect(()=>()=>{k.current&&clearTimeout(k.current);},[]),jsx("div",{className:`max-w-xs
66
+ `);var Wt=a(({url:r})=>{let[o,s]=useState(1),[u,h]=useState(),w=Ot.useRef(null),y=Ot.useRef(null),x=a(()=>{s(T=>Math.min(T+.25,4));},"handleZoomIn");return jsxs("div",{ref:y,className:"h-full w-full flex flex-col px-6",children:[jsxs("div",{className:"flex justify-center items-stretch py-3 gap-1 border-b border-gray-200 relative mx-2.5",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:a(()=>{s(T=>Math.max(T-.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 rounded-[5px]!",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:w,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,...u==="width"&&{width:`calc(${o*100}% - 20px)`},...u==="height"&&{height:`calc(${o*100}% - 20px)`}},onLoad:()=>{if(w.current&&y.current){let T=w.current.width,E=w.current.height,k=T<E?"height":"width";h(k);}}})})]})},"ImageDriver");var _t=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 rt=a(({url:r})=>{let[o,s]=useState(null),[u,h]=useState(false),[w,y]=useState(true),[x,C]=useState(null);return useEffect(()=>{h(true);},[]),useEffect(()=>{if(!u)return;a(async()=>{try{let E=await import('./PdfDriver-JBTZ7E5F.mjs');s(()=>E.PdfDriver),y(!1);}catch(E){console.error("Failed to load PDF driver:",E),C("Failed to load PDF viewer"),y(false);}},"loadPdfDriver")();},[u]),u?w?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 Gt=50,go=1e4,qt=a(({url:r,blob:o})=>{let s=useRef(null),u=useRef(null),[h,w]=useState(null),[y,x]=useState(true),[C,T]=useState(1),E=useRef(false),[k,N]=useState({width:0,height:0}),F=useRef(0),t=a(()=>{E.current=true,T(j=>Math.min(j+.25,4));},"handleZoomIn"),B=a(()=>{E.current=true,T(j=>Math.max(j-.25,.25));},"handleZoomOut");return useEffect(()=>{a(async()=>{if(u.current)try{x(!0),w(null);let f=o;if(!f&&r&&(f=await(await fetch(r)).blob()),!f){w("\u041D\u0435 \u043D\u0430\u0434\u0430\u043D\u043E \u0434\u043B\u044F DOCX \u0444\u0430\u0439\u043B\u0443");return}if(f.size/(1024*1024)>Gt){w(`\u0424\u0430\u0439\u043B \u0437\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0438\u0439 (> ${Gt} \u041C\u0411)`);return}u.current.innerHTML="";let S=renderAsync(f,u.current,void 0,{debug:!0,experimental:!0,hideWrapperOnPrint:!0,breakPages:!0,ignoreLastRenderedPageBreak:!1}),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")),go));await Promise.race([S,D]),await new Promise(G=>requestAnimationFrame(G));let V=u.current.querySelector(".docx-wrapper");if(V&&(F.current=V.offsetWidth,N({width:V.offsetWidth,height:V.offsetHeight})),s.current&&F.current>0){let G=s.current.clientWidth,te=Math.min(G/F.current,1);T(te);}x(!1);}catch(f){w(f?.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 j=po(R=>{if(!(E.current||F.current===0))for(let S of R){let D=S.contentRect.width,V=Math.min(D/F.current,1);T(V);}},150),f=new ResizeObserver(j);return f.observe(s.current),()=>{f.disconnect(),j.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",children:[jsx(z,{variant:"outlined","aria-label":"zoom-out",color:"default",size:"small",icon:jsx(Pa,{style:{width:20,height:20}}),onClick:B,disabled:C<=.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 rounded-[5px]!",children:[jsx(Ya,{color:"text.lighter",style:{fontSize:10},children:"Scale:"}),jsxs(Ya,{children:[Math.round(C*100),"%"]})]}),jsx(z,{variant:"outlined","aria-label":"zoom-in",size:"small",color:"default",icon:jsx(ma,{style:{width:14,height:14}}),onClick:t,disabled:C>=4,className:"bg-white! hover:bg-blue-50!",p:10})]}),!!h&&!y&&jsx("div",{className:"text-red-500 p-8",children:h}),y&&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:s,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:jsx("div",{style:{width:k.width>0?k.width*C:void 0,height:k.height>0?k.height*C:void 0,overflow:"hidden",margin:"0 auto"},children:jsx("div",{ref:u,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(${C})`,transformOrigin:"top left"}})})})]})},"DocxDriver");var Co=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"),Kt=a(({url:r,extension:o})=>{let[s,u]=useState(""),[h,w]=useState(true),[y,x]=useState(null),[C,T]=useState(0),E=useRef(null);if(useEffect(()=>{a(async()=>{try{w(!0),x(null);let t=await fetch(r);if(!t.ok)throw new Error(`Failed to load file: ${t.statusText}`);let B=await t.text();u(B);}catch(t){x(t instanceof Error?t.message:"Failed to load text content");}finally{w(false);}},"loadTextContent")();},[r]),useEffect(()=>{let F=a(()=>{if(E.current){let t=E.current.clientHeight;T(t);}},"updateHeight");return F(),window.addEventListener("resize",F),()=>{window.removeEventListener("resize",F);}},[h]),h)return jsx("div",{className:"flex items-center justify-center p-8.5",children:jsx("div",{className:"text-gray-500",children:"Loading text content..."})});if(y)return jsx("div",{className:"flex items-center justify-center p-8.5",children:jsxs("div",{className:"text-red-500",children:["Error: ",y]})});if(o==="md")return jsx("div",{ref:E,className:"h-full w-full overflow-auto p-5 prose max-w-[100%] select-text prose-table px-8.5",style:{wordBreak:"break-word"},children:jsx(So,{remarkPlugins:[Mo],children:s})});let N=Co(o);return jsx("div",{ref:E,className:"h-full w-full",children:C>0&&jsx(fo,{value:s,theme:vscodeLight,extensions:N,editable:false,height:`${C}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 er=a(({url:r})=>jsx("div",{className:"flex flex-col justify-center items-center w-full h-full px-8.5",children:jsx("video",{controls:true,src:r,className:"w-full max-h-full"})}),"VideoDriver");var tr=memo(a(function({extension:o,blob:s,path:u,buffer:h,not_supported_message:w=" Sorry, this file type isn\u2019t supported yet."}){console.log("Driver props:",{extension:o,blob:s,path:u,buffer:h});let y=o.toLocaleLowerCase().trim(),x;if(u?x=u:s&&(x=URL.createObjectURL(s)),x){if(["jpeg","jpg","png","gif","bmp","webp"].includes(y))return jsx(Wt,{url:x});if(["mp3","wav","ogg","flac"].includes(y))return jsx(_t,{url:x});if(["mp4","webm"].includes(y))return jsx(er,{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(y))return jsx(Kt,{url:x,extension:y})}return y==="docx"?jsx(qt,{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:w})})})},"Driver"));var Xc=a(r=>jsx("div",{className:"h-full w-full",children:jsx(tr,{...r})}),"FileViewer");var nr=250,rl=a(({text:r,speed:o=50,onDone:s,markdown:u=false,markdownComponents:h={},className:w,...y})=>{let[x,C]=useState(""),T=useRef(null),E=useRef(null);return useEffect(()=>{let k=false;if(o>0){C(""),T.current=performance.now();let N=a(F=>{if(k||!T.current)return;let t=F-T.current,B=t/o>nr?o/2:o,j=t/o>nr?1.5:1,f=Math.floor(t/B*j);if(f>=r.length){C(r),k=true,s?.();return}C(r.slice(0,f)),E.current=requestAnimationFrame(N);},"tick");E.current=requestAnimationFrame(N);}else C(r),s?.();return ()=>{E.current&&cancelAnimationFrame(E.current);}},[r,o,s]),u?jsx("div",{className:w,children:jsx(So,{remarkPlugins:[Mo],components:h,...y,children:x})}):jsx(Ya,{className:w,...y,children:x})},"Typewriter");var Oo={timeout:2e3,message:"Copied!"},hl=a(({text:r,children:o,format:s="text/plain",tooltip:u,positions:h=["top"],className:w})=>{let[y,x]=useState(false),C=useRef(null),T={...Oo,...u},E=Array.isArray(h)?h[0]:h,k=a(async()=>{"clipboard"in navigator?await navigator.clipboard.writeText(r):zo(r,{format:s}),x(true),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>x(false),T.timeout);},"handleCopy");return useEffect(()=>()=>{C.current&&clearTimeout(C.current);},[]),jsx(Popover,{padding:6,positions:h,isOpen:y,align:"center",onClickOutside:()=>x(false),content:!!u?.message&&jsx(Cb,{className:w,$position:E,$offset:6,children:u.message}),containerStyle:{zIndex:"9999"},children:jsx("div",{className:"inline-block",onMouseLeave:()=>x(false),children:o({copy:k})})})},"CopyToClipboard");var ir=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 h=parse(r||"",o,new Date);if(isValid(h)&&getYear(h)>=1970)return h}let u=new Date(r||"");return isNaN(u.getTime())?s:u},"parseDate"),Vo=a((r,o)=>{let s=r?qe(r,o):void 0;return s&&o?format(s,o):r},"renderDate"),Cl=a(({value:r,range:o,inline:s=false,minDate:u=new Date(getYear(new Date)-5,0,1),maxDate:h=new Date(getYear(new Date)+5,11,31),format:w="dd.MM.yyyy",onChange:y,...x})=>{let[C,T]=useState(getMonth(ir(r))),[E,k]=useState(getYear(ir(r))),N=useMemo(()=>{if(r){if(Array.isArray(r)){let t=qe(r[0],w),B=qe(r[1],w);return [t,B]}return qe(r,w)}},[r]),F=useCallback(t=>{if(o){let B=!!(N&&Array.isArray(N)&&N[0]),j=!!(N&&Array.isArray(N)&&N[1]);!B||B&&j?y?.([t.toString(),""]):B&&!j&&(t<N[0]?y?.([t.toString(),N[0].toString()]):y?.([N[0].toString(),t.toString()]));}else y?.(t.toString());},[o,N,y]);return s?jsx(sr,{month:C,year:E,minDate:u,maxDate:h,selectedDate:N,onSelectDate:F,onChangeMonth:T,onChangeYear:k}):o?jsx(Zo,{range:true,value:r,onChange:y,...x}):jsx(Uo,{value:r,onChange:y,minDate:u,maxDate:h,month:C,year:E,selectedDate:N,onChangeMonth:T,onChangeYear:k,onSelectDate:F,formatStr:w,...x})},"DatePicker"),Zo=a(({minDate:r,maxDate:o,value:s,onChange:u})=>null,"DatePickerGroupInput"),Uo=a(({placeholder:r,value:o,onChange:s,inputProps:u,...h})=>{let[w,y$1]=useState(false),x=y();return jsx(Popover,{positions:["bottom","top","right","left"],align:"start",isOpen:w,onClickOutside:()=>y$1(false),content:jsx(pb,{children:jsx(sr,{...h})}),containerStyle:{zIndex:`${x.zIndex.popover}`},children:jsx("div",{onClick:()=>y$1(true),children:jsx(kb,{...u,placeholder:r,value:Vo(o,h.formatStr),onChange:C=>s?.(C.target.value)})})})},"DatePickerInput"),sr=a(({month:r,year:o,selectedDate:s,minDate:u,maxDate:h,onSelectDate:w,onChangeMonth:y,onChangeYear:x})=>{let C=useMemo(()=>new Array(12).fill(null).map((f,R)=>{let S=new Date(0,R);return {value:R+1,inputDisplay:format(S,"MMMM")}}),[]),T=useMemo(()=>{let f=getYear(u),S=getYear(h)-f+1;return new Array(S).fill(null).map((D,V)=>{let G=f+V;return {value:G,inputDisplay:G.toString()}})},[u,h]),E=useMemo(()=>new Array(7).fill(null).map((f,R)=>{let S=startOfWeek(new Date,{weekStartsOn:R});return format(S,"EEE")}),[]),k=useMemo(()=>{let f=startOfMonth(new Date(o,r)),R=endOfMonth(new Date(o,r)),S=getDay(f)===0?f:previousSunday(f),D=getDay(R)===6?R:nextSaturday(R),V=differenceInDays(D,S),G=differenceInDays(f,S);return new Array(V+1).fill(null).map((te,J)=>new Date(o,r,J-G+1))},[r,o]),N=useCallback(()=>{r===0?(x(o-1),y(11)):y(r-1);},[r,o]),F=useCallback(()=>{r===11?(x(o+1),y(0)):y(r+1);},[r,o]),t=useMemo(()=>u?!(o<getYear(u)||o===getYear(u)&&r<=getMonth(u)):true,[r,o,u]),B=useMemo(()=>h?!(o>getYear(h)||o===getYear(h)&&r>=getMonth(h)):true,[r,o,h]),j=useCallback(f=>{f.stopPropagation();},[]);return jsxs("div",{className:"flex flex-col date-picker-calendar",onClick:j,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:N}),jsxs("div",{className:"flex-1 flex justify-center gap-1",children:[jsx(ib,{placeholder:"",hasBorder:false,selected:r+1,options:C,onSelect:f=>y(f-1),maxWidth:150,maxHeight:300}),jsx(ib,{placeholder:"",hasBorder:false,selected:o,options:T,onSelect:f=>x(f),maxWidth:100,maxHeight:300})]}),B&&jsx(z,{size:"small",variant:"empty",icon:jsx(H,{}),onClick:F})]}),jsx("div",{className:"grid grid-cols-7 gap-2",children:E.map(f=>jsx("div",{className:"text-center",children:f},f))}),jsx("div",{className:"grid grid-cols-7 gap-2 mt-2",children:k.map(f=>{let R=getMonth(f)===r,S=format(f,"yyyy-MM-dd")===format(new Date,"yyyy-MM-dd"),D=s&&(Array.isArray(s)&&(s[0]&&format(f,"yyyy-MM-dd")===format(s[0],"yyyy-MM-dd")||s[1]&&format(f,"yyyy-MM-dd")===format(s[1],"yyyy-MM-dd"))||!Array.isArray(s)&&format(f,"yyyy-MM-dd")===format(s,"yyyy-MM-dd")),V=s&&Array.isArray(s)&&s[0]&&s[1]&&f>s[0]&&f<s[1],G=u&&differenceInDays(f,u)<0||h&&differenceInDays(f,h)>0||!R;return jsx(Jo,{date:f,isCurrentMonth:R,isCurrentDay:S,isSelected:!!D,isInRange:!!V,isDisabled:!!G,onSelectDate:w},f.toISOString())})})]})},"DatePickerCalendar"),Jo=a(({date:r,isCurrentMonth:o,isCurrentDay:s,isSelected:u,isInRange:h,isDisabled:w,onSelectDate:y})=>jsx("div",{className:`text-center p-2 cursor-pointer rounded ${w?"text-gray-400 cursor-not-allowed":u?"bg-blue-500 text-white":h?"bg-blue-100":s?"text-blue-500":o?"text-black":"text-gray-400"} ${w?"":u?"hover:bg-blue-600":"hover:bg-gray-100"}`,onClick:a(C=>{w||y(r);},"handleClick"),children:format(r,"d")}),"CalendarDay");var en=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"),tn=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"),rn=a(r=>{switch(r){case "bottom":return "translate-y-4";case "top":default:return "-translate-y-4"}},"getTransitionStarting"),ur=a(({id:r,color:o="default",message:s,duration:u,transitionDirection:h,cancelable:w=true,onClose:y})=>{let[x,C]=useState(false),[T,E]=useState(false),k=useRef(null),N=useCallback(()=>{C(true),k.current=setTimeout(()=>{y(r);},300);},[r,y]);return useEffect(()=>{if(E(true),u&&u<1/0){let F=setTimeout(()=>{N();},u);return ()=>clearTimeout(F)}},[u,N]),useEffect(()=>()=>{k.current&&clearTimeout(k.current);},[]),jsx("div",{className:`max-w-xs
67
67
  border
68
68
  w-full
69
69
  text-sm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyber-harbour/ui",
3
- "version": "2.1.22",
3
+ "version": "2.1.24",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",