@innosolutions/inno-calendar 2.0.1 → 2.0.2
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/components/index.cjs +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/components/inno-calendar.d.ts.map +1 -1
- package/dist/components/shell/calendar-sidebar.d.ts +4 -1
- package/dist/components/shell/calendar-sidebar.d.ts.map +1 -1
- package/dist/components/shell/mini-month.d.ts +4 -7
- package/dist/components/shell/mini-month.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/inno-calendar-B3IO5ulf.cjs +11 -0
- package/dist/inno-calendar-B3IO5ulf.cjs.map +1 -0
- package/dist/{inno-calendar-R7LPGSJU.js → inno-calendar-Cw85molF.js} +1211 -1189
- package/dist/inno-calendar-Cw85molF.js.map +1 -0
- package/package.json +1 -1
- package/dist/inno-calendar-DFEaWcSi.cjs +0 -11
- package/dist/inno-calendar-DFEaWcSi.cjs.map +0 -1
- package/dist/inno-calendar-R7LPGSJU.js.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),o=require("react"),c=require("./utils-IjLH3w2e.cjs"),y=require("./position-utils-BVt-Bp93.cjs"),un=require("class-variance-authority"),Le=require("lucide-react"),Tt=require("react-dom"),ue=require("./z-layers-D1DivrJg.cjs"),Un=require("@radix-ui/react-dropdown-menu"),Bn=require("@radix-ui/react-popover"),qn=require("@radix-ui/react-dialog"),Vn=require("@radix-ui/react-tooltip");function Qe(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>t[s]})}}return n.default=t,Object.freeze(n)}const ye=Qe(o),me=Qe(Un),We=Qe(Bn),ve=Qe(qn),Ze=Qe(Vn),mn=o.createContext(null);function Yn({render:t,children:n}){return e.jsx(mn.Provider,{value:t,children:n})}function Gn(){return o.useContext(mn)}const Ie=We.Root,Re=We.Trigger,Kn=We.Anchor,Te=ye.forwardRef(({className:t,align:n="center",sideOffset:s=4,...r},a)=>e.jsx(We.Portal,{children:e.jsx(We.Content,{ref:a,align:n,sideOffset:s,className:c.cn("z-50 w-72 rounded-xl border bg-white text-popover-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));Te.displayName=We.Content.displayName;const Lt=ve.Root,It=ve.Trigger,Xn=ve.Close,Jn=ve.Portal,xn=ye.forwardRef(({className:t,...n},s)=>e.jsx(ve.Overlay,{className:c.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n,ref:s}));xn.displayName=ve.Overlay.displayName;const ft=ye.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(Jn,{children:[e.jsx(xn,{}),e.jsxs(ve.Content,{ref:r,className:c.cn("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500","inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",t),...s,children:[n,e.jsxs(ve.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(Le.X,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ft.displayName="SheetContent";const fn=({className:t,...n})=>e.jsx("div",{className:c.cn("flex flex-col space-y-2 text-center sm:text-left",t),...n});fn.displayName="SheetHeader";const ht=ye.forwardRef(({className:t,...n},s)=>e.jsx(ve.Title,{ref:s,className:c.cn("text-lg font-semibold text-foreground",t),...n}));ht.displayName=ve.Title.displayName;const hn=ye.forwardRef(({className:t,...n},s)=>e.jsx(ve.Description,{ref:s,className:c.cn("text-sm text-muted-foreground",t),...n}));hn.displayName=ve.Description.displayName;const Se=Ze.Provider,De=Ze.Root,Ce=Ze.Trigger,be=ye.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(Ze.Content,{ref:r,sideOffset:n,className:c.cn("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));be.displayName=Ze.Content.displayName;const Qn="Event details";function Zn(){const[t,n]=o.useState(typeof window<"u"&&window.innerWidth<y.COMPACT_WIDTH);return o.useEffect(()=>{const s=()=>n(window.innerWidth<y.COMPACT_WIDTH);return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),t}const zt=t=>{t.target?.closest?.(y.PORTALLED)&&t.preventDefault()};function Rt({open:t,onOpenChange:n,trigger:s,children:r}){return Zn()?e.jsxs(Lt,{open:t,onOpenChange:n,children:[e.jsx(It,{asChild:!0,children:s}),e.jsxs(ft,{className:c.cn("inset-x-0 inset-y-auto bottom-0 flex h-auto max-h-[85dvh] w-full","max-w-none flex-col rounded-t-xl border-l-0 border-t p-0","data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"),children:[e.jsx(ht,{className:"sr-only",children:Qn}),r]})]}):e.jsxs(Ie,{open:t,onOpenChange:n,children:[e.jsx(Re,{asChild:!0,children:s}),e.jsx(Te,{side:"right",align:"start",sideOffset:8,collisionPadding:12,onFocusOutside:zt,onPointerDownOutside:zt,className:c.cn("flex max-h-[var(--radix-popover-content-available-height)] w-96","max-w-[calc(100vw-1.5rem)] flex-col overflow-hidden p-0"),children:r})]})}function es(t,n){return y.formatClockCompact(t,{locale:n})}function He(t){return{blue:{bg:"bg-blue-50 dark:bg-blue-950/30",text:"text-blue-700 dark:text-blue-300",dot:"bg-blue-500",dotFill:"fill-blue-600 dark:fill-blue-500",border:"border-blue-400 dark:border-blue-600"},green:{bg:"bg-green-50 dark:bg-green-950/30",text:"text-green-700 dark:text-green-300",dot:"bg-green-500",dotFill:"fill-green-600 dark:fill-green-500",border:"border-green-400 dark:border-green-600"},red:{bg:"bg-red-50 dark:bg-red-950/30",text:"text-red-700 dark:text-red-300",dot:"bg-red-500",dotFill:"fill-red-600 dark:fill-red-500",border:"border-red-400 dark:border-red-600"},yellow:{bg:"bg-yellow-50 dark:bg-yellow-950/30",text:"text-yellow-700 dark:text-yellow-300",dot:"bg-yellow-500",dotFill:"fill-yellow-600 dark:fill-yellow-500",border:"border-yellow-400 dark:border-yellow-600"},purple:{bg:"bg-purple-50 dark:bg-purple-950/30",text:"text-purple-700 dark:text-purple-300",dot:"bg-purple-500",dotFill:"fill-purple-600 dark:fill-purple-500",border:"border-purple-400 dark:border-purple-600"},orange:{bg:"bg-orange-50 dark:bg-orange-950/30",text:"text-orange-700 dark:text-orange-300",dot:"bg-orange-500",dotFill:"fill-orange-600 dark:fill-orange-500",border:"border-orange-400 dark:border-orange-600"},pink:{bg:"bg-pink-50 dark:bg-pink-950/30",text:"text-pink-700 dark:text-pink-300",dot:"bg-pink-500",dotFill:"fill-pink-600 dark:fill-pink-500",border:"border-pink-400 dark:border-pink-600"},teal:{bg:"bg-teal-50 dark:bg-teal-950/30",text:"text-teal-700 dark:text-teal-300",dot:"bg-teal-500",dotFill:"fill-teal-600 dark:fill-teal-500",border:"border-teal-400 dark:border-teal-600"},gray:{bg:"bg-gray-50 dark:bg-gray-950/30",text:"text-gray-700 dark:text-gray-300",dot:"bg-gray-500",dotFill:"fill-gray-600 dark:fill-gray-500",border:"border-gray-400 dark:border-gray-600"},indigo:{bg:"bg-indigo-50 dark:bg-indigo-950/30",text:"text-indigo-700 dark:text-indigo-300",dot:"bg-indigo-500",dotFill:"fill-indigo-600 dark:fill-indigo-500",border:"border-indigo-400 dark:border-indigo-600"}}[t??"blue"]}function pn(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function Je({event:t,variant:n="full",badgeVariant:s="colored",onClick:r,className:a,showTime:l=!0,showDescription:i=!1,showParticipants:x=!1,style:d,disablePopover:f=!1,renderPopover:M,enableDrag:v=!1,enablePageTransition:u=!1,pageTransitionDuration:k=400}){const E=He(t.color),[D,C]=o.useState(!1),[S,g]=o.useState(!1),[b,_]=o.useState(!1),[U,I]=o.useState(null),T=o.useRef(null),j=ue.useOptionalDragDrop(),L=ue.useOptionalInnoCalendar();o.useEffect(()=>{if(!f&&L?.focusEventId&&L.focusEventId===t.id){const Q=setTimeout(()=>{C(!0),L.clearFocusEventId()},300);return()=>clearTimeout(Q)}},[L?.focusEventId,t.id,f]);const O=t.endDate<pn(new Date),N=t.isCanceled??!1,R=v&&j&&!N&&!O,P=t.data,H=P?.meetingTookPlace??t.meetingTookPlace??!1,m=N?e.jsx(ns,{className:"h-3 w-3 text-zinc-800 dark:text-zinc-200"}):H?e.jsx(ts,{className:c.cn("h-3 w-3",E.text)}):null,$=P?.productName,h=P?.extendedProps,W=P?.nrParticipant,B=P?.siteName,F=P?.siteCity,Y=!!B||!!F,se=o.useCallback(()=>{if(!S){if(f&&r){r(t);return}if(u&&T.current){const Q=T.current.getBoundingClientRect();I(Q),_(!0)}else f||C(!0)}},[S,f,r,t,u]);o.useCallback(()=>{_(!1),I(null),f||C(!0)},[f]);const J=o.useCallback(()=>{C(!1)},[]),K=o.useCallback(Q=>{R&&(Q.dataTransfer.effectAllowed="move",Q.dataTransfer.setData("text/plain",t.id),g(!0),j?.startDrag?.(t))},[R,t,j]),ne=o.useCallback(()=>{g(!1),j?.isDragging&&j.endDrag?.()},[j]),oe=M?.({event:t,onClose:J}),ee=Q=>e.jsx(Rt,{open:D,onOpenChange:C,trigger:Q,children:e.jsx("div",{className:c.cn("flex min-h-0 flex-1 flex-col",!M&&"p-4"),children:oe})});if(n==="dot"){const Q=e.jsx("button",{type:"button",onClick:se,className:c.cn("size-2 rounded-full cursor-pointer transition-opacity",E.dot,t.isCanceled&&"opacity-50",a),style:d,"aria-label":y.reactNodeToText(t.title)});return f?e.jsx(Se,{delayDuration:300,children:e.jsxs(De,{children:[e.jsx(Ce,{asChild:!0,children:Q}),e.jsx(be,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs opacity-80",children:y.formatEventTimeDisplay(t)})]})})]})}):ee(e.jsx(Se,{delayDuration:300,children:e.jsxs(De,{children:[e.jsx(Ce,{asChild:!0,children:Q}),e.jsx(be,{children:e.jsx("div",{className:"font-medium",children:t.title})})]})}))}if(n==="compact"){const Q=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!R,onDragStart:K,onDragEnd:ne,onClick:f?se:void 0,onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),se())},className:c.cn("group flex w-full relative items-center shadow-[0_0_1px_rgba(0,0,0,0.3)] gap-0 rounded px-1.5 py-1 text-left text-xs transition-colors hover:opacity-80",R?"cursor-grab active:cursor-grabbing":"cursor-pointer",S&&"opacity-50",N?y.CANCELED_CHIP:[s==="colored"&&[E.bg,E.text],s==="mixed"&&[E.bg,E.text],s==="dot"&&"bg-muted/50"],a),style:d,children:[["dot","mixed"].includes(s)&&!N&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot absolute -top-1 -left-1 shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:E.dotFill})}),e.jsx("span",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsxs("span",{className:"",children:[e.jsx("span",{className:"relative block overflow-hidden whitespace-nowrap text-xs leading-tight",style:{maskImage:"linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)",WebkitMaskImage:"linear-gradient(to right, transparent 0, black 8px, black calc(100% - 8px), transparent 100%)"},children:e.jsxs("span",{className:"inline-flex event-marquee",children:[e.jsx("span",{className:"shrink-0 px-1",children:t.title}),e.jsx("span",{className:"shrink-0 px-1",children:"•"}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 px-1",children:t.title}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 px-1",children:"•"})]})}),e.jsx("div",{className:c.cn("w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",E.border),children:y.formatEventTimeDisplay(t)})]})}),e.jsx("div",{className:"flex gap-0.5",children:m})]});return f?e.jsx(Se,{delayDuration:300,children:e.jsxs(De,{children:[e.jsx(Ce,{asChild:!0,children:Q}),e.jsx(be,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})})]})}):ee(Q)}const fe=e.jsxs("button",{type:"button",onClick:se,className:c.cn("group relative flex w-full flex-col gap-1 rounded-md px-2 py-1.5 text-left","ring-1 ring-inset ring-black/[0.06] dark:ring-white/10","transition-shadow hover:shadow-[0_1px_4px_rgba(0,0,0,0.12)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",N?y.CANCELED_CHIP:[s==="colored"&&[E.bg,E.text],s==="mixed"&&[E.bg,E.text],s==="dot"&&"bg-muted/50"],a),style:d,children:[e.jsxs("div",{className:"flex items-start justify-between gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[["dot","mixed"].includes(s)&&!N&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:E.dotFill})}),e.jsx("span",{className:c.cn("text-sm font-medium truncate",!N&&s!=="dot"&&E.text,N&&"line-through"),children:t.title})]}),m]}),$&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:$}),h&&h.length>0&&e.jsx("div",{className:"flex flex-col text-xs text-muted-foreground",children:h.map((Q,le)=>e.jsx("div",{children:Q},le))}),W!=null&&W>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ct,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[W," participant",W!==1?"s":""]})]}),l&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(gn,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),Y&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(yn,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{className:"truncate",children:[B,B&&F?", ":"",F]})]}),i&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),x&&t.participants&&t.participants.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ct,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.participants.map(Q=>Q.name).join(", ")})]})]});return f?e.jsx(Se,{delayDuration:300,children:e.jsxs(De,{children:[e.jsx(Ce,{asChild:!0,children:fe}),e.jsx(be,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})})]})}):ee(fe)}function gn({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("polyline",{points:"12 6 12 12 16 14"})]})}function ts({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 ns({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 Ct({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"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 yn({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 pt({event:t,position:n,hourHeight:s=y.DEFAULT_HOUR_HEIGHT,badgeVariant:r="colored",onClick:a,className:l,disablePopover:i=!1,renderPopover:x,enableDrag:d=!0}){const f=He(t.color),[M,v]=o.useState(!1),[u,k]=o.useState(!1),E=ue.useOptionalDragDrop(),D=ue.useOptionalInnoCalendar();o.useEffect(()=>{if(!i&&D?.focusEventId&&D.focusEventId===t.id){const re=setTimeout(()=>{v(!0),D.clearFocusEventId()},300);return()=>clearTimeout(re)}},[D?.focusEventId,t.id,i]);const C=(t.endDate.getTime()-t.startDate.getTime())/(1e3*60),S=C/60*s-8,g=t.endDate<pn(new Date),b=t.isCanceled??!1,_=d&&E&&!b&&!g,U=S<32,I=C<35,T=C>20,j=C>=45,L=t.data,O=L?.productName,N=L?.extendedProps,R=L?.nrParticipant,P=L?.siteName,H=L?.siteCity,m=!!P||!!H,$=r==="dot",h=o.useCallback(()=>{u||(i&&a?a(t):i||v(!0))},[u,i,a,t]),W=o.useCallback(()=>{v(!1)},[]),B=o.useCallback(re=>{if(!_)return;re.dataTransfer.effectAllowed="move",re.dataTransfer.setData("text/plain",t.id);const ce=re.currentTarget,we=ce.getBoundingClientRect();re.dataTransfer.setDragImage(ce,re.clientX-we.left,re.clientY-we.top),k(!0),E?.startDrag?.(t)},[_,t,E]),F=o.useCallback(()=>{k(!1),E?.isDragging&&E.endDrag?.()},[E]),[Y,se]=o.useState(null),J=Y!==null,K=D?.slotDuration??15,ne=_&&!!E?.resizeEvent,oe=o.useCallback(re=>{if(!ne)return;re.preventDefault(),re.stopPropagation();const ce=re.currentTarget;ce.setPointerCapture(re.pointerId);const we=re.clientY,p=t.endDate,A=new Date(t.startDate.getTime()+K*6e4);let z=p;const q=te=>{const ae=(te.clientY-we)/s*60,xe=Math.round(ae/K)*K,de=new Date(p.getTime()+xe*6e4);z=de<A?A:de,se((z.getTime()-p.getTime())/36e5*s)},V=()=>{ce.removeEventListener("pointermove",q),ce.removeEventListener("pointerup",V),ce.removeEventListener("pointercancel",X),se(null),z.getTime()!==p.getTime()&&E?.resizeEvent?.(t,z)},X=()=>{ce.removeEventListener("pointermove",q),ce.removeEventListener("pointerup",V),ce.removeEventListener("pointercancel",X),se(null)};ce.addEventListener("pointermove",q),ce.addEventListener("pointerup",V),ce.addEventListener("pointercancel",X)},[ne,t,s,K,E]),ee=ue.useOptionalInnoCalendar(),Q=Gn()?.(t,{view:ee?.view??"week",compact:U}),le=o.useCallback(re=>{(re.key==="Enter"||re.key===" ")&&(re.preventDefault(),h())},[h]),ie=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!_,onDragStart:B,onDragEnd:F,onKeyDown:le,onClick:u||J?void 0:h,className:c.cn("group relative flex w-full select-none overflow-hidden rounded-md text-xs text-left","ring-1 ring-inset ring-black/[0.06] dark:ring-white/10","transition-shadow hover:shadow-[0_1px_4px_rgba(0,0,0,0.12)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",_?"cursor-grab active:cursor-grabbing":"cursor-pointer",u&&"opacity-50",b?y.CANCELED_CHIP:[!$&&[f.bg,f.text],$&&"bg-neutral-50 dark:bg-neutral-900"],U?"flex-row items-center gap-1.5 px-2 py-0":I?"flex-col gap-0.5 px-2 py-0 justify-center":"flex-col gap-0.5 px-2 py-1.5",l),style:{height:`${Math.max(S+(Y??0),20)}px`},children:[ne&&e.jsx("div",{role:"separator","aria-label":"Resize event",onPointerDown:oe,onClick:re=>re.stopPropagation(),className:c.cn("absolute inset-x-0 bottom-0 z-10 cursor-ns-resize","opacity-0 transition-opacity group-hover:opacity-100",U?"h-1.5":"h-2",J&&"opacity-100"),children:e.jsx("span",{className:c.cn("mx-auto block h-0.5 w-6 rounded-full bg-current opacity-40",U?"mt-px":"mt-0.5")})}),Q,!Q&&(U?e.jsxs(e.Fragment,{children:[["mixed","dot"].includes(r)&&!b&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:f.dotFill})}),e.jsxs("span",{className:c.cn("truncate leading-none text-[11px]",!b&&$&&"text-foreground"),children:[e.jsx("span",{className:"font-semibold",children:t.title}),!t.isAllDay&&e.jsxs("span",{className:"opacity-75",children:[", ",es(t.startDate)]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[["mixed","dot"].includes(r)&&!b&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:f.dotFill})}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsx("p",{className:c.cn("font-semibold truncate leading-tight",!b&&$&&"text-foreground"),children:t.title})})]}),j&&O&&e.jsx("p",{className:c.cn("text-[11px] truncate leading-tight",$?"text-muted-foreground":"opacity-80"),children:O}),j&&N&&N.length>0&&e.jsx("div",{className:c.cn("flex flex-col text-[11px] leading-tight",$?"text-muted-foreground":"opacity-80"),children:N.map((re,ce)=>e.jsx("div",{children:re},ce))}),(j||t.isAllDay)&&R!=null&&R>0&&e.jsxs("div",{className:c.cn("flex items-center gap-1 text-[11px] leading-tight",$?"text-muted-foreground":"opacity-80"),children:[e.jsx(Ct,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[R," participant",R!==1?"s":""]})]}),T&&e.jsxs("div",{className:c.cn("flex items-center gap-1 text-[11px] tabular-nums leading-tight",$?"text-muted-foreground":"opacity-90"),children:[e.jsx(gn,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),j&&m&&e.jsxs("div",{className:c.cn("flex items-center gap-1 text-[11px] truncate leading-tight",$?"text-muted-foreground":"opacity-80"),children:[e.jsx(yn,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{className:"truncate",children:[P,P&&H?", ":"",H]})]})]}))]}),Ee=e.jsx(be,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),O&&e.jsx("div",{className:"text-xs text-muted-foreground",children:O}),N&&N.length>0&&N.map((re,ce)=>e.jsx("div",{className:"text-xs text-muted-foreground",children:re},ce)),R!=null&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[R," participant",R!==1?"s":""]}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)}),m&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[P,P&&H?", ":"",H]})]})});return i?e.jsx("div",{className:"absolute p-0.5",style:{top:`${n.top}px`,left:`${n.left}%`,width:n.minWidth?`max(${n.minWidth}px, ${n.width}%)`:`${n.width}%`,minWidth:n.minWidth?`${n.minWidth}px`:void 0},children:e.jsx(Se,{delayDuration:300,children:e.jsxs(De,{children:[e.jsx(Ce,{asChild:!0,children:ie}),Ee]})})}):e.jsx("div",{className:"absolute p-0.5",style:{top:`${n.top}px`,left:`${n.left}%`,width:n.minWidth?`max(${n.minWidth}px, ${n.width}%)`:`${n.width}%`,minWidth:n.minWidth?`${n.minWidth}px`:void 0},children:e.jsx(Rt,{open:M,onOpenChange:v,trigger:ie,children:e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x?.({event:t,onClose:W})})})})}function ss({event:t,spanDays:n,isStart:s,isEnd:r,onClick:a,className:l,disablePopover:i=!1,renderPopover:x}){const d=He(t.color),[f,M]=o.useState(!1),v=t.isCanceled??!1,u=o.useCallback(()=>{i&&a?a(t):i||M(!0)},[i,a,t]),k=o.useCallback(()=>{M(!1)},[]),E=e.jsx("button",{type:"button",onClick:u,className:c.cn("flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",v?"bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[d.dot,"text-white"],s&&"rounded-l",r&&"rounded-r",l),style:{width:`${n*100}%`},children:s&&e.jsx("span",{className:"truncate",children:t.title})}),D=e.jsx(be,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})});return i?e.jsx(Se,{delayDuration:300,children:e.jsxs(De,{children:[e.jsx(Ce,{asChild:!0,children:E}),D]})}):e.jsx(Rt,{open:f,onOpenChange:M,trigger:E,children:e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:x?.({event:t,onClose:k})})})}if(typeof window<"u"&&!document.getElementById("inno-calendar-event-marquee-style")){const t=document.createElement("style");t.id="inno-calendar-event-marquee-style",t.innerHTML=`
|
|
2
|
+
@keyframes event-marquee {
|
|
3
|
+
0% { transform: translateX(0); }
|
|
4
|
+
100% { transform: translateX(-50%); }
|
|
5
|
+
}
|
|
6
|
+
.event-marquee {
|
|
7
|
+
animation: event-marquee 28s linear infinite;
|
|
8
|
+
will-change: transform;
|
|
9
|
+
}
|
|
10
|
+
`,document.head.appendChild(t)}const vn=un.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input active:!bg-zinc-100 hover:!bg-zinc-50 active:bg-white !bg-white hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),je=o.forwardRef(({className:t,variant:n,size:s,loading:r,disabled:a,children:l,...i},x)=>e.jsxs("button",{className:c.cn(vn({variant:n,size:s,className:t})),ref:x,disabled:a||r,...i,children:[r&&e.jsxs("svg",{className:"animate-spin -ml-1 mr-2 size-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),l]}));je.displayName="Button";const jn=me.Root,bn=me.Trigger,rs=ye.forwardRef(({className:t,inset:n,children:s,...r},a)=>e.jsxs(me.SubTrigger,{ref:a,className:c.cn("flex cursor-default select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",n&&"pl-8",t),...r,children:[s,e.jsx(Le.ChevronRight,{className:"ml-auto h-4 w-4"})]}));rs.displayName=me.SubTrigger.displayName;const os=ye.forwardRef(({className:t,...n},s)=>e.jsx(me.SubContent,{ref:s,className:c.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));os.displayName=me.SubContent.displayName;const Ht=ye.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(me.Portal,{children:e.jsx(me.Content,{ref:r,sideOffset:n,className:c.cn("z-50 rounded-xl border bg-popover p-1 text-popover-foreground shadow-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));Ht.displayName=me.Content.displayName;const mt=ye.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(me.Item,{ref:r,className:c.cn("relative flex cursor-pointer select-none items-center rounded-lg px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",t),...s}));mt.displayName=me.Item.displayName;const as=ye.forwardRef(({className:t,children:n,checked:s=!1,...r},a)=>e.jsxs(me.CheckboxItem,{ref:a,className:c.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:s,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(me.ItemIndicator,{children:e.jsx(Le.Check,{className:"h-4 w-4"})})}),n]}));as.displayName=me.CheckboxItem.displayName;const is=ye.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(me.RadioItem,{ref:r,className:c.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(me.ItemIndicator,{children:e.jsx(Le.Circle,{className:"h-2 w-2 fill-current"})})}),n]}));is.displayName=me.RadioItem.displayName;const ls=ye.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(me.Label,{ref:r,className:c.cn("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...s}));ls.displayName=me.Label.displayName;const cs=ye.forwardRef(({className:t,...n},s)=>e.jsx(me.Separator,{ref:s,className:c.cn("-mx-1 my-1 h-px bg-muted",t),...n}));cs.displayName=me.Separator.displayName;function ds({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 wn({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 ct({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}function us({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 Ge({className:t}){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}function ms({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 xs({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 fs({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 hs({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 ps({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 gs({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 Pe({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:c.cn("animate-spin",t),children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}const ys={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."},Ke=o.forwardRef(({onClick:t,label:n,children:s,className:r,variant:a="ghost",...l},i)=>e.jsxs(De,{children:[e.jsx(Ce,{asChild:!0,children:e.jsx("button",{type:"button",ref:i,onClick:t,className:c.cn("h-8 w-8 rounded-full flex items-center justify-center transition-colors",a==="ghost"&&"hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-600 dark:text-zinc-400",a==="destructive"&&"hover:bg-red-50 dark:hover:bg-red-950/30 text-zinc-600 dark:text-zinc-400 hover:text-red-600",r),"aria-label":n,...l,children:s})}),e.jsx(be,{side:"bottom",className:"text-xs",children:n})]}));Ke.displayName="IconButton";function vs({src:t,alt:n,initials:s,className:r,isClient:a}){const[l,i]=o.useState(!1);return e.jsx("div",{className:c.cn("relative h-7 w-7 rounded-full overflow-hidden shrink-0",r),children:t&&!l?e.jsx("img",{src:t,alt:n,className:"h-full w-full object-cover",onError:()=>i(!0)}):e.jsx("div",{className:c.cn("h-full w-full flex items-center justify-center text-[10px] font-medium",a?"bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300":"bg-zinc-200 dark:bg-zinc-700 text-zinc-700 dark:text-zinc-300"),children:s})})}function Pt({participant:t,isEventCanceled:n=!1,labels:s}){const r=t.name||"Unknown",a=r.split(" ").map(u=>u[0]).join("").toUpperCase().slice(0,2),l=t.isOrganizer??!1,i=t.isConfirmed,x=i===!0,d=i===!1,f=t.isClient??!1,M=t.profilePicture||t.avatar,v=n;return e.jsxs("div",{className:c.cn("flex items-center gap-3 py-0",v&&"opacity-60"),children:[e.jsxs("div",{className:"relative",children:[e.jsx(vs,{src:M,alt:r,initials:a,isClient:f,className:c.cn(v&&"grayscale")}),v||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(ct,{className:"h-2 w-2 text-red-600 dark:text-red-400 stroke-[3]"})})}):x?e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center",children:e.jsx("div",{className:"h-3 w-3 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center",children:e.jsx(Ge,{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:c.cn("text-sm text-zinc-900 dark:text-zinc-100 truncate",v&&"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:s.client}),l&&!v&&e.jsx("div",{className:"text-xs text-zinc-500",children:s.organizer})]})]})}function js({open:t,onOpenChange:n,title:s,children:r}){return o.useEffect(()=>{if(!t)return;const a=l=>{l.key==="Escape"&&n(!1)};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[t,n]),o.useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]),t?e.jsxs("div",{className:"fixed inset-0 z-50",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>n(!1),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&n(!1)}}),e.jsx("div",{className:"fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-2xl shadow-xl overflow-hidden",children:[s&&e.jsx("div",{className:"sr-only",children:s}),r]})})]}):null}function bs({open:t,onOpenChange:n,title:s,description:r,cancelLabel:a,confirmLabel:l,onConfirm:i,isLoading:x}){return t?e.jsxs("div",{className:"fixed inset-0 z-[60]",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:()=>n(!1),onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&n(!1)}}),e.jsx("div",{className:"fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-lg shadow-xl p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:s}),e.jsx("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400",children:r}),e.jsxs("div",{className:"mt-4 flex justify-end gap-3",children:[e.jsx(je,{variant:"outline",size:"sm",onClick:()=>n(!1),children:a}),e.jsxs(je,{variant:"destructive",size:"sm",onClick:i,disabled:x,children:[x&&e.jsx(Pe,{className:"h-4 w-4 mr-2"}),e.jsx(wn,{className:"h-4 w-4 mr-2"}),l]})]})]})})]}):null}function ws(t,n){return t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function Ns(t,n){const s={hour:"2-digit",minute:"2-digit",hour12:!1};return`${t.toLocaleTimeString(void 0,s)} – ${n.toLocaleTimeString(void 0,s)}`}function ks(t){return t.toLocaleDateString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Ds(t){const[n,s]=o.useState(()=>typeof window<"u"?window.matchMedia(t).matches:!1);return o.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(t),a=l=>s(l.matches);return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[t]),n}function Wt({event:t,labels:n,isLoading:s,onClose:r,onEdit:a,onDelete:l,onCancel:i,onAccept:x,onDecline:d,onConfirmMeeting:f,canEdit:M=!0,canDelete:v=!1,canCancel:u=!0,isCurrentUserParticipant:k=!1,isCurrentUserClient:E=!1,currentUserAcceptStatus:D,isAcceptLoading:C=!1,isDeclineLoading:S=!1,isConfirmLoading:g=!1,isDeleteLoading:b=!1,renderParticipant:_,renderHeaderActions:U,renderCancelReason:I,renderDeleteConfirmation:T,formatDate:j=ws,formatTimeRange:L=Ns}){const[O,N]=o.useState(!1),R=!(t.isCanceled||t.meetingTookPlace),P=t.isRecurring??!1,H=t.participantDetails,m=t.participantsNames||[],$=H&&H.length>0,h=D===!0,W=D===!1,B=k&&!E&&R,F=$?H.filter(Q=>Q.isConfirmed).length:t.isAccepted?m.length:0,Y=$?H.length:m.length,se=t.scheduleTypeColor||t.hexColor||"#039BE5",J=o.useCallback(()=>t.startDate?j(t.startDate):n.noDateProvided,[t.startDate,j,n.noDateProvided]),K=o.useCallback(()=>t.startDate&&t.endDate?L(t.startDate,t.endDate):null,[t.startDate,t.endDate,L]),ne=()=>{r(),a?.(t)},oe=()=>{r(),i?.(t)},ee=()=>{N(!0)},fe=()=>{l?.(t),N(!1)};return s?e.jsx("div",{className:"flex h-48 items-center justify-center",children:e.jsx(Pe,{className:"h-6 w-6 text-zinc-400"})}):e.jsxs(Se,{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:U?U({onClose:r}):e.jsxs(e.Fragment,{children:[R&&M&&a&&e.jsx(Ke,{onClick:ne,label:n.edit,children:e.jsx(ds,{className:"h-[18px] w-[18px]"})}),R&&u&&i&&e.jsx(Ke,{onClick:oe,label:n.cancel,children:e.jsx(us,{className:"h-[18px] w-[18px]"})}),v&&l&&e.jsx(Ke,{onClick:ee,label:n.delete,variant:"destructive",children:e.jsx(wn,{className:"h-[18px] w-[18px]"})}),e.jsx(Ke,{onClick:r,label:n.close,children:e.jsx(ct,{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:se}}),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:c.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(ms,{className:"h-3 w-3"}),n.completed]}),t.isCanceled&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 text-xs font-medium",children:[e.jsx(ct,{className:"h-3 w-3"}),n.canceled]})]}),e.jsxs("div",{className:"mt-1 text-sm text-zinc-600 dark:text-zinc-400",children:[e.jsx("span",{children:J()}),K()&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mx-1.5",children:"·"}),e.jsx("span",{children:K()})]})]}),P&&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:I?I(t):e.jsx("div",{className:"flex items-start gap-0",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-red-700 dark:text-red-400",children:n.cancellationNote}),t.cancelReason&&e.jsxs("div",{className:"mt-1 text-sm text-red-600/80 dark:text-red-400/80 italic",children:['"',t.cancelReason,'"']}),t.canceledDate&&e.jsxs("div",{className:"mt-1.5 text-xs text-red-500/70 dark:text-red-400/60",children:[n.canceledOn," ",ks(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(hs,{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})]}),($||m.length>0)&&e.jsxs("div",{className:"flex items-start gap-2 py-0",children:[e.jsx(fs,{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:[Y," ",Y!==1?n.guests:n.guest]}),Y>0&&e.jsxs("span",{className:"text-xs text-zinc-500",children:["(",F," ",n.confirmed,")"]})]}),e.jsxs("div",{className:"mt-2 space-y-2",children:[$?H.slice(0,6).map((Q,le)=>_?_(Q,le):e.jsx(Pt,{participant:Q,isEventCanceled:t.isCanceled,labels:n},Q.id)):m.slice(0,6).map((Q,le)=>{const ie={id:String(le),name:Q,email:"",isConfirmed:t.isAccepted,isOrganizer:le===0,isClient:!1};return _?_(ie,le):e.jsx(Pt,{participant:ie,isEventCanceled:t.isCanceled,labels:n},Q)}),Y>6&&e.jsxs("div",{className:"text-xs text-zinc-500 py-1.5 pl-10",children:["+",Y-6," ",n.more]})]})]})]}),t.description&&e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(gs,{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(ps,{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:$&&H.find(Q=>Q.isOrganizer)?.name||m[0]||"Calendar"})]})]}),B&&x&&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:[P?e.jsxs(jn,{children:[e.jsx(bn,{asChild:!0,children:e.jsxs("div",{className:"flex",children:[e.jsx(je,{size:"sm",variant:"outline",className:c.cn("rounded-r-none gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",h&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:Q=>{Q.stopPropagation(),h||x(t)},disabled:C,children:C?e.jsx(Pe,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[h&&e.jsx(Ge,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(je,{size:"sm",variant:"outline",className:c.cn("rounded-l-none px-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",h&&"!bg-green-700 !text-white hover:!bg-green-700"),children:e.jsx(xs,{className:"h-3.5 w-3.5"})})]})}),e.jsxs(Ht,{align:"start",children:[e.jsxs(mt,{className:c.cn("gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",h&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>x(t),children:[e.jsx(Ge,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptThisEvent]}),e.jsxs(mt,{onClick:()=>x(t),children:[e.jsx(Ge,{className:"h-3.5 w-3.5 mr-2 text-green-600"}),n.acceptAllEvents]})]})]}):e.jsx(je,{size:"sm",variant:"outline",className:c.cn("gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",h&&"!bg-green-700 !text-white hover:!bg-green-700"),onClick:()=>{h||x(t)},disabled:C,children:C?e.jsx(Pe,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[h&&e.jsx(Ge,{className:"h-3.5 w-3.5"}),n.going]})}),e.jsx(je,{size:"sm",variant:"outline",className:c.cn("gap-1.5 h-8 !border-none !bg-rose-100 text-rose-800 hover:!bg-rose-200",W&&"!bg-rose-700 !text-white hover:!bg-rose-700"),onClick:()=>{W||d(t)},disabled:S,children:S?e.jsx(Pe,{className:"h-3.5 w-3.5"}):e.jsxs(e.Fragment,{children:[W&&e.jsx(ct,{className:"h-3.5 w-3.5"}),n.notGoing]})})]})}),k&&h&&!t.meetingTookPlace&&!t.isCanceled&&f&&e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800 py-3",children:e.jsxs(je,{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:g,children:[g&&e.jsx(Pe,{className:"h-4 w-4 mr-2"}),n.confirmMeeting]})})]}),T?O&&T({onConfirm:fe,onCancel:()=>N(!1),isLoading:b}):e.jsx(bs,{open:O,onOpenChange:N,title:n.deleteConfirmTitle,description:n.deleteConfirmDescription,cancelLabel:n.cancel,confirmLabel:n.delete,onConfirm:fe,isLoading:b})]})}function Cs({event:t,children:n,open:s,onOpenChange:r,isLoading:a,labels:l,onEdit:i,onDelete:x,onCancel:d,onAccept:f,onDecline:M,onConfirmMeeting:v,canEdit:u=!0,canDelete:k=!1,canCancel:E=!0,isCurrentUserParticipant:D,isCurrentUserClient:C,currentUserAcceptStatus:S,isAcceptLoading:g,isDeclineLoading:b,isConfirmLoading:_,isDeleteLoading:U,renderParticipant:I,renderHeaderActions:T,renderCancelReason:j,renderDeleteConfirmation:L,formatDate:O,formatTimeRange:N,className:R,width:P=360}){const H=Ds("(min-width: 768px)"),m={...ys,...l},$=o.useCallback(()=>{r?.(!1)},[r]),h={event:t,labels:m,isLoading:a,onClose:$,onEdit:i,onDelete:x,onCancel:d,onAccept:f,onDecline:M,onConfirmMeeting:v,canEdit:u,canDelete:k,canCancel:E,isCurrentUserParticipant:D,isCurrentUserClient:C,currentUserAcceptStatus:S,isAcceptLoading:g,isDeclineLoading:b,isConfirmLoading:_,isDeleteLoading:U,renderParticipant:I,renderHeaderActions:T,renderCancelReason:j,renderDeleteConfirmation:L,formatDate:O,formatTimeRange:N};return H?e.jsxs(Ie,{open:s??!1,onOpenChange:r??(()=>{}),children:[e.jsx(Re,{asChild:!0,children:n}),e.jsx(Te,{className:c.cn("p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",R),style:{width:P},align:"center",side:"bottom",sideOffset:4,children:e.jsx(Wt,{...h})})]}):e.jsxs(e.Fragment,{children:[n,e.jsx(js,{open:s??!1,onOpenChange:r??(()=>{}),title:t.title,children:e.jsx(Wt,{...h})})]})}const Es={title:"Calendar settings",interval:"Time interval",dayStart:"Day starts",dayEnd:"Day ends",workingHoursOnly:"Working hours only",eventStyle:"Event style",badgeDot:"Dot",badgeColored:"Colour",badgeMixed:"Mixed",minutes:"min"},Ms=[15,30,60],Ss=Array.from({length:25},(t,n)=>n);function Fe({label:t,children:n}){return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-sm text-foreground",children:t}),n]})}function $t({options:t,value:n,onChange:s}){return e.jsx("div",{className:"flex overflow-hidden rounded-md border border-border",children:t.map(r=>e.jsx("button",{type:"button",onClick:()=>s(r.value),className:c.cn("px-2.5 py-1 text-xs",r.value===n?"bg-primary text-primary-foreground":"bg-background hover:bg-accent hover:text-accent-foreground"),children:r.label},String(r.value)))})}function Ft({value:t,onChange:n,label:s}){return e.jsx("select",{"aria-label":s,value:t,onChange:r=>n(Number(r.target.value)),className:c.cn("rounded-md border border-border bg-background px-2 py-1 text-xs","focus:outline-none focus:ring-1 focus:ring-ring"),children:Ss.map(r=>e.jsxs("option",{value:r,children:[String(r).padStart(2,"0"),":00"]},r))})}function Nn({labels:t}){const n=ue.useOptionalInnoCalendar(),s={...Es,...t};if(!n)return null;const{slotDuration:r,setSlotDuration:a,visibleHours:l,setVisibleHours:i,showWorkingHoursOnly:x,setShowWorkingHoursOnly:d,badgeVariant:f,setBadgeVariant:M,isPreferenceLocked:v}=n,u=k=>v(k);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("p",{className:"text-sm font-medium",children:s.title}),!u("slotDuration")&&e.jsx(Fe,{label:s.interval,children:e.jsx($t,{value:r,onChange:k=>a(k),options:Ms.map(k=>({value:k,label:`${k} ${s.minutes}`}))})}),!u("visibleHours")&&e.jsxs(e.Fragment,{children:[e.jsx(Fe,{label:s.dayStart,children:e.jsx(Ft,{label:s.dayStart,value:l.start,onChange:k=>i(E=>({...E,start:Math.min(k,E.end-1)}))})}),e.jsx(Fe,{label:s.dayEnd,children:e.jsx(Ft,{label:s.dayEnd,value:l.end,onChange:k=>i(E=>({...E,end:Math.max(k,E.start+1)}))})})]}),!u("showWorkingHoursOnly")&&e.jsx(Fe,{label:s.workingHoursOnly,children:e.jsx("button",{type:"button",role:"switch","aria-checked":x,onClick:()=>d(!x),className:c.cn("relative h-5 w-9 rounded-full transition-colors",x?"bg-primary":"bg-muted"),children:e.jsx("span",{className:c.cn("absolute top-0.5 size-4 rounded-full bg-background transition-all",x?"left-[18px]":"left-0.5")})})}),!u("badgeVariant")&&e.jsx(Fe,{label:s.eventStyle,children:e.jsx($t,{value:f,onChange:k=>M(k),options:[{value:"dot",label:s.badgeDot},{value:"colored",label:s.badgeColored},{value:"mixed",label:s.badgeMixed}]})})]})}function Xe({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:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M9 8h7"}),e.jsx("path",{d:"M8 12h6"}),e.jsx("path",{d:"M11 16h5"})]})}function Ts({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:"m6 9 6 6 6-6"})})}function Ls({className:t}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}function Is({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:"7",height:"7",x:"3",y:"3",rx:"1"}),e.jsx("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}),e.jsx("path",{d:"M14 4h7"}),e.jsx("path",{d:"M14 9h7"}),e.jsx("path",{d:"M14 15h7"}),e.jsx("path",{d:"M14 20h7"})]})}function Rs({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:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M8 3v18"}),e.jsx("path",{d:"M12 3v18"}),e.jsx("path",{d:"M16 3v18"})]})}function Hs({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:"M8 6h13"}),e.jsx("path",{d:"M8 12h13"}),e.jsx("path",{d:"M8 18h13"}),e.jsx("path",{d:"M3 6h.01"}),e.jsx("path",{d:"M3 12h.01"}),e.jsx("path",{d:"M3 18h.01"})]})}function As({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:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M12 3v18"})]})}function _s({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:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M3 12h18"}),e.jsx("path",{d:"M12 3v18"})]})}function Os({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:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M3 9h18"}),e.jsx("path",{d:"M3 15h18"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M15 3v18"})]})}const Ut=[{value:"day",label:"Day",icon:Is},{value:"4day",label:"4 days",icon:Rs},{value:"week",label:"Week",icon:As},{value:"month",label:"Month",icon:_s},{value:"year",label:"Year",icon:Os},{value:"agenda",label:"Schedule",icon:Hs}],Bt={day:"D","4day":"X",week:"W",month:"M",year:"Y",agenda:"A"},zs=[{value:"timeline-3day",label:"3 Days",icon:Xe},{value:"timeline-week",label:"Week",icon:Xe}],Ps=[{value:"timeline-day",label:"Day",icon:Xe},{value:"resource-day",label:"Day",icon:Xe},{value:"resource-week",label:"Week",icon:Xe}];function Ws(t,n,s,r){const a=d=>new Intl.DateTimeFormat(r,{month:"long",year:"numeric"}).format(d);if(n==="day"||n==="timeline-day"||n==="resource-day")return new Intl.DateTimeFormat(r,{month:"long",day:"numeric",year:"numeric"}).format(t);if(n==="year")return new Intl.DateTimeFormat(r,{year:"numeric"}).format(t);const l=y.startOfWeek(t,s),i=y.endOfWeek(t,s);if(n==="month"||l.getMonth()===i.getMonth())return a(t);const x=d=>new Intl.DateTimeFormat(r,{month:"short"}).format(d);return`${x(l)} – ${x(i)} ${i.getFullYear()}`}function qt({dir:t}){return e.jsx("svg",{viewBox:"0 0 24 24",className:"size-5",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:t==="prev"?"M15 18L9 12l6-6":"M9 18l6-6-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function $s(t){return`People · ${t.label}`}function kn({currentDate:t,view:n,onNavigateToday:s,onNavigatePrev:r,onNavigateNext:a,onNavigate:l,onViewChange:i,onAddEvent:x,availableViews:d=["day","4day","week","month","agenda"],showTimelineViews:f=!1,timelineViews:M,settingsContent:v,showSettings:u=!0,filterContent:k,leadingAction:E,actions:D,className:C,weekStartsOn:S=1,locale:g,todayLabel:b="Today",headerConfig:_,labels:U={}}){const I=_?.showSettings??u,T=Ws(t,n,S,g),j=_?.showToday??!0,L=_?.showDateNavigator??!0,O=_?.showCalendarViews??!0,N=_?.showFilters??!0,R=o.useMemo(()=>({today:"Today",addEvent:"Add Event",settings:"Settings",calendarView:"Calendar View",resourceView:"Resource View",...U}),[U]),P=()=>{s?.(),l?.("today")},H=()=>{r?.(),l?.("prev")},m=()=>{a?.(),l?.("next")},$=F=>R[F.value]??F.label,h=Ut.filter(F=>d.includes(F.value)),W=Ut.find(F=>F.value===n),B=(W&&$(W))??(()=>{const F=[...zs,...Ps].find(Y=>Y.value===n);return F?$s(F):n})();return e.jsxs("div",{className:c.cn("flex flex-col w-full gap-3 mb-2",C),children:[e.jsxs("div",{className:"flex lg:flex-row flex-col w-full justify-between gap-3",children:[e.jsx("div",{className:"flex items-center justify-between gap-2",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[E,j&&e.jsx("button",{type:"button",onClick:P,className:y.CONTROL,children:b}),L&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex shrink-0 items-center",children:[e.jsx("button",{type:"button","aria-label":"Previous",onClick:H,className:y.CONTROL_ICON,children:e.jsx(qt,{dir:"prev"})}),e.jsx("button",{type:"button","aria-label":"Next",onClick:m,className:y.CONTROL_ICON,children:e.jsx(qt,{dir:"next"})})]}),e.jsx("h2",{className:"truncate text-[22px] font-normal leading-tight",children:T})]})]})}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-none",children:[i&&O&&e.jsxs(jn,{children:[e.jsxs(bn,{className:c.cn(y.CONTROL,"gap-1.5"),children:[e.jsx("span",{children:B}),e.jsx(Ts,{className:"size-3.5 opacity-60"})]}),e.jsx(Ht,{align:"end",className:"min-w-[220px]",children:O&&h.map(F=>e.jsxs(mt,{onClick:()=>i(F.value),className:c.cn(n===F.value&&"bg-accent"),children:[e.jsx("span",{children:$(F)}),Bt[F.value]&&e.jsx("span",{className:"ml-auto pl-6 text-xs text-muted-foreground",children:Bt[F.value]})]},F.value))})]}),D,I&&e.jsxs(Ie,{children:[e.jsx(Re,{"aria-label":R.settings??"Settings",className:y.CONTROL_ICON,children:e.jsx(Ls,{className:"size-5"})}),e.jsx(Te,{align:"end",className:"w-80 p-4",children:v??e.jsx(Nn,{})})]})]})]}),N&&k&&e.jsx("div",{className:"flex items-center gap-2 pb-1 -mb-1 scrollbar-none",children:k})]})}const Fs=un.cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Us({className:t,variant:n,...s}){return e.jsx("div",{className:c.cn(Fs({variant:n}),t),...s})}function Bs({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:"m15 18-6-6 6-6"})})}function qs({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:"m9 18 6-6-6-6"})})}const Vs=["January","February","March","April","May","June","July","August","September","October","November","December"];function Ys({date:t,view:n,events:s=[],onNavigatePrev:r,onNavigateNext:a,weekStartsOn:l=1,showEventCount:i=!0,className:x}){const d=Vs[t.getMonth()],f=t.getFullYear(),M=i?y.getEventsCountInView(s,t,n,l):0,v=y.getRangeText(t,n);return e.jsxs("div",{className:c.cn("min-w-0 flex-1",x),children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-base sm:text-lg font-semibold truncate",children:[d," ",f]}),i&&e.jsx(Us,{variant:"outline",className:"px-1 sm:px-1.5 text-[10px] sm:text-xs shrink-0",children:M})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsx(je,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:r,children:e.jsx(Bs,{})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:v}),e.jsx(je,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:a,children:e.jsx(qs,{})})]})]})}const Gs=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function Ks({onClick:t,className:n}){const s=new Date;return e.jsxs("button",{type:"button",className:c.cn("flex size-11 sm:size-14 flex-col items-start overflow-hidden rounded-lg border shrink-0","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","hover:bg-accent/50 transition-colors",n),onClick:t,children:[e.jsx("p",{className:"flex h-4 sm:h-6 w-full items-center justify-center bg-primary text-center text-[10px] sm:text-xs font-semibold text-primary-foreground",children:Gs[s.getMonth()]}),e.jsx("p",{className:"flex w-full flex-1 items-center justify-center text-sm sm:text-lg font-bold",children:s.getDate()})]})}const Xs=380,Js=520,pe=12,et=8;function Dn({args:t,anchor:n,render:s,closeLabel:r="Close",onClose:a}){const[l,i]=o.useState(!1),x=o.useRef(null),[d,f]=o.useState(()=>typeof window>"u"?{width:1024,height:768}:{width:window.innerWidth,height:window.innerHeight});o.useEffect(()=>{const C=()=>f({width:window.innerWidth,height:window.innerHeight});return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const M=d.width<y.COMPACT_WIDTH,v=M?d.width-pe*2:Math.min(l?Js:Xs,d.width-pe*2),[u,k]=o.useState({left:n?.x??0,top:n?.y??0,maxHeight:0});o.useLayoutEffect(()=>{const C=x.current;if(!C||M)return;const S=()=>{const{innerHeight:b,innerWidth:_}=window,U=b-pe*2,I=Math.min(C.scrollHeight,U),T=n?n.y-40:96,j=Math.min(Math.max(pe,T),Math.max(pe,b-I-pe)),L=n?n.align==="end"?[n.x-v-et,n.x+et]:n.align==="start"?[n.x+et,n.x-v-et]:[n.x-v/2]:[(_-v)/2],O=H=>H>=pe&&H+v<=_-pe,N=L.find(O)??L[0]??pe,P={left:Math.min(Math.max(pe,N),_-v-pe),top:j,maxHeight:b-j-pe};k(H=>H.left===P.left&&H.top===P.top&&H.maxHeight===P.maxHeight?H:P)};if(S(),typeof ResizeObserver>"u")return;const g=new ResizeObserver(S);return g.observe(C),()=>g.disconnect()},[n,v,M,d.height]),o.useEffect(()=>{const C=b=>{b.key==="Escape"&&(b.stopPropagation(),a())},S=b=>{const _=b.target;!_||_===document.body||_===document.documentElement||x.current?.contains(_)||_?.closest?.(y.PORTALLED)||a()};document.addEventListener("keydown",C,!0);const g=window.setTimeout(()=>document.addEventListener("pointerdown",S),0);return()=>{document.removeEventListener("keydown",C,!0),document.removeEventListener("pointerdown",S),window.clearTimeout(g)}},[a]);const E=o.useCallback(C=>{const S=C.clientX,g=C.clientY;let b={left:0,top:0};k(I=>(b=I,I));const _=I=>{const T=b.top+(I.clientY-g);k({left:b.left+(I.clientX-S),top:T,maxHeight:window.innerHeight-T-pe})},U=()=>{document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",U)};document.addEventListener("pointermove",_),document.addEventListener("pointerup",U)},[]);if(typeof document>"u")return null;const D=e.jsxs("div",{ref:x,role:"dialog",className:c.cn("ic-quick-create fixed flex flex-col overflow-hidden rounded-2xl","bg-popover text-popover-foreground shadow-2xl ring-1 ring-border"),style:M?{left:pe,right:pe,bottom:pe,zIndex:ue.IC_Z_CARD,maxHeight:`calc(100dvh - ${pe*2}px)`}:{left:u.left,top:u.top,width:v,zIndex:ue.IC_Z_CARD,maxHeight:u.maxHeight||void 0},onPointerDown:C=>C.stopPropagation(),children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 pt-2",children:[e.jsx("button",{type:"button","aria-label":"Move",onPointerDown:E,className:c.cn("flex size-7 cursor-grab items-center justify-center rounded-full","text-muted-foreground active:cursor-grabbing","hover:bg-accent hover:text-accent-foreground"),children:e.jsxs("span",{className:"flex flex-col gap-[3px]",children:[e.jsx("span",{className:"block h-[1.5px] w-3.5 rounded bg-current"}),e.jsx("span",{className:"block h-[1.5px] w-3.5 rounded bg-current"})]})}),e.jsx("button",{type:"button","aria-label":r,onClick:a,className:c.cn("flex size-7 items-center justify-center rounded-full","text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e.jsx(Le.X,{className:"size-4"})})]}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:s(t,{close:a,expand:i})})]});return Tt.createPortal(D,document.body)}const tt=200,Qs=60,Zs=300,er=7,Vt=2,yt=40,tr=18;function nr(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m18 15-6-6-6 6"})})}function sr(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function rr(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function or(){return e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function ar({containerRef:t,currentDate:n,className:s}){const[r,a]=o.useState({canUp:!1,canDown:!1,canLeft:!1,canRight:!1}),[l,i]=o.useState({x:0,y:0}),[x,d]=o.useState(!1),f=r.canUp||r.canDown||r.canLeft||r.canRight,M=o.useRef(null),v=o.useRef(null),u=o.useRef(null),k=o.useRef(!1),E=o.useRef({x:0,y:0}),D=o.useRef({x:0,y:0}),C=o.useRef(0),S=o.useRef(null),g=o.useCallback(()=>{const m=t.current;if(!m)return;const $=4;a({canUp:m.scrollTop>$,canDown:m.scrollTop+m.clientHeight<m.scrollHeight-$,canLeft:m.scrollLeft>$,canRight:m.scrollLeft+m.clientWidth<m.scrollWidth-$})},[t]);o.useEffect(()=>{const m=t.current;if(!m)return;g(),m.addEventListener("scroll",g,{passive:!0});const $=new ResizeObserver(g);$.observe(m);const h=new MutationObserver(g);return h.observe(m,{childList:!0,subtree:!0}),()=>{m.removeEventListener("scroll",g),$.disconnect(),h.disconnect()}},[t,g]);const b=o.useCallback((m,$)=>{t.current?.scrollBy({left:m,top:$,behavior:"smooth"})},[t]),_=o.useCallback(()=>b(0,-tt),[b]),U=o.useCallback(()=>b(0,tt),[b]),I=o.useCallback(()=>b(-tt,0),[b]),T=o.useCallback(()=>b(tt,0),[b]),j=o.useCallback(()=>{M.current&&(clearTimeout(M.current),M.current=null),v.current&&(clearInterval(v.current),v.current=null)},[]),L=o.useCallback(m=>{m(),M.current=setTimeout(()=>{v.current=setInterval(m,Qs)},Zs)},[]);o.useEffect(()=>j,[j]),o.useEffect(()=>{const m=t.current;if(!m)return;const $=h=>{if(h.ctrlKey||h.metaKey||h.altKey)return;const W=h.target.tagName;if(!(W==="INPUT"||W==="TEXTAREA"||h.target.isContentEditable))switch(h.key){case"ArrowUp":h.preventDefault(),_();break;case"ArrowDown":h.preventDefault(),U();break;case"ArrowLeft":h.preventDefault(),I();break;case"ArrowRight":h.preventDefault(),T();break}};return m.addEventListener("keydown",$),()=>m.removeEventListener("keydown",$)},[t,_,U,I,T]),o.useEffect(()=>{if(!f)return;const m=S.current;if(!m)return;let $=0;const h=()=>{const Y=m.offsetParent;if(!Y)return;const se=Y.getBoundingClientRect(),J=window.innerHeight;if(se.height<=J){m.style.removeProperty("top"),m.style.removeProperty("bottom");return}const ne=Math.min(se.bottom,J)-se.top,oe=m.offsetHeight,ee=ne-oe-12,fe=12,Q=Y.clientHeight-oe-12,le=Math.max(fe,Math.min(ee,Q));m.style.top=`${le}px`,m.style.bottom="auto"},W=()=>{cancelAnimationFrame($),$=requestAnimationFrame(h)},B=[window];let F=m.parentElement;for(;F;){const Y=getComputedStyle(F);/(auto|scroll)/.test(Y.overflow+Y.overflowY)&&B.push(F),F=F.parentElement}for(const Y of B)Y.addEventListener("scroll",W,{passive:!0});return window.addEventListener("resize",W,{passive:!0}),h(),()=>{cancelAnimationFrame($);for(const Y of B)Y.removeEventListener("scroll",W);window.removeEventListener("resize",W)}},[f]);const O=o.useCallback(()=>{k.current=!1,d(!1),i({x:0,y:0}),D.current={x:0,y:0},C.current&&cancelAnimationFrame(C.current)},[]),N=o.useCallback(m=>{m.preventDefault(),k.current=!0,d(!0),E.current={x:m.clientX,y:m.clientY},D.current={x:0,y:0},m.target.setPointerCapture(m.pointerId);const $=()=>{if(!k.current)return;const h=t.current;if(h){const{x:W,y:B}=D.current,F=Math.sqrt(W*W+B*B);if(F>Vt){const se=Math.min(F/yt,1)*tr;h.scrollLeft+=W/F*se,h.scrollTop+=B/F*se}}C.current=requestAnimationFrame($)};C.current=requestAnimationFrame($)},[t]),R=o.useCallback(m=>{if(!k.current)return;const $=m.clientX-E.current.x,h=m.clientY-E.current.y;D.current={x:$,y:h};const W=Math.sqrt($*$+h*h);if(W<Vt)i({x:0,y:0});else{const F=Math.min(W,yt)/yt*er;i({x:$/W*F,y:h/W*F})}},[]),P=o.useCallback(m=>{switch(m.key){case"ArrowUp":m.preventDefault(),_();break;case"ArrowDown":m.preventDefault(),U();break;case"ArrowLeft":m.preventDefault(),I();break;case"ArrowRight":m.preventDefault(),T();break}},[_,U,I,T]);if(!f)return null;const H=n?n.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):null;return e.jsxs("div",{ref:S,className:`inno-scroll-nav-wrapper ${s??""}`,role:"toolbar","aria-label":"Scroll navigation",onKeyDown:P,children:[H&&e.jsx("div",{className:"inno-scroll-nav-date","aria-live":"polite",children:H}),e.jsxs("div",{className:"inno-scroll-nav",children:[e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-up ${r.canUp?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll up",disabled:!r.canUp,onPointerDown:()=>L(_),onPointerUp:j,onPointerLeave:j,tabIndex:r.canUp?0:-1,children:e.jsx(nr,{})}),e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-left ${r.canLeft?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll left",disabled:!r.canLeft,onPointerDown:()=>L(I),onPointerUp:j,onPointerLeave:j,tabIndex:r.canLeft?0:-1,children:e.jsx(rr,{})}),e.jsx("button",{ref:u,type:"button",className:`inno-scroll-nav-joystick ${x?"inno-scroll-nav-joystick-active":""}`,"aria-label":"Drag to scroll freely",onPointerDown:N,onPointerMove:R,onPointerUp:O,onPointerCancel:O,tabIndex:0,children:e.jsx("span",{className:"inno-scroll-nav-joystick-dot",style:{transform:`translate(${l.x}px, ${l.y}px)`}})}),e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-right ${r.canRight?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll right",disabled:!r.canRight,onPointerDown:()=>L(T),onPointerUp:j,onPointerLeave:j,tabIndex:r.canRight?0:-1,children:e.jsx(or,{})}),e.jsx("button",{type:"button",className:`inno-scroll-nav-btn inno-scroll-nav-down ${r.canDown?"":"inno-scroll-nav-btn-disabled"}`,"aria-label":"Scroll down",disabled:!r.canDown,onPointerDown:()=>L(U),onPointerUp:j,onPointerLeave:j,tabIndex:r.canDown?0:-1,children:e.jsx(sr,{})})]})]})}function Yt({dir:t}){return e.jsx("svg",{viewBox:"0 0 24 24",className:"size-4",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:t==="prev"?"M15 18L9 12l6-6":"M9 18l6-6-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function At({selected:t,onSelect:n,events:s,locale:r,weekStartsOn:a=1,className:l}){const[i,x]=o.useState(()=>y.startOfMonth(t)),d=o.useMemo(()=>{const u=y.startOfWeek(y.startOfMonth(i),a);return Array.from({length:6},(k,E)=>Array.from({length:7},(D,C)=>{const S=new Date(u);return S.setDate(u.getDate()+E*7+C),S}))},[i,a]),f=o.useMemo(()=>s?.length?new Set(d.flat().filter(u=>y.getEventsForDay(s,u).length>0).map(u=>u.toDateString())):new Set,[d,s]),M=o.useMemo(()=>{const u=y.startOfWeek(new Date,a),k=new Intl.DateTimeFormat(r,{weekday:"narrow"});return Array.from({length:7},(E,D)=>{const C=new Date(u);return C.setDate(u.getDate()+D),k.format(C)})},[r,a]),v=new Intl.DateTimeFormat(r,{month:"long",year:"numeric"}).format(i);return e.jsxs("div",{className:c.cn("select-none",l),children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between pl-2",children:[e.jsx("span",{className:"text-sm font-medium",children:v}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("button",{type:"button","aria-label":"Previous month",onClick:()=>x(u=>y.addMonths(u,-1)),className:"flex size-7 items-center justify-center rounded-full text-muted-foreground hover:bg-accent hover:text-accent-foreground",children:e.jsx(Yt,{dir:"prev"})}),e.jsx("button",{type:"button","aria-label":"Next month",onClick:()=>x(u=>y.addMonths(u,1)),className:"flex size-7 items-center justify-center rounded-full text-muted-foreground hover:bg-accent hover:text-accent-foreground",children:e.jsx(Yt,{dir:"next"})})]})]}),e.jsxs("div",{className:"grid grid-cols-7",children:[M.map((u,k)=>e.jsx("span",{className:"flex h-7 items-center justify-center text-[10px] text-muted-foreground",children:u},k)),d.flat().map(u=>{const k=!y.isSameMonth(u,i),E=y.isToday(u),D=y.isSameDay(u,t);return e.jsxs("button",{type:"button",onClick:()=>n(u),className:c.cn("relative flex h-7 items-center justify-center rounded-full text-xs","hover:bg-accent hover:text-accent-foreground",k&&"text-muted-foreground/60",D&&!E&&"bg-accent font-medium text-accent-foreground",E&&"bg-primary font-medium text-primary-foreground hover:bg-primary"),children:[u.getDate(),f.has(u.toDateString())&&e.jsx("span",{"aria-hidden":"true",className:c.cn("absolute bottom-0.5 size-1 rounded-full",E?"bg-primary-foreground":"bg-primary",k&&"opacity-50")})]},u.toISOString())})]})]})}function ir(){return e.jsx("svg",{viewBox:"0 0 24 24",className:"size-4",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M12 5v14M5 12h14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function Cn({selected:t,onSelect:n,events:s,locale:r,weekStartsOn:a,onCreate:l,createLabel:i="Create",children:x,className:d}){return e.jsx("aside",{className:c.cn("ic-sidebar hidden w-64 shrink-0 flex-col gap-5 overflow-y-auto","py-2 pr-3 lg:flex",d),children:e.jsx(En,{selected:t,onSelect:n,...s&&{events:s},...r&&{locale:r},...a!==void 0&&{weekStartsOn:a},...l&&{onCreate:l},...i&&{createLabel:i},children:x})})}function En({selected:t,onSelect:n,events:s,onCreate:r,createLabel:a="Create",locale:l,weekStartsOn:i,children:x}){return e.jsxs(e.Fragment,{children:[r&&e.jsxs("button",{type:"button",onClick:r,className:c.cn(y.CONTROL,"w-fit gap-2 bg-popover shadow-sm"),children:[e.jsx(ir,{}),e.jsx("span",{children:a})]}),e.jsx(At,{selected:t,onSelect:n,...s&&{events:s},...l&&{locale:l},...i!==void 0&&{weekStartsOn:i}}),x&&e.jsx("div",{className:"@container min-w-0",children:x})]})}function Mn({label:t="Filters",open:n,onOpenChange:s,...r}){return e.jsxs(Lt,{...n!==void 0&&{open:n},...s&&{onOpenChange:s},children:[e.jsx(It,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":t,className:c.cn(y.CONTROL_ICON,"lg:hidden"),children:e.jsx(Le.SlidersHorizontal,{className:"size-4"})})}),e.jsxs(ft,{className:c.cn("left-0 right-auto w-72 max-w-[85vw] overflow-y-auto border-l-0 border-r p-4","data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left"),children:[e.jsx(ht,{className:"sr-only",children:t}),e.jsx("div",{className:"@container flex flex-col gap-5",children:e.jsx(En,{...r})})]})]})}function Sn({children:t,title:n,className:s}){return e.jsxs("div",{className:c.cn("flex flex-col gap-4",s),children:[n&&e.jsx("div",{className:"px-1 text-sm font-medium",children:n}),t]})}const lr={allDay:"All day",empty:"Nothing scheduled"},cr=t=>t.data?.isAccepted??t.isAccepted??!0;function dr({event:t}){const n=t.hexColor??"var(--primary)";return e.jsx("span",{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-full",style:cr(t)?{background:n}:{border:`2px solid ${n}`,background:"transparent"}})}function Gt(){return e.jsx("div",{className:"relative my-0.5 h-0","aria-hidden":"true",children:e.jsxs("div",{className:"absolute inset-x-0 flex items-center",children:[e.jsx("span",{className:"size-2 shrink-0 rounded-full bg-red-500"}),e.jsx("span",{className:"h-px flex-1 bg-red-500"})]})})}function ur({event:t,time:n,owners:s,onEventClick:r,renderPopover:a}){const l=e.jsxs("span",{className:c.cn("flex w-full items-center gap-3 rounded px-2 py-1.5 text-left","hover:bg-accent hover:text-accent-foreground",t.isCanceled&&"text-muted-foreground line-through"),children:[e.jsx(dr,{event:t}),e.jsx("span",{className:"w-28 shrink-0 text-sm tabular-nums text-muted-foreground",children:n}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:t.title}),s&&e.jsx("span",{className:"max-w-[35%] shrink-0 truncate text-xs text-muted-foreground",children:s})]});return a?e.jsxs(Ie,{children:[e.jsx(Re,{asChild:!0,children:e.jsx("button",{type:"button",className:"w-full",children:l})}),e.jsx(Te,{className:"w-96 p-0",align:"start",children:a({event:t,onClose:()=>document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0}))})})]}):e.jsx("button",{type:"button",className:"w-full",onClick:i=>r?.(t,i),children:l})}function Tn({events:t,date:n,daysAhead:s,locale:r,hour12:a,labels:l,emptyState:i,onEventClick:x,className:d,renderEvent:f,renderPopover:M}){const v={...lr,...l},u=o.useMemo(()=>{const g=y.getViewDateRange(n,"agenda"),b=new Date(g.startDate);b.setHours(0,0,0,0);const _=s===void 0?g.endDate:new Date(b.getTime()+s*864e5),U=new Map;for(const I of t){if(I.endDate<b||I.startDate>_)continue;const T=new Date(I.startDate);T.setHours(0,0,0,0),T<b&&T.setTime(b.getTime());const j=T.toDateString(),L=U.get(j)??{day:T,events:[]};L.events.push(I),U.set(j,L)}return[...U.values()].sort((I,T)=>I.day.getTime()-T.day.getTime()).map(I=>({...I,events:I.events.sort((T,j)=>T.startDate.getTime()-j.startDate.getTime())}))},[t,n,s]);if(u.length===0)return e.jsx("div",{className:c.cn("flex h-full flex-col items-center justify-center py-12",d),children:i??e.jsx("p",{className:"text-sm text-muted-foreground",children:v.empty})});const k=new Date,E=new Set;for(const g of u)for(const b of g.events)for(const _ of b.participants??[])E.add(_.id);const D=E.size>1,C=g=>D?(g.participants??[]).map(b=>b.name).filter(Boolean).join(", "):void 0,S=g=>{if(g.isAllDay)return v.allDay;const b=y.formatClock(g.startDate,{locale:r,hour12:a});return y.isSameDay(g.startDate,g.endDate)?`${b} – ${y.formatClock(g.endDate,{locale:r,hour12:a})}`:b};return e.jsx("div",{className:c.cn("flex h-full flex-col overflow-auto",d),children:u.map(({day:g,events:b})=>{const _=y.isToday(g),U=_?b.findIndex(I=>I.endDate>k):-1;return e.jsxs("div",{className:c.cn("flex border-b last:border-b-0"),children:[e.jsxs("div",{className:c.cn("flex w-32 shrink-0 items-center gap-2 py-3 pl-4"),children:[e.jsx("span",{className:c.cn("flex size-9 items-center justify-center rounded-full text-xl",_?"bg-primary font-medium text-primary-foreground":"text-foreground"),children:g.getDate()}),e.jsx("span",{className:c.cn("text-[11px] font-medium uppercase tracking-wide",_?"text-primary":"text-muted-foreground"),children:new Intl.DateTimeFormat(r,{month:"short",weekday:"short"}).format(g)})]}),e.jsxs("div",{className:"min-w-0 flex-1 py-2 pr-4",children:[b.map((I,T)=>e.jsxs("div",{children:[T===U&&e.jsx(Gt,{}),f?f({event:I,variant:"full"}):e.jsx(ur,{event:I,time:S(I),owners:C(I)||void 0,onEventClick:x,renderPopover:M})]},I.id)),_&&U===-1&&e.jsx(Gt,{})]})]},g.toDateString())})})}const nt=360,st=480,vt=280;function Ln({isOpen:t,onClose:n,date:s,events:r,anchorRect:a,badgeVariant:l="colored",onEventClick:i,renderEvent:x,renderPopover:d,className:f}){const M=o.useRef(null),v=o.useRef(null),[u,k]=o.useState("closed"),E=o.useRef(null);a&&(E.current=a);const D=a??E.current,C=o.useMemo(()=>[...r].sort((j,L)=>j.startDate.getTime()-L.startDate.getTime()),[r]),S=o.useMemo(()=>{const j=D;if(!j)return{top:0,left:0,width:nt,maxHeight:st};const L=typeof window<"u"?window.innerWidth:1200,O=typeof window<"u"?window.innerHeight:800;let N=j.left+j.width/2-nt/2;N=Math.max(16,Math.min(N,L-nt-16));const R=Math.min(r.length*68+80,st);let P=j.top+j.height/2-R/2;return P=Math.max(16,Math.min(P,O-R-16)),{top:P,left:N,width:nt,maxHeight:st}},[D,r.length]);o.useLayoutEffect(()=>{if(t&&D)k("entering"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{k("open")})});else if(!t&&(u==="open"||u==="entering")){k("exiting");const j=setTimeout(()=>{k("closed"),E.current=null},vt);return()=>clearTimeout(j)}},[t,D]),o.useEffect(()=>{if(u==="closed")return;const j=L=>{L.key==="Escape"&&(L.stopPropagation(),n())};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[u,n]),o.useEffect(()=>{u==="open"&&v.current&&v.current.focus()},[u]);const g=o.useCallback(j=>{j.target===M.current&&n()},[n]);if(u==="closed")return null;const b=u==="entering"||u==="exiting",_=D,U=b&&_?{position:"fixed",top:_.top,left:_.left,width:_.width,height:_.height,maxHeight:_.height,opacity:u==="entering"?.7:0,transform:"scale(1)",borderRadius:"8px"}:{position:"fixed",top:S.top,left:S.left,width:S.width,maxHeight:S.maxHeight,opacity:1,transform:"scale(1)",borderRadius:"12px"},I=b?0:1,T=s.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"});return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:M,role:"presentation",onClick:g,className:"ic-expansion-backdrop",style:{position:"fixed",inset:0,zIndex:40,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:I,transition:`opacity ${vt}ms cubic-bezier(0.32, 0.72, 0, 1)`}}),e.jsxs("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":`Events for ${T}`,tabIndex:-1,className:c.cn("ic-expansion-panel","!bg-white border border-border shadow-2xl overflow-hidden","focus:outline-none",f),style:{...U,zIndex:41,transition:`all ${vt}ms cubic-bezier(0.32, 0.72, 0, 1)`,willChange:"top, left, width, height, max-height, opacity, border-radius"},children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b bg-muted/30",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:T}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.length," event",r.length!==1?"s":""]})]}),e.jsx("button",{type:"button",onClick:n,className:"flex items-center justify-center size-7 rounded-full hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":"Close",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})})]}),e.jsxs("div",{className:"overflow-y-auto px-3 py-2 space-y-1.5",style:{maxHeight:`${st-64}px`},children:[C.map(j=>e.jsx("div",{onPointerDown:L=>L.stopPropagation(),children:x?x({event:j,variant:"compact"}):e.jsx(Je,{event:j,variant:"compact",badgeVariant:l,onClick:i,renderPopover:d,showTime:!0})},j.id)),r.length===0&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No events"})]})]})]})}function mr({event:t,date:n,onEventClick:s,disablePopover:r,renderPopover:a}){const[l,i]=o.useState(!1),x=He(t.color),d=y.detectAllDayEvent(t),f=y.isSameDay(t.startDate,n),M=y.isSameDay(t.endDate,n),v=d&&y.isSameDay(t.startDate,t.endDate),u=o.useCallback(()=>{r&&s?s(t):r||i(!0)},[r,s,t]),k=o.useCallback(()=>{i(!1)},[]),E=e.jsxs("button",{type:"button",onClick:u,title:y.formatEventTimeDisplay(t),className:c.cn("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium transition-opacity hover:opacity-80","sm:px-2 sm:py-1 sm:text-xs",t.isCanceled?y.CANCELED_CHIP:[x.bg,x.text]),children:[!v&&f&&!M&&"→ ",!v&&!f&&M&&" ←",!v&&!f&&!M&&"↔ ",e.jsx("span",{className:"truncate max-w-24 sm:max-w-32",children:t.title}),v&&e.jsx("span",{className:"text-[9px] opacity-70 sm:text-[10px]",children:"All day"})]}),D=e.jsx(be,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})});return r?e.jsxs(De,{children:[e.jsx(Ce,{asChild:!0,children:E}),D]}):e.jsxs(Ie,{open:l,onOpenChange:i,children:[e.jsx(Re,{asChild:!0,children:E}),e.jsx(Te,{className:"w-80",children:a?a({event:t,onClose:k}):e.jsx(xr,{event:t,onClose:k})})]})}function xr({event:t,onClose:n}){const s=He(t.color),r=t.isCanceled??!1;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:c.cn("size-4 rounded shrink-0 mt-0.5",s.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:c.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums",children:y.formatEventTimeDisplay(t)})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function In({events:t,date:n,onEventClick:s,disablePopover:r=!1,renderPopover:a,className:l}){if(t.length===0)return null;const i=t.some(f=>y.detectAllDayEvent(f)&&y.isSameDay(f.startDate,f.endDate)),x=t.some(f=>!y.isSameDay(f.startDate,f.endDate)||y.detectAllDayEvent(f)&&!y.isSameDay(f.startDate,f.endDate)),d=i&&x?"All day / Multi-day":i?"All day":"Multi-day";return e.jsxs("div",{className:c.cn("border-b bg-muted/20 px-2 py-1.5 space-y-1","sm:px-4 sm:py-2",l),children:[e.jsx("span",{className:"text-[10px] font-medium text-muted-foreground sm:text-xs",children:d}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(f=>e.jsx(mr,{event:f,date:n,onEventClick:s,disablePopover:r,renderPopover:a},f.id))})]})}const fr=5;function Rn({slot:t,onSelectionStart:n,onSelectionMove:s,onSelectionEnd:r,isSelected:a=!1,isSelecting:l=!1,disabled:i=!1,ariaLabel:x,children:d,className:f,height:M,style:v,dataAttributes:u}){const k=o.useRef(null),E=o.useRef(!1),D=o.useRef(!1),C=o.useRef(null),[S,g]=o.useState(!1),b=ue.useOptionalDragDrop(),_=o.useCallback(R=>{i||R.button!==0&&R.pointerType==="mouse"||(R.preventDefault(),k.current={x:R.clientX,y:R.clientY},E.current=!1,D.current=!0,n?.(t))},[i,t,n]),U=o.useCallback(R=>{if(!(k.current&&D.current&&!i))return;const P=R.clientX-k.current.x,H=R.clientY-k.current.y;Math.sqrt(P*P+H*H)>=fr&&(E.current=!0)},[i]),I=o.useCallback(R=>{i||(R.buttons>0||l)&&s?.(t)},[i,l,t,s]),T=o.useCallback(()=>{i||(r?.(),k.current=null,E.current=!1,D.current=!1)},[i,r]),j=o.useCallback(R=>{if(!b?.isDragging||i)return;R.preventDefault(),R.dataTransfer.dropEffect="move",g(!0);const P=new Date,H=t.hour??P.getHours(),m=t.minute??(P.getMinutes()>=30?30:0);b.updateDragPreview?.(t.date,H,m)},[b,i,t]),L=o.useCallback(()=>{g(!1)},[]),O=o.useCallback(R=>{R.preventDefault(),g(!1),!(!b?.isDragging||i)&&b.endDrag?.()},[b,i]);o.useEffect(()=>{const R=()=>{D.current&&(D.current=!1,k.current=null,E.current=!1)};return window.addEventListener("pointerup",R),window.addEventListener("pointercancel",R),()=>{window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",R)}},[]);const N=o.useCallback(R=>{i||(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),n?.(t),r?.())},[i,t,n,r]);return e.jsx("button",{ref:C,type:"button","aria-label":x,"aria-disabled":i,"aria-pressed":a,disabled:i,onPointerDown:_,onPointerMove:U,onPointerUp:T,onPointerEnter:I,onKeyDown:N,onDragOver:j,onDragLeave:L,onDrop:O,className:c.cn("select-none touch-none cursor-pointer transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",!(l||i)&&"hover:bg-blue-50/60",a&&"bg-blue-100/70",S&&"bg-primary/20 ring-2 ring-primary ring-inset",i&&"cursor-not-allowed opacity-50",f),style:{height:M,...v},...u,children:d})}function gt({slot:t,date:n,hour:s,minute:r,ariaLabel:a,...l}){const i=t??{date:n,hour:s??0,minute:r??0},x=a??`Add event at ${(i.hour??0).toString().padStart(2,"0")}:${(i.minute??0).toString().padStart(2,"0")} on ${i.date.toLocaleDateString()}`;return e.jsx(Rn,{slot:i,ariaLabel:x,...l})}function Hn({slot:t,date:n,ariaLabel:s,...r}){const a=t??{date:n},l=s??`Select ${a.date.toLocaleDateString()}`;return e.jsx(Rn,{slot:a,ariaLabel:l,...r})}const Ue=y.DEFAULT_HOUR_HEIGHT,jt=72,bt=80;function An({events:t,date:n,visibleHours:s={startHour:0,endHour:24},workingHours:r,slotDuration:a=30,badgeVariant:l="colored",onEventClick:i,onSlotSelect:x,className:d,renderEvent:f,renderPopover:M}){const v=60/a,u=100/v,k=o.useMemo(()=>{const m=[];for(let $=0;$<v;$++)m.push($*a);return m},[v,a]),E=o.useMemo(()=>y.getEventsForDay(t,n),[t,n]),{singleDay:D,multiDay:C}=o.useMemo(()=>y.separateEventsByDuration(E),[E]),S=o.useMemo(()=>{const m=y.calculateOverlappingPositions(D,n,s,Ue),$=new Map;for(const h of m)$.set(h.event.id,h.position);return $},[D,n,s]),g=o.useMemo(()=>y.getVisibleHoursArray(s),[s]),b=new Date,_=y.isToday(n),U=o.useMemo(()=>{if(!_)return 0;const m=b.getHours()+b.getMinutes()/60;return m<s.startHour||m>s.endHour?-1:(m-s.startHour)*Ue},[_,s,b]),I=o.useRef(null);o.useLayoutEffect(()=>{const m=I.current;if(!m)return;const $=()=>{let h;if(_){const B=new Date().getHours();h=Math.max(B-1,s.startHour)}else{const B=n.getDay(),F=r?.[B];F?.enabled&&F.from>0?h=Math.max(F.from-1,s.startHour):h=Math.max(7,s.startHour)}const W=(h-s.startHour)*Ue;m.scrollTo({top:W,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame($)})},[n,r,s,_]);const T=ue.useOptionalSlotSelection(),j=o.useCallback(m=>{T?.startSelection(m)},[T]),L=o.useCallback(m=>{T?.updateSelection(m)},[T]),O=o.useCallback(()=>{T?.endSelection()},[T]),N=o.useCallback(m=>{i?.(m)},[i]),R=n.toLocaleDateString([],{weekday:"short"}),P=n.getDate(),H=y.isToday(n);return e.jsxs("div",{className:c.cn("flex flex-col h-full",d),children:[e.jsx("div",{className:c.cn("flex items-center gap-3 border-b px-4 py-3",H&&void 0),children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:c.cn("text-[11px] font-medium uppercase tracking-wide",H?"text-primary":"text-muted-foreground"),children:R}),e.jsx("span",{className:c.cn("flex items-center justify-center rounded-full mt-0.5","size-12 text-3xl font-normal",H?"bg-primary text-primary-foreground":"text-foreground"),children:P})]})}),C.length>0&&e.jsx(In,{events:C,date:n,onEventClick:N,disablePopover:!!i&&!M,renderPopover:M}),e.jsx("div",{ref:I,className:c.cn("flex-1"),children:e.jsxs("div",{className:"relative min-h-full",children:[g.map((m,$)=>{const W=!y.isWorkingHour(n,m,r);return e.jsxs("div",{className:c.cn("relative flex",W&&"bg-calendar-disabled-hour",void 0),style:{height:Ue},children:[e.jsx("div",{className:c.cn("relative flex-shrink-0 border-r border-border/50 bg-background"),style:{width:jt},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:$!==0&&e.jsx("span",{className:c.cn("text-[10px] sm:text-xs text-muted-foreground"),children:y.formatHourLabel(m)})})}),e.jsxs("div",{className:"relative flex-1",children:[_&&!W&&e.jsx("div",{className:"absolute inset-0 bg-primary/5"}),$!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),k.slice(1).map(B=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${B/60*100}%`}},B)),k.map((B,F)=>{const Y={date:n,hour:m,minute:B};return e.jsx(gt,{slot:Y,onSelectionStart:j,onSelectionMove:L,onSelectionEnd:O,isSelected:T?.isSlotSelected(Y)??!1,isSelecting:T?.isSelecting??!1,disabled:W,className:"absolute inset-x-0",style:{top:`${F*u}%`,height:`${u}%`},ariaLabel:`Add event at ${y.formatHourLabel(m)}:${String(B).padStart(2,"0")}`},B)})]})]},m)}),e.jsx("div",{className:"absolute top-0 bottom-0 right-0 pointer-events-none",style:{left:jt},children:D.map(m=>{const $=S.get(m.id);if(!$)return null;const h=`calc(${$.width}% - 2px)`,W=`max(${bt}px, ${h})`;return f?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${$.top}px`,left:`${$.left}%`,width:W,minWidth:`${bt}px`},children:f({event:m,position:$})},m.id):e.jsx(pt,{event:m,position:{top:$.top,left:$.left,width:$.width,minWidth:bt},hourHeight:Ue,badgeVariant:l,onClick:i,disablePopover:!!i&&!M,renderPopover:M,className:c.cn("pointer-events-auto")},m.id)})}),_&&U>=0&&e.jsxs("div",{"data-ic-now":"",className:c.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none"),style:{top:U,left:jt},children:[e.jsx("div",{className:"h-2.5 w-2.5 -ml-1 rounded-full bg-red-500"}),e.jsx("div",{className:"flex-1 h-0.5 bg-red-500"})]})]})})]})}const hr=[{full:"Monday",short:"Mon",tiny:"M"},{full:"Tuesday",short:"Tue",tiny:"T"},{full:"Wednesday",short:"Wed",tiny:"W"},{full:"Thursday",short:"Thu",tiny:"T"},{full:"Friday",short:"Fri",tiny:"F"},{full:"Saturday",short:"Sat",tiny:"S"},{full:"Sunday",short:"Sun",tiny:"S"}],pr=[{full:"Sunday",short:"Sun",tiny:"S"},{full:"Monday",short:"Mon",tiny:"M"},{full:"Tuesday",short:"Tue",tiny:"T"},{full:"Wednesday",short:"Wed",tiny:"W"},{full:"Thursday",short:"Thu",tiny:"T"},{full:"Friday",short:"Fri",tiny:"F"},{full:"Saturday",short:"Sat",tiny:"S"}],Be=3;function Et({events:t,date:n,weekStartsOn:s=1,badgeVariant:r="colored",onEventClick:a,onSlotSelect:l,onDayClick:i,className:x,renderEvent:d,renderPopover:f,showMoreMode:M}){const v=M??"expand",[u,k]=o.useState(null),[E,D]=o.useState(null),C=o.useMemo(()=>y.generateMonthGrid(n,s),[n,s]),S=o.useMemo(()=>{const j=new Map;for(const L of C){const O=L.date.toDateString(),N=y.getEventsForDay(t,L.date);N.sort((R,P)=>R.startDate.getTime()-P.startDate.getTime()),j.set(O,N)}return j},[C,t]),g=ue.useOptionalSlotSelection(),b=o.useCallback(j=>{g?.startSelection(j)},[g]),_=o.useCallback(j=>{g?.updateSelection(j)},[g]),U=o.useCallback(()=>{g?.endSelection()},[g]),I=o.useCallback(j=>{i?.(j)},[i]),T=s===0?pr:hr;return e.jsxs("div",{className:c.cn("flex flex-col h-full overflow-hidden",x),children:[e.jsx("div",{className:"flex flex-col flex-1 overflow-auto",children:e.jsxs("div",{className:"flex flex-col flex-1 min-w-[560px] sm:min-w-0",children:[e.jsx("div",{className:c.cn("grid grid-cols-7 border-b !sticky !top-0 bg-background z-10"),children:T.map((j,L)=>e.jsxs("div",{className:c.cn("py-2 sm:py-2.5 text-center text-[11px] uppercase font-medium tracking-wide text-muted-foreground",L>=5&&"text-muted-foreground/70",void 0),children:[e.jsx("span",{className:"sm:hidden",children:j.short}),e.jsx("span",{className:"hidden sm:inline",children:j.short})]},j.full))}),e.jsx("div",{className:c.cn("grid grid-cols-7 auto-rows-min"),children:C.map(j=>{const L=j.date.toDateString(),O=S.get(L)||[],N=y.isToday(j.date),R=j.date.getDay()===0||j.date.getDay()===6,P=O.length>Be;return e.jsxs(Hn,{date:j.date,dataAttributes:{"data-day-key":L,...N&&{"data-ic-today":""}},onSelectionStart:b,onSelectionMove:_,onSelectionEnd:U,isSelected:g?.isSlotSelected({date:j.date})??!1,isSelecting:g?.isSelecting??!1,className:c.cn("relative flex flex-col border-r border-b text-left min-h-[80px] sm:min-h-[100px] overflow-hidden","[&:nth-child(7n)]:border-r-0",!j.isCurrentMonth&&"bg-muted/20",R&&j.isCurrentMonth&&"bg-muted/10",N&&!j.isCurrentMonth&&R&&void 0),ariaLabel:`${j.date.toLocaleDateString()} - ${O.length} events. Click to create event, double-click to view day.`,children:[e.jsx("div",{className:c.cn("flex items-center justify-center p-1",!j.isCurrentMonth&&"text-muted-foreground/40"),children:e.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),I(j.date)},className:c.cn("flex items-center justify-center rounded-full transition-colors","size-7 text-sm font-normal",N?"bg-primary text-primary-foreground":"hover:bg-muted"),children:j.date.getDate()})}),e.jsxs("div",{className:c.cn("flex-1 overflow-hidden px-2 pt-1 pb-1 space-y-1"),children:[O.slice(0,Be).map(H=>e.jsx("div",{onPointerDown:m=>{m.stopPropagation()},children:d?d({event:H,variant:"compact"}):e.jsx(Je,{event:H,variant:"compact",badgeVariant:r,onClick:a,disablePopover:!!a&&!f,renderPopover:f,showTime:!1,enableDrag:!0})},H.id)),P&&v==="expand"&&e.jsxs("button",{type:"button",onPointerDown:H=>H.stopPropagation(),onClick:H=>{H.stopPropagation();const m=document.querySelector(`[data-day-key="${L}"]`);D({date:j.date,events:O,rect:m?.getBoundingClientRect()??new DOMRect(window.innerWidth/2-180,window.innerHeight/2-240,0,0)})},className:c.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer"),children:["+",O.length-Be," more"]}),P&&v==="popover"&&e.jsxs(Ie,{open:u===L,onOpenChange:H=>k(H?L:null),children:[e.jsx(Re,{asChild:!0,children:e.jsxs("button",{type:"button",onPointerDown:H=>H.stopPropagation(),onClick:H=>{H.stopPropagation(),k(L)},className:c.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer"),children:["+",O.length-Be," more"]})}),e.jsxs(Te,{align:"start",side:"right",sideOffset:8,className:"w-72 max-h-80 overflow-y-auto p-2",onPointerDown:H=>H.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-2 pb-2 border-b",children:[e.jsx("span",{className:"text-sm font-medium",children:j.date.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[O.length," events"]})]}),e.jsx("div",{className:"space-y-1.5",children:O.map(H=>e.jsx("div",{children:d?d({event:H,variant:"compact"}):e.jsx(Je,{event:H,variant:"compact",badgeVariant:r,onClick:m=>{k(null),a?.(m)},disablePopover:!!a&&!f,renderPopover:f,showTime:!0})},H.id))})]})]}),P&&v==="dayView"&&e.jsxs("div",{onPointerDown:H=>{H.stopPropagation(),I(j.date)},className:c.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer"),children:["+",O.length-Be," more"]})]})]},L)})})]})}),e.jsx(Ln,{isOpen:E!==null,onClose:()=>D(null),date:E?.date??new Date,events:E?.events??[],anchorRect:E?.rect??null,badgeVariant:r,onEventClick:a,renderEvent:d,renderPopover:f})]})}const xt=26,Kt=2,rt=4;function Xt(t,n){const s=y.startOfDay(t);for(let a=0;a<n.length;a++){const l=n[a];if(l&&y.isSameDay(s,l))return a}const r=n[0];return r&&s<y.startOfDay(r)?-1:7}function gr(t){const n=[...t].sort((r,a)=>{const l=r.endCol-r.startCol,i=a.endCol-a.startCol;return i!==l?i-l:r.startCol-a.startCol}),s=[];return n.map(r=>{let a=-1;for(let i=0;i<s.length;i++){const x=s[i];if(!x)continue;let d=!0;for(let f=r.startCol;f<=r.endCol;f++)if(x[f]){d=!1;break}if(d){a=i;break}}a===-1&&(a=s.length,s.push(new Array(7).fill(!1)));const l=s[a];if(l)for(let i=r.startCol;i<=r.endCol;i++)l[i]=!0;return{...r,row:a}})}function yr({pe:t,onEventClick:n,disablePopover:s,renderPopover:r}){const[a,l]=o.useState(!1),i=He(t.event.color),x=o.useCallback(()=>{s&&n?n(t.event):s||l(!0)},[s,n,t.event]),d=o.useCallback(()=>{l(!1)},[]),f=e.jsxs("button",{type:"button",onClick:x,className:c.cn("inline-flex items-center gap-1 rounded text-[10px] font-medium transition-opacity hover:opacity-80 mx-0.5 overflow-hidden w-full","sm:text-xs",t.event.isCanceled?y.CANCELED_CHIP:[i.bg,i.text],t.continuesBefore&&"rounded-l-none -ml-0.5 pl-1",t.continuesAfter&&"rounded-r-none -mr-0.5 pr-1"),style:{height:xt,lineHeight:`${xt}px`,paddingLeft:t.continuesBefore?4:6,paddingRight:t.continuesAfter?4:6},children:[t.continuesBefore&&e.jsx("span",{className:"text-[9px] opacity-60 flex-shrink-0",children:"◂"}),e.jsx("span",{className:"truncate",children:t.event.title}),t.isSingleDayAllDay&&e.jsx("span",{className:"text-[9px] opacity-70 flex-shrink-0 hidden sm:inline",children:"All day"}),t.continuesAfter&&e.jsx("span",{className:"text-[9px] opacity-60 flex-shrink-0",children:"▸"})]}),M=e.jsx(be,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.event.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t.event)})]})}),v={gridColumn:`${t.startCol+2} / ${t.endCol+3}`,gridRow:t.row+1};return s?e.jsx("div",{style:v,children:e.jsxs(De,{children:[e.jsx(Ce,{asChild:!0,children:f}),M]})}):e.jsx("div",{style:v,children:e.jsxs(Ie,{open:a,onOpenChange:l,children:[e.jsx(Re,{asChild:!0,children:f}),e.jsx(Te,{className:"w-80",children:r?r({event:t.event,onClose:d}):e.jsx(vr,{event:t.event,onClose:d})})]})})}function vr({event:t,onClose:n}){const s=He(t.color),r=t.isCanceled??!1;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:c.cn("size-4 rounded shrink-0 mt-0.5",s.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:c.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums",children:y.formatEventTimeDisplay(t)})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function jr({events:t,weekDays:n,hourColumnWidth:s,minDayColumnWidth:r,dayColumnWidths:a,onEventClick:l,disablePopover:i=!1,renderPopover:x,className:d}){const f=o.useMemo(()=>{if(t.length===0)return[];const C=t.map(S=>{const g=Xt(S.startDate,n),b=Xt(S.endDate,n),_=Math.max(0,g),U=Math.min(6,b);if(_>6||U<0)return null;const I=g<0,T=b>6,L=y.detectAllDayEvent(S)&&y.isSameDay(S.startDate,S.endDate);return{event:S,startCol:_,endCol:U,continuesBefore:I,continuesAfter:T,isSingleDayAllDay:L}}).filter(Boolean);return gr(C)},[t,n]);if(f.length===0)return null;const M=Math.max(...f.map(C=>C.row))+1,v=Math.min(M,rt),u=M>rt,k=u?f.filter(C=>C.row>=rt).length:0,E=[`${s}px`,...a.map(C=>C>r?`${C}px`:`minmax(${r}px, 1fr)`)].join(" "),D=v*xt+(v-1)*Kt+8;return e.jsxs("div",{className:c.cn("ic-all-day-row border-b bg-muted/20 relative",d),style:{display:"grid",gridTemplateColumns:E,gridTemplateRows:`repeat(${v}, ${xt}px)`,gap:`${Kt}px 0`,paddingTop:4,paddingBottom:4,minHeight:D},children:[e.jsx("div",{className:"flex items-start justify-center pt-1 text-[10px] font-medium text-muted-foreground",style:{gridColumn:1,gridRow:`1 / span ${v}`},children:e.jsx("span",{className:"hidden sm:inline",children:"All day"})}),n.map((C,S)=>e.jsx("div",{className:"pointer-events-none border-r last:border-r-0",style:{gridColumn:S+2,gridRow:`1 / span ${v}`}},C.toDateString())),f.filter(C=>C.row<rt).map(C=>e.jsx(yr,{pe:C,onEventClick:l,disablePopover:i,renderPopover:x},C.event.id)),u&&e.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium px-2 flex items-center",style:{gridColumn:`2 / ${n.length+2}`,gridRow:v},children:["+",k," more"]})]})}let _e=null;function _n(t){return _e&&_e!==t&&_e(),_e=t,()=>{_e===t&&(_e=null)}}function _t({anchorRef:t,onClose:n,children:s,matchWidth:r,className:a}){const l=o.useRef(null),[i,x]=o.useState(null),d=o.useRef(n);return d.current=n,o.useEffect(()=>_n(()=>d.current()),[]),o.useLayoutEffect(()=>{const f=t.current,M=l.current;if(!f||!M)return;const v=f.getBoundingClientRect(),u=M.offsetHeight,k=r?v.width:M.offsetWidth,E=v.bottom+4,D=E+u>window.innerHeight-8?Math.max(8,v.top-u-4):E;x({left:Math.min(Math.max(8,v.left),window.innerWidth-k-8),top:D})},[t,r]),o.useEffect(()=>{const f=u=>{u.key==="Escape"&&(u.stopPropagation(),n())},M=u=>{const k=u.target;l.current?.contains(k)||t.current?.contains(k)||n()};document.addEventListener("keydown",f,!0);const v=window.setTimeout(()=>document.addEventListener("pointerdown",M,!0),0);return()=>{document.removeEventListener("keydown",f,!0),document.removeEventListener("pointerdown",M,!0),window.clearTimeout(v)}},[n,t]),typeof document>"u"?null:Tt.createPortal(e.jsx("div",{ref:l,"data-ic-layer":"",className:c.cn("fixed rounded-lg border bg-popover p-2 text-popover-foreground shadow-lg",a),style:{left:i?.left??-9999,top:i?.top??-9999,zIndex:ue.IC_Z_LAYER,visibility:i?"visible":"hidden",...r&&{width:t.current?.offsetWidth}},children:s}),document.body)}const On=["SU","MO","TU","WE","TH","FR","SA"],br=["first","second","third","fourth","last"],wr={doesNotRepeat:"Does not repeat",daily:"Daily",weeklyOn:t=>`Weekly on ${t}`,monthlyOnWeekday:(t,n)=>`Monthly on the ${br[t-1]??`${t}th`} ${n}`,monthlyOnDate:t=>`Monthly on day ${t}`,annuallyOn:t=>`Annually on ${t}`,everyWeekday:"Every weekday (Monday to Friday)",custom:"Custom…",summary:t=>`Every ${t.interval>1?`${t.interval} `:""}${{daily:"day",weekly:"week",monthly:"month",yearly:"year"}[t.freq]}`,customTitle:"Custom recurrence",repeatEvery:"Repeat every",repeatOn:"Repeat on",ends:"Ends",never:"Never",endsOn:"On",endsAfter:"After",occurrences:"occurrences",cancel:"Cancel",done:"Done",unit:{daily:"day",weekly:"week",monthly:"month",yearly:"year"}};function Nr(t){return Math.floor((t.getDate()-1)/7)+1}const dt=t=>On[t.getDay()],kr=t=>t.freq==="weekly"&&t.interval===1&&t.byWeekday?.length===5&&["MO","TU","WE","TH","FR"].every(n=>t.byWeekday?.includes(n)),Dr=(t,n)=>JSON.stringify(t??null)===JSON.stringify(n??null);function Cr(t){const n=s=>String(s).padStart(2,"0");return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}const Mt=t=>{const n=new Date(t);return n.setFullYear(n.getFullYear()+1),Cr(n)};function zn(t,n,s,r){const a=r?.freqs??["daily","weekly","monthly","yearly"],l=new Intl.DateTimeFormat(s,{weekday:"long"}).format(t),i=new Intl.DateTimeFormat(s,{day:"numeric",month:"long"}).format(t),x=r?.requireEnd?{until:(r.defaultUntil??Mt)(t)}:{},d=[{rule:null,label:n.doesNotRepeat}];return a.includes("daily")&&d.push({rule:{freq:"daily",interval:1,...x},label:n.daily}),a.includes("weekly")&&d.push({rule:{freq:"weekly",interval:1,byWeekday:[dt(t)],...x},label:n.weeklyOn(l)}),a.includes("monthly")&&d.push(r?.monthlyByWeekday===!1?{rule:{freq:"monthly",interval:1,monthly:"date",...x},label:n.monthlyOnDate(t.getDate())}:{rule:{freq:"monthly",interval:1,monthly:"weekday",...x},label:n.monthlyOnWeekday(Nr(t),l)}),a.includes("yearly")&&d.push({rule:{freq:"yearly",interval:1,...x},label:n.annuallyOn(i)}),a.includes("weekly")&&d.push({rule:{freq:"weekly",interval:1,byWeekday:["MO","TU","WE","TH","FR"],...x},label:n.everyWeekday}),d}const ot=c.cn("rounded-md border border-input bg-background px-2 py-1 text-sm","outline-none focus:border-primary");function Er({value:t,start:n,labels:s,locale:r,weekStartsOn:a=1,supports:l,onCancel:i,onDone:x}){const[d,f]=o.useState(()=>{const D=t??{freq:"weekly",interval:1,byWeekday:[dt(n)]};return!l?.requireEnd||D.until||D.count!=null?D:{...D,until:(l.defaultUntil??Mt)(n)}}),M=D=>f(C=>({...C,...D})),v=l?.freqs??["daily","weekly","monthly","yearly"],u=d.count!=null?"after":d.until?"on":"never",k=Array.from({length:7},(D,C)=>{const S=(a+C)%7,g=new Date(2024,0,7+S);return{key:On[S],letter:new Intl.DateTimeFormat(r,{weekday:"narrow"}).format(g)}}),E=D=>{const C=d.byWeekday??[],S=C.includes(D)?C.filter(g=>g!==D):[...C,D];M({byWeekday:S.length?S:[dt(n)]})};return typeof document>"u"?null:Tt.createPortal(e.jsx("div",{"data-ic-layer":"",className:"fixed inset-0 flex items-center justify-center bg-black/40",style:{zIndex:ue.IC_Z_MODAL},onPointerDown:D=>{D.target===D.currentTarget&&i()},children:e.jsxs("div",{role:"dialog","aria-label":s.customTitle,className:"w-[340px] rounded-xl bg-popover p-5 text-popover-foreground shadow-2xl",children:[e.jsx("h3",{className:"mb-4 text-base font-medium",children:s.customTitle}),e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"text-sm",children:s.repeatEvery}),e.jsx("input",{type:"number",min:1,max:99,"aria-label":s.repeatEvery,value:d.interval,onChange:D=>M({interval:Math.max(1,Number(D.target.value)||1)}),className:c.cn(ot,"w-16")}),e.jsx("select",{"aria-label":s.repeatEvery,value:d.freq,onChange:D=>{const C=D.target.value;M({freq:C,...C==="weekly"&&!d.byWeekday?.length?{byWeekday:[dt(n)]}:{},...C==="monthly"&&!d.monthly?{monthly:l?.monthlyByWeekday===!1?"date":"weekday"}:{}})},className:c.cn(ot,"flex-1"),children:v.map(D=>e.jsx("option",{value:D,children:s.unit[D]},D))})]}),d.freq==="weekly"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"mb-2 text-sm",children:s.repeatOn}),e.jsx("div",{className:"flex gap-1.5",children:k.map(({key:D,letter:C})=>{const S=d.byWeekday?.includes(D);return e.jsx("button",{type:"button","aria-pressed":S,"aria-label":D,onClick:()=>E(D),className:c.cn("size-8 rounded-full text-xs font-medium",S?"bg-primary text-primary-foreground":"bg-muted hover:bg-accent"),children:C},D)})})]}),e.jsxs("fieldset",{className:"mb-5",children:[e.jsx("legend",{className:"mb-2 text-sm",children:s.ends}),e.jsxs("div",{className:"flex flex-col gap-2",children:[!l?.requireEnd&&e.jsxs("label",{className:"flex items-center gap-3 text-sm",children:[e.jsx("input",{type:"radio",name:"ic-recurrence-ends",checked:u==="never",onChange:()=>M({until:null,count:null}),className:"size-4 accent-[var(--primary)]"}),s.never]}),l?.until!==!1&&e.jsxs("label",{className:"flex items-center gap-3 text-sm",children:[e.jsx("input",{type:"radio",name:"ic-recurrence-ends",checked:u==="on",onChange:()=>M({count:null,until:(l?.defaultUntil??Mt)(n)}),className:"size-4 accent-[var(--primary)]"}),e.jsx("span",{className:"w-12",children:s.endsOn}),e.jsx("input",{type:"date","aria-label":s.endsOn,disabled:u!=="on",value:d.until??"",onChange:D=>M({until:D.target.value,count:null}),className:c.cn(ot,"flex-1 disabled:opacity-50")})]}),l?.count!==!1&&e.jsxs("label",{className:"flex items-center gap-3 text-sm",children:[e.jsx("input",{type:"radio",name:"ic-recurrence-ends",checked:u==="after",onChange:()=>M({until:null,count:13}),className:"size-4 accent-[var(--primary)]"}),e.jsx("span",{className:"w-12",children:s.endsAfter}),e.jsx("input",{type:"number",min:1,max:999,"aria-label":s.occurrences,disabled:u!=="after",value:d.count??"",onChange:D=>M({count:Math.max(1,Number(D.target.value)||1),until:null}),className:c.cn(ot,"w-16 disabled:opacity-50")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.occurrences})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",onClick:i,className:"h-9 rounded-md px-3 text-sm font-medium text-primary hover:bg-accent",children:s.cancel}),e.jsx("button",{type:"button",onClick:()=>x(d),className:"h-9 rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/80",children:s.done})]})]})}),document.body)}function Mr({value:t,onChange:n,start:s,locale:r,weekStartsOn:a,supports:l,labels:i,disabled:x}){const d={...wr,...i},[f,M]=o.useState(!1),[v,u]=o.useState(!1),k=o.useRef(null),E=zn(s,d,r,l),D=E.find(S=>Dr(S.rule,t)),C=D?.label??(t?kr(t)?d.everyWeekday:d.summary(t):d.doesNotRepeat);return o.useEffect(()=>{if(f)return _n(()=>M(!1))},[f]),o.useEffect(()=>{if(!f)return;const S=b=>{k.current?.contains(b.target)||M(!1)},g=window.setTimeout(()=>document.addEventListener("pointerdown",S,!0),0);return()=>{document.removeEventListener("pointerdown",S,!0),window.clearTimeout(g)}},[f]),e.jsxs("div",{ref:k,className:"relative w-fit",children:[e.jsxs("button",{type:"button",disabled:x,onClick:()=>M(S=>!S),className:c.cn("flex items-center gap-1 rounded-md px-2 py-1 text-sm","hover:bg-accent hover:text-accent-foreground","disabled:cursor-not-allowed disabled:opacity-50",f&&"bg-accent text-accent-foreground"),children:[C,e.jsx(Le.ChevronDown,{className:c.cn("size-4",f&&"rotate-180")})]}),f&&e.jsxs("div",{"data-ic-layer":"",role:"listbox",className:c.cn("absolute left-0 top-full mt-1 w-64 rounded-lg border p-1","bg-popover text-popover-foreground shadow-lg"),style:{zIndex:ue.IC_Z_LAYER},children:[E.map(S=>e.jsx("button",{type:"button",role:"option","aria-selected":S===D,onClick:()=>{n(S.rule),M(!1)},className:c.cn("w-full rounded px-3 py-1.5 text-left text-sm","hover:bg-accent hover:text-accent-foreground",S===D&&"bg-accent font-medium"),children:S.label},S.label)),e.jsx("button",{type:"button",role:"option","aria-selected":!D&&!!t,onClick:()=>{M(!1),u(!0)},className:"w-full rounded px-3 py-1.5 text-left text-sm hover:bg-accent hover:text-accent-foreground",children:d.custom})]}),v&&e.jsx(Er,{value:t,start:s,labels:d,...r&&{locale:r},...a!==void 0&&{weekStartsOn:a},...l&&{supports:l},onCancel:()=>u(!1),onDone:S=>{n(S),u(!1)}})]})}const Oe=6e4,Jt=1440,Sr={allDay:"All day",startDate:"Start date",startTime:"Start time",endTime:"End time",endDate:"End date",duration:t=>{const n=Math.floor(t/60),s=t%60;return n?s?`${n} h ${s}`:`${n} h`:`${s} min`}},wt=t=>{const n=new Date(t);return n.setHours(0,0,0,0),n},at=t=>{const n=new Date(t);return n.setHours(23,59,59,999),n};function Nt(t,n){const s=new Date(n);return s.setHours(t.getHours(),t.getMinutes(),0,0),s}const Qt=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate(),Pn=c.cn("rounded-md px-2 py-1 text-sm whitespace-nowrap","hover:bg-accent hover:text-accent-foreground","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50");function Zt({value:t,onSelect:n,label:s,locale:r,weekStartsOn:a,disabled:l,menu:i}){const x=o.useRef(null),{open:d,onOpen:f,onClose:M}=i,v=new Intl.DateTimeFormat(r,{weekday:"short",day:"numeric",month:"short"}).format(t);return e.jsxs(e.Fragment,{children:[e.jsx("button",{ref:x,type:"button","aria-label":s,"aria-expanded":d,disabled:l,onClick:()=>{d?M():f()},className:c.cn(Pn,d&&"bg-accent text-accent-foreground"),children:v}),d&&e.jsx(_t,{anchorRef:x,onClose:M,className:"w-64",children:e.jsx(At,{selected:t,onSelect:u=>{n(u),M()},...r&&{locale:r},...a!==void 0&&{weekStartsOn:a}})})]})}function en({value:t,options:n,onSelect:s,onType:r,label:a,locale:l,hour12:i,disabled:x,menu:d}){const f=o.useRef(null),M=o.useRef(null),{open:v,onOpen:u,onClose:k}=d,[E,D]=o.useState(null),C=o.useRef(!1);o.useEffect(()=>{if(!v){C.current=!1;return}M.current?.querySelector('[data-current="true"]')?.scrollIntoView?.({block:"center"})},[v]);const S=()=>{if(E===null)return;const g=y.parseClockText(E);g&&r(g.hours,g.minutes),D(null)};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:f,type:"text",role:"combobox","aria-label":a,"aria-haspopup":"listbox","aria-expanded":v,autoComplete:"off",spellCheck:!1,disabled:x,value:E??y.formatClock(t,{locale:l,hour12:i}),onFocus:g=>{u(),g.currentTarget.select()},onClick:()=>{v||u()},onChange:g=>D(g.target.value),onKeyDown:g=>{g.key==="Enter"?(g.preventDefault(),S(),k()):g.key==="Escape"&&D(null)},onBlur:()=>{C.current||(S(),k())},className:c.cn(Pn,"bg-transparent",i?"w-24":"w-[4.5rem]",v&&"bg-accent text-accent-foreground")}),v&&e.jsx(_t,{anchorRef:f,onClose:k,className:"p-1",children:e.jsx("div",{ref:M,role:"listbox","aria-label":a,onPointerDown:()=>{C.current=!0},onPointerUp:()=>{setTimeout(()=>{C.current=!1},0)},className:"max-h-64 w-44 overflow-y-auto",children:n.map(g=>{const b=g.at.getHours()===t.getHours()&&g.at.getMinutes()===t.getMinutes();return e.jsxs("button",{type:"button",role:"option","aria-label":g.hint?`${g.text}, ${g.hint}`:g.text,"aria-selected":b,"data-current":b,onClick:()=>{D(null),s(g.at),k()},className:c.cn("flex w-full items-center gap-2 rounded px-2 py-1 text-left text-sm","hover:bg-accent hover:text-accent-foreground",b&&"bg-accent font-medium text-accent-foreground"),children:[e.jsx("span",{children:g.text}),g.hint&&e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:g.hint})]},g.at.toISOString())})})})]})}function Tr({start:t,end:n,allDay:s=!1,onChange:r,locale:a,hour12:l,step:i=15,weekStartsOn:x,labels:d,showAllDay:f=!0,children:M,disabled:v}){const u={...Sr,...d},k=Math.max(1,Math.round((n.getTime()-t.getTime())/Oe)),[E,D]=o.useState(null),C=O=>({open:E===O,onOpen:()=>D(O),onClose:()=>D(N=>N===O?null:N)}),S=Array.from({length:Math.floor(Jt/i)},(O,N)=>{const R=new Date(wt(t).getTime()+N*i*Oe);return{at:R,text:y.formatClock(R,{locale:a,hour12:l})}}),g=Array.from({length:Math.floor(Jt/i)},(O,N)=>{const R=(N+1)*i,P=new Date(t.getTime()+R*Oe);return{at:P,text:y.formatClock(P,{locale:a,hour12:l}),hint:u.duration(R)}}),b=O=>r({start:O,end:new Date(O.getTime()+k*Oe)}),_=(O,N)=>{const R=new Date(t);R.setHours(O,N,0,0),b(R)},U=(O,N)=>{const R=new Date(n);if(R.setHours(O,N,0,0),R<=t){if(!Qt(t,n)){r({end:t});return}R.setDate(R.getDate()+1)}r({end:R})},I=O=>{const N=s?wt(O):Nt(t,O);r({start:N,end:s?at(N>n?O:n):new Date(N.getTime()+k*Oe)})},T=O=>{const N=s?at(O):Nt(n,O);r({end:N<t?s?at(t):t:N})},j=()=>{if(s){const O=Nt(new Date(t.setHours(9,0,0,0)),t);r({allDay:!1,start:O,end:new Date(O.getTime()+60*Oe)});return}r({allDay:!0,start:wt(t),end:at(n)})},L=s||!Qt(t,n);return e.jsxs("div",{className:"flex items-start px-4 py-1.5",children:[e.jsx("span",{className:"flex w-8 shrink-0 items-start pt-1.5 text-muted-foreground",children:e.jsx(Le.Clock,{className:"size-4"})}),e.jsxs("div",{className:"-ml-2 flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5",children:[e.jsx(Zt,{value:t,onSelect:I,label:u.startDate,menu:C("startDate"),...a&&{locale:a},...x!==void 0&&{weekStartsOn:x},...v&&{disabled:v}}),!s&&e.jsxs(e.Fragment,{children:[e.jsx(en,{value:t,options:S,onSelect:b,onType:_,label:u.startTime,menu:C("startTime"),...a&&{locale:a},...l!==void 0&&{hour12:l},...v&&{disabled:v}}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"–"}),e.jsx(en,{value:n,options:g,onSelect:O=>r({end:O}),onType:U,label:u.endTime,menu:C("endTime"),...a&&{locale:a},...l!==void 0&&{hour12:l},...v&&{disabled:v}})]}),L&&e.jsxs(e.Fragment,{children:[s&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"–"}),e.jsx(Zt,{value:n,onSelect:T,label:u.endDate,menu:C("endDate"),...a&&{locale:a},...x!==void 0&&{weekStartsOn:x},...v&&{disabled:v}})]})]}),f&&e.jsx("div",{className:"py-1 pl-2",children:e.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:s,disabled:v,onChange:j,className:"size-4 shrink-0 accent-[var(--primary)] disabled:cursor-not-allowed disabled:opacity-50"}),u.allDay]})}),M]})]})}const Me=y.DEFAULT_HOUR_HEIGHT,tn=64,Lr=76,Ir=140,Rr=96;function nn(t){if(t.resourceId)return t.resourceId;const n=t.data;return n?.userId?String(n.userId):n?.user?.id?n.user.id:t.user?.id?t.user.id:t.participants?.[0]?.id}function Wn(t){return t.getHours()*y.MINUTES_IN_HOUR+t.getMinutes()}function Hr(t,n){const s=[...t].sort((a,l)=>a.startDate.getTime()-l.startDate.getTime()),r=[];for(const a of s){const l=r.at(-1),i=l?.some(x=>x.endDate.getTime()>a.startDate.getTime());l&&i?l.push(a):r.push([a])}return r.flatMap(a=>a.map((l,i)=>{const x=(Wn(l.startDate)-n*y.MINUTES_IN_HOUR)/y.MINUTES_IN_HOUR*Me,d=Math.max(18,(l.endDate.getTime()-l.startDate.getTime())/(1e3*60*y.MINUTES_IN_HOUR)*Me),f=100/a.length;return{event:l,top:x,height:d,left:f*i,width:f}}))}function qe({events:t,dates:n,resources:s,visibleHours:r,badgeVariant:a,slotDuration:l=30,locale:i,onEventClick:x,renderPopover:d,className:f}){const M=o.useMemo(()=>Array.from({length:Math.max(1,r.endHour-r.startHour)},(I,T)=>r.startHour+T),[r.startHour,r.endHour]),v=o.useMemo(()=>n.map(I=>I.toDateString()),[n]),u=o.useMemo(()=>t.filter(I=>v.includes(I.startDate.toDateString())),[t,v]),k=o.useMemo(()=>{const I=new Map(s.map(T=>[T.id,T]));for(const T of u){const j=nn(T);if(!j||I.has(j))continue;const L=T.participants?.find(N=>N.id===j),O=T.data?.user;I.set(j,L??O??{id:j,name:j})}return[...I.values()]},[s,u]),E=o.useMemo(()=>{const I=new Map;for(const T of v)for(const j of k)I.set(`${T}|${j.id}`,[]);for(const T of u){const j=nn(T);j&&I.get(`${T.startDate.toDateString()}|${j}`)?.push(T)}return I},[u,k,v]),D=o.useMemo(()=>{if(!n.some(y.isToday))return null;const T=(Wn(new Date)-r.startHour*y.MINUTES_IN_HOUR)/y.MINUTES_IN_HOUR*Me;return T>=0&&T<=M.length*Me?T:null},[n,r.startHour,M.length]),C=M.length*Me;if(k.length===0)return e.jsx("div",{className:c.cn("flex h-full items-center justify-center p-8 text-center","text-sm text-muted-foreground",f),children:"Select at least one person to see their day."});const S=n.length>1,g=ue.useOptionalSlotSelection(),b=Math.max(1,Math.round(y.MINUTES_IN_HOUR/l)),_=Me/b,U=S?Rr:Ir;return e.jsx("div",{className:c.cn("flex h-full flex-col",f),children:e.jsx("div",{className:"relative flex-1 overflow-auto",children:e.jsxs("div",{className:"min-w-max",children:[e.jsxs("div",{className:"sticky top-0 z-30 flex border-b bg-background",style:{height:Lr},children:[e.jsx("div",{className:"sticky left-0 z-10 flex shrink-0 flex-col items-center justify-center bg-background",style:{width:tn},children:!S&&n[0]&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:new Intl.DateTimeFormat(i,{weekday:"short"}).format(n[0])}),e.jsx("span",{className:c.cn("mt-0.5 flex size-9 items-center justify-center rounded-full text-xl",y.isToday(n[0])?"bg-primary font-medium text-primary-foreground":"text-foreground"),children:n[0].getDate()})]})}),n.map(I=>e.jsxs("div",{className:"flex flex-1 flex-col border-r last:border-r-0",style:{minWidth:U*k.length},children:[S&&e.jsxs("div",{className:"flex items-center justify-center gap-1.5 pt-1",children:[e.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:new Intl.DateTimeFormat(i,{weekday:"short"}).format(I)}),e.jsx("span",{className:c.cn("flex size-6 items-center justify-center rounded-full text-sm",y.isToday(I)?"bg-primary font-medium text-primary-foreground":"text-foreground"),children:I.getDate()})]}),e.jsx("div",{className:"flex flex-1",children:k.map(T=>e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-center justify-center gap-0.5 px-1",children:[!S&&e.jsx("span",{className:"max-w-full truncate text-[13px]",children:T.name}),T.avatar?e.jsx("img",{src:T.avatar,alt:T.name,title:T.name,className:c.cn("rounded-full object-cover",S?"size-5":"size-7")}):e.jsx("span",{title:T.name,className:c.cn("flex items-center justify-center rounded-full bg-muted font-medium text-muted-foreground",S?"size-5 text-[10px]":"size-7 text-xs"),children:T.name.charAt(0).toUpperCase()}),S&&e.jsx("span",{title:T.name,className:"w-full truncate text-center text-[10px] leading-tight text-muted-foreground",children:T.name})]},T.id))})]},I.toDateString()))]}),e.jsxs("div",{className:"relative flex",style:{height:C},children:[e.jsx("div",{className:c.cn("sticky left-0 z-10 shrink-0 border-r bg-background"),style:{width:tn},children:M.map((I,T)=>e.jsx("div",{className:"relative",style:{height:Me},children:T!==0&&e.jsx("span",{className:c.cn("absolute -top-2 right-2 text-[10px] text-muted-foreground"),children:y.formatClock(new Date(2e3,0,1,I),{locale:i})})},I))}),n.map(I=>e.jsx("div",{className:"flex flex-1 border-r last:border-r-0",style:{minWidth:U*k.length},children:k.map(T=>{const j=Hr(E.get(`${I.toDateString()}|${T.id}`)??[],r.startHour);return e.jsxs("div",{className:"relative flex-1 border-r border-border/40 last:border-r-0",children:[M.map(L=>e.jsx("div",{className:c.cn("relative border-b border-border/60"),style:{height:Me},children:Array.from({length:b},(O,N)=>{const R=N*l,P={date:I,hour:L,minute:R,resourceId:T.id};return e.jsx(gt,{slot:P,onSelectionStart:H=>g?.startSelection(H),onSelectionMove:H=>g?.updateSelection(H),onSelectionEnd:()=>g?.endSelection(),isSelected:g?.isSlotSelected(P)??!1,isSelecting:g?.isSelecting??!1,className:"absolute inset-x-0",style:{top:N*_,height:_}},R)})},L)),j.map(({event:L,top:O,height:N,left:R,width:P})=>e.jsx("div",{className:"pointer-events-none absolute z-10 px-0.5",style:{top:O,height:N,left:`${R}%`,width:`${P}%`},children:e.jsx(pt,{event:L,position:{top:0,left:0,width:100},hourHeight:Me,...a&&{badgeVariant:a},onClick:x,disablePopover:!!x&&!d,renderPopover:d,className:c.cn("!relative !inset-auto h-full w-full pointer-events-auto")})},L.id))]},T.id)})},I.toDateString())),D!==null&&e.jsxs("div",{"data-ic-now":"",className:"pointer-events-none absolute left-0 right-0 z-20 flex items-center",style:{top:D},children:[e.jsx("span",{className:"ml-[58px] size-3 shrink-0 rounded-full bg-red-500"}),e.jsx("span",{className:"h-0.5 flex-1 bg-red-500"})]})]})]})})})}const kt=44,sn=4,Ar=56,rn=8,it=80,Ve=140,on=100,an=2,_r=8,Or=18;function zr(t){return t.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2)}function Pr(t,n){const s=[];for(let r=0;r<n;r++){const a=new Date(t);a.setDate(a.getDate()+r),s.push(a)}return s}function Wr(t,n,s){const r=[];return t.forEach((a,l)=>{for(let i=n;i<s;i++)r.push({hour:i,dayIndex:l,date:a})}),r}function Dt(t){return`${t.toString().padStart(2,"0")}:00`}function $r(t){return t.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function ln(t){const n=[...t].sort((a,l)=>a.startCol!==l.startCol?a.startCol-l.startCol:l.spanCols-a.spanCols),s=[],r=[];for(const a of n){let l=0;for(;r[l]!==void 0&&r[l]>a.startCol;)l++;r[l]=a.startCol+a.spanCols,s.push({...a,stackIndex:l})}return s}function Fr(t,n,s,r,a){const l=t.startDate.getHours()+t.startDate.getMinutes()/60,i=t.endDate.getHours()+t.endDate.getMinutes()/60;let x=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY;for(let f=0;f<n.length;f++){const M=n[f],v=y.startOfDay(M),u=y.endOfDay(M);if(!(t.startDate<=u&&t.endDate>=v))continue;let k=t.startDate>=v?Math.max(s,l):s,E=t.endDate<=u?Math.min(r,i):r;if(k=Math.max(s,Math.min(r,k)),E=Math.max(s,Math.min(r,E)),E>k){const D=f*a+(k-s),C=f*a+(E-s);x=Math.min(x,D),d=Math.max(d,C)}}return d>x?{startCol:x,spanCols:d-x}:null}function Ur({src:t,alt:n,fallback:s,className:r}){return e.jsx("div",{className:c.cn("relative flex shrink-0 overflow-hidden rounded-sm border bg-muted",r),children:t?e.jsx("img",{src:t,alt:n,className:"aspect-square h-full w-full object-cover"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-muted text-muted-foreground",children:s})})}const Br=18,qr=10,Vr=32;function Yr({text:t,className:n}){const s=o.useRef(null),r=o.useRef(null),[a,l]=o.useState({active:!1,durationSec:0});return o.useLayoutEffect(()=>{const i=s.current,x=r.current;if(!i||!x)return;const d=()=>{const M=x.offsetWidth,v=i.clientWidth;if(M>v+1){const u=M+Vr,k=Math.max(qr,u/Br);l(E=>E.active&&Math.abs(E.durationSec-k)<.1?E:{active:!0,durationSec:k})}else l(u=>u.active?{active:!1,durationSec:0}:u)};d();const f=new ResizeObserver(d);return f.observe(i),f.observe(x),()=>f.disconnect()},[t]),e.jsx("div",{ref:s,className:c.cn("ic-marquee relative min-w-0 overflow-hidden",a.active&&"ic-marquee--active",n),children:e.jsxs("div",{className:"ic-marquee-track inline-flex whitespace-nowrap will-change-transform",style:a.active?{animationDuration:`${a.durationSec}s`}:void 0,children:[e.jsx("span",{ref:r,className:"ic-marquee-copy",children:t}),a.active&&e.jsx("span",{"aria-hidden":"true",className:"ic-marquee-copy",children:t})]})})}const Gr=7;function ut({daysToShow:t=Gr,events:n,users:s=[],alwaysShowResources:r,selectedDate:a,onDateChange:l,onEventClick:i,onSlotClick:x,onSlotSelect:d,visibleHours:f,className:M,getEventUserId:v,renderPopover:u,enableDrag:k=!0,resourceColumnConfig:E}){const D=E?.variant??"marquee",C=E?.showAvatar??"auto",S=o.useRef(null),g=ue.useOptionalDragDrop(),[b,_]=o.useState(null),U=o.useRef(!1),[I,T]=o.useState(null),j=a??new Date,L=!0,O=f?.from??_r,N=f?.to??Or,R=N-O,P=o.useMemo(()=>{const p=new Date(j);if(t===1||t===3)return p.setHours(0,0,0,0),p;const A=p.getDay(),z=A===0?-6:1-A;return p.setDate(p.getDate()+z),p.setHours(0,0,0,0),p},[j,t]),H=o.useMemo(()=>Pr(P,t),[P,t]),m=o.useMemo(()=>Wr(H,O,N),[L,H,O,N]),h=v??(p=>{if(p.resourceId)return p.resourceId;const A=p.data;if(A?.userId)return String(A.userId);if(A?.user&&typeof A.user=="object"&&A.user.id)return String(A.user.id);if(p.user?.id)return p.user.id;if(p.participants?.[0]?.id)return p.participants[0].id}),W=o.useMemo(()=>{const p=new Map;for(const A of s)p.set(A.id,{id:A.id,name:A.name,avatar:A.avatar??void 0,email:A.email});for(const A of n){const q=A.data?.user;q?.id&&!p.has(q.id)&&p.set(q.id,{id:q.id,name:q.name??"",avatar:q.avatar??void 0,email:q.email}),A.user?.id&&!p.has(A.user.id)&&p.set(A.user.id,{id:A.user.id,name:A.user.name,avatar:A.user.avatar??void 0,email:A.user.email});for(const V of A.participants||[])V.id&&!p.has(V.id)&&p.set(V.id,{id:V.id,name:V.name,avatar:V.avatar??void 0,email:V.email})}return Array.from(p.values())},[s,n]),B=o.useMemo(()=>{const p=[],A=new Map;for(const V of W)A.set(V.id,[]);A.set("unassigned",[]);for(const V of n){const X=h(V)??"unassigned";(A.get(X)??A.get("unassigned")).push(V)}const z=V=>{const X=[];for(const te of V){const ae=Fr(te,H,O,N,R);ae&&X.push({event:te,...ae})}return X};for(const V of W){const X=A.get(V.id)??[],te=z(X),ae=ln(te),xe=ae.reduce((de,he)=>Math.max(de,he.stackIndex+1),0);p.push({user:V,events:ae,maxStack:Math.max(xe,1)})}const q=A.get("unassigned")??[];if(q.length>0){const V=z(q),X=ln(V),te=X.reduce((ae,xe)=>Math.max(ae,xe.stackIndex+1),0);p.push({user:{id:"unassigned",name:"Unassigned",avatar:void 0,email:void 0},events:X,maxStack:Math.max(te,1)})}if(r?.length){const V=new Set(p.map(X=>X.user.id));for(const X of r)V.has(X.id)||(p.push({user:{id:X.id,name:X.name,avatar:X.avatar??void 0,email:X.email},events:[],maxStack:1}),V.add(X.id))}return p},[W,n,H,L,R,O,N,h,r]),F=o.useMemo(()=>{const p=new Map;for(const A of B)for(const z of A.events)if(z.spanCols<=1){const q=Math.floor(z.startCol),V=p.get(q)??0;p.set(q,V+1)}return p},[B]),Y=o.useMemo(()=>{const p=m.length,A=it,z=[];for(let q=0;q<p;q++){const V=F.get(q)??0;V>an?z.push(on+(V-an)*20):V>0?z.push(Math.max(A,on)):z.push(A)}return z},[L,m.length,H.length,F]),se=p=>Math.max(Ar,p*(kt+sn)+rn*2),J=Ve+Y.reduce((p,A)=>p+A,0),K=o.useMemo(()=>{const p=[0];for(let A=0;A<Y.length;A++)p.push(p[A]+Y[A]);return p},[Y]),ne=o.useCallback(p=>{const A=K.length-1;if(p<=0)return K[0]??0;if(p>=A)return K[A]??0;const z=Math.floor(p),q=K[z]??0,V=K[z+1]??q;return q+(p-z)*(V-q)},[K]);o.useLayoutEffect(()=>{const p=S.current;if(!p)return;const A=()=>{let z=-1;const V=new Date().getHours();{for(let X=0;X<m.length;X++){const te=m[X];if(te&&y.isToday(te.date)&&te.hour<=V&&te.hour+1>V){z=X;break}}if(z===-1)for(let X=0;X<m.length;X++){const te=m[X];if(te&&y.isToday(te.date)){z=X;break}}}if(z!==-1){const X=(K[z]??0)+Ve,te=p.clientWidth,ae=Math.max(0,X-te/3);p.scrollTo({left:ae,behavior:"instant"})}};requestAnimationFrame(()=>{requestAnimationFrame(A)})},[j,m,H,K,L]);const oe=o.useCallback((p,A)=>{const z=A.getBoundingClientRect(),q=p-z.left+A.scrollLeft;for(let V=0;V<K.length-1;V++){const X=K[V],te=K[V+1];if(q>=X&&q<te){const ae=(q-X)/(te-X),xe=Math.floor(ae*60),de=Math.round(xe/15)*15;return{colIndex:V,minute:Math.min(de,45)}}}return null},[K]),ee=o.useCallback((p,A)=>{if(m[p]){const z=m[p],q=new Date(z.date);return q.setHours(z.hour,A??0,0,0),{date:q,hour:z.hour}}return{date:new Date}},[L,m,H]),fe=o.useCallback((p,A)=>{if(p.preventDefault(),p.dataTransfer.dropEffect="move",!g?.isDragging||!g.dragState)return;const z=p.currentTarget,q=oe(p.clientX,z);if(!q)return;const{colIndex:V,minute:X}=q,{date:te,hour:ae}=ee(V,X);g.updateDragPreview(te,ae,X,A);const{originalStartDate:xe,originalEndDate:de}=g.dragState,he=de.getTime()-xe.getTime(),Ne=m.length;let w;{const G=he/36e5;w=Math.max(1,Math.ceil(G))}w=Math.min(w,Ne-V),T({resourceId:A,colIndex:V,spanCols:w})},[g,oe,ee,L,m.length,H.length]),Q=o.useCallback(p=>{const A=p.relatedTarget;p.currentTarget.contains(A)||T(null)},[]),le=o.useCallback((p,A)=>{p.preventDefault(),T(null),g?.isDragging&&g.endDrag()},[g]),ie=o.useCallback((p,A)=>{if(!b||b.resourceId!==p)return!1;const z=Math.min(b.startCol,b.endCol),q=Math.max(b.startCol,b.endCol);return A>=z&&A<=q},[b]),Ee=o.useCallback((p,A)=>!I||I.resourceId!==p?!1:A>=I.colIndex&&A<I.colIndex+I.spanCols,[I]),re=o.useCallback((p,A,z)=>{z.button!==0&&z.pointerType==="mouse"||(d||x)&&(z.preventDefault(),U.current=!0,_({resourceId:p,startCol:A,endCol:A,isSelecting:!0}))},[d,x]),ce=o.useCallback((p,A,z)=>{if(U.current&&!(!b||b.resourceId!==p)){if(z.buttons===0){U.current=!1;return}_(q=>q?{...q,endCol:A}:null)}},[b]),we=o.useCallback(()=>{if(!U.current||!b)return;U.current=!1;const p=Math.min(b.startCol,b.endCol),A=Math.max(b.startCol,b.endCol),z=ee(p),q=ee(A),V=new Date(z.date),X=new Date(q.date);q.hour!==void 0&&X.setHours(q.hour+1,0,0,0);const te={startDate:V,endDate:X,resourceId:b.resourceId};p===A&&x&&x(z.date,z.hour,b.resourceId),d?.(te),_(ae=>ae?{...ae,isSelecting:!1}:null),setTimeout(()=>_(null),150)},[b,ee,L,x,d]);return o.useEffect(()=>{const p=()=>{U.current&&we()};return window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p),()=>{window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p)}},[we]),o.useEffect(()=>{g?.isDragging||T(null)},[g?.isDragging]),e.jsx("div",{className:c.cn("flex h-full flex-col",M),children:e.jsx("div",{className:"ic-timeline-scroll-container flex-1",ref:S,children:e.jsxs("div",{className:"relative",style:{minWidth:J},children:[e.jsx("div",{className:"ic-timeline-header sticky top-0 z-20 border-b bg-background",children:t>1?e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex shrink-0 items-center justify-center border-r bg-background px-2 sticky left-0 z-10",style:{width:Ve},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("div",{className:"flex border-b",children:H.map((p,A)=>{const z=y.isToday(p),q=A*R,V=Y.slice(q,q+R).reduce((X,te)=>X+te,0);return e.jsx("div",{className:c.cn("flex shrink-0 items-center justify-center border-r py-1.5 font-medium",z?"bg-primary/10 text-primary":"bg-muted/30"),style:{width:V},children:e.jsx("span",{className:"text-xs",children:$r(p)})},`day-${p.toISOString()}`)})}),e.jsx("div",{className:"flex",children:m.map((p,A)=>{const z=p.hour===O,q=y.isToday(p.date),V=Y[A]??it;return e.jsx("div",{className:c.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",z&&A>0?"border-l-2 border-l-border":"border-r border-r-border/50",q&&"bg-primary/5"),style:{width:V},children:Dt(p.hour)},`hour-${p.dayIndex}-${p.hour}`)})})]})]}):e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex shrink-0 items-center border-r bg-background px-2 py-2",style:{width:Ve},children:e.jsx("span",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Resources"})}),m.map((p,A)=>{const z=p.hour===O,q=y.isToday(p.date),V=Y[A]??it;return e.jsx("div",{className:c.cn("flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",z&&A>0?"border-l-2 border-l-border":"border-r border-r-border/50",q&&"bg-primary/5"),style:{width:V},children:Dt(p.hour)},`hour-${p.dayIndex}-${p.hour}`)})]})}),B.map(p=>{const A=se(p.maxStack);return e.jsxs("div",{className:c.cn("relative flex border-b"),style:{height:A},children:[e.jsx("div",{className:"sticky left-0 z-10",style:{width:Ve},children:e.jsxs("div",{className:c.cn("flex h-full items-center gap-2 sm:gap-3 border-r bg-background px-2 sm:px-4"),children:[(()=>{const z=!!p.user.avatar;return C===!0||C==="auto"&&z?e.jsx(Ur,{className:"size-7",src:p.user.avatar,alt:p.user.name,fallback:zr(p.user.name)}):null})(),D==="marquee"?e.jsx(Yr,{text:p.user.name,className:"flex-1 text-xs sm:text-sm font-medium"}):e.jsx("span",{className:"min-w-0 flex-1 truncate text-xs sm:text-sm font-medium",children:p.user.name})]})}),e.jsxs("div",{className:"ic-timeline-grid relative flex",onDragOver:z=>fe(z,p.user.id),onDragLeave:Q,onDrop:z=>le(z,p.user.id),children:[m.map((z,q)=>{const V=z.hour===O&&q>0,X=Y[q]??it,te=ie(p.user.id,q),ae=Ee(p.user.id,q),xe=!!(d||x);return e.jsx("div",{role:xe?"button":void 0,tabIndex:xe?0:void 0,"aria-label":xe?`Select ${Dt(z.hour)} on ${z.date.toLocaleDateString()} for ${p.user.name}`:void 0,onPointerDown:de=>re(p.user.id,q,de),onPointerEnter:de=>ce(p.user.id,q,de),onPointerUp:we,onKeyDown:de=>{if(xe&&(de.key==="Enter"||de.key===" ")){de.preventDefault();const he=ee(q);x?.(he.date,he.hour,p.user.id),d?.({startDate:he.date,endDate:(()=>{const Ne=new Date(he.date);return he.hour!==void 0&&Ne.setHours(he.hour+1,0,0,0),Ne})(),resourceId:p.user.id})}},className:c.cn("shrink-0 select-none touch-none transition-colors",xe&&"cursor-pointer",V?"border-l-2 border-l-border":"border-r border-r-border/50",y.isToday(z.date)&&"bg-primary/5",xe&&!b?.isSelecting&&!g?.isDragging&&"hover:bg-blue-50/60",te&&"bg-blue-100/70",ae&&"bg-primary/20 ring-2 ring-primary ring-inset"),style:{width:X}},`cell-${z.dayIndex}-${z.hour}`)}),p.events.map(z=>{const q=ne(z.startCol),V=ne(z.startCol+z.spanCols),X=q+2,te=V-q-4,ae=rn+z.stackIndex*(kt+sn),xe=z.event.data?.isPlaceholder===!0,de=z.event.endDate<y.startOfDay(new Date),he=k&&!!g&&!z.event.isCanceled&&!de&&!xe;return e.jsx("div",{className:c.cn("absolute",he&&"cursor-grab active:cursor-grabbing"),style:{left:X,width:Math.max(te,0),top:ae,height:kt},draggable:he||void 0,onDragStart:he?Ne=>{Ne.dataTransfer.effectAllowed="move",Ne.dataTransfer.setData("text/plain",z.event.id),g?.startDrag(z.event)}:void 0,children:e.jsx(Je,{event:z.event,variant:"compact",enableDrag:k,onClick:i,renderPopover:u,className:"h-full w-full"})},z.event.id)})]})]},p.user.id)}),B.length===0&&e.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:"No users or events to display"})]})})})}const ze=y.DEFAULT_HOUR_HEIGHT,Ye=56,cn=72,ke=120,lt=100,Kr=3;function St({events:t,date:n,days:s,weekStartsOn:r=1,visibleHours:a={startHour:0,endHour:24},workingHours:l,slotDuration:i=30,badgeVariant:x="colored",onEventClick:d,onSlotSelect:f,onDayClick:M,className:v,renderEvent:u,renderPopover:k}){const E=60/i,D=100/E,C=o.useMemo(()=>{const h=[];for(let W=0;W<E;W++)h.push(W*i);return h},[E,i]),S=o.useMemo(()=>{if(!s)return y.getWeekDays(n,r);const h=new Date(n);return h.setHours(0,0,0,0),Array.from({length:s},(W,B)=>y.addDays(h,B))},[n,r,s]),g=o.useMemo(()=>y.getVisibleHoursArray(a),[a]),b=o.useMemo(()=>{const h=new Map;for(const W of S){const B=W.toDateString(),F=y.getEventsForDay(t,W),{singleDay:Y,multiDay:se}=y.separateEventsByDuration(F),J=y.calculateOverlappingPositions(Y,W,a,ze),K=new Map;let ne=1;for(const oe of J)if(K.set(oe.event.id,oe.position),oe.position.width>0){const ee=Math.round(100/oe.position.width);ne=Math.max(ne,ee)}h.set(B,{singleDay:Y,multiDay:se,positions:K,maxOverlapping:ne})}return h},[S,t,a]),_=o.useMemo(()=>{const h=new Map;for(const{multiDay:W}of b.values())for(const B of W)h.set(B.id,B);return Array.from(h.values())},[b]),U=new Date,I=S.findIndex(h=>y.isToday(h)),T=o.useMemo(()=>{if(I<0)return-1;const h=U.getHours()+U.getMinutes()/60;return h<a.startHour||h>a.endHour?-1:(h-a.startHour)*ze},[I,a,U]),j=o.useRef(null);o.useLayoutEffect(()=>{const h=j.current;if(!h)return;const W=()=>{let B;if(I!==-1){const Y=new Date().getHours();B=Math.max(Y-1,a.startHour)}else{const se=new Date().getDay();let J=l?.[se];if(!J?.enabled||J.from===0){const K=l?.[1];K?.enabled&&(J=K)}J?.enabled&&J.from>0?B=Math.max(J.from-1,a.startHour):B=Math.max(7,a.startHour)}const F=(B-a.startHour)*ze;h.scrollTo({top:F,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(W)})},[n,l,a,I]);const L=ue.useOptionalSlotSelection(),O=o.useCallback(h=>{L?.startSelection(h)},[L]),N=o.useCallback(h=>{L?.updateSelection(h)},[L]),R=o.useCallback(()=>{L?.endSelection()},[L]),P=o.useCallback(h=>{d?.(h)},[d]),H=Ye+7*ke,m=o.useMemo(()=>{const h=[];for(const W of S){const B=W.toDateString(),Y=b.get(B)?.maxOverlapping??1;Y>Kr?h.push(Math.max(ke,Y*lt)):h.push(ke)}return h},[S,b]),$=Ye+m.reduce((h,W)=>h+W,0);return e.jsxs("div",{className:c.cn("ic-week-view flex flex-col h-full",v),children:[_.length>0&&e.jsx(jr,{events:_,weekDays:S,hourColumnWidth:Ye,minDayColumnWidth:ke,dayColumnWidths:m,onEventClick:P,disablePopover:!!d&&!k,renderPopover:k}),e.jsx("div",{ref:j,className:c.cn("ic-week-scroll-container flex-1"),children:e.jsxs("div",{style:{minWidth:Math.max(H,$)},children:[e.jsx("div",{className:"ic-week-header sticky top-0 z-20 border-b bg-background",children:e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"flex-shrink-0 flex items-end justify-center pb-2 text-[10px] text-muted-foreground/70",style:{width:Ye,height:cn},children:e.jsxs("span",{className:"hidden sm:inline",children:["GMT",(()=>{const h=new Date().getTimezoneOffset(),W=Math.abs(Math.floor(h/60)),B=h<=0?"+":"-";return W>0?`${B}${String(W).padStart(2,"0")}`:""})()]})}),S.map((h,W)=>{const B=y.isToday(h),F=m[W]??ke,Y=F>ke;return e.jsxs("div",{className:c.cn("flex-1 flex flex-col items-center justify-center border-r last:border-r-0 py-2"),style:{height:cn,minWidth:Y?F:ke},children:[e.jsx("span",{className:c.cn("text-[11px] font-medium uppercase tracking-wide",B?"text-primary":"text-muted-foreground"),children:h.toLocaleDateString([],{weekday:"short"})}),e.jsx("button",{type:"button",onClick:()=>M?.(h),className:c.cn("flex items-center justify-center rounded-full transition-colors mt-0.5","size-10 text-2xl font-normal",B?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"),children:h.getDate()})]},h.toDateString())})]})}),e.jsxs("div",{className:"relative flex",children:[e.jsx("div",{className:c.cn("ic-hour-column sticky left-0 z-10 bg-background border-r"),style:{width:Ye},children:g.map((h,W)=>e.jsx("div",{className:"relative",style:{height:ze},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:W!==0&&e.jsx("span",{className:c.cn("text-[10px] sm:text-xs text-muted-foreground"),children:y.formatHourLabel(h)})})},h))}),e.jsx("div",{className:"ic-week-grid relative flex-1",children:e.jsx("div",{className:"flex divide-x",children:S.map((h,W)=>{const B=h.toDateString(),F=b.get(B),Y=m[W]??ke,se=Y>ke;return e.jsxs("div",{className:"ic-day-column relative flex-1",style:{minWidth:se?Y:ke},children:[g.map((J,K)=>{const oe=!y.isWorkingHour(h,J,l);return e.jsxs("div",{className:c.cn("relative",oe&&"bg-calendar-disabled-hour",y.isToday(h)&&!oe&&"bg-primary/5"),style:{height:ze},children:[K!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),C.slice(1).map(ee=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${ee/60*100}%`}},ee)),C.map((ee,fe)=>{const Q={date:h,hour:J,minute:ee};return e.jsx(gt,{slot:Q,onSelectionStart:O,onSelectionMove:N,onSelectionEnd:R,isSelected:L?.isSlotSelected(Q)??!1,isSelecting:L?.isSelecting??!1,disabled:oe,className:"absolute inset-x-0",style:{top:`${fe*D}%`,height:`${D}%`},ariaLabel:`Add event on ${h.toLocaleDateString()} at ${y.formatHourLabel(J)}:${String(ee).padStart(2,"0")}`},ee)})]},J)}),F?.singleDay.map(J=>{const K=F.positions.get(J.id);if(!K)return null;const ne=`calc(${K.width}% - 2px)`,oe=`max(${lt}px, ${ne})`;return u?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${K.top}px`,left:`${K.left}%`,width:oe,minWidth:`${lt}px`},children:u({event:J,position:K})},J.id):e.jsx(pt,{event:J,position:{top:K.top,left:K.left,width:K.width,minWidth:lt},hourHeight:ze,badgeVariant:x,onClick:d,disablePopover:!!d&&!k,renderPopover:k,className:c.cn("pointer-events-auto")},J.id)}),W===I&&T>=0&&e.jsxs("div",{"data-ic-now":"",className:c.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none"),style:{top:T},children:[e.jsx("div",{className:"h-2 w-2 -ml-1 rounded-full bg-red-500"}),e.jsx("div",{className:"flex-1 h-0.5 bg-red-500"})]})]},h.toDateString())})})})]})]})})]})}const Xr=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Jr=["January","February","March","April","May","June","July","August","September","October","November","December"];function dn(t){const n=t.hexColor;return n?{backgroundColor:n}:{}}function Qr({day:t,date:n,events:s,isCurrentMonth:r,onDayClick:a}){const l=y.isToday(n),i=3,x=s.length;return e.jsxs("button",{type:"button",onClick:()=>a?.(n),className:c.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:c.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}),x>0&&e.jsx("div",{className:"mt-0.5 flex items-center gap-0.5",children:x<=i?s.map(d=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:dn(d)},d.id)):e.jsxs(e.Fragment,{children:[s.slice(0,i).map(d=>e.jsx("div",{className:"size-1 sm:size-1.5 rounded-full bg-primary",style:dn(d)},d.id)),e.jsxs("span",{className:"text-[6px] sm:text-[7px] font-medium text-muted-foreground",children:["+",x-i]})]})})]})}function Zr({date:t,events:n,onMonthClick:s,onDayClick:r}){const a=o.useMemo(()=>y.generateMonthGrid(t,0),[t]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("button",{type:"button",onClick:()=>s?.(t),className:c.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:Jr[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:Xr.map((l,i)=>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})]},i))}),e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 gap-y-1",children:a.map((l,i)=>{const x=y.getEventsForDay(n,l.date);return e.jsx(Qr,{day:l.date.getDate(),date:l.date,events:x,isCurrentMonth:l.isCurrentMonth,onDayClick:r},`${i+1}-${l.date.toISOString()}`)})})]})]})}function $n({events:t,year:n,onMonthClick:s,onDayClick:r,className:a}){const l=o.useMemo(()=>y.getYearMonths(n),[n]);return e.jsxs("div",{className:c.cn("flex flex-col h-full",a),children:[e.jsx("div",{className:"flex items-center justify-center border-b px-4 py-3",children:e.jsx("h2",{className:"text-lg font-semibold",children:n})}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:l.map(i=>e.jsx(Zr,{date:i,events:t,onMonthClick:s,onDayClick:r},i.getMonth()))})})]})}const eo=[],to=[],Fn=["day","4day","week","month","agenda"];function no(t){switch(t){case"day":case"4day":case"week":return"time";default:return"day"}}function so({onEventClick:t,onSlotClick:n,onSlotSelect:s,onAddEvent:r,alwaysShowResources:a,className:l,showHeader:i=!0,minSelectionMinutes:x=30,showMoreMode:d,showMoreEventsInPopover:f=!1,isLoading:M=!1,eventCard:v,eventForm:u,settingsContent:k,filterContent:E,headerActions:D,eventDetail:C,calendarRef:S,headerConfig:g,resourceColumnConfig:b,filters:_,labels:U,showSidebar:I=!1,sidebarContent:T,createLabel:j,locale:L}){const O=d??(f?"popover":"expand"),{view:N,setView:R,selectedDate:P,setSelectedDate:H,slotDuration:m,filteredEvents:$,users:h,visibleHours:W,workingHours:B,badgeVariant:F,showWorkingHoursOnly:Y,clearFocusEventId:se}=ue.useInnoCalendar(),J=o.useMemo(()=>{if(!Y||!B)return{startHour:W.start,endHour:W.end};let w=24,G=0;for(const Z of Object.keys(B)){const ge=B[Number(Z)];!ge||ge.enabled===!1||(ge.from<w&&(w=ge.from),ge.to>G&&(G=ge.to))}return w>=G?{startHour:W.start,endHour:W.end}:{startHour:w,endHour:G}},[Y,B,W]),K=J,ne=o.useRef(null),oe=o.useRef(null),ee=o.useMemo(()=>({scrollToToday:()=>{const w=new Date;H(w,N),requestAnimationFrame(()=>{requestAnimationFrame(()=>{const G=ne.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!G)return;const Z=w.getHours(),ge=y.DEFAULT_HOUR_HEIGHT,Ae=(Z-J.startHour)*ge;Ae>0&&G.scrollTo({top:Math.max(0,Ae-100),behavior:"smooth"})})})},openForm:w=>{if(!w?.start&&!w?.event)return oe.current?.();const G=w?.start??(w?.event).startDate,Z=w?.end??(w?.event?w.event.endDate:new Date(G.getTime()+30*6e4));Ee({selection:{startDate:G,endDate:Z,...w?.resourceId!==void 0&&{resourceId:w.resourceId}},...w?.anchor&&{anchor:w.anchor},...w?.event&&{event:w.event}})},getNowAnchor:()=>{const w=ne.current,G=w?.querySelector("[data-ic-now]")??w?.querySelector("[data-ic-today]");if(!G)return null;const Z=G.getBoundingClientRect();return Z.width===0&&Z.height===0||!(Z.bottom>0&&Z.top<window.innerHeight&&Z.right>0&&Z.left<window.innerWidth)?null:{x:Z.left,y:Z.top+Z.height/2}},scrollToWorkingHours:()=>{let w=8;if(B)for(const G of Object.keys(B)){const Z=B[Number(G)];Z?.enabled&&Z.from<w&&(w=Math.max(Z.from-1,0))}requestAnimationFrame(()=>{requestAnimationFrame(()=>{const G=ne.current?.querySelector(".ic-timeline-scroll-container, [class*='overflow-auto']");if(!G)return;const Z=y.DEFAULT_HOUR_HEIGHT,ge=(w-J.startHour)*Z;G.scrollTo({top:Math.max(0,ge),behavior:"smooth"})})})},getViewRect:()=>ne.current?.getBoundingClientRect()??null,focusEvent:w=>{se(),requestAnimationFrame(()=>{se()});const G=ne.current?.querySelector(`[data-event-id="${w}"]`);G&&setTimeout(()=>G.click(),150)}}),[H,N,J,B,se]);o.useImperativeHandle(S,()=>ee,[ee]);const fe=o.useRef(N);o.useEffect(()=>{if(fe.current===N||(fe.current=N,N==="month"||N==="year"||N==="agenda"))return;const w=setTimeout(()=>ee.scrollToToday(),300);return()=>clearTimeout(w)},[N,ee]);const Q=o.useMemo(()=>no(N),[N]),le=o.useRef({x:0,y:0}),[ie,Ee]=o.useState(null);o.useEffect(()=>{const w=G=>{le.current={x:G.clientX,y:G.clientY}};return document.addEventListener("pointerdown",w,!0),document.addEventListener("pointerup",w,!0),()=>{document.removeEventListener("pointerdown",w,!0),document.removeEventListener("pointerup",w,!0)}},[]);const re=o.useCallback(w=>{if(s){s(w,{anchor:{...le.current}});return}if(u){Ee({selection:w,anchor:{...le.current,align:"start"}});return}if(n){const G=w.startDate.getHours();n(w.startDate,G)}},[s,n,u]),ce=o.useCallback(w=>{R("day"),H(w,"day")},[H,R]),we=o.useCallback(w=>{R("month"),H(w,"month")},[H,R]),p=o.useCallback(w=>{t?.(w)},[t]),A=o.useCallback((w,G,Z)=>{n?.(w,G)},[n]),z=o.useCallback((w,G)=>{Ee({selection:{startDate:G?.start??w.startDate,endDate:G?.end??w.endDate},event:w})},[]),q=o.useCallback(()=>{const w=new Date,G=x??30;w.setMinutes(Math.floor(w.getMinutes()/G)*G,0,0);const Z=new Date(w.getTime()+G*6e4),ge=()=>{const $e=ee.getNowAnchor();return $e?{...$e,align:"end"}:void 0},Ae=$e=>Ee({selection:{startDate:w,endDate:Z},...$e&&{anchor:$e}}),Ot=ge();if(Ot)return Ae(Ot);ee.scrollToToday(),setTimeout(()=>Ae(ge()),450)},[ee,x]);oe.current=q;const V=r??(u?q:void 0),X=o.useMemo(()=>C?({event:w,onClose:G})=>C(w,{close:G,...u&&{edit:()=>{G(),setTimeout(()=>z(w),0)}}}):void 0,[C,u,z]),te=()=>{const w=$,G=p,Z=X;switch(N){case"day":return h.length>1?e.jsx(qe,{events:w,dates:[P],resources:h,visibleHours:K,slotDuration:m,badgeVariant:F,...L&&{locale:L},onEventClick:G,renderPopover:Z}):e.jsx(An,{events:w,date:P,visibleHours:K,workingHours:B,slotDuration:m,badgeVariant:F,onEventClick:G,renderPopover:Z});case"4day":return h.length>1?e.jsx(qe,{events:w,dates:Array.from({length:4},(ge,Ae)=>y.addDays(P,Ae)),resources:h,visibleHours:K,slotDuration:m,badgeVariant:F,...L&&{locale:L},onEventClick:G,renderPopover:Z}):e.jsx(St,{events:w,date:P,days:4,visibleHours:K,workingHours:B,slotDuration:m,badgeVariant:F,onEventClick:G,renderPopover:Z});case"week":return h.length>1?e.jsx(qe,{events:w,dates:y.getWeekDays(P),resources:h,visibleHours:K,slotDuration:m,badgeVariant:F,...L&&{locale:L},onEventClick:G,renderPopover:Z}):e.jsx(St,{events:w,date:P,visibleHours:K,workingHours:B,slotDuration:m,badgeVariant:F,onEventClick:G,renderPopover:Z});case"month":return e.jsx(Et,{events:w,date:P,badgeVariant:F,onEventClick:G,onDayClick:ce,renderPopover:Z,showMoreMode:O});case"year":return e.jsx($n,{events:w,year:P.getFullYear(),onMonthClick:we,onDayClick:ce});case"agenda":return e.jsx(Tn,{events:w,date:P,onEventClick:G,renderPopover:Z,...L&&{locale:L},...U?.agenda&&{labels:U.agenda}});case"resource-day":return e.jsx(qe,{events:w,dates:[P],resources:h,visibleHours:K,slotDuration:m,badgeVariant:F,...L&&{locale:L},onEventClick:G,renderPopover:Z});case"resource-week":return e.jsx(ut,{daysToShow:7,events:w,users:h,...a&&{alwaysShowResources:a},selectedDate:P,visibleHours:{from:J.startHour,to:J.endHour},onEventClick:G,onSlotSelect:re,onSlotClick:A,renderPopover:Z,...b&&{resourceColumnConfig:b}});case"timeline-day":return e.jsx(qe,{events:w,dates:[P],resources:h,visibleHours:K,slotDuration:m,badgeVariant:F,...L&&{locale:L},onEventClick:G,renderPopover:Z});case"timeline-3day":return e.jsx(ut,{daysToShow:3,events:w,users:h,...a&&{alwaysShowResources:a},selectedDate:P,visibleHours:{from:J.startHour,to:J.endHour},onEventClick:G,onSlotSelect:re,onSlotClick:A,renderPopover:Z,...b&&{resourceColumnConfig:b}});case"timeline-week":return e.jsx(ut,{daysToShow:7,events:w,users:h,...a&&{alwaysShowResources:a},selectedDate:P,visibleHours:{from:J.startHour,to:J.endHour},onEventClick:G,onSlotSelect:re,onSlotClick:A,renderPopover:Z,...b&&{resourceColumnConfig:b}});default:return e.jsx(Et,{events:w,date:P,badgeVariant:F,onEventClick:G,onDayClick:ce})}},ae=o.useRef(null);o.useEffect(()=>{ne.current=ae.current});const[xe,de]=o.useState(!1),he=e.jsxs(e.Fragment,{children:[_&&e.jsx(Sn,{...U?.filters&&{title:U.filters},children:_({close:()=>de(!1)})}),T]}),Ne=e.jsx(Se,{delayDuration:300,children:e.jsx(ue.SlotSelectionProvider,{mode:Q,onSelect:re,minDurationMinutes:x,slotDurationMinutes:m,enabled:!!(s||n||u)&&!ie,children:e.jsxs("div",{className:c.cn("inno-calendar-root flex h-full gap-4 p-4",l),children:[I&&e.jsx(Cn,{selected:P,onSelect:w=>H(w,N),events:$,...L&&{locale:L},...V&&{onCreate:V},...j&&{createLabel:j},children:he}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[i&&e.jsx(kn,{currentDate:P,view:N,...I&&{leadingAction:e.jsx(Mn,{open:xe,onOpenChange:de,selected:P,onSelect:w=>H(w,N),events:$,...L&&{locale:L},...V&&{onCreate:()=>{de(!1),V()}},...j&&{createLabel:j},...U?.filters&&{label:U.filters},children:he})},...U?.header&&{labels:U.header},events:$,onViewChange:R,onNavigateToday:()=>H(new Date,N),onNavigatePrev:()=>{const w=new Date(P);N==="day"||N==="timeline-day"||N==="resource-day"?w.setDate(w.getDate()-1):N==="timeline-3day"?w.setDate(w.getDate()-3):N==="4day"?w.setDate(w.getDate()-4):N==="week"||N==="timeline-week"||N==="resource-week"?w.setDate(w.getDate()-7):N==="month"?w.setMonth(w.getMonth()-1):N==="year"?w.setFullYear(w.getFullYear()-1):w.setDate(w.getDate()-7),H(w,N)},onNavigateNext:()=>{const w=new Date(P);N==="day"||N==="timeline-day"||N==="resource-day"?w.setDate(w.getDate()+1):N==="timeline-3day"?w.setDate(w.getDate()+3):N==="4day"?w.setDate(w.getDate()+4):N==="week"||N==="timeline-week"||N==="resource-week"?w.setDate(w.getDate()+7):N==="month"?w.setMonth(w.getMonth()+1):N==="year"?w.setFullYear(w.getFullYear()+1):w.setDate(w.getDate()+7),H(w,N)},availableViews:Fn,showTimelineViews:!0,showSettings:!0,...!D&&V&&{onAddEvent:V},actions:D,settingsContent:k,filterContent:E,...g&&{headerConfig:g}}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:ae,className:c.cn("h-full border rounded-lg bg-white overflow-x-auto"),children:te()}),M&&e.jsx("div",{className:"inno-calendar-loading-overlay",children:e.jsx("div",{className:"inno-calendar-spinner"})}),e.jsx(ar,{containerRef:ae,currentDate:P})]})]}),ie&&u&&e.jsx(Dn,{args:{selection:ie.selection,...ie.event&&{event:ie.event}},...ie.anchor&&{anchor:ie.anchor},render:u,onClose:()=>Ee(null)})]})})});return v?e.jsx(Yn,{render:v,children:Ne}):Ne}function ro({events:t=eo,users:n=to,alwaysShowResources:s,scheduleTypes:r=[],initialView:a,initialDate:l,initialSelectedUserId:i,initialScheduleTypeIds:x,initialParticipantIds:d,initialWorkingHoursView:f,initialSearchQuery:M,preferencesConfig:v,viewPersistence:u,onEventClick:k,onSlotClick:E,onSlotSelect:D,onAddEvent:C,onEventDrop:S,onDateChange:g,onViewChange:b,className:_,showHeader:U=!0,minSelectionMinutes:I=30,showMoreMode:T,showMoreEventsInPopover:j=!1,isLoading:L=!1,eventDetail:O,settingsContent:N,filterContent:R,headerActions:P,focusEventId:H,headerConfig:m,resourceColumnConfig:$,filters:h,labels:W,eventCard:B,eventForm:F,showSidebar:Y,sidebarContent:se,createLabel:J,locale:K},ne){const oe=o.useRef(null),ee=o.useCallback(ie=>{oe.current=ie,typeof ne=="function"?ne(ie):ne&&(ne.current=ie)},[ne]),fe=o.useMemo(()=>{if(S)return S;if(F)return ie=>setTimeout(()=>oe.current?.openForm({event:ie.event,start:ie.newStartDate,end:ie.newEndDate}),0)},[S,F]),Q=e.jsx(so,{...k&&{onEventClick:k},...E&&{onSlotClick:E},...D&&{onSlotSelect:D},...C&&{onAddEvent:C},...s&&{alwaysShowResources:s},...O&&{eventDetail:O},className:_,showHeader:U,minSelectionMinutes:I,...T&&{showMoreMode:T},showMoreEventsInPopover:j,isLoading:L,...B&&{eventCard:B},...F&&{eventForm:F},settingsContent:N,filterContent:R,headerActions:P,calendarRef:ee,...m&&{headerConfig:m},...$&&{resourceColumnConfig:$},...h&&{filters:h},...W&&{labels:W},...W?.agenda&&{agendaLabels:W.agenda},...Y!==void 0&&{showSidebar:Y},sidebarContent:se,...J&&{createLabel:J},...K&&{locale:K}}),le=ie=>e.jsx(ue.InnoCalendarProvider,{initialEvents:t,initialUsers:n,initialScheduleTypes:r,allowedViews:Fn,...a&&{initialView:a},...l&&{initialDate:l},...i&&{initialSelectedUserId:i},...x&&{initialScheduleTypeIds:x},...d&&{initialParticipantIds:d},...f&&{initialWorkingHoursView:f},...M&&{initialSearchQuery:M},...v&&{preferencesConfig:v},...u&&{viewPersistence:u},...g&&{onDateChange:g},...b&&{onViewChange:b},...H&&{initialFocusEventId:H},children:ie});return e.jsx(ue.DragDropProvider,{...fe&&{onEventDrop:fe},children:le(Q)})}const oo=o.forwardRef(ro);exports.AgendaView=Tn;exports.Button=je;exports.CalendarHeader=kn;exports.CalendarSettings=Nn;exports.CalendarSidebar=Cn;exports.DateNavigator=Ys;exports.DayEventsExpansion=Ln;exports.DaySlot=Hn;exports.DayView=An;exports.EventBlock=pt;exports.EventCard=Je;exports.EventPopover=Cs;exports.FieldLayer=_t;exports.FilterPanel=Sn;exports.InnoCalendar=oo;exports.MiniMonth=At;exports.MonthView=Et;exports.MultiDayBanner=In;exports.MultiDayEventBar=ss;exports.Popover=Ie;exports.PopoverAnchor=Kn;exports.PopoverContent=Te;exports.PopoverTrigger=Re;exports.QuickCreate=Dn;exports.RecurrenceField=Mr;exports.Sheet=Lt;exports.SheetClose=Xn;exports.SheetContent=ft;exports.SheetDescription=hn;exports.SheetHeader=fn;exports.SheetTitle=ht;exports.SheetTrigger=It;exports.SidebarSheet=Mn;exports.TimeSlot=gt;exports.TimelineView=ut;exports.TodayButton=Ks;exports.Tooltip=De;exports.TooltipContent=be;exports.TooltipProvider=Se;exports.TooltipTrigger=Ce;exports.WeekView=St;exports.WhenRow=Tr;exports.YearView=$n;exports.buttonVariants=vn;exports.getEventColorClasses=He;exports.recurrencePresets=zn;
|
|
11
|
+
//# sourceMappingURL=inno-calendar-B3IO5ulf.cjs.map
|