@innosolutions/inno-calendar 1.0.70 → 1.0.72

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.
Files changed (60) hide show
  1. package/LICENSE +48 -0
  2. package/dist/{agenda-widget-GRHaHwQ2.js → agenda-widget-B0t3TCcV.js} +1158 -1141
  3. package/dist/agenda-widget-B0t3TCcV.js.map +1 -0
  4. package/dist/agenda-widget-i2tjGr5U.cjs +2 -0
  5. package/dist/agenda-widget-i2tjGr5U.cjs.map +1 -0
  6. package/dist/components/index.cjs +1 -1
  7. package/dist/components/index.mjs +2 -2
  8. package/dist/components/inno-calendar.d.ts +23 -1
  9. package/dist/components/inno-calendar.d.ts.map +1 -1
  10. package/dist/components/views/timeline-view.d.ts.map +1 -1
  11. package/dist/core/context/inno-calendar-provider.d.ts +8 -2
  12. package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
  13. package/dist/core/index.cjs +1 -1
  14. package/dist/core/index.d.ts +1 -1
  15. package/dist/core/index.d.ts.map +1 -1
  16. package/dist/core/index.mjs +4 -4
  17. package/dist/core/types.d.ts +51 -0
  18. package/dist/core/types.d.ts.map +1 -1
  19. package/dist/core/utils/view-storage.d.ts +14 -10
  20. package/dist/core/utils/view-storage.d.ts.map +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.mjs +7 -7
  23. package/dist/position-utils-D_KpwRus.js +1053 -0
  24. package/dist/position-utils-D_KpwRus.js.map +1 -0
  25. package/dist/position-utils-ksZ_IjXC.cjs +2 -0
  26. package/dist/position-utils-ksZ_IjXC.cjs.map +1 -0
  27. package/dist/presets/index.cjs +1 -1
  28. package/dist/presets/index.mjs +1 -1
  29. package/dist/slot-selection-context-CLYZU6ul.cjs +2 -0
  30. package/dist/{slot-selection-context-DvTn_R-Z.cjs.map → slot-selection-context-CLYZU6ul.cjs.map} +1 -1
  31. package/dist/slot-selection-context-Ct5cVcKW.js +611 -0
  32. package/dist/{slot-selection-context-D6zo91K_.js.map → slot-selection-context-Ct5cVcKW.js.map} +1 -1
  33. package/dist/{tailwind-calendar-BA7v_Wgx.cjs → tailwind-calendar-BbUb61uY.cjs} +2 -2
  34. package/dist/{tailwind-calendar-BA7v_Wgx.cjs.map → tailwind-calendar-BbUb61uY.cjs.map} +1 -1
  35. package/dist/{tailwind-calendar-Bh1yB1jf.js → tailwind-calendar-DrwGVSF-.js} +3 -3
  36. package/dist/{tailwind-calendar-Bh1yB1jf.js.map → tailwind-calendar-DrwGVSF-.js.map} +1 -1
  37. package/dist/{use-calendar-BwqE_WNA.cjs → use-calendar-BK0nQYJq.cjs} +2 -2
  38. package/dist/{use-calendar-BwqE_WNA.cjs.map → use-calendar-BK0nQYJq.cjs.map} +1 -1
  39. package/dist/{use-calendar--JnbGA3L.js → use-calendar-DJI35SSd.js} +2 -2
  40. package/dist/{use-calendar--JnbGA3L.js.map → use-calendar-DJI35SSd.js.map} +1 -1
  41. package/dist/{use-slot-selection-C1tk-o0j.cjs → use-slot-selection-CCE11R4j.cjs} +2 -2
  42. package/dist/{use-slot-selection-C1tk-o0j.cjs.map → use-slot-selection-CCE11R4j.cjs.map} +1 -1
  43. package/dist/{use-slot-selection-BLCDzQzo.js → use-slot-selection-CX1w8EdM.js} +3 -3
  44. package/dist/{use-slot-selection-BLCDzQzo.js.map → use-slot-selection-CX1w8EdM.js.map} +1 -1
  45. package/dist/utils.cjs +1 -1
  46. package/dist/utils.mjs +1 -1
  47. package/dist/{week-view-D1wefMb8.cjs → week-view-BXmaRChB.cjs} +2 -2
  48. package/dist/{week-view-D1wefMb8.cjs.map → week-view-BXmaRChB.cjs.map} +1 -1
  49. package/dist/{week-view-BbtTpJTU.js → week-view-BeasFcyR.js} +3 -3
  50. package/dist/{week-view-BbtTpJTU.js.map → week-view-BeasFcyR.js.map} +1 -1
  51. package/package.json +1 -1
  52. package/dist/agenda-widget-GRHaHwQ2.js.map +0 -1
  53. package/dist/agenda-widget-TLJuxen3.cjs +0 -2
  54. package/dist/agenda-widget-TLJuxen3.cjs.map +0 -1
  55. package/dist/position-utils-BzmOPdvQ.js +0 -1038
  56. package/dist/position-utils-BzmOPdvQ.js.map +0 -1
  57. package/dist/position-utils-EQTCC4tZ.cjs +0 -2
  58. package/dist/position-utils-EQTCC4tZ.cjs.map +0 -1
  59. package/dist/slot-selection-context-D6zo91K_.js +0 -610
  60. package/dist/slot-selection-context-DvTn_R-Z.cjs +0 -2
@@ -0,0 +1,2 @@
1
+ "use strict";const e=require("react/jsx-runtime"),De=require("./use-calendar-BK0nQYJq.cjs"),c=require("react"),f=require("./index-D2U2F80P.cjs"),b=require("./week-view-BXmaRChB.cjs"),be=require("./slot-selection-context-CLYZU6ul.cjs"),X=require("./position-utils-ksZ_IjXC.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:g,preferences:d,locale:l,slots:p,renderEvent:S,onViewChange:w,onDateChange:j,onEventClick:I,onSlotSelect:E,onFiltersChange:H,className:O,children:$}=t,z=De.useOptionalCalendarContext();if(z)return e.jsx("div",{className:O,style:{position:"relative"},children:$??e.jsx(Pe,{view:z.view,className:O})});const L=De.useCalendar({events:n,resources:s,scheduleTypes:r,initialView:o,initialDate:i,initialFilters:g,preferences:d,locale:l,onViewChange:w,onDateChange:j,onEventClick:I,onSlotSelect:E,onFiltersChange:H});return e.jsx(De.CalendarProvider,{value:L,children:e.jsx("div",{className:O,style:{position:"relative"},children:$??e.jsx(Pe,{view:L.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 Xe({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 je({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."},we=c.forwardRef(({onClick:t,label:n,children:s,className:r,variant:o="ghost",...i},g)=>e.jsxs(b.Tooltip,{children:[e.jsx(b.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button",ref:g,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(b.TooltipContent,{side:"bottom",className:"text-xs",children:n})]}));we.displayName="IconButton";function xt({src:t,alt:n,initials:s,className:r,isClient:o}){const[i,g]=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:()=>g(!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(j=>j[0]).join("").toUpperCase().slice(0,2),i=t.isOrganizer??!1,g=t.isConfirmed,d=g===!0,l=g===!1,p=t.isClient??!1,S=t.profilePicture||t.avatar,w=n;return e.jsxs("div",{className:f.cn("flex items-center gap-3 py-0",w&&"opacity-60"),children:[e.jsxs("div",{className:"relative",children:[e.jsx(xt,{src:S,alt:r,initials:o,isClient:p,className:f.cn(w&&"grayscale")}),w||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]"})})}):d?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(je,{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",w&&"line-through text-zinc-500 dark:text-zinc-500"),children:r})}),p&&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&&!w&&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:g,isLoading:d}){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(b.Button,{variant:"outline",size:"sm",onClick:()=>n(!1),children:o}),e.jsxs(b.Button,{variant:"destructive",size:"sm",onClick:g,disabled:d,children:[d&&e.jsx(ge,{className:"h-4 w-4 mr-2"}),e.jsx(Xe,{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:g,onAccept:d,onDecline:l,onConfirmMeeting:p,canEdit:S=!0,canDelete:w=!1,canCancel:j=!0,isCurrentUserParticipant:I=!1,isCurrentUserClient:E=!1,currentUserAcceptStatus:H,isAcceptLoading:O=!1,isDeclineLoading:$=!1,isConfirmLoading:z=!1,isDeleteLoading:L=!1,renderParticipant:W,renderHeaderActions:P,renderCancelReason:Q,renderDeleteConfirmation:M,formatDate:_=ft,formatTimeRange:A=gt}){const[Y,q]=c.useState(!1),J=!(t.isCanceled||t.meetingTookPlace),v=t.isRecurring??!1,D=t.participantDetails,x=t.participantsNames||[],N=D&&D.length>0,y=H===!0,V=H===!1,R=I&&!E&&J,K=N?D.filter(G=>G.isConfirmed).length:t.isAccepted?x.length:0,B=N?D.length:x.length,oe=t.scheduleTypeColor||t.hexColor||"#039BE5",Z=c.useCallback(()=>t.startDate?_(t.startDate):n.noDateProvided,[t.startDate,_,n.noDateProvided]),ce=c.useCallback(()=>t.startDate&&t.endDate?A(t.startDate,t.endDate):null,[t.startDate,t.endDate,A]),me=()=>{r(),o?.(t)},ne=()=>{r(),g?.(t)},ae=()=>{q(!0)},de=()=>{i?.(t),q(!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(b.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:P?P({onClose:r}):e.jsxs(e.Fragment,{children:[J&&S&&o&&e.jsx(we,{onClick:me,label:n.edit,children:e.jsx(rt,{className:"h-[18px] w-[18px]"})}),J&&j&&g&&e.jsx(we,{onClick:ne,label:n.cancel,children:e.jsx(st,{className:"h-[18px] w-[18px]"})}),w&&i&&e.jsx(we,{onClick:ae,label:n.delete,variant:"destructive",children:e.jsx(Xe,{className:"h-[18px] w-[18px]"})}),e.jsx(we,{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:oe}}),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:Z()}),ce()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsx("span",{children:ce()})]})]}),v&&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:Q?Q(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})]}),(N||x.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:[B," ",B!==1?n.guests:n.guest]}),B>0&&e.jsxs("span",{className:"text-xs text-zinc-500",children:["(",K," ",n.confirmed,")"]})]}),e.jsxs("div",{className:"mt-2 space-y-2",children:[N?D.slice(0,6).map((G,m)=>W?W(G,m):e.jsx(Ae,{participant:G,isEventCanceled:t.isCanceled,labels:n},G.id)):x.slice(0,6).map((G,m)=>{const F={id:String(m),name:G,email:"",isConfirmed:t.isAccepted,isOrganizer:m===0,isClient:!1};return W?W(F,m):e.jsx(Ae,{participant:F,isEventCanceled:t.isCanceled,labels:n},G)}),B>6&&e.jsxs("div",{className:"text-xs text-zinc-500 py-1.5 pl-10",children:["+",B-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:N&&D.find(G=>G.isOrganizer)?.name||x[0]||"Calendar"})]})]}),R&&d&&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:[v?e.jsxs(b.DropdownMenu,{children:[e.jsx(b.DropdownMenuTrigger,{asChild:!0,children:e.jsxs("div",{className:"flex",children:[e.jsx(b.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",y&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:G=>{G.stopPropagation(),y||d(t)},disabled:O,children:O?e.jsx(ge,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[y&&e.jsx(je,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(b.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",y&&"!bg-green-700 !text-white hover:!bg-green-700"),children:e.jsx(at,{className:"h-3.5 w-3.5"})})]})}),e.jsxs(b.DropdownMenuContent,{align:"start",children:[e.jsxs(b.DropdownMenuItem,{className:f.cn("gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",y&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>d(t),children:[e.jsx(je,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptThisEvent]}),e.jsxs(b.DropdownMenuItem,{onClick:()=>d(t),children:[e.jsx(je,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptAllEvents]})]})]}):e.jsx(b.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",y&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>{y||d(t)},disabled:O,children:O?e.jsx(ge,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[y&&e.jsx(je,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(b.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",V&&"!bg-rose-700 !text-white hover:!bg-rose-700"),onClick:()=>{V||l(t)},disabled:$,children:$?e.jsx(ge,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[V&&e.jsx(Me,{className:"h-3.5 w-3.5"}),n.notGoing]})})]})}),I&&y&&!t.meetingTookPlace&&!t.isCanceled&&p&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 py-3",children:e.jsxs(b.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:()=>p(t),disabled:z,children:[z&&e.jsx(ge,{className:"h-4 w-4 mr-2"}),n.confirmMeeting]})})]}),M?Y&&M({onConfirm:de,onCancel:()=>q(!1),isLoading:L}):e.jsx(mt,{open:Y,onOpenChange:q,title:n.deleteConfirmTitle,description:n.deleteConfirmDescription,cancelLabel:n.cancel,confirmLabel:n.delete,onConfirm:de,isLoading:L})]})}function jt({event:t,children:n,open:s,onOpenChange:r,isLoading:o,labels:i,onEdit:g,onDelete:d,onCancel:l,onAccept:p,onDecline:S,onConfirmMeeting:w,canEdit:j=!0,canDelete:I=!1,canCancel:E=!0,isCurrentUserParticipant:H,isCurrentUserClient:O,currentUserAcceptStatus:$,isAcceptLoading:z,isDeclineLoading:L,isConfirmLoading:W,isDeleteLoading:P,renderParticipant:Q,renderHeaderActions:M,renderCancelReason:_,renderDeleteConfirmation:A,formatDate:Y,formatTimeRange:q,className:J,width:v=360}){const D=vt("(min-width: 768px)"),x={...ut,...i},N=c.useCallback(()=>{r?.(!1)},[r]),y={event:t,labels:x,isLoading:o,onClose:N,onEdit:g,onDelete:d,onCancel:l,onAccept:p,onDecline:S,onConfirmMeeting:w,canEdit:j,canDelete:I,canCancel:E,isCurrentUserParticipant:H,isCurrentUserClient:O,currentUserAcceptStatus:$,isAcceptLoading:z,isDeclineLoading:L,isConfirmLoading:W,isDeleteLoading:P,renderParticipant:Q,renderHeaderActions:M,renderCancelReason:_,renderDeleteConfirmation:A,formatDate:Y,formatTimeRange:q};return D?e.jsxs(b.Popover,{open:s??!1,onOpenChange:r??(()=>{}),children:[e.jsx(b.PopoverTrigger,{asChild:!0,children:n}),e.jsx(b.PopoverContent,{className:f.cn("p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",J),style:{width:v},align:"center",side:"bottom",sideOffset:4,children:e.jsx(Fe,{...y})})]}):e.jsxs(e.Fragment,{children:[n,e.jsx(ht,{open:s??!1,onOpenChange:r??(()=>{}),title:t.title,children:e.jsx(Fe,{...y})})]})}const Ee=44,We=4,wt=56,Oe=8,Ne=80,ve=140,_e=100,Re=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 g=n;g<s;g++)r.push({hour:g,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 $e(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(t,n,s,r,o){const i=t.startDate.getHours()+t.startDate.getMinutes()/60,g=t.endDate.getHours()+t.endDate.getMinutes()/60;let d=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let p=0;p<n.length;p++){const S=n[p],w=X.startOfDay(S),j=X.endOfDay(S);if(!(t.startDate<=j&&t.endDate>=w))continue;let I=t.startDate>=w?Math.max(s,i):s,E=t.endDate<=j?Math.min(r,g):r;if(I=Math.max(s,Math.min(r,I)),E=Math.max(s,Math.min(r,E)),E>I){const H=p*o+(I-s),O=p*o+(E-s);d=Math.min(d,H),l=Math.max(l,O)}}return l>d?{startCol:d,spanCols:l-d}:null}function Tt({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 Et=18,St=10,Lt=32;function It({text:t,className:n}){const s=c.useRef(null),r=c.useRef(null),[o,i]=c.useState({active:!1,durationSec:0});return c.useLayoutEffect(()=>{const g=s.current,d=r.current;if(!g||!d)return;const l=()=>{const S=d.offsetWidth,w=g.clientWidth;if(S>w+1){const j=S+Lt,I=Math.max(St,j/Et);i(E=>E.active&&Math.abs(E.durationSec-I)<.1?E:{active:!0,durationSec:I})}else i(j=>j.active?{active:!1,durationSec:0}:j)};l();const p=new ResizeObserver(l);return p.observe(g),p.observe(d),()=>p.disconnect()},[t]),e.jsx("div",{ref:s,className:f.cn("ic-marquee relative min-w-0 overflow-hidden",o.active&&"ic-marquee--active",n),children:e.jsxs("div",{className:"ic-marquee-track inline-flex whitespace-nowrap will-change-transform",style:o.active?{animationDuration:`${o.durationSec}s`}:void 0,children:[e.jsx("span",{ref:r,className:"ic-marquee-copy",children:t}),o.active&&e.jsx("span",{"aria-hidden":"true",className:"ic-marquee-copy",children:t})]})})}const zt=7;function pe({daysToShow:t=zt,events:n,users:s=[],alwaysShowResources:r,selectedDate:o,onDateChange:i,onEventClick:g,onSlotClick:d,onSlotSelect:l,visibleHours:p,className:S,getEventUserId:w,renderPopover:j,slots:I,classNames:E,enableDrag:H=!0,resourceColumnConfig:O}){const $=O?.variant??"marquee",z=O?.showAvatar??"auto",L=c.useRef(null),W=be.useOptionalDragDrop(),[P,Q]=c.useState(null),M=c.useRef(!1),[_,A]=c.useState(null),Y=o??new Date,q=!0,J=p?.from??bt,v=p?.to??yt,D=v-J,x=c.useMemo(()=>{const a=new Date(Y);if(t===1||t===3)return a.setHours(0,0,0,0),a;const u=a.getDay(),h=u===0?-6:1-u;return a.setDate(a.getDate()+h),a.setHours(0,0,0,0),a},[Y,t]),N=c.useMemo(()=>Nt(x,t),[x,t]),y=c.useMemo(()=>Ct(N,J,v),[q,N,J,v]),R=w??(a=>{if(a.resourceId)return a.resourceId;const u=a.data;if(u?.userId)return String(u.userId);if(u?.user&&typeof u.user=="object"&&u.user.id)return String(u.user.id);if(a.user?.id)return a.user.id;if(a.participants?.[0]?.id)return a.participants[0].id}),K=c.useMemo(()=>{const a=new Map;for(const u of s)a.set(u.id,{id:u.id,name:u.name,avatar:u.avatar??void 0,email:u.email});for(const u of n){const k=u.data?.user;k?.id&&!a.has(k.id)&&a.set(k.id,{id:k.id,name:k.name??"",avatar:k.avatar??void 0,email:k.email}),u.user?.id&&!a.has(u.user.id)&&a.set(u.user.id,{id:u.user.id,name:u.user.name,avatar:u.user.avatar??void 0,email:u.user.email});for(const C of u.participants||[])C.id&&!a.has(C.id)&&a.set(C.id,{id:C.id,name:C.name,avatar:C.avatar??void 0,email:C.email})}return Array.from(a.values())},[s,n]),B=c.useMemo(()=>{const a=[],u=new Map;for(const C of K)u.set(C.id,[]);u.set("unassigned",[]);for(const C of n){const T=R(C)??"unassigned";(u.get(T)??u.get("unassigned")).push(C)}const h=C=>{const T=[];for(const U of C){const te=Mt(U,N,J,v,D);te&&T.push({event:U,...te})}return T};for(const C of K){const T=u.get(C.id)??[],U=h(T),te=$e(U),re=te.reduce((se,ie)=>Math.max(se,ie.stackIndex+1),0);a.push({user:C,events:te,maxStack:Math.max(re,1)})}const k=u.get("unassigned")??[];if(k.length>0){const C=h(k),T=$e(C),U=T.reduce((te,re)=>Math.max(te,re.stackIndex+1),0);a.push({user:{id:"unassigned",name:"Unassigned",avatar:void 0,email:void 0},events:T,maxStack:Math.max(U,1)})}if(r?.length){const C=new Set(a.map(T=>T.user.id));for(const T of r)C.has(T.id)||(a.push({user:{id:T.id,name:T.name,avatar:T.avatar??void 0,email:T.email},events:[],maxStack:1}),C.add(T.id))}return a},[K,n,N,q,D,J,v,R,r]),oe=c.useMemo(()=>{const a=new Map;for(const u of B)for(const h of u.events)if(h.spanCols<=1){const k=Math.floor(h.startCol),C=a.get(k)??0;a.set(k,C+1)}return a},[B]),Z=c.useMemo(()=>{const a=y.length,u=Ne,h=[];for(let k=0;k<a;k++){const C=oe.get(k)??0;C>Re?h.push(_e+(C-Re)*20):C>0?h.push(Math.max(u,_e)):h.push(u)}return h},[q,y.length,N.length,oe]),ce=a=>Math.max(wt,a*(Ee+We)+Oe*2),me=ve+Z.reduce((a,u)=>a+u,0),ne=c.useMemo(()=>{const a=[0];for(let u=0;u<Z.length;u++)a.push(a[u]+Z[u]);return a},[Z]),ae=c.useCallback(a=>{const u=ne.length-1;if(a<=0)return ne[0]??0;if(a>=u)return ne[u]??0;const h=Math.floor(a),k=ne[h]??0,C=ne[h+1]??k;return k+(a-h)*(C-k)},[ne]);c.useLayoutEffect(()=>{const a=L.current;if(!a)return;const u=()=>{let h=-1;const C=new Date().getHours();{for(let T=0;T<y.length;T++){const U=y[T];if(U&&X.isToday(U.date)&&U.hour<=C&&U.hour+1>C){h=T;break}}if(h===-1)for(let T=0;T<y.length;T++){const U=y[T];if(U&&X.isToday(U.date)){h=T;break}}}if(h!==-1){const T=(ne[h]??0)+ve,U=a.clientWidth,te=Math.max(0,T-U/3);a.scrollTo({left:te,behavior:"instant"})}};requestAnimationFrame(()=>{requestAnimationFrame(u)})},[Y,y,N,ne,q]);const de=c.useCallback((a,u)=>{const h=u.getBoundingClientRect(),k=a-h.left+u.scrollLeft;for(let C=0;C<ne.length-1;C++){const T=ne[C],U=ne[C+1];if(k>=T&&k<U){const te=(k-T)/(U-T),re=Math.floor(te*60),se=Math.round(re/15)*15;return{colIndex:C,minute:Math.min(se,45)}}}return null},[ne]),G=c.useCallback((a,u)=>{if(y[a]){const h=y[a],k=new Date(h.date);return k.setHours(h.hour,u??0,0,0),{date:k,hour:h.hour}}return{date:new Date}},[q,y,N]),m=c.useCallback((a,u)=>{if(a.preventDefault(),a.dataTransfer.dropEffect="move",!W?.isDragging||!W.dragState)return;const h=a.currentTarget,k=de(a.clientX,h);if(!k)return;const{colIndex:C,minute:T}=k,{date:U,hour:te}=G(C,T);W.updateDragPreview(U,te,T,u);const{originalStartDate:re,originalEndDate:se}=W.dragState,ie=se.getTime()-re.getTime(),fe=y.length;let he;{const ke=ie/36e5;he=Math.max(1,Math.ceil(ke))}he=Math.min(he,fe-C),A({resourceId:u,colIndex:C,spanCols:he})},[W,de,G,q,y.length,N.length]),F=c.useCallback(a=>{const u=a.relatedTarget;a.currentTarget.contains(u)||A(null)},[]),ee=c.useCallback((a,u)=>{a.preventDefault(),A(null),W?.isDragging&&W.endDrag()},[W]),le=c.useCallback((a,u)=>{if(!P||P.resourceId!==a)return!1;const h=Math.min(P.startCol,P.endCol),k=Math.max(P.startCol,P.endCol);return u>=h&&u<=k},[P]),ye=c.useCallback((a,u)=>!_||_.resourceId!==a?!1:u>=_.colIndex&&u<_.colIndex+_.spanCols,[_]),Ze=c.useCallback((a,u,h)=>{h.button!==0&&h.pointerType==="mouse"||(l||d)&&(h.preventDefault(),M.current=!0,Q({resourceId:a,startCol:u,endCol:u,isSelecting:!0}))},[l,d]),et=c.useCallback((a,u,h)=>{if(M.current&&!(!P||P.resourceId!==a)){if(h.buttons===0){M.current=!1;return}Q(k=>k?{...k,endCol:u}:null)}},[P]),Te=c.useCallback(()=>{if(!M.current||!P)return;M.current=!1;const a=Math.min(P.startCol,P.endCol),u=Math.max(P.startCol,P.endCol),h=G(a),k=G(u),C=new Date(h.date),T=new Date(k.date);k.hour!==void 0&&T.setHours(k.hour+1,0,0,0);const U={startDate:C,endDate:T,resourceId:P.resourceId};a===u&&d&&d(h.date,h.hour,P.resourceId),l?.(U),Q(te=>te?{...te,isSelecting:!1}:null),setTimeout(()=>Q(null),150)},[P,G,q,d,l]);return c.useEffect(()=>{const a=()=>{M.current&&Te()};return window.addEventListener("pointerup",a),window.addEventListener("pointercancel",a),()=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a)}},[Te]),c.useEffect(()=>{W?.isDragging||A(null)},[W?.isDragging]),e.jsx("div",{className:f.cn("flex h-full flex-col",S),children:e.jsx("div",{className:"ic-timeline-scroll-container flex-1",ref:L,children:e.jsxs("div",{className:"relative",style:{minWidth:me},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:ve},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:N.map((a,u)=>{const h=X.isToday(a),k=u*D,C=Z.slice(k,k+D).reduce((T,U)=>T+U,0);return e.jsx("div",{className:f.cn("flex shrink-0 items-center justify-center border-r py-1.5 font-medium",h?"bg-primary/10 text-primary":"bg-muted/30"),style:{width:C},children:e.jsx("span",{className:"text-xs",children:Dt(a)})},`day-${a.toISOString()}`)})}),e.jsx("div",{className:"flex",children:y.map((a,u)=>{const h=a.hour===J,k=X.isToday(a.date),C=Z[u]??Ne;return e.jsx("div",{className:f.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",h&&u>0?"border-l-2 border-l-border":"border-r border-r-border/50",k&&"bg-primary/5"),style:{width:C},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:ve},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),y.map((a,u)=>{const h=a.hour===J,k=X.isToday(a.date),C=Z[u]??Ne;return e.jsx("div",{className:f.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",h&&u>0?"border-l-2 border-l-border":"border-r border-r-border/50",k&&"bg-primary/5"),style:{width:C},children:Se(a.hour)},`hour-${a.dayIndex}-${a.hour}`)})]})}),B.map(a=>{const u=ce(a.maxStack);return e.jsxs("div",{className:f.cn("relative flex border-b",E?.resourceRow),style:{height:u},children:[e.jsx("div",{className:"sticky left-0 z-10",style:{width:ve},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",E?.resourceHeader),children:[(()=>{const h=!!a.user.avatar;return z===!0||z==="auto"&&h?e.jsx(Tt,{className:"size-7",src:a.user.avatar,alt:a.user.name,fallback:kt(a.user.name)}):null})(),$==="marquee"?e.jsx(It,{text:a.user.name,className:"flex-1 text-xs sm:text-sm font-medium"}):e.jsx("span",{className:"min-w-0 flex-1 truncate text-xs sm:text-sm font-medium",children:a.user.name})]})}),e.jsxs("div",{className:"ic-timeline-grid relative flex",onDragOver:h=>m(h,a.user.id),onDragLeave:F,onDrop:h=>ee(h,a.user.id),children:[y.map((h,k)=>{const C=h.hour===J&&k>0,T=Z[k]??Ne,U=le(a.user.id,k),te=ye(a.user.id,k),re=!!(l||d);return e.jsx("div",{role:re?"button":void 0,tabIndex:re?0:void 0,"aria-label":re?`Select ${Se(h.hour)} on ${h.date.toLocaleDateString()} for ${a.user.name}`:void 0,onPointerDown:se=>Ze(a.user.id,k,se),onPointerEnter:se=>et(a.user.id,k,se),onPointerUp:Te,onKeyDown:se=>{if(re&&(se.key==="Enter"||se.key===" ")){se.preventDefault();const ie=G(k);d?.(ie.date,ie.hour,a.user.id),l?.({startDate:ie.date,endDate:(()=>{const fe=new Date(ie.date);return ie.hour!==void 0&&fe.setHours(ie.hour+1,0,0,0),fe})(),resourceId:a.user.id})}},className:f.cn("shrink-0 select-none touch-none transition-colors",re&&"cursor-pointer",C?"border-l-2 border-l-border":"border-r border-r-border/50",X.isToday(h.date)&&"bg-primary/5",re&&!P?.isSelecting&&!W?.isDragging&&"hover:bg-blue-50/60",U&&"bg-blue-100/70",te&&"bg-primary/20 ring-2 ring-primary ring-inset"),style:{width:T}},`cell-${h.dayIndex}-${h.hour}`)}),a.events.map(h=>{const k=ae(h.startCol),C=ae(h.startCol+h.spanCols),T=k+2,U=C-k-4,te=Oe+h.stackIndex*(Ee+We),re=t===1?"timeline-day":t===3?"timeline-3day":"timeline-week",se=I?.eventCard,ie=h.event.data?.isPlaceholder===!0,fe=h.event.endDate<X.startOfDay(new Date),he=H&&!!W&&!h.event.isCanceled&&!fe&&!ie;return e.jsx("div",{className:f.cn("absolute",he&&"cursor-grab active:cursor-grabbing"),style:{left:T,width:Math.max(U,0),top:te,height:Ee},draggable:he||void 0,onDragStart:he?ke=>{ke.dataTransfer.effectAllowed="move",ke.dataTransfer.setData("text/plain",h.event.id),W?.startDrag(h.event)}:void 0,children:se?e.jsx(se,{event:h.event,view:re,isCompact:!0,enableDrag:H,onClick:()=>g?.(h.event)}):e.jsx(b.EventCard,{event:h.event,variant:"compact",enableDrag:H,onClick:g,renderPopover:j,className:f.cn("h-full w-full",E?.eventCardCompact)})},h.event.id)})]})]},a.user.id)}),B.length===0&&e.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:"No users or events to display"})]})})})}const Ht=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Pt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Be(t){const n=t.hexColor;return n?{backgroundColor:n}:{}}function At({day:t,date:n,events:s,isCurrentMonth:r,onDayClick:o}){const i=X.isToday(n),g=3,d=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}),d>0&&e.jsx("div",{className:"mt-0.5 flex items-center gap-0.5",children:d<=g?s.map(l=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:Be(l)},l.id)):e.jsxs(e.Fragment,{children:[s.slice(0,g).map(l=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:Be(l)},l.id)),e.jsxs("span",{className:"text-[6px] sm:text-[7px] font-medium text-muted-foreground",children:["+",d-g]})]})})]})}function Ft({date:t,events:n,onMonthClick:s,onDayClick:r}){const o=c.useMemo(()=>X.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:Pt[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:Ht.map((i,g)=>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})]},g))}),e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 gap-y-1",children:o.map((i,g)=>{const d=X.getEventsForDay(n,i.date);return e.jsx(At,{day:i.date.getDate(),date:i.date,events:d,isCurrentMonth:i.isCurrentMonth,onDayClick:r},`${g+1}-${i.date.toISOString()}`)})})]})]})}function Je({events:t,year:n,onMonthClick:s,onDayClick:r,className:o,slots:i,classNames:g}){const d=c.useMemo(()=>X.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:d.map(l=>e.jsx(Ft,{date:l,events:t,onMonthClick:s,onDayClick:r},l.getMonth()))})})]})}const Ce=200,Wt=60,Ot=300,_t=7,Ue=2,Le=40,Rt=18;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:"m18 15-6-6-6 6"})})}function Bt(){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 Ut(){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 Vt(){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 Yt({containerRef:t,currentDate:n,className:s}){const[r,o]=c.useState({canUp:!1,canDown:!1,canLeft:!1,canRight:!1}),[i,g]=c.useState({x:0,y:0}),[d,l]=c.useState(!1),p=r.canUp||r.canDown||r.canLeft||r.canRight,S=c.useRef(null),w=c.useRef(null),j=c.useRef(null),I=c.useRef(!1),E=c.useRef({x:0,y:0}),H=c.useRef({x:0,y:0}),O=c.useRef(0),$=c.useRef(null),z=c.useCallback(()=>{const x=t.current;if(!x)return;const N=4;o({canUp:x.scrollTop>N,canDown:x.scrollTop+x.clientHeight<x.scrollHeight-N,canLeft:x.scrollLeft>N,canRight:x.scrollLeft+x.clientWidth<x.scrollWidth-N})},[t]);c.useEffect(()=>{const x=t.current;if(!x)return;z(),x.addEventListener("scroll",z,{passive:!0});const N=new ResizeObserver(z);N.observe(x);const y=new MutationObserver(z);return y.observe(x,{childList:!0,subtree:!0}),()=>{x.removeEventListener("scroll",z),N.disconnect(),y.disconnect()}},[t,z]);const L=c.useCallback((x,N)=>{t.current?.scrollBy({left:x,top:N,behavior:"smooth"})},[t]),W=c.useCallback(()=>L(0,-Ce),[L]),P=c.useCallback(()=>L(0,Ce),[L]),Q=c.useCallback(()=>L(-Ce,0),[L]),M=c.useCallback(()=>L(Ce,0),[L]),_=c.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null),w.current&&(clearInterval(w.current),w.current=null)},[]),A=c.useCallback(x=>{x(),S.current=setTimeout(()=>{w.current=setInterval(x,Wt)},Ot)},[]);c.useEffect(()=>_,[_]),c.useEffect(()=>{const x=t.current;if(!x)return;const N=y=>{if(y.ctrlKey||y.metaKey||y.altKey)return;const V=y.target.tagName;if(!(V==="INPUT"||V==="TEXTAREA"||y.target.isContentEditable))switch(y.key){case"ArrowUp":y.preventDefault(),W();break;case"ArrowDown":y.preventDefault(),P();break;case"ArrowLeft":y.preventDefault(),Q();break;case"ArrowRight":y.preventDefault(),M();break}};return x.addEventListener("keydown",N),()=>x.removeEventListener("keydown",N)},[t,W,P,Q,M]),c.useEffect(()=>{if(!p)return;const x=$.current;if(!x)return;let N=0;const y=()=>{const B=x.offsetParent;if(!B)return;const oe=B.getBoundingClientRect(),Z=window.innerHeight;if(oe.height<=Z){x.style.removeProperty("top"),x.style.removeProperty("bottom");return}const me=Math.min(oe.bottom,Z)-oe.top,ne=x.offsetHeight,ae=me-ne-12,de=12,G=B.clientHeight-ne-12,m=Math.max(de,Math.min(ae,G));x.style.top=`${m}px`,x.style.bottom="auto"},V=()=>{cancelAnimationFrame(N),N=requestAnimationFrame(y)},R=[window];let K=x.parentElement;for(;K;){const B=getComputedStyle(K);/(auto|scroll)/.test(B.overflow+B.overflowY)&&R.push(K),K=K.parentElement}for(const B of R)B.addEventListener("scroll",V,{passive:!0});return window.addEventListener("resize",V,{passive:!0}),y(),()=>{cancelAnimationFrame(N);for(const B of R)B.removeEventListener("scroll",V);window.removeEventListener("resize",V)}},[p]);const Y=c.useCallback(()=>{I.current=!1,l(!1),g({x:0,y:0}),H.current={x:0,y:0},O.current&&cancelAnimationFrame(O.current)},[]),q=c.useCallback(x=>{x.preventDefault(),I.current=!0,l(!0),E.current={x:x.clientX,y:x.clientY},H.current={x:0,y:0},x.target.setPointerCapture(x.pointerId);const N=()=>{if(!I.current)return;const y=t.current;if(y){const{x:V,y:R}=H.current,K=Math.sqrt(V*V+R*R);if(K>Ue){const oe=Math.min(K/Le,1)*Rt;y.scrollLeft+=V/K*oe,y.scrollTop+=R/K*oe}}O.current=requestAnimationFrame(N)};O.current=requestAnimationFrame(N)},[t]),J=c.useCallback(x=>{if(!I.current)return;const N=x.clientX-E.current.x,y=x.clientY-E.current.y;H.current={x:N,y};const V=Math.sqrt(N*N+y*y);if(V<Ue)g({x:0,y:0});else{const K=Math.min(V,Le)/Le*_t;g({x:N/V*K,y:y/V*K})}},[]),v=c.useCallback(x=>{switch(x.key){case"ArrowUp":x.preventDefault(),W();break;case"ArrowDown":x.preventDefault(),P();break;case"ArrowLeft":x.preventDefault(),Q();break;case"ArrowRight":x.preventDefault(),M();break}},[W,P,Q,M]);if(!p)return null;const D=n?n.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):null;return e.jsxs("div",{ref:$,className:`inno-scroll-nav-wrapper ${s??""}`,role:"toolbar","aria-label":"Scroll navigation",onKeyDown:v,children:[D&&e.jsx("div",{className:"inno-scroll-nav-date","aria-live":"polite",children:D}),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:()=>A(W),onPointerUp:_,onPointerLeave:_,tabIndex:r.canUp?0:-1,children:e.jsx($t,{})}),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:()=>A(Q),onPointerUp:_,onPointerLeave:_,tabIndex:r.canLeft?0:-1,children:e.jsx(Ut,{})}),e.jsx("button",{ref:j,type:"button",className:`inno-scroll-nav-joystick ${d?"inno-scroll-nav-joystick-active":""}`,"aria-label":"Drag to scroll freely",onPointerDown:q,onPointerMove:J,onPointerUp:Y,onPointerCancel:Y,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:()=>A(M),onPointerUp:_,onPointerLeave:_,tabIndex:r.canRight?0:-1,children:e.jsx(Vt,{})}),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:()=>A(P),onPointerUp:_,onPointerLeave:_,tabIndex:r.canDown?0:-1,children:e.jsx(Bt,{})})]})]})}function qt(t){switch(t){case"day":case"week":return"time";default:return"day"}}function Kt({onEventClick:t,onSlotClick:n,onSlotSelect:s,onAddEvent:r,alwaysShowResources:o,className:i,showHeader:g=!0,minSelectionMinutes:d=30,showMoreMode:l,showMoreEventsInPopover:p=!1,isLoading:S=!1,slots:w,classNames:j,settingsContent:I,filterContent:E,headerActions:H,renderPopover:O,calendarRef:$,headerConfig:z,resourceColumnConfig:L,eventDetailMode:W,renderEventDetail:P}){const Q=l??(p?"popover":"expand"),{view:M,setView:_,selectedDate:A,setSelectedDate:Y,slotDuration:q,filteredEvents:J,users:v,visibleHours:D,workingHours:x,badgeVariant:N,showWorkingHoursOnly:y,clearFocusEventId:V}=be.useInnoCalendar(),R=c.useMemo(()=>{if(!y||!x)return{startHour:D.start,endHour:D.end};let m=24,F=0;for(const ee of Object.keys(x)){const le=x[Number(ee)];!le||le.enabled===!1||(le.from<m&&(m=le.from),le.to>F&&(F=le.to))}return m>=F?{startHour:D.start,endHour:D.end}:{startHour:m,endHour:F}},[y,x,D]),K=R,B=c.useRef(null);c.useImperativeHandle($,()=>({scrollToToday:()=>{const m=new Date;Y(m,M),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const F=B.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!F)return;const ye=(m.getHours()-R.startHour)*96;ye>0&&F.scrollTo({top:Math.max(0,ye-100),behavior:"smooth"})})})},scrollToWorkingHours:()=>{let m=8;if(x)for(const F of Object.keys(x)){const ee=x[Number(F)];ee?.enabled&&ee.from<m&&(m=Math.max(ee.from-1,0))}requestAnimationFrame(()=>{requestAnimationFrame(()=>{const F=B.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!F)return;const le=(m-R.startHour)*96;F.scrollTo({top:Math.max(0,le),behavior:"smooth"})})})},getViewRect:()=>B.current?.getBoundingClientRect()??null,focusEvent:m=>{V(),requestAnimationFrame(()=>{V()});const F=B.current?.querySelector(`[data-event-id="${m}"]`);F&&setTimeout(()=>F.click(),150)}}),[Y,M,R,x,V]);const oe=c.useMemo(()=>qt(M),[M]),Z=c.useCallback(m=>{if(s){s(m);return}if(n){const F=m.startDate.getHours();n(m.startDate,F)}},[s,n]),ce=c.useCallback(m=>{_("day"),Y(m,"day")},[Y,_]),me=c.useCallback(m=>{_("month"),Y(m,"month")},[Y,_]),ne=c.useCallback(m=>{t?.(m)},[t]),ae=c.useCallback((m,F,ee)=>{n?.(m,F)},[n]),de=()=>{const m=J,F=ne,ee=O;switch(M){case"day":return e.jsx(b.DayView,{events:m,date:A,visibleHours:K,workingHours:x,slotDuration:q,badgeVariant:N,onEventClick:F,renderPopover:ee,...w&&{slots:w},...j&&{classNames:j}});case"week":return e.jsx(b.WeekView,{events:m,date:A,visibleHours:K,workingHours:x,slotDuration:q,badgeVariant:N,onEventClick:F,renderPopover:ee,...w&&{slots:w},...j&&{classNames:j}});case"month":return e.jsx(b.MonthView,{events:m,date:A,badgeVariant:N,onEventClick:F,onDayClick:ce,renderPopover:ee,showMoreMode:Q,...w&&{slots:w},...j&&{classNames:j}});case"year":return e.jsx(Je,{events:m,year:A.getFullYear(),onMonthClick:me,onDayClick:ce,...w&&{slots:w},...j&&{classNames:j}});case"agenda":return e.jsx(b.AgendaView,{events:m,date:A,onEventClick:F,renderPopover:ee,...w&&{slots:w},...j&&{classNames:j}});case"resource-day":return e.jsx(pe,{daysToShow:1,events:m,users:v,...o&&{alwaysShowResources:o},selectedDate:A,visibleHours:{from:R.startHour,to:R.endHour},onEventClick:F,onSlotSelect:Z,onSlotClick:ae,renderPopover:ee,...w&&{slots:w},...j&&{classNames:j},...L&&{resourceColumnConfig:L}});case"resource-week":return e.jsx(pe,{daysToShow:7,events:m,users:v,...o&&{alwaysShowResources:o},selectedDate:A,visibleHours:{from:R.startHour,to:R.endHour},onEventClick:F,onSlotSelect:Z,onSlotClick:ae,renderPopover:ee,...w&&{slots:w},...j&&{classNames:j},...L&&{resourceColumnConfig:L}});case"timeline-day":return e.jsx(pe,{daysToShow:1,events:m,users:v,...o&&{alwaysShowResources:o},selectedDate:A,visibleHours:{from:R.startHour,to:R.endHour},onEventClick:F,onSlotSelect:Z,onSlotClick:ae,renderPopover:ee,...w&&{slots:w},...j&&{classNames:j},...L&&{resourceColumnConfig:L}});case"timeline-3day":return e.jsx(pe,{daysToShow:3,events:m,users:v,...o&&{alwaysShowResources:o},selectedDate:A,visibleHours:{from:R.startHour,to:R.endHour},onEventClick:F,onSlotSelect:Z,onSlotClick:ae,renderPopover:ee,...w&&{slots:w},...j&&{classNames:j},...L&&{resourceColumnConfig:L}});case"timeline-week":return e.jsx(pe,{daysToShow:7,events:m,users:v,...o&&{alwaysShowResources:o},selectedDate:A,visibleHours:{from:R.startHour,to:R.endHour},onEventClick:F,onSlotSelect:Z,onSlotClick:ae,renderPopover:ee,...w&&{slots:w},...j&&{classNames:j},...L&&{resourceColumnConfig:L}});default:return e.jsx(b.MonthView,{events:m,date:A,badgeVariant:N,onEventClick:F,onDayClick:ce,...w&&{slots:w},...j&&{classNames:j}})}},G=c.useRef(null);return c.useEffect(()=>{B.current=G.current}),e.jsx(be.SlotSelectionProvider,{mode:oe,onSelect:Z,minDurationMinutes:d,slotDurationMinutes:q,enabled:!!(s||n),children:e.jsxs("div",{className:f.cn("inno-calendar-root flex flex-col h-full p-4",j?.root,i),children:[g&&e.jsx(b.CalendarHeader,{currentDate:A,view:M,events:J,onViewChange:_,onNavigateToday:()=>Y(new Date,M),onNavigatePrev:()=>{const m=new Date(A);M==="day"||M==="timeline-day"||M==="resource-day"?m.setDate(m.getDate()-1):M==="timeline-3day"?m.setDate(m.getDate()-3):M==="week"||M==="timeline-week"||M==="resource-week"?m.setDate(m.getDate()-7):M==="month"?m.setMonth(m.getMonth()-1):M==="year"?m.setFullYear(m.getFullYear()-1):m.setDate(m.getDate()-7),Y(m,M)},onNavigateNext:()=>{const m=new Date(A);M==="day"||M==="timeline-day"||M==="resource-day"?m.setDate(m.getDate()+1):M==="timeline-3day"?m.setDate(m.getDate()+3):M==="week"||M==="timeline-week"||M==="resource-week"?m.setDate(m.getDate()+7):M==="month"?m.setMonth(m.getMonth()+1):M==="year"?m.setFullYear(m.getFullYear()+1):m.setDate(m.getDate()+7),Y(m,M)},availableViews:["day","week","month","agenda"],showTimelineViews:!0,showSettings:!!I,...!H&&r&&{onAddEvent:r},actions:H,settingsContent:I,filterContent:E,...z&&{headerConfig:z}}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:G,className:f.cn("h-full border rounded-lg bg-white overflow-x-auto",j?.viewContainer),children:de()}),S&&e.jsx("div",{className:"inno-calendar-loading-overlay",children:e.jsx("div",{className:"inno-calendar-spinner"})}),e.jsx(Yt,{containerRef:G,currentDate:A})]})]})})}function Gt({events:t,users:n=[],alwaysShowResources:s,scheduleTypes:r=[],initialView:o,initialDate:i,initialSelectedUserId:g,initialScheduleTypeIds:d,initialParticipantIds:l,initialWorkingHoursView:p,initialSearchQuery:S,preferencesConfig:w,onEventClick:j,onSlotClick:I,onSlotSelect:E,onAddEvent:H,onEventDrop:O,onDateChange:$,onViewChange:z,className:L,showHeader:W=!0,minSelectionMinutes:P=30,showMoreMode:Q,showMoreEventsInPopover:M=!1,isLoading:_=!1,renderPopover:A,slots:Y,classNames:q,settingsContent:J,filterContent:v,headerActions:D,focusEventId:x,headerConfig:N,resourceColumnConfig:y,viewPersistence:V,eventDetailMode:R,renderEventDetail:K},B){return e.jsx(be.DragDropProvider,{...O&&{onEventDrop:O},children:e.jsx(be.InnoCalendarProvider,{initialEvents:t,initialUsers:n,initialScheduleTypes:r,...o&&{initialView:o},...i&&{initialDate:i},...g&&{initialSelectedUserId:g},...d&&{initialScheduleTypeIds:d},...l&&{initialParticipantIds:l},...p&&{initialWorkingHoursView:p},...S&&{initialSearchQuery:S},...w&&{preferencesConfig:w},...$&&{onDateChange:$},...z&&{onViewChange:z},...x&&{initialFocusEventId:x},...V&&{viewPersistence:V},children:e.jsx(Kt,{...j&&{onEventClick:j},...I&&{onSlotClick:I},...E&&{onSlotSelect:E},...H&&{onAddEvent:H},...s&&{alwaysShowResources:s},...A&&{renderPopover:A},className:L,showHeader:W,minSelectionMinutes:P,...Q&&{showMoreMode:Q},showMoreEventsInPopover:M,isLoading:_,...Y&&{slots:Y},...q&&{classNames:q},settingsContent:J,filterContent:v,headerActions:D,calendarRef:B,...N&&{headerConfig:N},...y&&{resourceColumnConfig:y},...R&&{eventDetailMode:R},...K&&{renderEventDetail:K}})})})}const Xt=c.forwardRef(Gt),xe=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}));xe.displayName="Select";const ue=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}));ue.displayName="Label";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 Qt({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 Zt=[{value:15,label:"15 minutes"},{value:30,label:"30 minutes"},{value:60,label:"1 hour"}];function en({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},g=d=>{s||n(Number(d.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(ue,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(b.TooltipProvider,{delayDuration:100,children:e.jsxs(b.Tooltip,{children:[e.jsx(b.TooltipTrigger,{children:e.jsx(Qt,{className:"size-3 text-muted-foreground"})}),e.jsx(b.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(b.TooltipProvider,{delayDuration:100,children:e.jsxs(b.Tooltip,{children:[e.jsx(b.TooltipTrigger,{children:e.jsx(Jt,{className:"size-3 text-muted-foreground"})}),e.jsx(b.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx(xe,{value:t.toString(),onChange:g,disabled:s,className:"h-9 w-[128px] text-sm",children:Zt.map(d=>e.jsx("option",{value:d.value.toString(),children:d.label},d.value))})]})}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("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function nn({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 rn=[{value:"dot",label:"Dot indicator"},{value:"colored",label:"Full color"},{value:"mixed",label:"Mixed"}];function sn({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},g=l=>i.options?.[l]??l,d=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(ue,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(b.TooltipProvider,{delayDuration:100,children:e.jsxs(b.Tooltip,{children:[e.jsx(b.TooltipTrigger,{children:e.jsx(nn,{className:"size-3 text-muted-foreground"})}),e.jsx(b.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(b.TooltipProvider,{delayDuration:100,children:e.jsxs(b.Tooltip,{children:[e.jsx(b.TooltipTrigger,{children:e.jsx(tn,{className:"size-3 text-muted-foreground"})}),e.jsx(b.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx(xe,{value:t,onChange:d,disabled:s,className:"h-9 w-[128px] text-sm",children:rn.map(l=>e.jsx("option",{value:l.value,children:g(l.value)},l.value))})]})}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("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 16v-4"}),e.jsx("path",{d:"M12 8h.01"})]})}function an({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 ln(){return Array.from({length:25},(t,n)=>({value:n,label:`${String(n).padStart(2,"0")}:00`}))}function cn({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},g=ln(),d=p=>{if(s)return;const S=Number(p.target.value);S<t.endHour&&n({...t,startHour:S})},l=p=>{if(s)return;const S=Number(p.target.value);S>t.startHour&&n({...t,endHour:S})};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(ue,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(b.TooltipProvider,{delayDuration:100,children:e.jsxs(b.Tooltip,{children:[e.jsx(b.TooltipTrigger,{children:e.jsx(an,{className:"size-3 text-muted-foreground"})}),e.jsx(b.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(b.TooltipProvider,{delayDuration:100,children:e.jsxs(b.Tooltip,{children:[e.jsx(b.TooltipTrigger,{children:e.jsx(on,{className:"size-3 text-muted-foreground"})}),e.jsx(b.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(ue,{className:"text-xs text-muted-foreground",children:i.from}),e.jsx(xe,{value:t.startHour.toString(),onChange:d,disabled:s,className:"h-9 w-[88px] text-sm",children:g.map(p=>e.jsx("option",{value:p.value.toString(),disabled:p.value>=t.endHour,children:p.label},p.value))})]}),e.jsx("span",{className:"mt-5 text-muted-foreground",children:"—"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(ue,{className:"text-xs text-muted-foreground",children:i.to}),e.jsx(xe,{value:t.endHour.toString(),onChange:l,disabled:s,className:"h-9 w-[88px] text-sm",children:g.map(p=>e.jsx("option",{value:p.value.toString(),disabled:p.value<=t.startHour,children:p.label},p.value))})]})]})]})}function dn({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 un({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 xn({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 hn=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function mn(){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 fn({dayLabel:t,config:n,onChange:s,disabled:r,hourOptions:o}){const i=()=>{r||s({...n,enabled:!n.enabled})},g=l=>{if(r)return;const p=Number(l.target.value);p<n.to&&s({...n,from:p})},d=l=>{if(r)return;const p=Number(l.target.value);p>n.from&&s({...n,to:p})};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(xn,{className:"size-3"})}),e.jsx("span",{className:f.cn("w-10 text-sm",!n.enabled&&"text-muted-foreground"),children:t}),e.jsx(xe,{value:n.from.toString(),onChange:g,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(xe,{value:n.to.toString(),onChange:d,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 gn({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},g=mn(),d=(l,p)=>{s||n({...t,[l]:p})};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(ue,{className:"text-sm font-semibold",children:i.title}),s?e.jsx(b.TooltipProvider,{delayDuration:100,children:e.jsxs(b.Tooltip,{children:[e.jsx(b.TooltipTrigger,{children:e.jsx(un,{className:"size-3 text-muted-foreground"})}),e.jsx(b.TooltipContent,{children:e.jsx("p",{children:i.lockedMessage})})]})}):e.jsx(b.TooltipProvider,{delayDuration:100,children:e.jsxs(b.Tooltip,{children:[e.jsx(b.TooltipTrigger,{children:e.jsx(dn,{className:"size-3 text-muted-foreground"})}),e.jsx(b.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:i.infoMessage})})]})})]}),e.jsx("div",{className:"flex flex-col gap-2",children:hn.map(l=>e.jsx(fn,{dayLabel:i.days?.[l]??Ve[l],config:t[l],onChange:p=>d(l,p),disabled:s,hourOptions:g},l))})]})}const pn={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 Ie({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 vn({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 jn({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 ze({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 wn({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(vn,{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 qe(t,n,s,r=.3){if(!n.trim())return t;const o=n.toLowerCase();return t.filter(i=>s(i).some(d=>d?d.toLowerCase().includes(o):!1))}const bn={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 yn({scheduleTypes:t,users:n,selectedScheduleTypeIds:s,onScheduleTypeChange:r,selectedUserIds:o,onUserChange:i,onClearAll:g,className:d,scheduleTypesLoading:l=!1,usersLoading:p=!1,labels:S,getScheduleTypeName:w}){const j={...bn,...S},[I,E]=c.useState(""),[H,O]=c.useState(""),$=c.useMemo(()=>I.trim()?qe(t,I,v=>[v.name,w?.(v)||v.name]):t,[t,I,w]),z=c.useMemo(()=>H.trim()?qe(n,H,v=>[v.name,v.email||""]):n,[n,H]),L=$.length>0&&$.every(v=>s.includes(v.id)),W=z.length>0&&z.every(v=>o.includes(v.id)),P=s.length+o.length,Q=(v,D)=>{const x=D?[...s,v]:s.filter(N=>N!==v);r(x)},M=()=>{if(L){const v=new Set($.map(D=>D.id));r(s.filter(D=>!v.has(D)))}else{const v=new Set([...s,...$.map(D=>D.id)]);r(Array.from(v))}},_=(v,D)=>{const x=D?[...o,v]:o.filter(N=>N!==v);i(x)},A=()=>{if(W){const v=new Set(z.map(D=>D.id));i(o.filter(D=>!v.has(D)))}else{const v=new Set([...o,...z.map(D=>D.id)]);i(Array.from(v))}},Y=()=>{r([]),i([]),g?.()},q=v=>w?w(v):v.name,J=v=>v.colorHex||v.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",d),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:j.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j.subtitle})]}),P>0&&e.jsxs("button",{type:"button",onClick:Y,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(jn,{className:"h-3.5 w-3.5"}),j.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:j.scheduleTypes}),e.jsx("button",{type:"button",onClick:M,className:"text-xs font-medium text-primary transition-colors hover:text-primary/80",children:L?j.unselectAll:j.selectAll})]}),t.length>6&&e.jsx("div",{className:"px-4 pb-3",children:e.jsx(Ye,{value:I,onChange:E,placeholder:j.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((v,D)=>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-${D}`)):$.map(v=>{const D=s.includes(v.id),x=J(v);return e.jsxs(ze,{checked:D,onCheckedChange:N=>Q(v.id,N),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",D&&"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",D&&"border-primary bg-primary text-primary-foreground"),children:D&&e.jsx(Ie,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:q(v)})]}),e.jsx("div",{className:"h-4 w-4 rounded-full border",style:{backgroundColor:x,borderColor:x}})]},v.id)}),!l&&$.length===0&&e.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:j.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:j.participants}),e.jsx(ze,{checked:W,onCheckedChange:()=>A(),className:f.cn("flex h-5 w-5 items-center justify-center rounded border border-border bg-white transition-colors hover:border-primary/50",W&&"border-primary bg-primary text-primary-foreground"),children:W&&e.jsx(Ie,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx(Ye,{value:H,onChange:O,placeholder:j.searchParticipants})}),e.jsxs("div",{className:"flex max-h-[400px] flex-col gap-2 overflow-y-auto px-4 pb-4 scrollbar-thin",children:[p?Array.from({length:4}).map((v,D)=>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-${D}`)):z.map(v=>{const D=o.includes(v.id);return e.jsxs(ze,{checked:D,onCheckedChange:x=>_(v.id,x),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",D&&"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",D&&"border-primary bg-primary text-primary-foreground"),children:D&&e.jsx(Ie,{className:"h-2.5 w-2.5"})}),e.jsxs("div",{className:"flex flex-1 items-start gap-2",children:[e.jsx(wn,{src:v.avatar??null,alt:v.name,fallback:v.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:v.name}),e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:v.email,children:v.email})]})]})]},v.id)}),!p&&z.length===0&&e.jsx("p",{className:"px-4 text-xs text-muted-foreground",children:j.noParticipants})]})]})]})}function kn({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 Nn({scheduleTypes:t,value:n,onChange:s,allLabel:r="All types",className:o,label:i}){const g=l=>{s(l.target.value)},d=t.find(l=>String(l.id)===n);return e.jsxs("div",{className:f.cn("flex flex-col gap-1",o),children:[i&&e.jsx(ue,{className:"text-xs text-muted-foreground",children:i}),e.jsxs("div",{className:"relative",children:[d?e.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 size-3 -translate-y-1/2 rounded-full",style:{backgroundColor:d.color}}):e.jsx(kn,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(xe,{value:n,onChange:g,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 Cn({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 Dn({users:t,value:n,onChange:s,allLabel:r="All users",className:o,label:i}){const g=d=>{s(d.target.value)};return e.jsxs("div",{className:f.cn("flex flex-col gap-1",o),children:[i&&e.jsx(ue,{className:"text-xs text-muted-foreground",children:i}),e.jsxs("div",{className:"relative",children:[e.jsx(Cn,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(xe,{value:n,onChange:g,className:"h-9 w-full min-w-[120px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:r}),t.map(d=>e.jsx("option",{value:d.id,children:d.name},d.id))]})]})]})}function Mn({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 Tn({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 En({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 Sn({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 Ln(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 Ke(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 In(t){const n=Ke(t.startDate),s=Ke(t.endDate);return`${n} - ${s}`}function zn(t){const n=X.addDays(new Date,1);return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Hn(t){if(X.isToday(t))return"Today";if(zn(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 Pn(t,n){const s=new Map;for(const r of t){const o=Ln(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((d,l)=>d.startDate.getTime()-l.startDate.getTime()),g=n>0?i.slice(0,n):i;return{date:new Date(r),dateKey:r,events:g,hasMore:n>0&&i.length>n}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function An(t){const n=X.startOfDay(new Date),s=X.endOfDay(new Date);return t.filter(r=>r.startDate>=n&&r.startDate<=s).length}function He({className:t}){return e.jsx("div",{className:f.cn("animate-pulse rounded-md bg-muted",t)})}function Fn({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:In(t)})]}),n&&e.jsx(En,{className:"shrink-0 size-4 text-muted-foreground/50 mt-1"})]})}function Wn({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",X.isToday(t.date)&&"text-primary"),children:Hn(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(Fn,{event:s,onClick:n},s.id))})]})}function On({events:t,isLoading:n=!1,className:s,daysAhead:r=7,maxEventsPerDay:o=3,onEventClick:i,onNavigateToAgenda:g}){const[d,l]=c.useState(!1),p=c.useMemo(()=>{const E=X.startOfDay(new Date),H=X.addDays(E,r);return t.filter(O=>O.endDate>=E&&O.startDate<H)},[t,r]),S=c.useMemo(()=>Pn(p,o),[p,o]),w=c.useMemo(()=>An(t),[t]),j=E=>{l(!1),i?.(E)},I=()=>{l(!1),g?.()};return e.jsxs(b.Popover,{open:d,onOpenChange:l,children:[e.jsxs(b.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(Mn,{className:"h-4 w-4"}),w>0&&e.jsx(b.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:w>99?"99+":w})]}),e.jsxs(b.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:w>0?`${w} event${w>1?"s":""} today`:"No events today"})]}),g&&e.jsxs("button",{type:"button",onClick:I,className:"text-xs text-primary hover:underline flex items-center gap-1",children:["View all",e.jsx(Sn,{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((E,H)=>e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(He,{className:"h-2 w-2 rounded-full mt-2"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(He,{className:"h-4 w-full"}),e.jsx(He,{className:"h-3 w-3/4"})]})]},H))}):S.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(Tn,{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:S.map(E=>e.jsx(Wn,{group:E,onEventClick:j},E.dateKey))})})]})]})}function _n({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 Rn(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 $n(t){return new Intl.DateTimeFormat("en-US",{weekday:"long",month:"short",day:"numeric"}).format(t)}function Bn(t){const n=Ge(t.startDate),s=Ge(t.endDate);return`${n} - ${s}`}function Un(t){return X.isToday(t)?"Today":Rn(t)?"Tomorrow":$n(t)}function Vn(t,n){const s=new Map;for(const r of t){const o=X.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((d,l)=>d.startDate.getTime()-l.startDate.getTime()),g=n>0?i.slice(0,n):i;return{date:new Date(r),dateKey:r,events:g,hasMore:n>0&&i.length>n}}).sort((r,o)=>r.date.getTime()-o.date.getTime())}function Yn({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:Bn(t)})]}),n&&e.jsx(Qe,{className:f.cn("shrink-0 text-muted-foreground/50",s?"size-3":"size-4")})]})}function qn({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",X.isToday(t.date)&&"text-primary"),children:Un(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(Yn,{event:o,onClick:n,compact:r},o.id))})]})}function Kn({events:t,daysAhead:n=7,maxEventsPerDay:s=3,onEventClick:r,onViewAll:o,className:i,emptyState:g,title:d="Upcoming",showHeader:l=!0,compact:p=!1}){const S=De.useOptionalCalendarContext(),w=S?.filteredEvents,j=S?.currentDate??new Date,I=t??w??[],E=c.useMemo(()=>{const $=X.startOfDay(j),z=new Date($);return z.setDate(z.getDate()+n),I.filter(L=>L.endDate>=$&&L.startDate<z)},[I,n,j]),H=c.useMemo(()=>Vn(E,s),[E,s]),O=E.length;return H.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",p?"py-2":"py-3"),children:e.jsx("h2",{className:f.cn("font-semibold",p?"text-sm":"text-base"),children:d})}),e.jsx("div",{className:f.cn("flex flex-col items-center justify-center text-center",p?"py-6 px-4":"py-10 px-6"),children:g??e.jsxs(e.Fragment,{children:[e.jsx(_n,{className:f.cn("text-muted-foreground/50 mb-2",p?"size-8":"size-10")}),e.jsx("p",{className:f.cn("text-muted-foreground",p?"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",p?"py-2":"py-3"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:f.cn("font-semibold",p?"text-sm":"text-base"),children:d}),e.jsx("span",{className:f.cn("text-muted-foreground bg-muted rounded-full px-2",p?"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",p?"text-xs":"text-sm"),children:["View all",e.jsx(Qe,{className:"size-3"})]})]}),e.jsx("div",{className:f.cn("divide-y overflow-auto",p?"p-2 max-h-[280px]":"p-3 max-h-[400px]"),children:H.map($=>e.jsx(qn,{group:$,onEventClick:r,onViewMore:o?z=>o(z):void 0,compact:p},$.dateKey))})]})}exports.AgendaDropdown=On;exports.AgendaWidget=Kn;exports.BadgeVariantSetting=sn;exports.Calendar=nt;exports.CalendarFilterSidebar=yn;exports.DEFAULT_WEEK_WORKING_HOURS=pn;exports.EventPopover=jt;exports.InnoCalendar=Xt;exports.ScheduleTypeFilter=Nn;exports.SlotDurationSetting=en;exports.TimelineView=pe;exports.UserFilter=Dn;exports.VisibleHoursSetting=cn;exports.WorkingHoursSetting=gn;exports.YearView=Je;
2
+ //# sourceMappingURL=agenda-widget-i2tjGr5U.cjs.map