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