@innosolutions/inno-calendar 1.0.66 → 1.0.68
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/AGENT.md +1783 -1783
- package/README.md +305 -305
- package/dist/agenda-widget-DyPlCQHM.cjs +2 -0
- package/dist/agenda-widget-DyPlCQHM.cjs.map +1 -0
- package/dist/{agenda-widget-qwbBw3IK.js → agenda-widget-nh_h1yy6.js} +803 -794
- package/dist/agenda-widget-nh_h1yy6.js.map +1 -0
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/components/views/timeline-view.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +214 -214
- package/dist/position-utils-BzmOPdvQ.js.map +1 -1
- package/dist/position-utils-EQTCC4tZ.cjs.map +1 -1
- package/dist/slot-selection-context-CjS_VIPj.js.map +1 -1
- package/dist/slot-selection-context-CmE-aWgt.cjs.map +1 -1
- package/dist/week-view-B1KsZsC3.js.map +1 -1
- package/dist/week-view-Dv-Uz0eT.cjs.map +1 -1
- package/package.json +138 -138
- package/dist/agenda-widget-BNnhQds1.cjs +0 -2
- package/dist/agenda-widget-BNnhQds1.cjs.map +0 -1
- package/dist/agenda-widget-qwbBw3IK.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),De=require("./use-calendar-BwqE_WNA.cjs"),c=require("react"),f=require("./index-D2U2F80P.cjs"),w=require("./week-view-Dv-Uz0eT.cjs"),ye=require("./slot-selection-context-CmE-aWgt.cjs"),q=require("./position-utils-EQTCC4tZ.cjs");function tt({view:t,className:n=""}){return e.jsx("div",{className:n,style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"400px",backgroundColor:"#f9fafb",borderRadius:"0.5rem",border:"1px dashed #d1d5db"},children:e.jsxs("div",{style:{textAlign:"center",color:"#6b7280"},children:[e.jsxs("p",{style:{fontSize:"1.125rem",fontWeight:500},children:[t.charAt(0).toUpperCase()+t.slice(1)," View"]}),e.jsx("p",{style:{fontSize:"0.875rem"},children:"Implementation pending"})]})})}function Pe({view:t,className:n}){return e.jsx(tt,{view:t,className:n})}function nt(t){const{events:n,resources:s,scheduleTypes:r,initialView:o="week",initialDate:i,initialFilters:v,preferences:x,locale:l,slots:j,renderEvent:F,onViewChange:y,onDateChange:k,onEventClick:B,onSlotSelect:A,onFiltersChange:W,className:O,children:H}=t,C=De.useOptionalCalendarContext();if(C)return e.jsx("div",{className:O,style:{position:"relative"},children:H??e.jsx(Pe,{view:C.view,className:O})});const _=De.useCalendar({events:n,resources:s,scheduleTypes:r,initialView:o,initialDate:i,initialFilters:v,preferences:x,locale:l,onViewChange:y,onDateChange:k,onEventClick:B,onSlotSelect:A,onFiltersChange:W});return e.jsx(De.CalendarProvider,{value:_,children:e.jsx("div",{className:O,style:{position:"relative"},children:H??e.jsx(Pe,{view:_.view,className:O})})})}function rt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}),e.jsx("path",{d:"m15 5 4 4"})]})}function Je({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"}),e.jsx("line",{x1:"10",x2:"10",y1:"11",y2:"17"}),e.jsx("line",{x1:"14",x2:"14",y1:"11",y2:"17"})]})}function Me({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}function st({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m4.9 4.9 14.2 14.2"})]})}function we({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}function ot({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"m9 12 2 2 4-4"})]})}function at({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function it({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}function lt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"}),e.jsx("circle",{cx:"12",cy:"10",r:"3"})]})}function ct({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("path",{d:"M3 10h18"})]})}function dt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),e.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),e.jsx("path",{d:"M10 9H8"}),e.jsx("path",{d:"M16 13H8"}),e.jsx("path",{d:"M16 17H8"})]})}function ge({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:f.cn("animate-spin",t),children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}const ut={edit:"Edit",delete:"Delete",cancel:"Cancel Event",close:"Close",going:"Going",notGoing:"Not Going",confirmMeeting:"Confirm meeting took place",completed:"Completed",canceled:"Canceled",participants:"Participants",guest:"guest",guests:"guests",confirmed:"confirmed",organizer:"Organizer",client:"Client",more:"more",noDateProvided:"No date provided",eventNotFound:"Event not found",cancellationNote:"Cancellation Note",canceledOn:"Canceled on",acceptThisEvent:"Accept this event only",acceptAllEvents:"Accept all events",deleteConfirmTitle:"Delete Event",deleteConfirmDescription:"Are you sure you want to delete this event? This action cannot be undone."},be=c.forwardRef(({onClick:t,label:n,children:s,className:r,variant:o="ghost",...i},v)=>e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button",ref:v,onClick:t,className:f.cn("h-8 w-8 rounded-full flex items-center justify-center transition-colors",o==="ghost"&&"hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-600 dark:text-zinc-400",o==="destructive"&&"hover:bg-red-50 dark:hover:bg-red-950/30 text-zinc-600 dark:text-zinc-400 hover:text-red-600",r),"aria-label":n,...i,children:s})}),e.jsx(w.TooltipContent,{side:"bottom",className:"text-xs",children:n})]}));be.displayName="IconButton";function xt({src:t,alt:n,initials:s,className:r,isClient:o}){const[i,v]=c.useState(!1);return e.jsx("div",{className:f.cn("relative h-7 w-7 rounded-full overflow-hidden shrink-0",r),children:t&&!i?e.jsx("img",{src:t,alt:n,className:"h-full w-full object-cover",onError:()=>v(!0)}):e.jsx("div",{className:f.cn("h-full w-full flex items-center justify-center text-[10px] font-medium",o?"bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300":"bg-zinc-200 dark:bg-zinc-700 text-zinc-700 dark:text-zinc-300"),children:s})})}function Ae({participant:t,isEventCanceled:n=!1,labels:s}){const r=t.name||"Unknown",o=r.split(" ").map(k=>k[0]).join("").toUpperCase().slice(0,2),i=t.isOrganizer??!1,v=t.isConfirmed,x=v===!0,l=v===!1,j=t.isClient??!1,F=t.profilePicture||t.avatar,y=n;return e.jsxs("div",{className:f.cn("flex items-center gap-3 py-0",y&&"opacity-60"),children:[e.jsxs("div",{className:"relative",children:[e.jsx(xt,{src:F,alt:r,initials:o,isClient:j,className:f.cn(y&&"grayscale")}),y||l?e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center",children:e.jsx("div",{className:"h-3 w-3 rounded-full bg-red-100 dark:bg-red-900/50 flex items-center justify-center",children:e.jsx(Me,{className:"h-2 w-2 text-red-600 dark:text-red-400 stroke-[3]"})})}):x?e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center",children:e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center",children:e.jsx(we,{className:"h-2 w-2 text-green-600 dark:text-green-400 stroke-[3]"})})}):null]}),e.jsxs("div",{className:"!h-fit min-w-0 gap-0",children:[e.jsx("div",{className:"gap-0",children:e.jsx("span",{className:f.cn("text-sm text-zinc-900 dark:text-zinc-100 truncate",y&&"line-through text-zinc-500 dark:text-zinc-500"),children:r})}),j&&e.jsx("div",{className:"text-[10px] px-1.5 w-fit py-0.5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 font-medium",children:s.client}),i&&!y&&e.jsx("div",{className:"text-xs text-zinc-500",children:s.organizer})]})]})}function ht({open:t,onOpenChange:n,title:s,children:r}){return c.useEffect(()=>{if(!t)return;const o=i=>{i.key==="Escape"&&n(!1)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t,n]),c.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t?e.jsxs("div",{className:"fixed inset-0 z-50",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>n(!1),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&n(!1)}}),e.jsx("div",{className:"fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-2xl shadow-xl overflow-hidden",children:[s&&e.jsx("div",{className:"sr-only",children:s}),r]})})]}):null}function mt({open:t,onOpenChange:n,title:s,description:r,cancelLabel:o,confirmLabel:i,onConfirm:v,isLoading:x}){return t?e.jsxs("div",{className:"fixed inset-0 z-[60]",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>n(!1),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&n(!1)}}),e.jsx("div",{className:"fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-lg shadow-xl p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:s}),e.jsx("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400",children:r}),e.jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[e.jsx(w.Button,{variant:"outline",size:"sm",onClick:()=>n(!1),children:o}),e.jsxs(w.Button,{variant:"destructive",size:"sm",onClick:v,disabled:x,children:[x&&e.jsx(ge,{className:"h-4 w-4 mr-2"}),e.jsx(Je,{className:"h-4 w-4 mr-2"}),i]})]})]})})]}):null}function ft(t,n){return t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function gt(t,n){const s={hour:"2-digit",minute:"2-digit",hour12:!1};return`${t.toLocaleTimeString(void 0,s)} – ${n.toLocaleTimeString(void 0,s)}`}function pt(t){return t.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function vt(t){const[n,s]=c.useState(()=>typeof window<"u"?window.matchMedia(t).matches:!1);return c.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(t),o=i=>s(i.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),n}function Fe({event:t,labels:n,isLoading:s,onClose:r,onEdit:o,onDelete:i,onCancel:v,onAccept:x,onDecline:l,onConfirmMeeting:j,canEdit:F=!0,canDelete:y=!1,canCancel:k=!0,isCurrentUserParticipant:B=!1,isCurrentUserClient:A=!1,currentUserAcceptStatus:W,isAcceptLoading:O=!1,isDeclineLoading:H=!1,isConfirmLoading:C=!1,isDeleteLoading:_=!1,renderParticipant:R,renderHeaderActions:Y,renderCancelReason:M,renderDeleteConfirmation:V,formatDate:S=ft,formatTimeRange:z=gt}){const[U,G]=c.useState(!1),Z=!(t.isCanceled||t.meetingTookPlace),h=t.isRecurring??!1,g=t.participantDetails,m=t.participantsNames||[],T=g&&g.length>0,D=W===!0,L=W===!1,te=B&&!A&&Z,$=T?g.filter(u=>u.isConfirmed).length:t.isAccepted?m.length:0,J=T?g.length:m.length,re=t.scheduleTypeColor||t.hexColor||"#039BE5",X=c.useCallback(()=>t.startDate?S(t.startDate):n.noDateProvided,[t.startDate,S,n.noDateProvided]),de=c.useCallback(()=>t.startDate&&t.endDate?z(t.startDate,t.endDate):null,[t.startDate,t.endDate,z]),ue=()=>{r(),o?.(t)},se=()=>{r(),v?.(t)},he=()=>{G(!0)},ie=()=>{i?.(t),G(!1)};return s?e.jsx("div",{className:"flex h-48 items-center justify-center",children:e.jsx(ge,{className:"h-6 w-6 text-zinc-400"})}):e.jsxs(w.TooltipProvider,{delayDuration:300,children:[e.jsxs("div",{className:"flex flex-col gap-0.5 p-3",children:[e.jsx("div",{className:"flex items-start justify-end gap-0.5",children:Y?Y({onClose:r}):e.jsxs(e.Fragment,{children:[Z&&F&&o&&e.jsx(be,{onClick:ue,label:n.edit,children:e.jsx(rt,{className:"h-[18px] w-[18px]"})}),Z&&k&&v&&e.jsx(be,{onClick:se,label:n.cancel,children:e.jsx(st,{className:"h-[18px] w-[18px]"})}),y&&i&&e.jsx(be,{onClick:he,label:n.delete,variant:"destructive",children:e.jsx(Je,{className:"h-[18px] w-[18px]"})}),e.jsx(be,{onClick:r,label:n.close,children:e.jsx(Me,{className:"h-[18px] w-[18px]"})})]})}),e.jsx("div",{children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-4 h-4 rounded mt-1 shrink-0",style:{backgroundColor:re}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h2",{className:f.cn("text-[22px] font-normal text-zinc-900 dark:text-zinc-100 leading-tight",t.isCanceled&&"line-through opacity-60"),children:t.title}),t.meetingTookPlace&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 text-xs font-medium",children:[e.jsx(ot,{className:"h-3 w-3"}),n.completed]}),t.isCanceled&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 text-xs font-medium",children:[e.jsx(Me,{className:"h-3 w-3"}),n.canceled]})]}),e.jsxs("div",{className:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx("span",{children:X()}),de()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsx("span",{children:de()})]})]}),h&&t.recurrenceSummary&&e.jsx("div",{className:"text-sm text-zinc-500 dark:text-zinc-500",children:t.recurrenceSummary})]})]})}),t.isCanceled&&e.jsx("div",{className:"mx-4 p-3 rounded-lg bg-red-50 dark:bg-red-950/30",children:M?M(t):e.jsx("div",{className:"flex items-start gap-0",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-red-700 dark:text-red-400",children:n.cancellationNote}),t.cancelReason&&e.jsxs("div",{className:"mt-1 text-sm text-red-600/80 dark:text-red-400/80 italic",children:['"',t.cancelReason,'"']}),t.canceledDate&&e.jsxs("div",{className:"mt-1.5 text-xs text-red-500/70 dark:text-red-400/60",children:[n.canceledOn," ",pt(t.canceledDate)]})]})})}),e.jsxs("div",{className:"space-y-0.5",children:[t.address&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(lt,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsx("span",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:t.address})]}),(T||m.length>0)&&e.jsxs("div",{className:"flex items-start gap-2 py-0",children:[e.jsx(it,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsxs("span",{className:"text-sm text-zinc-900 dark:text-zinc-100 font-medium",children:[J," ",J!==1?n.guests:n.guest]}),J>0&&e.jsxs("span",{className:"text-xs text-zinc-500",children:["(",$," ",n.confirmed,")"]})]}),e.jsxs("div",{className:"mt-2 space-y-2",children:[T?g.slice(0,6).map((u,I)=>R?R(u,I):e.jsx(Ae,{participant:u,isEventCanceled:t.isCanceled,labels:n},u.id)):m.slice(0,6).map((u,I)=>{const K={id:String(I),name:u,email:"",isConfirmed:t.isAccepted,isOrganizer:I===0,isClient:!1};return R?R(K,I):e.jsx(Ae,{participant:K,isEventCanceled:t.isCanceled,labels:n},u)}),J>6&&e.jsxs("div",{className:"text-xs text-zinc-500 py-1.5 pl-10",children:["+",J-6," ",n.more]})]})]})]}),t.description&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(dt,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-sm text-zinc-700 dark:text-zinc-300 whitespace-pre-wrap",children:t.description})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ct,{className:"h-5 w-5 text-zinc-400 mt-0.5 shrink-0"}),e.jsx("div",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:T&&g.find(u=>u.isOrganizer)?.name||m[0]||"Calendar"})]})]}),te&&x&&l&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 mt-3 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[h?e.jsxs(w.DropdownMenu,{children:[e.jsx(w.DropdownMenuTrigger,{asChild:!0,children:e.jsxs("div",{className:"flex",children:[e.jsx(w.Button,{size:"sm",variant:"outline",className:f.cn("rounded-r-none gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",D&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:u=>{u.stopPropagation(),D||x(t)},disabled:O,children:O?e.jsx(ge,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[D&&e.jsx(we,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(w.Button,{size:"sm",variant:"outline",className:f.cn("rounded-l-none px-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",D&&"!bg-green-700 !text-white hover:!bg-green-700"),children:e.jsx(at,{className:"h-3.5 w-3.5"})})]})}),e.jsxs(w.DropdownMenuContent,{align:"start",children:[e.jsxs(w.DropdownMenuItem,{className:f.cn("gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",D&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>x(t),children:[e.jsx(we,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptThisEvent]}),e.jsxs(w.DropdownMenuItem,{onClick:()=>x(t),children:[e.jsx(we,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptAllEvents]})]})]}):e.jsx(w.Button,{size:"sm",variant:"outline",className:f.cn("gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",D&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>{D||x(t)},disabled:O,children:O?e.jsx(ge,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[D&&e.jsx(we,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(w.Button,{size:"sm",variant:"outline",className:f.cn("gap-1.5 h-8 !border-none !bg-rose-100 text-rose-800 hover:!bg-rose-200",L&&"!bg-rose-700 !text-white hover:!bg-rose-700"),onClick:()=>{L||l(t)},disabled:H,children:H?e.jsx(ge,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[L&&e.jsx(Me,{className:"h-3.5 w-3.5"}),n.notGoing]})})]})}),B&&D&&!t.meetingTookPlace&&!t.isCanceled&&j&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 py-3",children:e.jsxs(w.Button,{size:"sm",variant:"outline",className:"w-full h-9 hover:!bg-green-100 hover:text-green-700 text-green-700 !bg-green-100 !border-none dark:text-green-400 dark:hover:bg-green-950/30",onClick:()=>j(t),disabled:C,children:[C&&e.jsx(ge,{className:"h-4 w-4 mr-2"}),n.confirmMeeting]})})]}),V?U&&V({onConfirm:ie,onCancel:()=>G(!1),isLoading:_}):e.jsx(mt,{open:U,onOpenChange:G,title:n.deleteConfirmTitle,description:n.deleteConfirmDescription,cancelLabel:n.cancel,confirmLabel:n.delete,onConfirm:ie,isLoading:_})]})}function jt({event:t,children:n,open:s,onOpenChange:r,isLoading:o,labels:i,onEdit:v,onDelete:x,onCancel:l,onAccept:j,onDecline:F,onConfirmMeeting:y,canEdit:k=!0,canDelete:B=!1,canCancel:A=!0,isCurrentUserParticipant:W,isCurrentUserClient:O,currentUserAcceptStatus:H,isAcceptLoading:C,isDeclineLoading:_,isConfirmLoading:R,isDeleteLoading:Y,renderParticipant:M,renderHeaderActions:V,renderCancelReason:S,renderDeleteConfirmation:z,formatDate:U,formatTimeRange:G,className:Z,width:h=360}){const g=vt("(min-width: 768px)"),m={...ut,...i},T=c.useCallback(()=>{r?.(!1)},[r]),D={event:t,labels:m,isLoading:o,onClose:T,onEdit:v,onDelete:x,onCancel:l,onAccept:j,onDecline:F,onConfirmMeeting:y,canEdit:k,canDelete:B,canCancel:A,isCurrentUserParticipant:W,isCurrentUserClient:O,currentUserAcceptStatus:H,isAcceptLoading:C,isDeclineLoading:_,isConfirmLoading:R,isDeleteLoading:Y,renderParticipant:M,renderHeaderActions:V,renderCancelReason:S,renderDeleteConfirmation:z,formatDate:U,formatTimeRange:G};return g?e.jsxs(w.Popover,{open:s??!1,onOpenChange:r??(()=>{}),children:[e.jsx(w.PopoverTrigger,{asChild:!0,children:n}),e.jsx(w.PopoverContent,{className:f.cn("p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",Z),style:{width:h},align:"center",side:"bottom",sideOffset:4,children:e.jsx(Fe,{...D})})]}):e.jsxs(e.Fragment,{children:[n,e.jsx(ht,{open:s??!1,onOpenChange:r??(()=>{}),title:t.title,children:e.jsx(Fe,{...D})})]})}const Ee=44,We=4,wt=56,Oe=8,Ne=80,je=140,_e=100,$e=2,bt=8,yt=18;function kt(t){return t.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2)}function Nt(t,n){const s=[];for(let r=0;r<n;r++){const o=new Date(t);o.setDate(o.getDate()+r),s.push(o)}return s}function Ct(t,n,s){const r=[];return t.forEach((o,i)=>{for(let v=n;v<s;v++)r.push({hour:v,dayIndex:i,date:o})}),r}function Se(t){return`${t.toString().padStart(2,"0")}:00`}function Dt(t){return t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function Be(t){const n=[...t].sort((o,i)=>o.startCol!==i.startCol?o.startCol-i.startCol:i.spanCols-o.spanCols),s=[],r=[];for(const o of n){let i=0;for(;r[i]!==void 0&&r[i]>o.startCol;)i++;r[i]=o.startCol+o.spanCols,s.push({...o,stackIndex:i})}return s}function Mt({src:t,alt:n,fallback:s,className:r}){return e.jsx("div",{className:f.cn("relative flex shrink-0 overflow-hidden rounded-sm border bg-muted",r),children:t?e.jsx("img",{src:t,alt:n,className:"aspect-square h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-muted text-muted-foreground",children:s})})}const Tt=7;function pe({daysToShow:t=Tt,events:n,users:s=[],alwaysShowResources:r,selectedDate:o,onDateChange:i,onEventClick:v,onSlotClick:x,onSlotSelect:l,visibleHours:j,className:F,getEventUserId:y,renderPopover:k,slots:B,classNames:A,enableDrag:W=!0}){const O=c.useRef(null),H=ye.useOptionalDragDrop(),[C,_]=c.useState(null),R=c.useRef(!1),[Y,M]=c.useState(null),V=o??new Date,S=!0,z=j?.from??bt,U=j?.to??yt,G=U-z,Z=c.useMemo(()=>{const a=new Date(V);if(t===1||t===3)return a.setHours(0,0,0,0),a;const d=a.getDay(),p=d===0?-6:1-d;return a.setDate(a.getDate()+p),a.setHours(0,0,0,0),a},[V,t]),h=c.useMemo(()=>Nt(Z,t),[Z,t]),g=c.useMemo(()=>Ct(h,z,U),[S,h,z,U]),T=y??(a=>{if(a.resourceId)return a.resourceId;const d=a.data;if(d?.userId)return String(d.userId);if(d?.user&&typeof d.user=="object"&&d.user.id)return String(d.user.id);if(a.user?.id)return a.user.id;if(a.participants?.[0]?.id)return a.participants[0].id}),D=c.useMemo(()=>{const a=new Map;for(const d of s)a.set(d.id,{id:d.id,name:d.name,avatar:d.avatar??void 0,email:d.email});for(const d of n){const b=d.data?.user;b?.id&&!a.has(b.id)&&a.set(b.id,{id:b.id,name:b.name??"",avatar:b.avatar??void 0,email:b.email}),d.user?.id&&!a.has(d.user.id)&&a.set(d.user.id,{id:d.user.id,name:d.user.name,avatar:d.user.avatar??void 0,email:d.user.email});for(const N of d.participants||[])N.id&&!a.has(N.id)&&a.set(N.id,{id:N.id,name:N.name,avatar:N.avatar??void 0,email:N.email})}return Array.from(a.values())},[s,n]),L=c.useMemo(()=>{const a=[],d=new Map;for(const N of D)d.set(N.id,[]);d.set("unassigned",[]);for(const N of n){const E=T(N)??"unassigned";(d.get(E)??d.get("unassigned")).push(N)}const p=N=>{const E=[];for(const P of N){const ee=P.startDate.getHours()+P.startDate.getMinutes()/60,ne=P.endDate.getHours()+P.endDate.getMinutes()/60;for(let Q=0;Q<h.length;Q++){const oe=h[Q],me=q.startOfDay(oe),fe=q.endOfDay(oe);if(P.startDate<=fe&&P.endDate>=me){let xe=z,ve=U;if(P.startDate>=me&&(xe=Math.max(z,ee)),P.endDate<=fe&&(ve=Math.min(U,ne)),xe=Math.max(z,Math.min(U,xe)),ve=Math.max(z,Math.min(U,ve)),ve>xe){const Ze=Q*G+(xe-z),et=ve-xe;E.push({event:P,startCol:Ze,spanCols:et})}}}}return E};for(const N of D){const E=d.get(N.id)??[],P=p(E),ee=Be(P),ne=ee.reduce((Q,oe)=>Math.max(Q,oe.stackIndex+1),0);a.push({user:N,events:ee,maxStack:Math.max(ne,1)})}const b=d.get("unassigned")??[];if(b.length>0){const N=p(b),E=Be(N),P=E.reduce((ee,ne)=>Math.max(ee,ne.stackIndex+1),0);a.push({user:{id:"unassigned",name:"Unassigned",avatar:void 0,email:void 0},events:E,maxStack:Math.max(P,1)})}if(r?.length){const N=new Set(a.map(E=>E.user.id));for(const E of r)N.has(E.id)||(a.push({user:{id:E.id,name:E.name,avatar:E.avatar??void 0,email:E.email},events:[],maxStack:1}),N.add(E.id))}return a},[D,n,h,S,G,z,U,T,r]),te=c.useMemo(()=>{const a=new Map;for(const d of L)for(const p of d.events)if(p.spanCols<=1){const b=Math.floor(p.startCol),N=a.get(b)??0;a.set(b,N+1)}return a},[L]),$=c.useMemo(()=>{const a=g.length,d=Ne,p=[];for(let b=0;b<a;b++){const N=te.get(b)??0;N>$e?p.push(_e+(N-$e)*20):N>0?p.push(Math.max(d,_e)):p.push(d)}return p},[S,g.length,h.length,te]),J=a=>Math.max(wt,a*(Ee+We)+Oe*2),re=je+$.reduce((a,d)=>a+d,0),X=c.useMemo(()=>{const a=[0];for(let d=0;d<$.length;d++)a.push(a[d]+$[d]);return a},[$]),de=c.useCallback(a=>{const d=X.length-1;if(a<=0)return X[0]??0;if(a>=d)return X[d]??0;const p=Math.floor(a),b=X[p]??0,N=X[p+1]??b;return b+(a-p)*(N-b)},[X]);c.useLayoutEffect(()=>{const a=O.current;if(!a)return;const d=()=>{let p=-1;const N=new Date().getHours();{for(let E=0;E<g.length;E++){const P=g[E];if(P&&q.isToday(P.date)&&P.hour<=N&&P.hour+1>N){p=E;break}}if(p===-1)for(let E=0;E<g.length;E++){const P=g[E];if(P&&q.isToday(P.date)){p=E;break}}}if(p!==-1){const E=(X[p]??0)+je,P=a.clientWidth,ee=Math.max(0,E-P/3);a.scrollTo({left:ee,behavior:"instant"})}};requestAnimationFrame(()=>{requestAnimationFrame(d)})},[V,g,h,X,S]);const ue=c.useCallback((a,d)=>{const p=d.getBoundingClientRect(),b=a-p.left+d.scrollLeft;for(let N=0;N<X.length-1;N++){const E=X[N],P=X[N+1];if(b>=E&&b<P){const ee=(b-E)/(P-E),ne=Math.floor(ee*60),Q=Math.round(ne/15)*15;return{colIndex:N,minute:Math.min(Q,45)}}}return null},[X]),se=c.useCallback((a,d)=>{if(g[a]){const p=g[a],b=new Date(p.date);return b.setHours(p.hour,d??0,0,0),{date:b,hour:p.hour}}return{date:new Date}},[S,g,h]),he=c.useCallback((a,d)=>{if(a.preventDefault(),a.dataTransfer.dropEffect="move",!H?.isDragging||!H.dragState)return;const p=a.currentTarget,b=ue(a.clientX,p);if(!b)return;const{colIndex:N,minute:E}=b,{date:P,hour:ee}=se(N,E);H.updateDragPreview(P,ee,E,d);const{originalStartDate:ne,originalEndDate:Q}=H.dragState,oe=Q.getTime()-ne.getTime(),me=g.length;let fe;{const xe=oe/36e5;fe=Math.max(1,Math.ceil(xe))}fe=Math.min(fe,me-N),M({resourceId:d,colIndex:N,spanCols:fe})},[H,ue,se,S,g.length,h.length]),ie=c.useCallback(a=>{const d=a.relatedTarget;a.currentTarget.contains(d)||M(null)},[]),u=c.useCallback((a,d)=>{a.preventDefault(),M(null),H?.isDragging&&H.endDrag()},[H]),I=c.useCallback((a,d)=>{if(!C||C.resourceId!==a)return!1;const p=Math.min(C.startCol,C.endCol),b=Math.max(C.startCol,C.endCol);return d>=p&&d<=b},[C]),K=c.useCallback((a,d)=>!Y||Y.resourceId!==a?!1:d>=Y.colIndex&&d<Y.colIndex+Y.spanCols,[Y]),ae=c.useCallback((a,d,p)=>{p.button!==0&&p.pointerType==="mouse"||(l||x)&&(p.preventDefault(),R.current=!0,_({resourceId:a,startCol:d,endCol:d,isSelecting:!0}))},[l,x]),ke=c.useCallback((a,d,p)=>{if(R.current&&!(!C||C.resourceId!==a)){if(p.buttons===0){R.current=!1;return}_(b=>b?{...b,endCol:d}:null)}},[C]),Te=c.useCallback(()=>{if(!R.current||!C)return;R.current=!1;const a=Math.min(C.startCol,C.endCol),d=Math.max(C.startCol,C.endCol),p=se(a),b=se(d),N=new Date(p.date),E=new Date(b.date);b.hour!==void 0&&E.setHours(b.hour+1,0,0,0);const P={startDate:N,endDate:E,resourceId:C.resourceId};a===d&&x&&x(p.date,p.hour,C.resourceId),l?.(P),_(ee=>ee?{...ee,isSelecting:!1}:null),setTimeout(()=>_(null),150)},[C,se,S,x,l]);return c.useEffect(()=>{const a=()=>{R.current&&Te()};return window.addEventListener("pointerup",a),window.addEventListener("pointercancel",a),()=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a)}},[Te]),c.useEffect(()=>{H?.isDragging||M(null)},[H?.isDragging]),e.jsx("div",{className:f.cn("flex h-full flex-col",F),children:e.jsx("div",{className:"ic-timeline-scroll-container flex-1",ref:O,children:e.jsxs("div",{className:"relative",style:{minWidth:re},children:[e.jsx("div",{className:"ic-timeline-header sticky top-0 z-20 border-b bg-background",children:t>1?e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex shrink-0 items-center justify-center border-r bg-background px-2 sticky left-0 z-10",style:{width:je},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("div",{className:"flex border-b",children:h.map((a,d)=>{const p=q.isToday(a),b=d*G,N=$.slice(b,b+G).reduce((E,P)=>E+P,0);return e.jsx("div",{className:f.cn("flex shrink-0 items-center justify-center border-r py-1.5 font-medium",p?"bg-primary/10 text-primary":"bg-muted/30"),style:{width:N},children:e.jsx("span",{className:"text-xs",children:Dt(a)})},`day-${a.toISOString()}`)})}),e.jsx("div",{className:"flex",children:g.map((a,d)=>{const p=a.hour===z,b=q.isToday(a.date),N=$[d]??Ne;return e.jsx("div",{className:f.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",p&&d>0?"border-l-2 border-l-border":"border-r border-r-border/50",b&&"bg-primary/5"),style:{width:N},children:Se(a.hour)},`hour-${a.dayIndex}-${a.hour}`)})})]})]}):e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex shrink-0 items-center border-r bg-background px-2 py-2",style:{width:je},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),g.map((a,d)=>{const p=a.hour===z,b=q.isToday(a.date),N=$[d]??Ne;return e.jsx("div",{className:f.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",p&&d>0?"border-l-2 border-l-border":"border-r border-r-border/50",b&&"bg-primary/5"),style:{width:N},children:Se(a.hour)},`hour-${a.dayIndex}-${a.hour}`)})]})}),L.map(a=>{const d=J(a.maxStack);return e.jsxs("div",{className:f.cn("relative flex border-b",A?.resourceRow),style:{height:d},children:[e.jsx("div",{className:"sticky left-0 z-10",style:{width:je},children:e.jsxs("div",{className:f.cn("flex h-full items-center gap-2 sm:gap-3 border-r bg-background px-2 sm:px-4",A?.resourceHeader),children:[e.jsx(Mt,{className:"size-7",src:a.user.avatar,alt:a.user.name,fallback:kt(a.user.name)}),e.jsx("span",{className:"truncate text-xs sm:text-sm font-medium",children:a.user.name})]})}),e.jsxs("div",{className:"ic-timeline-grid relative flex",onDragOver:p=>he(p,a.user.id),onDragLeave:ie,onDrop:p=>u(p,a.user.id),children:[g.map((p,b)=>{const N=p.hour===z&&b>0,E=$[b]??Ne,P=I(a.user.id,b),ee=K(a.user.id,b),ne=!!(l||x);return e.jsx("div",{role:ne?"button":void 0,tabIndex:ne?0:void 0,"aria-label":ne?`Select ${Se(p.hour)} on ${p.date.toLocaleDateString()} for ${a.user.name}`:void 0,onPointerDown:Q=>ae(a.user.id,b,Q),onPointerEnter:Q=>ke(a.user.id,b,Q),onPointerUp:Te,onKeyDown:Q=>{if(ne&&(Q.key==="Enter"||Q.key===" ")){Q.preventDefault();const oe=se(b);x?.(oe.date,oe.hour,a.user.id),l?.({startDate:oe.date,endDate:(()=>{const me=new Date(oe.date);return oe.hour!==void 0&&me.setHours(oe.hour+1,0,0,0),me})(),resourceId:a.user.id})}},className:f.cn("shrink-0 select-none touch-none transition-colors",ne&&"cursor-pointer",N?"border-l-2 border-l-border":"border-r border-r-border/50",q.isToday(p.date)&&"bg-primary/5",ne&&!C?.isSelecting&&!H?.isDragging&&"hover:bg-blue-50/60",P&&"bg-blue-100/70",ee&&"bg-primary/20 ring-2 ring-primary ring-inset"),style:{width:E}},`cell-${p.dayIndex}-${p.hour}`)}),a.events.map(p=>{const b=de(p.startCol),N=de(p.startCol+p.spanCols),E=b+2,P=N-b-4,ee=Oe+p.stackIndex*(Ee+We),ne=t===1?"timeline-day":t===3?"timeline-3day":"timeline-week",Q=B?.eventCard;return e.jsx("div",{className:"absolute",style:{left:E,width:Math.max(P,0),top:ee,height:Ee},children:Q?e.jsx(Q,{event:p.event,view:ne,isCompact:!0,onClick:()=>v?.(p.event)}):e.jsx(w.EventCard,{event:p.event,variant:"compact",enableDrag:W,onClick:v,renderPopover:k,className:f.cn("h-full w-full",A?.eventCardCompact)})},p.event.id)})]})]},a.user.id)}),L.length===0&&e.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:"No users or events to display"})]})})})}const Et=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],St=["January","February","March","April","May","June","July","August","September","October","November","December"];function Re(t){const n=t.hexColor;return n?{backgroundColor:n}:{}}function Lt({day:t,date:n,events:s,isCurrentMonth:r,onDayClick:o}){const i=q.isToday(n),v=3,x=s.length;return e.jsxs("button",{type:"button",onClick:()=>o?.(n),className:f.cn("flex h-9 sm:h-11 flex-1 flex-col items-center justify-start gap-0.5 rounded-md pt-0.5 sm:pt-1","hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-colors",!r&&"opacity-40"),children:[e.jsx("div",{className:f.cn("flex size-5 sm:size-6 items-center justify-center rounded-full text-[10px] sm:text-xs font-medium",i&&"bg-primary font-semibold text-primary-foreground"),children:t}),x>0&&e.jsx("div",{className:"mt-0.5 flex items-center gap-0.5",children:x<=v?s.map(l=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:Re(l)},l.id)):e.jsxs(e.Fragment,{children:[s.slice(0,v).map(l=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:Re(l)},l.id)),e.jsxs("span",{className:"text-[6px] sm:text-[7px] font-medium text-muted-foreground",children:["+",x-v]})]})})]})}function Ht({date:t,events:n,onMonthClick:s,onDayClick:r}){const o=c.useMemo(()=>q.generateMonthGrid(t,0),[t]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("button",{type:"button",onClick:()=>s?.(t),className:f.cn("w-full rounded-t-lg border px-2 sm:px-3 py-1.5 sm:py-2 text-xs sm:text-sm font-semibold","hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-colors"),children:St[t.getMonth()]}),e.jsxs("div",{className:"flex-1 space-y-1.5 sm:space-y-2 rounded-b-lg border border-t-0 p-2 sm:p-3",children:[e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 text-center",children:Et.map((i,v)=>e.jsxs("div",{className:"text-[9px] sm:text-xs font-medium text-muted-foreground",children:[e.jsx("span",{className:"sm:hidden",children:i[0]}),e.jsx("span",{className:"hidden sm:inline",children:i})]},v))}),e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 gap-y-1",children:o.map((i,v)=>{const x=q.getEventsForDay(n,i.date);return e.jsx(Lt,{day:i.date.getDate(),date:i.date,events:x,isCurrentMonth:i.isCurrentMonth,onDayClick:r},`${v+1}-${i.date.toISOString()}`)})})]})]})}function Xe({events:t,year:n,onMonthClick:s,onDayClick:r,className:o,slots:i,classNames:v}){const x=c.useMemo(()=>q.getYearMonths(n),[n]);return e.jsxs("div",{className:f.cn("flex flex-col h-full",o),children:[e.jsx("div",{className:"flex items-center justify-center border-b px-4 py-3",children:e.jsx("h2",{className:"text-lg font-semibold",children:n})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:x.map(l=>e.jsx(Ht,{date:l,events:t,onMonthClick:s,onDayClick:r},l.getMonth()))})})]})}const Ce=200,It=60,zt=300,Pt=7,Ue=2,Le=40,At=18;function Ft(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m18 15-6-6-6 6"})})}function Wt(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function Ot(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function _t(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function $t({containerRef:t,currentDate:n,className:s}){const[r,o]=c.useState({canUp:!1,canDown:!1,canLeft:!1,canRight:!1}),[i,v]=c.useState({x:0,y:0}),[x,l]=c.useState(!1),j=r.canUp||r.canDown||r.canLeft||r.canRight,F=c.useRef(null),y=c.useRef(null),k=c.useRef(null),B=c.useRef(!1),A=c.useRef({x:0,y:0}),W=c.useRef({x:0,y:0}),O=c.useRef(0),H=c.useRef(null),C=c.useCallback(()=>{const m=t.current;if(!m)return;const T=4;o({canUp:m.scrollTop>T,canDown:m.scrollTop+m.clientHeight<m.scrollHeight-T,canLeft:m.scrollLeft>T,canRight:m.scrollLeft+m.clientWidth<m.scrollWidth-T})},[t]);c.useEffect(()=>{const m=t.current;if(!m)return;C(),m.addEventListener("scroll",C,{passive:!0});const T=new ResizeObserver(C);T.observe(m);const D=new MutationObserver(C);return D.observe(m,{childList:!0,subtree:!0}),()=>{m.removeEventListener("scroll",C),T.disconnect(),D.disconnect()}},[t,C]);const _=c.useCallback((m,T)=>{t.current?.scrollBy({left:m,top:T,behavior:"smooth"})},[t]),R=c.useCallback(()=>_(0,-Ce),[_]),Y=c.useCallback(()=>_(0,Ce),[_]),M=c.useCallback(()=>_(-Ce,0),[_]),V=c.useCallback(()=>_(Ce,0),[_]),S=c.useCallback(()=>{F.current&&(clearTimeout(F.current),F.current=null),y.current&&(clearInterval(y.current),y.current=null)},[]),z=c.useCallback(m=>{m(),F.current=setTimeout(()=>{y.current=setInterval(m,It)},zt)},[]);c.useEffect(()=>S,[S]),c.useEffect(()=>{const m=t.current;if(!m)return;const T=D=>{if(D.ctrlKey||D.metaKey||D.altKey)return;const L=D.target.tagName;if(!(L==="INPUT"||L==="TEXTAREA"||D.target.isContentEditable))switch(D.key){case"ArrowUp":D.preventDefault(),R();break;case"ArrowDown":D.preventDefault(),Y();break;case"ArrowLeft":D.preventDefault(),M();break;case"ArrowRight":D.preventDefault(),V();break}};return m.addEventListener("keydown",T),()=>m.removeEventListener("keydown",T)},[t,R,Y,M,V]),c.useEffect(()=>{if(!j)return;const m=H.current;if(!m)return;let T=0;const D=()=>{const J=m.offsetParent;if(!J)return;const re=J.getBoundingClientRect(),X=window.innerHeight;if(re.height<=X){m.style.removeProperty("top"),m.style.removeProperty("bottom");return}const ue=Math.min(re.bottom,X)-re.top,se=m.offsetHeight,he=ue-se-12,ie=12,u=J.clientHeight-se-12,I=Math.max(ie,Math.min(he,u));m.style.top=`${I}px`,m.style.bottom="auto"},L=()=>{cancelAnimationFrame(T),T=requestAnimationFrame(D)},te=[window];let $=m.parentElement;for(;$;){const J=getComputedStyle($);/(auto|scroll)/.test(J.overflow+J.overflowY)&&te.push($),$=$.parentElement}for(const J of te)J.addEventListener("scroll",L,{passive:!0});return window.addEventListener("resize",L,{passive:!0}),D(),()=>{cancelAnimationFrame(T);for(const J of te)J.removeEventListener("scroll",L);window.removeEventListener("resize",L)}},[j]);const U=c.useCallback(()=>{B.current=!1,l(!1),v({x:0,y:0}),W.current={x:0,y:0},O.current&&cancelAnimationFrame(O.current)},[]),G=c.useCallback(m=>{m.preventDefault(),B.current=!0,l(!0),A.current={x:m.clientX,y:m.clientY},W.current={x:0,y:0},m.target.setPointerCapture(m.pointerId);const T=()=>{if(!B.current)return;const D=t.current;if(D){const{x:L,y:te}=W.current,$=Math.sqrt(L*L+te*te);if($>Ue){const re=Math.min($/Le,1)*At;D.scrollLeft+=L/$*re,D.scrollTop+=te/$*re}}O.current=requestAnimationFrame(T)};O.current=requestAnimationFrame(T)},[t]),Z=c.useCallback(m=>{if(!B.current)return;const T=m.clientX-A.current.x,D=m.clientY-A.current.y;W.current={x:T,y:D};const L=Math.sqrt(T*T+D*D);if(L<Ue)v({x:0,y:0});else{const $=Math.min(L,Le)/Le*Pt;v({x:T/L*$,y:D/L*$})}},[]),h=c.useCallback(m=>{switch(m.key){case"ArrowUp":m.preventDefault(),R();break;case"ArrowDown":m.preventDefault(),Y();break;case"ArrowLeft":m.preventDefault(),M();break;case"ArrowRight":m.preventDefault(),V();break}},[R,Y,M,V]);if(!j)return null;const g=n?n.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):null;return e.jsxs("div",{ref:H,className:`inno-scroll-nav-wrapper ${s??""}`,role:"toolbar","aria-label":"Scroll navigation",onKeyDown:h,children:[g&&e.jsx("div",{className:"inno-scroll-nav-date","aria-live":"polite",children:g}),e.jsxs("div",{className:"inno-scroll-nav",children:[e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-up ${r.canUp?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll up",disabled:!r.canUp,onPointerDown:()=>z(R),onPointerUp:S,onPointerLeave:S,tabIndex:r.canUp?0:-1,children:e.jsx(Ft,{})}),e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-left ${r.canLeft?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll left",disabled:!r.canLeft,onPointerDown:()=>z(M),onPointerUp:S,onPointerLeave:S,tabIndex:r.canLeft?0:-1,children:e.jsx(Ot,{})}),e.jsx("button",{ref:k,type:"button",className:`inno-scroll-nav-joystick ${x?"inno-scroll-nav-joystick-active":""}`,"aria-label":"Drag to scroll freely",onPointerDown:G,onPointerMove:Z,onPointerUp:U,onPointerCancel:U,tabIndex:0,children:e.jsx("span",{className:"inno-scroll-nav-joystick-dot",style:{transform:`translate(${i.x}px, ${i.y}px)`}})}),e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-right ${r.canRight?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll right",disabled:!r.canRight,onPointerDown:()=>z(V),onPointerUp:S,onPointerLeave:S,tabIndex:r.canRight?0:-1,children:e.jsx(_t,{})}),e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-down ${r.canDown?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll down",disabled:!r.canDown,onPointerDown:()=>z(Y),onPointerUp:S,onPointerLeave:S,tabIndex:r.canDown?0:-1,children:e.jsx(Wt,{})})]})]})}function Bt(t){switch(t){case"day":case"week":return"time";default:return"day"}}function Rt({onEventClick:t,onSlotClick:n,onSlotSelect:s,onAddEvent:r,alwaysShowResources:o,className:i,showHeader:v=!0,minSelectionMinutes:x=30,showMoreMode:l,showMoreEventsInPopover:j=!1,isLoading:F=!1,slots:y,classNames:k,settingsContent:B,filterContent:A,headerActions:W,renderPopover:O,calendarRef:H,headerConfig:C,eventDetailMode:_,renderEventDetail:R}){const Y=l??(j?"popover":"expand"),{view:M,setView:V,selectedDate:S,setSelectedDate:z,slotDuration:U,filteredEvents:G,users:Z,visibleHours:h,workingHours:g,badgeVariant:m,showWorkingHoursOnly:T,clearFocusEventId:D}=ye.useInnoCalendar(),L=c.useMemo(()=>{if(!T||!g)return{startHour:h.start,endHour:h.end};let u=24,I=0;for(const K of Object.keys(g)){const ae=g[Number(K)];!ae||ae.enabled===!1||(ae.from<u&&(u=ae.from),ae.to>I&&(I=ae.to))}return u>=I?{startHour:h.start,endHour:h.end}:{startHour:u,endHour:I}},[T,g,h]),te=L,$=c.useRef(null);c.useImperativeHandle(H,()=>({scrollToToday:()=>{const u=new Date;z(u,M),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const I=$.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!I)return;const ke=(u.getHours()-L.startHour)*96;ke>0&&I.scrollTo({top:Math.max(0,ke-100),behavior:"smooth"})})})},scrollToWorkingHours:()=>{let u=8;if(g)for(const I of Object.keys(g)){const K=g[Number(I)];K?.enabled&&K.from<u&&(u=Math.max(K.from-1,0))}requestAnimationFrame(()=>{requestAnimationFrame(()=>{const I=$.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!I)return;const ae=(u-L.startHour)*96;I.scrollTo({top:Math.max(0,ae),behavior:"smooth"})})})},getViewRect:()=>$.current?.getBoundingClientRect()??null,focusEvent:u=>{D(),requestAnimationFrame(()=>{D()});const I=$.current?.querySelector(`[data-event-id="${u}"]`);I&&setTimeout(()=>I.click(),150)}}),[z,M,L,g,D]);const J=c.useMemo(()=>Bt(M),[M]),re=c.useCallback(u=>{if(s){s(u);return}if(n){const I=u.startDate.getHours();n(u.startDate,I)}},[s,n]),X=c.useCallback(u=>{V("day"),z(u,"day")},[z,V]),de=c.useCallback(u=>{V("month"),z(u,"month")},[z,V]),ue=c.useCallback(u=>{t?.(u)},[t]),se=c.useCallback((u,I,K)=>{n?.(u,I)},[n]),he=()=>{const u=G,I=ue,K=O;switch(M){case"day":return e.jsx(w.DayView,{events:u,date:S,visibleHours:te,workingHours:g,slotDuration:U,badgeVariant:m,onEventClick:I,renderPopover:K,...y&&{slots:y},...k&&{classNames:k}});case"week":return e.jsx(w.WeekView,{events:u,date:S,visibleHours:te,workingHours:g,slotDuration:U,badgeVariant:m,onEventClick:I,renderPopover:K,...y&&{slots:y},...k&&{classNames:k}});case"month":return e.jsx(w.MonthView,{events:u,date:S,badgeVariant:m,onEventClick:I,onDayClick:X,renderPopover:K,showMoreMode:Y,...y&&{slots:y},...k&&{classNames:k}});case"year":return e.jsx(Xe,{events:u,year:S.getFullYear(),onMonthClick:de,onDayClick:X,...y&&{slots:y},...k&&{classNames:k}});case"agenda":return e.jsx(w.AgendaView,{events:u,date:S,onEventClick:I,renderPopover:K,...y&&{slots:y},...k&&{classNames:k}});case"resource-day":return e.jsx(pe,{daysToShow:1,events:u,users:Z,...o&&{alwaysShowResources:o},selectedDate:S,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:se,renderPopover:K,...y&&{slots:y},...k&&{classNames:k}});case"resource-week":return e.jsx(pe,{daysToShow:7,events:u,users:Z,...o&&{alwaysShowResources:o},selectedDate:S,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:se,renderPopover:K,...y&&{slots:y},...k&&{classNames:k}});case"timeline-day":return e.jsx(pe,{daysToShow:1,events:u,users:Z,...o&&{alwaysShowResources:o},selectedDate:S,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:se,renderPopover:K,...y&&{slots:y},...k&&{classNames:k}});case"timeline-3day":return e.jsx(pe,{daysToShow:3,events:u,users:Z,...o&&{alwaysShowResources:o},selectedDate:S,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:se,renderPopover:K,...y&&{slots:y},...k&&{classNames:k}});case"timeline-week":return e.jsx(pe,{daysToShow:7,events:u,users:Z,...o&&{alwaysShowResources:o},selectedDate:S,visibleHours:{from:L.startHour,to:L.endHour},onEventClick:I,onSlotSelect:re,onSlotClick:se,renderPopover:K,...y&&{slots:y},...k&&{classNames:k}});default:return e.jsx(w.MonthView,{events:u,date:S,badgeVariant:m,onEventClick:I,onDayClick:X,...y&&{slots:y},...k&&{classNames:k}})}},ie=c.useRef(null);return c.useEffect(()=>{$.current=ie.current}),e.jsx(ye.SlotSelectionProvider,{mode:J,onSelect:re,minDurationMinutes:x,slotDurationMinutes:U,enabled:!!(s||n),children:e.jsxs("div",{className:f.cn("inno-calendar-root flex flex-col h-full p-4",k?.root,i),children:[v&&e.jsx(w.CalendarHeader,{currentDate:S,view:M,events:G,onViewChange:V,onNavigateToday:()=>z(new Date,M),onNavigatePrev:()=>{const u=new Date(S);M==="day"||M==="timeline-day"||M==="resource-day"?u.setDate(u.getDate()-1):M==="timeline-3day"?u.setDate(u.getDate()-3):M==="week"||M==="timeline-week"||M==="resource-week"?u.setDate(u.getDate()-7):M==="month"?u.setMonth(u.getMonth()-1):M==="year"?u.setFullYear(u.getFullYear()-1):u.setDate(u.getDate()-7),z(u,M)},onNavigateNext:()=>{const u=new Date(S);M==="day"||M==="timeline-day"||M==="resource-day"?u.setDate(u.getDate()+1):M==="timeline-3day"?u.setDate(u.getDate()+3):M==="week"||M==="timeline-week"||M==="resource-week"?u.setDate(u.getDate()+7):M==="month"?u.setMonth(u.getMonth()+1):M==="year"?u.setFullYear(u.getFullYear()+1):u.setDate(u.getDate()+7),z(u,M)},availableViews:["day","week","month","agenda"],showTimelineViews:!0,showSettings:!!B,...!W&&r&&{onAddEvent:r},actions:W,settingsContent:B,filterContent:A,...C&&{headerConfig:C}}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:ie,className:f.cn("h-full border rounded-lg bg-white overflow-x-auto",k?.viewContainer),children:he()}),F&&e.jsx("div",{className:"inno-calendar-loading-overlay",children:e.jsx("div",{className:"inno-calendar-spinner"})}),e.jsx($t,{containerRef:ie,currentDate:S})]})]})})}function Ut({events:t,users:n=[],alwaysShowResources:s,scheduleTypes:r=[],initialView:o,initialDate:i,initialSelectedUserId:v,initialScheduleTypeIds:x,initialParticipantIds:l,initialWorkingHoursView:j,initialSearchQuery:F,preferencesConfig:y,onEventClick:k,onSlotClick:B,onSlotSelect:A,onAddEvent:W,onEventDrop:O,onDateChange:H,onViewChange:C,className:_,showHeader:R=!0,minSelectionMinutes:Y=30,showMoreMode:M,showMoreEventsInPopover:V=!1,isLoading:S=!1,renderPopover:z,slots:U,classNames:G,settingsContent:Z,filterContent:h,headerActions:g,focusEventId:m,headerConfig:T,eventDetailMode:D,renderEventDetail:L},te){return e.jsx(ye.DragDropProvider,{...O&&{onEventDrop:O},children:e.jsx(ye.InnoCalendarProvider,{initialEvents:t,initialUsers:n,initialScheduleTypes:r,...o&&{initialView:o},...i&&{initialDate:i},...v&&{initialSelectedUserId:v},...x&&{initialScheduleTypeIds:x},...l&&{initialParticipantIds:l},...j&&{initialWorkingHoursView:j},...F&&{initialSearchQuery:F},...y&&{preferencesConfig:y},...H&&{onDateChange:H},...C&&{onViewChange:C},...m&&{initialFocusEventId:m},children:e.jsx(Rt,{...k&&{onEventClick:k},...B&&{onSlotClick:B},...A&&{onSlotSelect:A},...W&&{onAddEvent:W},...s&&{alwaysShowResources:s},...z&&{renderPopover:z},className:_,showHeader:R,minSelectionMinutes:Y,...M&&{showMoreMode:M},showMoreEventsInPopover:V,isLoading:S,...U&&{slots:U},...G&&{classNames:G},settingsContent:Z,filterContent:h,headerActions:g,calendarRef:te,...T&&{headerConfig:T},...D&&{eventDetailMode:D},...L&&{renderEventDetail:L}})})})}const Vt=c.forwardRef(Ut),ce=c.forwardRef(({className:t,children:n,...s},r)=>e.jsx("select",{ref:r,className:f.cn("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm","ring-offset-background","focus:outline-none focus:ring-1 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50","[&>option]:bg-background",t),...s,children:n}));ce.displayName="Select";const le=c.forwardRef(({className:t,...n},s)=>e.jsx("label",{ref:s,className:f.cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...n}));le.displayName="Label";function Yt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function Kt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}const qt=[{value:15,label:"15 minutes"},{value:30,label:"30 minutes"},{value:60,label:"1 hour"}];function Gt({value:t,onChange:n,isLocked:s=!1,className:r,labels:o={}}){const i={title:"Slot duration",lockedMessage:"This setting is locked by the administrator",infoMessage:"Set the time slot duration for day and week calendar views.",...o},v=x=>{s||n(Number(x.target.value))};return e.jsxs("div",{className:f.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(Kt,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(Yt,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx(ce,{value:t.toString(),onChange:v,disabled:s,className:"h-9 w-[128px] text-sm",children:qt.map(x=>e.jsx("option",{value:x.value.toString(),children:x.label},x.value))})]})}function Jt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function Xt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}const Qt=[{value:"dot",label:"Dot indicator"},{value:"colored",label:"Full color"},{value:"mixed",label:"Mixed"}];function Zt({value:t,onChange:n,isLocked:s=!1,className:r,labels:o={}}){const i={title:"Event display",lockedMessage:"This setting is locked by the administrator",infoMessage:"Choose how events are displayed. Dot shows a small indicator, colored fills the entire event, mixed uses both.",options:{dot:"Dot indicator",colored:"Full color",mixed:"Mixed"},...o},v=l=>i.options?.[l]??l,x=l=>{s||n(l.target.value)};return e.jsxs("div",{className:f.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(Xt,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(Jt,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx(ce,{value:t,onChange:x,disabled:s,className:"h-9 w-[128px] text-sm",children:Qt.map(l=>e.jsx("option",{value:l.value,children:v(l.value)},l.value))})]})}function en({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function tn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}function nn(){return Array.from({length:25},(t,n)=>({value:n,label:`${String(n).padStart(2,"0")}:00`}))}function rn({value:t,onChange:n,isLocked:s=!1,className:r,labels:o={}}){const i={title:"Visible hours",from:"From",to:"To",lockedMessage:"This setting is locked by the administrator",infoMessage:"Set the visible hour range for day and week views. Hours outside this range will be hidden.",...o},v=nn(),x=j=>{if(s)return;const F=Number(j.target.value);F<t.endHour&&n({...t,startHour:F})},l=j=>{if(s)return;const F=Number(j.target.value);F>t.startHour&&n({...t,endHour:F})};return e.jsxs("div",{className:f.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(tn,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(en,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(le,{className:"text-xs text-muted-foreground",children:i.from}),e.jsx(ce,{value:t.startHour.toString(),onChange:x,disabled:s,className:"h-9 w-[88px] text-sm",children:v.map(j=>e.jsx("option",{value:j.value.toString(),disabled:j.value>=t.endHour,children:j.label},j.value))})]}),e.jsx("span",{className:"mt-5 text-muted-foreground",children:"—"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(le,{className:"text-xs text-muted-foreground",children:i.to}),e.jsx(ce,{value:t.endHour.toString(),onChange:l,disabled:s,className:"h-9 w-[88px] text-sm",children:v.map(j=>e.jsx("option",{value:j.value.toString(),disabled:j.value<=t.startHour,children:j.label},j.value))})]})]})]})}function sn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function on({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}function an({className:t}){return e.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}const ln=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function cn(){return Array.from({length:25},(t,n)=>({value:n,label:`${String(n).padStart(2,"0")}:00`}))}const Ve={sunday:"Sun",monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat"};function dn({dayLabel:t,config:n,onChange:s,disabled:r,hourOptions:o}){const i=()=>{r||s({...n,enabled:!n.enabled})},v=l=>{if(r)return;const j=Number(l.target.value);j<n.to&&s({...n,from:j})},x=l=>{if(r)return;const j=Number(l.target.value);j>n.from&&s({...n,to:j})};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",role:"checkbox","aria-checked":n.enabled,"aria-label":`Enable ${t}`,onClick:i,disabled:r,className:f.cn("flex size-5 shrink-0 items-center justify-center rounded border transition-colors",n.enabled?"border-primary bg-primary text-primary-foreground":"border-input bg-background",r&&"cursor-not-allowed opacity-50"),children:n.enabled&&e.jsx(an,{className:"size-3"})}),e.jsx("span",{className:f.cn("w-10 text-sm",!n.enabled&&"text-muted-foreground"),children:t}),e.jsx(ce,{value:n.from.toString(),onChange:v,disabled:r||!n.enabled,className:"h-8 w-[76px] text-xs",children:o.map(l=>e.jsx("option",{value:l.value.toString(),disabled:l.value>=n.to,children:l.label},l.value))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}),e.jsx(ce,{value:n.to.toString(),onChange:x,disabled:r||!n.enabled,className:"h-8 w-[76px] text-xs",children:o.map(l=>e.jsx("option",{value:l.value.toString(),disabled:l.value<=n.from,children:l.label},l.value))})]})}function un({value:t,onChange:n,isLocked:s=!1,className:r,labels:o={}}){const i={title:"Working hours",lockedMessage:"This setting is locked by the administrator",infoMessage:"Configure working hours for each day of the week. Non-working hours will be grayed out in day and week views.",days:Ve,...o},v=cn(),x=(l,j)=>{s||n({...t,[l]:j})};return e.jsxs("div",{className:f.cn("flex flex-col gap-3",r),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(on,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(w.TooltipProvider,{delayDuration:100,children:e.jsxs(w.Tooltip,{children:[e.jsx(w.TooltipTrigger,{children:e.jsx(sn,{className:"size-3 text-muted-foreground"})}),e.jsx(w.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx("div",{className:"flex flex-col gap-2",children:ln.map(l=>e.jsx(dn,{dayLabel:i.days?.[l]??Ve[l],config:t[l],onChange:j=>x(l,j),disabled:s,hourOptions:v},l))})]})}const xn={sunday:{enabled:!1,from:8,to:18},monday:{enabled:!0,from:8,to:18},tuesday:{enabled:!0,from:8,to:18},wednesday:{enabled:!0,from:8,to:18},thursday:{enabled:!0,from:8,to:18},friday:{enabled:!0,from:8,to:18},saturday:{enabled:!1,from:8,to:18}};function He({className:t}){return e.jsx("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function hn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}function mn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function Ie({checked:t,onCheckedChange:n,className:s,children:r}){return e.jsx("button",{type:"button",role:"checkbox","aria-checked":t,onClick:()=>n(!t),className:s,children:r})}function fn({src:t,alt:n,fallback:s,className:r}){const[o,i]=c.useState(!1);return!t||o?e.jsx("div",{className:f.cn("flex items-center justify-center bg-zinc-200 text-zinc-600 font-medium text-sm",r),children:s||"?"}):e.jsx("img",{src:t,alt:n||"",className:f.cn("object-cover",r),onError:()=>i(!0)})}function Ye({value:t,onChange:n,placeholder:s,className:r}){return e.jsxs("div",{className:f.cn("relative",r),children:[e.jsx(hn,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{type:"text",value:t,onChange:o=>n(o.target.value),placeholder:s,className:"h-9 w-full rounded-lg border border-border bg-white pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"})]})}function Ke(t,n,s,r=.3){if(!n.trim())return t;const o=n.toLowerCase();return t.filter(i=>s(i).some(x=>x?x.toLowerCase().includes(o):!1))}const gn={title:"Filters",subtitle:"Filter calendar events",scheduleTypes:"Event Types",participants:"Participants",clearAll:"Clear all",selectAll:"Select all",unselectAll:"Unselect all",searchScheduleTypes:"Search event types...",searchParticipants:"Search participants...",noScheduleTypes:"No event types found",noParticipants:"No participants found"};function pn({scheduleTypes:t,users:n,selectedScheduleTypeIds:s,onScheduleTypeChange:r,selectedUserIds:o,onUserChange:i,onClearAll:v,className:x,scheduleTypesLoading:l=!1,usersLoading:j=!1,labels:F,getScheduleTypeName:y}){const k={...gn,...F},[B,A]=c.useState(""),[W,O]=c.useState(""),H=c.useMemo(()=>B.trim()?Ke(t,B,h=>[h.name,y?.(h)||h.name]):t,[t,B,y]),C=c.useMemo(()=>W.trim()?Ke(n,W,h=>[h.name,h.email||""]):n,[n,W]),_=H.length>0&&H.every(h=>s.includes(h.id)),R=C.length>0&&C.every(h=>o.includes(h.id)),Y=s.length+o.length,M=(h,g)=>{const m=g?[...s,h]:s.filter(T=>T!==h);r(m)},V=()=>{if(_){const h=new Set(H.map(g=>g.id));r(s.filter(g=>!h.has(g)))}else{const h=new Set([...s,...H.map(g=>g.id)]);r(Array.from(h))}},S=(h,g)=>{const m=g?[...o,h]:o.filter(T=>T!==h);i(m)},z=()=>{if(R){const h=new Set(C.map(g=>g.id));i(o.filter(g=>!h.has(g)))}else{const h=new Set([...o,...C.map(g=>g.id)]);i(Array.from(h))}},U=()=>{r([]),i([]),v?.()},G=h=>y?y(h):h.name,Z=h=>h.colorHex||h.color||"#069AD7";return e.jsxs("div",{className:f.cn("flex min-w-72 max-w-72 flex-col rounded-lg border bg-white shadow-sm",x),children:[e.jsxs("header",{className:"flex items-start justify-between gap-2 px-4 pb-2 pt-4",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:k.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:k.subtitle})]}),Y>0&&e.jsxs("button",{type:"button",onClick:U,className:"flex h-auto items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/10",children:[e.jsx(mn,{className:"h-3.5 w-3.5"}),k.clearAll]})]}),e.jsx("div",{className:"h-px w-full bg-border/60"}),e.jsxs("section",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:k.scheduleTypes}),e.jsx("button",{type:"button",onClick:V,className:"text-xs font-medium text-primary transition-colors hover:text-primary/80",children:_?k.unselectAll:k.selectAll})]}),t.length>6&&e.jsx("div",{className:"px-4 pb-3",children:e.jsx(Ye,{value:B,onChange:A,placeholder:k.searchScheduleTypes})}),e.jsxs("div",{className:"flex max-h-[220px] flex-col gap-2 overflow-y-auto px-4 pb-2 scrollbar-thin",children:[l?Array.from({length:4}).map((h,g)=>e.jsxs("div",{className:"flex animate-pulse items-center gap-2 rounded-md border border-border/60 bg-muted/40 p-2",children:[e.jsx("div",{className:"h-5 w-5 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-3 w-24 rounded bg-muted-foreground/20"})]},`skeleton-${g}`)):H.map(h=>{const g=s.includes(h.id),m=Z(h);return e.jsxs(Ie,{checked:g,onCheckedChange:T=>M(h.id,T),className:f.cn("relative flex w-full cursor-pointer items-center justify-between gap-3 rounded-md border border-border bg-white px-3 py-2 transition-colors hover:border-primary/50",g&&"border-primary bg-primary/5"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:f.cn("flex h-4 w-4 items-center justify-center rounded border border-border text-xs transition-colors",g&&"border-primary bg-primary text-primary-foreground"),children:g&&e.jsx(He,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:G(h)})]}),e.jsx("div",{className:"h-4 w-4 rounded-full border",style:{backgroundColor:m,borderColor:m}})]},h.id)}),!l&&H.length===0&&e.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:k.noScheduleTypes})]})]}),e.jsx("div",{className:"h-px w-full bg-border/60"}),e.jsxs("section",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground",children:k.participants}),e.jsx(Ie,{checked:R,onCheckedChange:()=>z(),className:f.cn("flex h-5 w-5 items-center justify-center rounded border border-border bg-white transition-colors hover:border-primary/50",R&&"border-primary bg-primary text-primary-foreground"),children:R&&e.jsx(He,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx(Ye,{value:W,onChange:O,placeholder:k.searchParticipants})}),e.jsxs("div",{className:"flex max-h-[400px] flex-col gap-2 overflow-y-auto px-4 pb-4 scrollbar-thin",children:[j?Array.from({length:4}).map((h,g)=>e.jsxs("div",{className:"flex animate-pulse items-center gap-3 rounded-md border border-border/60 bg-muted/40 p-3",children:[e.jsx("div",{className:"h-5 w-5 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted-foreground/20"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-3 w-24 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-2 w-32 rounded bg-muted-foreground/10"})]})]},`p-skeleton-${g}`)):C.map(h=>{const g=o.includes(h.id);return e.jsxs(Ie,{checked:g,onCheckedChange:m=>S(h.id,m),className:f.cn("relative flex w-full cursor-pointer items-start gap-2 rounded-lg border border-border bg-white p-2 transition-colors hover:border-primary/50",g&&"border-primary bg-zinc-50"),children:[e.jsx("span",{className:f.cn("flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border border-border transition-colors",g&&"border-primary bg-primary text-primary-foreground"),children:g&&e.jsx(He,{className:"h-2.5 w-2.5"})}),e.jsxs("div",{className:"flex flex-1 items-start gap-2",children:[e.jsx(fn,{src:h.avatar??null,alt:h.name,fallback:h.name?.[0]?.toUpperCase()??"?",className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"flex max-w-[140px] flex-col gap-0.5 overflow-hidden",children:[e.jsx("span",{className:"line-clamp-1 text-sm font-medium text-foreground",children:h.name}),e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:h.email,children:h.email})]})]})]},h.id)}),!j&&C.length===0&&e.jsx("p",{className:"px-4 text-xs text-muted-foreground",children:k.noParticipants})]})]})]})}function vn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}),e.jsx("circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"})]})}function jn({scheduleTypes:t,value:n,onChange:s,allLabel:r="All types",className:o,label:i}){const v=l=>{s(l.target.value)},x=t.find(l=>String(l.id)===n);return e.jsxs("div",{className:f.cn("flex flex-col gap-1",o),children:[i&&e.jsx(le,{className:"text-xs text-muted-foreground",children:i}),e.jsxs("div",{className:"relative",children:[x?e.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 size-3 -translate-y-1/2 rounded-full",style:{backgroundColor:x.color}}):e.jsx(vn,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(ce,{value:n,onChange:v,className:"h-9 w-full min-w-[140px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:r}),t.map(l=>e.jsx("option",{value:String(l.id),children:l.label},l.id))]})]})]})}function wn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"9",cy:"7",r:"4"}),e.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),e.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})}function bn({users:t,value:n,onChange:s,allLabel:r="All users",className:o,label:i}){const v=x=>{s(x.target.value)};return e.jsxs("div",{className:f.cn("flex flex-col gap-1",o),children:[i&&e.jsx(le,{className:"text-xs text-muted-foreground",children:i}),e.jsxs("div",{className:"relative",children:[e.jsx(wn,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(ce,{value:n,onChange:v,className:"h-9 w-full min-w-[120px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:r}),t.map(x=>e.jsx("option",{value:x.id,children:x.name},x.id))]})]})]})}function yn({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("path",{d:"M3 10h18"}),e.jsx("path",{d:"M8 14h.01"}),e.jsx("path",{d:"M12 14h.01"}),e.jsx("path",{d:"M16 14h.01"}),e.jsx("path",{d:"M8 18h.01"}),e.jsx("path",{d:"M12 18h.01"}),e.jsx("path",{d:"M16 18h.01"})]})}function kn({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M3 10h5"}),e.jsx("path",{d:"M17.5 17.5 16 16.3V14"}),e.jsx("circle",{cx:"16",cy:"16",r:"6"})]})}function Nn({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function Cn({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M15 3h6v6"}),e.jsx("path",{d:"M10 14 21 3"}),e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function Dn(t){const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${r}`}function qe(t){const n=t.getHours(),s=t.getMinutes(),r=n>=12?"PM":"AM",o=n%12||12,i=String(s).padStart(2,"0");return`${o}:${i} ${r}`}function Mn(t){const n=qe(t.startDate),s=qe(t.endDate);return`${n} - ${s}`}function Tn(t){const n=q.addDays(new Date,1);return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function En(t){if(q.isToday(t))return"Today";if(Tn(t))return"Tomorrow";const n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=n[t.getDay()],o=s[t.getMonth()],i=t.getDate();return`${r}, ${o} ${i}`}function Sn(t,n){const s=new Map;for(const r of t){const o=Dn(r.startDate),i=s.get(o)??[];i.push(r),s.set(o,i)}return Array.from(s.entries()).map(([r,o])=>{const i=[...o].sort((x,l)=>x.startDate.getTime()-l.startDate.getTime()),v=n>0?i.slice(0,n):i;return{date:new Date(r),dateKey:r,events:v,hasMore:n>0&&i.length>n}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function Ln(t){const n=q.startOfDay(new Date),s=q.endOfDay(new Date);return t.filter(r=>r.startDate>=n&&r.startDate<=s).length}function ze({className:t}){return e.jsx("div",{className:f.cn("animate-pulse rounded-md bg-muted",t)})}function Hn({event:t,onClick:n}){return e.jsxs("button",{type:"button",onClick:()=>n?.(t),className:f.cn("w-full text-left rounded-lg transition-colors","hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","flex items-start gap-3 p-2"),children:[e.jsx("div",{className:"shrink-0 rounded-full mt-1.5 size-2",style:{backgroundColor:t.color??"#3b82f6"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.title}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Mn(t)})]}),n&&e.jsx(Nn,{className:"shrink-0 size-4 text-muted-foreground/50 mt-1"})]})}function In({group:t,onEventClick:n}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5",children:[e.jsx("h3",{className:f.cn("text-xs font-semibold",q.isToday(t.date)&&"text-primary"),children:En(t.date)}),t.hasMore&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["+",t.events.length," more"]})]}),e.jsx("div",{className:"space-y-0.5",children:t.events.map(s=>e.jsx(Hn,{event:s,onClick:n},s.id))})]})}function zn({events:t,isLoading:n=!1,className:s,daysAhead:r=7,maxEventsPerDay:o=3,onEventClick:i,onNavigateToAgenda:v}){const[x,l]=c.useState(!1),j=c.useMemo(()=>{const A=q.startOfDay(new Date),W=q.addDays(A,r);return t.filter(O=>O.endDate>=A&&O.startDate<W)},[t,r]),F=c.useMemo(()=>Sn(j,o),[j,o]),y=c.useMemo(()=>Ln(t),[t]),k=A=>{l(!1),i?.(A)},B=()=>{l(!1),v?.()};return e.jsxs(w.Popover,{open:x,onOpenChange:l,children:[e.jsxs(w.PopoverTrigger,{className:f.cn("relative rounded-xl hover:text-zinc-700 hover:!bg-zinc-300 !bg-zinc-200 text-zinc-600 shadow-none !px-2.5 p-2 max-h-10",s),children:[e.jsx(yn,{className:"h-4 w-4"}),y>0&&e.jsx(w.Badge,{variant:"destructive",className:"absolute -right-4 -top-4 m-3 flex h-5 w-5 items-center justify-center rounded-full bg-primary p-0 text-[10px] font-medium hover:bg-primary",children:y>99?"99+":y})]}),e.jsxs(w.PopoverContent,{className:"w-80 rounded-xl p-0",align:"end",side:"bottom",sideOffset:8,children:[e.jsxs("div",{className:"flex items-center justify-between border-b p-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Upcoming"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:y>0?`${y} event${y>1?"s":""} today`:"No events today"})]}),v&&e.jsxs("button",{type:"button",onClick:B,className:"text-xs text-primary hover:underline flex items-center gap-1",children:["View all",e.jsx(Cn,{className:"size-3"})]})]}),e.jsx("div",{className:"max-h-80 overflow-y-auto p-2",children:n?e.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:3}).map((A,W)=>e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(ze,{className:"h-2 w-2 rounded-full mt-2"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(ze,{className:"h-4 w-full"}),e.jsx(ze,{className:"h-3 w-3/4"})]})]},W))}):F.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(kn,{className:"mb-2 h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming events"}),e.jsxs("p",{className:"text-xs text-muted-foreground/70",children:["Your schedule is clear for the next ",r," days"]})]}):e.jsx("div",{className:"space-y-3 divide-y",children:F.map(A=>e.jsx(In,{group:A,onEventClick:k},A.dateKey))})})]})]})}function Pn({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("path",{d:"M8 2v4"}),e.jsx("path",{d:"M3 10h5"}),e.jsx("path",{d:"M17.5 17.5 16 16.25V14"}),e.jsx("circle",{cx:"16",cy:"16",r:"6"})]})}function Qe({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function An(t){const n=new Date;return n.setDate(n.getDate()+1),t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Ge(t){const n=t.getHours(),s=t.getMinutes(),r=n>=12?"PM":"AM";return`${n%12||12}:${s.toString().padStart(2,"0")} ${r}`}function Fn(t){return new Intl.DateTimeFormat("en-US",{weekday:"long",month:"short",day:"numeric"}).format(t)}function Wn(t){const n=Ge(t.startDate),s=Ge(t.endDate);return`${n} - ${s}`}function On(t){return q.isToday(t)?"Today":An(t)?"Tomorrow":Fn(t)}function _n(t,n){const s=new Map;for(const r of t){const o=q.formatDateISO(r.startDate),i=s.get(o)??[];i.push(r),s.set(o,i)}return Array.from(s.entries()).map(([r,o])=>{const i=[...o].sort((x,l)=>x.startDate.getTime()-l.startDate.getTime()),v=n>0?i.slice(0,n):i;return{date:new Date(r),dateKey:r,events:v,hasMore:n>0&&i.length>n}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function $n({event:t,onClick:n,compact:s}){return e.jsxs("button",{type:"button",onClick:()=>n?.(t),className:f.cn("w-full text-left rounded-lg transition-colors","hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","flex items-start gap-3",s?"p-2":"p-3"),children:[e.jsx("div",{className:f.cn("shrink-0 rounded-full mt-1",s?"size-2":"size-2.5"),style:{backgroundColor:t.color??"#3b82f6"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:f.cn("font-medium truncate",s?"text-xs":"text-sm"),children:t.title}),e.jsx("p",{className:f.cn("text-muted-foreground truncate",s?"text-[10px]":"text-xs"),children:Wn(t)})]}),n&&e.jsx(Qe,{className:f.cn("shrink-0 text-muted-foreground/50",s?"size-3":"size-4")})]})}function Bn({group:t,onEventClick:n,onViewMore:s,compact:r}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:f.cn("flex items-center justify-between px-2",r?"py-1":"py-1.5"),children:[e.jsx("h3",{className:f.cn("font-semibold",r?"text-xs":"text-sm",q.isToday(t.date)&&"text-primary"),children:On(t.date)}),t.hasMore&&s&&e.jsx("button",{type:"button",onClick:()=>s(t.date),className:f.cn("text-primary hover:underline",r?"text-[10px]":"text-xs"),children:"+more"})]}),e.jsx("div",{className:"space-y-0.5",children:t.events.map(o=>e.jsx($n,{event:o,onClick:n,compact:r},o.id))})]})}function Rn({events:t,daysAhead:n=7,maxEventsPerDay:s=3,onEventClick:r,onViewAll:o,className:i,emptyState:v,title:x="Upcoming",showHeader:l=!0,compact:j=!1}){const F=De.useOptionalCalendarContext(),y=F?.filteredEvents,k=F?.currentDate??new Date,B=t??y??[],A=c.useMemo(()=>{const H=q.startOfDay(k),C=new Date(H);return C.setDate(C.getDate()+n),B.filter(_=>_.endDate>=H&&_.startDate<C)},[B,n,k]),W=c.useMemo(()=>_n(A,s),[A,s]),O=A.length;return W.length===0?e.jsxs("div",{className:f.cn("rounded-lg border bg-card",i),children:[l&&e.jsx("div",{className:f.cn("border-b px-4 flex items-center justify-between",j?"py-2":"py-3"),children:e.jsx("h2",{className:f.cn("font-semibold",j?"text-sm":"text-base"),children:x})}),e.jsx("div",{className:f.cn("flex flex-col items-center justify-center text-center",j?"py-6 px-4":"py-10 px-6"),children:v??e.jsxs(e.Fragment,{children:[e.jsx(Pn,{className:f.cn("text-muted-foreground/50 mb-2",j?"size-8":"size-10")}),e.jsx("p",{className:f.cn("text-muted-foreground",j?"text-xs":"text-sm"),children:"No upcoming events"})]})})]}):e.jsxs("div",{className:f.cn("rounded-lg border bg-card overflow-hidden",i),children:[l&&e.jsxs("div",{className:f.cn("border-b px-4 flex items-center justify-between",j?"py-2":"py-3"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:f.cn("font-semibold",j?"text-sm":"text-base"),children:x}),e.jsx("span",{className:f.cn("text-muted-foreground bg-muted rounded-full px-2",j?"text-[10px] py-0":"text-xs py-0.5"),children:O})]}),o&&e.jsxs("button",{type:"button",onClick:()=>o(),className:f.cn("text-primary hover:underline flex items-center gap-0.5",j?"text-xs":"text-sm"),children:["View all",e.jsx(Qe,{className:"size-3"})]})]}),e.jsx("div",{className:f.cn("divide-y overflow-auto",j?"p-2 max-h-[280px]":"p-3 max-h-[400px]"),children:W.map(H=>e.jsx(Bn,{group:H,onEventClick:r,onViewMore:o?C=>o(C):void 0,compact:j},H.dateKey))})]})}exports.AgendaDropdown=zn;exports.AgendaWidget=Rn;exports.BadgeVariantSetting=Zt;exports.Calendar=nt;exports.CalendarFilterSidebar=pn;exports.DEFAULT_WEEK_WORKING_HOURS=xn;exports.EventPopover=jt;exports.InnoCalendar=Vt;exports.ScheduleTypeFilter=jn;exports.SlotDurationSetting=Gt;exports.TimelineView=pe;exports.UserFilter=bn;exports.VisibleHoursSetting=rn;exports.WorkingHoursSetting=un;exports.YearView=Xe;
|
|
2
|
+
//# sourceMappingURL=agenda-widget-DyPlCQHM.cjs.map
|