@innosolutions/inno-calendar 1.0.49 → 1.0.50

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.
Files changed (57) hide show
  1. package/AGENT.md +1288 -359
  2. package/dist/agenda-widget-WpqvlAJP.cjs +2 -0
  3. package/dist/agenda-widget-WpqvlAJP.cjs.map +1 -0
  4. package/dist/{agenda-widget-DhCPt2vI.js → agenda-widget-ssrwyMvF.js} +1245 -1182
  5. package/dist/agenda-widget-ssrwyMvF.js.map +1 -0
  6. package/dist/components/event/event-card.d.ts +21 -2
  7. package/dist/components/event/event-card.d.ts.map +1 -1
  8. package/dist/components/header/calendar-header.d.ts +10 -2
  9. package/dist/components/header/calendar-header.d.ts.map +1 -1
  10. package/dist/components/index.cjs +1 -1
  11. package/dist/components/index.d.ts +1 -1
  12. package/dist/components/index.d.ts.map +1 -1
  13. package/dist/components/index.mjs +49 -35
  14. package/dist/components/inno-calendar.d.ts +45 -2
  15. package/dist/components/inno-calendar.d.ts.map +1 -1
  16. package/dist/components/ui/dialog.d.ts +35 -0
  17. package/dist/components/ui/dialog.d.ts.map +1 -0
  18. package/dist/components/ui/index.d.ts +2 -0
  19. package/dist/components/ui/index.d.ts.map +1 -1
  20. package/dist/components/ui/sheet.d.ts +35 -0
  21. package/dist/components/ui/sheet.d.ts.map +1 -0
  22. package/dist/components/views/timeline-view.d.ts +10 -1
  23. package/dist/components/views/timeline-view.d.ts.map +1 -1
  24. package/dist/core/context/drag-drop-context.d.ts +7 -1
  25. package/dist/core/context/drag-drop-context.d.ts.map +1 -1
  26. package/dist/core/index.cjs +1 -1
  27. package/dist/core/index.d.ts +1 -1
  28. package/dist/core/index.d.ts.map +1 -1
  29. package/dist/core/index.mjs +1 -1
  30. package/dist/core/types.d.ts +81 -0
  31. package/dist/core/types.d.ts.map +1 -1
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.mjs +206 -192
  34. package/dist/presets/index.cjs +1 -1
  35. package/dist/presets/index.mjs +1 -1
  36. package/dist/{slot-selection-context-D1495hEJ.js → slot-selection-context-BwghpxKA.js} +233 -231
  37. package/dist/slot-selection-context-BwghpxKA.js.map +1 -0
  38. package/dist/slot-selection-context-CHSaOPWP.cjs +2 -0
  39. package/dist/slot-selection-context-CHSaOPWP.cjs.map +1 -0
  40. package/dist/{tailwind-calendar-BmJa4HhQ.js → tailwind-calendar-Ctfffnbn.js} +2 -2
  41. package/dist/{tailwind-calendar-BmJa4HhQ.js.map → tailwind-calendar-Ctfffnbn.js.map} +1 -1
  42. package/dist/{tailwind-calendar-CJmOutn1.cjs → tailwind-calendar-Gy1Uc9ZK.cjs} +2 -2
  43. package/dist/{tailwind-calendar-CJmOutn1.cjs.map → tailwind-calendar-Gy1Uc9ZK.cjs.map} +1 -1
  44. package/dist/week-view-ITRsM6y1.cjs +11 -0
  45. package/dist/week-view-ITRsM6y1.cjs.map +1 -0
  46. package/dist/{week-view-aRPB2cjn.js → week-view-vnIcmoVr.js} +1564 -1405
  47. package/dist/week-view-vnIcmoVr.js.map +1 -0
  48. package/package.json +2 -1
  49. package/dist/agenda-widget-B-AVTnqM.cjs +0 -2
  50. package/dist/agenda-widget-B-AVTnqM.cjs.map +0 -1
  51. package/dist/agenda-widget-DhCPt2vI.js.map +0 -1
  52. package/dist/slot-selection-context-BCsC7WT7.cjs +0 -2
  53. package/dist/slot-selection-context-BCsC7WT7.cjs.map +0 -1
  54. package/dist/slot-selection-context-D1495hEJ.js.map +0 -1
  55. package/dist/week-view-D19YRBQC.cjs +0 -11
  56. package/dist/week-view-D19YRBQC.cjs.map +0 -1
  57. package/dist/week-view-aRPB2cjn.js.map +0 -1
@@ -0,0 +1,11 @@
1
+ "use strict";const e=require("react/jsx-runtime"),a=require("react"),i=require("./index-D2U2F80P.cjs"),wt=require("@radix-ui/react-dropdown-menu"),y=require("./utils.cjs"),oe=require("./slot-selection-context-CHSaOPWP.cjs"),vt=require("@radix-ui/react-dialog"),Nt=require("@radix-ui/react-popover"),kt=require("@radix-ui/react-tooltip");function ye(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 X=ye(a),U=ye(wt),F=ye(vt),ue=ye(Nt),be=ye(kt);const Ye=(...t)=>t.filter((n,s,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===s).join(" ").trim();const Dt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ct=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,s,r)=>r?r.toUpperCase():s.toLowerCase());const $e=t=>{const n=Ct(t);return n.charAt(0).toUpperCase()+n.slice(1)};var St={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"};const Mt=t=>{for(const n in t)if(n.startsWith("aria-")||n==="role"||n==="title")return!0;return!1};const Tt=a.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:o="",children:m,iconNode:l,...b},k)=>a.createElement("svg",{ref:k,...St,width:n,height:n,stroke:t,strokeWidth:r?Number(s)*24/Number(n):s,className:Ye("lucide",o),...!m&&!Mt(b)&&{"aria-hidden":"true"},...b},[...l.map(([d,j])=>a.createElement(d,j)),...Array.isArray(m)?m:[m]]));const Se=(t,n)=>{const s=a.forwardRef(({className:r,...o},m)=>a.createElement(Tt,{ref:m,iconNode:n,className:Ye(`lucide-${Dt($e(t))}`,`lucide-${t}`,r),...o}));return s.displayName=$e(t),s};const Et=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],zt=Se("check",Et);const At=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Lt=Se("chevron-right",At);const _t=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Wt=Se("circle",_t);const Rt=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Je=Se("x",Rt),Ze=F.Root,Qe=F.Trigger,Bt=F.Portal,It=F.Close,et=X.forwardRef(({className:t,...n},s)=>e.jsx(F.Overlay,{ref:s,className:i.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}));et.displayName=F.Overlay.displayName;const We=X.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(Bt,{children:[e.jsx(et,{}),e.jsxs(F.Content,{ref:r,className:i.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",t),...s,children:[n,e.jsxs(F.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-accent data-[state=open]:text-muted-foreground",children:[e.jsx(Je,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));We.displayName=F.Content.displayName;const tt=({className:t,...n})=>e.jsx("div",{className:i.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...n});tt.displayName="DialogHeader";const nt=X.forwardRef(({className:t,...n},s)=>e.jsx(F.Title,{ref:s,className:i.cn("text-lg font-semibold leading-none tracking-tight",t),...n}));nt.displayName=F.Title.displayName;const st=X.forwardRef(({className:t,...n},s)=>e.jsx(F.Description,{ref:s,className:i.cn("text-sm text-muted-foreground",t),...n}));st.displayName=F.Description.displayName;const ae=ue.Root,ie=ue.Trigger,Ht=ue.Anchor,ne=X.forwardRef(({className:t,align:n="center",sideOffset:s=4,...r},o)=>e.jsx(ue.Portal,{children:e.jsx(ue.Content,{ref:o,align:n,sideOffset:s,className:i.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})}));ne.displayName=ue.Content.displayName;const rt=F.Root,ot=F.Trigger,Ot=F.Close,$t=F.Portal,at=X.forwardRef(({className:t,...n},s)=>e.jsx(F.Overlay,{className:i.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}));at.displayName=F.Overlay.displayName;const Re=X.forwardRef(({className:t,children:n,...s},r)=>e.jsxs($t,{children:[e.jsx(at,{}),e.jsxs(F.Content,{ref:r,className:i.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(F.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(Je,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Re.displayName="SheetContent";const it=({className:t,...n})=>e.jsx("div",{className:i.cn("flex flex-col space-y-2 text-center sm:text-left",t),...n});it.displayName="SheetHeader";const lt=X.forwardRef(({className:t,...n},s)=>e.jsx(F.Title,{ref:s,className:i.cn("text-lg font-semibold text-foreground",t),...n}));lt.displayName=F.Title.displayName;const dt=X.forwardRef(({className:t,...n},s)=>e.jsx(F.Description,{ref:s,className:i.cn("text-sm text-muted-foreground",t),...n}));dt.displayName=F.Description.displayName;const Pt=be.Provider,ee=be.Root,te=be.Trigger,Q=X.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(be.Content,{ref:r,sideOffset:n,className:i.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}));Q.displayName=be.Content.displayName;function se(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",accentBorder:"border-l-blue-500 dark:border-l-blue-400"},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",accentBorder:"border-l-green-500 dark:border-l-green-400"},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",accentBorder:"border-l-red-500 dark:border-l-red-400"},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",accentBorder:"border-l-yellow-500 dark:border-l-yellow-400"},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",accentBorder:"border-l-purple-500 dark:border-l-purple-400"},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",accentBorder:"border-l-orange-500 dark:border-l-orange-400"},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",accentBorder:"border-l-pink-500 dark:border-l-pink-400"},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",accentBorder:"border-l-teal-500 dark:border-l-teal-400"},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",accentBorder:"border-l-gray-500 dark:border-l-gray-400"},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",accentBorder:"border-l-indigo-500 dark:border-l-indigo-400"}}[t??"blue"]}function ct(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function ge({event:t,variant:n="full",badgeVariant:s="colored",onClick:r,className:o,showTime:m=!0,showDescription:l=!1,showParticipants:b=!1,style:k,disablePopover:d=!1,renderPopover:j,enableDrag:v=!1,enablePageTransition:u=!1,pageTransitionDuration:f=400,eventDetailMode:h="popover",renderEventDetail:N}){const p=se(t.color),[L,D]=a.useState(!1),[T,B]=a.useState(!1),[z,A]=a.useState(!1),[R,$]=a.useState(null),W=a.useRef(null),I=oe.useOptionalDragDrop(),P=oe.useOptionalInnoCalendar();a.useEffect(()=>{if(!d&&P?.focusEventId&&P.focusEventId===t.id){const K=setTimeout(()=>{D(!0),P.clearFocusEventId()},300);return()=>clearTimeout(K)}},[P?.focusEventId,t.id,d]);const E=t.endDate<ct(new Date),g=t.isCanceled??!1,_=v&&I&&!g&&!E,M=t.data,V=M?.meetingTookPlace??t.meetingTookPlace??!1,w=g?e.jsx(Ft,{className:"h-3 w-3 text-zinc-800 dark:text-zinc-200"}):V?e.jsx(Vt,{className:i.cn("h-3 w-3",p.text)}):null,c=t.scheduleTypeName||M?.scheduleTypeName||M?.typeName,x=M?.productName,S=M?.nrParticipant,C=M?.siteName,H=M?.siteCity,q=[C,H].filter(Boolean).join(", "),O=a.useCallback(()=>{if(!T){if(d&&r){r(t);return}if(u&&W.current){const K=W.current.getBoundingClientRect();$(K),A(!0)}else d||D(!0)}},[T,d,r,t,u]);a.useCallback(()=>{A(!1),$(null),d||D(!0)},[d]);const G=a.useCallback(()=>{D(!1)},[]),re=a.useCallback(K=>{_&&(K.dataTransfer.effectAllowed="move",K.dataTransfer.setData("text/plain",t.id),B(!0),I?.startDrag?.(t))},[_,t,I]),Y=a.useCallback(()=>{B(!1),I?.isDragging&&I.endDrag?.()},[I]),J=N?N({event:t,onClose:G}):j?j({event:t,onClose:G}):e.jsx(Ie,{event:t,onClose:G}),xe=K=>{switch(h){case"dialog":return e.jsxs(Ze,{open:L,onOpenChange:D,children:[e.jsx(Qe,{asChild:!0,children:K}),e.jsx(We,{className:"sm:max-w-md",children:J})]});case"sheet":return e.jsxs(rt,{open:L,onOpenChange:D,children:[e.jsx(ot,{asChild:!0,children:K}),e.jsx(Re,{children:J})]});case"custom":return K;default:return e.jsxs(ae,{open:L,onOpenChange:D,children:[e.jsx(ie,{asChild:!0,children:K}),e.jsx(ne,{className:"w-80",children:J})]})}};if(n==="dot"){const K=e.jsx("button",{type:"button",onClick:O,className:i.cn("size-2 rounded-full cursor-pointer transition-opacity",p.dot,t.isCanceled&&"opacity-50",o),style:k,"aria-label":t.title});return d?e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:K}),e.jsx(Q,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs opacity-80",children:y.formatEventTimeDisplay(t)})]})})]}):xe(e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:K}),e.jsx(Q,{children:e.jsx("div",{className:"font-medium",children:t.title})})]}))}if(n==="compact"){const K=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!_,onDragStart:re,onDragEnd:Y,onClick:d?O:void 0,onKeyDown:Me=>{(Me.key==="Enter"||Me.key===" ")&&(Me.preventDefault(),O())},className:i.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",_?"cursor-grab active:cursor-grabbing":"cursor-pointer",T&&"opacity-50",g?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 line-through":[s==="colored"&&[p.bg,p.text],s==="mixed"&&[p.bg,p.text],s==="dot"&&"bg-muted/50"],o),style:k,children:[["dot","mixed"].includes(s)&&!g&&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:p.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:i.cn("w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",p.border),children:y.formatEventTimeDisplay(t)})]})}),e.jsx("div",{className:"flex gap-0.5",children:w})]});return d?e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:K}),e.jsx(Q,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})})]}):xe(K)}const me=e.jsxs("button",{type:"button",onClick:O,className:i.cn("group relative flex w-full flex-col gap-1 rounded-md border-l-[3px] px-2 py-1.5 text-left transition-all","shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:shadow-[0_2px_6px_rgba(0,0,0,0.12)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",g?"bg-zinc-100 dark:bg-zinc-800 border-l-zinc-400 dark:border-l-zinc-600 text-zinc-500 dark:text-zinc-400 line-through":[s==="colored"&&[p.bg,p.accentBorder,p.text],s==="mixed"&&[p.bg,p.accentBorder,p.text],s==="dot"&&"bg-muted/50 border-l-neutral-400 dark:border-l-neutral-600"],o),style:k,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)&&!g&&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:p.dotFill})}),e.jsxs("span",{className:i.cn("text-sm font-medium truncate",!g&&s!=="dot"&&p.text,g&&"line-through"),children:[t.title,c&&e.jsxs("span",{className:"font-normal opacity-75",children:[" ","- ",c]})]})]}),w]}),x&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:x}),S!=null&&S>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ae,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[S," participant",S!==1?"s":""]})]}),m&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Be,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),q&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(ut,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:q})]}),l&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),b&&t.participants&&t.participants.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ae,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.participants.map(K=>K.name).join(", ")})]})]});return d?e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:me}),e.jsx(Q,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})})]}):xe(me)}function Be({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]})}function Vt({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 Ft({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 Ae({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"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 ut({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"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 Ie({event:t,onClose:n}){const s=se(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:i.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:i.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsxs("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1",children:[e.jsx(Be,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"tabular-nums",children:y.formatEventTimeDisplay(t)})]})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),t.isRecurring&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"Recurring"}),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 He({event:t,position:n,hourHeight:s=96,badgeVariant:r="colored",onClick:o,className:m,disablePopover:l=!1,renderPopover:b,enableDrag:k=!0}){const d=se(t.color),[j,v]=a.useState(!1),[u,f]=a.useState(!1),h=oe.useOptionalDragDrop(),N=oe.useOptionalInnoCalendar();a.useEffect(()=>{if(!l&&N?.focusEventId&&N.focusEventId===t.id){const q=setTimeout(()=>{v(!0),N.clearFocusEventId()},300);return()=>clearTimeout(q)}},[N?.focusEventId,t.id,l]);const p=(t.endDate.getTime()-t.startDate.getTime())/(1e3*60),L=p/60*s-8,D=t.endDate<ct(new Date),T=t.isCanceled??!1,B=k&&h&&!T&&!D,z=p<35,A=p>25,R=p>=45,$=t.data,W=t.scheduleTypeName||$?.scheduleTypeName||$?.typeName,I=$?.productName,P=$?.nrParticipant,E=$?.siteName,g=$?.siteCity,_=[E,g].filter(Boolean).join(", "),M=r==="dot",V=a.useCallback(()=>{u||(l&&o?o(t):l||v(!0))},[u,l,o,t]),w=a.useCallback(()=>{v(!1)},[]),c=a.useCallback(q=>{if(!B)return;q.dataTransfer.effectAllowed="move",q.dataTransfer.setData("text/plain",t.id);const O=q.currentTarget,G=O.getBoundingClientRect();q.dataTransfer.setDragImage(O,q.clientX-G.left,q.clientY-G.top),f(!0),h?.startDrag?.(t)},[B,t,h]),x=a.useCallback(()=>{f(!1),h?.isDragging&&h.endDrag?.()},[h]),S=a.useCallback(q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),V())},[V]),C=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!B,onDragStart:c,onDragEnd:x,onKeyDown:S,onClick:u?void 0:V,className:i.cn("group flex w-full select-none flex-col gap-0.5 overflow-hidden rounded-md border-l-[3px] px-2 py-1.5 text-xs text-left","shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:shadow-[0_2px_6px_rgba(0,0,0,0.12)]","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-all",B?"cursor-grab active:cursor-grabbing":"cursor-pointer",u&&"opacity-50",T?"bg-zinc-100 dark:bg-zinc-800 border-l-zinc-400 dark:border-l-zinc-600 text-zinc-500 dark:text-zinc-400 line-through":[!M&&[d.bg,d.accentBorder,d.text],M&&"bg-neutral-50 dark:bg-neutral-900 border-l-neutral-400 dark:border-l-neutral-600"],z&&"py-0 justify-center",m),style:{height:`${Math.max(L,20)}px`},children:[e.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[["mixed","dot"].includes(r)&&!T&&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:d.dotFill})}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsxs("p",{className:i.cn("font-semibold truncate leading-tight",!T&&M&&"text-foreground"),children:[t.title,W&&e.jsxs("span",{className:"font-normal opacity-75",children:[" ","- ",W]})]})})]}),R&&I&&e.jsx("p",{className:i.cn("text-[11px] truncate leading-tight",M?"text-muted-foreground":"opacity-80"),children:I}),P!=null&&P>0&&e.jsxs("div",{className:i.cn("flex items-center gap-1 text-[11px] leading-tight",M?"text-muted-foreground":"opacity-80"),children:[e.jsx(Ae,{className:"h-3 w-3 shrink-0"}),e.jsxs("span",{children:[P," participant",P!==1?"s":""]})]}),A&&e.jsxs("div",{className:i.cn("flex items-center gap-1 text-[11px] tabular-nums leading-tight",M?"text-muted-foreground":"opacity-90"),children:[e.jsx(Be,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:y.formatEventTimeDisplay(t)})]}),R&&_&&e.jsxs("div",{className:i.cn("flex items-center gap-1 text-[11px] truncate leading-tight",M?"text-muted-foreground":"opacity-80"),children:[e.jsx(ut,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:_})]})]}),H=e.jsx(Q,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"font-medium",children:[t.title,W&&e.jsxs("span",{className:"font-normal opacity-75",children:[" ","- ",W]})]}),I&&e.jsx("div",{className:"text-xs text-muted-foreground",children:I}),P!=null&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[P," participant",P!==1?"s":""]}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)}),_&&e.jsx("div",{className:"text-xs text-muted-foreground",children:_})]})});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.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:C}),H]})}):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.jsxs(ae,{open:j,onOpenChange:v,children:[e.jsx(ie,{asChild:!0,children:C}),e.jsx(ne,{className:"w-80",children:b?b({event:t,onClose:w}):e.jsx(Ie,{event:t,onClose:w})})]})})}function qt({event:t,spanDays:n,isStart:s,isEnd:r,onClick:o,className:m,disablePopover:l=!1,renderPopover:b}){const k=se(t.color),[d,j]=a.useState(!1),v=t.isCanceled??!1,u=a.useCallback(()=>{l&&o?o(t):l||j(!0)},[l,o,t]),f=a.useCallback(()=>{j(!1)},[]),h=e.jsx("button",{type:"button",onClick:u,className:i.cn("flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",v?"bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[k.dot,"text-white"],s&&"rounded-l",r&&"rounded-r",!s&&"border-l-0",!r&&"border-r-0",m),style:{width:`${n*100}%`},children:s&&e.jsx("span",{className:"truncate",children:t.title})}),N=e.jsx(Q,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})});return l?e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:h}),N]}):e.jsxs(ae,{open:d,onOpenChange:j,children:[e.jsx(ie,{asChild:!0,children:h}),e.jsx(ne,{className:"w-80",children:b?b({event:t,onClose:f}):e.jsx(Ie,{event:t,onClose:f})})]})}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 Pe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Ve=i.clsx,xt=(t,n)=>s=>{var r;if(n?.variants==null)return Ve(t,s?.class,s?.className);const{variants:o,defaultVariants:m}=n,l=Object.keys(o).map(d=>{const j=s?.[d],v=m?.[d];if(j===null)return null;const u=Pe(j)||Pe(v);return o[d][u]}),b=s&&Object.entries(s).reduce((d,j)=>{let[v,u]=j;return u===void 0||(d[v]=u),d},{}),k=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((d,j)=>{let{class:v,className:u,...f}=j;return Object.entries(f).every(h=>{let[N,p]=h;return Array.isArray(p)?p.includes({...m,...b}[N]):{...m,...b}[N]===p})?[...d,v,u]:d},[]);return Ve(t,l,k,s?.class,s?.className)},mt=xt("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"}}),le=a.forwardRef(({className:t,variant:n,size:s,loading:r,disabled:o,children:m,...l},b)=>e.jsxs("button",{className:i.cn(mt({variant:n,size:s,className:t})),ref:b,disabled:o||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"})]}),m]}));le.displayName="Button";const Le=U.Root,_e=U.Trigger,Gt=X.forwardRef(({className:t,inset:n,children:s,...r},o)=>e.jsxs(U.SubTrigger,{ref:o,className:i.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(Lt,{className:"ml-auto h-4 w-4"})]}));Gt.displayName=U.SubTrigger.displayName;const Ut=X.forwardRef(({className:t,...n},s)=>e.jsx(U.SubContent,{ref:s,className:i.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}));Ut.displayName=U.SubContent.displayName;const ke=X.forwardRef(({className:t,sideOffset:n=4,...s},r)=>e.jsx(U.Portal,{children:e.jsx(U.Content,{ref:r,sideOffset:n,className:i.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})}));ke.displayName=U.Content.displayName;const De=X.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(U.Item,{ref:r,className:i.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}));De.displayName=U.Item.displayName;const Kt=X.forwardRef(({className:t,children:n,checked:s=!1,...r},o)=>e.jsxs(U.CheckboxItem,{ref:o,className:i.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(U.ItemIndicator,{children:e.jsx(zt,{className:"h-4 w-4"})})}),n]}));Kt.displayName=U.CheckboxItem.displayName;const Xt=X.forwardRef(({className:t,children:n,...s},r)=>e.jsxs(U.RadioItem,{ref:r,className:i.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(U.ItemIndicator,{children:e.jsx(Wt,{className:"h-2 w-2 fill-current"})})}),n]}));Xt.displayName=U.RadioItem.displayName;const Yt=X.forwardRef(({className:t,inset:n,...s},r)=>e.jsx(U.Label,{ref:r,className:i.cn("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",t),...s}));Yt.displayName=U.Label.displayName;const Jt=X.forwardRef(({className:t,...n},s)=>e.jsx(U.Separator,{ref:s,className:i.cn("-mx-1 my-1 h-px bg-muted",t),...n}));Jt.displayName=U.Separator.displayName;const Zt=xt("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 ht({className:t,variant:n,...s}){return e.jsx("div",{className:i.cn(Zt({variant:n}),t),...s})}function Qt({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 en({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 tn=["January","February","March","April","May","June","July","August","September","October","November","December"];function pt({date:t,view:n,events:s=[],onNavigatePrev:r,onNavigateNext:o,weekStartsOn:m=1,showEventCount:l=!0,className:b}){const k=tn[t.getMonth()],d=t.getFullYear(),j=l?y.getEventsCountInView(s,t,n,m):0,v=y.getRangeText(t,n);return e.jsxs("div",{className:i.cn("min-w-0 flex-1",b),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:[k," ",d]}),l&&e.jsx(ht,{variant:"outline",className:"px-1 sm:px-1.5 text-[10px] sm:text-xs shrink-0",children:j})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsx(le,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:r,children:e.jsx(Qt,{})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:v}),e.jsx(le,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:o,children:e.jsx(en,{})})]})]})}const nn=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function ft({onClick:t,className:n}){const s=new Date;return e.jsxs("button",{type:"button",className:i.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:nn[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()})]})}function sn({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 2v4"}),e.jsx("path",{d:"M16 2v4"}),e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("path",{d:"M3 10h18"}),e.jsx("path",{d:"M8 14h.01"}),e.jsx("path",{d:"M12 14h.01"}),e.jsx("path",{d:"M16 14h.01"}),e.jsx("path",{d:"M8 18h.01"}),e.jsx("path",{d:"M12 18h.01"}),e.jsx("path",{d:"M16 18h.01"})]})}function ce({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 Fe({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 rn({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function qe({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:"M5 12h14"}),e.jsx("path",{d:"M12 5v14"})]})}function on({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("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 an({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 ln({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 dn({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 cn=[{value:"day",label:"Day",icon:on},{value:"week",label:"Week",icon:an},{value:"month",label:"Month",icon:ln},{value:"year",label:"Year",icon:dn}],Ge=[{value:"timeline-day",label:"1 Day",icon:ce},{value:"timeline-3day",label:"3 Days",icon:ce},{value:"timeline-week",label:"7 Days",icon:ce}],un=[{value:"resource-day",label:"1 Day",icon:ce},{value:"resource-week",label:"7 Days",icon:ce}];function xn({currentDate:t,view:n,events:s=[],onNavigateToday:r,onNavigatePrev:o,onNavigateNext:m,onNavigate:l,onViewChange:b,onAddEvent:k,availableViews:d=["day","week","month","agenda"],showTimelineViews:j=!1,timelineViews:v,settingsContent:u,showSettings:f=!1,filterContent:h,actions:N,className:p,weekStartsOn:L=1,headerConfig:D,labels:T={}}){const B=D?.showToday??!0,z=D?.showDateNavigator??!0,A=D?.showCalendarViews??!0,R=D?.showResourceViews??j,$=D?.showSettings??f,W=D?.showAddEvent??!0,I=D?.showFilters??!0,P=a.useMemo(()=>({today:"Today",addEvent:"Add Event",calendarView:"Calendar View",resourceView:"Resource View",...T}),[T]),E=()=>{r?.(),l?.("today")},g=()=>{o?.(),l?.("prev")},_=()=>{m?.(),l?.("next")},M=["day","week","month","year","agenda"].includes(n),V=n.startsWith("timeline-")||n.startsWith("resource-"),w=cn.filter(C=>d.includes(C.value)),c=M?w.find(C=>C.value===n):null,x=[...Ge,...un],S=V?x.find(C=>C.value===n):null;return e.jsxs("div",{className:i.cn("flex flex-col w-full gap-3 mb-2",p),children:[e.jsxs("div",{className:"flex lg:flex-row flex-col w-full justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 min-w-0",children:[B&&e.jsx(ft,{onClick:E}),z&&e.jsx(pt,{date:t,view:n,events:s,onNavigatePrev:g,onNavigateNext:_,weekStartsOn:L})]}),W&&k&&e.jsx(le,{size:"icon",className:"shrink-0 lg:hidden",onClick:k,children:e.jsx(qe,{className:"size-4"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-none",children:[A&&b&&w.length>0&&e.jsxs(Le,{children:[e.jsxs(_e,{className:i.cn("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors","h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",M?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-input bg-background hover:bg-accent hover:text-accent-foreground"),children:[e.jsx(sn,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:c?.label??P.calendarView}),e.jsx(Fe,{className:"size-3 opacity-60"})]}),e.jsx(ke,{align:"start",className:"min-w-[120px]",children:w.map(C=>{const H=C.icon;return e.jsxs(De,{onClick:()=>b(C.value),className:i.cn("gap-2",n===C.value&&"bg-accent"),children:[e.jsx(H,{className:"size-4"}),e.jsx("span",{children:C.label})]},C.value)})})]}),R&&b&&e.jsxs(Le,{children:[e.jsxs(_e,{className:i.cn("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors","h-10 px-2 sm:px-3 gap-1 sm:gap-1.5 shrink-0",V?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-input bg-white hover:bg-zinc-50 hover:text-accent-foreground"),children:[e.jsx(ce,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:S?.label??P.resourceView}),e.jsx(Fe,{className:"size-3 opacity-60"})]}),e.jsx(ke,{align:"start",className:"min-w-[120px]",children:Ge.map(C=>{const H=C.icon;return e.jsxs(De,{onClick:()=>b(C.value),className:i.cn("gap-2",n===C.value&&"bg-accent"),children:[e.jsx(H,{className:"size-4"}),e.jsx("span",{children:C.label})]},C.value)})})]}),$&&u&&e.jsxs(ae,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(le,{variant:"outline",size:"icon",className:"min-w-10 min-h-10 shrink-0 mx-0",children:e.jsx(rn,{className:"size-4 sm:size-5"})})}),e.jsx(ne,{className:"w-auto min-w-80 p-0",align:"end",sideOffset:8,children:e.jsx("div",{className:"max-h-[70vh] overflow-y-auto p-4 space-y-6",children:u})})]}),N,W&&k&&e.jsxs(le,{className:"hidden lg:flex shrink-0 max-h-10",onClick:k,children:[e.jsx(qe,{className:"size-4"}),P.addEvent]})]})]}),I&&h&&e.jsx("div",{className:"flex items-center gap-2 pb-1 -mb-1 scrollbar-none",children:h})]})}function mn({events:t,date:n,daysAhead:s=60,badgeVariant:r="colored",onEventClick:o,className:m,renderEvent:l,renderPopover:b,slots:k,classNames:d}){const j=a.useMemo(()=>{const u=new Date(n);u.setHours(0,0,0,0);const f=new Date(u);return f.setDate(f.getDate()+s),t.filter(h=>h.endDate>=u&&h.startDate<=f)},[t,s,n]),v=a.useMemo(()=>{const u=y.groupEventsByDate(j),f=[];for(const[h,N]of u)f.push({date:new Date(h),dateKey:h,events:N});return f.sort((h,N)=>h.date.getTime()-N.date.getTime()),f},[j]);return v.length===0?e.jsx("div",{className:i.cn("flex flex-col items-center justify-center h-full py-12",m),children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-muted-foreground",children:"No events found"}),e.jsx("p",{className:"text-sm text-muted-foreground/70",children:"No events scheduled for this period"})]})}):e.jsxs("div",{className:i.cn("flex flex-col h-full overflow-auto",d?.agendaList,m),children:[e.jsx("div",{className:"sticky top-0 z-10 bg-background border-b px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-medium",children:"Schedule"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[j.length," event",j.length!==1?"s":""]})]})}),e.jsx("div",{className:"flex-1",children:v.map(({date:u,dateKey:f,events:h})=>{const N=y.isToday(u),p=u.toLocaleDateString([],{weekday:"short"}),L=u.getDate(),D=u.toLocaleDateString([],{month:"short"});return e.jsxs("div",{className:i.cn("",d?.agendaDayGroup),children:[e.jsx("div",{className:i.cn("sticky top-[52px] z-10 bg-background px-4 py-3 border-b",d?.agendaDayHeader),children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center min-w-[40px]",children:[e.jsx("span",{className:i.cn("text-[11px] font-medium uppercase tracking-wide",N?"text-primary":"text-muted-foreground"),children:p}),e.jsx("span",{className:i.cn("flex items-center justify-center rounded-full mt-0.5","size-10 text-xl font-normal",N?"bg-primary text-primary-foreground":"text-foreground"),children:L})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[D," ",u.getFullYear()]})]})}),e.jsx("div",{className:"px-4 py-3 space-y-2 border-b last:border-b-0",children:h.map(T=>l?e.jsx("div",{children:l({event:T,variant:"full"})},T.id):e.jsx(ge,{event:T,variant:"full",badgeVariant:r,onClick:o,disablePopover:!!o&&!b,renderPopover:b,showTime:!0,showDescription:!0,showParticipants:!0,...d?.eventCard&&{className:d.eventCard}},T.id))})]},f)})})]})}const je=360,we=480,Te=280;function gt({isOpen:t,onClose:n,date:s,events:r,anchorRect:o,badgeVariant:m="colored",onEventClick:l,renderEvent:b,renderPopover:k,className:d}){const j=a.useRef(null),v=a.useRef(null),[u,f]=a.useState("closed"),h=a.useMemo(()=>[...r].sort((z,A)=>z.startDate.getTime()-A.startDate.getTime()),[r]),N=a.useMemo(()=>{if(!o)return{top:0,left:0,width:je,maxHeight:we};const z=typeof window<"u"?window.innerWidth:1200,A=typeof window<"u"?window.innerHeight:800;let R=o.left+o.width/2-je/2;R=Math.max(16,Math.min(R,z-je-16));const $=Math.min(r.length*68+80,we);let W=o.top+o.height/2-$/2;return W=Math.max(16,Math.min(W,A-$-16)),{top:W,left:R,width:je,maxHeight:we}},[o,r.length]);a.useLayoutEffect(()=>{if(t&&o)f("entering"),requestAnimationFrame(()=>{requestAnimationFrame(()=>{f("open")})});else if(!t&&u==="open"){f("exiting");const z=setTimeout(()=>{f("closed")},Te);return()=>clearTimeout(z)}},[t,o]),a.useEffect(()=>{if(u==="closed")return;const z=A=>{A.key==="Escape"&&(A.stopPropagation(),n())};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[u,n]),a.useEffect(()=>{u==="open"&&v.current&&v.current.focus()},[u]);const p=a.useCallback(z=>{z.target===j.current&&n()},[n]);if(u==="closed")return null;const L=u==="entering"||u==="exiting",D=L&&o?{position:"fixed",top:o.top,left:o.left,width:o.width,height:o.height,maxHeight:o.height,opacity:u==="entering"?.7:0,transform:"scale(1)",borderRadius:"8px"}:{position:"fixed",top:N.top,left:N.left,width:N.width,maxHeight:N.maxHeight,opacity:1,transform:"scale(1)",borderRadius:"12px"},T=L?0:1,B=s.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"});return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:j,role:"presentation",onClick:p,className:"ic-expansion-backdrop",style:{position:"fixed",inset:0,zIndex:50,backgroundColor:"rgba(0, 0, 0, 0.2)",opacity:T,transition:`opacity ${Te}ms cubic-bezier(0.32, 0.72, 0, 1)`}}),e.jsxs("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":`Events for ${B}`,tabIndex:-1,className:i.cn("ic-expansion-panel","bg-background border border-border shadow-2xl overflow-hidden","focus:outline-none",d),style:{...D,zIndex:51,transition:`all ${Te}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:`${we-64}px`},children:[h.map(z=>e.jsx("div",{onPointerDown:A=>A.stopPropagation(),children:b?b({event:z,variant:"compact"}):e.jsx(ge,{event:z,variant:"compact",badgeVariant:m,onClick:A=>{n(),l?.(A)},disablePopover:!!l&&!k,renderPopover:k,showTime:!0})},z.id)),r.length===0&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No events"})]})]})]})}function hn({event:t,date:n,onEventClick:s,disablePopover:r,renderPopover:o}){const[m,l]=a.useState(!1),b=se(t.color),k=y.detectAllDayEvent(t),d=y.isSameDay(t.startDate,n),j=y.isSameDay(t.endDate,n),v=k&&y.isSameDay(t.startDate,t.endDate),u=a.useCallback(()=>{r&&s?s(t):r||l(!0)},[r,s,t]),f=a.useCallback(()=>{l(!1)},[]),h=e.jsxs("button",{type:"button",onClick:u,title:y.formatEventTimeDisplay(t),className:i.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",b.bg,b.text,t.isCanceled&&"opacity-60 line-through"),children:[!v&&d&&!j&&"→ ",!v&&!d&&j&&" ←",!v&&!d&&!j&&"↔ ",e.jsx("span",{className:"truncate max-w-24 sm:max-w-32",children:t.title}),v&&e.jsx("span",{className:"text-[9px] opacity-70 sm:text-[10px]",children:"All day"})]}),N=e.jsx(Q,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t)})]})});return r?e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:h}),N]}):e.jsxs(ae,{open:m,onOpenChange:l,children:[e.jsx(ie,{asChild:!0,children:h}),e.jsx(ne,{className:"w-80",children:o?o({event:t,onClose:f}):e.jsx(pn,{event:t,onClose:f})})]})}function pn({event:t,onClose:n}){const s=se(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:i.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:i.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums",children:y.formatEventTimeDisplay(t)})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function yt({events:t,date:n,onEventClick:s,disablePopover:r=!1,renderPopover:o,className:m}){if(t.length===0)return null;const l=t.some(d=>y.detectAllDayEvent(d)&&y.isSameDay(d.startDate,d.endDate)),b=t.some(d=>!y.isSameDay(d.startDate,d.endDate)||y.detectAllDayEvent(d)&&!y.isSameDay(d.startDate,d.endDate)),k=l&&b?"All day / Multi-day":l?"All day":"Multi-day";return e.jsxs("div",{className:i.cn("border-b bg-muted/20 px-2 py-1.5 space-y-1","sm:px-4 sm:py-2",m),children:[e.jsx("span",{className:"text-[10px] font-medium text-muted-foreground sm:text-xs",children:k}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(d=>e.jsx(hn,{event:d,date:n,onEventClick:s,disablePopover:r,renderPopover:o},d.id))})]})}const fn=5;function bt({slot:t,onSelectionStart:n,onSelectionMove:s,onSelectionEnd:r,isSelected:o=!1,isSelecting:m=!1,disabled:l=!1,ariaLabel:b,children:k,className:d,height:j,style:v,dataAttributes:u}){const f=a.useRef(null),h=a.useRef(!1),N=a.useRef(!1),p=a.useRef(null),[L,D]=a.useState(!1),T=oe.useOptionalDragDrop(),B=a.useCallback(E=>{l||E.button!==0&&E.pointerType==="mouse"||(E.preventDefault(),f.current={x:E.clientX,y:E.clientY},h.current=!1,N.current=!0,n?.(t))},[l,t,n]),z=a.useCallback(E=>{if(!(f.current&&N.current&&!l))return;const g=E.clientX-f.current.x,_=E.clientY-f.current.y;Math.sqrt(g*g+_*_)>=fn&&(h.current=!0)},[l]),A=a.useCallback(E=>{l||(E.buttons>0||m)&&s?.(t)},[l,m,t,s]),R=a.useCallback(()=>{l||(r?.(),f.current=null,h.current=!1,N.current=!1)},[l,r]),$=a.useCallback(E=>{if(!T?.isDragging||l)return;E.preventDefault(),E.dataTransfer.dropEffect="move",D(!0);const g=new Date,_=t.hour??g.getHours(),M=t.minute??(g.getMinutes()>=30?30:0);T.updateDragPreview?.(t.date,_,M)},[T,l,t]),W=a.useCallback(()=>{D(!1)},[]),I=a.useCallback(E=>{E.preventDefault(),D(!1),!(!T?.isDragging||l)&&T.endDrag?.()},[T,l]);a.useEffect(()=>{const E=()=>{N.current&&(N.current=!1,f.current=null,h.current=!1)};return window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),()=>{window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E)}},[]);const P=a.useCallback(E=>{l||(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),n?.(t),r?.())},[l,t,n,r]);return e.jsx("button",{ref:p,type:"button","aria-label":b,"aria-disabled":l,"aria-pressed":o,disabled:l,onPointerDown:B,onPointerMove:z,onPointerUp:R,onPointerEnter:A,onKeyDown:P,onDragOver:$,onDragLeave:W,onDrop:I,className:i.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",!(m||l)&&"hover:bg-blue-50/60",o&&"bg-blue-100/70",L&&"bg-primary/20 ring-2 ring-primary ring-inset",l&&"cursor-not-allowed opacity-50",d),style:{height:j,...v},...u,children:k})}function Oe({slot:t,date:n,hour:s,minute:r,ariaLabel:o,...m}){const l=t??{date:n,hour:s??0,minute:r??0},b=o??`Add event at ${(l.hour??0).toString().padStart(2,"0")}:${(l.minute??0).toString().padStart(2,"0")} on ${l.date.toLocaleDateString()}`;return e.jsx(bt,{slot:l,ariaLabel:b,...m})}function jt({slot:t,date:n,ariaLabel:s,...r}){const o=t??{date:n},m=s??`Select ${o.date.toLocaleDateString()}`;return e.jsx(bt,{slot:o,ariaLabel:m,...r})}const he=96,Ee=72,ze=80;function gn({events:t,date:n,visibleHours:s={startHour:0,endHour:24},workingHours:r,slotDuration:o=30,badgeVariant:m="colored",onEventClick:l,onSlotSelect:b,className:k,renderEvent:d,renderPopover:j,slots:v,classNames:u}){const f=60/o,h=100/f,N=a.useMemo(()=>{const w=[];for(let c=0;c<f;c++)w.push(c*o);return w},[f,o]),p=a.useMemo(()=>y.getEventsForDay(t,n),[t,n]),{singleDay:L,multiDay:D}=a.useMemo(()=>y.separateEventsByDuration(p),[p]),T=a.useMemo(()=>{const w=y.calculateOverlappingPositions(L,n,s,he),c=new Map;for(const x of w)c.set(x.event.id,x.position);return c},[L,n,s]),B=a.useMemo(()=>y.getVisibleHoursArray(s),[s]),z=new Date,A=y.isToday(n),R=a.useMemo(()=>{if(!A)return 0;const w=z.getHours()+z.getMinutes()/60;return w<s.startHour||w>s.endHour?-1:(w-s.startHour)*he},[A,s,z]),$=a.useRef(null);a.useLayoutEffect(()=>{const w=$.current;if(!w)return;const c=()=>{let x;if(A){const C=new Date().getHours();x=Math.max(C-1,s.startHour)}else{const C=n.getDay(),H=r?.[C];H?.enabled&&H.from>0?x=Math.max(H.from-1,s.startHour):x=Math.max(7,s.startHour)}const S=(x-s.startHour)*he;w.scrollTo({top:S,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(c)})},[n,r,s,A]);const W=oe.useOptionalSlotSelection(),I=a.useCallback(w=>{W?.startSelection(w)},[W]),P=a.useCallback(w=>{W?.updateSelection(w)},[W]),E=a.useCallback(()=>{W?.endSelection()},[W]),g=a.useCallback(w=>{l?.(w)},[l]),_=n.toLocaleDateString([],{weekday:"short"}),M=n.getDate(),V=y.isToday(n);return e.jsxs("div",{className:i.cn("flex flex-col h-full",k),children:[e.jsx("div",{className:i.cn("flex items-center gap-3 border-b px-4 py-3",u?.columnHeader,V&&u?.columnHeaderToday),children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:i.cn("text-[11px] font-medium uppercase tracking-wide",V?"text-primary":"text-muted-foreground"),children:_}),e.jsx("span",{className:i.cn("flex items-center justify-center rounded-full mt-0.5","size-12 text-3xl font-normal",V?"bg-primary text-primary-foreground":"text-foreground"),children:M})]})}),D.length>0&&e.jsx(yt,{events:D,date:n,onEventClick:g,disablePopover:!!l&&!j,renderPopover:j,...u?.multiDayBanner&&{className:u.multiDayBanner}}),e.jsx("div",{ref:$,className:i.cn("flex-1",u?.scrollContainer),children:e.jsxs("div",{className:"relative min-h-full",children:[B.map((w,c)=>{const S=!y.isWorkingHour(n,w,r);return e.jsxs("div",{className:i.cn("relative flex",S&&"bg-calendar-disabled-hour",u?.timeSlot,S?u?.timeSlotNonWorking:u?.timeSlotWorking),style:{height:he},children:[e.jsx("div",{className:i.cn("relative flex-shrink-0 border-r border-border/50 bg-zinc-50 dark:bg-zinc-900",u?.timeGutter),style:{width:Ee},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:c!==0&&e.jsx("span",{className:i.cn("text-[10px] sm:text-xs text-muted-foreground",u?.timeGutterLabel),children:y.formatHourLabel(w)})})}),e.jsxs("div",{className:"relative flex-1",children:[A&&!S&&e.jsx("div",{className:"absolute inset-0 bg-primary/5"}),c!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),N.slice(1).map(C=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${C/60*100}%`}},C)),N.map((C,H)=>{const q={date:n,hour:w,minute:C};return e.jsx(Oe,{slot:q,onSelectionStart:I,onSelectionMove:P,onSelectionEnd:E,isSelected:W?.isSlotSelected(q)??!1,isSelecting:W?.isSelecting??!1,disabled:S,className:"absolute inset-x-0",style:{top:`${H*h}%`,height:`${h}%`},ariaLabel:`Add event at ${y.formatHourLabel(w)}:${String(C).padStart(2,"0")}`},C)})]})]},w)}),e.jsx("div",{className:"absolute top-0 bottom-0 right-0 pointer-events-none",style:{left:Ee},children:L.map(w=>{const c=T.get(w.id);if(!c)return null;const x=`calc(${c.width}% - 2px)`,S=`max(${ze}px, ${x})`;return d?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${c.top}px`,left:`${c.left}%`,width:S,minWidth:`${ze}px`},children:d({event:w,position:c})},w.id):e.jsx(He,{event:w,position:{top:c.top,left:c.left,width:c.width,minWidth:ze},hourHeight:he,badgeVariant:m,onClick:l,disablePopover:!!l&&!j,renderPopover:j,className:i.cn("pointer-events-auto",u?.eventCard)},w.id)})}),A&&R>=0&&e.jsxs("div",{className:i.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",u?.currentTimeIndicator),style:{top:R,left:Ee},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 yn=[{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"}],bn=[{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"}],pe=3;function jn({events:t,date:n,weekStartsOn:s=1,badgeVariant:r="colored",onEventClick:o,onSlotSelect:m,onDayClick:l,className:b,renderEvent:k,renderPopover:d,showMoreMode:j,showMoreEventsInPopover:v=!1,slots:u,classNames:f}){const h=j??(v?"popover":"expand"),N=u?.dayCellHeader,p=u?.dayCellFooter,[L,D]=a.useState(null),[T,B]=a.useState(null),z=a.useMemo(()=>y.generateMonthGrid(n,s),[n,s]),A=a.useMemo(()=>{const g=new Map;for(const _ of z){const M=_.date.toDateString(),V=y.getEventsForDay(t,_.date);V.sort((w,c)=>w.startDate.getTime()-c.startDate.getTime()),g.set(M,V)}return g},[z,t]),R=oe.useOptionalSlotSelection(),$=a.useCallback(g=>{R?.startSelection(g)},[R]),W=a.useCallback(g=>{R?.updateSelection(g)},[R]),I=a.useCallback(()=>{R?.endSelection()},[R]),P=a.useCallback(g=>{l?.(g)},[l]),E=s===0?bn:yn;return e.jsxs("div",{className:i.cn("flex flex-col h-full overflow-hidden",b),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:i.cn("grid grid-cols-7 border-b !sticky !top-0 bg-background z-10",f?.weekdayHeader),children:E.map((g,_)=>e.jsxs("div",{className:i.cn("py-2 sm:py-2.5 text-center text-[11px] uppercase font-medium tracking-wide text-muted-foreground",_>=5&&"text-muted-foreground/70",f?.weekdayLabel),children:[e.jsx("span",{className:"sm:hidden",children:g.short}),e.jsx("span",{className:"hidden sm:inline",children:g.short})]},g.full))}),e.jsx("div",{className:i.cn("grid grid-cols-7 auto-rows-min",f?.monthGrid),children:z.map(g=>{const _=g.date.toDateString(),M=A.get(_)||[],V=y.isToday(g.date),w=g.date.getDay()===0||g.date.getDay()===6,c=M.length>pe;return e.jsxs(jt,{date:g.date,dataAttributes:{"data-day-key":_},onSelectionStart:$,onSelectionMove:W,onSelectionEnd:I,isSelected:R?.isSlotSelected({date:g.date})??!1,isSelecting:R?.isSelecting??!1,className:i.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",!g.isCurrentMonth&&"bg-muted/20",w&&g.isCurrentMonth&&"bg-muted/10",f?.dayCell,V&&f?.dayCellToday,!g.isCurrentMonth&&f?.dayCellOutside,w&&f?.dayCellWeekend),ariaLabel:`${g.date.toLocaleDateString()} - ${M.length} events. Click to create event, double-click to view day.`,children:[e.jsx("div",{className:i.cn("flex items-center justify-center p-1",!g.isCurrentMonth&&"text-muted-foreground/40",f?.dayCellNumber),children:e.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),P(g.date)},className:i.cn("flex items-center justify-center rounded-full transition-colors","size-7 text-sm font-normal",V?"bg-primary text-primary-foreground":"hover:bg-muted"),children:g.date.getDate()})}),N&&e.jsx(N,{date:g.date,events:M,isToday:V,isCurrentMonth:g.isCurrentMonth,isWeekend:w,view:"month"}),e.jsxs("div",{className:i.cn("flex-1 overflow-hidden px-2 pt-1 pb-1 space-y-1",f?.dayCellContent),children:[M.slice(0,pe).map(x=>e.jsx("div",{onPointerDown:S=>{S.stopPropagation()},children:k?k({event:x,variant:"compact"}):e.jsx(ge,{event:x,variant:"compact",badgeVariant:r,onClick:o,disablePopover:!!o&&!d,renderPopover:d,showTime:!1,enableDrag:!0,...f?.eventCardCompact&&{className:f.eventCardCompact}})},x.id)),c&&h==="expand"&&e.jsxs("button",{type:"button",onPointerDown:x=>x.stopPropagation(),onClick:x=>{x.stopPropagation();const S=document.querySelector(`[data-day-key="${_}"]`);B({date:g.date,events:M,rect:S?.getBoundingClientRect()??new DOMRect(window.innerWidth/2-180,window.innerHeight/2-240,0,0)})},className:i.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",f?.moreEventsIndicator),children:["+",M.length-pe," more"]}),c&&h==="popover"&&e.jsxs(ae,{open:L===_,onOpenChange:x=>D(x?_:null),children:[e.jsx(ie,{asChild:!0,children:e.jsxs("button",{type:"button",onPointerDown:x=>x.stopPropagation(),onClick:x=>{x.stopPropagation(),D(_)},className:i.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",f?.moreEventsIndicator),children:["+",M.length-pe," more"]})}),e.jsxs(ne,{align:"start",side:"right",sideOffset:8,className:"w-72 max-h-80 overflow-y-auto p-2",onPointerDown:x=>x.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:g.date.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[M.length," events"]})]}),e.jsx("div",{className:"space-y-1.5",children:M.map(x=>e.jsx("div",{children:k?k({event:x,variant:"compact"}):e.jsx(ge,{event:x,variant:"compact",badgeVariant:r,onClick:S=>{D(null),o?.(S)},disablePopover:!!o&&!d,renderPopover:d,showTime:!0})},x.id))})]})]}),c&&h==="dayView"&&e.jsxs("div",{onPointerDown:x=>{x.stopPropagation(),P(g.date)},className:i.cn("w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",f?.moreEventsIndicator),children:["+",M.length-pe," more"]})]}),p&&e.jsx(p,{date:g.date,events:M,isToday:V,isCurrentMonth:g.isCurrentMonth,isWeekend:w,view:"month"})]},_)})})]})}),e.jsx(gt,{isOpen:T!==null,onClose:()=>B(null),date:T?.date??new Date,events:T?.events??[],anchorRect:T?.rect??null,badgeVariant:r,onEventClick:o,renderEvent:k,renderPopover:d})]})}const Ce=26,Ue=2,ve=4;function Ke(t,n){const s=y.startOfDay(t);for(let o=0;o<n.length;o++){const m=n[o];if(m&&y.isSameDay(s,m))return o}const r=n[0];return r&&s<y.startOfDay(r)?-1:7}function wn(t){const n=[...t].sort((r,o)=>{const m=r.endCol-r.startCol,l=o.endCol-o.startCol;return l!==m?l-m:r.startCol-o.startCol}),s=[];return n.map(r=>{let o=-1;for(let l=0;l<s.length;l++){const b=s[l];if(!b)continue;let k=!0;for(let d=r.startCol;d<=r.endCol;d++)if(b[d]){k=!1;break}if(k){o=l;break}}o===-1&&(o=s.length,s.push(new Array(7).fill(!1)));const m=s[o];if(m)for(let l=r.startCol;l<=r.endCol;l++)m[l]=!0;return{...r,row:o}})}function vn({pe:t,onEventClick:n,disablePopover:s,renderPopover:r}){const[o,m]=a.useState(!1),l=se(t.event.color),b=a.useCallback(()=>{s&&n?n(t.event):s||m(!0)},[s,n,t.event]),k=a.useCallback(()=>{m(!1)},[]),d=e.jsxs("button",{type:"button",onClick:b,className:i.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",l.bg,l.text,t.event.isCanceled&&"opacity-60 line-through",t.continuesBefore&&"rounded-l-none -ml-0.5 pl-1",t.continuesAfter&&"rounded-r-none -mr-0.5 pr-1"),style:{height:Ce,lineHeight:`${Ce}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:"▸"})]}),j=e.jsx(Q,{children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("div",{className:"font-medium",children:t.event.title}),e.jsx("div",{className:"text-xs text-muted-foreground tabular-nums",children:y.formatEventTimeDisplay(t.event)})]})}),v={gridColumn:`${t.startCol+2} / ${t.endCol+3}`,gridRow:t.row+1};return s?e.jsx("div",{style:v,children:e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:d}),j]})}):e.jsx("div",{style:v,children:e.jsxs(ae,{open:o,onOpenChange:m,children:[e.jsx(ie,{asChild:!0,children:d}),e.jsx(ne,{className:"w-80",children:r?r({event:t.event,onClose:k}):e.jsx(Nn,{event:t.event,onClose:k})})]})})}function Nn({event:t,onClose:n}){const s=se(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:i.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:i.cn("font-semibold text-lg",r&&"line-through opacity-50"),children:t.title}),e.jsx("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1 tabular-nums",children:y.formatEventTimeDisplay(t)})]})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[t.isAllDay&&e.jsx("span",{className:"text-xs bg-muted px-2 py-0.5 rounded-full font-medium",children:"All day"}),r&&e.jsx("span",{className:"text-xs bg-red-100 dark:bg-red-950/30 text-red-700 dark:text-red-300 px-2 py-0.5 rounded-full font-medium",children:"Canceled"})]}),e.jsx("div",{className:"flex justify-end pt-2 border-t",children:e.jsx("button",{type:"button",onClick:n,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function kn({events:t,weekDays:n,hourColumnWidth:s,minDayColumnWidth:r,dayColumnWidths:o,onEventClick:m,disablePopover:l=!1,renderPopover:b,className:k}){const d=a.useMemo(()=>{if(t.length===0)return[];const p=t.map(L=>{const D=Ke(L.startDate,n),T=Ke(L.endDate,n),B=Math.max(0,D),z=Math.min(6,T);if(B>6||z<0)return null;const A=D<0,R=T>6,W=y.detectAllDayEvent(L)&&y.isSameDay(L.startDate,L.endDate);return{event:L,startCol:B,endCol:z,continuesBefore:A,continuesAfter:R,isSingleDayAllDay:W}}).filter(Boolean);return wn(p)},[t,n]);if(d.length===0)return null;const j=Math.max(...d.map(p=>p.row))+1,v=Math.min(j,ve),u=j>ve,f=u?d.filter(p=>p.row>=ve).length:0,h=[`${s}px`,...o.map(p=>p>r?`${p}px`:`minmax(${r}px, 1fr)`)].join(" "),N=v*Ce+(v-1)*Ue+8;return e.jsxs("div",{className:i.cn("ic-all-day-row border-b bg-muted/20 relative",k),style:{display:"grid",gridTemplateColumns:h,gridTemplateRows:`repeat(${v}, ${Ce}px)`,gap:`${Ue}px 0`,paddingTop:4,paddingBottom:4,minHeight:N},children:[e.jsx("div",{className:"flex items-start justify-center pt-1 text-[10px] font-medium text-muted-foreground",style:{gridColumn:1,gridRow:`1 / span ${v}`},children:e.jsx("span",{className:"hidden sm:inline",children:"All day"})}),n.map((p,L)=>e.jsx("div",{className:"pointer-events-none border-r last:border-r-0",style:{gridColumn:L+2,gridRow:`1 / span ${v}`}},p.toDateString())),d.filter(p=>p.row<ve).map(p=>e.jsx(vn,{pe:p,onEventClick:m,disablePopover:l,renderPopover:b},p.event.id)),u&&e.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium px-2 flex items-center",style:{gridColumn:`2 / ${n.length+2}`,gridRow:v},children:["+",f," more"]})]})}const de=96,fe=56,Xe=72,Z=120,Ne=100,Dn=3;function Cn({events:t,date:n,weekStartsOn:s=1,visibleHours:r={startHour:0,endHour:24},workingHours:o,slotDuration:m=30,badgeVariant:l="colored",onEventClick:b,onSlotSelect:k,onDayClick:d,className:j,renderEvent:v,renderPopover:u,slots:f,classNames:h}){const N=60/m,p=100/N,L=a.useMemo(()=>{const c=[];for(let x=0;x<N;x++)c.push(x*m);return c},[N,m]),D=a.useMemo(()=>y.getWeekDays(n,s),[n,s]),T=a.useMemo(()=>y.getVisibleHoursArray(r),[r]),B=a.useMemo(()=>{const c=new Map;for(const x of D){const S=x.toDateString(),C=y.getEventsForDay(t,x),{singleDay:H,multiDay:q}=y.separateEventsByDuration(C),O=y.calculateOverlappingPositions(H,x,r,de),G=new Map;let re=1;for(const Y of O)if(G.set(Y.event.id,Y.position),Y.position.width>0){const J=Math.round(100/Y.position.width);re=Math.max(re,J)}c.set(S,{singleDay:H,multiDay:q,positions:G,maxOverlapping:re})}return c},[D,t,r]),z=a.useMemo(()=>{const c=new Map;for(const{multiDay:x}of B.values())for(const S of x)c.set(S.id,S);return Array.from(c.values())},[B]),A=new Date,R=D.findIndex(c=>y.isToday(c)),$=a.useMemo(()=>{if(R<0)return-1;const c=A.getHours()+A.getMinutes()/60;return c<r.startHour||c>r.endHour?-1:(c-r.startHour)*de},[R,r,A]),W=a.useRef(null);a.useLayoutEffect(()=>{const c=W.current;if(!c)return;const x=()=>{let S;if(R!==-1){const H=new Date().getHours();S=Math.max(H-1,r.startHour)}else{const q=new Date().getDay();let O=o?.[q];if(!O?.enabled||O.from===0){const G=o?.[1];G?.enabled&&(O=G)}O?.enabled&&O.from>0?S=Math.max(O.from-1,r.startHour):S=Math.max(7,r.startHour)}const C=(S-r.startHour)*de;c.scrollTo({top:C,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(x)})},[n,o,r,R]);const I=oe.useOptionalSlotSelection(),P=a.useCallback(c=>{I?.startSelection(c)},[I]),E=a.useCallback(c=>{I?.updateSelection(c)},[I]),g=a.useCallback(()=>{I?.endSelection()},[I]),_=a.useCallback(c=>{b?.(c)},[b]),M=fe+7*Z,V=a.useMemo(()=>{const c=[];for(const x of D){const S=x.toDateString(),H=B.get(S)?.maxOverlapping??1;H>Dn?c.push(Math.max(Z,H*Ne)):c.push(Z)}return c},[D,B]),w=fe+V.reduce((c,x)=>c+x,0);return e.jsxs("div",{className:i.cn("ic-week-view flex flex-col h-full",j),children:[z.length>0&&e.jsx(kn,{events:z,weekDays:D,hourColumnWidth:fe,minDayColumnWidth:Z,dayColumnWidths:V,onEventClick:_,disablePopover:!!b&&!u,renderPopover:u,...h?.multiDayBanner&&{className:h.multiDayBanner}}),e.jsx("div",{ref:W,className:i.cn("ic-week-scroll-container flex-1",h?.scrollContainer),children:e.jsxs("div",{style:{minWidth:Math.max(M,w)},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:fe,height:Xe},children:e.jsxs("span",{className:"hidden sm:inline",children:["GMT",(()=>{const c=new Date().getTimezoneOffset(),x=Math.abs(Math.floor(c/60)),S=c<=0?"+":"-";return x>0?`${S}${String(x).padStart(2,"0")}`:""})()]})}),D.map((c,x)=>{const S=y.isToday(c),C=V[x]??Z,H=C>Z;return e.jsxs("div",{className:i.cn("flex-1 flex flex-col items-center justify-center border-r last:border-r-0 py-2",h?.columnHeader,S&&h?.columnHeaderToday),style:{height:Xe,minWidth:H?C:Z},children:[e.jsx("span",{className:i.cn("text-[11px] font-medium uppercase tracking-wide",S?"text-primary":"text-muted-foreground"),children:c.toLocaleDateString([],{weekday:"short"})}),e.jsx("button",{type:"button",onClick:()=>d?.(c),className:i.cn("flex items-center justify-center rounded-full transition-colors mt-0.5","size-10 text-2xl font-normal",S?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"),children:c.getDate()})]},c.toDateString())})]})}),e.jsxs("div",{className:"relative flex",children:[e.jsx("div",{className:i.cn("ic-hour-column sticky left-0 z-10 bg-zinc-50 border-r",h?.timeGutter),style:{width:fe},children:T.map((c,x)=>e.jsx("div",{className:"relative",style:{height:de},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:i.cn("text-[10px] sm:text-xs text-muted-foreground",h?.timeGutterLabel),children:y.formatHourLabel(c)})})},c))}),e.jsx("div",{className:"ic-week-grid relative flex-1",children:e.jsx("div",{className:"flex divide-x",children:D.map((c,x)=>{const S=c.toDateString(),C=B.get(S),H=V[x]??Z,q=H>Z;return e.jsxs("div",{className:"ic-day-column relative flex-1",style:{minWidth:q?H:Z},children:[T.map((O,G)=>{const Y=!y.isWorkingHour(c,O,o);return e.jsxs("div",{className:i.cn("relative",Y&&"bg-calendar-disabled-hour",y.isToday(c)&&!Y&&"bg-primary/5",h?.timeSlot,Y?h?.timeSlotNonWorking:h?.timeSlotWorking),style:{height:de},children:[G!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),L.slice(1).map(J=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${J/60*100}%`}},J)),L.map((J,xe)=>{const me={date:c,hour:O,minute:J};return e.jsx(Oe,{slot:me,onSelectionStart:P,onSelectionMove:E,onSelectionEnd:g,isSelected:I?.isSlotSelected(me)??!1,isSelecting:I?.isSelecting??!1,disabled:Y,className:"absolute inset-x-0",style:{top:`${xe*p}%`,height:`${p}%`},ariaLabel:`Add event on ${c.toLocaleDateString()} at ${y.formatHourLabel(O)}:${String(J).padStart(2,"0")}`},J)})]},O)}),C?.singleDay.map(O=>{const G=C.positions.get(O.id);if(!G)return null;const re=`calc(${G.width}% - 2px)`,Y=`max(${Ne}px, ${re})`;return v?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${G.top}px`,left:`${G.left}%`,width:Y,minWidth:`${Ne}px`},children:v({event:O,position:G})},O.id):e.jsx(He,{event:O,position:{top:G.top,left:G.left,width:G.width,minWidth:Ne},hourHeight:de,badgeVariant:l,onClick:b,disablePopover:!!b&&!u,renderPopover:u,className:i.cn("pointer-events-auto",h?.eventCard)},O.id)}),x===R&&$>=0&&e.jsxs("div",{className:i.cn("absolute left-0 right-0 z-20 flex items-center pointer-events-none",h?.currentTimeIndicator),style:{top:$},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"})]})]},c.toDateString())})})})]})]})})]})}exports.AgendaView=mn;exports.Badge=ht;exports.Button=le;exports.CalendarHeader=xn;exports.DateNavigator=pt;exports.DayEventsExpansion=gt;exports.DaySlot=jt;exports.DayView=gn;exports.Dialog=Ze;exports.DialogClose=It;exports.DialogContent=We;exports.DialogDescription=st;exports.DialogHeader=tt;exports.DialogTitle=nt;exports.DialogTrigger=Qe;exports.DropdownMenu=Le;exports.DropdownMenuContent=ke;exports.DropdownMenuItem=De;exports.DropdownMenuTrigger=_e;exports.EventBlock=He;exports.EventCard=ge;exports.MonthView=jn;exports.MultiDayBanner=yt;exports.MultiDayEventBar=qt;exports.Popover=ae;exports.PopoverAnchor=Ht;exports.PopoverContent=ne;exports.PopoverTrigger=ie;exports.Sheet=rt;exports.SheetClose=Ot;exports.SheetContent=Re;exports.SheetDescription=dt;exports.SheetHeader=it;exports.SheetTitle=lt;exports.SheetTrigger=ot;exports.TimeSlot=Oe;exports.TodayButton=ft;exports.Tooltip=ee;exports.TooltipContent=Q;exports.TooltipProvider=Pt;exports.TooltipTrigger=te;exports.WeekView=Cn;exports.buttonVariants=mt;exports.getEventColorClasses=se;
11
+ //# sourceMappingURL=week-view-ITRsM6y1.cjs.map