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