@innosolutions/inno-calendar 1.0.21 → 1.0.23

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 (49) hide show
  1. package/dist/{agenda-dropdown-D8rfvI3Q.js → agenda-dropdown-B76IBhmH.js} +777 -769
  2. package/dist/agenda-dropdown-B76IBhmH.js.map +1 -0
  3. package/dist/agenda-dropdown-DMtt0PMz.cjs +2 -0
  4. package/dist/agenda-dropdown-DMtt0PMz.cjs.map +1 -0
  5. package/dist/{agenda-view-CRI1J_KB.js → agenda-view-5sPzr1GA.js} +795 -733
  6. package/dist/{agenda-view-CRI1J_KB.js.map → agenda-view-5sPzr1GA.js.map} +1 -1
  7. package/dist/agenda-view-BhD-XJn-.cjs +11 -0
  8. package/dist/{agenda-view-BotvTTEB.cjs.map → agenda-view-BhD-XJn-.cjs.map} +1 -1
  9. package/dist/components/index.cjs +1 -1
  10. package/dist/components/index.mjs +2 -2
  11. package/dist/components/inno-calendar.d.ts +7 -1
  12. package/dist/components/inno-calendar.d.ts.map +1 -1
  13. package/dist/components/views/month-view.d.ts +7 -1
  14. package/dist/components/views/month-view.d.ts.map +1 -1
  15. package/dist/components/views/timeline-view.d.ts +1 -1
  16. package/dist/components/views/timeline-view.d.ts.map +1 -1
  17. package/dist/core/index.cjs +1 -1
  18. package/dist/core/index.mjs +3 -3
  19. package/dist/core/utils/date-utils.d.ts +2 -0
  20. package/dist/core/utils/date-utils.d.ts.map +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.mjs +6 -6
  23. package/dist/{inno-calendar-provider-BAcxjBGI.cjs → inno-calendar-provider-CEO8ZyR2.cjs} +2 -2
  24. package/dist/{inno-calendar-provider-BAcxjBGI.cjs.map → inno-calendar-provider-CEO8ZyR2.cjs.map} +1 -1
  25. package/dist/{inno-calendar-provider-Cy72EfJy.js → inno-calendar-provider-CbnwQSuI.js} +2 -2
  26. package/dist/{inno-calendar-provider-Cy72EfJy.js.map → inno-calendar-provider-CbnwQSuI.js.map} +1 -1
  27. package/dist/presets/index.cjs +1 -1
  28. package/dist/presets/index.mjs +1 -1
  29. package/dist/slot-selection-context-BnE5w6aV.cjs +2 -0
  30. package/dist/slot-selection-context-BnE5w6aV.cjs.map +1 -0
  31. package/dist/{slot-selection-context-CZjfJAcp.js → slot-selection-context-CMaE5Bc5.js} +103 -103
  32. package/dist/slot-selection-context-CMaE5Bc5.js.map +1 -0
  33. package/dist/styles/index.css +1 -1
  34. package/dist/{tailwind-calendar-Y9dn5uKm.js → tailwind-calendar-BEf7QDjd.js} +3 -3
  35. package/dist/{tailwind-calendar-Y9dn5uKm.js.map → tailwind-calendar-BEf7QDjd.js.map} +1 -1
  36. package/dist/{tailwind-calendar-CQBD-ljO.cjs → tailwind-calendar-Cur19bSK.cjs} +2 -2
  37. package/dist/{tailwind-calendar-CQBD-ljO.cjs.map → tailwind-calendar-Cur19bSK.cjs.map} +1 -1
  38. package/dist/{use-calendar-time-config-CLYhL81Z.js → use-calendar-time-config-C_ZU8YAc.js} +3 -3
  39. package/dist/{use-calendar-time-config-CLYhL81Z.js.map → use-calendar-time-config-C_ZU8YAc.js.map} +1 -1
  40. package/dist/{use-calendar-time-config-BQ1Yni0n.cjs → use-calendar-time-config-bm7Fn31s.cjs} +2 -2
  41. package/dist/{use-calendar-time-config-BQ1Yni0n.cjs.map → use-calendar-time-config-bm7Fn31s.cjs.map} +1 -1
  42. package/package.json +1 -1
  43. package/dist/agenda-dropdown-D8rfvI3Q.js.map +0 -1
  44. package/dist/agenda-dropdown-oY4qocpp.cjs +0 -2
  45. package/dist/agenda-dropdown-oY4qocpp.cjs.map +0 -1
  46. package/dist/agenda-view-BotvTTEB.cjs +0 -11
  47. package/dist/slot-selection-context-B_YLI-x7.cjs +0 -2
  48. package/dist/slot-selection-context-B_YLI-x7.cjs.map +0 -1
  49. package/dist/slot-selection-context-CZjfJAcp.js.map +0 -1
@@ -1,11 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),u=require("./index-D2U2F80P.cjs"),o=require("react"),Ue=require("@radix-ui/react-dropdown-menu"),j=require("./slot-selection-context-B_YLI-x7.cjs"),Ke=require("@radix-ui/react-popover"),Ye=require("@radix-ui/react-tooltip");function pe(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(s,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return s.default=t,Object.freeze(s)}const U=pe(o),R=pe(Ue),ae=pe(Ke),ce=pe(Ye),ze=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Te=u.clsx,Re=(t,s)=>n=>{var r;if(s?.variants==null)return Te(t,n?.class,n?.className);const{variants:c,defaultVariants:h}=s,i=Object.keys(c).map(f=>{const m=n?.[f],b=h?.[f];if(m===null)return null;const l=ze(m)||ze(b);return c[f][l]}),p=n&&Object.entries(n).reduce((f,m)=>{let[b,l]=m;return l===void 0||(f[b]=l),f},{}),D=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((f,m)=>{let{class:b,className:l,...w}=m;return Object.entries(w).every(v=>{let[N,M]=v;return Array.isArray(M)?M.includes({...h,...p}[N]):{...h,...p}[N]===M})?[...f,b,l]:f},[]);return Te(t,i,D,n?.class,n?.className)},Ae=Re("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"}}),ee=o.forwardRef(({className:t,variant:s,size:n,loading:r,disabled:c,children:h,...i},p)=>e.jsxs("button",{className:u.cn(Ae({variant:s,size:n,className:t})),ref:p,disabled:c||r,...i,children:[r&&e.jsxs("svg",{className:"animate-spin -ml-1 mr-2 size-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),h]}));ee.displayName="Button";const Ie=(...t)=>t.filter((s,n,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===n).join(" ").trim();const Ge=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Xe=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(s,n,r)=>r?r.toUpperCase():n.toLowerCase());const Le=t=>{const s=Xe(t);return s.charAt(0).toUpperCase()+s.slice(1)};var Je={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 Ze=t=>{for(const s in t)if(s.startsWith("aria-")||s==="role"||s==="title")return!0;return!1};const Qe=o.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:c="",children:h,iconNode:i,...p},D)=>o.createElement("svg",{ref:D,...Je,width:s,height:s,stroke:t,strokeWidth:r?Number(n)*24/Number(s):n,className:Ie("lucide",c),...!h&&!Ze(p)&&{"aria-hidden":"true"},...p},[...i.map(([f,m])=>o.createElement(f,m)),...Array.isArray(h)?h:[h]]));const ve=(t,s)=>{const n=o.forwardRef(({className:r,...c},h)=>o.createElement(Qe,{ref:h,iconNode:s,className:Ie(`lucide-${Ge(Le(t))}`,`lucide-${t}`,r),...c}));return n.displayName=Le(t),n};const et=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],tt=ve("check",et);const st=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],nt=ve("chevron-right",st);const rt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],at=ve("circle",rt),je=R.Root,we=R.Trigger,ot=U.forwardRef(({className:t,inset:s,children:n,...r},c)=>e.jsxs(R.SubTrigger,{ref:c,className:u.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",s&&"pl-8",t),...r,children:[n,e.jsx(nt,{className:"ml-auto h-4 w-4"})]}));ot.displayName=R.SubTrigger.displayName;const it=U.forwardRef(({className:t,...s},n)=>e.jsx(R.SubContent,{ref:n,className:u.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),...s}));it.displayName=R.SubContent.displayName;const me=U.forwardRef(({className:t,sideOffset:s=4,...n},r)=>e.jsx(R.Portal,{children:e.jsx(R.Content,{ref:r,sideOffset:s,className:u.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),...n})}));me.displayName=R.Content.displayName;const he=U.forwardRef(({className:t,inset:s,...n},r)=>e.jsx(R.Item,{ref:r,className:u.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",s&&"pl-8",t),...n}));he.displayName=R.Item.displayName;const lt=U.forwardRef(({className:t,children:s,checked:n=!1,...r},c)=>e.jsxs(R.CheckboxItem,{ref:c,className:u.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:n,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(R.ItemIndicator,{children:e.jsx(tt,{className:"h-4 w-4"})})}),s]}));lt.displayName=R.CheckboxItem.displayName;const ct=U.forwardRef(({className:t,children:s,...n},r)=>e.jsxs(R.RadioItem,{ref:r,className:u.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),...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(R.ItemIndicator,{children:e.jsx(at,{className:"h-2 w-2 fill-current"})})}),s]}));ct.displayName=R.RadioItem.displayName;const dt=U.forwardRef(({className:t,inset:s,...n},r)=>e.jsx(R.Label,{ref:r,className:u.cn("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...n}));dt.displayName=R.Label.displayName;const ut=U.forwardRef(({className:t,...s},n)=>e.jsx(R.Separator,{ref:n,className:u.cn("-mx-1 my-1 h-px bg-muted",t),...s}));ut.displayName=R.Separator.displayName;const te=ae.Root,se=ae.Trigger,xt=ae.Anchor,J=U.forwardRef(({className:t,align:s="center",sideOffset:n=4,...r},c)=>e.jsx(ae.Portal,{children:e.jsx(ae.Content,{ref:c,align:s,sideOffset:n,className:u.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})}));J.displayName=ae.Content.displayName;const mt=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"];function Pe({onClick:t,className:s}){const n=new Date;return e.jsxs("button",{type:"button",className:u.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",s),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:mt[n.getMonth()]}),e.jsx("p",{className:"flex w-full flex-1 items-center justify-center text-sm sm:text-lg font-bold",children:n.getDate()})]})}const ht=Re("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 Be({className:t,variant:s,...n}){return e.jsx("div",{className:u.cn(ht({variant:s}),t),...n})}function ft({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 pt({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 gt=["January","February","March","April","May","June","July","August","September","October","November","December"];function Oe({date:t,view:s,events:n=[],onNavigatePrev:r,onNavigateNext:c,weekStartsOn:h=1,showEventCount:i=!0,className:p}){const D=gt[t.getMonth()],f=t.getFullYear(),m=i?j.getEventsCountInView(n,t,s,h):0,b=j.getRangeText(t,s);return e.jsxs("div",{className:u.cn("min-w-0 flex-1",p),children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 flex-wrap",children:[e.jsxs("span",{className:"text-base sm:text-lg font-semibold truncate",children:[D," ",f]}),i&&e.jsx(Be,{variant:"outline",className:"px-1 sm:px-1.5 text-[10px] sm:text-xs shrink-0",children:m})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsx(ee,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:r,children:e.jsx(ft,{})}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground truncate",children:b}),e.jsx(ee,{variant:"outline",size:"icon",className:"size-5 sm:size-6 [&_svg]:size-3 sm:[&_svg]:size-4",onClick:c,children:e.jsx(pt,{})})]})]})}function bt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("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 xe({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M9 8h7"}),e.jsx("path",{d:"M8 12h6"}),e.jsx("path",{d:"M11 16h5"})]})}function We({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 yt({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 Ee({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 jt({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 wt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M12 3v18"})]})}function vt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),e.jsx("path",{d:"M3 12h18"}),e.jsx("path",{d:"M12 3v18"})]})}function kt({className:t}){return e.jsxs("svg",{className:t,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("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 Nt=[{value:"day",label:"Day",icon:jt},{value:"week",label:"Week",icon:wt},{value:"month",label:"Month",icon:vt},{value:"year",label:"Year",icon:kt}],_e=[{value:"timeline-day",label:"1 Day",icon:xe},{value:"timeline-3day",label:"3 Days",icon:xe},{value:"timeline-week",label:"7 Days",icon:xe}];function Dt({currentDate:t,view:s,events:n=[],onNavigateToday:r,onNavigatePrev:c,onNavigateNext:h,onNavigate:i,onViewChange:p,onAddEvent:D,availableViews:f=["day","week","month","agenda"],showTimelineViews:m=!1,timelineViews:b,settingsContent:l,showSettings:w=!1,filterContent:v,actions:N,className:M,weekStartsOn:z=1,labels:d={}}){const g=o.useMemo(()=>({today:"Today",addEvent:"Add Event",calendarView:"Calendar View",resourceView:"Resource View",...d}),[d]),T=()=>{r?.(),i?.("today")},A=()=>{c?.(),i?.("prev")},W=()=>{h?.(),i?.("next")},C=["day","week","month","year","agenda"].includes(s),S=s.startsWith("timeline-")||s.startsWith("resource-"),B=Nt.filter(x=>f.includes(x.value)),V=C?B.find(x=>x.value===s):null,I=S?_e.find(x=>x.value===s):null;return e.jsxs("div",{className:u.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.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:[e.jsx(Pe,{onClick:T}),e.jsx(Oe,{date:t,view:s,events:n,onNavigatePrev:A,onNavigateNext:W,weekStartsOn:z})]}),D&&e.jsx(ee,{size:"icon",className:"shrink-0 lg:hidden",onClick:D,children:e.jsx(Ee,{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:[p&&B.length>0&&e.jsxs(je,{children:[e.jsxs(we,{className:u.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",C?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-input bg-background hover:bg-accent hover:text-accent-foreground"),children:[e.jsx(bt,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:V?.label??g.calendarView}),e.jsx(We,{className:"size-3 opacity-60"})]}),e.jsx(me,{align:"start",className:"min-w-[120px]",children:B.map(x=>{const O=x.icon;return e.jsxs(he,{onClick:()=>p(x.value),className:u.cn("gap-2",s===x.value&&"bg-accent"),children:[e.jsx(O,{className:"size-4"}),e.jsx("span",{children:x.label})]},x.value)})})]}),m&&p&&e.jsxs(je,{children:[e.jsxs(we,{className:u.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",S?"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(xe,{className:"size-4"}),e.jsx("span",{className:"text-xs sm:text-sm font-medium",children:I?.label??g.resourceView}),e.jsx(We,{className:"size-3 opacity-60"})]}),e.jsx(me,{align:"start",className:"min-w-[120px]",children:_e.map(x=>{const O=x.icon;return e.jsxs(he,{onClick:()=>p(x.value),className:u.cn("gap-2",s===x.value&&"bg-accent"),children:[e.jsx(O,{className:"size-4"}),e.jsx("span",{children:x.label})]},x.value)})})]}),w&&l&&e.jsxs(te,{children:[e.jsx(se,{asChild:!0,children:e.jsx(ee,{variant:"outline",size:"icon",className:"min-w-10 min-h-10 shrink-0 mx-0",children:e.jsx(yt,{className:"size-4 sm:size-5"})})}),e.jsx(J,{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:l})})]}),N,D&&e.jsxs(ee,{className:"hidden lg:flex shrink-0 max-h-10",onClick:D,children:[e.jsx(Ee,{className:"size-4"}),g.addEvent]})]})]}),v&&e.jsx("div",{className:"flex items-center gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-none",children:v})]})}const Ct=ce.Provider,Z=ce.Root,Q=ce.Trigger,X=U.forwardRef(({className:t,sideOffset:s=4,...n},r)=>e.jsx(ce.Content,{ref:r,sideOffset:s,className:u.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),...n}));X.displayName=ce.Content.displayName;function oe(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 fe(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function G(t,s){return`${fe(t)} - ${fe(s)}`}function ke(t){const s=new Date(t);return s.setHours(0,0,0,0),s}function Ne({event:t,variant:s="full",badgeVariant:n="colored",onClick:r,className:c,showTime:h=!0,showDescription:i=!1,showParticipants:p=!1,style:D,disablePopover:f=!1,renderPopover:m,enableDrag:b=!1}){const l=oe(t.color),[w,v]=o.useState(!1),[N,M]=o.useState(!1),z=j.useOptionalDragDrop(),d=t.endDate<ke(new Date),g=t.isCanceled??!1,T=b&&z&&!g&&!d,A=g?e.jsx(St,{className:"h-3 w-3 text-zinc-800 dark:text-zinc-200"}):t.meetingTookPlace?e.jsx(Mt,{className:u.cn("h-3 w-3",l.text)}):null,W=o.useCallback(()=>{N||(f&&r?r(t):f||v(!0))},[N,f,r,t]),C=o.useCallback(()=>{v(!1)},[]),S=o.useCallback(I=>{T&&(I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",t.id),M(!0),z?.startDrag?.(t))},[T,t,z]),B=o.useCallback(()=>{M(!1),z?.isDragging&&z.endDrag?.()},[z]);if(s==="dot"){const I=e.jsx("button",{type:"button",onClick:W,className:u.cn("size-2 rounded-full cursor-pointer transition-opacity",d?"bg-gray-400":l.dot,t.isCanceled&&"opacity-50",c),style:D,"aria-label":t.title});return f?e.jsxs(Z,{children:[e.jsx(Q,{asChild:!0,children:I}),e.jsx(X,{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(t.startDate,t.endDate)})]})})]}):e.jsxs(te,{open:w,onOpenChange:v,children:[e.jsx(se,{asChild:!0,children:e.jsxs(Z,{children:[e.jsx(Q,{asChild:!0,children:I}),e.jsx(X,{children:e.jsx("div",{className:"font-medium",children:t.title})})]})}),e.jsx(J,{className:"w-80",children:m?m({event:t,onClose:C}):e.jsx(le,{event:t,onClose:C})})]})}if(s==="compact"){const I=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!T,onDragStart:S,onDragEnd:B,onClick:f?W:void 0,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),W())},className:u.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",T?"cursor-grab active:cursor-grabbing":"cursor-pointer",N&&"opacity-50",g||d?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400 line-through":[n==="colored"&&[l.bg,l.text],n==="mixed"&&[l.bg,l.text],n==="dot"&&"bg-muted/50"],c),style:D,children:[["dot","mixed"].includes(n)&&!d&&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:l.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:u.cn("w-fit mt-0.5 text-[10px] px-1 py-0.5 border border-dashed rounded-full font-medium",d?"border-zinc-400 dark:border-zinc-600":l.border),children:G(t.startDate,t.endDate)})]})}),e.jsx("div",{className:"flex gap-0.5",children:A})]});return f?e.jsxs(Z,{children:[e.jsx(Q,{asChild:!0,children:I}),e.jsx(X,{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(t.startDate,t.endDate)})]})})]}):e.jsxs(te,{open:w,onOpenChange:v,children:[e.jsx(se,{asChild:!0,children:I}),e.jsx(J,{className:"w-80",children:m?m({event:t,onClose:C}):e.jsx(le,{event:t,onClose:C})})]})}const V=e.jsxs("button",{type:"button",onClick:W,className:u.cn("group relative flex w-full flex-col gap-1 rounded-md border px-2 py-1.5 text-left transition-all hover:shadow-md","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",g||d?"bg-zinc-100 dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[n==="colored"&&[l.bg,l.border,l.text],n==="mixed"&&[l.bg,l.border,l.text],n==="dot"&&"bg-muted/50 border-border"],c),style:D,children:[e.jsxs("div",{className:"flex items-start justify-between gap-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[["dot","mixed"].includes(n)&&!d&&!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:l.dotFill})}),e.jsx("span",{className:u.cn("text-sm font-medium truncate",!d&&!g&&n!=="dot"&&l.text,g&&"line-through"),children:t.title})]}),A]}),h&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(He,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{children:G(t.startDate,t.endDate)})]}),i&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),p&&t.participants&&t.participants.length>0&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(zt,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:t.participants.map(I=>I.name).join(", ")})]}),t.scheduleTypeName&&e.jsx("span",{className:u.cn("mt-1 inline-flex self-start rounded-full px-2 py-0.5 text-[10px] font-medium",d?"bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400":[l.bg,l.text]),children:t.scheduleTypeName})]});return f?e.jsxs(Z,{children:[e.jsx(Q,{asChild:!0,children:V}),e.jsx(X,{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(t.startDate,t.endDate)})]})})]}):e.jsxs(te,{open:w,onOpenChange:v,children:[e.jsx(se,{asChild:!0,children:V}),e.jsx(J,{className:"w-80",children:m?m({event:t,onClose:C}):e.jsx(le,{event:t,onClose:C})})]})}function He({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 Mt({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 St({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"M18 6 6 18"}),e.jsx("path",{d:"m6 6 12 12"})]})}function zt({className:t}){return e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:[e.jsx("path",{d:"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 le({event:t,onClose:s}){const n=oe(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:u.cn("size-4 rounded shrink-0 mt-0.5",n.dot)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:u.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(He,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"tabular-nums",children:G(t.startDate,t.endDate)})]})]})]}),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:s,className:"text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md hover:bg-muted transition-colors",children:"Close"})})]})}function De({event:t,position:s,hourHeight:n=96,badgeVariant:r="colored",onClick:c,className:h,disablePopover:i=!1,renderPopover:p,enableDrag:D=!0}){const f=oe(t.color),[m,b]=o.useState(!1),[l,w]=o.useState(!1),v=j.useOptionalDragDrop(),N=(t.endDate.getTime()-t.startDate.getTime())/(1e3*60),M=N/60*n-8,z=t.endDate<ke(new Date),d=t.isCanceled??!1,g=D&&v&&!d&&!z,T=N<35,A=N>25,W=r==="dot",C=o.useCallback(()=>{l||(i&&c?c(t):i||b(!0))},[l,i,c,t]),S=o.useCallback(()=>{b(!1)},[]),B=o.useCallback(E=>{if(!g)return;E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("text/plain",t.id);const y=E.currentTarget,a=y.getBoundingClientRect();E.dataTransfer.setDragImage(y,E.clientX-a.left,E.clientY-a.top),w(!0),v?.startDrag?.(t)},[g,t,v]),V=o.useCallback(()=>{w(!1),v?.isDragging&&v.endDrag?.()},[v]),I=o.useCallback(E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),C())},[C]),x=e.jsxs("div",{role:"button",tabIndex:0,draggable:!!g,onDragStart:B,onDragEnd:V,onKeyDown:I,onClick:l?void 0:C,className:u.cn("group flex w-full select-none flex-col gap-0.5 overflow-hidden rounded-md border px-2 py-1.5 text-xs text-left","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","transition-opacity",g?"cursor-grab active:cursor-grabbing":"cursor-pointer",l&&"opacity-50",d||z?"bg-zinc-100 dark:bg-zinc-800 border-zinc-300 dark:border-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[!W&&[f.bg,f.border,f.text],W&&"bg-neutral-50 dark:bg-neutral-900 border-neutral-200 dark:border-neutral-700"],T&&"py-0 justify-center",h),style:{height:`${Math.max(M,20)}px`},children:[e.jsxs("div",{className:"flex items-start gap-1.5 min-w-0",children:[["mixed","dot"].includes(r)&&!z&&!d&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0","aria-hidden":"true",focusable:"false",children:e.jsx("circle",{cx:"4",cy:"4",r:"4",className:f.dotFill})}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:e.jsx("p",{className:u.cn("font-semibold whitespace-nowrap",!z&&!d&&W&&"text-foreground"),children:t.title})})]}),A&&e.jsxs("p",{className:u.cn("text-[11px] tabular-nums",W?"text-muted-foreground":"opacity-90"),children:[fe(t.startDate)," - ",fe(t.endDate)]})]}),O=e.jsx(X,{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(t.startDate,t.endDate)})]})});return i?e.jsx("div",{className:"absolute p-0.5",style:{top:`${s.top}px`,left:`${s.left}%`,width:s.minWidth?`max(${s.minWidth}px, ${s.width}%)`:`${s.width}%`,minWidth:s.minWidth?`${s.minWidth}px`:void 0},children:e.jsxs(Z,{children:[e.jsx(Q,{asChild:!0,children:x}),O]})}):e.jsx("div",{className:"absolute p-0.5",style:{top:`${s.top}px`,left:`${s.left}%`,width:s.minWidth?`max(${s.minWidth}px, ${s.width}%)`:`${s.width}%`,minWidth:s.minWidth?`${s.minWidth}px`:void 0},children:e.jsxs(te,{open:m,onOpenChange:b,children:[e.jsx(se,{asChild:!0,children:x}),e.jsx(J,{className:"w-80",children:p?p({event:t,onClose:S}):e.jsx(le,{event:t,onClose:S})})]})})}function Tt({event:t,spanDays:s,isStart:n,isEnd:r,onClick:c,className:h,disablePopover:i=!1,renderPopover:p}){const D=oe(t.color),[f,m]=o.useState(!1),b=t.endDate<ke(new Date),l=t.isCanceled??!1,w=o.useCallback(()=>{i&&c?c(t):i||m(!0)},[i,c,t]),v=o.useCallback(()=>{m(!1)},[]),N=e.jsx("button",{type:"button",onClick:w,className:u.cn("flex h-5 items-center px-1.5 text-xs font-medium transition-opacity hover:opacity-80",l||b?"bg-zinc-200 dark:bg-zinc-700 text-zinc-500 dark:text-zinc-400 line-through":[D.dot,"text-white"],n&&"rounded-l",r&&"rounded-r",!n&&"border-l-0",!r&&"border-r-0",h),style:{width:`${s*100}%`},children:n&&e.jsx("span",{className:"truncate",children:t.title})}),M=e.jsx(X,{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(t.startDate,t.endDate)})]})});return i?e.jsxs(Z,{children:[e.jsx(Q,{asChild:!0,children:N}),M]}):e.jsxs(te,{open:f,onOpenChange:m,children:[e.jsx(se,{asChild:!0,children:N}),e.jsx(J,{className:"w-80",children:p?p({event:t,onClose:v}):e.jsx(le,{event:t,onClose:v})})]})}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)}function Ce({events:t,date:s,onEventClick:n,className:r}){return t.length===0?null:e.jsxs("div",{className:u.cn("border-b bg-muted/20 px-2 py-1.5 space-y-1","sm:px-4 sm:py-2",r),children:[e.jsx("span",{className:"text-[10px] font-medium text-muted-foreground sm:text-xs",children:"All day / Multi-day"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(c=>{const h=oe(c.color),i=j.isSameDay(c.startDate,s),p=j.isSameDay(c.endDate,s);return e.jsxs("button",{type:"button",onClick:()=>n?.(c),className:u.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",h.bg,h.text,c.isCanceled&&"opacity-60 line-through"),children:[i&&"→ ",e.jsx("span",{className:"truncate max-w-24 sm:max-w-32",children:c.title}),p&&" →"]},c.id)})})]})}const Lt=5;function Ve({slot:t,onSelectionStart:s,onSelectionMove:n,onSelectionEnd:r,isSelected:c=!1,isSelecting:h=!1,disabled:i=!1,ariaLabel:p,children:D,className:f,height:m,style:b,dataAttributes:l}){const w=o.useRef(null),v=o.useRef(!1),N=o.useRef(!1),M=o.useRef(null),[z,d]=o.useState(!1),g=j.useOptionalDragDrop(),T=o.useCallback(x=>{i||x.button!==0&&x.pointerType==="mouse"||(x.preventDefault(),w.current={x:x.clientX,y:x.clientY},v.current=!1,N.current=!0,s?.(t))},[i,t,s]),A=o.useCallback(x=>{if(!(w.current&&N.current&&!i))return;const O=x.clientX-w.current.x,E=x.clientY-w.current.y;Math.sqrt(O*O+E*E)>=Lt&&(v.current=!0)},[i]),W=o.useCallback(x=>{i||(x.buttons>0||h)&&n?.(t)},[i,h,t,n]),C=o.useCallback(()=>{i||(r?.(),w.current=null,v.current=!1,N.current=!1)},[i,r]),S=o.useCallback(x=>{if(!g?.isDragging||i)return;x.preventDefault(),x.dataTransfer.dropEffect="move",d(!0);const O=new Date,E=t.hour??O.getHours(),y=t.minute??(O.getMinutes()>=30?30:0);g.updateDragPreview?.(t.date,E,y)},[g,i,t]),B=o.useCallback(()=>{d(!1)},[]),V=o.useCallback(x=>{x.preventDefault(),d(!1),!(!g?.isDragging||i)&&g.endDrag?.()},[g,i]);o.useEffect(()=>{const x=()=>{N.current&&(N.current=!1,w.current=null,v.current=!1)};return window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x),()=>{window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x)}},[]);const I=o.useCallback(x=>{i||(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),s?.(t),r?.())},[i,t,s,r]);return e.jsx("button",{ref:M,type:"button","aria-label":p,"aria-disabled":i,"aria-pressed":c,disabled:i,onPointerDown:T,onPointerMove:A,onPointerUp:C,onPointerEnter:W,onKeyDown:I,onDragOver:S,onDragLeave:B,onDrop:V,className:u.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",!(h||i)&&"hover:bg-accent/50",c&&"bg-zinc-50",z&&"bg-primary/20 ring-2 ring-primary ring-inset",i&&"cursor-not-allowed opacity-50",f),style:{height:m,...b},...l,children:D})}function Me({slot:t,date:s,hour:n,minute:r,ariaLabel:c,...h}){const i=t??{date:s,hour:n??0,minute:r??0},p=c??`Add event at ${(i.hour??0).toString().padStart(2,"0")}:${(i.minute??0).toString().padStart(2,"0")} on ${i.date.toLocaleDateString()}`;return e.jsx(Ve,{slot:i,ariaLabel:p,...h})}function Fe({slot:t,date:s,ariaLabel:n,...r}){const c=t??{date:s},h=n??`Select ${c.date.toLocaleDateString()}`;return e.jsx(Ve,{slot:c,ariaLabel:h,...r})}const ie=96,ge=72,be=80;function Wt({events:t,date:s,visibleHours:n={startHour:0,endHour:24},workingHours:r,slotDuration:c=30,badgeVariant:h="colored",onEventClick:i,onSlotSelect:p,className:D,renderEvent:f,renderPopover:m}){const b=60/c,l=100/b,w=o.useMemo(()=>{const y=[];for(let a=0;a<b;a++)y.push(a*c);return y},[b,c]),v=o.useMemo(()=>j.getEventsForDay(t,s),[t,s]),{singleDay:N,multiDay:M}=o.useMemo(()=>j.separateEventsByDuration(v),[v]),z=o.useMemo(()=>{const y=j.calculateOverlappingPositions(N,s,n,ie),a=new Map;for(const k of y)a.set(k.event.id,k.position);return a},[N,s,n]),d=o.useMemo(()=>j.getVisibleHoursArray(n),[n]),g=new Date,T=j.isToday(s),A=o.useMemo(()=>{if(!T)return 0;const y=g.getHours()+g.getMinutes()/60;return y<n.startHour||y>n.endHour?-1:(y-n.startHour)*ie},[T,n,g]),W=o.useRef(null);o.useLayoutEffect(()=>{const y=W.current;if(!y)return;const a=()=>{const k=s.getDay(),L=r?.[k];let _;L?.enabled&&L.from>0?_=Math.max(L.from-1,n.startHour):_=Math.max(7,n.startHour);const $=(_-n.startHour)*ie;y.scrollTo({top:$,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(a)})},[s,r,n]);const C=j.useOptionalSlotSelection(),S=o.useCallback(y=>{C?.startSelection(y)},[C]),B=o.useCallback(y=>{C?.updateSelection(y)},[C]),V=o.useCallback(()=>{C?.endSelection()},[C]),I=o.useCallback(y=>{i?.(y)},[i]),x=s.toLocaleDateString([],{weekday:"short"}),O=s.getDate(),E=j.isToday(s);return e.jsxs("div",{className:u.cn("flex flex-col h-full",D),children:[e.jsx("div",{className:"flex items-center gap-3 border-b px-4 py-3",children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:u.cn("text-[11px] font-medium uppercase tracking-wide",E?"text-primary":"text-muted-foreground"),children:x}),e.jsx("span",{className:u.cn("flex items-center justify-center rounded-full mt-0.5","size-12 text-3xl font-normal",E?"bg-primary text-primary-foreground":"text-foreground"),children:O})]})}),M.length>0&&e.jsx(Ce,{events:M,date:s,onEventClick:I}),e.jsx("div",{ref:W,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"relative min-h-full",children:[d.map((y,a)=>{const L=!j.isWorkingHour(s,y,r);return e.jsxs("div",{className:u.cn("relative flex",L&&"bg-calendar-disabled-hour"),style:{height:ie},children:[e.jsx("div",{className:"relative flex-shrink-0 border-r border-border/50 bg-zinc-50 dark:bg-zinc-900",style:{width:ge},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:a!==0&&e.jsx("span",{className:"text-[10px] sm:text-xs text-muted-foreground",children:j.formatHourLabel(y)})})}),e.jsxs("div",{className:"relative flex-1",children:[T&&!L&&e.jsx("div",{className:"absolute inset-0 bg-primary/5"}),a!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),w.slice(1).map(_=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${_/60*100}%`}},_)),w.map((_,$)=>{const F={date:s,hour:y,minute:_};return e.jsx(Me,{slot:F,onSelectionStart:S,onSelectionMove:B,onSelectionEnd:V,isSelected:C?.isSlotSelected(F)??!1,isSelecting:C?.isSelecting??!1,disabled:L,className:"absolute inset-x-0",style:{top:`${$*l}%`,height:`${l}%`},ariaLabel:`Add event at ${j.formatHourLabel(y)}:${String(_).padStart(2,"0")}`},_)})]})]},y)}),e.jsx("div",{className:"absolute top-0 bottom-0 right-0 pointer-events-none",style:{left:ge},children:N.map(y=>{const a=z.get(y.id);if(!a)return null;const k=`calc(${a.width}% - 2px)`,L=`max(${be}px, ${k})`;return f?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${a.top}px`,left:`${a.left}%`,width:L,minWidth:`${be}px`},children:f({event:y,position:a})},y.id):e.jsx(De,{event:y,position:{top:a.top,left:a.left,width:a.width,minWidth:be},hourHeight:ie,badgeVariant:h,onClick:i,disablePopover:!!i&&!m,renderPopover:m,className:"pointer-events-auto"},y.id)})}),T&&A>=0&&e.jsxs("div",{className:"absolute left-0 right-0 z-20 flex items-center pointer-events-none",style:{top:A,left:ge},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 re=96,de=56,$e=72,K=120,ue=100,Et=3;function _t({events:t,date:s,weekStartsOn:n=1,visibleHours:r={startHour:0,endHour:24},workingHours:c,slotDuration:h=30,badgeVariant:i="colored",onEventClick:p,onSlotSelect:D,onDayClick:f,className:m,renderEvent:b,renderPopover:l}){const w=60/h,v=100/w,N=o.useMemo(()=>{const a=[];for(let k=0;k<w;k++)a.push(k*h);return a},[w,h]),M=o.useMemo(()=>j.getWeekDays(s,n),[s,n]),z=o.useMemo(()=>j.getVisibleHoursArray(r),[r]),d=o.useMemo(()=>{const a=new Map;for(const k of M){const L=k.toDateString(),_=j.getEventsForDay(t,k),{singleDay:$,multiDay:F}=j.separateEventsByDuration(_),H=j.calculateOverlappingPositions($,k,r,re),P=new Map;let ne=1;for(const q of H)if(P.set(q.event.id,q.position),q.position.width>0){const Y=Math.round(100/q.position.width);ne=Math.max(ne,Y)}a.set(L,{singleDay:$,multiDay:F,positions:P,maxOverlapping:ne})}return a},[M,t,r]),g=o.useMemo(()=>{const a=new Map;for(const{multiDay:k}of d.values())for(const L of k)a.set(L.id,L);return Array.from(a.values())},[d]),T=new Date,A=M.findIndex(a=>j.isToday(a)),W=o.useMemo(()=>{if(A<0)return-1;const a=T.getHours()+T.getMinutes()/60;return a<r.startHour||a>r.endHour?-1:(a-r.startHour)*re},[A,r,T]),C=o.useRef(null);o.useLayoutEffect(()=>{const a=C.current;if(!a)return;const k=()=>{const _=new Date().getDay();let $=c?.[_];if(!$?.enabled||$.from===0){const P=c?.[1];P?.enabled&&($=P)}let F;$?.enabled&&$.from>0?F=Math.max($.from-1,r.startHour):F=Math.max(7,r.startHour);const H=(F-r.startHour)*re;a.scrollTo({top:H,behavior:"instant"})};requestAnimationFrame(()=>{requestAnimationFrame(k)})},[s,c,r]);const S=j.useOptionalSlotSelection(),B=o.useCallback(a=>{S?.startSelection(a)},[S]),V=o.useCallback(a=>{S?.updateSelection(a)},[S]),I=o.useCallback(()=>{S?.endSelection()},[S]),x=o.useCallback(a=>{p?.(a)},[p]),O=de+7*K,E=o.useMemo(()=>{const a=[];for(const k of M){const L=k.toDateString(),$=d.get(L)?.maxOverlapping??1;$>Et?a.push(Math.max(K,$*ue)):a.push(K)}return a},[M,d]),y=de+E.reduce((a,k)=>a+k,0);return e.jsxs("div",{className:u.cn("ic-week-view flex flex-col h-full",m),children:[g.length>0&&e.jsx(Ce,{events:g,date:j.startOfWeek(s,n),onEventClick:x}),e.jsx("div",{ref:C,className:"ic-week-scroll-container flex-1",children:e.jsxs("div",{style:{minWidth:Math.max(O,y)},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:de,height:$e},children:e.jsxs("span",{className:"hidden sm:inline",children:["GMT",(()=>{const a=new Date().getTimezoneOffset(),k=Math.abs(Math.floor(a/60)),L=a<=0?"+":"-";return k>0?`${L}${String(k).padStart(2,"0")}`:""})()]})}),M.map((a,k)=>{const L=j.isToday(a),_=E[k]??K,$=_>K;return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center border-r last:border-r-0 py-2",style:{height:$e,minWidth:$?_:K},children:[e.jsx("span",{className:u.cn("text-[11px] font-medium uppercase tracking-wide",L?"text-primary":"text-muted-foreground"),children:a.toLocaleDateString([],{weekday:"short"})}),e.jsx("button",{type:"button",onClick:()=>f?.(a),className:u.cn("flex items-center justify-center rounded-full transition-colors mt-0.5","size-10 text-2xl font-normal",L?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"),children:a.getDate()})]},a.toDateString())})]})}),e.jsxs("div",{className:"relative flex",children:[e.jsx("div",{className:"ic-hour-column sticky left-0 z-10 bg-zinc-50 dark:bg-zinc-900 border-r",style:{width:de},children:z.map((a,k)=>e.jsx("div",{className:"relative",style:{height:re},children:e.jsx("div",{className:"absolute -top-2.5 right-1 sm:right-2 flex h-5 items-center",children:k!==0&&e.jsx("span",{className:"text-[10px] sm:text-xs text-muted-foreground",children:j.formatHourLabel(a)})})},a))}),e.jsx("div",{className:"ic-week-grid relative flex-1",children:e.jsx("div",{className:"flex divide-x",children:M.map((a,k)=>{const L=a.toDateString(),_=d.get(L),$=E[k]??K,F=$>K;return e.jsxs("div",{className:"ic-day-column relative flex-1",style:{minWidth:F?$:K},children:[z.map((H,P)=>{const q=!j.isWorkingHour(a,H,c);return e.jsxs("div",{className:u.cn("relative",q&&"bg-calendar-disabled-hour",j.isToday(a)&&!q&&"bg-primary/5"),style:{height:re},children:[P!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b border-border/50"}),N.slice(1).map(Y=>e.jsx("div",{className:"pointer-events-none absolute inset-x-0 border-b border-dashed border-border/30",style:{top:`${Y/60*100}%`}},Y)),N.map((Y,qe)=>{const Se={date:a,hour:H,minute:Y};return e.jsx(Me,{slot:Se,onSelectionStart:B,onSelectionMove:V,onSelectionEnd:I,isSelected:S?.isSlotSelected(Se)??!1,isSelecting:S?.isSelecting??!1,disabled:q,className:"absolute inset-x-0",style:{top:`${qe*v}%`,height:`${v}%`},ariaLabel:`Add event on ${a.toLocaleDateString()} at ${j.formatHourLabel(H)}:${String(Y).padStart(2,"0")}`},Y)})]},H)}),_?.singleDay.map(H=>{const P=_.positions.get(H.id);if(!P)return null;const ne=`calc(${P.width}% - 2px)`,q=`max(${ue}px, ${ne})`;return b?e.jsx("div",{className:"absolute pointer-events-auto p-0.5",style:{top:`${P.top}px`,left:`${P.left}%`,width:q,minWidth:`${ue}px`},children:b({event:H,position:P})},H.id):e.jsx(De,{event:H,position:{top:P.top,left:P.left,width:P.width,minWidth:ue},hourHeight:re,badgeVariant:i,onClick:p,disablePopover:!!p&&!l,renderPopover:l,className:"pointer-events-auto"},H.id)}),k===A&&W>=0&&e.jsxs("div",{className:"absolute left-0 right-0 z-20 flex items-center pointer-events-none",style:{top:W},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"})]})]},a.toDateString())})})})]})]})})]})}const $t=[{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"}],Rt=[{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 At({events:t,date:s,weekStartsOn:n=1,badgeVariant:r="colored",onEventClick:c,onSlotSelect:h,onDayClick:i,className:p,renderEvent:D,renderPopover:f}){const m=o.useMemo(()=>j.generateMonthGrid(s,n),[s,n]),b=o.useMemo(()=>{const d=new Map;for(const g of m){const T=g.date.toDateString(),A=j.getEventsForDay(t,g.date);A.sort((W,C)=>W.startDate.getTime()-C.startDate.getTime()),d.set(T,A)}return d},[m,t]),l=j.useOptionalSlotSelection(),w=o.useCallback(d=>{l?.startSelection(d)},[l]),v=o.useCallback(d=>{l?.updateSelection(d)},[l]),N=o.useCallback(()=>{l?.endSelection()},[l]),M=o.useCallback(d=>{i?.(d)},[i]),z=n===0?Rt:$t;return e.jsx("div",{className:u.cn("flex flex-col h-full overflow-hidden",p),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:"grid grid-cols-7 border-b !sticky !top-0 bg-background z-10",children:z.map((d,g)=>e.jsxs("div",{className:u.cn("py-2 sm:py-2.5 text-center text-[11px] uppercase font-medium tracking-wide text-muted-foreground",g>=5&&"text-muted-foreground/70"),children:[e.jsx("span",{className:"sm:hidden",children:d.short}),e.jsx("span",{className:"hidden sm:inline",children:d.short})]},d.full))}),e.jsx("div",{className:"grid grid-cols-7 auto-rows-min",children:m.map(d=>{const g=d.date.toDateString(),T=b.get(g)||[],A=j.isToday(d.date),W=d.date.getDay()===0||d.date.getDay()===6,C=T.length>ye;return e.jsxs(Fe,{date:d.date,onSelectionStart:w,onSelectionMove:v,onSelectionEnd:N,isSelected:l?.isSlotSelected({date:d.date})??!1,isSelecting:l?.isSelecting??!1,className:u.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",!d.isCurrentMonth&&"bg-muted/20",W&&d.isCurrentMonth&&"bg-muted/10"),ariaLabel:`${d.date.toLocaleDateString()} - ${T.length} events. Click to create event, double-click to view day.`,children:[e.jsx("div",{className:u.cn("flex items-center justify-center p-1",!d.isCurrentMonth&&"text-muted-foreground/40"),children:e.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),M(d.date)},className:u.cn("flex items-center justify-center rounded-full transition-colors","size-7 text-sm font-normal",A?"bg-primary text-primary-foreground":"hover:bg-muted"),children:d.date.getDate()})}),e.jsxs("div",{className:"flex-1 overflow-hidden px-2 pt-1 pb-1 space-y-1",children:[T.slice(0,ye).map(S=>e.jsx("div",{onPointerDown:B=>{B.stopPropagation()},children:D?D({event:S,variant:"compact"}):e.jsx(Ne,{event:S,variant:"compact",badgeVariant:r,onClick:c,disablePopover:!!c&&!f,renderPopover:f,showTime:!1,enableDrag:!0})},S.id)),C&&e.jsxs("div",{onPointerDown:S=>{S.stopPropagation(),M(d.date)},className:"w-full text-left text-xs text-muted-foreground hover:text-foreground hover:underline px-1.5 cursor-pointer",children:["+",T.length-ye," more"]})]})]},g)})})]})})})}function It({events:t,date:s,daysAhead:n=60,badgeVariant:r="colored",onEventClick:c,className:h,renderEvent:i,renderPopover:p}){const D=o.useMemo(()=>{const m=new Date(s);m.setHours(0,0,0,0);const b=new Date(m);return b.setDate(b.getDate()+n),t.filter(l=>l.endDate>=m&&l.startDate<=b)},[t,n,s]),f=o.useMemo(()=>{const m=j.groupEventsByDate(D),b=[];for(const[l,w]of m)b.push({date:new Date(l),dateKey:l,events:w});return b.sort((l,w)=>l.date.getTime()-w.date.getTime()),b},[D]);return f.length===0?e.jsx("div",{className:u.cn("flex flex-col items-center justify-center h-full py-12",h),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:u.cn("flex flex-col h-full overflow-auto",h),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:[D.length," event",D.length!==1?"s":""]})]})}),e.jsx("div",{className:"flex-1",children:f.map(({date:m,dateKey:b,events:l})=>{const w=j.isToday(m),v=m.toLocaleDateString([],{weekday:"short"}),N=m.getDate(),M=m.toLocaleDateString([],{month:"short"});return e.jsxs("div",{className:"",children:[e.jsx("div",{className:u.cn("sticky top-[52px] z-10 bg-background px-4 py-3 border-b"),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:u.cn("text-[11px] font-medium uppercase tracking-wide",w?"text-primary":"text-muted-foreground"),children:v}),e.jsx("span",{className:u.cn("flex items-center justify-center rounded-full mt-0.5","size-10 text-xl font-normal",w?"bg-primary text-primary-foreground":"text-foreground"),children:N})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[M," ",m.getFullYear()]})]})}),e.jsx("div",{className:"px-4 py-3 space-y-2 border-b last:border-b-0",children:l.map(z=>i?e.jsx("div",{children:i({event:z,variant:"full"})},z.id):e.jsx(Ne,{event:z,variant:"full",badgeVariant:r,onClick:c,disablePopover:!!c&&!p,renderPopover:p,showTime:!0,showDescription:!0,showParticipants:!0},z.id))})]},b)})})]})}exports.AgendaView=It;exports.Badge=Be;exports.Button=ee;exports.CalendarHeader=Dt;exports.DateNavigator=Oe;exports.DaySlot=Fe;exports.DayView=Wt;exports.DropdownMenu=je;exports.DropdownMenuContent=me;exports.DropdownMenuItem=he;exports.DropdownMenuTrigger=we;exports.EventBlock=De;exports.EventCard=Ne;exports.MonthView=At;exports.MultiDayBanner=Ce;exports.MultiDayEventBar=Tt;exports.Popover=te;exports.PopoverAnchor=xt;exports.PopoverContent=J;exports.PopoverTrigger=se;exports.TimeSlot=Me;exports.TodayButton=Pe;exports.Tooltip=Z;exports.TooltipContent=X;exports.TooltipProvider=Ct;exports.TooltipTrigger=Q;exports.WeekView=_t;exports.buttonVariants=Ae;exports.getEventColorClasses=oe;
11
- //# sourceMappingURL=agenda-view-BotvTTEB.cjs.map
@@ -1,2 +0,0 @@
1
- "use strict";const N=require("react/jsx-runtime"),f=require("react"),ee=["day","week","month","year","agenda","resource-day","resource-week","timeline-day","timeline-week"],te={startHour:8,endHour:18,firstDayOfWeek:1,slotDuration:30,showWeekends:!0,timeFormat:"24h",badgeVariant:"colored",showCanceledEvents:!1},ne={startHour:0,endHour:24},re={startHour:8,endHour:18},oe={day:{type:"day",slotMinTime:"00:00",slotMaxTime:"24:00",slotDuration:"00:30:00",scrollTime:"08:00:00",allDaySlot:!0},week:{type:"week",slotMinTime:"00:00",slotMaxTime:"24:00",slotDuration:"00:30:00",scrollTime:"08:00:00",dayMaxEventRows:3,allDaySlot:!0},month:{type:"month",dayMaxEventRows:4,eventMaxStack:3,allDaySlot:!1},year:{type:"year",dayMaxEventRows:2,allDaySlot:!1},agenda:{type:"agenda",allDaySlot:!1},"resource-day":{type:"resource-day",slotMinTime:"00:00",slotMaxTime:"24:00",slotDuration:"00:30:00",scrollTime:"08:00:00",allDaySlot:!0},"resource-week":{type:"resource-week",slotMinTime:"00:00",slotMaxTime:"24:00",slotDuration:"00:30:00",scrollTime:"08:00:00",allDaySlot:!0},"timeline-day":{type:"timeline-day",slotDuration:"01:00:00"},"timeline-3day":{type:"timeline-3day",slotDuration:"01:00:00"},"timeline-week":{type:"timeline-week",slotDuration:"01:00:00"}},ae={blue:"#3b82f6",green:"#22c55e",red:"#ef4444",yellow:"#eab308",purple:"#a855f7",orange:"#f97316",pink:"#ec4899",teal:"#14b8a6",gray:"#6b7280",indigo:"#6366f1"},se={blue:{bg:"bg-blue-100",text:"text-blue-800",border:"border-blue-300"},green:{bg:"bg-green-100",text:"text-green-800",border:"border-green-300"},red:{bg:"bg-red-100",text:"text-red-800",border:"border-red-300"},yellow:{bg:"bg-yellow-100",text:"text-yellow-800",border:"border-yellow-300"},purple:{bg:"bg-purple-100",text:"text-purple-800",border:"border-purple-300"},orange:{bg:"bg-orange-100",text:"text-orange-800",border:"border-orange-300"},pink:{bg:"bg-pink-100",text:"text-pink-800",border:"border-pink-300"},teal:{bg:"bg-teal-100",text:"text-teal-800",border:"border-teal-300"},gray:{bg:"bg-gray-100",text:"text-gray-800",border:"border-gray-300"},indigo:{bg:"bg-indigo-100",text:"text-indigo-800",border:"border-indigo-300"}},ue={"#3b82f6":"blue","#22c55e":"green","#ef4444":"red","#eab308":"yellow","#a855f7":"purple","#f97316":"orange","#ec4899":"pink","#14b8a6":"teal","#6b7280":"gray","#6366f1":"indigo"},ie=24,ce=60,B=60*1e3,$=60*B,le=24*$,O=64,ge=32,fe=56,de=200,P=20;function S(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function M(e){const t=new Date(e);return t.setHours(23,59,59,999),t}function m(e,t){const n=new Date(e);return n.setDate(n.getDate()+t),n}function De(e,t){return m(e,-t)}function k(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function R(e){return k(e,new Date)}function me(e){return e.getDay()}function U(e){const t=e.getDay();return t===0||t===6}function E(e,t=1){const n=new Date(e),r=n.getDay(),o=(r<t?7:0)+r-t;return n.setDate(n.getDate()-o),n.setHours(0,0,0,0),n}function w(e,t=1){const n=E(e,t);return n.setDate(n.getDate()+6),n.setHours(23,59,59,999),n}function v(e,t){return m(e,t*7)}function ye(e,t){return m(e,-t*7)}function he(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),n=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-n);const r=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-r.getTime())/864e5+1)/7)}function Se(e,t,n=1){const r=E(e,n),o=E(t,n);return k(r,o)}function H(e){const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),t}function b(e){const t=new Date(e.getFullYear(),e.getMonth()+1,0);return t.setHours(23,59,59,999),t}function C(e,t){const n=new Date(e);return n.setMonth(n.getMonth()+t),n}function Ee(e,t){return C(e,-t)}function Te(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()}function _(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function W(e){return new Date(e.getFullYear(),0,1,0,0,0,0)}function V(e){return new Date(e.getFullYear(),11,31,23,59,59,999)}function x(e,t){const n=new Date(e);return n.setFullYear(n.getFullYear()+t),n}function pe(e,t){return x(e,-t)}function we(e,t){return e.getFullYear()===t.getFullYear()}function G(e,t){const n=new Date(e);return n.setHours(n.getHours()+t),n}function Me(e,t){const n=new Date(e);return n.setMinutes(n.getMinutes()+t),n}function He(e,t,n=0,r=0){const o=new Date(e);return o.setHours(t,n,r,0),o}function be(e){return e.getHours()+e.getMinutes()/60}function ke(e,t){return e.getTime()<t.getTime()}function Ie(e,t){return e.getTime()>t.getTime()}function ve(e,t,n){const r=e.getTime();return r>=t.getTime()&&r<=n.getTime()}function Oe(e){if(e.length!==0)return e.reduce((t,n)=>n<t?n:t)}function Ce(e){if(e.length!==0)return e.reduce((t,n)=>n>t?n:t)}function F(e,t){return e.getTime()-t.getTime()}function _e(e,t){return Math.floor(F(e,t)/6e4)}function xe(e,t){return Math.floor(F(e,t)/36e5)}function Fe(e,t){const n=S(e),r=S(t);return Math.floor(F(n,r)/864e5)}function Re(e,t="24h"){const n=e.getHours(),r=e.getMinutes();if(t==="12h"){const o=n>=12?"PM":"AM";return`${n%12||12}:${r.toString().padStart(2,"0")} ${o}`}return`${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Ue(e){const t=e.getFullYear(),n=(e.getMonth()+1).toString().padStart(2,"0"),r=e.getDate().toString().padStart(2,"0");return`${t}-${n}-${r}`}function We(e){return new Date(e)}function z(e,t){const n=[];let r=S(e);const o=S(t);for(;r<=o;)n.push(new Date(r)),r=m(r,1);return n}function Ae(e,t){const n=[];let r=new Date(e);for(;r<=t;)n.push(new Date(r)),r=G(r,1);return n}function Ye(e="en-US",t="short"){const n=new Intl.DateTimeFormat(e,{weekday:t}),r=[],o=new Date(2024,0,7);for(let a=0;a<7;a++)r.push(n.format(m(o,a)));return r}function Le(e="en-US",t="long"){const n=new Intl.DateTimeFormat(e,{month:t}),r=[];for(let o=0;o<12;o++)r.push(n.format(new Date(2024,o,1)));return r}function Ne(e){const t=[];for(let n=e.startHour;n<=e.endHour;n++)t.push(n);return t}function Be(e,t="24h"){if(t==="12h"){const n=e>=12?"PM":"AM";return`${e%12||12} ${n}`}return`${String(e).padStart(2,"0")}:00`}function $e(e,t=1){const n=E(e,t),r=[];for(let o=0;o<7;o++)r.push(m(n,o));return r}function Pe(e,t=1){const n=H(e),r=b(e),o=E(n,t),a=w(r,t),s=e.getMonth();return z(o,a).map(i=>({date:i,isCurrentMonth:i.getMonth()===s,isWeekend:i.getDay()===0||i.getDay()===6}))}function Ve(e){const t=[],n=[];for(const r of e)k(r.startDate,r.endDate)?t.push(r):n.push(r);return{singleDay:t,multiDay:n}}function Ge(e,t,n){return e.filter(r=>r.startDate<=n&&r.endDate>=t)}function ze(e,t,n){if(!n)return!0;const r=e.getDay(),o=n[r];return!o||!o.enabled||o.from===o.to?!1:t>=o.from&&t<o.to}function je(e,t){const n=e.getDay(),r=t[n];return!r||!r.enabled||r.from===r.to?null:{from:r.from,to:r.to}}function qe(e){const t=[];for(let n=0;n<12;n++)t.push(new Date(e,n,1));return t}function j(e,t,n=1){switch(t){case"day":case"resource-day":case"timeline-day":return{startDate:S(e),endDate:M(e)};case"week":case"resource-week":case"timeline-week":return{startDate:E(e,n),endDate:w(e,n)};case"month":const r=H(e),o=b(e);return{startDate:E(r,n),endDate:w(o,n)};case"year":return{startDate:W(e),endDate:V(e)};case"agenda":return{startDate:S(e),endDate:M(m(e,29))};default:return{startDate:S(e),endDate:M(e)}}}function Xe(e,t){switch(t){case"day":case"resource-day":case"timeline-day":return m(e,1);case"week":case"resource-week":case"timeline-week":return v(e,1);case"month":return C(e,1);case"year":return x(e,1);case"agenda":return v(e,1);default:return m(e,1)}}function Je(e,t){switch(t){case"day":case"resource-day":case"timeline-day":return m(e,-1);case"week":case"resource-week":case"timeline-week":return v(e,-1);case"month":return C(e,-1);case"year":return x(e,-1);case"agenda":return v(e,-1);default:return m(e,-1)}}function Ke(){return S(new Date)}function Qe(e,t=1){const n=H(e),r=b(e),o=E(n,t),a=w(r,t),s=[];let u=o;for(;u<=a;)s.push({date:new Date(u),isToday:R(u),isCurrentMonth:_(u,e),isWeekend:U(u),dayOfWeek:u.getDay()}),u=m(u,1);return s}function Ze(e,t=1){const n=E(e,t),r=[];for(let o=0;o<7;o++){const a=m(n,o);r.push({date:a,isToday:R(a),isCurrentMonth:_(a,e),isWeekend:U(a),dayOfWeek:a.getDay()})}return r}function et(e){const t=W(e),n=[];for(let r=0;r<12;r++){const o=C(t,r);n.push({date:o,isToday:_(o,new Date),isCurrentMonth:!0,isWeekend:!1,dayOfWeek:o.getDay()})}return n}function tt(e,t,n=30){const r=[],o=60/n;for(let a=e;a<t;a++)for(let s=0;s<o;s++){const u=s*n;r.push({hour:a,minute:u,label:`${a.toString().padStart(2,"0")}:${u.toString().padStart(2,"0")}`})}return r}function nt(e,t,n="24h"){const r=[];for(let o=e;o<=t;o++){let a;if(n==="12h"){const s=o>=12?"PM":"AM";a=`${o%12||12} ${s}`}else a=`${o.toString().padStart(2,"0")}:00`;r.push({hour:o,label:a})}return r}function rt(e,t,n="en-US"){const r=new Intl.DateTimeFormat(n,{weekday:"short",month:"short",day:"numeric"}),o=new Intl.DateTimeFormat(n,{month:"short",day:"numeric"});switch(t){case"day":case"resource-day":case"timeline-day":return r.format(e);case"week":case"resource-week":case"timeline-week":{const a=E(e,1),s=w(e,1);return`${o.format(a)} - ${o.format(s)}`}case"month":{const a=H(e),s=b(e);return`${o.format(a)} - ${o.format(s)}`}case"year":return`Jan 1 - Dec 31, ${e.getFullYear()}`;case"agenda":{const a=H(e),s=b(e);return`${o.format(a)} - ${o.format(s)}`}default:return""}}function ot(e,t,n,r=1){const o=j(t,n,r);return e.filter(a=>a.startDate<=o.endDate&&a.endDate>=o.startDate).length}function at(e,t,n="en-US"){const r=new Intl.DateTimeFormat(n,{month:"long",year:"numeric"}),o=new Intl.DateTimeFormat(n,{weekday:"long",month:"long",day:"numeric",year:"numeric"});switch(t){case"day":case"resource-day":case"timeline-day":return o.format(e);case"week":case"resource-week":case"timeline-week":{const a=E(e,1),s=w(e,1),u=new Intl.DateTimeFormat(n,{month:"short"}).format(a),i=new Intl.DateTimeFormat(n,{month:"short"}).format(s),c=a.getFullYear();return u===i?`${u} ${a.getDate()} - ${s.getDate()}, ${c}`:`${u} ${a.getDate()} - ${i} ${s.getDate()}, ${c}`}case"month":return r.format(e);case"year":return e.getFullYear().toString();case"agenda":return`Agenda - ${r.format(e)}`;default:return r.format(e)}}function st(e=1,t="short",n="en-US"){const r=new Intl.DateTimeFormat(n,{weekday:t}),o=[],a=new Date(2024,0,7);for(let s=0;s<7;s++){const u=(e+s)%7,i=m(a,u);o.push({dayOfWeek:u,label:r.format(i)})}return o}function q(e,t,n){const r=S(t),o=M(n);return e.filter(a=>{const s=a.startDate,u=a.endDate;return s<=o&&u>=r})}function X(e,t){return t.length===0?e:e.filter(n=>n.scheduleTypeId!==void 0&&t.includes(n.scheduleTypeId))}function J(e,t){return t.length===0?e:e.filter(n=>n.resourceId!==void 0&&t.includes(n.resourceId))}function K(e,t){if(!t.trim())return e;const n=t.toLowerCase();return e.filter(r=>{const o=r.title.toLowerCase().includes(n),a=r.description?.toLowerCase().includes(n);return o||a})}function Q(e){return e.filter(t=>!t.isCanceled)}function ut(e,t){let n=[...e];return t.dateRange&&(n=q(n,t.dateRange.startDate,t.dateRange.endDate)),t.scheduleTypeIds&&t.scheduleTypeIds.length>0&&(n=X(n,t.scheduleTypeIds)),t.resourceIds&&t.resourceIds.length>0&&(n=J(n,t.resourceIds)),t.search&&(n=K(n,t.search)),t.showCanceled||(n=Q(n)),n}function it(e){return[...e].sort((t,n)=>t.startDate.getTime()-n.startDate.getTime())}function ct(e){return[...e].sort((t,n)=>t.endDate.getTime()-n.endDate.getTime())}function lt(e){return[...e].sort((t,n)=>{const r=t.endDate.getTime()-t.startDate.getTime();return n.endDate.getTime()-n.startDate.getTime()-r})}function gt(e){const t=new Map;for(const n of e){const r=S(n.startDate).toISOString(),o=t.get(r)??[];o.push(n),t.set(r,o)}return t}function ft(e){const t=new Map;for(const n of e){const r=t.get(n.scheduleTypeId)??[];r.push(n),t.set(n.scheduleTypeId,r)}return t}function dt(e){const t=new Map;for(const n of e){const r=t.get(n.resourceId)??[];r.push(n),t.set(n.resourceId,r)}return t}function Dt(e,t){return e.filter(n=>{const r=S(t),o=M(t);return n.startDate<=o&&n.endDate>=r})}function mt(e){return e.filter(t=>t.isAllDay)}function yt(e){return e.filter(t=>!t.isAllDay)}function ht(e){return e.filter(t=>t.isMultiDay?!0:!k(t.startDate,t.endDate))}function St(e){return e.isMultiDay?!0:!k(e.startDate,e.endDate)}function Et(e){return Math.floor((e.endDate.getTime()-e.startDate.getTime())/6e4)}function Tt(e,t="blue"){return e.color??t}function pt(e,t,n="blue"){if(e.color)return e.color;if(e.scheduleTypeId!==void 0&&t){const r=t.get(e.scheduleTypeId);if(r)return r}return n}function Z(e,t,n,r=O){const{startHour:o,endHour:a}=n,s=a-o,u=s*r,i=e.startDate.getHours()+e.startDate.getMinutes()/60,c=e.endDate.getHours()+e.endDate.getMinutes()/60,l=Math.max(i,o),g=Math.min(c,a),d=(l-o)/s*u,y=(g-o)/s*u,p=Math.max(y-d,P);return{top:d,height:p,left:0,width:100,zIndex:1}}function wt(e,t,n,r=O){if(e.length===0)return[];const o=[...e].sort((c,l)=>{const g=c.startDate.getTime()-l.startDate.getTime();if(g!==0)return g;const d=c.endDate.getTime()-c.startDate.getTime();return l.endDate.getTime()-l.startDate.getTime()-d}),a=[],s=[];for(const c of o){const l=c.startDate.getTime(),g=c.endDate.getTime();let d=-1;for(let h=0;h<a.length;h++){const D=a[h];if(!D)continue;const T=D[D.length-1];if(T&&T.endTime<=l){d=h;break}}d===-1&&(d=a.length,a.push([]));const y=a[d];y&&y.push({event:c,endTime:g});const p=Z(c,t,n,r);s.push({event:c,position:p,column:d,columnSpan:1})}const i=100/a.length;for(const c of s)c.position.left=c.column*i,c.position.width=i*c.columnSpan,c.position.zIndex=c.column+1;return s}function Mt(e,t,n,r=O,o=30){const{startHour:a,endHour:s}=n,u=s-a,i=u*r,c=e/i*u,g=(a+c)*60,d=Math.round(g/o)*o,y=new Date(t);return y.setHours(0,0,0,0),y.setMinutes(d),y}function Ht(e,t,n=O){const{startHour:r,endHour:o}=t,a=o-r,s=a*n,u=e.getHours()+e.getMinutes()/60;return(Math.max(r,Math.min(u,o))-r)/a*s}function bt(e,t){return e.startDate<t.endDate&&e.endDate>t.startDate}function kt(e){if(e.length===0)return[];const t=[...e].sort((a,s)=>a.startDate.getTime()-s.startDate.getTime()),n=[];let r=[],o=0;for(const a of t)r.length===0||a.startDate.getTime()<o?(r.push(a),o=Math.max(o,a.endDate.getTime())):(r.length>0&&n.push(r),r=[a],o=a.endDate.getTime());return r.length>0&&n.push(r),n}function It(e,t,n){const r=Math.max(0,Math.min(e,t)),o=Math.min(n,Math.max(e,t));return{top:r,height:o-r}}const A=f.createContext(void 0);function vt({children:e,onEventDrop:t}){const[n,r]=f.useState(null),o=f.useCallback(i=>{const c=typeof i.startDate=="string"?new Date(i.startDate):i.startDate,l=typeof i.endDate=="string"?new Date(i.endDate):i.endDate;r({event:i,originalStartDate:c,originalEndDate:l})},[]),a=f.useCallback((i,c,l)=>{r(g=>g?{...g,previewDate:i,previewHour:c,previewMinute:l}:null)},[]),s=f.useCallback(()=>{if(!n)return null;const{event:i,originalStartDate:c,originalEndDate:l,previewDate:g,previewHour:d,previewMinute:y}=n,p=l.getTime()-c.getTime();let h;g?(h=new Date(g),typeof d=="number"?h.setHours(d,y??0,0,0):h.setHours(c.getHours(),c.getMinutes(),c.getSeconds(),0)):h=c;const D=new Date(h.getTime()+p),T={event:i,newStartDate:h,newEndDate:D};return r(null),t?.(T),T},[n,t]),u=f.useCallback(()=>{r(null)},[]);return N.jsx(A.Provider,{value:{dragState:n,isDragging:n!==null,startDrag:o,updateDragPreview:a,endDrag:s,cancelDrag:u},children:e})}function Ot(){const e=f.useContext(A);if(!e)throw new Error("useDragDrop must be used within a DragDropProvider");return e}function Ct(){return f.useContext(A)??null}const Y=f.createContext(void 0);function I(e){const t=new Date(e.date);return typeof e.hour=="number"&&t.setHours(e.hour,e.minute??0,0,0),t}function _t(e){const t=new Date(e),n=t.getMinutes(),r=Math.floor(n/30)*30;return t.setMinutes(r,0,0),t}function xt(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function L(e,t,n,r,o=30){const a=I(e),s=I(t);let u=a,i=s;if(s<a&&(u=s,i=a),n==="day")if(xt(u,i)){const l=_t(new Date);u=new Date(u),u.setHours(l.getHours(),l.getMinutes(),0,0),i=new Date(u.getTime()+r*60*1e3)}else u.setHours(0,0,0,0),i.setHours(23,59,59,999);else{const c=o*60*1e3;i=new Date(i.getTime()+c);const l=i.getTime()-u.getTime(),g=r*60*1e3;l<g&&(i=new Date(u.getTime()+g))}return{startDate:u,endDate:i}}function Ft(e,t,n,r){const o=I(e),a=I(t),s=I(n),u=a<=s?a:s,i=a<=s?s:a;if(r==="day"){const c=new Date(o);c.setHours(0,0,0,0);const l=new Date(u);l.setHours(0,0,0,0);const g=new Date(i);return g.setHours(0,0,0,0),c>=l&&c<=g}return o>=u&&o<=i}function Rt({children:e,mode:t="time",onSelect:n,minDurationMinutes:r=30,slotDurationMinutes:o=30,enabled:a=!0}){const[s,u]=f.useState(null),i=f.useRef(!1),c=f.useCallback(D=>{a&&(i.current=!0,u({start:D,end:D,isSelecting:!0}))},[a]),l=f.useCallback(D=>{a&&i.current&&u(T=>T?{...T,end:D}:null)},[a]),g=f.useCallback(()=>{i.current&&(i.current=!1,u(D=>{if(!D)return null;const T=L(D.start,D.end,t,r,o);return n?.(T),{...D,isSelecting:!1}}),setTimeout(()=>{u(null)},100))},[t,r,o,n]),d=f.useCallback(()=>{i.current=!1,u(null)},[]),y=f.useCallback(D=>s?Ft(D,s.start,s.end,t):!1,[s,t]),p=f.useCallback(()=>s?L(s.start,s.end,t,r,o):null,[s,t,r,o]),h=f.useMemo(()=>({isSelecting:s?.isSelecting??!1,startSelection:c,updateSelection:l,endSelection:g,cancelSelection:d,isSlotSelected:y,getSelectionResult:p,mode:t}),[s?.isSelecting,c,l,g,d,y,p,t]);return N.jsx(Y.Provider,{value:h,children:e})}function Ut(){const e=f.useContext(Y);if(!e)throw new Error("useSlotSelectionContext must be used within a SlotSelectionProvider");return e}function Wt(){return f.useContext(Y)}exports.CALENDAR_VIEWS=ee;exports.DEFAULT_BUSINESS_HOURS=re;exports.DEFAULT_HEADER_HEIGHT=fe;exports.DEFAULT_HOUR_HEIGHT=O;exports.DEFAULT_PREFERENCES=te;exports.DEFAULT_RESOURCE_WIDTH=de;exports.DEFAULT_SLOT_HEIGHT=ge;exports.DEFAULT_VIEW_CONFIGS=oe;exports.DEFAULT_VISIBLE_HOURS=ne;exports.DragDropProvider=vt;exports.EVENT_COLORS=ae;exports.EVENT_COLOR_CLASSES=se;exports.HEX_TO_EVENT_COLOR=ue;exports.HOURS_IN_DAY=ie;exports.MINUTES_IN_HOUR=ce;exports.MIN_EVENT_HEIGHT=P;exports.MS_PER_DAY=le;exports.MS_PER_HOUR=$;exports.MS_PER_MINUTE=B;exports.SlotSelectionProvider=Rt;exports.addDays=m;exports.addHours=G;exports.addMinutes=Me;exports.addMonths=C;exports.addWeeks=v;exports.addYears=x;exports.applyEventFilters=ut;exports.calculateEventPosition=Z;exports.calculateOverlappingPositions=wt;exports.calculateSelectionOverlay=It;exports.differenceInDays=Fe;exports.differenceInHours=xe;exports.differenceInMilliseconds=F;exports.differenceInMinutes=_e;exports.eachDayOfInterval=z;exports.eachHourOfInterval=Ae;exports.endOfDay=M;exports.endOfMonth=b;exports.endOfWeek=w;exports.endOfYear=V;exports.eventsOverlap=bt;exports.filterEventsByDateRange=q;exports.filterEventsByResource=J;exports.filterEventsByScheduleType=X;exports.filterEventsBySearch=K;exports.filterOutCanceled=Q;exports.formatDateISO=Ue;exports.formatHourLabel=Be;exports.formatTime=Re;exports.generateHourLabels=nt;exports.generateMonthCells=Qe;exports.generateMonthGrid=Pe;exports.generateTimeSlots=tt;exports.generateWeekCells=Ze;exports.generateYearCells=et;exports.getAllDayEvents=mt;exports.getDayOfWeek=me;exports.getDaysInMonth=Te;exports.getDecimalHours=be;exports.getEventColor=Tt;exports.getEventDurationMinutes=Et;exports.getEventsCountInView=ot;exports.getEventsForDay=Dt;exports.getEventsInRange=Ge;exports.getMonthNames=Le;exports.getMultiDayEvents=ht;exports.getOverlappingGroups=kt;exports.getRangeText=rt;exports.getTimedEvents=yt;exports.getViewDateRange=j;exports.getViewTitle=at;exports.getVisibleHoursArray=Ne;exports.getWeekDays=$e;exports.getWeekNumber=he;exports.getWeekdayHeaders=st;exports.getWeekdayNames=Ye;exports.getWorkingHoursForDay=je;exports.getYearMonths=qe;exports.groupEventsByDate=gt;exports.groupEventsByResource=dt;exports.groupEventsByScheduleType=ft;exports.isAfter=Ie;exports.isBefore=ke;exports.isBetween=ve;exports.isMultiDayEvent=St;exports.isSameDay=k;exports.isSameMonth=_;exports.isSameWeek=Se;exports.isSameYear=we;exports.isToday=R;exports.isWeekend=U;exports.isWorkingHour=ze;exports.maxDate=Ce;exports.minDate=Oe;exports.navigateNext=Xe;exports.navigatePrev=Je;exports.navigateToday=Ke;exports.parseISO=We;exports.resolveEventColor=pt;exports.separateEventsByDuration=Ve;exports.setTime=He;exports.sortEventsByDuration=lt;exports.sortEventsByEnd=ct;exports.sortEventsByStart=it;exports.startOfDay=S;exports.startOfMonth=H;exports.startOfWeek=E;exports.startOfYear=W;exports.subDays=De;exports.subMonths=Ee;exports.subWeeks=ye;exports.subYears=pe;exports.timeToY=Ht;exports.useDragDrop=Ot;exports.useOptionalDragDrop=Ct;exports.useOptionalSlotSelection=Wt;exports.useSlotSelectionContext=Ut;exports.yToTime=Mt;
2
- //# sourceMappingURL=slot-selection-context-B_YLI-x7.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slot-selection-context-B_YLI-x7.cjs","sources":["../src/core/constants.ts","../src/core/utils/date-utils.ts","../src/core/utils/grid-utils.ts","../src/core/utils/event-utils.ts","../src/core/utils/position-utils.ts","../src/core/context/drag-drop-context.tsx","../src/core/context/slot-selection-context.tsx"],"sourcesContent":["/**\r\n * Constants for @inno/calendar\r\n *\r\n * Default values, view configurations, and color mappings.\r\n */\r\n\r\nimport type {\r\n\tICalendarPreferences,\r\n\tIViewConfig,\r\n\tIVisibleHours,\r\n\tTCalendarView,\r\n\tTEventColor,\r\n} from './types';\r\n\r\n// ============================================================================\r\n// CALENDAR VIEWS\r\n// ============================================================================\r\n\r\n/**\r\n * All available calendar views\r\n */\r\nexport const CALENDAR_VIEWS: TCalendarView[] = [\r\n\t'day',\r\n\t'week',\r\n\t'month',\r\n\t'year',\r\n\t'agenda',\r\n\t'resource-day',\r\n\t'resource-week',\r\n\t'timeline-day',\r\n\t'timeline-week',\r\n];\r\n\r\n// ============================================================================\r\n// DEFAULT PREFERENCES\r\n// ============================================================================\r\n\r\n/**\r\n * Default calendar preferences\r\n */\r\nexport const DEFAULT_PREFERENCES: ICalendarPreferences = {\r\n\tstartHour: 8,\r\n\tendHour: 18,\r\n\tfirstDayOfWeek: 1, // Monday\r\n\tslotDuration: 30,\r\n\tshowWeekends: true,\r\n\ttimeFormat: '24h',\r\n\tbadgeVariant: 'colored',\r\n\tshowCanceledEvents: false,\r\n};\r\n\r\n/**\r\n * Default visible hours\r\n */\r\nexport const DEFAULT_VISIBLE_HOURS: IVisibleHours = {\r\n\tstartHour: 0,\r\n\tendHour: 24,\r\n};\r\n\r\n/**\r\n * Default business hours range (used as a fallback for visible hours)\r\n */\r\nexport const DEFAULT_BUSINESS_HOURS: IVisibleHours = {\r\n\tstartHour: 8,\r\n\tendHour: 18,\r\n};\r\n\r\n// ============================================================================\r\n// VIEW CONFIGURATIONS\r\n// ============================================================================\r\n\r\n/**\r\n * Default configuration for each view type\r\n */\r\nexport const DEFAULT_VIEW_CONFIGS: Record<TCalendarView, IViewConfig> = {\r\n\tday: {\r\n\t\ttype: 'day',\r\n\t\tslotMinTime: '00:00',\r\n\t\tslotMaxTime: '24:00',\r\n\t\tslotDuration: '00:30:00',\r\n\t\tscrollTime: '08:00:00',\r\n\t\tallDaySlot: true,\r\n\t},\r\n\tweek: {\r\n\t\ttype: 'week',\r\n\t\tslotMinTime: '00:00',\r\n\t\tslotMaxTime: '24:00',\r\n\t\tslotDuration: '00:30:00',\r\n\t\tscrollTime: '08:00:00',\r\n\t\tdayMaxEventRows: 3,\r\n\t\tallDaySlot: true,\r\n\t},\r\n\tmonth: {\r\n\t\ttype: 'month',\r\n\t\tdayMaxEventRows: 4,\r\n\t\teventMaxStack: 3,\r\n\t\tallDaySlot: false,\r\n\t},\r\n\tyear: {\r\n\t\ttype: 'year',\r\n\t\tdayMaxEventRows: 2,\r\n\t\tallDaySlot: false,\r\n\t},\r\n\tagenda: {\r\n\t\ttype: 'agenda',\r\n\t\tallDaySlot: false,\r\n\t},\r\n\t'resource-day': {\r\n\t\ttype: 'resource-day',\r\n\t\tslotMinTime: '00:00',\r\n\t\tslotMaxTime: '24:00',\r\n\t\tslotDuration: '00:30:00',\r\n\t\tscrollTime: '08:00:00',\r\n\t\tallDaySlot: true,\r\n\t},\r\n\t'resource-week': {\r\n\t\ttype: 'resource-week',\r\n\t\tslotMinTime: '00:00',\r\n\t\tslotMaxTime: '24:00',\r\n\t\tslotDuration: '00:30:00',\r\n\t\tscrollTime: '08:00:00',\r\n\t\tallDaySlot: true,\r\n\t},\r\n\t'timeline-day': {\r\n\t\ttype: 'timeline-day',\r\n\t\tslotDuration: '01:00:00',\r\n\t},\r\n\t'timeline-3day': {\r\n\t\ttype: 'timeline-3day',\r\n\t\tslotDuration: '01:00:00',\r\n\t},\r\n\t'timeline-week': {\r\n\t\ttype: 'timeline-week',\r\n\t\tslotDuration: '01:00:00',\r\n\t},\r\n};\r\n\r\n// ============================================================================\r\n// EVENT COLORS\r\n// ============================================================================\r\n\r\n/**\r\n * Event color palette with hex values\r\n */\r\nexport const EVENT_COLORS: Record<TEventColor, string> = {\r\n\tblue: '#3b82f6',\r\n\tgreen: '#22c55e',\r\n\tred: '#ef4444',\r\n\tyellow: '#eab308',\r\n\tpurple: '#a855f7',\r\n\torange: '#f97316',\r\n\tpink: '#ec4899',\r\n\tteal: '#14b8a6',\r\n\tgray: '#6b7280',\r\n\tindigo: '#6366f1',\r\n};\r\n\r\n/**\r\n * TailwindCSS class mappings for event colors\r\n */\r\nexport const EVENT_COLOR_CLASSES: Record<TEventColor, { bg: string; text: string; border: string }> = {\r\n\tblue: { bg: 'bg-blue-100', text: 'text-blue-800', border: 'border-blue-300' },\r\n\tgreen: { bg: 'bg-green-100', text: 'text-green-800', border: 'border-green-300' },\r\n\tred: { bg: 'bg-red-100', text: 'text-red-800', border: 'border-red-300' },\r\n\tyellow: { bg: 'bg-yellow-100', text: 'text-yellow-800', border: 'border-yellow-300' },\r\n\tpurple: { bg: 'bg-purple-100', text: 'text-purple-800', border: 'border-purple-300' },\r\n\torange: { bg: 'bg-orange-100', text: 'text-orange-800', border: 'border-orange-300' },\r\n\tpink: { bg: 'bg-pink-100', text: 'text-pink-800', border: 'border-pink-300' },\r\n\tteal: { bg: 'bg-teal-100', text: 'text-teal-800', border: 'border-teal-300' },\r\n\tgray: { bg: 'bg-gray-100', text: 'text-gray-800', border: 'border-gray-300' },\r\n\tindigo: { bg: 'bg-indigo-100', text: 'text-indigo-800', border: 'border-indigo-300' },\r\n};\r\n\r\n/**\r\n * Map hex colors to event color names\r\n */\r\nexport const HEX_TO_EVENT_COLOR: Record<string, TEventColor> = {\r\n\t'#3b82f6': 'blue',\r\n\t'#22c55e': 'green',\r\n\t'#ef4444': 'red',\r\n\t'#eab308': 'yellow',\r\n\t'#a855f7': 'purple',\r\n\t'#f97316': 'orange',\r\n\t'#ec4899': 'pink',\r\n\t'#14b8a6': 'teal',\r\n\t'#6b7280': 'gray',\r\n\t'#6366f1': 'indigo',\r\n};\r\n\r\n// ============================================================================\r\n// TIME CONSTANTS\r\n// ============================================================================\r\n\r\n/**\r\n * Hours in a day\r\n */\r\nexport const HOURS_IN_DAY = 24;\r\n\r\n/**\r\n * Minutes in an hour\r\n */\r\nexport const MINUTES_IN_HOUR = 60;\r\n\r\n/**\r\n * Milliseconds in a minute\r\n */\r\nexport const MS_PER_MINUTE = 60 * 1000;\r\n\r\n/**\r\n * Milliseconds in an hour\r\n */\r\nexport const MS_PER_HOUR = 60 * MS_PER_MINUTE;\r\n\r\n/**\r\n * Milliseconds in a day\r\n */\r\nexport const MS_PER_DAY = 24 * MS_PER_HOUR;\r\n\r\n// ============================================================================\r\n// GRID CONSTANTS\r\n// ============================================================================\r\n\r\n/**\r\n * Default hour height in pixels for time grid views\r\n */\r\nexport const DEFAULT_HOUR_HEIGHT = 64;\r\n\r\n/**\r\n * Default slot height in pixels\r\n */\r\nexport const DEFAULT_SLOT_HEIGHT = 32;\r\n\r\n/**\r\n * Default header height in pixels\r\n */\r\nexport const DEFAULT_HEADER_HEIGHT = 56;\r\n\r\n/**\r\n * Default resource column width in pixels\r\n */\r\nexport const DEFAULT_RESOURCE_WIDTH = 200;\r\n\r\n/**\r\n * Minimum event height in pixels\r\n */\r\nexport const MIN_EVENT_HEIGHT = 20;\r\n","/**\r\n * Date Utilities for @inno/calendar\r\n *\r\n * Pure functions for date manipulation using native Date API.\r\n * No external dependencies.\r\n */\r\n\r\nimport type { TWorkingHours } from '../types';\r\n\r\n// Re-export TWorkingHours for convenience\r\nexport type { TWorkingHours };\r\n\r\n// ============================================================================\r\n// DAY OPERATIONS\r\n// ============================================================================\r\n\r\n/**\r\n * Get start of day (00:00:00.000)\r\n */\r\nexport function startOfDay(date: Date): Date {\r\n\tconst result = new Date(date);\r\n\tresult.setHours(0, 0, 0, 0);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get end of day (23:59:59.999)\r\n */\r\nexport function endOfDay(date: Date): Date {\r\n\tconst result = new Date(date);\r\n\tresult.setHours(23, 59, 59, 999);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Add days to a date\r\n */\r\nexport function addDays(date: Date, days: number): Date {\r\n\tconst result = new Date(date);\r\n\tresult.setDate(result.getDate() + days);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Subtract days from a date\r\n */\r\nexport function subDays(date: Date, days: number): Date {\r\n\treturn addDays(date, -days);\r\n}\r\n\r\n/**\r\n * Check if two dates are the same day\r\n */\r\nexport function isSameDay(date1: Date, date2: Date): boolean {\r\n\treturn (\r\n\t\tdate1.getFullYear() === date2.getFullYear() &&\r\n\t\tdate1.getMonth() === date2.getMonth() &&\r\n\t\tdate1.getDate() === date2.getDate()\r\n\t);\r\n}\r\n\r\n/**\r\n * Check if date is today\r\n */\r\nexport function isToday(date: Date): boolean {\r\n\treturn isSameDay(date, new Date());\r\n}\r\n\r\n/**\r\n * Get day of week (0-6, where 0 is Sunday)\r\n */\r\nexport function getDayOfWeek(date: Date): number {\r\n\treturn date.getDay();\r\n}\r\n\r\n/**\r\n * Check if date is a weekend\r\n */\r\nexport function isWeekend(date: Date): boolean {\r\n\tconst day = date.getDay();\r\n\treturn day === 0 || day === 6;\r\n}\r\n\r\n// ============================================================================\r\n// WEEK OPERATIONS\r\n// ============================================================================\r\n\r\n/**\r\n * Get start of week\r\n */\r\nexport function startOfWeek(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1): Date {\r\n\tconst result = new Date(date);\r\n\tconst day = result.getDay();\r\n\tconst diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\r\n\tresult.setDate(result.getDate() - diff);\r\n\tresult.setHours(0, 0, 0, 0);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get end of week\r\n */\r\nexport function endOfWeek(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1): Date {\r\n\tconst result = startOfWeek(date, weekStartsOn);\r\n\tresult.setDate(result.getDate() + 6);\r\n\tresult.setHours(23, 59, 59, 999);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Add weeks to a date\r\n */\r\nexport function addWeeks(date: Date, weeks: number): Date {\r\n\treturn addDays(date, weeks * 7);\r\n}\r\n\r\n/**\r\n * Subtract weeks from a date\r\n */\r\nexport function subWeeks(date: Date, weeks: number): Date {\r\n\treturn addDays(date, -weeks * 7);\r\n}\r\n\r\n/**\r\n * Get week number in year (ISO 8601)\r\n */\r\nexport function getWeekNumber(date: Date): number {\r\n\tconst d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));\r\n\tconst dayNum = d.getUTCDay() || 7;\r\n\td.setUTCDate(d.getUTCDate() + 4 - dayNum);\r\n\tconst yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));\r\n\treturn Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);\r\n}\r\n\r\n/**\r\n * Check if two dates are in the same week\r\n */\r\nexport function isSameWeek(\r\n\tdate1: Date,\r\n\tdate2: Date,\r\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\r\n): boolean {\r\n\tconst start1 = startOfWeek(date1, weekStartsOn);\r\n\tconst start2 = startOfWeek(date2, weekStartsOn);\r\n\treturn isSameDay(start1, start2);\r\n}\r\n\r\n// ============================================================================\r\n// MONTH OPERATIONS\r\n// ============================================================================\r\n\r\n/**\r\n * Get start of month\r\n */\r\nexport function startOfMonth(date: Date): Date {\r\n\tconst result = new Date(date);\r\n\tresult.setDate(1);\r\n\tresult.setHours(0, 0, 0, 0);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get end of month\r\n */\r\nexport function endOfMonth(date: Date): Date {\r\n\tconst result = new Date(date.getFullYear(), date.getMonth() + 1, 0);\r\n\tresult.setHours(23, 59, 59, 999);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Add months to a date\r\n */\r\nexport function addMonths(date: Date, months: number): Date {\r\n\tconst result = new Date(date);\r\n\tresult.setMonth(result.getMonth() + months);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Subtract months from a date\r\n */\r\nexport function subMonths(date: Date, months: number): Date {\r\n\treturn addMonths(date, -months);\r\n}\r\n\r\n/**\r\n * Get number of days in a month\r\n */\r\nexport function getDaysInMonth(date: Date): number {\r\n\treturn new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();\r\n}\r\n\r\n/**\r\n * Check if two dates are in the same month\r\n */\r\nexport function isSameMonth(date1: Date, date2: Date): boolean {\r\n\treturn (\r\n\t\tdate1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth()\r\n\t);\r\n}\r\n\r\n// ============================================================================\r\n// YEAR OPERATIONS\r\n// ============================================================================\r\n\r\n/**\r\n * Get start of year\r\n */\r\nexport function startOfYear(date: Date): Date {\r\n\treturn new Date(date.getFullYear(), 0, 1, 0, 0, 0, 0);\r\n}\r\n\r\n/**\r\n * Get end of year\r\n */\r\nexport function endOfYear(date: Date): Date {\r\n\treturn new Date(date.getFullYear(), 11, 31, 23, 59, 59, 999);\r\n}\r\n\r\n/**\r\n * Add years to a date\r\n */\r\nexport function addYears(date: Date, years: number): Date {\r\n\tconst result = new Date(date);\r\n\tresult.setFullYear(result.getFullYear() + years);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Subtract years from a date\r\n */\r\nexport function subYears(date: Date, years: number): Date {\r\n\treturn addYears(date, -years);\r\n}\r\n\r\n/**\r\n * Check if two dates are in the same year\r\n */\r\nexport function isSameYear(date1: Date, date2: Date): boolean {\r\n\treturn date1.getFullYear() === date2.getFullYear();\r\n}\r\n\r\n// ============================================================================\r\n// TIME OPERATIONS\r\n// ============================================================================\r\n\r\n/**\r\n * Add hours to a date\r\n */\r\nexport function addHours(date: Date, hours: number): Date {\r\n\tconst result = new Date(date);\r\n\tresult.setHours(result.getHours() + hours);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Add minutes to a date\r\n */\r\nexport function addMinutes(date: Date, minutes: number): Date {\r\n\tconst result = new Date(date);\r\n\tresult.setMinutes(result.getMinutes() + minutes);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Set time on a date\r\n */\r\nexport function setTime(date: Date, hours: number, minutes = 0, seconds = 0): Date {\r\n\tconst result = new Date(date);\r\n\tresult.setHours(hours, minutes, seconds, 0);\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Get time as decimal hours (e.g., 14:30 = 14.5)\r\n */\r\nexport function getDecimalHours(date: Date): number {\r\n\treturn date.getHours() + date.getMinutes() / 60;\r\n}\r\n\r\n// ============================================================================\r\n// COMPARISON OPERATIONS\r\n// ============================================================================\r\n\r\n/**\r\n * Check if date is before another date\r\n */\r\nexport function isBefore(date: Date, dateToCompare: Date): boolean {\r\n\treturn date.getTime() < dateToCompare.getTime();\r\n}\r\n\r\n/**\r\n * Check if date is after another date\r\n */\r\nexport function isAfter(date: Date, dateToCompare: Date): boolean {\r\n\treturn date.getTime() > dateToCompare.getTime();\r\n}\r\n\r\n/**\r\n * Check if date is between two dates (inclusive)\r\n */\r\nexport function isBetween(date: Date, start: Date, end: Date): boolean {\r\n\tconst time = date.getTime();\r\n\treturn time >= start.getTime() && time <= end.getTime();\r\n}\r\n\r\n/**\r\n * Get minimum date from array\r\n */\r\nexport function minDate(dates: Date[]): Date | undefined {\r\n\tif (dates.length === 0) return undefined;\r\n\treturn dates.reduce((min, date) => (date < min ? date : min));\r\n}\r\n\r\n/**\r\n * Get maximum date from array\r\n */\r\nexport function maxDate(dates: Date[]): Date | undefined {\r\n\tif (dates.length === 0) return undefined;\r\n\treturn dates.reduce((max, date) => (date > max ? date : max));\r\n}\r\n\r\n// ============================================================================\r\n// DIFFERENCE OPERATIONS\r\n// ============================================================================\r\n\r\n/**\r\n * Get difference in milliseconds\r\n */\r\nexport function differenceInMilliseconds(date1: Date, date2: Date): number {\r\n\treturn date1.getTime() - date2.getTime();\r\n}\r\n\r\n/**\r\n * Get difference in minutes\r\n */\r\nexport function differenceInMinutes(date1: Date, date2: Date): number {\r\n\treturn Math.floor(differenceInMilliseconds(date1, date2) / 60000);\r\n}\r\n\r\n/**\r\n * Get difference in hours\r\n */\r\nexport function differenceInHours(date1: Date, date2: Date): number {\r\n\treturn Math.floor(differenceInMilliseconds(date1, date2) / 3600000);\r\n}\r\n\r\n/**\r\n * Get difference in days\r\n */\r\nexport function differenceInDays(date1: Date, date2: Date): number {\r\n\tconst start = startOfDay(date1);\r\n\tconst end = startOfDay(date2);\r\n\treturn Math.floor(differenceInMilliseconds(start, end) / 86400000);\r\n}\r\n\r\n// ============================================================================\r\n// FORMATTING\r\n// ============================================================================\r\n\r\n/**\r\n * Format time as HH:MM\r\n */\r\nexport function formatTime(date: Date, format: '12h' | '24h' = '24h'): string {\r\n\tconst hours = date.getHours();\r\n\tconst minutes = date.getMinutes();\r\n\r\n\tif (format === '12h') {\r\n\t\tconst period = hours >= 12 ? 'PM' : 'AM';\r\n\t\tconst hour12 = hours % 12 || 12;\r\n\t\treturn `${hour12}:${minutes.toString().padStart(2, '0')} ${period}`;\r\n\t}\r\n\r\n\treturn `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`;\r\n}\r\n\r\n/**\r\n * Format date as YYYY-MM-DD\r\n */\r\nexport function formatDateISO(date: Date): string {\r\n\tconst year = date.getFullYear();\r\n\tconst month = (date.getMonth() + 1).toString().padStart(2, '0');\r\n\tconst day = date.getDate().toString().padStart(2, '0');\r\n\treturn `${year}-${month}-${day}`;\r\n}\r\n\r\n/**\r\n * Parse ISO date string to Date\r\n */\r\nexport function parseISO(dateString: string): Date {\r\n\treturn new Date(dateString);\r\n}\r\n\r\n// ============================================================================\r\n// ARRAY GENERATION\r\n// ============================================================================\r\n\r\n/**\r\n * Generate array of dates between start and end (inclusive)\r\n */\r\nexport function eachDayOfInterval(start: Date, end: Date): Date[] {\r\n\tconst dates: Date[] = [];\r\n\tlet current = startOfDay(start);\r\n\tconst endDay = startOfDay(end);\r\n\r\n\twhile (current <= endDay) {\r\n\t\tdates.push(new Date(current));\r\n\t\tcurrent = addDays(current, 1);\r\n\t}\r\n\r\n\treturn dates;\r\n}\r\n\r\n/**\r\n * Generate array of hours between start and end\r\n */\r\nexport function eachHourOfInterval(start: Date, end: Date): Date[] {\r\n\tconst hours: Date[] = [];\r\n\tlet current = new Date(start);\r\n\r\n\twhile (current <= end) {\r\n\t\thours.push(new Date(current));\r\n\t\tcurrent = addHours(current, 1);\r\n\t}\r\n\r\n\treturn hours;\r\n}\r\n\r\n/**\r\n * Get weekday names\r\n */\r\nexport function getWeekdayNames(\r\n\tlocale = 'en-US',\r\n\tformat: 'long' | 'short' | 'narrow' = 'short',\r\n): string[] {\r\n\tconst formatter = new Intl.DateTimeFormat(locale, { weekday: format });\r\n\tconst days: string[] = [];\r\n\r\n\t// Use a known Sunday to start\r\n\tconst baseDate = new Date(2024, 0, 7); // Sunday, Jan 7, 2024\r\n\r\n\tfor (let i = 0; i < 7; i++) {\r\n\t\tdays.push(formatter.format(addDays(baseDate, i)));\r\n\t}\r\n\r\n\treturn days;\r\n}\r\n\r\n/**\r\n * Get month names\r\n */\r\nexport function getMonthNames(\r\n\tlocale = 'en-US',\r\n\tformat: 'long' | 'short' | 'narrow' = 'long',\r\n): string[] {\r\n\tconst formatter = new Intl.DateTimeFormat(locale, { month: format });\r\n\tconst months: string[] = [];\r\n\r\n\tfor (let i = 0; i < 12; i++) {\r\n\t\tmonths.push(formatter.format(new Date(2024, i, 1)));\r\n\t}\r\n\r\n\treturn months;\r\n}\r\n\r\n// ============================================================================\r\n// VIEW HELPERS\r\n// ============================================================================\r\n\r\n/**\r\n * Get array of visible hours based on configuration\r\n */\r\nexport function getVisibleHoursArray(visibleHours: { startHour: number; endHour: number }): number[] {\r\n\tconst hours: number[] = [];\r\n\tfor (let h = visibleHours.startHour; h <= visibleHours.endHour; h++) {\r\n\t\thours.push(h);\r\n\t}\r\n\treturn hours;\r\n}\r\n\r\n/**\r\n * Format hour for display (e.g., 8 -> \"8:00\", 14 -> \"14:00\")\r\n */\r\nexport function formatHourLabel(hour: number, format: '12h' | '24h' = '24h'): string {\r\n\tif (format === '12h') {\r\n\t\tconst period = hour >= 12 ? 'PM' : 'AM';\r\n\t\tconst hour12 = hour % 12 || 12;\r\n\t\treturn `${hour12} ${period}`;\r\n\t}\r\n\t// 24h format with leading zero (e.g., \"09:00\", \"14:00\")\r\n\treturn `${String(hour).padStart(2, '0')}:00`;\r\n}\r\n\r\n/**\r\n * Get an array of 7 days for a week starting from the given date\r\n */\r\nexport function getWeekDays(date: Date, weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1): Date[] {\r\n\tconst weekStart = startOfWeek(date, weekStartsOn);\r\n\tconst days: Date[] = [];\r\n\r\n\tfor (let i = 0; i < 7; i++) {\r\n\t\tdays.push(addDays(weekStart, i));\r\n\t}\r\n\r\n\treturn days;\r\n}\r\n\r\n/**\r\n * Generate month grid cells (typically 6 weeks x 7 days = 42 days)\r\n * Returns enriched cell objects with date, isCurrentMonth, and isWeekend\r\n */\r\nexport function generateMonthGrid(\r\n\tdate: Date,\r\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\r\n): Array<{ date: Date; isCurrentMonth: boolean; isWeekend: boolean }> {\r\n\tconst monthStart = startOfMonth(date);\r\n\tconst monthEnd = endOfMonth(date);\r\n\tconst gridStart = startOfWeek(monthStart, weekStartsOn);\r\n\tconst gridEnd = endOfWeek(monthEnd, weekStartsOn);\r\n\tconst currentMonth = date.getMonth();\r\n\r\n\tconst dates = eachDayOfInterval(gridStart, gridEnd);\r\n\r\n\treturn dates.map((d) => ({\r\n\t\tdate: d,\r\n\t\tisCurrentMonth: d.getMonth() === currentMonth,\r\n\t\tisWeekend: d.getDay() === 0 || d.getDay() === 6,\r\n\t}));\r\n}\r\n\r\n/**\r\n * Separate events into single-day and multi-day events\r\n */\r\nexport function separateEventsByDuration<TEvent extends { id: string; startDate: Date; endDate: Date }>(events: TEvent[]): {\r\n\tsingleDay: TEvent[];\r\n\tmultiDay: TEvent[];\r\n} {\r\n\tconst singleDay: TEvent[] = [];\r\n\tconst multiDay: TEvent[] = [];\r\n\r\n\tfor (const event of events) {\r\n\t\tif (isSameDay(event.startDate, event.endDate)) {\r\n\t\t\tsingleDay.push(event);\r\n\t\t} else {\r\n\t\t\tmultiDay.push(event);\r\n\t\t}\r\n\t}\r\n\r\n\treturn { singleDay, multiDay };\r\n}\r\n\r\n/**\r\n * Get events within a date range\r\n */\r\nexport function getEventsInRange<TEvent extends { startDate: Date; endDate: Date }>(\r\n\tevents: TEvent[],\r\n\trangeStart: Date,\r\n\trangeEnd: Date,\r\n): TEvent[] {\r\n\treturn events.filter((event) => {\r\n\t\treturn event.startDate <= rangeEnd && event.endDate >= rangeStart;\r\n\t});\r\n}\r\n\r\n// ============================================================================\r\n// WORKING HOURS UTILITIES\r\n// ============================================================================\r\n\r\n/**\r\n * Check if a given hour is within working hours for a specific day\r\n */\r\nexport function isWorkingHour(\r\n\tdate: Date,\r\n\thour: number,\r\n\tworkingHours?: TWorkingHours,\r\n): boolean {\r\n\tif (!workingHours) return true; // If no working hours defined, all hours are valid\r\n\r\n\tconst dayOfWeek = date.getDay();\r\n\tconst dayHours = workingHours[dayOfWeek];\r\n\r\n\t// Check if day exists, is enabled, and has valid hours\r\n\tif (!dayHours || !dayHours.enabled || dayHours.from === dayHours.to) {\r\n\t\treturn false;\r\n\t}\r\n\r\n\treturn hour >= dayHours.from && hour < dayHours.to;\r\n}\r\n\r\n/**\r\n * Get working hours for a specific day\r\n * Returns null if the day is disabled or has no working hours\r\n */\r\nexport function getWorkingHoursForDay(\r\n\tdate: Date,\r\n\tworkingHours: TWorkingHours,\r\n): { from: number; to: number } | null {\r\n\tconst dayOfWeek = date.getDay();\r\n\tconst dayHours = workingHours[dayOfWeek];\r\n\r\n\t// Check if day exists, is enabled, and has valid hours\r\n\tif (!dayHours || !dayHours.enabled || dayHours.from === dayHours.to) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\treturn { from: dayHours.from, to: dayHours.to };\r\n}\r\n\r\n/**\r\n * Get all months for a year (for year view)\r\n */\r\nexport function getYearMonths(year: number): Date[] {\r\n\tconst months: Date[] = [];\r\n\tfor (let month = 0; month < 12; month++) {\r\n\t\tmonths.push(new Date(year, month, 1));\r\n\t}\r\n\treturn months;\r\n}\r\n","/**\r\n * Grid Utilities for @inno/calendar\r\n *\r\n * Functions for view navigation, date ranges, and cell generation.\r\n */\r\n\r\nimport type { TCalendarView, ICalendarCell, IDateRange } from '../types';\r\nimport {\r\n\tstartOfDay,\r\n\tendOfDay,\r\n\tstartOfWeek,\r\n\tendOfWeek,\r\n\tstartOfMonth,\r\n\tendOfMonth,\r\n\tstartOfYear,\r\n\tendOfYear,\r\n\taddDays,\r\n\taddWeeks,\r\n\taddMonths,\r\n\taddYears,\r\n\tisToday,\r\n\tisWeekend,\r\n\tisSameMonth,\r\n} from './date-utils';\r\n\r\n// ============================================================================\r\n// VIEW DATE RANGES\r\n// ============================================================================\r\n\r\n/**\r\n * Get date range for a specific view\r\n */\r\nexport function getViewDateRange(\r\n\tdate: Date,\r\n\tview: TCalendarView,\r\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\r\n): IDateRange {\r\n\tswitch (view) {\r\n\t\tcase 'day':\r\n\t\tcase 'resource-day':\r\n\t\tcase 'timeline-day':\r\n\t\t\treturn {\r\n\t\t\t\tstartDate: startOfDay(date),\r\n\t\t\t\tendDate: endOfDay(date),\r\n\t\t\t};\r\n\r\n\t\tcase 'week':\r\n\t\tcase 'resource-week':\r\n\t\tcase 'timeline-week':\r\n\t\t\treturn {\r\n\t\t\t\tstartDate: startOfWeek(date, weekStartsOn),\r\n\t\t\t\tendDate: endOfWeek(date, weekStartsOn),\r\n\t\t\t};\r\n\r\n\t\tcase 'month':\r\n\t\t\t// Include partial weeks at start and end\r\n\t\t\tconst monthStart = startOfMonth(date);\r\n\t\t\tconst monthEnd = endOfMonth(date);\r\n\t\t\treturn {\r\n\t\t\t\tstartDate: startOfWeek(monthStart, weekStartsOn),\r\n\t\t\t\tendDate: endOfWeek(monthEnd, weekStartsOn),\r\n\t\t\t};\r\n\r\n\t\tcase 'year':\r\n\t\t\treturn {\r\n\t\t\t\tstartDate: startOfYear(date),\r\n\t\t\t\tendDate: endOfYear(date),\r\n\t\t\t};\r\n\r\n\t\tcase 'agenda':\r\n\t\t\t// Agenda typically shows next 30 days\r\n\t\t\treturn {\r\n\t\t\t\tstartDate: startOfDay(date),\r\n\t\t\t\tendDate: endOfDay(addDays(date, 29)),\r\n\t\t\t};\r\n\r\n\t\tdefault:\r\n\t\t\treturn {\r\n\t\t\t\tstartDate: startOfDay(date),\r\n\t\t\t\tendDate: endOfDay(date),\r\n\t\t\t};\r\n\t}\r\n}\r\n\r\n// ============================================================================\r\n// NAVIGATION\r\n// ============================================================================\r\n\r\n/**\r\n * Navigate to next period based on view\r\n */\r\nexport function navigateNext(date: Date, view: TCalendarView): Date {\r\n\tswitch (view) {\r\n\t\tcase 'day':\r\n\t\tcase 'resource-day':\r\n\t\tcase 'timeline-day':\r\n\t\t\treturn addDays(date, 1);\r\n\r\n\t\tcase 'week':\r\n\t\tcase 'resource-week':\r\n\t\tcase 'timeline-week':\r\n\t\t\treturn addWeeks(date, 1);\r\n\r\n\t\tcase 'month':\r\n\t\t\treturn addMonths(date, 1);\r\n\r\n\t\tcase 'year':\r\n\t\t\treturn addYears(date, 1);\r\n\r\n\t\tcase 'agenda':\r\n\t\t\treturn addWeeks(date, 1);\r\n\r\n\t\tdefault:\r\n\t\t\treturn addDays(date, 1);\r\n\t}\r\n}\r\n\r\n/**\r\n * Navigate to previous period based on view\r\n */\r\nexport function navigatePrev(date: Date, view: TCalendarView): Date {\r\n\tswitch (view) {\r\n\t\tcase 'day':\r\n\t\tcase 'resource-day':\r\n\t\tcase 'timeline-day':\r\n\t\t\treturn addDays(date, -1);\r\n\r\n\t\tcase 'week':\r\n\t\tcase 'resource-week':\r\n\t\tcase 'timeline-week':\r\n\t\t\treturn addWeeks(date, -1);\r\n\r\n\t\tcase 'month':\r\n\t\t\treturn addMonths(date, -1);\r\n\r\n\t\tcase 'year':\r\n\t\t\treturn addYears(date, -1);\r\n\r\n\t\tcase 'agenda':\r\n\t\t\treturn addWeeks(date, -1);\r\n\r\n\t\tdefault:\r\n\t\t\treturn addDays(date, -1);\r\n\t}\r\n}\r\n\r\n/**\r\n * Navigate to today\r\n */\r\nexport function navigateToday(): Date {\r\n\treturn startOfDay(new Date());\r\n}\r\n\r\n// ============================================================================\r\n// CELL GENERATION\r\n// ============================================================================\r\n\r\n/**\r\n * Generate cells for month view\r\n */\r\nexport function generateMonthCells(\r\n\tdate: Date,\r\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\r\n): ICalendarCell[] {\r\n\tconst monthStart = startOfMonth(date);\r\n\tconst monthEnd = endOfMonth(date);\r\n\tconst viewStart = startOfWeek(monthStart, weekStartsOn);\r\n\tconst viewEnd = endOfWeek(monthEnd, weekStartsOn);\r\n\r\n\tconst cells: ICalendarCell[] = [];\r\n\tlet current = viewStart;\r\n\r\n\twhile (current <= viewEnd) {\r\n\t\tcells.push({\r\n\t\t\tdate: new Date(current),\r\n\t\t\tisToday: isToday(current),\r\n\t\t\tisCurrentMonth: isSameMonth(current, date),\r\n\t\t\tisWeekend: isWeekend(current),\r\n\t\t\tdayOfWeek: current.getDay(),\r\n\t\t});\r\n\t\tcurrent = addDays(current, 1);\r\n\t}\r\n\r\n\treturn cells;\r\n}\r\n\r\n/**\r\n * Generate cells for week view\r\n */\r\nexport function generateWeekCells(\r\n\tdate: Date,\r\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\r\n): ICalendarCell[] {\r\n\tconst weekStart = startOfWeek(date, weekStartsOn);\r\n\tconst cells: ICalendarCell[] = [];\r\n\r\n\tfor (let i = 0; i < 7; i++) {\r\n\t\tconst current = addDays(weekStart, i);\r\n\t\tcells.push({\r\n\t\t\tdate: current,\r\n\t\t\tisToday: isToday(current),\r\n\t\t\tisCurrentMonth: isSameMonth(current, date),\r\n\t\t\tisWeekend: isWeekend(current),\r\n\t\t\tdayOfWeek: current.getDay(),\r\n\t\t});\r\n\t}\r\n\r\n\treturn cells;\r\n}\r\n\r\n/**\r\n * Generate cells for year view (months)\r\n */\r\nexport function generateYearCells(date: Date): ICalendarCell[] {\r\n\tconst yearStart = startOfYear(date);\r\n\tconst cells: ICalendarCell[] = [];\r\n\r\n\tfor (let i = 0; i < 12; i++) {\r\n\t\tconst current = addMonths(yearStart, i);\r\n\t\tcells.push({\r\n\t\t\tdate: current,\r\n\t\t\tisToday: isSameMonth(current, new Date()),\r\n\t\t\tisCurrentMonth: true,\r\n\t\t\tisWeekend: false,\r\n\t\t\tdayOfWeek: current.getDay(),\r\n\t\t});\r\n\t}\r\n\r\n\treturn cells;\r\n}\r\n\r\n// ============================================================================\r\n// TIME SLOTS\r\n// ============================================================================\r\n\r\n/**\r\n * Generate time slots for a day\r\n */\r\nexport function generateTimeSlots(\r\n\tstartHour: number,\r\n\tendHour: number,\r\n\tslotDuration: number = 30,\r\n): { hour: number; minute: number; label: string }[] {\r\n\tconst slots: { hour: number; minute: number; label: string }[] = [];\r\n\tconst slotsPerHour = 60 / slotDuration;\r\n\r\n\tfor (let hour = startHour; hour < endHour; hour++) {\r\n\t\tfor (let slot = 0; slot < slotsPerHour; slot++) {\r\n\t\t\tconst minute = slot * slotDuration;\r\n\t\t\tslots.push({\r\n\t\t\t\thour,\r\n\t\t\t\tminute,\r\n\t\t\t\tlabel: `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`,\r\n\t\t\t});\r\n\t\t}\r\n\t}\r\n\r\n\treturn slots;\r\n}\r\n\r\n/**\r\n * Generate hour labels\r\n */\r\nexport function generateHourLabels(\r\n\tstartHour: number,\r\n\tendHour: number,\r\n\tformat: '12h' | '24h' = '24h',\r\n): { hour: number; label: string }[] {\r\n\tconst labels: { hour: number; label: string }[] = [];\r\n\r\n\tfor (let hour = startHour; hour <= endHour; hour++) {\r\n\t\tlet label: string;\r\n\t\tif (format === '12h') {\r\n\t\t\tconst period = hour >= 12 ? 'PM' : 'AM';\r\n\t\t\tconst hour12 = hour % 12 || 12;\r\n\t\t\tlabel = `${hour12} ${period}`;\r\n\t\t} else {\r\n\t\t\tlabel = `${hour.toString().padStart(2, '0')}:00`;\r\n\t\t}\r\n\t\tlabels.push({ hour, label });\r\n\t}\r\n\r\n\treturn labels;\r\n}\r\n\r\n// ============================================================================\r\n// VIEW TITLE\r\n// ============================================================================\r\n\r\n/**\r\n * Get range text for date navigator (e.g., \"Mon, Jan 1 - Sun, Jan 7\")\r\n * Shows a more compact range description below the month/year title\r\n */\r\nexport function getRangeText(date: Date, view: TCalendarView, locale = 'en-US'): string {\r\n\tconst dayMonthFormat = new Intl.DateTimeFormat(locale, { weekday: 'short', month: 'short', day: 'numeric' });\r\n\tconst shortFormat = new Intl.DateTimeFormat(locale, { month: 'short', day: 'numeric' });\r\n\r\n\tswitch (view) {\r\n\t\tcase 'day':\r\n\t\tcase 'resource-day':\r\n\t\tcase 'timeline-day':\r\n\t\t\treturn dayMonthFormat.format(date);\r\n\r\n\t\tcase 'week':\r\n\t\tcase 'resource-week':\r\n\t\tcase 'timeline-week': {\r\n\t\t\tconst weekStart = startOfWeek(date, 1);\r\n\t\t\tconst weekEnd = endOfWeek(date, 1);\r\n\t\t\treturn `${shortFormat.format(weekStart)} - ${shortFormat.format(weekEnd)}`;\r\n\t\t}\r\n\r\n\t\tcase 'month': {\r\n\t\t\tconst monthStart = startOfMonth(date);\r\n\t\t\tconst monthEnd = endOfMonth(date);\r\n\t\t\treturn `${shortFormat.format(monthStart)} - ${shortFormat.format(monthEnd)}`;\r\n\t\t}\r\n\r\n\t\tcase 'year':\r\n\t\t\treturn `Jan 1 - Dec 31, ${date.getFullYear()}`;\r\n\r\n\t\tcase 'agenda': {\r\n\t\t\tconst monthStart = startOfMonth(date);\r\n\t\t\tconst monthEnd = endOfMonth(date);\r\n\t\t\treturn `${shortFormat.format(monthStart)} - ${shortFormat.format(monthEnd)}`;\r\n\t\t}\r\n\r\n\t\tdefault:\r\n\t\t\treturn '';\r\n\t}\r\n}\r\n\r\n/**\r\n * Count events in the current view's date range\r\n * Useful for showing an event count badge in the navigation\r\n */\r\nexport function getEventsCountInView(\r\n\tevents: { startDate: Date; endDate: Date }[],\r\n\tdate: Date,\r\n\tview: TCalendarView,\r\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\r\n): number {\r\n\tconst range = getViewDateRange(date, view, weekStartsOn);\r\n\r\n\treturn events.filter((event) => {\r\n\t\t// Event overlaps with period if it starts before period ends AND ends after period starts\r\n\t\treturn event.startDate <= range.endDate && event.endDate >= range.startDate;\r\n\t}).length;\r\n}\r\n\r\n/**\r\n * Get formatted title for current view\r\n */\r\nexport function getViewTitle(date: Date, view: TCalendarView, locale = 'en-US'): string {\r\n\tconst monthFormat = new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric' });\r\n\tconst dateFormat = new Intl.DateTimeFormat(locale, {\r\n\t\tweekday: 'long',\r\n\t\tmonth: 'long',\r\n\t\tday: 'numeric',\r\n\t\tyear: 'numeric',\r\n\t});\r\n\r\n\tswitch (view) {\r\n\t\tcase 'day':\r\n\t\tcase 'resource-day':\r\n\t\tcase 'timeline-day':\r\n\t\t\treturn dateFormat.format(date);\r\n\r\n\t\tcase 'week':\r\n\t\tcase 'resource-week':\r\n\t\tcase 'timeline-week': {\r\n\t\t\tconst weekStart = startOfWeek(date, 1);\r\n\t\t\tconst weekEnd = endOfWeek(date, 1);\r\n\t\t\tconst startMonth = new Intl.DateTimeFormat(locale, { month: 'short' }).format(weekStart);\r\n\t\t\tconst endMonth = new Intl.DateTimeFormat(locale, { month: 'short' }).format(weekEnd);\r\n\t\t\tconst year = weekStart.getFullYear();\r\n\r\n\t\t\tif (startMonth === endMonth) {\r\n\t\t\t\treturn `${startMonth} ${weekStart.getDate()} - ${weekEnd.getDate()}, ${year}`;\r\n\t\t\t}\r\n\t\t\treturn `${startMonth} ${weekStart.getDate()} - ${endMonth} ${weekEnd.getDate()}, ${year}`;\r\n\t\t}\r\n\r\n\t\tcase 'month':\r\n\t\t\treturn monthFormat.format(date);\r\n\r\n\t\tcase 'year':\r\n\t\t\treturn date.getFullYear().toString();\r\n\r\n\t\tcase 'agenda':\r\n\t\t\treturn `Agenda - ${monthFormat.format(date)}`;\r\n\r\n\t\tdefault:\r\n\t\t\treturn monthFormat.format(date);\r\n\t}\r\n}\r\n\r\n// ============================================================================\r\n// WEEK DAYS\r\n// ============================================================================\r\n\r\n/**\r\n * Get weekday headers for week/month views\r\n */\r\nexport function getWeekdayHeaders(\r\n\tweekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6 = 1,\r\n\tformat: 'long' | 'short' | 'narrow' = 'short',\r\n\tlocale = 'en-US',\r\n): { dayOfWeek: number; label: string }[] {\r\n\tconst formatter = new Intl.DateTimeFormat(locale, { weekday: format });\r\n\tconst headers: { dayOfWeek: number; label: string }[] = [];\r\n\r\n\t// Start from a known date (Jan 7, 2024 is a Sunday)\r\n\tconst baseDate = new Date(2024, 0, 7);\r\n\r\n\tfor (let i = 0; i < 7; i++) {\r\n\t\tconst dayIndex = (weekStartsOn + i) % 7;\r\n\t\tconst date = addDays(baseDate, dayIndex);\r\n\t\theaders.push({\r\n\t\t\tdayOfWeek: dayIndex,\r\n\t\t\tlabel: formatter.format(date),\r\n\t\t});\r\n\t}\r\n\r\n\treturn headers;\r\n}\r\n","/**\r\n * Event Utilities for @inno/calendar\r\n *\r\n * Functions for filtering, sorting, and grouping events.\r\n * All functions are generic to work with any event data type.\r\n */\r\n\r\nimport type { CalendarEvent, TEventColor } from '../types';\r\nimport { isSameDay, startOfDay, endOfDay } from './date-utils';\r\n\r\n// ============================================================================\r\n// FILTERING\r\n// ============================================================================\r\n\r\n/**\r\n * Filter events by date range\r\n */\r\nexport function filterEventsByDateRange<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n\tstartDate: Date,\r\n\tendDate: Date,\r\n): CalendarEvent<TData>[] {\r\n\tconst rangeStart = startOfDay(startDate);\r\n\tconst rangeEnd = endOfDay(endDate);\r\n\r\n\treturn events.filter((event) => {\r\n\t\tconst eventStart = event.startDate;\r\n\t\tconst eventEnd = event.endDate;\r\n\r\n\t\t// Event overlaps with range if:\r\n\t\t// - Event starts before range ends AND\r\n\t\t// - Event ends after range starts\r\n\t\treturn eventStart <= rangeEnd && eventEnd >= rangeStart;\r\n\t});\r\n}\r\n\r\n/**\r\n * Filter events by schedule type IDs\r\n */\r\nexport function filterEventsByScheduleType<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n\tscheduleTypeIds: number[],\r\n): CalendarEvent<TData>[] {\r\n\tif (scheduleTypeIds.length === 0) return events;\r\n\treturn events.filter(\r\n\t\t(event) => event.scheduleTypeId !== undefined && scheduleTypeIds.includes(event.scheduleTypeId),\r\n\t);\r\n}\r\n\r\n/**\r\n * Filter events by resource IDs\r\n */\r\nexport function filterEventsByResource<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n\tresourceIds: string[],\r\n): CalendarEvent<TData>[] {\r\n\tif (resourceIds.length === 0) return events;\r\n\treturn events.filter(\r\n\t\t(event) => event.resourceId !== undefined && resourceIds.includes(event.resourceId),\r\n\t);\r\n}\r\n\r\n/**\r\n * Filter events by search term\r\n */\r\nexport function filterEventsBySearch<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n\tsearch: string,\r\n): CalendarEvent<TData>[] {\r\n\tif (!search.trim()) return events;\r\n\r\n\tconst searchLower = search.toLowerCase();\r\n\treturn events.filter((event) => {\r\n\t\tconst titleMatch = event.title.toLowerCase().includes(searchLower);\r\n\t\tconst descriptionMatch = event.description?.toLowerCase().includes(searchLower);\r\n\t\treturn titleMatch || descriptionMatch;\r\n\t});\r\n}\r\n\r\n/**\r\n * Filter out canceled events\r\n */\r\nexport function filterOutCanceled<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): CalendarEvent<TData>[] {\r\n\treturn events.filter((event) => !event.isCanceled);\r\n}\r\n\r\n/**\r\n * Apply all filters at once\r\n */\r\nexport function applyEventFilters<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n\toptions: {\r\n\t\tdateRange?: { startDate: Date; endDate: Date };\r\n\t\tscheduleTypeIds?: number[];\r\n\t\tresourceIds?: string[];\r\n\t\tsearch?: string;\r\n\t\tshowCanceled?: boolean;\r\n\t},\r\n): CalendarEvent<TData>[] {\r\n\tlet filtered = [...events];\r\n\r\n\tif (options.dateRange) {\r\n\t\tfiltered = filterEventsByDateRange(filtered, options.dateRange.startDate, options.dateRange.endDate);\r\n\t}\r\n\r\n\tif (options.scheduleTypeIds && options.scheduleTypeIds.length > 0) {\r\n\t\tfiltered = filterEventsByScheduleType(filtered, options.scheduleTypeIds);\r\n\t}\r\n\r\n\tif (options.resourceIds && options.resourceIds.length > 0) {\r\n\t\tfiltered = filterEventsByResource(filtered, options.resourceIds);\r\n\t}\r\n\r\n\tif (options.search) {\r\n\t\tfiltered = filterEventsBySearch(filtered, options.search);\r\n\t}\r\n\r\n\tif (!options.showCanceled) {\r\n\t\tfiltered = filterOutCanceled(filtered);\r\n\t}\r\n\r\n\treturn filtered;\r\n}\r\n\r\n// ============================================================================\r\n// SORTING\r\n// ============================================================================\r\n\r\n/**\r\n * Sort events by start date (ascending)\r\n */\r\nexport function sortEventsByStart<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): CalendarEvent<TData>[] {\r\n\treturn [...events].sort((a, b) => a.startDate.getTime() - b.startDate.getTime());\r\n}\r\n\r\n/**\r\n * Sort events by end date (ascending)\r\n */\r\nexport function sortEventsByEnd<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): CalendarEvent<TData>[] {\r\n\treturn [...events].sort((a, b) => a.endDate.getTime() - b.endDate.getTime());\r\n}\r\n\r\n/**\r\n * Sort events by duration (longest first)\r\n */\r\nexport function sortEventsByDuration<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): CalendarEvent<TData>[] {\r\n\treturn [...events].sort((a, b) => {\r\n\t\tconst durationA = a.endDate.getTime() - a.startDate.getTime();\r\n\t\tconst durationB = b.endDate.getTime() - b.startDate.getTime();\r\n\t\treturn durationB - durationA;\r\n\t});\r\n}\r\n\r\n// ============================================================================\r\n// GROUPING\r\n// ============================================================================\r\n\r\n/**\r\n * Group events by date\r\n */\r\nexport function groupEventsByDate<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): Map<string, CalendarEvent<TData>[]> {\r\n\tconst groups = new Map<string, CalendarEvent<TData>[]>();\r\n\r\n\tfor (const event of events) {\r\n\t\tconst dateKey = startOfDay(event.startDate).toISOString();\r\n\t\tconst existing = groups.get(dateKey) ?? [];\r\n\t\texisting.push(event);\r\n\t\tgroups.set(dateKey, existing);\r\n\t}\r\n\r\n\treturn groups;\r\n}\r\n\r\n/**\r\n * Group events by schedule type\r\n */\r\nexport function groupEventsByScheduleType<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): Map<number | undefined, CalendarEvent<TData>[]> {\r\n\tconst groups = new Map<number | undefined, CalendarEvent<TData>[]>();\r\n\r\n\tfor (const event of events) {\r\n\t\tconst existing = groups.get(event.scheduleTypeId) ?? [];\r\n\t\texisting.push(event);\r\n\t\tgroups.set(event.scheduleTypeId, existing);\r\n\t}\r\n\r\n\treturn groups;\r\n}\r\n\r\n/**\r\n * Group events by resource\r\n */\r\nexport function groupEventsByResource<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): Map<string | undefined, CalendarEvent<TData>[]> {\r\n\tconst groups = new Map<string | undefined, CalendarEvent<TData>[]>();\r\n\r\n\tfor (const event of events) {\r\n\t\tconst existing = groups.get(event.resourceId) ?? [];\r\n\t\texisting.push(event);\r\n\t\tgroups.set(event.resourceId, existing);\r\n\t}\r\n\r\n\treturn groups;\r\n}\r\n\r\n// ============================================================================\r\n// QUERIES\r\n// ============================================================================\r\n\r\n/**\r\n * Get events for a specific day\r\n */\r\nexport function getEventsForDay<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n\tdate: Date,\r\n): CalendarEvent<TData>[] {\r\n\treturn events.filter((event) => {\r\n\t\t// Check if event spans this day\r\n\t\tconst dayStart = startOfDay(date);\r\n\t\tconst dayEnd = endOfDay(date);\r\n\t\treturn event.startDate <= dayEnd && event.endDate >= dayStart;\r\n\t});\r\n}\r\n\r\n/**\r\n * Get all-day events\r\n */\r\nexport function getAllDayEvents<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): CalendarEvent<TData>[] {\r\n\treturn events.filter((event) => event.isAllDay);\r\n}\r\n\r\n/**\r\n * Get timed events (not all-day)\r\n */\r\nexport function getTimedEvents<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): CalendarEvent<TData>[] {\r\n\treturn events.filter((event) => !event.isAllDay);\r\n}\r\n\r\n/**\r\n * Get multi-day events\r\n */\r\nexport function getMultiDayEvents<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): CalendarEvent<TData>[] {\r\n\treturn events.filter((event) => {\r\n\t\tif (event.isMultiDay) return true;\r\n\t\treturn !isSameDay(event.startDate, event.endDate);\r\n\t});\r\n}\r\n\r\n/**\r\n * Check if event spans multiple days\r\n */\r\nexport function isMultiDayEvent<TData = Record<string, unknown>>(\r\n\tevent: CalendarEvent<TData>,\r\n): boolean {\r\n\tif (event.isMultiDay) return true;\r\n\treturn !isSameDay(event.startDate, event.endDate);\r\n}\r\n\r\n/**\r\n * Get event duration in minutes\r\n */\r\nexport function getEventDurationMinutes<TData = Record<string, unknown>>(\r\n\tevent: CalendarEvent<TData>,\r\n): number {\r\n\treturn Math.floor((event.endDate.getTime() - event.startDate.getTime()) / 60000);\r\n}\r\n\r\n// ============================================================================\r\n// COLOR UTILITIES\r\n// ============================================================================\r\n\r\n/**\r\n * Get event color with fallback\r\n */\r\nexport function getEventColor<TData = Record<string, unknown>>(\r\n\tevent: CalendarEvent<TData>,\r\n\tdefaultColor: TEventColor = 'blue',\r\n): TEventColor {\r\n\treturn event.color ?? defaultColor;\r\n}\r\n\r\n/**\r\n * Resolve color from schedule type or event\r\n */\r\nexport function resolveEventColor<TData = Record<string, unknown>>(\r\n\tevent: CalendarEvent<TData>,\r\n\tscheduleTypeColors?: Map<number, TEventColor | string>,\r\n\tdefaultColor: TEventColor = 'blue',\r\n): TEventColor | string {\r\n\t// Event color takes precedence\r\n\tif (event.color) return event.color;\r\n\r\n\t// Then schedule type color\r\n\tif (event.scheduleTypeId !== undefined && scheduleTypeColors) {\r\n\t\tconst typeColor = scheduleTypeColors.get(event.scheduleTypeId);\r\n\t\tif (typeColor) return typeColor;\r\n\t}\r\n\r\n\treturn defaultColor;\r\n}\r\n","/**\r\n * Position Utilities for @inno/calendar\r\n *\r\n * Functions for calculating event positions in time grid views.\r\n */\r\n\r\nimport type { CalendarEvent, IEventPosition, IPositionedEvent, IVisibleHours } from '../types';\r\nimport { DEFAULT_HOUR_HEIGHT, MIN_EVENT_HEIGHT } from '../constants';\r\n\r\n// ============================================================================\r\n// POSITION CALCULATION\r\n// ============================================================================\r\n\r\n/**\r\n * Calculate event position in time grid\r\n */\r\nexport function calculateEventPosition<TData = Record<string, unknown>>(\r\n\tevent: CalendarEvent<TData>,\r\n\t_dayStart: Date,\r\n\tvisibleHours: IVisibleHours,\r\n\thourHeight: number = DEFAULT_HOUR_HEIGHT,\r\n): IEventPosition {\r\n\tconst { startHour, endHour } = visibleHours;\r\n\tconst totalVisibleHours = endHour - startHour;\r\n\tconst totalHeight = totalVisibleHours * hourHeight;\r\n\r\n\t// Get event times as decimal hours\r\n\tconst eventStartHour = event.startDate.getHours() + event.startDate.getMinutes() / 60;\r\n\tconst eventEndHour = event.endDate.getHours() + event.endDate.getMinutes() / 60;\r\n\r\n\t// Clamp to visible range\r\n\tconst clampedStart = Math.max(eventStartHour, startHour);\r\n\tconst clampedEnd = Math.min(eventEndHour, endHour);\r\n\r\n\t// Calculate position relative to visible area\r\n\tconst top = ((clampedStart - startHour) / totalVisibleHours) * totalHeight;\r\n\tconst bottom = ((clampedEnd - startHour) / totalVisibleHours) * totalHeight;\r\n\tconst height = Math.max(bottom - top, MIN_EVENT_HEIGHT);\r\n\r\n\treturn {\r\n\t\ttop,\r\n\t\theight,\r\n\t\tleft: 0,\r\n\t\twidth: 100,\r\n\t\tzIndex: 1,\r\n\t};\r\n}\r\n\r\n/**\r\n * Calculate positions for overlapping events\r\n */\r\nexport function calculateOverlappingPositions<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n\tdayStart: Date,\r\n\tvisibleHours: IVisibleHours,\r\n\thourHeight: number = DEFAULT_HOUR_HEIGHT,\r\n): IPositionedEvent<TData>[] {\r\n\tif (events.length === 0) return [];\r\n\r\n\t// Sort by start time, then by duration (longer events first)\r\n\tconst sortedEvents = [...events].sort((a, b) => {\r\n\t\tconst startDiff = a.startDate.getTime() - b.startDate.getTime();\r\n\t\tif (startDiff !== 0) return startDiff;\r\n\t\t// Longer events first\r\n\t\tconst durationA = a.endDate.getTime() - a.startDate.getTime();\r\n\t\tconst durationB = b.endDate.getTime() - b.startDate.getTime();\r\n\t\treturn durationB - durationA;\r\n\t});\r\n\r\n\t// Track columns for each event\r\n\tconst columns: { event: CalendarEvent<TData>; endTime: number }[][] = [];\r\n\r\n\tconst positionedEvents: IPositionedEvent<TData>[] = [];\r\n\r\n\tfor (const event of sortedEvents) {\r\n\t\tconst eventStart = event.startDate.getTime();\r\n\t\tconst eventEnd = event.endDate.getTime();\r\n\r\n\t\t// Find first available column\r\n\t\tlet columnIndex = -1;\r\n\t\tfor (let i = 0; i < columns.length; i++) {\r\n\t\t\tconst column = columns[i];\r\n\t\t\tif (!column) continue;\r\n\t\t\tconst lastInColumn = column[column.length - 1];\r\n\t\t\tif (lastInColumn && lastInColumn.endTime <= eventStart) {\r\n\t\t\t\tcolumnIndex = i;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Create new column if needed\r\n\t\tif (columnIndex === -1) {\r\n\t\t\tcolumnIndex = columns.length;\r\n\t\t\tcolumns.push([]);\r\n\t\t}\r\n\r\n\t\t// Add to column\r\n\t\tconst column = columns[columnIndex];\r\n\t\tif (column) {\r\n\t\t\tcolumn.push({ event, endTime: eventEnd });\r\n\t\t}\r\n\r\n\t\t// Calculate base position\r\n\t\tconst basePosition = calculateEventPosition<TData>(event, dayStart, visibleHours, hourHeight);\r\n\r\n\t\tpositionedEvents.push({\r\n\t\t\tevent,\r\n\t\t\tposition: basePosition,\r\n\t\t\tcolumn: columnIndex,\r\n\t\t\tcolumnSpan: 1,\r\n\t\t});\r\n\t}\r\n\r\n\t// Calculate width and left for each event based on column count\r\n\tconst totalColumns = columns.length;\r\n\tconst widthPerColumn = 100 / totalColumns;\r\n\r\n\tfor (const positioned of positionedEvents) {\r\n\t\tpositioned.position.left = positioned.column * widthPerColumn;\r\n\t\tpositioned.position.width = widthPerColumn * positioned.columnSpan;\r\n\t\tpositioned.position.zIndex = positioned.column + 1;\r\n\t}\r\n\r\n\treturn positionedEvents;\r\n}\r\n\r\n// ============================================================================\r\n// TIME TO POSITION CONVERSION\r\n// ============================================================================\r\n\r\n/**\r\n * Convert Y position to time\r\n */\r\nexport function yToTime(\r\n\ty: number,\r\n\tdayStart: Date,\r\n\tvisibleHours: IVisibleHours,\r\n\thourHeight: number = DEFAULT_HOUR_HEIGHT,\r\n\tslotDuration: number = 30,\r\n): Date {\r\n\tconst { startHour, endHour } = visibleHours;\r\n\tconst totalVisibleHours = endHour - startHour;\r\n\tconst totalHeight = totalVisibleHours * hourHeight;\r\n\r\n\t// Calculate hours from top\r\n\tconst hoursFromTop = (y / totalHeight) * totalVisibleHours;\r\n\tconst absoluteHours = startHour + hoursFromTop;\r\n\r\n\t// Snap to slot duration\r\n\tconst totalMinutes = absoluteHours * 60;\r\n\tconst snappedMinutes = Math.round(totalMinutes / slotDuration) * slotDuration;\r\n\r\n\t// Create date with snapped time\r\n\tconst result = new Date(dayStart);\r\n\tresult.setHours(0, 0, 0, 0);\r\n\tresult.setMinutes(snappedMinutes);\r\n\r\n\treturn result;\r\n}\r\n\r\n/**\r\n * Convert time to Y position\r\n */\r\nexport function timeToY(\r\n\ttime: Date,\r\n\tvisibleHours: IVisibleHours,\r\n\thourHeight: number = DEFAULT_HOUR_HEIGHT,\r\n): number {\r\n\tconst { startHour, endHour } = visibleHours;\r\n\tconst totalVisibleHours = endHour - startHour;\r\n\tconst totalHeight = totalVisibleHours * hourHeight;\r\n\r\n\tconst hours = time.getHours() + time.getMinutes() / 60;\r\n\tconst clampedHours = Math.max(startHour, Math.min(hours, endHour));\r\n\r\n\treturn ((clampedHours - startHour) / totalVisibleHours) * totalHeight;\r\n}\r\n\r\n// ============================================================================\r\n// OVERLAP DETECTION\r\n// ============================================================================\r\n\r\n/**\r\n * Check if two events overlap in time\r\n */\r\nexport function eventsOverlap(event1: CalendarEvent, event2: CalendarEvent): boolean {\r\n\treturn event1.startDate < event2.endDate && event1.endDate > event2.startDate;\r\n}\r\n\r\n/**\r\n * Get overlapping event groups\r\n */\r\nexport function getOverlappingGroups<TData = Record<string, unknown>>(\r\n\tevents: CalendarEvent<TData>[],\r\n): CalendarEvent<TData>[][] {\r\n\tif (events.length === 0) return [];\r\n\r\n\tconst sorted = [...events].sort((a, b) => a.startDate.getTime() - b.startDate.getTime());\r\n\tconst groups: CalendarEvent<TData>[][] = [];\r\n\tlet currentGroup: CalendarEvent<TData>[] = [];\r\n\tlet groupEnd = 0;\r\n\r\n\tfor (const event of sorted) {\r\n\t\tif (currentGroup.length === 0 || event.startDate.getTime() < groupEnd) {\r\n\t\t\t// Event overlaps with current group\r\n\t\t\tcurrentGroup.push(event);\r\n\t\t\tgroupEnd = Math.max(groupEnd, event.endDate.getTime());\r\n\t\t} else {\r\n\t\t\t// Start new group\r\n\t\t\tif (currentGroup.length > 0) {\r\n\t\t\t\tgroups.push(currentGroup);\r\n\t\t\t}\r\n\t\t\tcurrentGroup = [event];\r\n\t\t\tgroupEnd = event.endDate.getTime();\r\n\t\t}\r\n\t}\r\n\r\n\tif (currentGroup.length > 0) {\r\n\t\tgroups.push(currentGroup);\r\n\t}\r\n\r\n\treturn groups;\r\n}\r\n\r\n// ============================================================================\r\n// SELECTION OVERLAY\r\n// ============================================================================\r\n\r\n/**\r\n * Calculate selection overlay dimensions\r\n */\r\nexport function calculateSelectionOverlay(\r\n\tstartY: number,\r\n\tcurrentY: number,\r\n\tcontainerHeight: number,\r\n): { top: number; height: number } {\r\n\tconst minY = Math.max(0, Math.min(startY, currentY));\r\n\tconst maxY = Math.min(containerHeight, Math.max(startY, currentY));\r\n\r\n\treturn {\r\n\t\ttop: minY,\r\n\t\theight: maxY - minY,\r\n\t};\r\n}\r\n","/**\r\n * DragDropContext - Drag & Drop State Management for Calendar Events\r\n *\r\n * Provides drag & drop state management for calendar events.\r\n * Enables dragging events between time slots and days.\r\n *\r\n * Features:\r\n * - Generic event type support via CalendarEvent<TData>\r\n * - Preview position tracking during drag\r\n * - Duration preservation when dropping\r\n * - Optional provider pattern (components can work without drag-drop)\r\n */\r\n\r\nimport {\r\n createContext,\r\n useCallback,\r\n useContext,\r\n useState,\r\n type ReactNode,\r\n} from 'react';\r\nimport type { CalendarEvent } from '../types';\r\n\r\n// ============================================================================\r\n// TYPES\r\n// ============================================================================\r\n\r\nexport interface IDragState<TData = Record<string, unknown>> {\r\n /** The event being dragged */\r\n event: CalendarEvent<TData>;\r\n /** Original start date of the event */\r\n originalStartDate: Date;\r\n /** Original end date of the event */\r\n originalEndDate: Date;\r\n /** Current preview position (during drag) */\r\n previewDate?: Date | undefined;\r\n /** Current preview hour (for time-based views) */\r\n previewHour?: number | undefined;\r\n /** Current preview minute */\r\n previewMinute?: number | undefined;\r\n}\r\n\r\nexport interface IDropResult<TData = Record<string, unknown>> {\r\n /** The event that was dropped */\r\n event: CalendarEvent<TData>;\r\n /** New start date after drop */\r\n newStartDate: Date;\r\n /** New end date after drop (maintains original duration) */\r\n newEndDate: Date;\r\n}\r\n\r\nexport interface IDragDropContext<TData = Record<string, unknown>> {\r\n /** Current drag state, null when not dragging */\r\n dragState: IDragState<TData> | null;\r\n /** Whether a drag operation is in progress */\r\n isDragging: boolean;\r\n /** Start dragging an event */\r\n // biome-ignore lint/suspicious/noExplicitAny: Accept any event type for flexibility\r\n startDrag: (event: CalendarEvent<any>) => void;\r\n /** Update drag preview position */\r\n updateDragPreview: (date: Date, hour?: number, minute?: number) => void;\r\n /** End drag operation and return drop result */\r\n endDrag: () => IDropResult<TData> | null;\r\n /** Cancel drag operation */\r\n cancelDrag: () => void;\r\n}\r\n\r\n// ============================================================================\r\n// CONTEXT\r\n// ============================================================================\r\n\r\n// biome-ignore lint/suspicious/noExplicitAny: Context needs to be flexible for different event types\r\nconst DragDropContext = createContext<IDragDropContext<any> | undefined>(undefined);\r\n\r\n// ============================================================================\r\n// PROVIDER PROPS\r\n// ============================================================================\r\n\r\nexport interface DragDropProviderProps<TData = Record<string, unknown>> {\r\n children: ReactNode;\r\n /** Callback when an event is dropped at a new location */\r\n onEventDrop?: (result: IDropResult<TData>) => void;\r\n}\r\n\r\n// ============================================================================\r\n// PROVIDER\r\n// ============================================================================\r\n\r\nexport function DragDropProvider<TData = Record<string, unknown>>({\r\n children,\r\n onEventDrop,\r\n}: DragDropProviderProps<TData>) {\r\n const [dragState, setDragState] = useState<IDragState<TData> | null>(null);\r\n\r\n // biome-ignore lint/suspicious/noExplicitAny: Accept any event type for flexibility\r\n const startDrag = useCallback((event: CalendarEvent<any>) => {\r\n const startDate =\r\n typeof event.startDate === 'string'\r\n ? new Date(event.startDate)\r\n : event.startDate;\r\n const endDate =\r\n typeof event.endDate === 'string'\r\n ? new Date(event.endDate)\r\n : event.endDate;\r\n\r\n setDragState({\r\n event: event as CalendarEvent<TData>,\r\n originalStartDate: startDate,\r\n originalEndDate: endDate,\r\n });\r\n }, []);\r\n\r\n const updateDragPreview = useCallback(\r\n (date: Date, hour?: number, minute?: number) => {\r\n setDragState((prev) => {\r\n if (!prev) return null;\r\n return {\r\n ...prev,\r\n previewDate: date,\r\n previewHour: hour,\r\n previewMinute: minute,\r\n };\r\n });\r\n },\r\n [],\r\n );\r\n\r\n const endDrag = useCallback(() => {\r\n if (!dragState) return null;\r\n\r\n const { event, originalStartDate, originalEndDate, previewDate, previewHour, previewMinute } =\r\n dragState;\r\n\r\n // Calculate duration of original event\r\n const durationMs = originalEndDate.getTime() - originalStartDate.getTime();\r\n\r\n // Calculate new start date\r\n let newStartDate: Date;\r\n\r\n if (previewDate) {\r\n newStartDate = new Date(previewDate);\r\n\r\n if (typeof previewHour === 'number') {\r\n // Time-based drop (day/week view)\r\n newStartDate.setHours(previewHour, previewMinute ?? 0, 0, 0);\r\n } else {\r\n // Day-based drop (month view) - keep original time\r\n newStartDate.setHours(\r\n originalStartDate.getHours(),\r\n originalStartDate.getMinutes(),\r\n originalStartDate.getSeconds(),\r\n 0,\r\n );\r\n }\r\n } else {\r\n // No preview, return to original position\r\n newStartDate = originalStartDate;\r\n }\r\n\r\n // Calculate new end date maintaining duration\r\n const newEndDate = new Date(newStartDate.getTime() + durationMs);\r\n\r\n const result: IDropResult<TData> = {\r\n event,\r\n newStartDate,\r\n newEndDate,\r\n };\r\n\r\n // Clear drag state\r\n setDragState(null);\r\n\r\n // Notify parent\r\n onEventDrop?.(result);\r\n\r\n return result;\r\n }, [dragState, onEventDrop]);\r\n\r\n const cancelDrag = useCallback(() => {\r\n setDragState(null);\r\n }, []);\r\n\r\n return (\r\n <DragDropContext.Provider\r\n value={{\r\n dragState,\r\n isDragging: dragState !== null,\r\n startDrag,\r\n updateDragPreview,\r\n endDrag,\r\n cancelDrag,\r\n }}\r\n >\r\n {children}\r\n </DragDropContext.Provider>\r\n );\r\n}\r\n\r\n// ============================================================================\r\n// HOOKS\r\n// ============================================================================\r\n\r\n/**\r\n * Access drag & drop context (required)\r\n *\r\n * @throws Error if used outside of DragDropProvider\r\n */\r\nexport function useDragDrop<TData = Record<string, unknown>>(): IDragDropContext<TData> {\r\n const context = useContext(DragDropContext);\r\n if (!context) {\r\n throw new Error('useDragDrop must be used within a DragDropProvider');\r\n }\r\n return context as IDragDropContext<TData>;\r\n}\r\n\r\n/**\r\n * Access drag & drop context (optional)\r\n *\r\n * Use this for components that may be rendered outside of DragDropProvider.\r\n * Returns null when drag-drop is not available.\r\n */\r\nexport function useOptionalDragDrop<TData = Record<string, unknown>>(): IDragDropContext<TData> | null {\r\n const context = useContext(DragDropContext);\r\n return (context as IDragDropContext<TData>) ?? null;\r\n}\r\n","/**\r\n * Slot Selection Context\r\n *\r\n * Provides centralized selection state management across all calendar views.\r\n * This context handles:\r\n * - Drag-to-select functionality\r\n * - Selection visualization\r\n * - Callback integration with parent components\r\n *\r\n * Usage:\r\n * 1. Wrap calendar views with SlotSelectionProvider\r\n * 2. Use useSlotSelectionContext in child components\r\n * 3. Connect onSelect callback to event creation dialog\r\n */\r\n\r\nimport { createContext, useContext, useMemo, useCallback, useRef, useState, type ReactNode } from 'react';\r\nimport type {\r\n ISlotSelectionState,\r\n ISelectionResult,\r\n ITimeSlot,\r\n TOnSlotSelect,\r\n TSelectionMode,\r\n} from '../types';\r\n\r\n// ============================================================================\r\n// CONTEXT TYPES\r\n// ============================================================================\r\n\r\ninterface ISlotSelectionContext {\r\n /** Current selection state */\r\n isSelecting: boolean;\r\n /** Start selection at a slot */\r\n startSelection: (slot: ITimeSlot) => void;\r\n /** Update selection end point */\r\n updateSelection: (slot: ITimeSlot) => void;\r\n /** Complete the selection */\r\n endSelection: () => void;\r\n /** Cancel the selection */\r\n cancelSelection: () => void;\r\n /** Check if a slot is within the current selection */\r\n isSlotSelected: (slot: ITimeSlot) => boolean;\r\n /** Get the normalized selection result */\r\n getSelectionResult: () => ISelectionResult | null;\r\n /** Current selection mode */\r\n mode: TSelectionMode;\r\n}\r\n\r\n// ============================================================================\r\n// CONTEXT\r\n// ============================================================================\r\n\r\nconst SlotSelectionContext = createContext<ISlotSelectionContext | undefined>(\r\n undefined,\r\n);\r\n\r\n// ============================================================================\r\n// PROVIDER PROPS\r\n// ============================================================================\r\n\r\ninterface SlotSelectionProviderProps {\r\n children: ReactNode;\r\n /** Selection mode based on view */\r\n mode?: TSelectionMode;\r\n /** Callback when selection completes */\r\n onSelect?: TOnSlotSelect;\r\n /** Minimum duration in minutes (for time mode) */\r\n minDurationMinutes?: number;\r\n /** Slot duration in minutes (default: 30) */\r\n slotDurationMinutes?: number;\r\n /** Whether selection is enabled */\r\n enabled?: boolean;\r\n}\r\n\r\n// ============================================================================\r\n// HELPERS\r\n// ============================================================================\r\n\r\n/**\r\n * Convert a time slot to a Date object\r\n */\r\nfunction slotToDate(slot: ITimeSlot): Date {\r\n const date = new Date(slot.date);\r\n if (typeof slot.hour === 'number') {\r\n date.setHours(slot.hour, slot.minute ?? 0, 0, 0);\r\n }\r\n return date;\r\n}\r\n\r\n/**\r\n * Round time to nearest 30-minute interval\r\n */\r\nfunction roundToNearest30Minutes(date: Date): Date {\r\n const result = new Date(date);\r\n const minutes = result.getMinutes();\r\n const roundedMinutes = Math.floor(minutes / 30) * 30;\r\n result.setMinutes(roundedMinutes, 0, 0);\r\n return result;\r\n}\r\n\r\n/**\r\n * Check if two dates are the same calendar day\r\n */\r\nfunction isSameDay(date1: Date, date2: Date): boolean {\r\n return (\r\n date1.getFullYear() === date2.getFullYear() &&\r\n date1.getMonth() === date2.getMonth() &&\r\n date1.getDate() === date2.getDate()\r\n );\r\n}\r\n\r\n/**\r\n * Normalize selection so start is always before end\r\n */\r\nfunction normalizeSelection(\r\n start: ITimeSlot,\r\n end: ITimeSlot,\r\n mode: TSelectionMode,\r\n minDurationMinutes: number,\r\n slotDurationMinutes = 30,\r\n): ISelectionResult {\r\n const startDate = slotToDate(start);\r\n const endDate = slotToDate(end);\r\n\r\n // Swap if end is before start\r\n let normalizedStart = startDate;\r\n let normalizedEnd = endDate;\r\n\r\n if (endDate < startDate) {\r\n normalizedStart = endDate;\r\n normalizedEnd = startDate;\r\n }\r\n\r\n // Apply mode-specific logic\r\n if (mode === 'day') {\r\n // Check if single day selection (same day click)\r\n if (isSameDay(normalizedStart, normalizedEnd)) {\r\n // Single day: use current time rounded to nearest 30 min + default duration\r\n const now = new Date();\r\n const roundedNow = roundToNearest30Minutes(now);\r\n\r\n // Set the date portion from the selected day\r\n normalizedStart = new Date(normalizedStart);\r\n normalizedStart.setHours(\r\n roundedNow.getHours(),\r\n roundedNow.getMinutes(),\r\n 0,\r\n 0,\r\n );\r\n\r\n // End time = start + minimum duration (default 30 min)\r\n normalizedEnd = new Date(\r\n normalizedStart.getTime() + minDurationMinutes * 60 * 1000,\r\n );\r\n } else {\r\n // Multi-day selection: full days\r\n normalizedStart.setHours(0, 0, 0, 0);\r\n normalizedEnd.setHours(23, 59, 59, 999);\r\n }\r\n } else {\r\n // Time mode: The end slot represents the START of that slot block,\r\n // so we need to add slot duration to get the actual end time\r\n const slotDurationMs = slotDurationMinutes * 60 * 1000;\r\n normalizedEnd = new Date(normalizedEnd.getTime() + slotDurationMs);\r\n\r\n // Ensure minimum duration\r\n const durationMs = normalizedEnd.getTime() - normalizedStart.getTime();\r\n const minDurationMs = minDurationMinutes * 60 * 1000;\r\n\r\n if (durationMs < minDurationMs) {\r\n normalizedEnd = new Date(normalizedStart.getTime() + minDurationMs);\r\n }\r\n }\r\n\r\n return {\r\n startDate: normalizedStart,\r\n endDate: normalizedEnd,\r\n };\r\n}\r\n\r\n/**\r\n * Check if a slot is within a selection range\r\n */\r\nfunction isSlotWithinRange(\r\n slot: ITimeSlot,\r\n start: ITimeSlot,\r\n end: ITimeSlot,\r\n mode: TSelectionMode,\r\n): boolean {\r\n const slotDate = slotToDate(slot);\r\n const startDate = slotToDate(start);\r\n const endDate = slotToDate(end);\r\n\r\n // Normalize the range\r\n const rangeStart = startDate <= endDate ? startDate : endDate;\r\n const rangeEnd = startDate <= endDate ? endDate : startDate;\r\n\r\n if (mode === 'day') {\r\n // Day mode: check if slot's date is within range (ignore time)\r\n const slotDay = new Date(slotDate);\r\n slotDay.setHours(0, 0, 0, 0);\r\n const startDay = new Date(rangeStart);\r\n startDay.setHours(0, 0, 0, 0);\r\n const endDay = new Date(rangeEnd);\r\n endDay.setHours(0, 0, 0, 0);\r\n return slotDay >= startDay && slotDay <= endDay;\r\n }\r\n\r\n // Time mode: precise check\r\n return slotDate >= rangeStart && slotDate <= rangeEnd;\r\n}\r\n\r\n// ============================================================================\r\n// PROVIDER\r\n// ============================================================================\r\n\r\nexport function SlotSelectionProvider({\r\n children,\r\n mode = 'time',\r\n onSelect,\r\n minDurationMinutes = 30,\r\n slotDurationMinutes = 30,\r\n enabled = true,\r\n}: SlotSelectionProviderProps) {\r\n const [selection, setSelection] = useState<ISlotSelectionState | null>(null);\r\n const isSelectingRef = useRef(false);\r\n\r\n // Start selection\r\n const startSelection = useCallback(\r\n (slot: ITimeSlot) => {\r\n if (!enabled) return;\r\n\r\n isSelectingRef.current = true;\r\n setSelection({\r\n start: slot,\r\n end: slot,\r\n isSelecting: true,\r\n });\r\n },\r\n [enabled],\r\n );\r\n\r\n // Update selection end point\r\n const updateSelection = useCallback(\r\n (slot: ITimeSlot) => {\r\n if (!(enabled && isSelectingRef.current)) return;\r\n\r\n setSelection((prev) => {\r\n if (!prev) return null;\r\n return {\r\n ...prev,\r\n end: slot,\r\n };\r\n });\r\n },\r\n [enabled],\r\n );\r\n\r\n // Complete selection and fire callback\r\n const endSelection = useCallback(() => {\r\n if (!isSelectingRef.current) return;\r\n\r\n isSelectingRef.current = false;\r\n\r\n setSelection((prev) => {\r\n if (!prev) return null;\r\n\r\n // Calculate final result\r\n const result = normalizeSelection(\r\n prev.start,\r\n prev.end,\r\n mode,\r\n minDurationMinutes,\r\n slotDurationMinutes,\r\n );\r\n\r\n // Fire callback\r\n onSelect?.(result);\r\n\r\n // Clear selection after a brief delay for visual feedback\r\n return {\r\n ...prev,\r\n isSelecting: false,\r\n };\r\n });\r\n\r\n // Clear selection after callback\r\n setTimeout(() => {\r\n setSelection(null);\r\n }, 100);\r\n }, [mode, minDurationMinutes, slotDurationMinutes, onSelect]);\r\n\r\n // Cancel selection without firing callback\r\n const cancelSelection = useCallback(() => {\r\n isSelectingRef.current = false;\r\n setSelection(null);\r\n }, []);\r\n\r\n // Check if a slot is in the current selection\r\n const isSlotInSelection = useCallback(\r\n (slot: ITimeSlot): boolean => {\r\n if (!selection) return false;\r\n return isSlotWithinRange(slot, selection.start, selection.end, mode);\r\n },\r\n [selection, mode],\r\n );\r\n\r\n // Get the normalized selection result\r\n const getSelectionResult = useCallback((): ISelectionResult | null => {\r\n if (!selection) return null;\r\n return normalizeSelection(\r\n selection.start,\r\n selection.end,\r\n mode,\r\n minDurationMinutes,\r\n slotDurationMinutes,\r\n );\r\n }, [selection, mode, minDurationMinutes, slotDurationMinutes]);\r\n\r\n // Memoize context value\r\n const value = useMemo<ISlotSelectionContext>(\r\n () => ({\r\n isSelecting: selection?.isSelecting ?? false,\r\n startSelection,\r\n updateSelection,\r\n endSelection,\r\n cancelSelection,\r\n isSlotSelected: isSlotInSelection,\r\n getSelectionResult,\r\n mode,\r\n }),\r\n [\r\n selection?.isSelecting,\r\n startSelection,\r\n updateSelection,\r\n endSelection,\r\n cancelSelection,\r\n isSlotInSelection,\r\n getSelectionResult,\r\n mode,\r\n ],\r\n );\r\n\r\n return (\r\n <SlotSelectionContext.Provider value={value}>\r\n {children}\r\n </SlotSelectionContext.Provider>\r\n );\r\n}\r\n\r\n// ============================================================================\r\n// HOOKS\r\n// ============================================================================\r\n\r\nexport function useSlotSelectionContext(): ISlotSelectionContext {\r\n const context = useContext(SlotSelectionContext);\r\n if (!context) {\r\n throw new Error(\r\n 'useSlotSelectionContext must be used within a SlotSelectionProvider',\r\n );\r\n }\r\n return context;\r\n}\r\n\r\n/**\r\n * Optional hook that returns undefined if not in provider\r\n * Useful for components that can work with or without selection\r\n */\r\nexport function useOptionalSlotSelection(): ISlotSelectionContext | undefined {\r\n return useContext(SlotSelectionContext);\r\n}\r\n\r\n// ============================================================================\r\n// TYPE EXPORTS\r\n// ============================================================================\r\n\r\nexport type { ISlotSelectionContext, SlotSelectionProviderProps };\r\n"],"names":["CALENDAR_VIEWS","DEFAULT_PREFERENCES","DEFAULT_VISIBLE_HOURS","DEFAULT_BUSINESS_HOURS","DEFAULT_VIEW_CONFIGS","EVENT_COLORS","EVENT_COLOR_CLASSES","HEX_TO_EVENT_COLOR","HOURS_IN_DAY","MINUTES_IN_HOUR","MS_PER_MINUTE","MS_PER_HOUR","MS_PER_DAY","DEFAULT_HOUR_HEIGHT","DEFAULT_SLOT_HEIGHT","DEFAULT_HEADER_HEIGHT","DEFAULT_RESOURCE_WIDTH","MIN_EVENT_HEIGHT","startOfDay","date","result","endOfDay","addDays","days","subDays","isSameDay","date1","date2","isToday","getDayOfWeek","isWeekend","day","startOfWeek","weekStartsOn","diff","endOfWeek","addWeeks","weeks","subWeeks","getWeekNumber","d","dayNum","yearStart","isSameWeek","start1","start2","startOfMonth","endOfMonth","addMonths","months","subMonths","getDaysInMonth","isSameMonth","startOfYear","endOfYear","addYears","years","subYears","isSameYear","addHours","hours","addMinutes","minutes","setTime","seconds","getDecimalHours","isBefore","dateToCompare","isAfter","isBetween","start","end","time","minDate","dates","min","maxDate","max","differenceInMilliseconds","differenceInMinutes","differenceInHours","differenceInDays","formatTime","format","period","formatDateISO","year","month","parseISO","dateString","eachDayOfInterval","current","endDay","eachHourOfInterval","getWeekdayNames","locale","formatter","baseDate","i","getMonthNames","getVisibleHoursArray","visibleHours","h","formatHourLabel","hour","getWeekDays","weekStart","generateMonthGrid","monthStart","monthEnd","gridStart","gridEnd","currentMonth","separateEventsByDuration","events","singleDay","multiDay","event","getEventsInRange","rangeStart","rangeEnd","isWorkingHour","workingHours","dayOfWeek","dayHours","getWorkingHoursForDay","getYearMonths","getViewDateRange","view","navigateNext","navigatePrev","navigateToday","generateMonthCells","viewStart","viewEnd","cells","generateWeekCells","generateYearCells","generateTimeSlots","startHour","endHour","slotDuration","slots","slotsPerHour","slot","minute","generateHourLabels","labels","label","getRangeText","dayMonthFormat","shortFormat","weekEnd","getEventsCountInView","range","getViewTitle","monthFormat","dateFormat","startMonth","endMonth","getWeekdayHeaders","headers","dayIndex","filterEventsByDateRange","startDate","endDate","eventStart","eventEnd","filterEventsByScheduleType","scheduleTypeIds","filterEventsByResource","resourceIds","filterEventsBySearch","search","searchLower","titleMatch","descriptionMatch","filterOutCanceled","applyEventFilters","options","filtered","sortEventsByStart","a","b","sortEventsByEnd","sortEventsByDuration","durationA","groupEventsByDate","groups","dateKey","existing","groupEventsByScheduleType","groupEventsByResource","getEventsForDay","dayStart","dayEnd","getAllDayEvents","getTimedEvents","getMultiDayEvents","isMultiDayEvent","getEventDurationMinutes","getEventColor","defaultColor","resolveEventColor","scheduleTypeColors","typeColor","calculateEventPosition","_dayStart","hourHeight","totalVisibleHours","totalHeight","eventStartHour","eventEndHour","clampedStart","clampedEnd","top","bottom","height","calculateOverlappingPositions","sortedEvents","startDiff","columns","positionedEvents","columnIndex","column","lastInColumn","basePosition","widthPerColumn","positioned","yToTime","y","hoursFromTop","totalMinutes","snappedMinutes","timeToY","eventsOverlap","event1","event2","getOverlappingGroups","sorted","currentGroup","groupEnd","calculateSelectionOverlay","startY","currentY","containerHeight","minY","maxY","DragDropContext","createContext","DragDropProvider","children","onEventDrop","dragState","setDragState","useState","startDrag","useCallback","updateDragPreview","prev","endDrag","originalStartDate","originalEndDate","previewDate","previewHour","previewMinute","durationMs","newStartDate","newEndDate","cancelDrag","jsx","useDragDrop","context","useContext","useOptionalDragDrop","SlotSelectionContext","slotToDate","roundToNearest30Minutes","roundedMinutes","normalizeSelection","mode","minDurationMinutes","slotDurationMinutes","normalizedStart","normalizedEnd","roundedNow","slotDurationMs","minDurationMs","isSlotWithinRange","slotDate","slotDay","startDay","SlotSelectionProvider","onSelect","enabled","selection","setSelection","isSelectingRef","useRef","startSelection","updateSelection","endSelection","cancelSelection","isSlotInSelection","getSelectionResult","value","useMemo","useSlotSelectionContext","useOptionalSlotSelection"],"mappings":"qEAqBaA,GAAkC,CAC9C,MACA,OACA,QACA,OACA,SACA,eACA,gBACA,eACA,eACD,EASaC,GAA4C,CACxD,UAAW,EACX,QAAS,GACT,eAAgB,EAChB,aAAc,GACd,aAAc,GACd,WAAY,MACZ,aAAc,UACd,mBAAoB,EACrB,EAKaC,GAAuC,CACnD,UAAW,EACX,QAAS,EACV,EAKaC,GAAwC,CACpD,UAAW,EACX,QAAS,EACV,EASaC,GAA2D,CACvE,IAAK,CACJ,KAAM,MACN,YAAa,QACb,YAAa,QACb,aAAc,WACd,WAAY,WACZ,WAAY,EAAA,EAEb,KAAM,CACL,KAAM,OACN,YAAa,QACb,YAAa,QACb,aAAc,WACd,WAAY,W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