@innosolutions/inno-calendar 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agenda-widget-CcvTi51_.cjs +2 -0
- package/dist/agenda-widget-CcvTi51_.cjs.map +1 -0
- package/dist/{agenda-widget-B0zdMifv.js → agenda-widget-DHq2DsjV.js} +364 -346
- package/dist/agenda-widget-DHq2DsjV.js.map +1 -0
- package/dist/components/event/event-card.d.ts.map +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/views/day-events-expansion.d.ts +1 -1
- package/dist/components/views/day-events-expansion.d.ts.map +1 -1
- package/dist/components/views/timeline-view.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +3 -3
- package/dist/presets/index.cjs +1 -1
- package/dist/presets/index.mjs +1 -1
- package/dist/{tailwind-calendar-Gy1Uc9ZK.cjs → tailwind-calendar-Ufp5YM_i.cjs} +2 -2
- package/dist/{tailwind-calendar-Gy1Uc9ZK.cjs.map → tailwind-calendar-Ufp5YM_i.cjs.map} +1 -1
- package/dist/{tailwind-calendar-Ctfffnbn.js → tailwind-calendar-Wvl6G_sK.js} +2 -2
- package/dist/{tailwind-calendar-Ctfffnbn.js.map → tailwind-calendar-Wvl6G_sK.js.map} +1 -1
- package/dist/week-view-1DnsOgRW.cjs +11 -0
- package/dist/week-view-1DnsOgRW.cjs.map +1 -0
- package/dist/{week-view-vnIcmoVr.js → week-view-CCzE8DEb.js} +1041 -1046
- package/dist/week-view-CCzE8DEb.js.map +1 -0
- package/package.json +1 -1
- package/dist/agenda-widget-B0zdMifv.js.map +0 -1
- package/dist/agenda-widget-COtUXK9d.cjs +0 -2
- package/dist/agenda-widget-COtUXK9d.cjs.map +0 -1
- package/dist/week-view-ITRsM6y1.cjs +0 -11
- package/dist/week-view-ITRsM6y1.cjs.map +0 -1
- package/dist/week-view-vnIcmoVr.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),Ne=require("./use-calendar-BEuelmSu.cjs"),g=require("react"),x=require("./index-D2U2F80P.cjs"),p=require("./week-view-1DnsOgRW.cjs"),ye=require("./slot-selection-context-CHSaOPWP.cjs"),R=require("./utils.cjs");function Je({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 He({view:t,className:n}){return e.jsx(Je,{view:t,className:n})}function Xe(t){const{events:n,resources:r,scheduleTypes:o,initialView:i="week",initialDate:a,initialFilters:f,preferences:h,locale:c,slots:j,renderEvent:y,onViewChange:v,onDateChange:H,onEventClick:A,onSlotSelect:I,onFiltersChange:W,className:S,children:N}=t,F=Ne.useOptionalCalendarContext();if(F)return e.jsx("div",{className:S,style:{position:"relative"},children:N??e.jsx(He,{view:F.view,className:S})});const $=Ne.useCalendar({events:n,resources:r,scheduleTypes:o,initialView:i,initialDate:a,initialFilters:f,preferences:h,locale:c,onViewChange:v,onDateChange:H,onEventClick:A,onSlotSelect:I,onFiltersChange:W});return e.jsx(Ne.CalendarProvider,{value:$,children:e.jsx("div",{className:S,style:{position:"relative"},children:N??e.jsx(He,{view:$.view,className:S})})})}function Qe({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 Ge({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 Ce({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 Ze({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 et({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 tt({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 nt({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 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:"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 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("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 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("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 me({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:x.cn("animate-spin",t),children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}const it={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=g.forwardRef(({onClick:t,label:n,children:r,className:o,variant:i="ghost",...a},f)=>e.jsxs(p.Tooltip,{children:[e.jsx(p.TooltipTrigger,{asChild:!0,children:e.jsx("button",{type:"button",ref:f,onClick:t,className:x.cn("h-8 w-8 rounded-full flex items-center justify-center transition-colors",i==="ghost"&&"hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-600 dark:text-zinc-400",i==="destructive"&&"hover:bg-red-50 dark:hover:bg-red-950/30 text-zinc-600 dark:text-zinc-400 hover:text-red-600",o),"aria-label":n,...a,children:r})}),e.jsx(p.TooltipContent,{side:"bottom",className:"text-xs",children:n})]}));be.displayName="IconButton";function at({src:t,alt:n,initials:r,className:o,isClient:i}){const[a,f]=g.useState(!1);return e.jsx("div",{className:x.cn("relative h-7 w-7 rounded-full overflow-hidden shrink-0",o),children:t&&!a?e.jsx("img",{src:t,alt:n,className:"h-full w-full object-cover",onError:()=>f(!0)}):e.jsx("div",{className:x.cn("h-full w-full flex items-center justify-center text-[10px] font-medium",i?"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:r})})}function Le({participant:t,isEventCanceled:n=!1,labels:r}){const o=t.name||"Unknown",i=o.split(" ").map(H=>H[0]).join("").toUpperCase().slice(0,2),a=t.isOrganizer??!1,f=t.isConfirmed,h=f===!0,c=f===!1,j=t.isClient??!1,y=t.profilePicture||t.avatar,v=n;return e.jsxs("div",{className:x.cn("flex items-center gap-3 py-0",v&&"opacity-60"),children:[e.jsxs("div",{className:"relative",children:[e.jsx(at,{src:y,alt:o,initials:i,isClient:j,className:x.cn(v&&"grayscale")}),v||c?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(Ce,{className:"h-2 w-2 text-red-600 dark:text-red-400 stroke-[3]"})})}):h?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:x.cn("text-sm text-zinc-900 dark:text-zinc-100 truncate",v&&"line-through text-zinc-500 dark:text-zinc-500"),children:o})}),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:r.client}),a&&!v&&e.jsx("div",{className:"text-xs text-zinc-500",children:r.organizer})]})]})}function lt({open:t,onOpenChange:n,title:r,children:o}){return g.useEffect(()=>{if(!t)return;const i=a=>{a.key==="Escape"&&n(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,n]),g.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:i=>{(i.key==="Enter"||i.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:[r&&e.jsx("div",{className:"sr-only",children:r}),o]})})]}):null}function ct({open:t,onOpenChange:n,title:r,description:o,cancelLabel:i,confirmLabel:a,onConfirm:f,isLoading:h}){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:c=>{(c.key==="Enter"||c.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:r}),e.jsx("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400",children:o}),e.jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[e.jsx(p.Button,{variant:"outline",size:"sm",onClick:()=>n(!1),children:i}),e.jsxs(p.Button,{variant:"destructive",size:"sm",onClick:f,disabled:h,children:[h&&e.jsx(me,{className:"h-4 w-4 mr-2"}),e.jsx(Ge,{className:"h-4 w-4 mr-2"}),a]})]})]})})]}):null}function dt(t,n){return t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function ut(t,n){const r={hour:"2-digit",minute:"2-digit",hour12:!1};return`${t.toLocaleTimeString(void 0,r)} – ${n.toLocaleTimeString(void 0,r)}`}function xt(t){return t.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function ht(t){const[n,r]=g.useState(()=>typeof window<"u"?window.matchMedia(t).matches:!1);return g.useEffect(()=>{if(typeof window>"u")return;const o=window.matchMedia(t),i=a=>r(a.matches);return o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[t]),n}function Ie({event:t,labels:n,isLoading:r,onClose:o,onEdit:i,onDelete:a,onCancel:f,onAccept:h,onDecline:c,onConfirmMeeting:j,canEdit:y=!0,canDelete:v=!1,canCancel:H=!0,isCurrentUserParticipant:A=!1,isCurrentUserClient:I=!1,currentUserAcceptStatus:W,isAcceptLoading:S=!1,isDeclineLoading:N=!1,isConfirmLoading:F=!1,isDeleteLoading:$=!1,renderParticipant:_,renderHeaderActions:C,renderCancelReason:q,renderDeleteConfirmation:L,formatDate:z=dt,formatTimeRange:V=ut}){const[K,U]=g.useState(!1),P=!(t.isCanceled||t.meetingTookPlace),d=t.isRecurring??!1,k=t.participantDetails,O=t.participantsNames||[],B=k&&k.length>0,E=W===!0,ne=W===!1,X=A&&!I&&P,ge=B?k.filter(Q=>Q.isConfirmed).length:t.isAccepted?O.length:0,ee=B?k.length:O.length,J=t.scheduleTypeColor||t.hexColor||"#039BE5",xe=g.useCallback(()=>t.startDate?z(t.startDate):n.noDateProvided,[t.startDate,z,n.noDateProvided]),re=g.useCallback(()=>t.startDate&&t.endDate?V(t.startDate,t.endDate):null,[t.startDate,t.endDate,V]),se=()=>{o(),i?.(t)},pe=()=>{o(),f?.(t)},le=()=>{U(!0)},he=()=>{a?.(t),U(!1)};return r?e.jsx("div",{className:"flex h-48 items-center justify-center",children:e.jsx(me,{className:"h-6 w-6 text-zinc-400"})}):e.jsxs(p.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:C?C({onClose:o}):e.jsxs(e.Fragment,{children:[P&&y&&i&&e.jsx(be,{onClick:se,label:n.edit,children:e.jsx(Qe,{className:"h-[18px] w-[18px]"})}),P&&H&&f&&e.jsx(be,{onClick:pe,label:n.cancel,children:e.jsx(Ze,{className:"h-[18px] w-[18px]"})}),v&&a&&e.jsx(be,{onClick:le,label:n.delete,variant:"destructive",children:e.jsx(Ge,{className:"h-[18px] w-[18px]"})}),e.jsx(be,{onClick:o,label:n.close,children:e.jsx(Ce,{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:J}}),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:x.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(et,{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(Ce,{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:xe()}),re()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsx("span",{children:re()})]})]}),d&&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," ",xt(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(rt,{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})]}),(B||O.length>0)&&e.jsxs("div",{className:"flex items-start gap-2 py-0",children:[e.jsx(nt,{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:[ee," ",ee!==1?n.guests:n.guest]}),ee>0&&e.jsxs("span",{className:"text-xs text-zinc-500",children:["(",ge," ",n.confirmed,")"]})]}),e.jsxs("div",{className:"mt-2 space-y-2",children:[B?k.slice(0,6).map((Q,oe)=>_?_(Q,oe):e.jsx(Le,{participant:Q,isEventCanceled:t.isCanceled,labels:n},Q.id)):O.slice(0,6).map((Q,oe)=>{const u={id:String(oe),name:Q,email:"",isConfirmed:t.isAccepted,isOrganizer:oe===0,isClient:!1};return _?_(u,oe):e.jsx(Le,{participant:u,isEventCanceled:t.isCanceled,labels:n},Q)}),ee>6&&e.jsxs("div",{className:"text-xs text-zinc-500 py-1.5 pl-10",children:["+",ee-6," ",n.more]})]})]})]}),t.description&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(ot,{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(st,{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:B&&k.find(Q=>Q.isOrganizer)?.name||O[0]||"Calendar"})]})]}),X&&h&&c&&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:[d?e.jsxs(p.DropdownMenu,{children:[e.jsx(p.DropdownMenuTrigger,{asChild:!0,children:e.jsxs("div",{className:"flex",children:[e.jsx(p.Button,{size:"sm",variant:"outline",className:x.cn("rounded-r-none gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",E&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:Q=>{Q.stopPropagation(),E||h(t)},disabled:S,children:S?e.jsx(me,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[E&&e.jsx(we,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(p.Button,{size:"sm",variant:"outline",className:x.cn("rounded-l-none px-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",E&&"!bg-green-700 !text-white hover:!bg-green-700"),children:e.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),e.jsxs(p.DropdownMenuContent,{align:"start",children:[e.jsxs(p.DropdownMenuItem,{className:x.cn("gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",E&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>h(t),children:[e.jsx(we,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptThisEvent]}),e.jsxs(p.DropdownMenuItem,{onClick:()=>h(t),children:[e.jsx(we,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptAllEvents]})]})]}):e.jsx(p.Button,{size:"sm",variant:"outline",className:x.cn("gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",E&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>{E||h(t)},disabled:S,children:S?e.jsx(me,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[E&&e.jsx(we,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(p.Button,{size:"sm",variant:"outline",className:x.cn("gap-1.5 h-8 !border-none !bg-rose-100 text-rose-800 hover:!bg-rose-200",ne&&"!bg-rose-700 !text-white hover:!bg-rose-700"),onClick:()=>{ne||c(t)},disabled:N,children:N?e.jsx(me,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[ne&&e.jsx(Ce,{className:"h-3.5 w-3.5"}),n.notGoing]})})]})}),A&&E&&!t.meetingTookPlace&&!t.isCanceled&&j&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 py-3",children:e.jsxs(p.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:F,children:[F&&e.jsx(me,{className:"h-4 w-4 mr-2"}),n.confirmMeeting]})})]}),L?K&&L({onConfirm:he,onCancel:()=>U(!1),isLoading:$}):e.jsx(ct,{open:K,onOpenChange:U,title:n.deleteConfirmTitle,description:n.deleteConfirmDescription,cancelLabel:n.cancel,confirmLabel:n.delete,onConfirm:he,isLoading:$})]})}function mt({event:t,children:n,open:r,onOpenChange:o,isLoading:i,labels:a,onEdit:f,onDelete:h,onCancel:c,onAccept:j,onDecline:y,onConfirmMeeting:v,canEdit:H=!0,canDelete:A=!1,canCancel:I=!0,isCurrentUserParticipant:W,isCurrentUserClient:S,currentUserAcceptStatus:N,isAcceptLoading:F,isDeclineLoading:$,isConfirmLoading:_,isDeleteLoading:C,renderParticipant:q,renderHeaderActions:L,renderCancelReason:z,renderDeleteConfirmation:V,formatDate:K,formatTimeRange:U,className:P,width:d=360}){const k=ht("(min-width: 768px)"),O={...it,...a},B=g.useCallback(()=>{o?.(!1)},[o]),E={event:t,labels:O,isLoading:i,onClose:B,onEdit:f,onDelete:h,onCancel:c,onAccept:j,onDecline:y,onConfirmMeeting:v,canEdit:H,canDelete:A,canCancel:I,isCurrentUserParticipant:W,isCurrentUserClient:S,currentUserAcceptStatus:N,isAcceptLoading:F,isDeclineLoading:$,isConfirmLoading:_,isDeleteLoading:C,renderParticipant:q,renderHeaderActions:L,renderCancelReason:z,renderDeleteConfirmation:V,formatDate:K,formatTimeRange:U};return k?e.jsxs(p.Popover,{open:r??!1,onOpenChange:o??(()=>{}),children:[e.jsx(p.PopoverTrigger,{asChild:!0,children:n}),e.jsx(p.PopoverContent,{className:x.cn("p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",P),style:{width:d},align:"center",side:"bottom",sideOffset:4,children:e.jsx(Ie,{...E})})]}):e.jsxs(e.Fragment,{children:[n,e.jsx(lt,{open:r??!1,onOpenChange:o??(()=>{}),title:t.title,children:e.jsx(Ie,{...E})})]})}const De=44,Fe=4,ft=56,We=8,ke=80,ve=140,Pe=100,Ae=2,gt=8,pt=18;function jt(t){return t.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2)}function vt(t,n){const r=[];for(let o=0;o<n;o++){const i=new Date(t);i.setDate(i.getDate()+o),r.push(i)}return r}function wt(t,n,r){const o=[];return t.forEach((i,a)=>{for(let f=n;f<r;f++)o.push({hour:f,dayIndex:a,date:i})}),o}function Me(t){return`${t.toString().padStart(2,"0")}:00`}function bt(t){return t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function Oe(t){const n=[...t].sort((i,a)=>i.startCol!==a.startCol?i.startCol-a.startCol:a.spanCols-i.spanCols),r=[],o=[];for(const i of n){let a=0;for(;o[a]!==void 0&&o[a]>i.startCol;)a++;o[a]=i.startCol+i.spanCols,r.push({...i,stackIndex:a})}return r}function yt({src:t,alt:n,fallback:r,className:o}){return e.jsx("div",{className:x.cn("relative flex shrink-0 overflow-hidden rounded-sm border bg-muted",o),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:r})})}const kt=7;function fe({daysToShow:t=kt,events:n,users:r=[],selectedDate:o,onDateChange:i,onEventClick:a,onSlotClick:f,onSlotSelect:h,visibleHours:c,className:j,getEventUserId:y,renderPopover:v,slots:H,classNames:A,enableDrag:I=!0}){const W=g.useRef(null),S=ye.useOptionalDragDrop(),[N,F]=g.useState(null),$=g.useRef(!1),[_,C]=g.useState(null),q=o??new Date,L=!0,z=c?.from??gt,V=c?.to??pt,K=V-z,U=g.useMemo(()=>{const s=new Date(q);if(t===1||t===3)return s.setHours(0,0,0,0),s;const l=s.getDay(),m=l===0?-6:1-l;return s.setDate(s.getDate()+m),s.setHours(0,0,0,0),s},[q,t]),P=g.useMemo(()=>vt(U,t),[U,t]),d=g.useMemo(()=>wt(P,z,V),[L,P,z,V]),O=y??(s=>{if(s.resourceId)return s.resourceId;const l=s.data;if(l?.userId)return String(l.userId);if(l?.user&&typeof l.user=="object"&&l.user.id)return String(l.user.id);if(s.user?.id)return s.user.id;if(s.participants?.[0]?.id)return s.participants[0].id}),B=g.useMemo(()=>{const s=new Map;for(const l of r)s.set(l.id,{id:l.id,name:l.name,avatar:l.avatar??void 0,email:l.email});for(const l of n){const w=l.data?.user;w?.id&&!s.has(w.id)&&s.set(w.id,{id:w.id,name:w.name??"",avatar:w.avatar??void 0,email:w.email}),l.user?.id&&!s.has(l.user.id)&&s.set(l.user.id,{id:l.user.id,name:l.user.name,avatar:l.user.avatar??void 0,email:l.user.email});for(const b of l.participants||[])b.id&&!s.has(b.id)&&s.set(b.id,{id:b.id,name:b.name,avatar:b.avatar??void 0,email:b.email})}return Array.from(s.values())},[r,n]),E=g.useMemo(()=>{const s=[],l=new Map;for(const b of B)l.set(b.id,[]);l.set("unassigned",[]);for(const b of n){const M=O(b)??"unassigned";(l.get(M)??l.get("unassigned")).push(b)}const m=b=>{const M=[];for(const T of b){const G=T.startDate.getHours()+T.startDate.getMinutes()/60,Z=T.endDate.getHours()+T.endDate.getMinutes()/60;for(let Y=0;Y<P.length;Y++){const te=P[Y],ce=R.startOfDay(te),de=R.endOfDay(te);if(T.startDate<=de&&T.endDate>=ce){let ue=z,je=V;if(T.startDate>=ce&&(ue=Math.max(z,G)),T.endDate<=de&&(je=Math.min(V,Z)),ue=Math.max(z,Math.min(V,ue)),je=Math.max(z,Math.min(V,je)),je>ue){const ze=Y*K+Math.floor(ue-z),Ke=Y*K+Math.ceil(je-z);M.push({event:T,startCol:ze,spanCols:Math.max(1,Ke-ze)})}}}}return M};for(const b of B){const M=l.get(b.id)??[],T=m(M),G=Oe(T),Z=G.reduce((Y,te)=>Math.max(Y,te.stackIndex+1),0);s.push({user:b,events:G,maxStack:Math.max(Z,1)})}const w=l.get("unassigned")??[];if(w.length>0){const b=m(w),M=Oe(b),T=M.reduce((G,Z)=>Math.max(G,Z.stackIndex+1),0);s.push({user:{id:"unassigned",name:"Unassigned",avatar:void 0,email:void 0},events:M,maxStack:Math.max(T,1)})}return s.filter(b=>b.events.length>0)},[B,n,P,L,K,z,V,O]),ne=g.useMemo(()=>{const s=new Map;for(const l of E)for(const m of l.events)if(m.spanCols===1){const w=s.get(m.startCol)??0;s.set(m.startCol,w+1)}return s},[E]),X=g.useMemo(()=>{const s=d.length,l=ke,m=[];for(let w=0;w<s;w++){const b=ne.get(w)??0;b>Ae?m.push(Pe+(b-Ae)*20):b>0?m.push(Math.max(l,Pe)):m.push(l)}return m},[L,d.length,P.length,ne]),ge=s=>Math.max(ft,s*(De+Fe)+We*2),ee=ve+X.reduce((s,l)=>s+l,0),J=g.useMemo(()=>{const s=[0];for(let l=0;l<X.length;l++)s.push(s[l]+X[l]);return s},[X]);g.useLayoutEffect(()=>{const s=W.current;if(!s)return;const l=()=>{let m=-1;const b=new Date().getHours();{for(let M=0;M<d.length;M++){const T=d[M];if(T&&R.isToday(T.date)&&T.hour<=b&&T.hour+1>b){m=M;break}}if(m===-1)for(let M=0;M<d.length;M++){const T=d[M];if(T&&R.isToday(T.date)){m=M;break}}}if(m!==-1){const M=(J[m]??0)+ve,T=s.clientWidth,G=Math.max(0,M-T/3);s.scrollTo({left:G,behavior:"instant"})}};requestAnimationFrame(()=>{requestAnimationFrame(l)})},[q,d,P,J,L]);const xe=g.useCallback((s,l)=>{const m=l.getBoundingClientRect(),w=s-m.left+l.scrollLeft;for(let b=0;b<J.length-1;b++){const M=J[b],T=J[b+1];if(w>=M&&w<T){const G=(w-M)/(T-M),Z=Math.floor(G*60),Y=Math.round(Z/15)*15;return{colIndex:b,minute:Math.min(Y,45)}}}return null},[J]),re=g.useCallback((s,l)=>{if(d[s]){const m=d[s],w=new Date(m.date);return w.setHours(m.hour,l??0,0,0),{date:w,hour:m.hour}}return{date:new Date}},[L,d,P]),se=g.useCallback((s,l)=>{if(s.preventDefault(),s.dataTransfer.dropEffect="move",!S?.isDragging||!S.dragState)return;const m=s.currentTarget,w=xe(s.clientX,m);if(!w)return;const{colIndex:b,minute:M}=w,{date:T,hour:G}=re(b,M);S.updateDragPreview(T,G,M,l);const{originalStartDate:Z,originalEndDate:Y}=S.dragState,te=Y.getTime()-Z.getTime(),ce=d.length;let de;{const ue=te/36e5;de=Math.max(1,Math.ceil(ue))}de=Math.min(de,ce-b),C({resourceId:l,colIndex:b,spanCols:de})},[S,xe,re,L,d.length,P.length]),pe=g.useCallback(s=>{const l=s.relatedTarget;s.currentTarget.contains(l)||C(null)},[]),le=g.useCallback((s,l)=>{s.preventDefault(),C(null),S?.isDragging&&S.endDrag()},[S]),he=g.useCallback((s,l)=>{if(!N||N.resourceId!==s)return!1;const m=Math.min(N.startCol,N.endCol),w=Math.max(N.startCol,N.endCol);return l>=m&&l<=w},[N]),Q=g.useCallback((s,l)=>!_||_.resourceId!==s?!1:l>=_.colIndex&&l<_.colIndex+_.spanCols,[_]),oe=g.useCallback((s,l,m)=>{m.button!==0&&m.pointerType==="mouse"||(h||f)&&(m.preventDefault(),$.current=!0,F({resourceId:s,startCol:l,endCol:l,isSelecting:!0}))},[h,f]),u=g.useCallback((s,l,m)=>{if($.current&&!(!N||N.resourceId!==s)){if(m.buttons===0){$.current=!1;return}F(w=>w?{...w,endCol:l}:null)}},[N]),D=g.useCallback(()=>{if(!$.current||!N)return;$.current=!1;const s=Math.min(N.startCol,N.endCol),l=Math.max(N.startCol,N.endCol),m=re(s),w=re(l),b=new Date(m.date),M=new Date(w.date);w.hour!==void 0&&M.setHours(w.hour+1,0,0,0);const T={startDate:b,endDate:M,resourceId:N.resourceId};s===l&&f&&f(m.date,m.hour,N.resourceId),h?.(T),F(G=>G?{...G,isSelecting:!1}:null),setTimeout(()=>F(null),150)},[N,re,L,f,h]);return g.useEffect(()=>{const s=()=>{$.current&&D()};return window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[D]),g.useEffect(()=>{S?.isDragging||C(null)},[S?.isDragging]),e.jsx("div",{className:x.cn("flex h-full flex-col",j),children:e.jsx("div",{className:"ic-timeline-scroll-container flex-1",ref:W,children:e.jsxs("div",{className:"relative",style:{minWidth:ee},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:P.map((s,l)=>{const m=R.isToday(s),w=l*K,b=X.slice(w,w+K).reduce((M,T)=>M+T,0);return e.jsx("div",{className:x.cn("flex shrink-0 items-center justify-center border-r py-1.5 font-medium",m?"bg-primary/10 text-primary":"bg-muted/30"),style:{width:b},children:e.jsx("span",{className:"text-xs",children:bt(s)})},`day-${s.toISOString()}`)})}),e.jsx("div",{className:"flex",children:d.map((s,l)=>{const m=s.hour===z,w=R.isToday(s.date),b=X[l]??ke;return e.jsx("div",{className:x.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",m&&l>0?"border-l-2 border-l-border":"border-r border-r-border/50",w&&"bg-primary/5"),style:{width:b},children:Me(s.hour)},`hour-${s.dayIndex}-${s.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"})}),d.map((s,l)=>{const m=s.hour===z,w=R.isToday(s.date),b=X[l]??ke;return e.jsx("div",{className:x.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",m&&l>0?"border-l-2 border-l-border":"border-r border-r-border/50",w&&"bg-primary/5"),style:{width:b},children:Me(s.hour)},`hour-${s.dayIndex}-${s.hour}`)})]})}),E.map(s=>{const l=ge(s.maxStack);return e.jsxs("div",{className:x.cn("relative flex border-b",A?.resourceRow),style:{height:l},children:[e.jsx("div",{className:"sticky left-0 z-10",style:{width:ve},children:e.jsxs("div",{className:x.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(yt,{className:"size-7",src:s.user.avatar,alt:s.user.name,fallback:jt(s.user.name)}),e.jsx("span",{className:"truncate text-xs sm:text-sm font-medium",children:s.user.name})]})}),e.jsxs("div",{className:"ic-timeline-grid relative flex",onDragOver:m=>se(m,s.user.id),onDragLeave:pe,onDrop:m=>le(m,s.user.id),children:[d.map((m,w)=>{const b=m.hour===z&&w>0,M=X[w]??ke,T=he(s.user.id,w),G=Q(s.user.id,w),Z=!!(h||f);return e.jsx("div",{role:Z?"button":void 0,tabIndex:Z?0:void 0,"aria-label":Z?`Select ${Me(m.hour)} on ${m.date.toLocaleDateString()} for ${s.user.name}`:void 0,onPointerDown:Y=>oe(s.user.id,w,Y),onPointerEnter:Y=>u(s.user.id,w,Y),onPointerUp:D,onKeyDown:Y=>{if(Z&&(Y.key==="Enter"||Y.key===" ")){Y.preventDefault();const te=re(w);f?.(te.date,te.hour,s.user.id),h?.({startDate:te.date,endDate:(()=>{const ce=new Date(te.date);return te.hour!==void 0&&ce.setHours(te.hour+1,0,0,0),ce})(),resourceId:s.user.id})}},className:x.cn("shrink-0 select-none touch-none transition-colors",Z&&"cursor-pointer",b?"border-l-2 border-l-border":"border-r border-r-border/50",R.isToday(m.date)&&"bg-primary/5",Z&&!N?.isSelecting&&!S?.isDragging&&"hover:bg-blue-50/60",T&&"bg-blue-100/70",G&&"bg-primary/20 ring-2 ring-primary ring-inset"),style:{width:M}},`cell-${m.dayIndex}-${m.hour}`)}),s.events.map(m=>{const w=(J[m.startCol]??0)+2,b=J[m.startCol+m.spanCols]??J[J.length-1]??0,M=J[m.startCol]??0,T=b-M-4,G=We+m.stackIndex*(De+Fe);return e.jsx("div",{className:"absolute",style:{left:w,width:Math.max(T,0),top:G,height:De},children:e.jsx(p.EventCard,{event:m.event,variant:"compact",enableDrag:I,onClick:a,renderPopover:v,className:x.cn("h-full w-full",A?.eventCardCompact)})},m.event.id)})]})]},s.user.id)}),E.length===0&&e.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:"No users or events to display"})]})})})}const Nt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Ct=["January","February","March","April","May","June","July","August","September","October","November","December"];function Be(t){const n=t.hexColor;return n?{backgroundColor:n}:{}}function Dt({day:t,date:n,events:r,isCurrentMonth:o,onDayClick:i}){const a=R.isToday(n),f=3,h=r.length;return e.jsxs("button",{type:"button",onClick:()=>i?.(n),className:x.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",!o&&"opacity-40"),children:[e.jsx("div",{className:x.cn("flex size-5 sm:size-6 items-center justify-center rounded-full text-[10px] sm:text-xs font-medium",a&&"bg-primary font-semibold text-primary-foreground"),children:t}),h>0&&e.jsx("div",{className:"mt-0.5 flex items-center gap-0.5",children:h<=f?r.map(c=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:Be(c)},c.id)):e.jsxs(e.Fragment,{children:[r.slice(0,f).map(c=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:Be(c)},c.id)),e.jsxs("span",{className:"text-[6px] sm:text-[7px] font-medium text-muted-foreground",children:["+",h-f]})]})})]})}function Mt({date:t,events:n,onMonthClick:r,onDayClick:o}){const i=g.useMemo(()=>R.generateMonthGrid(t,0),[t]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("button",{type:"button",onClick:()=>r?.(t),className:x.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:Ct[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:Nt.map((a,f)=>e.jsxs("div",{className:"text-[9px] sm:text-xs font-medium text-muted-foreground",children:[e.jsx("span",{className:"sm:hidden",children:a[0]}),e.jsx("span",{className:"hidden sm:inline",children:a})]},f))}),e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 gap-y-1",children:i.map((a,f)=>{const h=R.getEventsForDay(n,a.date);return e.jsx(Dt,{day:a.date.getDate(),date:a.date,events:h,isCurrentMonth:a.isCurrentMonth,onDayClick:o},`${f+1}-${a.date.toISOString()}`)})})]})]})}function Ye({events:t,year:n,onMonthClick:r,onDayClick:o,className:i,slots:a,classNames:f}){const h=g.useMemo(()=>R.getYearMonths(n),[n]);return e.jsxs("div",{className:x.cn("flex flex-col h-full",i),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:h.map(c=>e.jsx(Mt,{date:c,events:t,onMonthClick:r,onDayClick:o},c.getMonth()))})})]})}function Tt(t){switch(t){case"day":case"week":return"time";default:return"day"}}function St({onEventClick:t,onSlotClick:n,onSlotSelect:r,onAddEvent:o,className:i,showHeader:a=!0,minSelectionMinutes:f=30,showMoreMode:h,showMoreEventsInPopover:c=!1,isLoading:j=!1,slots:y,classNames:v,settingsContent:H,filterContent:A,headerActions:I,renderPopover:W,calendarRef:S,headerConfig:N,eventDetailMode:F,renderEventDetail:$}){const _=h??(c?"popover":"expand"),{view:C,setView:q,selectedDate:L,setSelectedDate:z,slotDuration:V,filteredEvents:K,users:U,visibleHours:P,workingHours:d,badgeVariant:k,showWorkingHoursOnly:O,clearFocusEventId:B}=ye.useInnoCalendar(),E=g.useMemo(()=>{if(!O||!d)return{startHour:P.start,endHour:P.end};let u=24,D=0;for(const s of Object.keys(d)){const l=d[Number(s)];!l||l.enabled===!1||(l.from<u&&(u=l.from),l.to>D&&(D=l.to))}return u>=D?{startHour:P.start,endHour:P.end}:{startHour:u,endHour:D}},[O,d,P]),ne=E,X=g.useRef(null);g.useImperativeHandle(S,()=>({scrollToToday:()=>{const u=new Date;z(u,C),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const D=X.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!D)return;const m=(u.getHours()-E.startHour)*96;m>0&&D.scrollTo({top:Math.max(0,m-100),behavior:"smooth"})})})},scrollToWorkingHours:()=>{let u=8;if(d)for(const D of Object.keys(d)){const s=d[Number(D)];s?.enabled&&s.from<u&&(u=Math.max(s.from-1,0))}requestAnimationFrame(()=>{requestAnimationFrame(()=>{const D=X.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!D)return;const l=(u-E.startHour)*96;D.scrollTo({top:Math.max(0,l),behavior:"smooth"})})})},getViewRect:()=>X.current?.getBoundingClientRect()??null,focusEvent:u=>{B(),requestAnimationFrame(()=>{B()});const D=X.current?.querySelector(`[data-event-id="${u}"]`);D&&setTimeout(()=>D.click(),150)}}),[z,C,E,d,B]);const ge=g.useMemo(()=>Tt(C),[C]),ee=g.useCallback(u=>{if(r){r(u);return}if(n){const D=u.startDate.getHours();n(u.startDate,D)}},[r,n]),J=g.useCallback(u=>{q("day"),z(u,"day")},[z,q]),xe=g.useCallback(u=>{q("month"),z(u,"month")},[z,q]),re=g.useCallback(u=>{t?.(u)},[t]),se=g.useCallback((u,D,s)=>{n?.(u,D)},[n]),pe=()=>{const u=K,D=re,s=W;switch(C){case"day":return e.jsx(p.DayView,{events:u,date:L,visibleHours:ne,workingHours:d,slotDuration:V,badgeVariant:k,onEventClick:D,renderPopover:s,...y&&{slots:y},...v&&{classNames:v}});case"week":return e.jsx(p.WeekView,{events:u,date:L,visibleHours:ne,workingHours:d,slotDuration:V,badgeVariant:k,onEventClick:D,renderPopover:s,...y&&{slots:y},...v&&{classNames:v}});case"month":return e.jsx(p.MonthView,{events:u,date:L,badgeVariant:k,onEventClick:D,onDayClick:J,renderPopover:s,showMoreMode:_,...y&&{slots:y},...v&&{classNames:v}});case"year":return e.jsx(Ye,{events:u,year:L.getFullYear(),onMonthClick:xe,onDayClick:J,...y&&{slots:y},...v&&{classNames:v}});case"agenda":return e.jsx(p.AgendaView,{events:u,date:L,onEventClick:D,renderPopover:s,...y&&{slots:y},...v&&{classNames:v}});case"resource-day":return e.jsx(fe,{daysToShow:1,events:u,users:U,selectedDate:L,visibleHours:{from:E.startHour,to:E.endHour},onEventClick:D,onSlotSelect:ee,onSlotClick:se,renderPopover:s,...y&&{slots:y},...v&&{classNames:v}});case"resource-week":return e.jsx(fe,{daysToShow:7,events:u,users:U,selectedDate:L,visibleHours:{from:E.startHour,to:E.endHour},onEventClick:D,onSlotSelect:ee,onSlotClick:se,renderPopover:s,...y&&{slots:y},...v&&{classNames:v}});case"timeline-day":return e.jsx(fe,{daysToShow:1,events:u,users:U,selectedDate:L,visibleHours:{from:E.startHour,to:E.endHour},onEventClick:D,onSlotSelect:ee,onSlotClick:se,renderPopover:s,...y&&{slots:y},...v&&{classNames:v}});case"timeline-3day":return e.jsx(fe,{daysToShow:3,events:u,users:U,selectedDate:L,visibleHours:{from:E.startHour,to:E.endHour},onEventClick:D,onSlotSelect:ee,onSlotClick:se,renderPopover:s,...y&&{slots:y},...v&&{classNames:v}});case"timeline-week":return e.jsx(fe,{daysToShow:7,events:u,users:U,selectedDate:L,visibleHours:{from:E.startHour,to:E.endHour},onEventClick:D,onSlotSelect:ee,onSlotClick:se,renderPopover:s,...y&&{slots:y},...v&&{classNames:v}});default:return e.jsx(p.MonthView,{events:u,date:L,badgeVariant:k,onEventClick:D,onDayClick:J,...y&&{slots:y},...v&&{classNames:v}})}},le=g.useRef(null),[he,Q]=g.useState(!1);g.useEffect(()=>{X.current=le.current}),g.useEffect(()=>{const u=le.current;if(!u)return;const D=()=>{const{scrollLeft:m,scrollWidth:w,clientWidth:b}=u;Q(m+b<w-4)};D(),u.addEventListener("scroll",D,{passive:!0});const s=new ResizeObserver(D);s.observe(u);const l=new MutationObserver(D);return l.observe(u,{childList:!0,subtree:!0}),()=>{u.removeEventListener("scroll",D),s.disconnect(),l.disconnect()}},[C]);const oe=g.useCallback(()=>{le.current?.scrollBy({left:300,behavior:"smooth"})},[]);return e.jsx(ye.SlotSelectionProvider,{mode:ge,onSelect:ee,minDurationMinutes:f,slotDurationMinutes:V,enabled:!!(r||n),children:e.jsxs("div",{className:x.cn("inno-calendar-root flex flex-col h-full p-4",v?.root,i),children:[a&&e.jsx(p.CalendarHeader,{currentDate:L,view:C,events:K,onViewChange:q,onNavigateToday:()=>z(new Date,C),onNavigatePrev:()=>{const u=new Date(L);C==="day"||C==="timeline-day"||C==="resource-day"?u.setDate(u.getDate()-1):C==="timeline-3day"?u.setDate(u.getDate()-3):C==="week"||C==="timeline-week"||C==="resource-week"?u.setDate(u.getDate()-7):C==="month"?u.setMonth(u.getMonth()-1):C==="year"?u.setFullYear(u.getFullYear()-1):u.setDate(u.getDate()-7),z(u,C)},onNavigateNext:()=>{const u=new Date(L);C==="day"||C==="timeline-day"||C==="resource-day"?u.setDate(u.getDate()+1):C==="timeline-3day"?u.setDate(u.getDate()+3):C==="week"||C==="timeline-week"||C==="resource-week"?u.setDate(u.getDate()+7):C==="month"?u.setMonth(u.getMonth()+1):C==="year"?u.setFullYear(u.getFullYear()+1):u.setDate(u.getDate()+7),z(u,C)},availableViews:["day","week","month","agenda"],showTimelineViews:!0,showSettings:!!H,...!I&&o&&{onAddEvent:o},actions:I,settingsContent:H,filterContent:A,...N&&{headerConfig:N}}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:le,className:x.cn("h-full border rounded-lg bg-white overflow-x-auto",v?.viewContainer),children:pe()}),j&&e.jsx("div",{className:"inno-calendar-loading-overlay",children:e.jsx("div",{className:"inno-calendar-spinner"})}),he&&e.jsx("button",{type:"button",onClick:oe,className:"inno-scroll-right-btn","aria-label":"Scroll right",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("title",{children:"Scroll right"}),e.jsx("path",{d:"m9 18 6-6-6-6"})]})})]})]})})}function Et({events:t,users:n=[],scheduleTypes:r=[],initialView:o="week",initialDate:i,initialSelectedUserId:a,initialScheduleTypeIds:f,initialParticipantIds:h,initialWorkingHoursView:c,initialSearchQuery:j,preferencesConfig:y,onEventClick:v,onSlotClick:H,onSlotSelect:A,onAddEvent:I,onEventDrop:W,onDateChange:S,onViewChange:N,className:F,showHeader:$=!0,minSelectionMinutes:_=30,showMoreMode:C,showMoreEventsInPopover:q=!1,isLoading:L=!1,renderPopover:z,slots:V,classNames:K,settingsContent:U,filterContent:P,headerActions:d,focusEventId:k,headerConfig:O,eventDetailMode:B,renderEventDetail:E},ne){return e.jsx(ye.DragDropProvider,{...W&&{onEventDrop:W},children:e.jsx(ye.InnoCalendarProvider,{initialEvents:t,initialUsers:n,initialScheduleTypes:r,initialView:o,...i&&{initialDate:i},...a&&{initialSelectedUserId:a},...f&&{initialScheduleTypeIds:f},...h&&{initialParticipantIds:h},...c&&{initialWorkingHoursView:c},...j&&{initialSearchQuery:j},...y&&{preferencesConfig:y},...S&&{onDateChange:S},...N&&{onViewChange:N},...k&&{initialFocusEventId:k},children:e.jsx(St,{...v&&{onEventClick:v},...H&&{onSlotClick:H},...A&&{onSlotSelect:A},...I&&{onAddEvent:I},...z&&{renderPopover:z},className:F,showHeader:$,minSelectionMinutes:_,...C&&{showMoreMode:C},showMoreEventsInPopover:q,isLoading:L,...V&&{slots:V},...K&&{classNames:K},settingsContent:U,filterContent:P,headerActions:d,calendarRef:ne,...O&&{headerConfig:O},...B&&{eventDetailMode:B},...E&&{renderEventDetail:E}})})})}const zt=g.forwardRef(Et),ae=g.forwardRef(({className:t,children:n,...r},o)=>e.jsx("select",{ref:o,className:x.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),...r,children:n}));ae.displayName="Select";const ie=g.forwardRef(({className:t,...n},r)=>e.jsx("label",{ref:r,className:x.cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...n}));ie.displayName="Label";function Ht({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 Lt({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 It=[{value:15,label:"15 minutes"},{value:30,label:"30 minutes"},{value:60,label:"1 hour"}];function Ft({value:t,onChange:n,isLocked:r=!1,className:o,labels:i={}}){const a={title:"Slot duration",lockedMessage:"This setting is locked by the administrator",infoMessage:"Set the time slot duration for day and week calendar views.",...i},f=h=>{r||n(Number(h.target.value))};return e.jsxs("div",{className:x.cn("flex flex-col gap-3",o),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"text-sm font-semibold",children:a.title}),r?e.jsx(p.TooltipProvider,{delayDuration:100,children:e.jsxs(p.Tooltip,{children:[e.jsx(p.TooltipTrigger,{children:e.jsx(Lt,{className:"size-3 text-muted-foreground"})}),e.jsx(p.TooltipContent,{children:e.jsx("p",{children:a.lockedMessage})})]})}):e.jsx(p.TooltipProvider,{delayDuration:100,children:e.jsxs(p.Tooltip,{children:[e.jsx(p.TooltipTrigger,{children:e.jsx(Ht,{className:"size-3 text-muted-foreground"})}),e.jsx(p.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:a.infoMessage})})]})})]}),e.jsx(ae,{value:t.toString(),onChange:f,disabled:r,className:"h-9 w-[128px] text-sm",children:It.map(h=>e.jsx("option",{value:h.value.toString(),children:h.label},h.value))})]})}function Wt({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 Pt({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 At=[{value:"dot",label:"Dot indicator"},{value:"colored",label:"Full color"},{value:"mixed",label:"Mixed"}];function Ot({value:t,onChange:n,isLocked:r=!1,className:o,labels:i={}}){const a={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"},...i},f=c=>a.options?.[c]??c,h=c=>{r||n(c.target.value)};return e.jsxs("div",{className:x.cn("flex flex-col gap-3",o),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"text-sm font-semibold",children:a.title}),r?e.jsx(p.TooltipProvider,{delayDuration:100,children:e.jsxs(p.Tooltip,{children:[e.jsx(p.TooltipTrigger,{children:e.jsx(Pt,{className:"size-3 text-muted-foreground"})}),e.jsx(p.TooltipContent,{children:e.jsx("p",{children:a.lockedMessage})})]})}):e.jsx(p.TooltipProvider,{delayDuration:100,children:e.jsxs(p.Tooltip,{children:[e.jsx(p.TooltipTrigger,{children:e.jsx(Wt,{className:"size-3 text-muted-foreground"})}),e.jsx(p.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:a.infoMessage})})]})})]}),e.jsx(ae,{value:t,onChange:h,disabled:r,className:"h-9 w-[128px] text-sm",children:At.map(c=>e.jsx("option",{value:c.value,children:f(c.value)},c.value))})]})}function Bt({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 $t({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 Rt(){return Array.from({length:25},(t,n)=>({value:n,label:`${String(n).padStart(2,"0")}:00`}))}function _t({value:t,onChange:n,isLocked:r=!1,className:o,labels:i={}}){const a={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.",...i},f=Rt(),h=j=>{if(r)return;const y=Number(j.target.value);y<t.endHour&&n({...t,startHour:y})},c=j=>{if(r)return;const y=Number(j.target.value);y>t.startHour&&n({...t,endHour:y})};return e.jsxs("div",{className:x.cn("flex flex-col gap-3",o),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"text-sm font-semibold",children:a.title}),r?e.jsx(p.TooltipProvider,{delayDuration:100,children:e.jsxs(p.Tooltip,{children:[e.jsx(p.TooltipTrigger,{children:e.jsx($t,{className:"size-3 text-muted-foreground"})}),e.jsx(p.TooltipContent,{children:e.jsx("p",{children:a.lockedMessage})})]})}):e.jsx(p.TooltipProvider,{delayDuration:100,children:e.jsxs(p.Tooltip,{children:[e.jsx(p.TooltipTrigger,{children:e.jsx(Bt,{className:"size-3 text-muted-foreground"})}),e.jsx(p.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:a.infoMessage})})]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(ie,{className:"text-xs text-muted-foreground",children:a.from}),e.jsx(ae,{value:t.startHour.toString(),onChange:h,disabled:r,className:"h-9 w-[88px] text-sm",children:f.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(ie,{className:"text-xs text-muted-foreground",children:a.to}),e.jsx(ae,{value:t.endHour.toString(),onChange:c,disabled:r,className:"h-9 w-[88px] text-sm",children:f.map(j=>e.jsx("option",{value:j.value.toString(),disabled:j.value<=t.startHour,children:j.label},j.value))})]})]})]})}function Vt({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 Ut({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 Gt({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 Yt=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];function qt(){return Array.from({length:25},(t,n)=>({value:n,label:`${String(n).padStart(2,"0")}:00`}))}const $e={sunday:"Sun",monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat"};function Kt({dayLabel:t,config:n,onChange:r,disabled:o,hourOptions:i}){const a=()=>{o||r({...n,enabled:!n.enabled})},f=c=>{if(o)return;const j=Number(c.target.value);j<n.to&&r({...n,from:j})},h=c=>{if(o)return;const j=Number(c.target.value);j>n.from&&r({...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:a,disabled:o,className:x.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",o&&"cursor-not-allowed opacity-50"),children:n.enabled&&e.jsx(Gt,{className:"size-3"})}),e.jsx("span",{className:x.cn("w-10 text-sm",!n.enabled&&"text-muted-foreground"),children:t}),e.jsx(ae,{value:n.from.toString(),onChange:f,disabled:o||!n.enabled,className:"h-8 w-[76px] text-xs",children:i.map(c=>e.jsx("option",{value:c.value.toString(),disabled:c.value>=n.to,children:c.label},c.value))}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"—"}),e.jsx(ae,{value:n.to.toString(),onChange:h,disabled:o||!n.enabled,className:"h-8 w-[76px] text-xs",children:i.map(c=>e.jsx("option",{value:c.value.toString(),disabled:c.value<=n.from,children:c.label},c.value))})]})}function Jt({value:t,onChange:n,isLocked:r=!1,className:o,labels:i={}}){const a={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:$e,...i},f=qt(),h=(c,j)=>{r||n({...t,[c]:j})};return e.jsxs("div",{className:x.cn("flex flex-col gap-3",o),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"text-sm font-semibold",children:a.title}),r?e.jsx(p.TooltipProvider,{delayDuration:100,children:e.jsxs(p.Tooltip,{children:[e.jsx(p.TooltipTrigger,{children:e.jsx(Ut,{className:"size-3 text-muted-foreground"})}),e.jsx(p.TooltipContent,{children:e.jsx("p",{children:a.lockedMessage})})]})}):e.jsx(p.TooltipProvider,{delayDuration:100,children:e.jsxs(p.Tooltip,{children:[e.jsx(p.TooltipTrigger,{children:e.jsx(Vt,{className:"size-3 text-muted-foreground"})}),e.jsx(p.TooltipContent,{className:"max-w-64 text-center",children:e.jsx("p",{children:a.infoMessage})})]})})]}),e.jsx("div",{className:"flex flex-col gap-2",children:Yt.map(c=>e.jsx(Kt,{dayLabel:a.days?.[c]??$e[c],config:t[c],onChange:j=>h(c,j),disabled:r,hourOptions:f},c))})]})}const Xt={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 Te({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 Qt({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 Zt({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 Se({checked:t,onCheckedChange:n,className:r,children:o}){return e.jsx("button",{type:"button",role:"checkbox","aria-checked":t,onClick:()=>n(!t),className:r,children:o})}function en({src:t,alt:n,fallback:r,className:o}){const[i,a]=g.useState(!1);return!t||i?e.jsx("div",{className:x.cn("flex items-center justify-center bg-zinc-200 text-zinc-600 font-medium text-sm",o),children:r||"?"}):e.jsx("img",{src:t,alt:n||"",className:x.cn("object-cover",o),onError:()=>a(!0)})}function Re({value:t,onChange:n,placeholder:r,className:o}){return e.jsxs("div",{className:x.cn("relative",o),children:[e.jsx(Qt,{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:i=>n(i.target.value),placeholder:r,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 _e(t,n,r,o=.3){if(!n.trim())return t;const i=n.toLowerCase();return t.filter(a=>r(a).some(h=>h?h.toLowerCase().includes(i):!1))}const tn={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 nn({scheduleTypes:t,users:n,selectedScheduleTypeIds:r,onScheduleTypeChange:o,selectedUserIds:i,onUserChange:a,onClearAll:f,className:h,scheduleTypesLoading:c=!1,usersLoading:j=!1,labels:y,getScheduleTypeName:v}){const H={...tn,...y},[A,I]=g.useState(""),[W,S]=g.useState(""),N=g.useMemo(()=>A.trim()?_e(t,A,d=>[d.name,v?.(d)||d.name]):t,[t,A,v]),F=g.useMemo(()=>W.trim()?_e(n,W,d=>[d.name,d.email||""]):n,[n,W]),$=N.length>0&&N.every(d=>r.includes(d.id)),_=F.length>0&&F.every(d=>i.includes(d.id)),C=r.length+i.length,q=(d,k)=>{const O=k?[...r,d]:r.filter(B=>B!==d);o(O)},L=()=>{if($){const d=new Set(N.map(k=>k.id));o(r.filter(k=>!d.has(k)))}else{const d=new Set([...r,...N.map(k=>k.id)]);o(Array.from(d))}},z=(d,k)=>{const O=k?[...i,d]:i.filter(B=>B!==d);a(O)},V=()=>{if(_){const d=new Set(F.map(k=>k.id));a(i.filter(k=>!d.has(k)))}else{const d=new Set([...i,...F.map(k=>k.id)]);a(Array.from(d))}},K=()=>{o([]),a([]),f?.()},U=d=>v?v(d):d.name,P=d=>d.colorHex||d.color||"#069AD7";return e.jsxs("div",{className:x.cn("flex min-w-72 max-w-72 flex-col rounded-lg border bg-white shadow-sm",h),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:H.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:H.subtitle})]}),C>0&&e.jsxs("button",{type:"button",onClick:K,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(Zt,{className:"h-3.5 w-3.5"}),H.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:H.scheduleTypes}),e.jsx("button",{type:"button",onClick:L,className:"text-xs font-medium text-primary transition-colors hover:text-primary/80",children:$?H.unselectAll:H.selectAll})]}),t.length>6&&e.jsx("div",{className:"px-4 pb-3",children:e.jsx(Re,{value:A,onChange:I,placeholder:H.searchScheduleTypes})}),e.jsxs("div",{className:"flex max-h-[220px] flex-col gap-2 overflow-y-auto px-4 pb-2 scrollbar-thin",children:[c?Array.from({length:4}).map((d,k)=>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-${k}`)):N.map(d=>{const k=r.includes(d.id),O=P(d);return e.jsxs(Se,{checked:k,onCheckedChange:B=>q(d.id,B),className:x.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",k&&"border-primary bg-primary/5"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:x.cn("flex h-4 w-4 items-center justify-center rounded border border-border text-xs transition-colors",k&&"border-primary bg-primary text-primary-foreground"),children:k&&e.jsx(Te,{className:"h-3 w-3"})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:U(d)})]}),e.jsx("div",{className:"h-4 w-4 rounded-full border",style:{backgroundColor:O,borderColor:O}})]},d.id)}),!c&&N.length===0&&e.jsx("p",{className:"px-2 py-1 text-xs text-muted-foreground",children:H.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:H.participants}),e.jsx(Se,{checked:_,onCheckedChange:()=>V(),className:x.cn("flex h-5 w-5 items-center justify-center rounded border border-border bg-white transition-colors hover:border-primary/50",_&&"border-primary bg-primary text-primary-foreground"),children:_&&e.jsx(Te,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx(Re,{value:W,onChange:S,placeholder:H.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((d,k)=>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-${k}`)):F.map(d=>{const k=i.includes(d.id);return e.jsxs(Se,{checked:k,onCheckedChange:O=>z(d.id,O),className:x.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",k&&"border-primary bg-zinc-50"),children:[e.jsx("span",{className:x.cn("flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border border-border transition-colors",k&&"border-primary bg-primary text-primary-foreground"),children:k&&e.jsx(Te,{className:"h-2.5 w-2.5"})}),e.jsxs("div",{className:"flex flex-1 items-start gap-2",children:[e.jsx(en,{src:d.avatar??null,alt:d.name,fallback:d.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:d.name}),e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:d.email,children:d.email})]})]})]},d.id)}),!j&&F.length===0&&e.jsx("p",{className:"px-4 text-xs text-muted-foreground",children:H.noParticipants})]})]})]})}function rn({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 sn({scheduleTypes:t,value:n,onChange:r,allLabel:o="All types",className:i,label:a}){const f=c=>{r(c.target.value)},h=t.find(c=>String(c.id)===n);return e.jsxs("div",{className:x.cn("flex flex-col gap-1",i),children:[a&&e.jsx(ie,{className:"text-xs text-muted-foreground",children:a}),e.jsxs("div",{className:"relative",children:[h?e.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 size-3 -translate-y-1/2 rounded-full",style:{backgroundColor:h.color}}):e.jsx(rn,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(ae,{value:n,onChange:f,className:"h-9 w-full min-w-[140px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:o}),t.map(c=>e.jsx("option",{value:String(c.id),children:c.label},c.id))]})]})]})}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("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 an({users:t,value:n,onChange:r,allLabel:o="All users",className:i,label:a}){const f=h=>{r(h.target.value)};return e.jsxs("div",{className:x.cn("flex flex-col gap-1",i),children:[a&&e.jsx(ie,{className:"text-xs text-muted-foreground",children:a}),e.jsxs("div",{className:"relative",children:[e.jsx(on,{className:"pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsxs(ae,{value:n,onChange:f,className:"h-9 w-full min-w-[120px] pl-8 pr-8 text-sm",children:[e.jsx("option",{value:"all",children:o}),t.map(h=>e.jsx("option",{value:h.id,children:h.name},h.id))]})]})]})}function ln({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 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:"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 dn({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 un({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 xn(t){const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${n}-${r}-${o}`}function Ve(t){const n=t.getHours(),r=t.getMinutes(),o=n>=12?"PM":"AM",i=n%12||12,a=String(r).padStart(2,"0");return`${i}:${a} ${o}`}function hn(t){const n=Ve(t.startDate),r=Ve(t.endDate);return`${n} - ${r}`}function mn(t){const n=R.addDays(new Date,1);return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function fn(t){if(R.isToday(t))return"Today";if(mn(t))return"Tomorrow";const n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],o=n[t.getDay()],i=r[t.getMonth()],a=t.getDate();return`${o}, ${i} ${a}`}function gn(t,n){const r=new Map;for(const o of t){const i=xn(o.startDate),a=r.get(i)??[];a.push(o),r.set(i,a)}return Array.from(r.entries()).map(([o,i])=>{const a=[...i].sort((h,c)=>h.startDate.getTime()-c.startDate.getTime()),f=n>0?a.slice(0,n):a;return{date:new Date(o),dateKey:o,events:f,hasMore:n>0&&a.length>n}}).sort((o,i)=>o.date.getTime()-i.date.getTime())}function pn(t){const n=R.startOfDay(new Date),r=R.endOfDay(new Date);return t.filter(o=>o.startDate>=n&&o.startDate<=r).length}function Ee({className:t}){return e.jsx("div",{className:x.cn("animate-pulse rounded-md bg-muted",t)})}function jn({event:t,onClick:n}){return e.jsxs("button",{type:"button",onClick:()=>n?.(t),className:x.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:hn(t)})]}),n&&e.jsx(dn,{className:"shrink-0 size-4 text-muted-foreground/50 mt-1"})]})}function vn({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:x.cn("text-xs font-semibold",R.isToday(t.date)&&"text-primary"),children:fn(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(r=>e.jsx(jn,{event:r,onClick:n},r.id))})]})}function wn({events:t,isLoading:n=!1,className:r,daysAhead:o=7,maxEventsPerDay:i=3,onEventClick:a,onNavigateToAgenda:f}){const[h,c]=g.useState(!1),j=g.useMemo(()=>{const I=R.startOfDay(new Date),W=R.addDays(I,o);return t.filter(S=>S.endDate>=I&&S.startDate<W)},[t,o]),y=g.useMemo(()=>gn(j,i),[j,i]),v=g.useMemo(()=>pn(t),[t]),H=I=>{c(!1),a?.(I)},A=()=>{c(!1),f?.()};return e.jsxs(p.Popover,{open:h,onOpenChange:c,children:[e.jsxs(p.PopoverTrigger,{className:x.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",r),children:[e.jsx(ln,{className:"h-4 w-4"}),v>0&&e.jsx(p.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:v>99?"99+":v})]}),e.jsxs(p.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:v>0?`${v} event${v>1?"s":""} today`:"No events today"})]}),f&&e.jsxs("button",{type:"button",onClick:A,className:"text-xs text-primary hover:underline flex items-center gap-1",children:["View all",e.jsx(un,{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((I,W)=>e.jsxs("div",{className:"flex space-x-3",children:[e.jsx(Ee,{className:"h-2 w-2 rounded-full mt-2"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Ee,{className:"h-4 w-full"}),e.jsx(Ee,{className:"h-3 w-3/4"})]})]},W))}):y.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(cn,{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 ",o," days"]})]}):e.jsx("div",{className:"space-y-3 divide-y",children:y.map(I=>e.jsx(vn,{group:I,onEventClick:H},I.dateKey))})})]})]})}function bn({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 yn(t){const n=new Date;return n.setDate(n.getDate()+1),t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Ue(t){const n=t.getHours(),r=t.getMinutes(),o=n>=12?"PM":"AM";return`${n%12||12}:${r.toString().padStart(2,"0")} ${o}`}function kn(t){return new Intl.DateTimeFormat("en-US",{weekday:"long",month:"short",day:"numeric"}).format(t)}function Nn(t){const n=Ue(t.startDate),r=Ue(t.endDate);return`${n} - ${r}`}function Cn(t){return R.isToday(t)?"Today":yn(t)?"Tomorrow":kn(t)}function Dn(t,n){const r=new Map;for(const o of t){const i=R.formatDateISO(o.startDate),a=r.get(i)??[];a.push(o),r.set(i,a)}return Array.from(r.entries()).map(([o,i])=>{const a=[...i].sort((h,c)=>h.startDate.getTime()-c.startDate.getTime()),f=n>0?a.slice(0,n):a;return{date:new Date(o),dateKey:o,events:f,hasMore:n>0&&a.length>n}}).sort((o,i)=>o.date.getTime()-i.date.getTime())}function Mn({event:t,onClick:n,compact:r}){return e.jsxs("button",{type:"button",onClick:()=>n?.(t),className:x.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",r?"p-2":"p-3"),children:[e.jsx("div",{className:x.cn("shrink-0 rounded-full mt-1",r?"size-2":"size-2.5"),style:{backgroundColor:t.color??"#3b82f6"}}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:x.cn("font-medium truncate",r?"text-xs":"text-sm"),children:t.title}),e.jsx("p",{className:x.cn("text-muted-foreground truncate",r?"text-[10px]":"text-xs"),children:Nn(t)})]}),n&&e.jsx(qe,{className:x.cn("shrink-0 text-muted-foreground/50",r?"size-3":"size-4")})]})}function Tn({group:t,onEventClick:n,onViewMore:r,compact:o}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:x.cn("flex items-center justify-between px-2",o?"py-1":"py-1.5"),children:[e.jsx("h3",{className:x.cn("font-semibold",o?"text-xs":"text-sm",R.isToday(t.date)&&"text-primary"),children:Cn(t.date)}),t.hasMore&&r&&e.jsx("button",{type:"button",onClick:()=>r(t.date),className:x.cn("text-primary hover:underline",o?"text-[10px]":"text-xs"),children:"+more"})]}),e.jsx("div",{className:"space-y-0.5",children:t.events.map(i=>e.jsx(Mn,{event:i,onClick:n,compact:o},i.id))})]})}function Sn({events:t,daysAhead:n=7,maxEventsPerDay:r=3,onEventClick:o,onViewAll:i,className:a,emptyState:f,title:h="Upcoming",showHeader:c=!0,compact:j=!1}){const y=Ne.useOptionalCalendarContext(),v=y?.filteredEvents,H=y?.currentDate??new Date,A=t??v??[],I=g.useMemo(()=>{const N=R.startOfDay(H),F=new Date(N);return F.setDate(F.getDate()+n),A.filter($=>$.endDate>=N&&$.startDate<F)},[A,n,H]),W=g.useMemo(()=>Dn(I,r),[I,r]),S=I.length;return W.length===0?e.jsxs("div",{className:x.cn("rounded-lg border bg-card",a),children:[c&&e.jsx("div",{className:x.cn("border-b px-4 flex items-center justify-between",j?"py-2":"py-3"),children:e.jsx("h2",{className:x.cn("font-semibold",j?"text-sm":"text-base"),children:h})}),e.jsx("div",{className:x.cn("flex flex-col items-center justify-center text-center",j?"py-6 px-4":"py-10 px-6"),children:f??e.jsxs(e.Fragment,{children:[e.jsx(bn,{className:x.cn("text-muted-foreground/50 mb-2",j?"size-8":"size-10")}),e.jsx("p",{className:x.cn("text-muted-foreground",j?"text-xs":"text-sm"),children:"No upcoming events"})]})})]}):e.jsxs("div",{className:x.cn("rounded-lg border bg-card overflow-hidden",a),children:[c&&e.jsxs("div",{className:x.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:x.cn("font-semibold",j?"text-sm":"text-base"),children:h}),e.jsx("span",{className:x.cn("text-muted-foreground bg-muted rounded-full px-2",j?"text-[10px] py-0":"text-xs py-0.5"),children:S})]}),i&&e.jsxs("button",{type:"button",onClick:()=>i(),className:x.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:x.cn("divide-y overflow-auto",j?"p-2 max-h-[280px]":"p-3 max-h-[400px]"),children:W.map(N=>e.jsx(Tn,{group:N,onEventClick:o,onViewMore:i?F=>i(F):void 0,compact:j},N.dateKey))})]})}exports.AgendaDropdown=wn;exports.AgendaWidget=Sn;exports.BadgeVariantSetting=Ot;exports.Calendar=Xe;exports.CalendarFilterSidebar=nn;exports.DEFAULT_WEEK_WORKING_HOURS=Xt;exports.EventPopover=mt;exports.InnoCalendar=zt;exports.ScheduleTypeFilter=sn;exports.SlotDurationSetting=Ft;exports.TimelineView=fe;exports.UserFilter=an;exports.VisibleHoursSetting=_t;exports.WorkingHoursSetting=Jt;exports.YearView=Ye;
|
|
2
|
+
//# sourceMappingURL=agenda-widget-CcvTi51_.cjs.map
|