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