big-calendar 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CUSTOMIZATION.md CHANGED
@@ -377,9 +377,9 @@ Add custom classes to override or extend component styles:
377
377
  ```jsx
378
378
  <ClientContainer
379
379
  view="month"
380
- className="my-custom-calendar" // Custom container styles
381
- headerClassName="custom-header" // Custom header styles
382
- contentClassName="custom-content" // Custom content area styles
380
+ className="bigcal-my-custom-calendar" // Custom container styles
381
+ headerclassName="bigcal-custom-header" // Custom header styles
382
+ contentclassName="bigcal-custom-content" // Custom content area styles
383
383
  headerProps={{
384
384
  className: "additional-header-class",
385
385
  leftSectionClassName: "custom-left-section",
@@ -440,13 +440,13 @@ Add custom classes to override or extend component styles:
440
440
  // Remove border radius
441
441
  <ClientContainer
442
442
  view="month"
443
- className="rounded-none"
443
+ className="bigcal-rounded-none"
444
444
  />
445
445
 
446
446
  // Add custom shadow
447
447
  <ClientContainer
448
448
  view="month"
449
- className="shadow-2xl"
449
+ className="bigcal-shadow-2xl"
450
450
  />
451
451
 
452
452
  // Custom header styling
@@ -486,9 +486,9 @@ function MyStyledCalendar() {
486
486
  <CalendarProvider useMocks={true}>
487
487
  <ClientContainer
488
488
  view="month"
489
- className="my-custom-calendar shadow-lg"
490
- headerClassName="bg-blue-50 border-blue-200"
491
- contentClassName="p-2"
489
+ className="bigcal-my-custom-calendar shadow-lg"
490
+ headerclassName="bigcal-bg-blue-50 border-blue-200"
491
+ contentclassName="bigcal-p-2"
492
492
  headerProps={{
493
493
  leftSectionClassName: "gap-4",
494
494
  rightSectionClassName: "gap-2",
package/README.md CHANGED
@@ -143,8 +143,8 @@ function MyCalendar() {
143
143
  ```jsx
144
144
  <ClientContainer
145
145
  view="month"
146
- className="my-custom-calendar"
147
- headerClassName="custom-header"
146
+ className="bigcal-my-custom-calendar"
147
+ headerclassName="bigcal-custom-header"
148
148
  />
149
149
  ```
150
150
 
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),o=require("date-fns"),yr=require("clsx"),Dr=require("tailwind-merge"),me=require("react-dnd"),gt=require("react-dnd-html5-backend"),N=require("lucide-react"),ht=require("@radix-ui/react-slot"),ee=require("class-variance-authority"),Nr=require("@radix-ui/react-avatar"),wr=require("@radix-ui/react-select"),te=require("react-hook-form"),ve=require("@hookform/resolvers"),Ve=require("react-aria-components"),Sr=require("react-day-picker"),kr=require("@radix-ui/react-popover"),Ir=require("@radix-ui/react-label"),Cr=require("@radix-ui/react-dialog"),V=require("zod"),Mr=require("@radix-ui/react-scroll-area"),Or=require("@radix-ui/react-tooltip"),Er=require("@radix-ui/react-switch"),Tr=require("@radix-ui/react-accordion");function q(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const D=q(v),ce=q(Nr),M=q(wr),ne=q(kr),pt=q(Ir),R=q(Cr),Z=q(Mr),ae=q(Or),Be=q(Er),X=q(Tr),K=[{id:"dd503cf9-6c38-43cf-94cc-0d4032e2f77a",name:"Leonardo Ramos",picturePath:null},{id:"f3b035ac-49f7-4e92-a715-35680bf63175",name:"Michael Doe",picturePath:null},{id:"3e36ea6e-78f3-40dd-ab8c-a6c737c3c422",name:"Alice Johnson",picturePath:null},{id:"a7aff6bd-a50a-4d6a-ab57-76f76bb27cf5",name:"Robert Smith",picturePath:null}],ye=["blue","green","red","yellow","purple","orange","gray"],De=["Doctor's appointment","Dental cleaning","Eye exam","Therapy session","Business meeting","Team stand-up","Project deadline","Weekly report submission","Client presentation","Marketing strategy review","Networking event","Sales call","Investor pitch","Board meeting","Employee training","Performance review","One-on-one meeting","Lunch with a colleague","HR interview","Conference call","Web development sprint planning","Software deployment","Code review","QA testing session","Cybersecurity audit","Server maintenance","API integration update","Data backup","Cloud migration","System upgrade","Content planning session","Product launch","Customer support review","Team building activity","Legal consultation","Budget review","Financial planning session","Tax filing deadline","Investor relations update","Partnership negotiation","Medical check-up","Vaccination appointment","Blood donation","Gym workout","Yoga class","Physical therapy session","Nutrition consultation","Personal trainer session","Parent-teacher meeting","School open house","College application deadline","Final exam","Graduation ceremony","Job interview","Internship orientation","Office relocation","Business trip","Flight departure","Hotel check-in","Vacation planning","Birthday party","Wedding anniversary","Family reunion","Housewarming party","Community volunteer work","Charity fundraiser","Religious service","Concert attendance","Theater play","Movie night","Sporting event","Football match","Basketball game","Tennis practice","Marathon training","Cycling event","Fishing trip","Camping weekend","Hiking expedition","Photography session","Art workshop","Cooking class","Book club meeting","Grocery shopping","Car maintenance","Home renovation meeting"],_r=t=>{const s=[{id:1204,startDate:new Date("2025-09-20T00:00:00-03:00").toISOString(),endDate:new Date("2025-09-20T23:59:00-03:00").toISOString(),title:"My wedding :)",color:"red",description:"Can't wait to see the most beautiful woman in that dress!",user:K[0]}];let r=1;const n=K[Math.floor(Math.random()*K.length)],d=new Date,c=new Date(d);c.setDate(d.getDate()-30);const i=new Date(d);i.setDate(d.getDate()+30);const a={id:r++,startDate:new Date(d.getTime()-30*6e4).toISOString(),endDate:new Date(d.getTime()+30*6e4).toISOString(),title:De[Math.floor(Math.random()*De.length)],color:ye[Math.floor(Math.random()*ye.length)],description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",user:n};(d.getMonth()!==8||d.getDate()!==20)&&s.push(a);let l=0,u=0;const x=t*3;for(;l<t-1&&u<x;){u++;const g=Math.random()<.1,h=new Date(c.getTime()+Math.random()*(i.getTime()-c.getTime()));if(h.getMonth()===8&&h.getDate()===20)continue;h.setHours(8+Math.floor(Math.random()*8),Math.floor(Math.random()*4)*15,0,0);const f=new Date(h);if(g){const m=Math.floor(Math.random()*4)+1;f.setDate(h.getDate()+m);const p=f.getMonth(),j=f.getDate(),S=h.getMonth(),k=h.getDate();if(S===8&&k<20&&(p>8||p===8&&j>=20)||p===8&&j>=20&&(S<8||S===8&&k<20))continue;f.setHours(8+Math.floor(Math.random()*12),Math.floor(Math.random()*4)*15,0,0)}else{const m=(Math.floor(Math.random()*11)+2)*15;f.setTime(f.getTime()+m*60*1e3)}s.push({id:r++,startDate:h.toISOString(),endDate:f.toISOString(),title:De[Math.floor(Math.random()*De.length)],color:ye[Math.floor(Math.random()*ye.length)],description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",user:K[Math.floor(Math.random()*K.length)]}),l++}return s},mt=_r(80),bt=v.createContext({}),zr={0:{from:0,to:0},1:{from:8,to:17},2:{from:8,to:17},3:{from:8,to:17},4:{from:8,to:17},5:{from:8,to:17},6:{from:8,to:12}},Pr={from:7,to:18};function Fr({children:t,users:s,events:r,api:n={},useMocks:d=!1,singleUser:c=!1,currentUser:i,defaultSettings:a={},onSettingsChange:l,onEventCreate:u,onEventUpdate:x,onEventDelete:g}){const[h,f]=v.useState(a.badgeVariant||"colored"),[m,p]=v.useState(a.visibleHours||Pr),[j,S]=v.useState(a.workingHours||zr),[k,P]=v.useState(new Date),[H,re]=v.useState("all"),[be,Fe]=v.useState(s||[]),[ut,B]=v.useState(r||[]),[ur,se]=v.useState(!1),mr=c?i||(be.length>0?be[0]:null)||(s&&s.length>0?s[0]:null):null,je=d||!n.getEvents&&!r,Ae=d||!n.getUsers&&!s;v.useEffect(()=>{Ae&&be.length===0?Fe(K):n.getUsers&&!Ae&&(se(!0),n.getUsers().then(y=>{Fe(y)}).catch(y=>{console.error("Failed to fetch users:",y),d&&Fe(K)}).finally(()=>{se(!1)}))},[n.getUsers,Ae,d]),v.useEffect(()=>{je&&ut.length===0?B(mt):n.getEvents&&!je&&(se(!0),n.getEvents().then(y=>{B(y)}).catch(y=>{console.error("Failed to fetch events:",y),d&&B(mt)}).finally(()=>{se(!1)}))},[n.getEvents,je,d]);const xr=y=>{y&&P(y)},fr=y=>{f(y),l==null||l({badgeVariant:y,visibleHours:m,workingHours:j})},gr=y=>{p(y),l==null||l({badgeVariant:h,visibleHours:y,workingHours:j})},hr=y=>{S(y),l==null||l({badgeVariant:h,visibleHours:m,workingHours:y})},pr=v.useCallback(async y=>{if(n.createEvent)try{const w=await n.createEvent(y);return B(F=>[...F,w]),u==null||u(w),w}catch(w){throw console.error("Failed to create event:",w),w}else{const w={...y,id:Date.now()};return B(F=>[...F,w]),u==null||u(w),w}},[n.createEvent,u]),br=v.useCallback(async y=>{if(n.updateEvent)try{const w=await n.updateEvent(y);return B(F=>{const G=F.findIndex(He=>He.id===y.id);return G===-1?F:[...F.slice(0,G),w,...F.slice(G+1)]}),x==null||x(w),w}catch(w){throw console.error("Failed to update event:",w),w}else{const w={...y};return B(F=>{const G=F.findIndex(He=>He.id===y.id);return G===-1?F:[...F.slice(0,G),w,...F.slice(G+1)]}),x==null||x(w),w}},[n.updateEvent,x]),jr=v.useCallback(async y=>{if(n.deleteEvent)try{await n.deleteEvent(y),B(w=>w.filter(F=>F.id!==y)),g==null||g(y)}catch(w){throw console.error("Failed to delete event:",w),w}else B(w=>w.filter(F=>F.id!==y)),g==null||g(y)},[n.deleteEvent,g]),vr=v.useCallback(async()=>{if(n.getEvents){se(!0);try{const y=await n.getEvents();B(y)}catch(y){console.error("Failed to refetch events:",y)}finally{se(!1)}}},[n.getEvents]);return e.jsx(bt.Provider,{value:{selectedDate:k,setSelectedDate:xr,selectedUserId:H,setSelectedUserId:re,badgeVariant:h,setBadgeVariant:fr,users:be,visibleHours:m,setVisibleHours:gr,workingHours:j,setWorkingHours:hr,events:ut,setEvents:B,isLoading:ur,createEvent:pr,updateEvent:br,deleteEvent:jr,refetchEvents:vr,api:n,useMocks:je,singleUser:c,currentUser:mr},children:t})}function C(){const t=v.useContext(bt);if(!t)throw new Error("useCalendar must be used within a CalendarProvider.");return t}function b(...t){return Dr.twMerge(yr.clsx(t))}function jt(){const{isDragging:t,item:s,currentOffset:r,initialOffset:n,initialClientOffset:d}=me.useDragLayer(l=>({item:l.getItem(),itemType:l.getItemType(),isDragging:l.isDragging(),currentOffset:l.getClientOffset(),initialOffset:l.getInitialSourceClientOffset(),initialClientOffset:l.getInitialClientOffset()}));if(!t||!s||!r||!n||!d)return null;const c=d.x-n.x,i=d.y-n.y,a={position:"fixed",pointerEvents:"none",zIndex:100,left:r.x-c,top:r.y-i};return e.jsx("div",{style:a,children:e.jsx("div",{className:"",style:{width:s.width,height:s.height},children:s.children})})}function vt({children:t}){return e.jsxs(me.DndProvider,{backend:gt.HTML5Backend,children:[t,e.jsx(jt,{})]})}const Se=ee.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring 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 bg-background shadow-sm 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:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),O=D.forwardRef(({className:t,variant:s,size:r,asChild:n=!1,...d},c)=>{const i=n?ht.Slot:"button";return e.jsx(i,{className:b(Se({variant:s,size:r,className:t})),ref:c,...d})});O.displayName="Button";const We=v.forwardRef(({className:t,children:s,max:r=1,spacing:n=10,...d},c)=>{const i=v.Children.toArray(s),a=v.useMemo(()=>e.jsxs(e.Fragment,{children:[i.slice(0,r).map((l,u)=>v.cloneElement(l,{className:b(l.props.className,"border-2 border-background"),style:{marginLeft:u===0?0:-n,...l.props.style}})),i.length>r&&e.jsx("div",{className:b("relative flex items-center justify-center rounded-full border-2 border-background bg-muted",i[0].props.className),style:{marginLeft:-n},children:e.jsxs("p",{children:["+",i.length-r]})})]}),[i,r,n]);return e.jsx("div",{ref:c,className:b("relative flex",t),...d,children:a})});We.displayName="AvatarGroup";const oe=D.forwardRef(({className:t,...s},r)=>e.jsx(ce.Root,{ref:r,className:b("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...s}));oe.displayName=ce.Root.displayName;const ie=D.forwardRef(({className:t,...s},r)=>e.jsx(ce.Image,{ref:r,className:b("aspect-square h-full w-full",t),...s}));ie.displayName=ce.Image.displayName;const le=D.forwardRef(({className:t,...s},r)=>e.jsx(ce.Fallback,{ref:r,className:b("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...s}));le.displayName=ce.Fallback.displayName;const J=M.Root,Ar=M.Group,Q=M.Value,U=D.forwardRef(({className:t,children:s,...r},n)=>e.jsxs(M.Trigger,{ref:n,className:b("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1",t),...r,children:[s,e.jsx(M.Icon,{asChild:!0,children:e.jsx(N.ChevronDown,{className:"size-4 opacity-50"})})]}));U.displayName=M.Trigger.displayName;const qe=D.forwardRef(({className:t,...s},r)=>e.jsx(M.ScrollUpButton,{ref:r,className:b("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(N.ChevronUp,{className:"size-4"})}));qe.displayName=M.ScrollUpButton.displayName;const $e=D.forwardRef(({className:t,...s},r)=>e.jsx(M.ScrollDownButton,{ref:r,className:b("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(N.ChevronDown,{className:"size-4"})}));$e.displayName=M.ScrollDownButton.displayName;const Y=D.forwardRef(({className:t,children:s,position:r="popper",...n},d)=>e.jsx(M.Portal,{children:e.jsxs(M.Content,{ref:d,className:b("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...n,children:[e.jsx(qe,{}),e.jsx(M.Viewport,{className:b("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx($e,{})]})}));Y.displayName=M.Content.displayName;const yt=D.forwardRef(({className:t,...s},r)=>e.jsx(M.Label,{ref:r,className:b("px-2 py-1.5 text-sm font-semibold",t),...s}));yt.displayName=M.Label.displayName;const I=D.forwardRef(({className:t,children:s,...r},n)=>e.jsxs(M.Item,{ref:n,className:b("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[e.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(M.ItemIndicator,{children:e.jsx(N.Check,{className:"size-4"})})}),e.jsx(M.ItemText,{children:s})]}));I.displayName=M.Item.displayName;const Dt=D.forwardRef(({className:t,...s},r)=>e.jsx(M.Separator,{ref:r,className:b("-mx-1 my-1 h-px bg-muted",t),...s}));Dt.displayName=M.Separator.displayName;function Nt(){const{users:t,selectedUserId:s,setSelectedUserId:r}=C();return e.jsxs(J,{value:s,onValueChange:r,children:[e.jsx(U,{className:"flex-1 md:w-48",children:e.jsx(Q,{})}),e.jsxs(Y,{align:"end",children:[e.jsx(I,{value:"all",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(We,{max:2,children:t.map(n=>e.jsxs(oe,{className:"size-6 text-xxs",children:[e.jsx(ie,{src:n.picturePath??void 0,alt:n.name}),e.jsx(le,{className:"text-xxs",children:n.name[0]})]},n.id))}),"All"]})}),t.map(n=>e.jsx(I,{value:n.id,className:"flex-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(oe,{className:"size-6",children:[e.jsx(ie,{src:n.picturePath??void 0,alt:n.name}),e.jsx(le,{className:"text-xxs",children:n.name[0]})]},n.id),e.jsx("p",{className:"truncate",children:n.name})]})},n.id))]})]})}function wt(){const{setSelectedDate:t}=C(),s=new Date,r=()=>t(s);return e.jsxs("button",{className:"flex size-14 flex-col items-start overflow-hidden rounded-lg border focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:r,children:[e.jsx("p",{className:"flex h-6 w-full items-center justify-center bg-primary text-center text-xs font-semibold text-primary-foreground",children:o.formatDate(s,"MMM").toUpperCase()}),e.jsx("p",{className:"flex w-full items-center justify-center text-lg font-bold",children:s.getDate()})]})}const St=ee.cva("inline-flex items-center rounded-md 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 shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function kt({className:t,variant:s,...r}){return e.jsx("div",{className:b(St({variant:s}),t),...r})}function It(t,s){const r="MMM d, yyyy";let n,d;switch(t){case"agenda":n=o.startOfMonth(s),d=o.endOfMonth(s);break;case"year":n=o.startOfYear(s),d=o.endOfYear(s);break;case"month":n=o.startOfMonth(s),d=o.endOfMonth(s);break;case"week":n=o.startOfWeek(s),d=o.endOfWeek(s);break;case"day":return o.format(s,r);default:return"Error while formatting "}return`${o.format(n,r)} - ${o.format(d,r)}`}function Le(t,s,r){return{agenda:r==="next"?o.addMonths:o.subMonths,year:r==="next"?o.addYears:o.subYears,month:r==="next"?o.addMonths:o.subMonths,week:r==="next"?o.addWeeks:o.subWeeks,day:r==="next"?o.addDays:o.subDays}[s](t,1)}function Ct(t,s,r){const n={agenda:o.isSameMonth,year:o.isSameYear,day:o.isSameDay,week:o.isSameWeek,month:o.isSameMonth};return t.filter(d=>n[r](new Date(d.startDate),s)).length}function Mt(t){const s=new Date;return t.filter(r=>o.isWithinInterval(s,{start:o.parseISO(r.startDate),end:o.parseISO(r.endDate)}))||null}function Ue(t){const s=t.sort((n,d)=>o.parseISO(n.startDate).getTime()-o.parseISO(d.startDate).getTime()),r=[];for(const n of s){const d=o.parseISO(n.startDate);let c=!1;for(const i of r){const a=i[i.length-1],l=o.parseISO(a.endDate);if(d>=l){i.push(n),c=!0;break}}c||r.push([n])}return r}function Ye(t,s,r,n,d){const c=o.parseISO(t.startDate),i=new Date(s.setHours(0,0,0,0)),a=c<i?i:c,l=o.differenceInMinutes(a,i);let u;if(d){const h=d.from*60,m=d.to*60-h;u=(l-h)/m*100}else u=l/1440*100;const x=100/n,g=r*x;return{top:`${u}%`,width:`${x}%`,left:`${g}%`}}function Ge(t,s,r){const n=t.getDay(),d=r[n];return s>=d.from&&s<d.to}function Ke(t,s){let r=t.from,n=t.to;return s.forEach(c=>{const i=o.parseISO(c.startDate).getHours(),a=o.parseISO(c.endDate),l=a.getHours()+(a.getMinutes()>0?1:0);i<r&&(r=i),l>n&&(n=l)}),n=Math.min(n,24),{hours:Array.from({length:n-r},(c,i)=>i+r),earliestEventHour:r,latestEventHour:n}}function Ot(t){const s=t.getFullYear(),r=t.getMonth(),n=(h,f)=>new Date(h,f+1,0).getDate(),d=(h,f)=>new Date(h,f,1).getDay(),c=n(s,r),i=d(s,r),a=n(s,r-1),l=i+c,u=Array.from({length:i},(h,f)=>({day:a-i+f+1,currentMonth:!1,date:new Date(s,r-1,a-i+f+1)})),x=Array.from({length:c},(h,f)=>({day:f+1,currentMonth:!0,date:new Date(s,r,f+1)})),g=Array.from({length:(7-l%7)%7},(h,f)=>({day:f+1,currentMonth:!1,date:new Date(s,r+1,f+1)}));return[...u,...x,...g]}function Et(t,s,r){const n=o.startOfMonth(r),d=o.endOfMonth(r),c={},i={};return o.eachDayOfInterval({start:n,end:d}).forEach(l=>{i[l.toISOString()]=[!1,!1,!1]}),[...t.sort((l,u)=>{const x=o.differenceInDays(o.parseISO(l.endDate),o.parseISO(l.startDate));return o.differenceInDays(o.parseISO(u.endDate),o.parseISO(u.startDate))-x||o.parseISO(l.startDate).getTime()-o.parseISO(u.startDate).getTime()}),...s.sort((l,u)=>o.parseISO(l.startDate).getTime()-o.parseISO(u.startDate).getTime())].forEach(l=>{const u=o.parseISO(l.startDate),x=o.parseISO(l.endDate),g=o.eachDayOfInterval({start:u<n?n:u,end:x>d?d:x});let h=-1;for(let f=0;f<3;f++)if(g.every(m=>{const p=i[o.startOfDay(m).toISOString()];return p&&!p[f]})){h=f;break}h!==-1&&(g.forEach(f=>{const m=o.startOfDay(f).toISOString();i[m][h]=!0}),c[l.id]=h)}),c}function Tt(t,s,r){return s.filter(d=>{const c=o.parseISO(d.startDate),i=o.parseISO(d.endDate);return t>=c&&t<=i||o.isSameDay(t,c)||o.isSameDay(t,i)}).map(d=>({...d,position:r[d.id]??-1,isMultiDay:d.startDate!==d.endDate})).sort((d,c)=>d.isMultiDay&&!c.isMultiDay?-1:!d.isMultiDay&&c.isMultiDay?1:d.position-c.position)}function _t({view:t,events:s}){const{selectedDate:r,setSelectedDate:n}=C(),d=o.formatDate(r,"MMMM"),c=r.getFullYear(),i=v.useMemo(()=>Ct(s,r,t),[s,r,t]),a=()=>n(Le(r,t,"previous")),l=()=>n(Le(r,t,"next"));return e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-lg font-semibold",children:[d," ",c]}),e.jsxs(kt,{variant:"outline",className:"px-1.5",children:[i," events"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{variant:"outline",className:"size-6.5 px-0 [&_svg]:size-4.5",onClick:a,children:e.jsx(N.ChevronLeft,{})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:It(t,r)}),e.jsx(O,{variant:"outline",className:"size-6.5 px-0 [&_svg]:size-4.5",onClick:l,children:e.jsx(N.ChevronRight,{})})]})]})}function zt(t,s,r){function n(a,l){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),s(a,l);for(const x in i.prototype)x in a||Object.defineProperty(a,x,{value:i.prototype[x].bind(a)});a._zod.constr=i,a._zod.def=l}const d=(r==null?void 0:r.Parent)??Object;class c extends d{}Object.defineProperty(c,"name",{value:t});function i(a){var l;const u=r!=null&&r.Parent?new c:this;n(u,a),(l=u._zod).deferred??(l.deferred=[]);for(const x of u._zod.deferred)x();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var l,u;return r!=null&&r.Parent&&a instanceof r.Parent?!0:(u=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:u.has(t)}}),Object.defineProperty(i,"name",{value:t}),i}class Hr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Vr={};function Pt(t){return Vr}function Rr(t,s){return typeof s=="bigint"?s.toString():s}const Ft=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Ne(t){return typeof t=="string"?t:t==null?void 0:t.message}function At(t,s,r){var d,c,i,a,l,u;const n={...t,path:t.path??[]};if(!t.message){const x=Ne((i=(c=(d=t.inst)==null?void 0:d._zod.def)==null?void 0:c.error)==null?void 0:i.call(c,t))??Ne((a=s==null?void 0:s.error)==null?void 0:a.call(s,t))??Ne((l=r.customError)==null?void 0:l.call(r,t))??Ne((u=r.localeError)==null?void 0:u.call(r,t))??"Invalid input";n.message=x}return delete n.inst,delete n.continue,s!=null&&s.reportInput||delete n.input,n}const Ht=(t,s)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:s,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(s,Rr,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Br=zt("$ZodError",Ht),Vt=zt("$ZodError",Ht,{Parent:Error}),Lr=t=>(s,r,n,d)=>{const c=n?Object.assign(n,{async:!1}):{async:!1},i=s._zod.run({value:r,issues:[]},c);if(i instanceof Promise)throw new Hr;if(i.issues.length){const a=new((d==null?void 0:d.Err)??t)(i.issues.map(l=>At(l,c,Pt())));throw Ft(a,d==null?void 0:d.callee),a}return i.value},Wr=Lr(Vt),qr=t=>async(s,r,n,d)=>{const c=n?Object.assign(n,{async:!0}):{async:!0};let i=s._zod.run({value:r,issues:[]},c);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((d==null?void 0:d.Err)??t)(i.issues.map(l=>At(l,c,Pt())));throw Ft(a,d==null?void 0:d.callee),a}return i.value},$r=qr(Vt);function xt(t,s){try{var r=t()}catch(n){return s(n)}return r&&r.then?r.then(void 0,s):r}function Ur(t,s){for(var r={};t.length;){var n=t[0],d=n.code,c=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:c,type:d};if("unionErrors"in n&&n.unionErrors.forEach(function(x){return x.errors.forEach(function(g){return t.push(g)})}),s){var l=r[i].types,u=l&&l[n.code];r[i]=te.appendErrors(i,s,r,d,u?[].concat(u,n.message):n.message)}t.shift()}return r}function Yr(t,s){for(var r={};t.length;){var n=t[0],d=n.code,c=n.message,i=n.path.join(".");if(!r[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[i]={message:a.message,type:a.code}}else r[i]={message:c,type:d};if(n.code==="invalid_union"&&n.errors.forEach(function(x){return x.forEach(function(g){return t.push(g)})}),s){var l=r[i].types,u=l&&l[n.code];r[i]=te.appendErrors(i,s,r,d,u?[].concat(u,n.message):n.message)}t.shift()}return r}function Rt(t,s,r){if(r===void 0&&(r={}),function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def}(t))return function(n,d,c){try{return Promise.resolve(xt(function(){return Promise.resolve(t[r.mode==="sync"?"parse":"parseAsync"](n,s)).then(function(i){return c.shouldUseNativeValidation&&ve.validateFieldsNatively({},c),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if(function(a){return Array.isArray(a==null?void 0:a.issues)}(i))return{values:{},errors:ve.toNestErrors(Ur(i.errors,!c.shouldUseNativeValidation&&c.criteriaMode==="all"),c)};throw i}))}catch(i){return Promise.reject(i)}};if(function(n){return"_zod"in n&&typeof n._zod=="object"}(t))return function(n,d,c){try{return Promise.resolve(xt(function(){return Promise.resolve((r.mode==="sync"?Wr:$r)(t,n,s)).then(function(i){return c.shouldUseNativeValidation&&ve.validateFieldsNatively({},c),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if(function(a){return a instanceof Br}(i))return{values:{},errors:ve.toNestErrors(Yr(i.issues,!c.shouldUseNativeValidation&&c.criteriaMode==="all"),c)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}function ke({defaultIsOpen:t=!1}={}){const[s,r]=v.useState(t);return{onOpen:()=>r(!0),onClose:()=>r(!1),isOpen:s,onToggle:()=>r(i=>!i)}}const Ie=D.forwardRef(({className:t,type:s,...r},n)=>e.jsx("input",{type:s,className:b("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...r}));Ie.displayName="Input";const Ce=D.forwardRef(({className:t,...s},r)=>e.jsx("textarea",{className:b("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...s}));Ce.displayName="Textarea";const W=v.forwardRef(({className:t,dateInputClassName:s,segmentClassName:r,disabled:n,"data-invalid":d,...c},i)=>e.jsx(Ve.TimeField,{ref:i,className:b("relative",t),isDisabled:n,isInvalid:d,...c,"aria-label":"Time",shouldForceLeadingZeros:!0,children:e.jsx(Ve.DateInput,{className:b("peer inline-flex h-9 w-full items-center overflow-hidden whitespace-nowrap rounded-md border bg-background px-3 py-2 text-sm shadow-black","data-[focus-within]:outline-none data-[focus-within]:ring-1 data-[focus-within]:ring-ring","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",s),children:a=>e.jsx(Ve.DateSegment,{segment:a,className:b("inline rounded p-0.5 caret-transparent outline outline-0","data-[focused]:bg-foreground/10 data-[focused]:text-foreground","data-[placeholder]:text-muted-foreground","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",r)})})}));W.displayName="TimeInput";function Me({className:t,classNames:s,showOutsideDays:r=!0,selected:n,...d}){const[c,i]=D.useState(n instanceof Date?n:void 0);return e.jsx(Sr.DayPicker,{selected:n,showOutsideDays:r,month:c,onMonthChange:i,className:b("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:b(Se({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:b("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-r-md","[&:has([aria-selected])]:rounded-md"),day:b(Se({variant:"ghost"}),"h-8 w-8 p-0 font-normal aria-selected:opacity-100"),day_range_start:"day-range-start",day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...s},components:{IconLeft:({className:a,...l})=>e.jsx(N.ChevronLeft,{className:b("h-4 w-4",a),...l}),IconRight:({className:a,...l})=>e.jsx(N.ChevronRight,{className:b("h-4 w-4",a),...l})},...d})}Me.displayName="Calendar";const Bt=ne.Root,Lt=ne.Trigger,Gr=ne.Anchor,Ze=D.forwardRef(({className:t,align:s="center",sideOffset:r=4,...n},d)=>e.jsx(ne.Portal,{children:e.jsx(ne.Content,{ref:d,align:s,sideOffset:r,className:b("z-50 w-72 origin-[--radix-popover-content-transform-origin] rounded-md border bg-popover p-4 text-popover-foreground shadow-md 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),...n})}));Ze.displayName=ne.Content.displayName;function ue({id:t,onSelect:s,className:r,placeholder:n,labelVariant:d="PPP",value:c,...i}){const{isOpen:a,onClose:l,onToggle:u}=ke(),x=g=>{s(g),l()};return e.jsxs(Bt,{open:a,onOpenChange:u,modal:!0,children:[e.jsx(Lt,{asChild:!0,children:e.jsxs(O,{id:t,variant:"outline",className:b("group relative h-9 w-full justify-start whitespace-nowrap px-3 py-2 font-normal hover:bg-inherit",r),...i,children:[c&&e.jsx("span",{children:o.format(c,d)}),!c&&e.jsx("span",{className:"text-muted-foreground",children:n})]})}),e.jsx(Ze,{align:"center",className:"w-fit p-0",children:e.jsx(Me,{mode:"single",selected:c,onSelect:x,initialFocus:!0})})]})}const Kr=ee.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Xe=D.forwardRef(({className:t,...s},r)=>e.jsx(pt.Root,{ref:r,className:b(Kr(),t),...s}));Xe.displayName=pt.Root.displayName;const Je=te.FormProvider,Wt=D.createContext({});function A({...t}){return e.jsx(Wt.Provider,{value:{name:t.name},children:e.jsx(te.Controller,{...t})})}const xe=()=>{const t=D.useContext(Wt),s=D.useContext(qt),{getFieldState:r,formState:n}=te.useFormContext(),d=r(t.name,n);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:c}=s;return{id:c,name:t.name,formItemId:`${c}-form-item`,formDescriptionId:`${c}-form-item-description`,formMessageId:`${c}-form-item-message`,...d}},qt=D.createContext({}),E=D.forwardRef(({className:t,...s},r)=>{const n=D.useId();return e.jsx(qt.Provider,{value:{id:n},children:e.jsx("div",{ref:r,className:b("space-y-2",t),...s})})});E.displayName="FormItem";const T=D.forwardRef(({className:t,...s},r)=>{const{error:n,formItemId:d}=xe();return e.jsx(Xe,{ref:r,className:b(n&&"text-destructive",t),htmlFor:d,...s})});T.displayName="FormLabel";const _=D.forwardRef(({...t},s)=>{const{error:r,formItemId:n,formDescriptionId:d,formMessageId:c}=xe();return e.jsx(ht.Slot,{ref:s,id:n,"aria-describedby":r?`${d} ${c}`:`${d}`,"aria-invalid":!!r,...t})});_.displayName="FormControl";const $t=D.forwardRef(({className:t,...s},r)=>{const{formDescriptionId:n}=xe();return e.jsx("p",{ref:r,id:n,className:b("text-[0.8rem] text-muted-foreground",t),...s})});$t.displayName="FormDescription";const z=D.forwardRef(({className:t,children:s,...r},n)=>{const{error:d,formMessageId:c}=xe(),i=d?String((d==null?void 0:d.message)??""):s;return i?e.jsx("p",{ref:n,id:c,className:b("text-[0.8rem] font-medium text-destructive",t),...r,children:i}):null});z.displayName="FormMessage";const Oe=R.Root,Ee=R.Trigger,Ut=R.Portal,Qe=R.Close,et=D.forwardRef(({className:t,...s},r)=>e.jsx(R.Overlay,{ref:r,className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s}));et.displayName=R.Overlay.displayName;const fe=D.forwardRef(({className:t,children:s,...r},n)=>e.jsxs(Ut,{children:[e.jsx(et,{}),e.jsxs(R.Content,{ref:n,className:b("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...r,children:[s,e.jsxs(R.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(N.X,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));fe.displayName=R.Content.displayName;function ge({className:t,...s}){return e.jsx("div",{className:b("flex flex-col space-y-1.5 text-center sm:text-left",t),...s})}ge.displayName="DialogHeader";function he({className:t,...s}){return e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s})}he.displayName="DialogFooter";const pe=D.forwardRef(({className:t,...s},r)=>e.jsx(R.Title,{ref:r,className:b("text-lg font-semibold leading-none tracking-tight",t),...s}));pe.displayName=R.Title.displayName;const Te=D.forwardRef(({className:t,...s},r)=>e.jsx(R.Description,{ref:r,className:b("text-sm text-muted-foreground",t),...s}));Te.displayName=R.Description.displayName;const tt=(t=!1)=>V.z.object({user:t?V.z.string().optional():V.z.string(),title:V.z.string().min(1,"Title is required"),description:V.z.string().min(1,"Description is required"),startDate:V.z.date({required_error:"Start date is required"}),startTime:V.z.object({hour:V.z.number(),minute:V.z.number()},{required_error:"Start time is required"}),endDate:V.z.date({required_error:"End date is required"}),endTime:V.z.object({hour:V.z.number(),minute:V.z.number()},{required_error:"End time is required"}),color:V.z.enum(["blue","green","red","yellow","purple","orange","gray"],{required_error:"Color is required"})}).refine(s=>{const r=new Date(s.startDate);r.setHours(s.startTime.hour,s.startTime.minute,0,0);const n=new Date(s.endDate);return n.setHours(s.endTime.hour,s.endTime.minute,0,0),r<n},{message:"Start date cannot be after end date",path:["startDate"]}),Zr=tt(!1);function L({children:t,startDate:s,startTime:r,onEventCreated:n,showFormDisclaimer:d=!0}){const{users:c,createEvent:i,singleUser:a,currentUser:l}=C(),{isOpen:u,onClose:x,onToggle:g}=ke(),h=te.useForm({resolver:Rt(tt(a)),defaultValues:{title:"",description:"",user:a&&l?l.id:void 0,startDate:typeof s<"u"?s:void 0,startTime:typeof r<"u"?r:void 0}}),f=async m=>{try{const p=a?l:c.find(H=>H.id===m.user);if(!p){a||h.setError("user",{message:"User not found"});return}const j=new Date(m.startDate);j.setHours(m.startTime.hour,m.startTime.minute,0,0);const S=new Date(m.endDate);S.setHours(m.endTime.hour,m.endTime.minute,0,0);const k={user:p,title:m.title,color:m.color,description:m.description,startDate:j.toISOString(),endDate:S.toISOString()},P=await i(k);n==null||n(P),x(),h.reset()}catch(p){console.error("Failed to create event:",p)}};return v.useEffect(()=>{h.reset({startDate:s,startTime:r})},[s,r,h]),e.jsxs(Oe,{open:u,onOpenChange:g,children:[e.jsx(Ee,{asChild:!0,children:t}),e.jsxs(fe,{children:[e.jsxs(ge,{children:[e.jsx(pe,{children:"Add New Event"}),d&&e.jsx(Te,{className:"mt-2",children:"Create a new calendar event. The event will be saved according to your API configuration."})]}),e.jsx(Je,{...h,children:e.jsxs("form",{id:"event-form",onSubmit:h.handleSubmit(f),className:"grid gap-4 py-4",children:[!a&&e.jsx(A,{control:h.control,name:"user",render:({field:m,fieldState:p})=>e.jsxs(E,{children:[e.jsx(T,{children:"Responsible"}),e.jsx(_,{children:e.jsxs(J,{value:m.value,onValueChange:m.onChange,children:[e.jsx(U,{"data-invalid":p.invalid,children:e.jsx(Q,{placeholder:"Select an option"})}),e.jsx(Y,{children:c.map(j=>e.jsx(I,{value:j.id,className:"flex-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(oe,{className:"size-6",children:[e.jsx(ie,{src:j.picturePath??void 0,alt:j.name}),e.jsx(le,{className:"text-xxs",children:j.name[0]})]},j.id),e.jsx("p",{className:"truncate",children:j.name})]})},j.id))})]})}),e.jsx(z,{})]})}),e.jsx(A,{control:h.control,name:"title",render:({field:m,fieldState:p})=>e.jsxs(E,{children:[e.jsx(T,{htmlFor:"title",children:"Title"}),e.jsx(_,{children:e.jsx(Ie,{id:"title",placeholder:"Enter a title","data-invalid":p.invalid,...m})}),e.jsx(z,{})]})}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(A,{control:h.control,name:"startDate",render:({field:m,fieldState:p})=>e.jsxs(E,{className:"flex-1",children:[e.jsx(T,{htmlFor:"startDate",children:"Start Date"}),e.jsx(_,{children:e.jsx(ue,{id:"startDate",value:m.value,onSelect:j=>m.onChange(j),placeholder:"Select a date","data-invalid":p.invalid})}),e.jsx(z,{})]})}),e.jsx(A,{control:h.control,name:"startTime",render:({field:m,fieldState:p})=>e.jsxs(E,{className:"flex-1",children:[e.jsx(T,{children:"Start Time"}),e.jsx(_,{children:e.jsx(W,{value:m.value,onChange:m.onChange,hourCycle:12,"data-invalid":p.invalid})}),e.jsx(z,{})]})})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(A,{control:h.control,name:"endDate",render:({field:m,fieldState:p})=>e.jsxs(E,{className:"flex-1",children:[e.jsx(T,{children:"End Date"}),e.jsx(_,{children:e.jsx(ue,{value:m.value,onSelect:j=>m.onChange(j),placeholder:"Select a date","data-invalid":p.invalid})}),e.jsx(z,{})]})}),e.jsx(A,{control:h.control,name:"endTime",render:({field:m,fieldState:p})=>e.jsxs(E,{className:"flex-1",children:[e.jsx(T,{children:"End Time"}),e.jsx(_,{children:e.jsx(W,{value:m.value,onChange:m.onChange,hourCycle:12,"data-invalid":p.invalid})}),e.jsx(z,{})]})})]}),e.jsx(A,{control:h.control,name:"color",render:({field:m,fieldState:p})=>e.jsxs(E,{children:[e.jsx(T,{children:"Color"}),e.jsx(_,{children:e.jsxs(J,{value:m.value,onValueChange:m.onChange,children:[e.jsx(U,{"data-invalid":p.invalid,children:e.jsx(Q,{placeholder:"Select an option"})}),e.jsxs(Y,{children:[e.jsx(I,{value:"blue",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-blue-600"}),"Blue"]})}),e.jsx(I,{value:"green",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-green-600"}),"Green"]})}),e.jsx(I,{value:"red",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-red-600"}),"Red"]})}),e.jsx(I,{value:"yellow",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-yellow-600"}),"Yellow"]})}),e.jsx(I,{value:"purple",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-purple-600"}),"Purple"]})}),e.jsx(I,{value:"orange",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-orange-600"}),"Orange"]})}),e.jsx(I,{value:"gray",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-neutral-600"}),"Gray"]})})]})]})}),e.jsx(z,{})]})}),e.jsx(A,{control:h.control,name:"description",render:({field:m,fieldState:p})=>e.jsxs(E,{children:[e.jsx(T,{children:"Description"}),e.jsx(_,{children:e.jsx(Ce,{...m,value:m.value,"data-invalid":p.invalid})}),e.jsx(z,{})]})})]})}),e.jsxs(he,{children:[e.jsx(Qe,{asChild:!0,children:e.jsx(O,{type:"button",variant:"outline",children:"Cancel"})}),e.jsx(O,{form:"event-form",type:"submit",children:"Create Event"})]})]})]})}function Yt({view:t,events:s,onViewChange:r,showTodayButton:n=!0,showDateNavigator:d=!0,showViewSwitcher:c=!0,showUserSelect:i=!0,showAddEventButton:a=!0,availableViews:l=["day","week","month","year","agenda"],className:u,leftSectionClassName:x,rightSectionClassName:g,viewSwitcherClassName:h,addButtonClassName:f}){const{singleUser:m}=C(),p=S=>{r&&r(S)},j=i&&!m;return e.jsxs("div",{className:b("flex flex-col gap-4 border-b p-4 lg:flex-row lg:items-center lg:justify-between",u),children:[(n||d)&&e.jsxs("div",{className:b("flex items-center gap-3",x),children:[n&&e.jsx(wt,{}),d&&e.jsx(_t,{view:t,events:s})]}),(c||i||a)&&e.jsxs("div",{className:b("flex flex-col items-center gap-1.5 sm:flex-row sm:justify-between",g),children:[(c||i)&&e.jsxs("div",{className:"flex w-full items-center gap-1.5",children:[c&&e.jsxs("div",{className:b("inline-flex first:rounded-r-none last:rounded-l-none [&:not(:first-child):not(:last-child)]:rounded-none",h),children:[l.includes("day")&&e.jsx(O,{"aria-label":"View by day",size:"icon",variant:t==="day"?"default":"outline",className:"rounded-r-none [&_svg]:size-5",onClick:()=>p("day"),children:e.jsx(N.List,{strokeWidth:1.8})}),l.includes("week")&&e.jsx(O,{"aria-label":"View by week",size:"icon",variant:t==="week"?"default":"outline",className:"-ml-px rounded-none [&_svg]:size-5",onClick:()=>p("week"),children:e.jsx(N.Columns,{strokeWidth:1.8})}),l.includes("month")&&e.jsx(O,{"aria-label":"View by month",size:"icon",variant:t==="month"?"default":"outline",className:"-ml-px rounded-none [&_svg]:size-5",onClick:()=>p("month"),children:e.jsx(N.Grid2x2,{strokeWidth:1.8})}),l.includes("year")&&e.jsx(O,{"aria-label":"View by year",size:"icon",variant:t==="year"?"default":"outline",className:"-ml-px rounded-none [&_svg]:size-5",onClick:()=>p("year"),children:e.jsx(N.Grid3x3,{strokeWidth:1.8})}),l.includes("agenda")&&e.jsx(O,{"aria-label":"View by agenda",size:"icon",variant:t==="agenda"?"default":"outline",className:"-ml-px rounded-l-none [&_svg]:size-5",onClick:()=>p("agenda"),children:e.jsx(N.CalendarRange,{strokeWidth:1.8})})]}),j&&e.jsx(Nt,{})]}),a&&e.jsx(L,{children:e.jsxs(O,{className:b("w-full sm:w-auto",f),children:[e.jsx(N.Plus,{}),"Add Event"]})})]})]})}function Xr({day:t,date:s,events:r}){const{setSelectedDate:n}=C(),d=3,c=r.length,i=()=>{n(s)};return e.jsxs("button",{onClick:i,type:"button",className:"flex h-11 flex-1 flex-col items-center justify-start gap-0.5 rounded-md pt-1 hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsx("div",{className:b("flex size-6 items-center justify-center rounded-full text-xs font-medium",o.isToday(s)&&"bg-primary font-semibold text-primary-foreground"),children:t}),c>0&&e.jsx("div",{className:"mt-0.5 flex gap-0.5",children:c<=d?r.map(a=>e.jsx("div",{className:b("size-1.5 rounded-full",a.color==="blue"&&"bg-blue-600",a.color==="green"&&"bg-green-600",a.color==="red"&&"bg-red-600",a.color==="yellow"&&"bg-yellow-600",a.color==="purple"&&"bg-purple-600",a.color==="orange"&&"bg-orange-600",a.color==="gray"&&"bg-neutral-600")},a.id)):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:b("size-1.5 rounded-full",r[0].color==="blue"&&"bg-blue-600",r[0].color==="green"&&"bg-green-600",r[0].color==="red"&&"bg-red-600",r[0].color==="yellow"&&"bg-yellow-600",r[0].color==="purple"&&"bg-purple-600",r[0].color==="orange"&&"bg-orange-600")}),e.jsxs("span",{className:"text-[7px] text-muted-foreground",children:["+",c-1]})]})})]})}function Jr({month:t,events:s}){const{setSelectedDate:r}=C(),n=o.format(t,"MMMM"),d=v.useMemo(()=>{const a=o.getDaysInMonth(t),l=o.startOfMonth(t).getDay(),u=Array.from({length:a},(g,h)=>h+1);return[...Array(l).fill(null),...u]},[t]),c=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i=()=>{r(new Date(t.getFullYear(),t.getMonth(),1))};return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("button",{type:"button",onClick:i,className:"w-full rounded-t-lg border px-3 py-2 text-sm font-semibold hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:n}),e.jsxs("div",{className:"flex-1 space-y-2 rounded-b-lg border border-t-0 p-3",children:[e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 text-center",children:c.map((a,l)=>e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:a},l))}),e.jsx("div",{className:"grid grid-cols-7 gap-x-0.5 gap-y-2",children:d.map((a,l)=>{if(a===null)return e.jsx("div",{className:"h-10"},`blank-${l}`);const u=new Date(t.getFullYear(),t.getMonth(),a),x=s.filter(g=>o.isSameDay(o.parseISO(g.startDate),u)||o.isSameDay(o.parseISO(g.endDate),u));return e.jsx(Xr,{day:a,date:u,events:x},`day-${a}`)})})]})]})}function Gt({allEvents:t}){const{selectedDate:s}=C(),r=v.useMemo(()=>{const n=o.startOfYear(s);return Array.from({length:12},(d,c)=>o.addMonths(n,c))},[s]);return e.jsx("div",{className:"p-4",children:e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:r.map(n=>e.jsx(Jr,{month:n,events:t},n.toString()))})})}const Qr=ee.cva("size-2 rounded-full",{variants:{color:{blue:"bg-blue-600 dark:bg-blue-500",green:"bg-green-600 dark:bg-green-500",red:"bg-red-600 dark:bg-red-500",yellow:"bg-yellow-600 dark:bg-yellow-500",purple:"bg-purple-600 dark:bg-purple-500",gray:"bg-neutral-600 dark:bg-neutral-500",orange:"bg-orange-600 dark:bg-orange-500"}},defaultVariants:{color:"blue"}});function es({color:t,className:s}){return e.jsx("div",{className:b(Qr({color:t,className:s}))})}function rt(){const{updateEvent:t}=C();return{updateEvent:t}}const _e={EVENT:"event"};function st({event:t,children:s}){const r=v.useRef(null),[{isDragging:n},d,c]=me.useDrag(()=>({type:_e.EVENT,item:()=>{var l,u;const i=((l=r.current)==null?void 0:l.offsetWidth)||0,a=((u=r.current)==null?void 0:u.offsetHeight)||0;return{event:t,children:s,width:i,height:a}},collect:i=>({isDragging:i.isDragging()})}));return v.useEffect(()=>{c(gt.getEmptyImage(),{captureDraggingState:!0})},[c]),d(r),e.jsx("div",{ref:r,className:b(n&&"opacity-40"),children:s})}function Kt({cell:t,children:s}){const{updateEvent:r}=rt(),[{isOver:n,canDrop:d},c]=me.useDrop(()=>({accept:_e.EVENT,drop:i=>{const a=i.event,l=o.parseISO(a.startDate),u=o.parseISO(a.endDate),x=o.differenceInMilliseconds(u,l),g=new Date(t.date);g.setHours(l.getHours(),l.getMinutes(),l.getSeconds(),l.getMilliseconds());const h=new Date(g.getTime()+x);return r({...a,startDate:g.toISOString(),endDate:h.toISOString()}),{moved:!0}},collect:i=>({isOver:i.isOver(),canDrop:i.canDrop()})}),[t.date,r]);return e.jsx("div",{ref:c,className:b(n&&d&&"bg-accent/50"),children:s})}function Zt({children:t,event:s,onEventUpdated:r,showFormDisclaimer:n=!0}){const{isOpen:d,onClose:c,onToggle:i}=ke(),{users:a,updateEvent:l,singleUser:u,currentUser:x}=C(),g=te.useForm({resolver:Rt(tt(u)),defaultValues:{user:u&&(x==null?void 0:x.id)||s.user.id,title:s.title,description:s.description,startDate:o.parseISO(s.startDate),startTime:{hour:o.parseISO(s.startDate).getHours(),minute:o.parseISO(s.startDate).getMinutes()},endDate:o.parseISO(s.endDate),endTime:{hour:o.parseISO(s.endDate).getHours(),minute:o.parseISO(s.endDate).getMinutes()},color:s.color}}),h=async f=>{try{const m=u?x:a.find(k=>k.id===f.user);if(!m){u||g.setError("user",{message:"User not found"});return}const p=new Date(f.startDate);p.setHours(f.startTime.hour,f.startTime.minute,0,0);const j=new Date(f.endDate);j.setHours(f.endTime.hour,f.endTime.minute,0,0);const S=await l({...s,user:m,title:f.title,color:f.color,description:f.description,startDate:p.toISOString(),endDate:j.toISOString()});r==null||r(S),c()}catch(m){console.error("Failed to update event:",m)}};return e.jsxs(Oe,{open:d,onOpenChange:i,children:[e.jsx(Ee,{asChild:!0,children:t}),e.jsxs(fe,{children:[e.jsxs(ge,{children:[e.jsx(pe,{children:"Edit Event"}),n&&e.jsx(Te,{className:"mt-2",children:"Update the event details. Changes will be saved according to your API configuration."})]}),e.jsx(Je,{...g,children:e.jsxs("form",{id:"event-form",onSubmit:g.handleSubmit(h),className:"grid gap-4 py-4",children:[!u&&e.jsx(A,{control:g.control,name:"user",render:({field:f,fieldState:m})=>e.jsxs(E,{children:[e.jsx(T,{children:"Responsible"}),e.jsx(_,{children:e.jsxs(J,{value:f.value,onValueChange:f.onChange,children:[e.jsx(U,{"data-invalid":m.invalid,children:e.jsx(Q,{placeholder:"Select an option"})}),e.jsx(Y,{children:a.map(p=>e.jsx(I,{value:p.id,className:"flex-1",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(oe,{className:"size-6",children:[e.jsx(ie,{src:p.picturePath??void 0,alt:p.name}),e.jsx(le,{className:"text-xxs",children:p.name[0]})]},p.id),e.jsx("p",{className:"truncate",children:p.name})]})},p.id))})]})}),e.jsx(z,{})]})}),e.jsx(A,{control:g.control,name:"title",render:({field:f,fieldState:m})=>e.jsxs(E,{children:[e.jsx(T,{htmlFor:"title",children:"Title"}),e.jsx(_,{children:e.jsx(Ie,{id:"title",placeholder:"Enter a title","data-invalid":m.invalid,...f})}),e.jsx(z,{})]})}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(A,{control:g.control,name:"startDate",render:({field:f,fieldState:m})=>e.jsxs(E,{className:"flex-1",children:[e.jsx(T,{htmlFor:"startDate",children:"Start Date"}),e.jsx(_,{children:e.jsx(ue,{id:"startDate",value:f.value,onSelect:p=>f.onChange(p),placeholder:"Select a date","data-invalid":m.invalid})}),e.jsx(z,{})]})}),e.jsx(A,{control:g.control,name:"startTime",render:({field:f,fieldState:m})=>e.jsxs(E,{className:"flex-1",children:[e.jsx(T,{children:"Start Time"}),e.jsx(_,{children:e.jsx(W,{value:f.value,onChange:f.onChange,hourCycle:12,"data-invalid":m.invalid})}),e.jsx(z,{})]})})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(A,{control:g.control,name:"endDate",render:({field:f,fieldState:m})=>e.jsxs(E,{className:"flex-1",children:[e.jsx(T,{children:"End Date"}),e.jsx(_,{children:e.jsx(ue,{value:f.value,onSelect:p=>f.onChange(p),placeholder:"Select a date","data-invalid":m.invalid})}),e.jsx(z,{})]})}),e.jsx(A,{control:g.control,name:"endTime",render:({field:f,fieldState:m})=>e.jsxs(E,{className:"flex-1",children:[e.jsx(T,{children:"End Time"}),e.jsx(_,{children:e.jsx(W,{value:f.value,onChange:f.onChange,hourCycle:12,"data-invalid":m.invalid})}),e.jsx(z,{})]})})]}),e.jsx(A,{control:g.control,name:"color",render:({field:f,fieldState:m})=>e.jsxs(E,{children:[e.jsx(T,{children:"Color"}),e.jsx(_,{children:e.jsxs(J,{value:f.value,onValueChange:f.onChange,children:[e.jsx(U,{"data-invalid":m.invalid,children:e.jsx(Q,{placeholder:"Select an option"})}),e.jsxs(Y,{children:[e.jsx(I,{value:"blue",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-blue-600"}),"Blue"]})}),e.jsx(I,{value:"green",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-green-600"}),"Green"]})}),e.jsx(I,{value:"red",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-red-600"}),"Red"]})}),e.jsx(I,{value:"yellow",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-yellow-600"}),"Yellow"]})}),e.jsx(I,{value:"purple",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-purple-600"}),"Purple"]})}),e.jsx(I,{value:"orange",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-orange-600"}),"Orange"]})}),e.jsx(I,{value:"gray",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-3.5 rounded-full bg-neutral-600"}),"Gray"]})})]})]})}),e.jsx(z,{})]})}),e.jsx(A,{control:g.control,name:"description",render:({field:f,fieldState:m})=>e.jsxs(E,{children:[e.jsx(T,{children:"Description"}),e.jsx(_,{children:e.jsx(Ce,{...f,value:f.value,"data-invalid":m.invalid})}),e.jsx(z,{})]})})]})}),e.jsxs(he,{children:[e.jsx(Qe,{asChild:!0,children:e.jsx(O,{type:"button",variant:"outline",children:"Cancel"})}),e.jsx(O,{form:"event-form",type:"submit",children:"Save changes"})]})]})]})}function ze({event:t,children:s}){const r=o.parseISO(t.startDate),n=o.parseISO(t.endDate);return e.jsx(e.Fragment,{children:e.jsxs(Oe,{children:[e.jsx(Ee,{asChild:!0,children:s}),e.jsxs(fe,{children:[e.jsx(ge,{children:e.jsx(pe,{children:t.title})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(N.User,{className:"mt-1 size-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Responsible"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.user.name})]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(N.Calendar,{className:"mt-1 size-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Start Date"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:o.format(r,"MMM d, yyyy h:mm a")})]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(N.Clock,{className:"mt-1 size-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"End Date"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:o.format(n,"MMM d, yyyy h:mm a")})]})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(N.Text,{className:"mt-1 size-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Description"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.description})]})]})]}),e.jsx(he,{children:e.jsx(Zt,{event:t,children:e.jsx(O,{type:"button",variant:"outline",children:"Edit"})})})]})]})})}const ts=ee.cva("mx-1 flex size-auto h-6.5 select-none items-center justify-between gap-1.5 truncate whitespace-nowrap rounded-md border px-2 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",{variants:{color:{blue:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300 [&_.event-dot]:fill-blue-600",green:"border-green-200 bg-green-50 text-green-700 dark:border-green-800 dark:bg-green-950 dark:text-green-300 [&_.event-dot]:fill-green-600",red:"border-red-200 bg-red-50 text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300 [&_.event-dot]:fill-red-600",yellow:"border-yellow-200 bg-yellow-50 text-yellow-700 dark:border-yellow-800 dark:bg-yellow-950 dark:text-yellow-300 [&_.event-dot]:fill-yellow-600",purple:"border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-300 [&_.event-dot]:fill-purple-600",orange:"border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-800 dark:bg-orange-950 dark:text-orange-300 [&_.event-dot]:fill-orange-600",gray:"border-neutral-200 bg-neutral-50 text-neutral-900 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300 [&_.event-dot]:fill-neutral-600","blue-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-blue-600","green-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-green-600","red-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-red-600","yellow-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-yellow-600","purple-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-purple-600","orange-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-orange-600","gray-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-neutral-600"},multiDayPosition:{first:"relative z-10 mr-0 w-[calc(100%_-_3px)] rounded-r-none border-r-0 [&>span]:mr-2.5",middle:"relative z-10 mx-0 w-[calc(100%_+_1px)] rounded-none border-x-0",last:"ml-0 rounded-l-none border-l-0",none:""}},defaultVariants:{color:"blue-dot"}});function nt({event:t,cellDate:s,eventCurrentDay:r,eventTotalDays:n,className:d,position:c}){const{badgeVariant:i}=C(),a=o.startOfDay(o.parseISO(t.startDate)),l=o.endOfDay(o.parseISO(t.endDate));if(s<a||s>l)return null;let u;c?u=c:r&&n||o.isSameDay(a,l)?u="none":o.isSameDay(s,a)?u="first":o.isSameDay(s,l)?u="last":u="middle";const x=["first","none"].includes(u),g=i==="dot"?`${t.color}-dot`:t.color,h=b(ts({color:g,multiDayPosition:u,className:d})),f=m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),m.currentTarget instanceof HTMLElement&&m.currentTarget.click())};return e.jsx(st,{event:t,children:e.jsx(ze,{event:t,children:e.jsxs("div",{role:"button",tabIndex:0,className:h,onKeyDown:f,children:[e.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[!["middle","last"].includes(u)&&["mixed","dot"].includes(i)&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0",children:e.jsx("circle",{cx:"4",cy:"4",r:"4"})}),x&&e.jsxs("p",{className:"flex-1 truncate font-semibold",children:[r&&e.jsxs("span",{className:"text-xs",children:["Day ",r," of ",n," •"," "]}),t.title]})]}),x&&e.jsx("span",{children:o.format(new Date(t.startDate),"h:mm a")})]})})})}const Re=3;function rs({cell:t,events:s,eventPositions:r}){const{setSelectedDate:n}=C(),{day:d,currentMonth:c,date:i}=t,a=v.useMemo(()=>Tt(i,s,r),[i,s,r]),l=i.getDay()===0,u=()=>{n(i)};return e.jsx(Kt,{cell:t,children:e.jsxs("div",{className:b("flex h-full flex-col gap-1 border-l border-t py-1.5 lg:pb-2 lg:pt-1",l&&"border-l-0"),children:[e.jsx("button",{onClick:u,className:b("flex size-6 translate-x-1 items-center justify-center rounded-full text-xs font-semibold hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring lg:px-2",!c&&"opacity-20",o.isToday(i)&&"bg-primary font-bold text-primary-foreground hover:bg-primary"),children:d}),e.jsx("div",{className:b("flex h-6 gap-1 px-2 lg:h-[94px] lg:flex-col lg:gap-2 lg:px-0",!c&&"opacity-50"),children:[0,1,2].map(x=>{const g=a.find(f=>f.position===x),h=g?`event-${g.id}-${x}`:`empty-${x}`;return e.jsx("div",{className:"lg:flex-1",children:g&&e.jsxs(e.Fragment,{children:[e.jsx(es,{className:"lg:hidden",color:g.color}),e.jsx(nt,{className:"hidden lg:flex",event:g,cellDate:o.startOfDay(i)})]})},h)})}),a.length>Re&&e.jsxs("p",{className:b("h-4.5 px-1.5 text-xs font-semibold text-muted-foreground",!c&&"opacity-50"),children:[e.jsxs("span",{className:"sm:hidden",children:["+",a.length-Re]}),e.jsxs("span",{className:"hidden sm:inline",children:[" ",a.length-Re," more..."]})]})]})})}const ss=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Xt({singleDayEvents:t,multiDayEvents:s}){const{selectedDate:r}=C(),n=[...s,...t],d=v.useMemo(()=>Ot(r),[r]),c=v.useMemo(()=>Et(s,t,r),[s,t,r]);return e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-7 divide-x",children:ss.map(i=>e.jsx("div",{className:"flex items-center justify-center py-2",children:e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:i})},i))}),e.jsx("div",{className:"grid grid-cols-7 overflow-hidden",children:d.map(i=>e.jsx(rs,{cell:i,events:n,eventPositions:c},i.date.toISOString()))})]})}const de=D.forwardRef(({className:t,children:s,...r},n)=>e.jsxs(Z.Root,{ref:n,className:b("relative overflow-hidden",t),...r,children:[e.jsx(Z.Viewport,{className:"size-full rounded-[inherit]",children:s}),e.jsx(at,{}),e.jsx(Z.Corner,{})]}));de.displayName=Z.Root.displayName;const at=D.forwardRef(({className:t,orientation:s="vertical",...r},n)=>e.jsx(Z.ScrollAreaScrollbar,{ref:n,orientation:s,className:b("flex touch-none select-none transition-colors",s==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:e.jsx(Z.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));at.displayName=Z.ScrollAreaScrollbar.displayName;const ns=ee.cva("flex select-none items-center justify-between gap-3 rounded-md border p-3 text-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",{variants:{color:{blue:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300 [&_.event-dot]:fill-blue-600",green:"border-green-200 bg-green-50 text-green-700 dark:border-green-800 dark:bg-green-950 dark:text-green-300 [&_.event-dot]:fill-green-600",red:"border-red-200 bg-red-50 text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300 [&_.event-dot]:fill-red-600",yellow:"border-yellow-200 bg-yellow-50 text-yellow-700 dark:border-yellow-800 dark:bg-yellow-950 dark:text-yellow-300 [&_.event-dot]:fill-yellow-600",purple:"border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-300 [&_.event-dot]:fill-purple-600",orange:"border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-800 dark:bg-orange-950 dark:text-orange-300 [&_.event-dot]:fill-orange-600",gray:"border-neutral-200 bg-neutral-50 text-neutral-900 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300 [&_.event-dot]:fill-neutral-600","blue-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-blue-600","green-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-green-600","red-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-red-600","orange-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-orange-600","purple-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-purple-600","yellow-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-yellow-600","gray-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-neutral-600"}},defaultVariants:{color:"blue-dot"}});function ft({event:t,eventCurrentDay:s,eventTotalDays:r,className:n}){const{badgeVariant:d}=C(),c=o.parseISO(t.startDate),i=o.parseISO(t.endDate),a=d==="dot"?`${t.color}-dot`:t.color,l=ns({color:a,className:n}),u=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.currentTarget instanceof HTMLElement&&x.currentTarget.click())};return e.jsx(ze,{event:t,children:e.jsx("div",{role:"button",tabIndex:0,className:l,onKeyDown:u,children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[["mixed","dot"].includes(d)&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0",children:e.jsx("circle",{cx:"4",cy:"4",r:"4"})}),e.jsxs("p",{className:"font-medium",children:[s&&r&&e.jsxs("span",{className:"mr-1 text-xs",children:["Day ",s," of ",r," •"," "]}),t.title]})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[e.jsx(N.User,{className:"size-3 shrink-0"}),e.jsx("p",{className:"text-xs text-foreground",children:t.user.name})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(N.Clock,{className:"size-3 shrink-0"}),e.jsxs("p",{className:"text-xs text-foreground",children:[o.format(c,"h:mm a")," - ",o.format(i,"h:mm a")]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(N.Text,{className:"size-3 shrink-0"}),e.jsx("p",{className:"text-xs text-foreground",children:t.description})]})]})})})}function as({date:t,events:s,multiDayEvents:r}){const n=[...s].sort((d,c)=>new Date(d.startDate).getTime()-new Date(c.startDate).getTime());return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"sticky top-0 flex items-center gap-4 bg-background py-2",children:e.jsx("p",{className:"text-sm font-semibold",children:o.format(t,"EEEE, MMMM d, yyyy")})}),e.jsxs("div",{className:"space-y-2",children:[r.length>0&&r.map(d=>{const c=o.startOfDay(o.parseISO(d.startDate)),i=o.startOfDay(o.parseISO(d.endDate)),a=o.startOfDay(t),l=o.differenceInDays(i,c)+1,u=o.differenceInDays(a,c)+1;return e.jsx(ft,{event:d,eventCurrentDay:u,eventTotalDays:l},d.id)}),n.length>0&&n.map(d=>e.jsx(ft,{event:d},d.id))]})]})}function Jt({singleDayEvents:t,multiDayEvents:s}){const{selectedDate:r}=C(),n=v.useMemo(()=>{const c=new Map;return t.forEach(i=>{var u;const a=o.parseISO(i.startDate);if(!o.isSameMonth(a,r))return;const l=o.format(a,"yyyy-MM-dd");c.has(l)||c.set(l,{date:o.startOfDay(a),events:[],multiDayEvents:[]}),(u=c.get(l))==null||u.events.push(i)}),s.forEach(i=>{var g;const a=o.parseISO(i.startDate),l=o.parseISO(i.endDate);let u=o.startOfDay(a);const x=o.endOfDay(l);for(;u<=x;){if(o.isSameMonth(u,r)){const h=o.format(u,"yyyy-MM-dd");c.has(h)||c.set(h,{date:new Date(u),events:[],multiDayEvents:[]}),(g=c.get(h))==null||g.multiDayEvents.push(i)}u=new Date(u.setDate(u.getDate()+1))}}),Array.from(c.values()).sort((i,a)=>i.date.getTime()-a.date.getTime())},[t,s,r]),d=t.length>0||s.length>0;return e.jsx("div",{className:"h-[800px]",children:e.jsx(de,{className:"h-full",type:"always",children:e.jsxs("div",{className:"space-y-6 p-4",children:[n.map(c=>e.jsx(as,{date:c.date,events:c.events,multiDayEvents:c.multiDayEvents},o.format(c.date,"yyyy-MM-dd"))),!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-20 text-muted-foreground",children:[e.jsx(N.CalendarX2,{className:"size-10"}),e.jsx("p",{className:"text-sm md:text-base",children:"No events scheduled for the selected month"})]})]})})})}const os=ee.cva("flex select-none flex-col gap-0.5 truncate whitespace-nowrap rounded-md border px-2 py-1.5 text-xs focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",{variants:{color:{blue:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-300 [&_.event-dot]:fill-blue-600",green:"border-green-200 bg-green-50 text-green-700 dark:border-green-800 dark:bg-green-950 dark:text-green-300 [&_.event-dot]:fill-green-600",red:"border-red-200 bg-red-50 text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300 [&_.event-dot]:fill-red-600",yellow:"border-yellow-200 bg-yellow-50 text-yellow-700 dark:border-yellow-800 dark:bg-yellow-950 dark:text-yellow-300 [&_.event-dot]:fill-yellow-600",purple:"border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-300 [&_.event-dot]:fill-purple-600",orange:"border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-800 dark:bg-orange-950 dark:text-orange-300 [&_.event-dot]:fill-orange-600",gray:"border-neutral-200 bg-neutral-50 text-neutral-700 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300 [&_.event-dot]:fill-neutral-600","blue-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-blue-600","green-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-green-600","red-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-red-600","orange-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-orange-600","purple-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-purple-600","yellow-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-yellow-600","gray-dot":"bg-neutral-50 dark:bg-neutral-900 [&_.event-dot]:fill-neutral-600"}},defaultVariants:{color:"blue-dot"}});function Qt({event:t,className:s}){const{badgeVariant:r}=C(),n=o.parseISO(t.startDate),d=o.parseISO(t.endDate),c=o.differenceInMinutes(d,n),i=c/60*96-8,a=r==="dot"?`${t.color}-dot`:t.color,l=b(os({color:a,className:s}),c<35&&"py-0 justify-center"),u=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),x.currentTarget instanceof HTMLElement&&x.currentTarget.click())};return e.jsx(st,{event:t,children:e.jsx(ze,{event:t,children:e.jsxs("div",{role:"button",tabIndex:0,className:l,style:{height:`${i}px`},onKeyDown:u,children:[e.jsxs("div",{className:"flex items-center gap-1.5 truncate",children:[["mixed","dot"].includes(r)&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"event-dot shrink-0",children:e.jsx("circle",{cx:"4",cy:"4",r:"4"})}),e.jsx("p",{className:"truncate font-semibold",children:t.title})]}),c>25&&e.jsxs("p",{children:[o.format(n,"h:mm a")," - ",o.format(d,"h:mm a")]})]})})})}function $({date:t,hour:s,minute:r,children:n}){const{updateEvent:d}=rt(),[{isOver:c,canDrop:i},a]=me.useDrop(()=>({accept:_e.EVENT,drop:l=>{const u=l.event,x=o.parseISO(u.startDate),g=o.parseISO(u.endDate),h=o.differenceInMilliseconds(g,x),f=new Date(t);f.setHours(s,r,0,0);const m=new Date(f.getTime()+h);return d({...u,startDate:f.toISOString(),endDate:m.toISOString()}),{moved:!0}},collect:l=>({isOver:l.isOver(),canDrop:l.canDrop()})}),[t,s,r,d]);return e.jsx("div",{ref:a,className:b("h-[24px]",c&&i&&"bg-accent/50"),children:n})}function er({firstVisibleHour:t,lastVisibleHour:s}){const[r,n]=v.useState(new Date);v.useEffect(()=>{const a=setInterval(()=>n(new Date),6e4);return()=>clearInterval(a)},[]);const d=()=>{const a=r.getHours()*60+r.getMinutes(),l=t*60,x=s*60-l;return(a-l)/x*100},c=()=>o.format(r,"h:mm a"),i=r.getHours();return i<t||i>=s?null:e.jsxs("div",{className:"pointer-events-none absolute inset-x-0 z-50 border-t border-primary",style:{top:`${d()}%`},children:[e.jsx("div",{className:"absolute left-0 top-0 size-3 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary"}),e.jsx("div",{className:"absolute -left-18 flex w-16 -translate-y-1/2 justify-end bg-background pr-1 text-xs font-medium text-primary",children:c()})]})}function is({selectedDate:t,multiDayEvents:s}){const r=o.startOfDay(t),n=o.endOfDay(t),d=s.filter(c=>{const i=o.parseISO(c.startDate),a=o.parseISO(c.endDate);return o.isWithinInterval(r,{start:i,end:a})||o.isWithinInterval(n,{start:i,end:a})||i<=r&&a>=n}).sort((c,i)=>{const a=o.differenceInDays(o.parseISO(c.endDate),o.parseISO(c.startDate));return o.differenceInDays(o.parseISO(i.endDate),o.parseISO(i.startDate))-a});return d.length===0?null:e.jsxs("div",{className:"flex border-b",children:[e.jsx("div",{className:"w-18"}),e.jsx("div",{className:"flex flex-1 flex-col gap-1 border-l py-1",children:d.map(c=>{const i=o.startOfDay(o.parseISO(c.startDate)),a=o.startOfDay(o.parseISO(c.endDate)),l=o.startOfDay(t),u=o.differenceInDays(a,i)+1,x=o.differenceInDays(l,i)+1;return e.jsx(nt,{event:c,cellDate:t,eventCurrentDay:x,eventTotalDays:u},c.id)})})]})}function tr({singleDayEvents:t,multiDayEvents:s}){const{selectedDate:r,setSelectedDate:n,users:d,visibleHours:c,workingHours:i}=C(),{hours:a,earliestEventHour:l,latestEventHour:u}=Ke(c,t),x=Mt(t),g=t.filter(f=>{const m=o.parseISO(f.startDate);return m.getDate()===r.getDate()&&m.getMonth()===r.getMonth()&&m.getFullYear()===r.getFullYear()}),h=Ue(g);return e.jsxs("div",{className:"flex",children:[e.jsxs("div",{className:"flex flex-1 flex-col",children:[e.jsxs("div",{children:[e.jsx(is,{selectedDate:r,multiDayEvents:s}),e.jsxs("div",{className:"relative z-20 flex border-b",children:[e.jsx("div",{className:"w-18"}),e.jsxs("span",{className:"flex-1 border-l py-2 text-center text-xs font-medium text-muted-foreground",children:[o.format(r,"EE")," ",e.jsx("span",{className:"font-semibold text-foreground",children:o.format(r,"d")})]})]})]}),e.jsx(de,{className:"h-[800px]",type:"always",children:e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"relative w-18",children:a.map((f,m)=>e.jsx("div",{className:"relative",style:{height:"96px"},children:e.jsx("div",{className:"absolute -top-3 right-2 flex h-6 items-center",children:m!==0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:o.format(new Date().setHours(f,0,0,0),"hh a")})})},f))}),e.jsxs("div",{className:"relative flex-1 border-l",children:[e.jsxs("div",{className:"relative",children:[a.map((f,m)=>{const p=!Ge(r,f,i);return e.jsxs("div",{className:b("relative",p&&"bg-calendar-disabled-hour"),style:{height:"96px"},children:[m!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b"}),e.jsx($,{date:r,hour:f,minute:0,children:e.jsx(L,{startDate:r,startTime:{hour:f,minute:0},children:e.jsx("div",{className:"absolute inset-x-0 top-0 h-[24px] cursor-pointer transition-colors hover:bg-accent"})})}),e.jsx($,{date:r,hour:f,minute:15,children:e.jsx(L,{startDate:r,startTime:{hour:f,minute:15},children:e.jsx("div",{className:"absolute inset-x-0 top-[24px] h-[24px] cursor-pointer transition-colors hover:bg-accent"})})}),e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-1/2 border-b border-dashed"}),e.jsx($,{date:r,hour:f,minute:30,children:e.jsx(L,{startDate:r,startTime:{hour:f,minute:30},children:e.jsx("div",{className:"absolute inset-x-0 top-[48px] h-[24px] cursor-pointer transition-colors hover:bg-accent"})})}),e.jsx($,{date:r,hour:f,minute:45,children:e.jsx(L,{startDate:r,startTime:{hour:f,minute:45},children:e.jsx("div",{className:"absolute inset-x-0 top-[72px] h-[24px] cursor-pointer transition-colors hover:bg-accent"})})})]},f)}),h.map((f,m)=>f.map(p=>{let j=Ye(p,r,m,h.length,{from:l,to:u});return h.some((k,P)=>P!==m&&k.some(H=>o.areIntervalsOverlapping({start:o.parseISO(p.startDate),end:o.parseISO(p.endDate)},{start:o.parseISO(H.startDate),end:o.parseISO(H.endDate)})))||(j={...j,width:"100%",left:"0%"}),e.jsx("div",{className:"absolute p-1",style:j,children:e.jsx(Qt,{event:p})},p.id)}))]}),e.jsx(er,{firstVisibleHour:l,lastVisibleHour:u})]})]})})]}),e.jsxs("div",{className:"hidden w-64 divide-y border-l md:block",children:[e.jsx(Me,{className:"mx-auto w-fit",mode:"single",selected:r,onSelect:n,initialFocus:!0}),e.jsxs("div",{className:"flex-1 space-y-3",children:[x.length>0?e.jsxs("div",{className:"flex items-start gap-2 px-4 pt-4",children:[e.jsxs("span",{className:"relative mt-[5px] flex size-2.5",children:[e.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex size-2.5 rounded-full bg-green-600"})]}),e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Happening now"})]}):e.jsx("p",{className:"p-4 text-center text-sm italic text-muted-foreground",children:"No appointments or consultations at the moment"}),x.length>0&&e.jsx(de,{className:"h-[422px] px-4",type:"always",children:e.jsx("div",{className:"space-y-6 pb-4",children:x.map(f=>{const m=d.find(p=>p.id===f.user.id);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"line-clamp-2 text-sm font-semibold",children:f.title}),m&&e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(N.User,{className:"size-3.5"}),e.jsx("span",{className:"text-sm",children:m.name})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(N.Calendar,{className:"size-3.5"}),e.jsx("span",{className:"text-sm",children:o.format(new Date,"MMM d, yyyy")})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[e.jsx(N.Clock,{className:"size-3.5"}),e.jsxs("span",{className:"text-sm",children:[o.format(o.parseISO(f.startDate),"h:mm a")," - ",o.format(o.parseISO(f.endDate),"h:mm a")]})]})]},f.id)})})})]})]})]})}function ls({selectedDate:t,multiDayEvents:s}){const r=o.startOfWeek(t),n=o.endOfWeek(t),d=Array.from({length:7},(l,u)=>o.addDays(r,u)),c=v.useMemo(()=>s.map(l=>{const u=o.parseISO(l.startDate),x=o.parseISO(l.endDate),g=o.isBefore(u,r)?r:u,h=o.isAfter(x,n)?n:x,f=o.differenceInDays(g,r),m=o.differenceInDays(h,r);return{...l,adjustedStart:g,adjustedEnd:h,startIndex:f,endIndex:m}}).sort((l,u)=>{const x=l.adjustedStart.getTime()-u.adjustedStart.getTime();return x!==0?x:u.endIndex-u.startIndex-(l.endIndex-l.startIndex)}),[s,r,n]),i=v.useMemo(()=>{const l=[];return c.forEach(u=>{let x=l.findIndex(g=>g.every(h=>h.endIndex<u.startIndex||h.startIndex>u.endIndex));x===-1&&(x=l.length,l.push([])),l[x].push(u)}),l},[c]);return v.useMemo(()=>s.some(l=>{const u=o.parseISO(l.startDate),x=o.parseISO(l.endDate);return u>=r&&u<=n||x>=r&&x<=n||u<=r&&x>=n}),[s,r,n])?e.jsxs("div",{className:"hidden overflow-hidden sm:flex",children:[e.jsx("div",{className:"w-18 border-b"}),e.jsx("div",{className:"grid flex-1 grid-cols-7 divide-x border-b border-l",children:d.map((l,u)=>e.jsx("div",{className:"flex h-full flex-col gap-1 py-1",children:i.map((x,g)=>{const h=x.find(m=>m.startIndex<=u&&m.endIndex>=u);if(!h)return e.jsx("div",{className:"h-6.5"},`${g}-${u}`);let f="none";return u===h.startIndex&&u===h.endIndex?f="none":u===h.startIndex?f="first":u===h.endIndex?f="last":f="middle",e.jsx(nt,{event:h,cellDate:o.startOfDay(l),position:f},`${h.id}-${u}`)})},l.toISOString()))})]}):null}function rr({singleDayEvents:t,multiDayEvents:s}){const{selectedDate:r,workingHours:n,visibleHours:d}=C(),{hours:c,earliestEventHour:i,latestEventHour:a}=Ke(d,t),l=o.startOfWeek(r),u=Array.from({length:7},(x,g)=>o.addDays(l,g));return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center justify-center border-b py-4 text-sm text-muted-foreground sm:hidden",children:[e.jsx("p",{children:"Weekly view is not available on smaller devices."}),e.jsx("p",{children:"Please switch to daily or monthly view."})]}),e.jsxs("div",{className:"hidden flex-col sm:flex",children:[e.jsxs("div",{children:[e.jsx(ls,{selectedDate:r,multiDayEvents:s}),e.jsxs("div",{className:"relative z-20 flex border-b",children:[e.jsx("div",{className:"w-18"}),e.jsx("div",{className:"grid flex-1 grid-cols-7 divide-x border-l",children:u.map((x,g)=>e.jsxs("span",{className:"py-2 text-center text-xs font-medium text-muted-foreground",children:[o.format(x,"EE")," ",e.jsx("span",{className:"ml-1 font-semibold text-foreground",children:o.format(x,"d")})]},g))})]})]}),e.jsx(de,{className:"h-[736px]",type:"always",children:e.jsxs("div",{className:"flex overflow-hidden",children:[e.jsx("div",{className:"relative w-18",children:c.map((x,g)=>e.jsx("div",{className:"relative",style:{height:"96px"},children:e.jsx("div",{className:"absolute -top-3 right-2 flex h-6 items-center",children:g!==0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:o.format(new Date().setHours(x,0,0,0),"hh a")})})},x))}),e.jsxs("div",{className:"relative flex-1 border-l",children:[e.jsx("div",{className:"grid grid-cols-7 divide-x",children:u.map((x,g)=>{const h=t.filter(m=>o.isSameDay(o.parseISO(m.startDate),x)||o.isSameDay(o.parseISO(m.endDate),x)),f=Ue(h);return e.jsxs("div",{className:"relative",children:[c.map((m,p)=>{const j=!Ge(x,m,n);return e.jsxs("div",{className:b("relative",j&&"bg-calendar-disabled-hour"),style:{height:"96px"},children:[p!==0&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-b"}),e.jsx($,{date:x,hour:m,minute:0,children:e.jsx(L,{startDate:x,startTime:{hour:m,minute:0},children:e.jsx("div",{className:"absolute inset-x-0 top-0 h-[24px] cursor-pointer transition-colors hover:bg-accent"})})}),e.jsx($,{date:x,hour:m,minute:15,children:e.jsx(L,{startDate:x,startTime:{hour:m,minute:15},children:e.jsx("div",{className:"absolute inset-x-0 top-[24px] h-[24px] cursor-pointer transition-colors hover:bg-accent"})})}),e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-1/2 border-b border-dashed"}),e.jsx($,{date:x,hour:m,minute:30,children:e.jsx(L,{startDate:x,startTime:{hour:m,minute:30},children:e.jsx("div",{className:"absolute inset-x-0 top-[48px] h-[24px] cursor-pointer transition-colors hover:bg-accent"})})}),e.jsx($,{date:x,hour:m,minute:45,children:e.jsx(L,{startDate:x,startTime:{hour:m,minute:45},children:e.jsx("div",{className:"absolute inset-x-0 top-[72px] h-[24px] cursor-pointer transition-colors hover:bg-accent"})})})]},m)}),f.map((m,p)=>m.map(j=>{let S=Ye(j,x,p,f.length,{from:i,to:a});return f.some((P,H)=>H!==p&&P.some(re=>o.areIntervalsOverlapping({start:o.parseISO(j.startDate),end:o.parseISO(j.endDate)},{start:o.parseISO(re.startDate),end:o.parseISO(re.endDate)})))||(S={...S,width:"100%",left:"0%"}),e.jsx("div",{className:"absolute p-1",style:S,children:e.jsx(Qt,{event:j})},j.id)}))]},g)})}),e.jsx(er,{firstVisibleHour:i,lastVisibleHour:a})]})]})})]})]})}function ds({view:t,onViewChange:s,showHeader:r=!0,headerProps:n={},className:d,headerClassName:c,contentClassName:i}){const{selectedDate:a,selectedUserId:l,events:u}=C(),x=v.useMemo(()=>u.filter(m=>{const p=o.parseISO(m.startDate),j=o.parseISO(m.endDate);if(t==="year"){const S=new Date(a.getFullYear(),0,1),k=new Date(a.getFullYear(),11,31,23,59,59,999),P=p<=k&&j>=S,H=l==="all"||m.user.id===l;return P&&H}if(t==="month"||t==="agenda"){const S=new Date(a.getFullYear(),a.getMonth(),1),k=new Date(a.getFullYear(),a.getMonth()+1,0,23,59,59,999),P=p<=k&&j>=S,H=l==="all"||m.user.id===l;return P&&H}if(t==="week"){const S=a.getDay(),k=new Date(a);k.setDate(a.getDate()-S),k.setHours(0,0,0,0);const P=new Date(k);P.setDate(k.getDate()+6),P.setHours(23,59,59,999);const H=p<=P&&j>=k,re=l==="all"||m.user.id===l;return H&&re}if(t==="day"){const S=new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0),k=new Date(a.getFullYear(),a.getMonth(),a.getDate(),23,59,59),P=p<=k&&j>=S,H=l==="all"||m.user.id===l;return P&&H}}),[a,l,u,t]),g=x.filter(m=>{const p=o.parseISO(m.startDate),j=o.parseISO(m.endDate);return o.isSameDay(p,j)}),h=x.filter(m=>{const p=o.parseISO(m.startDate),j=o.parseISO(m.endDate);return!o.isSameDay(p,j)}),f=v.useMemo(()=>x.map(m=>({...m,endDate:m.startDate})),[x]);return e.jsxs("div",{className:b("overflow-hidden rounded-xl border",d),children:[r&&e.jsx(Yt,{view:t,events:x,onViewChange:s,className:b(c,n.className),...n}),e.jsx(vt,{children:e.jsxs("div",{className:i,children:[t==="day"&&e.jsx(tr,{singleDayEvents:g,multiDayEvents:h}),t==="month"&&e.jsx(Xt,{singleDayEvents:g,multiDayEvents:h}),t==="week"&&e.jsx(rr,{singleDayEvents:g,multiDayEvents:h}),t==="year"&&e.jsx(Gt,{allEvents:f}),t==="agenda"&&e.jsx(Jt,{singleDayEvents:g,multiDayEvents:h})]})})]})}function cs(){const{badgeVariant:t,setBadgeVariant:s}=C();return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Change badge variant"}),e.jsxs(J,{value:t,onValueChange:s,children:[e.jsx(U,{className:"w-48",children:e.jsx(Q,{})}),e.jsxs(Y,{children:[e.jsx(I,{value:"dot",children:"Dot"}),e.jsx(I,{value:"colored",children:"Colored"}),e.jsx(I,{value:"mixed",children:"Mixed"})]})]})]})}const ot=ae.Provider,it=ae.Root,lt=ae.Trigger,Pe=D.forwardRef(({className:t,sideOffset:s=4,...r},n)=>e.jsx(ae.Portal,{children:e.jsx(ae.Content,{ref:n,sideOffset:s,className:b("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground 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 origin-[--radix-tooltip-content-transform-origin]",t),...r})}));Pe.displayName=ae.Content.displayName;function us(){const{visibleHours:t,setVisibleHours:s}=C(),[r,n]=v.useState({hour:t.from,minute:0}),[d,c]=v.useState({hour:t.to,minute:0}),i=()=>{const a=d.hour===0?24:d.hour;s({from:r.hour,to:a})};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Change visible hours"}),e.jsx(ot,{delayDuration:100,children:e.jsxs(it,{children:[e.jsx(lt,{children:e.jsx(N.Info,{className:"size-3"})}),e.jsx(Pe,{className:"max-w-80 text-center",children:e.jsx("p",{children:"If an event falls outside the specified visible hours, the visible hours will automatically adjust to include that event."})})]})})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{children:"From"}),e.jsx(W,{id:"start-time",hourCycle:12,granularity:"hour",value:r,onChange:n}),e.jsx("p",{children:"To"}),e.jsx(W,{id:"end-time",hourCycle:12,granularity:"hour",value:d,onChange:c})]}),e.jsx(O,{className:"mt-4 w-fit",onClick:i,children:"Apply"})]})}const dt=D.forwardRef(({className:t,...s},r)=>e.jsx(Be.Root,{className:b("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...s,ref:r,children:e.jsx(Be.Thumb,{className:b("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));dt.displayName=Be.Root.displayName;const ms=[{index:0,name:"Sunday"},{index:1,name:"Monday"},{index:2,name:"Tuesday"},{index:3,name:"Wednesday"},{index:4,name:"Thursday"},{index:5,name:"Friday"},{index:6,name:"Saturday"}];function xs(){const{workingHours:t,setWorkingHours:s}=C(),[r,n]=v.useState({...t}),d=a=>{n(l=>({...l,[a]:l[a].from>0||l[a].to>0?{from:0,to:0}:{from:9,to:17}}))},c=(a,l,u)=>{u&&n(x=>{const g={...x[a],[l]:u.hour};return l==="to"&&u.hour===0&&g.from===0&&(g.to=24),{...x,[a]:g}})},i=()=>{const a={...r};for(const l in a){const u=a[parseInt(l)];r[parseInt(l)].from>0||r[parseInt(l)].to>0?u.from===0&&u.to===0?a[l]={from:0,to:24}:u.to===0&&u.from>0&&(a[l]={...u,to:24}):a[l]={from:0,to:0}}s(a)};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-semibold",children:"Change working hours"}),e.jsx(ot,{delayDuration:100,children:e.jsxs(it,{children:[e.jsx(lt,{children:e.jsx(N.Info,{className:"size-3"})}),e.jsx(Pe,{className:"max-w-80 text-center",children:e.jsx("p",{children:"This will apply a dashed background to the hour cells that fall outside the working hours — only for week and day views."})})]})})]}),e.jsx("div",{className:"space-y-4",children:ms.map(a=>{const l=r[a.index].from>0||r[a.index].to>0;return e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex w-40 items-center gap-2",children:[e.jsx(dt,{checked:l,onCheckedChange:()=>d(a.index)}),e.jsx("span",{className:"text-sm font-medium",children:a.name})]}),l?e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:"From"}),e.jsx(W,{id:`${a.name.toLowerCase()}-from`,hourCycle:12,granularity:"hour",value:{hour:r[a.index].from,minute:0},onChange:u=>c(a.index,"from",u)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:"To"}),e.jsx(W,{id:`${a.name.toLowerCase()}-to`,hourCycle:12,granularity:"hour",value:{hour:r[a.index].to,minute:0},onChange:u=>c(a.index,"to",u)})]})]}):e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(N.Moon,{className:"size-4"}),e.jsx("span",{children:"Closed"})]})]},a.index)})}),e.jsx(O,{className:"mt-4 w-fit",onClick:i,children:"Apply"})]})}const fs=X.Root,sr=D.forwardRef(({className:t,...s},r)=>e.jsx(X.Item,{ref:r,className:b("border-b",t),...s}));sr.displayName="AccordionItem";const nr=D.forwardRef(({className:t,children:s,...r},n)=>e.jsx(X.Header,{className:"flex",children:e.jsxs(X.Trigger,{ref:n,className:b("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",t),...r,children:[s,e.jsx(N.ChevronDown,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));nr.displayName=X.Trigger.displayName;const ar=D.forwardRef(({className:t,children:s,...r},n)=>e.jsx(X.Content,{ref:n,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:e.jsx("div",{className:b("pb-4 pt-0",t),children:s})}));ar.displayName=X.Content.displayName;function or({className:t,...s}){return e.jsx("div",{className:b("animate-pulse rounded-md bg-primary/10",t),...s})}const ct="big-calendar-theme",ir=60*60*24*365,we={theme:"dark"};function lr(t){document.cookie=`${ct}=${t}; path=/; max-age=${ir}`,document.documentElement.classList.remove("light","dark"),document.documentElement.classList.add(t)}function dr(){const[t,s]=v.useState();v.useEffect(()=>{const n=document.documentElement.classList.contains("dark")?"dark":"light";s(n)},[]);const r=()=>{const n=t==="light"?"dark":"light";lr(n),s(n)};return t?e.jsxs(O,{variant:"ghost",size:"icon",onClick:r,children:[t==="light"&&e.jsx(N.Sun,{}),t==="dark"&&e.jsx(N.Moon,{})]}):e.jsx(or,{className:"size-9"})}function gs(){return e.jsx("header",{className:"mx-auto flex h-[88px] w-full max-w-screen-2xl items-center justify-center",children:e.jsxs("div",{className:"my-3 flex h-14 w-full items-center justify-between px-8",children:[e.jsxs("div",{className:"flex items-center gap-3.5",children:[e.jsx("div",{className:"flex size-12 items-center justify-center rounded-full border p-3",children:e.jsx(N.Calendar,{className:"size-6 text-foreground"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-lg font-medium leading-6",children:"Big calendar"}),e.jsxs("p",{className:"text-sm text-foreground",children:["Built with React and Tailwind by"," ",e.jsxs("a",{href:"https://github.com/lramos33",target:"_blank",className:"inline-flex gap-0.5 text-sm underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:["lramos33",e.jsx(N.ArrowUpRight,{size:12,className:"text-foreground"})]})]})]})]}),e.jsxs("div",{className:"hidden items-center gap-4 md:flex",children:[e.jsxs("a",{href:"https://github.com/lramos33/big-calendar",target:"_blank",className:"inline-flex gap-0.5 text-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:["View on GitHub",e.jsx(N.ArrowUpRight,{size:14,className:"text-foreground"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{size:"icon",asChild:!0,variant:"ghost",children:e.jsx("a",{href:"https://x.com/leoo_ramos1",target:"_blank",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),e.jsx("path",{d:"M4 4l11.733 16h4.267l-11.733 -16z"}),e.jsx("path",{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"})]})})}),e.jsx(dr,{})]})]})]})})}const cr=["light","dark"];function hs(){var n;if(typeof document>"u")return we.theme;const s=document.cookie.split(";").find(d=>d.trim().startsWith(`${ct}=`));if(!s)return we.theme;const r=(n=s.split("=")[1])==null?void 0:n.trim();return cr.includes(r)?r:we.theme}const ps={variable:"--font-inter"};exports.Accordion=fs;exports.AccordionContent=ar;exports.AccordionItem=sr;exports.AccordionTrigger=nr;exports.AddEventDialog=L;exports.Avatar=oe;exports.AvatarFallback=le;exports.AvatarGroup=We;exports.AvatarImage=ie;exports.Badge=kt;exports.Button=O;exports.CalendarAgendaView=Jt;exports.CalendarDayView=tr;exports.CalendarHeader=Yt;exports.CalendarMonthView=Xt;exports.CalendarProvider=Fr;exports.CalendarWeekView=rr;exports.CalendarYearView=Gt;exports.ChangeBadgeVariantInput=cs;exports.ChangeVisibleHoursInput=us;exports.ChangeWorkingHoursInput=xs;exports.ClientContainer=ds;exports.CustomDragLayer=jt;exports.DEFAULT_VALUES=we;exports.DateNavigator=_t;exports.Dialog=Oe;exports.DialogClose=Qe;exports.DialogContent=fe;exports.DialogDescription=Te;exports.DialogFooter=he;exports.DialogHeader=ge;exports.DialogOverlay=et;exports.DialogPortal=Ut;exports.DialogTitle=pe;exports.DialogTrigger=Ee;exports.DndProviderWrapper=vt;exports.DraggableEvent=st;exports.DroppableDayCell=Kt;exports.DroppableTimeBlock=$;exports.EditEventDialog=Zt;exports.EventDetailsDialog=ze;exports.Form=Je;exports.FormControl=_;exports.FormDescription=$t;exports.FormField=A;exports.FormItem=E;exports.FormLabel=T;exports.FormMessage=z;exports.Header=gs;exports.Input=Ie;exports.ItemTypes=_e;exports.Label=Xe;exports.Popover=Bt;exports.PopoverAnchor=Gr;exports.PopoverContent=Ze;exports.PopoverTrigger=Lt;exports.ScrollArea=de;exports.ScrollBar=at;exports.Select=J;exports.SelectContent=Y;exports.SelectGroup=Ar;exports.SelectItem=I;exports.SelectLabel=yt;exports.SelectScrollDownButton=$e;exports.SelectScrollUpButton=qe;exports.SelectSeparator=Dt;exports.SelectTrigger=U;exports.SelectValue=Q;exports.SingleCalendar=Me;exports.SingleDayPicker=ue;exports.Skeleton=or;exports.Switch=dt;exports.THEMES_VALUES=cr;exports.THEME_COOKIE_MAX_AGE=ir;exports.THEME_COOKIE_NAME=ct;exports.Textarea=Ce;exports.TimeInput=W;exports.TodayButton=wt;exports.ToggleTheme=dr;exports.Tooltip=it;exports.TooltipContent=Pe;exports.TooltipProvider=ot;exports.TooltipTrigger=lt;exports.UserSelect=Nt;exports.badgeVariants=St;exports.buttonVariants=Se;exports.calculateMonthEventPositions=Et;exports.cn=b;exports.eventSchema=Zr;exports.getCalendarCells=Ot;exports.getCurrentEvents=Mt;exports.getEventBlockStyle=Ye;exports.getEventsCount=Ct;exports.getMonthCellEvents=Tt;exports.getTheme=hs;exports.getVisibleHours=Ke;exports.groupEvents=Ue;exports.inter=ps;exports.isWorkingHour=Ge;exports.navigateDate=Le;exports.rangeText=It;exports.setTheme=lr;exports.useCalendar=C;exports.useDisclosure=ke;exports.useFormField=xe;exports.useUpdateEvent=rt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("react"),r=require("date-fns"),Di=require("clsx"),Ni=require("tailwind-merge"),be=require("react-dnd"),fa=require("react-dnd-html5-backend"),N=require("lucide-react"),ha=require("@radix-ui/react-slot"),ee=require("class-variance-authority"),wi=require("@radix-ui/react-avatar"),Si=require("@radix-ui/react-select"),ae=require("react-hook-form"),je=require("@hookform/resolvers"),Ve=require("react-aria-components"),ki=require("react-day-picker"),Ii=require("@radix-ui/react-popover"),Ci=require("@radix-ui/react-label"),Mi=require("@radix-ui/react-dialog"),V=require("zod"),Oi=require("@radix-ui/react-scroll-area"),Ei=require("@radix-ui/react-tooltip"),Ti=require("@radix-ui/react-switch"),_i=require("@radix-ui/react-accordion");function q(a){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const i in a)if(i!=="default"){const t=Object.getOwnPropertyDescriptor(a,i);Object.defineProperty(l,i,t.get?t:{enumerable:!0,get:()=>a[i]})}}return l.default=a,Object.freeze(l)}const D=q(j),ge=q(wi),M=q(Si),te=q(Ii),pa=q(Ci),R=q(Mi),Z=q(Oi),ce=q(Ei),Be=q(Ti),X=q(_i),K=[{id:"dd503cf9-6c38-43cf-94cc-0d4032e2f77a",name:"Leonardo Ramos",picturePath:null},{id:"f3b035ac-49f7-4e92-a715-35680bf63175",name:"Michael Doe",picturePath:null},{id:"3e36ea6e-78f3-40dd-ab8c-a6c737c3c422",name:"Alice Johnson",picturePath:null},{id:"a7aff6bd-a50a-4d6a-ab57-76f76bb27cf5",name:"Robert Smith",picturePath:null}],ye=["blue","green","red","yellow","purple","orange","gray"],De=["Doctor's appointment","Dental cleaning","Eye exam","Therapy session","Business meeting","Team stand-up","Project deadline","Weekly report submission","Client presentation","Marketing strategy review","Networking event","Sales call","Investor pitch","Board meeting","Employee training","Performance review","One-on-one meeting","Lunch with a colleague","HR interview","Conference call","Web development sprint planning","Software deployment","Code review","QA testing session","Cybersecurity audit","Server maintenance","API integration update","Data backup","Cloud migration","System upgrade","Content planning session","Product launch","Customer support review","Team building activity","Legal consultation","Budget review","Financial planning session","Tax filing deadline","Investor relations update","Partnership negotiation","Medical check-up","Vaccination appointment","Blood donation","Gym workout","Yoga class","Physical therapy session","Nutrition consultation","Personal trainer session","Parent-teacher meeting","School open house","College application deadline","Final exam","Graduation ceremony","Job interview","Internship orientation","Office relocation","Business trip","Flight departure","Hotel check-in","Vacation planning","Birthday party","Wedding anniversary","Family reunion","Housewarming party","Community volunteer work","Charity fundraiser","Religious service","Concert attendance","Theater play","Movie night","Sporting event","Football match","Basketball game","Tennis practice","Marathon training","Cycling event","Fishing trip","Camping weekend","Hiking expedition","Photography session","Art workshop","Cooking class","Book club meeting","Grocery shopping","Car maintenance","Home renovation meeting"],zi=a=>{const l=[{id:1204,startDate:new Date("2025-09-20T00:00:00-03:00").toISOString(),endDate:new Date("2025-09-20T23:59:00-03:00").toISOString(),title:"My wedding :)",color:"red",description:"Can't wait to see the most beautiful woman in that dress!",user:K[0]}];let i=1;const t=K[Math.floor(Math.random()*K.length)],o=new Date,g=new Date(o);g.setDate(o.getDate()-30);const s=new Date(o);s.setDate(o.getDate()+30);const c={id:i++,startDate:new Date(o.getTime()-30*6e4).toISOString(),endDate:new Date(o.getTime()+30*6e4).toISOString(),title:De[Math.floor(Math.random()*De.length)],color:ye[Math.floor(Math.random()*ye.length)],description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",user:t};(o.getMonth()!==8||o.getDate()!==20)&&l.push(c);let n=0,d=0;const u=a*3;for(;n<a-1&&d<u;){d++;const x=Math.random()<.1,f=new Date(g.getTime()+Math.random()*(s.getTime()-g.getTime()));if(f.getMonth()===8&&f.getDate()===20)continue;f.setHours(8+Math.floor(Math.random()*8),Math.floor(Math.random()*4)*15,0,0);const m=new Date(f);if(x){const b=Math.floor(Math.random()*4)+1;m.setDate(f.getDate()+b);const h=m.getMonth(),v=m.getDate(),S=f.getMonth(),k=f.getDate();if(S===8&&k<20&&(h>8||h===8&&v>=20)||h===8&&v>=20&&(S<8||S===8&&k<20))continue;m.setHours(8+Math.floor(Math.random()*12),Math.floor(Math.random()*4)*15,0,0)}else{const b=(Math.floor(Math.random()*11)+2)*15;m.setTime(m.getTime()+b*60*1e3)}l.push({id:i++,startDate:f.toISOString(),endDate:m.toISOString(),title:De[Math.floor(Math.random()*De.length)],color:ye[Math.floor(Math.random()*ye.length)],description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",user:K[Math.floor(Math.random()*K.length)]}),n++}return l},ua=zi(80),va=j.createContext({}),Pi={0:{from:0,to:0},1:{from:8,to:17},2:{from:8,to:17},3:{from:8,to:17},4:{from:8,to:17},5:{from:8,to:17},6:{from:8,to:12}},Fi={from:7,to:18};function Ai({children:a,users:l,events:i,api:t={},useMocks:o=!1,singleUser:g=!1,currentUser:s,defaultSettings:c={},onSettingsChange:n,onEventCreate:d,onEventUpdate:u,onEventDelete:x}){const[f,m]=j.useState(c.badgeVariant||"colored"),[b,h]=j.useState(c.visibleHours||Fi),[v,S]=j.useState(c.workingHours||Pi),[k,P]=j.useState(new Date),[H,ie]=j.useState("all"),[pe,Fe]=j.useState(l||[]),[ba,B]=j.useState(i||[]),[bi,le]=j.useState(!1),ui=g?s||(pe.length>0?pe[0]:null)||(l&&l.length>0?l[0]:null):null,ve=o||!t.getEvents&&!i,Ae=o||!t.getUsers&&!l;j.useEffect(()=>{Ae&&pe.length===0?Fe(K):t.getUsers&&!Ae&&(le(!0),t.getUsers().then(y=>{Fe(y)}).catch(y=>{console.error("Failed to fetch users:",y),o&&Fe(K)}).finally(()=>{le(!1)}))},[t.getUsers,Ae,o]),j.useEffect(()=>{ve&&ba.length===0?B(ua):t.getEvents&&!ve&&(le(!0),t.getEvents().then(y=>{B(y)}).catch(y=>{console.error("Failed to fetch events:",y),o&&B(ua)}).finally(()=>{le(!1)}))},[t.getEvents,ve,o]);const mi=y=>{y&&P(y)},xi=y=>{m(y),n==null||n({badgeVariant:y,visibleHours:b,workingHours:v})},fi=y=>{h(y),n==null||n({badgeVariant:f,visibleHours:y,workingHours:v})},hi=y=>{S(y),n==null||n({badgeVariant:f,visibleHours:b,workingHours:y})},pi=j.useCallback(async y=>{if(t.createEvent)try{const w=await t.createEvent(y);return B(F=>[...F,w]),d==null||d(w),w}catch(w){throw console.error("Failed to create event:",w),w}else{const w={...y,id:Date.now()};return B(F=>[...F,w]),d==null||d(w),w}},[t.createEvent,d]),vi=j.useCallback(async y=>{if(t.updateEvent)try{const w=await t.updateEvent(y);return B(F=>{const G=F.findIndex(He=>He.id===y.id);return G===-1?F:[...F.slice(0,G),w,...F.slice(G+1)]}),u==null||u(w),w}catch(w){throw console.error("Failed to update event:",w),w}else{const w={...y};return B(F=>{const G=F.findIndex(He=>He.id===y.id);return G===-1?F:[...F.slice(0,G),w,...F.slice(G+1)]}),u==null||u(w),w}},[t.updateEvent,u]),ji=j.useCallback(async y=>{if(t.deleteEvent)try{await t.deleteEvent(y),B(w=>w.filter(F=>F.id!==y)),x==null||x(y)}catch(w){throw console.error("Failed to delete event:",w),w}else B(w=>w.filter(F=>F.id!==y)),x==null||x(y)},[t.deleteEvent,x]),yi=j.useCallback(async()=>{if(t.getEvents){le(!0);try{const y=await t.getEvents();B(y)}catch(y){console.error("Failed to refetch events:",y)}finally{le(!1)}}},[t.getEvents]);return e.jsx(va.Provider,{value:{selectedDate:k,setSelectedDate:mi,selectedUserId:H,setSelectedUserId:ie,badgeVariant:f,setBadgeVariant:xi,users:pe,visibleHours:b,setVisibleHours:fi,workingHours:v,setWorkingHours:hi,events:ba,setEvents:B,isLoading:bi,createEvent:pi,updateEvent:vi,deleteEvent:ji,refetchEvents:yi,api:t,useMocks:ve,singleUser:g,currentUser:ui},children:a})}function C(){const a=j.useContext(va);if(!a)throw new Error("useCalendar must be used within a CalendarProvider.");return a}function p(...a){return Ni.twMerge(Di.clsx(a))}function ja(){const{isDragging:a,item:l,currentOffset:i,initialOffset:t,initialClientOffset:o}=be.useDragLayer(n=>({item:n.getItem(),itemType:n.getItemType(),isDragging:n.isDragging(),currentOffset:n.getClientOffset(),initialOffset:n.getInitialSourceClientOffset(),initialClientOffset:n.getInitialClientOffset()}));if(!a||!l||!i||!t||!o)return null;const g=o.x-t.x,s=o.y-t.y,c={position:"fixed",pointerEvents:"none",zIndex:100,left:i.x-g,top:i.y-s};return e.jsx("div",{style:c,children:e.jsx("div",{className:"bigcal-pointer-events-none bigcal-rounded bigcal-border bigcal-shadow-md",style:{width:l.width,height:l.height},children:l.children})})}function ya({children:a}){return e.jsxs(be.DndProvider,{backend:fa.HTML5Backend,children:[a,e.jsx(ja,{})]})}const Se=ee.cva("bigcal-inline-flex bigcal-items-center bigcal-justify-center bigcal-gap-2 bigcal-whitespace-nowrap bigcal-rounded-md bigcal-text-sm bigcal-font-medium bigcal-transition-colors focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring disabled:bigcal-pointer-events-none disabled:bigcal-opacity-50 [&_svg]:bigcal-pointer-events-none [&_svg]:bigcal-size-4 [&_svg]:bigcal-shrink-0",{variants:{variant:{default:"bigcal-bg-primary bigcal-text-primary-foreground bigcal-shadow hover:bigcal-bg-primary/90",destructive:"bigcal-bg-destructive bigcal-text-destructive-foreground bigcal-shadow-sm hover:bigcal-bg-destructive/90",outline:"bigcal-border bigcal-border-input bigcal-bg-background bigcal-shadow-sm hover:bigcal-bg-accent hover:bigcal-text-accent-foreground",secondary:"bigcal-bg-secondary bigcal-text-secondary-foreground bigcal-shadow-sm hover:bigcal-bg-secondary/80",ghost:"hover:bigcal-bg-accent hover:bigcal-text-accent-foreground",link:"bigcal-text-primary bigcal-underline-offset-4 hover:bigcal-underline"},size:{default:"bigcal-h-9 bigcal-px-4 bigcal-py-2",sm:"bigcal-h-8 bigcal-rounded-md bigcal-px-3 bigcal-text-xs",lg:"bigcal-h-10 bigcal-rounded-md bigcal-px-8",icon:"bigcal-size-9"}},defaultVariants:{variant:"default",size:"default"}}),O=D.forwardRef(({className:a,variant:l,size:i,asChild:t=!1,...o},g)=>{const s=t?ha.Slot:"button";return e.jsx(s,{className:p(Se({variant:l,size:i,className:a})),ref:g,...o})});O.displayName="Button";const We=j.forwardRef(({className:a,children:l,max:i=1,spacing:t=10,...o},g)=>{const s=j.Children.toArray(l),c=j.useMemo(()=>e.jsxs(e.Fragment,{children:[s.slice(0,i).map((n,d)=>j.cloneElement(n,{className:p(n.props.className,"bigcal-border-2 bigcal-border-background"),style:{marginLeft:d===0?0:-t,...n.props.style}})),s.length>i&&e.jsx("div",{className:p("relative bigcal-flex bigcal-items-center bigcal-justify-center bigcal-rounded-full bigcal-border-2 bigcal-border-background bigcal-bg-muted",s[0].props.className),style:{marginLeft:-t},children:e.jsxs("p",{children:["+",s.length-i]})})]}),[s,i,t]);return e.jsx("div",{ref:g,className:p("relative bigcal-flex",a),...o,children:c})});We.displayName="AvatarGroup";const re=D.forwardRef(({className:a,...l},i)=>e.jsx(ge.Root,{ref:i,className:p("relative bigcal-flex bigcal-h-10 bigcal-w-10 bigcal-shrink-0 bigcal-overflow-hidden bigcal-rounded-full",a),...l}));re.displayName=ge.Root.displayName;const se=D.forwardRef(({className:a,...l},i)=>e.jsx(ge.Image,{ref:i,className:p("bigcal-aspect-square bigcal-h-full bigcal-w-full",a),...l}));se.displayName=ge.Image.displayName;const ne=D.forwardRef(({className:a,...l},i)=>e.jsx(ge.Fallback,{ref:i,className:p("bigcal-flex bigcal-h-full bigcal-w-full bigcal-items-center bigcal-justify-center bigcal-rounded-full bigcal-bg-muted",a),...l}));ne.displayName=ge.Fallback.displayName;const J=M.Root,Hi=M.Group,Q=M.Value,U=D.forwardRef(({className:a,children:l,...i},t)=>e.jsxs(M.Trigger,{ref:t,className:p("bigcal-flex bigcal-h-9 bigcal-w-full bigcal-items-center bigcal-justify-between bigcal-whitespace-nowrap bigcal-rounded-md bigcal-border bigcal-border-input bigcal-bg-transparent bigcal-px-3 bigcal-py-2 bigcal-text-sm bigcal-shadow-sm bigcal-ring-offset-background focus:bigcal-outline-none focus:bigcal-ring-1 focus:bigcal-ring-ring disabled:bigcal-cursor-not-allowed disabled:bigcal-opacity-50 data-[placeholder]:bigcal-text-muted-foreground [&>span]:bigcal-line-clamp-1",a),...i,children:[l,e.jsx(M.Icon,{asChild:!0,children:e.jsx(N.ChevronDown,{className:"bigcal-size-4 bigcal-opacity-50"})})]}));U.displayName=M.Trigger.displayName;const qe=D.forwardRef(({className:a,...l},i)=>e.jsx(M.ScrollUpButton,{ref:i,className:p("bigcal-flex bigcal-cursor-default bigcal-items-center bigcal-justify-center bigcal-py-1",a),...l,children:e.jsx(N.ChevronUp,{className:"bigcal-size-4"})}));qe.displayName=M.ScrollUpButton.displayName;const $e=D.forwardRef(({className:a,...l},i)=>e.jsx(M.ScrollDownButton,{ref:i,className:p("bigcal-flex bigcal-cursor-default bigcal-items-center bigcal-justify-center bigcal-py-1",a),...l,children:e.jsx(N.ChevronDown,{className:"bigcal-size-4"})}));$e.displayName=M.ScrollDownButton.displayName;const Y=D.forwardRef(({className:a,children:l,position:i="popper",...t},o)=>e.jsx(M.Portal,{children:e.jsxs(M.Content,{ref:o,className:p("bigcal-relative bigcal-z-50 bigcal-max-h-[--radix-select-content-available-height] bigcal-min-w-[8rem] bigcal-origin-[--radix-select-content-transform-origin] bigcal-overflow-y-auto bigcal-overflow-x-hidden bigcal-rounded-md bigcal-border bigcal-bg-popover bigcal-text-popover-foreground bigcal-shadow-md data-[state=open]:bigcal-animate-in data-[state=closed]:bigcal-animate-out data-[state=closed]:bigcal-fade-out-0 data-[state=open]:bigcal-fade-in-0 data-[state=closed]:bigcal-zoom-out-95 data-[state=open]:bigcal-zoom-in-95 data-[side=bottom]:bigcal-slide-in-from-top-2 data-[side=left]:bigcal-slide-in-from-right-2 data-[side=right]:bigcal-slide-in-from-left-2 data-[side=top]:bigcal-slide-in-from-bottom-2",i==="popper"&&"data-[side=bottom]:bigcal-translate-y-1 data-[side=left]:bigcal--translate-x-1 data-[side=right]:bigcal-translate-x-1 data-[side=top]:bigcal--translate-y-1",a),position:i,...t,children:[e.jsx(qe,{}),e.jsx(M.Viewport,{className:p("bigcal-p-1",i==="popper"&&"bigcal-h-[var(--radix-select-trigger-height)] bigcal-w-full bigcal-min-w-[var(--radix-select-trigger-width)]"),children:l}),e.jsx($e,{})]})}));Y.displayName=M.Content.displayName;const Da=D.forwardRef(({className:a,...l},i)=>e.jsx(M.Label,{ref:i,className:p("bigcal-px-2 bigcal-py-1.5 bigcal-text-sm bigcal-font-semibold",a),...l}));Da.displayName=M.Label.displayName;const I=D.forwardRef(({className:a,children:l,...i},t)=>e.jsxs(M.Item,{ref:t,className:p("bigcal-relative bigcal-flex bigcal-w-full bigcal-cursor-default bigcal-select-none bigcal-items-center bigcal-rounded-sm bigcal-py-1.5 bigcal-pl-2 bigcal-pr-8 bigcal-text-sm bigcal-outline-none focus:bigcal-bg-accent focus:bigcal-text-accent-foreground data-[disabled]:bigcal-pointer-events-none data-[disabled]:bigcal-opacity-50",a),...i,children:[e.jsx("span",{className:"bigcal-absolute bigcal-right-2 bigcal-flex bigcal-size-3.5 bigcal-items-center bigcal-justify-center",children:e.jsx(M.ItemIndicator,{children:e.jsx(N.Check,{className:"bigcal-size-4"})})}),e.jsx(M.ItemText,{children:l})]}));I.displayName=M.Item.displayName;const Na=D.forwardRef(({className:a,...l},i)=>e.jsx(M.Separator,{ref:i,className:p("bigcal--mx-1 bigcal-my-1 bigcal-h-px bigcal-bg-muted",a),...l}));Na.displayName=M.Separator.displayName;function wa(){const{users:a,selectedUserId:l,setSelectedUserId:i}=C();return e.jsxs(J,{value:l,onValueChange:i,children:[e.jsx(U,{className:"bigcal-flex-1 md:bigcal-w-48",children:e.jsx(Q,{})}),e.jsxs(Y,{align:"end",children:[e.jsx(I,{value:"all",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-1",children:[e.jsx(We,{max:2,children:a.map(t=>e.jsxs(re,{className:"bigcal-size-6 bigcal-text-xxs",children:[e.jsx(se,{src:t.picturePath??void 0,alt:t.name}),e.jsx(ne,{className:"bigcal-text-xxs",children:t.name[0]})]},t.id))}),"All"]})}),a.map(t=>e.jsx(I,{value:t.id,className:"bigcal-flex-1",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsxs(re,{className:"bigcal-size-6",children:[e.jsx(se,{src:t.picturePath??void 0,alt:t.name}),e.jsx(ne,{className:"bigcal-text-xxs",children:t.name[0]})]},t.id),e.jsx("p",{className:"bigcal-truncate",children:t.name})]})},t.id))]})]})}function Sa(){const{setSelectedDate:a}=C(),l=new Date,i=()=>a(l);return e.jsxs("button",{className:"bigcal-flex bigcal-size-14 bigcal-flex-col bigcal-items-start bigcal-overflow-hidden bigcal-rounded-lg bigcal-border focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring",onClick:i,children:[e.jsx("p",{className:"bigcal-flex bigcal-h-6 bigcal-w-full bigcal-items-center bigcal-justify-center bigcal-bg-primary bigcal-text-center bigcal-text-xs bigcal-font-semibold bigcal-text-primary-foreground",children:r.formatDate(l,"MMM").toUpperCase()}),e.jsx("p",{className:"bigcal-flex bigcal-w-full bigcal-items-center bigcal-justify-center bigcal-text-lg bigcal-font-bold",children:l.getDate()})]})}const ka=ee.cva("bigcal-inline-flex bigcal-items-center bigcal-rounded-md bigcal-border bigcal-px-2.5 bigcal-py-0.5 bigcal-text-xs bigcal-font-semibold bigcal-transition-colors focus:bigcal-outline-none focus:bigcal-ring-2 focus:bigcal-ring-ring focus:bigcal-ring-offset-2",{variants:{variant:{default:"bigcal-border-transparent bigcal-bg-primary bigcal-text-primary-foreground bigcal-shadow hover:bigcal-bg-primary/80",secondary:"bigcal-border-transparent bigcal-bg-secondary bigcal-text-secondary-foreground hover:bigcal-bg-secondary/80",destructive:"bigcal-border-transparent bigcal-bg-destructive bigcal-text-destructive-foreground bigcal-shadow hover:bigcal-bg-destructive/80",outline:"bigcal-text-foreground"}},defaultVariants:{variant:"default"}});function Ia({className:a,variant:l,...i}){return e.jsx("div",{className:p(ka({variant:l}),a),...i})}function Ca(a,l){const i="MMM d, yyyy";let t,o;switch(a){case"agenda":t=r.startOfMonth(l),o=r.endOfMonth(l);break;case"year":t=r.startOfYear(l),o=r.endOfYear(l);break;case"month":t=r.startOfMonth(l),o=r.endOfMonth(l);break;case"week":t=r.startOfWeek(l),o=r.endOfWeek(l);break;case"day":return r.format(l,i);default:return"Error while formatting "}return`${r.format(t,i)} - ${r.format(o,i)}`}function Le(a,l,i){return{agenda:i==="next"?r.addMonths:r.subMonths,year:i==="next"?r.addYears:r.subYears,month:i==="next"?r.addMonths:r.subMonths,week:i==="next"?r.addWeeks:r.subWeeks,day:i==="next"?r.addDays:r.subDays}[l](a,1)}function Ma(a,l,i){const t={agenda:r.isSameMonth,year:r.isSameYear,day:r.isSameDay,week:r.isSameWeek,month:r.isSameMonth};return a.filter(o=>t[i](new Date(o.startDate),l)).length}function Oa(a){const l=new Date;return a.filter(i=>r.isWithinInterval(l,{start:r.parseISO(i.startDate),end:r.parseISO(i.endDate)}))||null}function Ue(a){const l=a.sort((t,o)=>r.parseISO(t.startDate).getTime()-r.parseISO(o.startDate).getTime()),i=[];for(const t of l){const o=r.parseISO(t.startDate);let g=!1;for(const s of i){const c=s[s.length-1],n=r.parseISO(c.endDate);if(o>=n){s.push(t),g=!0;break}}g||i.push([t])}return i}function Ye(a,l,i,t,o){const g=r.parseISO(a.startDate),s=new Date(l.setHours(0,0,0,0)),c=g<s?s:g,n=r.differenceInMinutes(c,s);let d;if(o){const f=o.from*60,b=o.to*60-f;d=(n-f)/b*100}else d=n/1440*100;const u=100/t,x=i*u;return{top:`${d}%`,width:`${u}%`,left:`${x}%`}}function Ge(a,l,i){const t=a.getDay(),o=i[t];return l>=o.from&&l<o.to}function Ke(a,l){let i=a.from,t=a.to;return l.forEach(g=>{const s=r.parseISO(g.startDate).getHours(),c=r.parseISO(g.endDate),n=c.getHours()+(c.getMinutes()>0?1:0);s<i&&(i=s),n>t&&(t=n)}),t=Math.min(t,24),{hours:Array.from({length:t-i},(g,s)=>s+i),earliestEventHour:i,latestEventHour:t}}function Ea(a){const l=a.getFullYear(),i=a.getMonth(),t=(f,m)=>new Date(f,m+1,0).getDate(),o=(f,m)=>new Date(f,m,1).getDay(),g=t(l,i),s=o(l,i),c=t(l,i-1),n=s+g,d=Array.from({length:s},(f,m)=>({day:c-s+m+1,currentMonth:!1,date:new Date(l,i-1,c-s+m+1)})),u=Array.from({length:g},(f,m)=>({day:m+1,currentMonth:!0,date:new Date(l,i,m+1)})),x=Array.from({length:(7-n%7)%7},(f,m)=>({day:m+1,currentMonth:!1,date:new Date(l,i+1,m+1)}));return[...d,...u,...x]}function Ta(a,l,i){const t=r.startOfMonth(i),o=r.endOfMonth(i),g={},s={};return r.eachDayOfInterval({start:t,end:o}).forEach(n=>{s[n.toISOString()]=[!1,!1,!1]}),[...a.sort((n,d)=>{const u=r.differenceInDays(r.parseISO(n.endDate),r.parseISO(n.startDate));return r.differenceInDays(r.parseISO(d.endDate),r.parseISO(d.startDate))-u||r.parseISO(n.startDate).getTime()-r.parseISO(d.startDate).getTime()}),...l.sort((n,d)=>r.parseISO(n.startDate).getTime()-r.parseISO(d.startDate).getTime())].forEach(n=>{const d=r.parseISO(n.startDate),u=r.parseISO(n.endDate),x=r.eachDayOfInterval({start:d<t?t:d,end:u>o?o:u});let f=-1;for(let m=0;m<3;m++)if(x.every(b=>{const h=s[r.startOfDay(b).toISOString()];return h&&!h[m]})){f=m;break}f!==-1&&(x.forEach(m=>{const b=r.startOfDay(m).toISOString();s[b][f]=!0}),g[n.id]=f)}),g}function _a(a,l,i){return l.filter(o=>{const g=r.parseISO(o.startDate),s=r.parseISO(o.endDate);return a>=g&&a<=s||r.isSameDay(a,g)||r.isSameDay(a,s)}).map(o=>({...o,position:i[o.id]??-1,isMultiDay:o.startDate!==o.endDate})).sort((o,g)=>o.isMultiDay&&!g.isMultiDay?-1:!o.isMultiDay&&g.isMultiDay?1:o.position-g.position)}function za({view:a,events:l}){const{selectedDate:i,setSelectedDate:t}=C(),o=r.formatDate(i,"MMMM"),g=i.getFullYear(),s=j.useMemo(()=>Ma(l,i,a),[l,i,a]),c=()=>t(Le(i,a,"previous")),n=()=>t(Le(i,a,"next"));return e.jsxs("div",{className:"bigcal-space-y-0.5",children:[e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsxs("span",{className:"bigcal-text-lg bigcal-font-semibold",children:[o," ",g]}),e.jsxs(Ia,{variant:"outline",className:"bigcal-px-1.5",children:[s," events"]})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx(O,{variant:"outline",className:"bigcal-size-6.5 bigcal-px-0 bigcal-[&_svg]:bigcal-size-4.5",onClick:c,children:e.jsx(N.ChevronLeft,{})}),e.jsx("p",{className:"bigcal-text-sm bigcal-text-muted-foreground",children:Ca(a,i)}),e.jsx(O,{variant:"outline",className:"bigcal-size-6.5 bigcal-px-0 bigcal-[&_svg]:bigcal-size-4.5",onClick:n,children:e.jsx(N.ChevronRight,{})})]})]})}function Pa(a,l,i){function t(c,n){var d;Object.defineProperty(c,"_zod",{value:c._zod??{},enumerable:!1}),(d=c._zod).traits??(d.traits=new Set),c._zod.traits.add(a),l(c,n);for(const u in s.prototype)u in c||Object.defineProperty(c,u,{value:s.prototype[u].bind(c)});c._zod.constr=s,c._zod.def=n}const o=(i==null?void 0:i.Parent)??Object;class g extends o{}Object.defineProperty(g,"name",{value:a});function s(c){var n;const d=i!=null&&i.Parent?new g:this;t(d,c),(n=d._zod).deferred??(n.deferred=[]);for(const u of d._zod.deferred)u();return d}return Object.defineProperty(s,"init",{value:t}),Object.defineProperty(s,Symbol.hasInstance,{value:c=>{var n,d;return i!=null&&i.Parent&&c instanceof i.Parent?!0:(d=(n=c==null?void 0:c._zod)==null?void 0:n.traits)==null?void 0:d.has(a)}}),Object.defineProperty(s,"name",{value:a}),s}class Vi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Ri={};function Fa(a){return Ri}function Bi(a,l){return typeof l=="bigint"?l.toString():l}const Aa=Error.captureStackTrace?Error.captureStackTrace:(...a)=>{};function Ne(a){return typeof a=="string"?a:a==null?void 0:a.message}function Ha(a,l,i){var o,g,s,c,n,d;const t={...a,path:a.path??[]};if(!a.message){const u=Ne((s=(g=(o=a.inst)==null?void 0:o._zod.def)==null?void 0:g.error)==null?void 0:s.call(g,a))??Ne((c=l==null?void 0:l.error)==null?void 0:c.call(l,a))??Ne((n=i.customError)==null?void 0:n.call(i,a))??Ne((d=i.localeError)==null?void 0:d.call(i,a))??"Invalid input";t.message=u}return delete t.inst,delete t.continue,l!=null&&l.reportInput||delete t.input,t}const Va=(a,l)=>{a.name="$ZodError",Object.defineProperty(a,"_zod",{value:a._zod,enumerable:!1}),Object.defineProperty(a,"issues",{value:l,enumerable:!1}),Object.defineProperty(a,"message",{get(){return JSON.stringify(l,Bi,2)},enumerable:!0}),Object.defineProperty(a,"toString",{value:()=>a.message,enumerable:!1})},Li=Pa("$ZodError",Va),Ra=Pa("$ZodError",Va,{Parent:Error}),Wi=a=>(l,i,t,o)=>{const g=t?Object.assign(t,{async:!1}):{async:!1},s=l._zod.run({value:i,issues:[]},g);if(s instanceof Promise)throw new Vi;if(s.issues.length){const c=new((o==null?void 0:o.Err)??a)(s.issues.map(n=>Ha(n,g,Fa())));throw Aa(c,o==null?void 0:o.callee),c}return s.value},qi=Wi(Ra),$i=a=>async(l,i,t,o)=>{const g=t?Object.assign(t,{async:!0}):{async:!0};let s=l._zod.run({value:i,issues:[]},g);if(s instanceof Promise&&(s=await s),s.issues.length){const c=new((o==null?void 0:o.Err)??a)(s.issues.map(n=>Ha(n,g,Fa())));throw Aa(c,o==null?void 0:o.callee),c}return s.value},Ui=$i(Ra);function ma(a,l){try{var i=a()}catch(t){return l(t)}return i&&i.then?i.then(void 0,l):i}function Yi(a,l){for(var i={};a.length;){var t=a[0],o=t.code,g=t.message,s=t.path.join(".");if(!i[s])if("unionErrors"in t){var c=t.unionErrors[0].errors[0];i[s]={message:c.message,type:c.code}}else i[s]={message:g,type:o};if("unionErrors"in t&&t.unionErrors.forEach(function(u){return u.errors.forEach(function(x){return a.push(x)})}),l){var n=i[s].types,d=n&&n[t.code];i[s]=ae.appendErrors(s,l,i,o,d?[].concat(d,t.message):t.message)}a.shift()}return i}function Gi(a,l){for(var i={};a.length;){var t=a[0],o=t.code,g=t.message,s=t.path.join(".");if(!i[s])if(t.code==="invalid_union"&&t.errors.length>0){var c=t.errors[0][0];i[s]={message:c.message,type:c.code}}else i[s]={message:g,type:o};if(t.code==="invalid_union"&&t.errors.forEach(function(u){return u.forEach(function(x){return a.push(x)})}),l){var n=i[s].types,d=n&&n[t.code];i[s]=ae.appendErrors(s,l,i,o,d?[].concat(d,t.message):t.message)}a.shift()}return i}function Ba(a,l,i){if(i===void 0&&(i={}),function(t){return"_def"in t&&typeof t._def=="object"&&"typeName"in t._def}(a))return function(t,o,g){try{return Promise.resolve(ma(function(){return Promise.resolve(a[i.mode==="sync"?"parse":"parseAsync"](t,l)).then(function(s){return g.shouldUseNativeValidation&&je.validateFieldsNatively({},g),{errors:{},values:i.raw?Object.assign({},t):s}})},function(s){if(function(c){return Array.isArray(c==null?void 0:c.issues)}(s))return{values:{},errors:je.toNestErrors(Yi(s.errors,!g.shouldUseNativeValidation&&g.criteriaMode==="all"),g)};throw s}))}catch(s){return Promise.reject(s)}};if(function(t){return"_zod"in t&&typeof t._zod=="object"}(a))return function(t,o,g){try{return Promise.resolve(ma(function(){return Promise.resolve((i.mode==="sync"?qi:Ui)(a,t,l)).then(function(s){return g.shouldUseNativeValidation&&je.validateFieldsNatively({},g),{errors:{},values:i.raw?Object.assign({},t):s}})},function(s){if(function(c){return c instanceof Li}(s))return{values:{},errors:je.toNestErrors(Gi(s.issues,!g.shouldUseNativeValidation&&g.criteriaMode==="all"),g)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}function ke({defaultIsOpen:a=!1}={}){const[l,i]=j.useState(a);return{onOpen:()=>i(!0),onClose:()=>i(!1),isOpen:l,onToggle:()=>i(s=>!s)}}const Ie=D.forwardRef(({className:a,type:l,...i},t)=>e.jsx("input",{type:l,className:p("bigcal-flex bigcal-h-9 bigcal-w-full bigcal-rounded-md bigcal-border bigcal-border-input bigcal-bg-transparent bigcal-px-3 bigcal-py-1 bigcal-text-base bigcal-shadow-sm bigcal-transition-colors file:bigcal-border-0 file:bigcal-bg-transparent file:bigcal-text-sm file:bigcal-font-medium file:bigcal-text-foreground placeholder:bigcal-text-muted-foreground focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring disabled:bigcal-cursor-not-allowed disabled:bigcal-opacity-50 md:bigcal-text-sm",a),ref:t,...i}));Ie.displayName="Input";const Ce=D.forwardRef(({className:a,...l},i)=>e.jsx("textarea",{className:p("bigcal-flex bigcal-min-h-[60px] bigcal-w-full bigcal-rounded-md bigcal-border bigcal-border-input bigcal-bg-transparent bigcal-px-3 bigcal-py-2 bigcal-text-base bigcal-shadow-sm placeholder:bigcal-text-muted-foreground focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring disabled:bigcal-cursor-not-allowed disabled:bigcal-opacity-50 md:bigcal-text-sm",a),ref:i,...l}));Ce.displayName="Textarea";const W=j.forwardRef(({className:a,dateInputClassName:l,segmentClassName:i,disabled:t,"data-invalid":o,...g},s)=>e.jsx(Ve.TimeField,{ref:s,className:p("bigcal-relative",a),isDisabled:t,isInvalid:o,...g,"aria-label":"Time",shouldForceLeadingZeros:!0,children:e.jsx(Ve.DateInput,{className:p("bigcal-peer bigcal-inline-flex bigcal-h-9 bigcal-w-full bigcal-items-center bigcal-overflow-hidden bigcal-whitespace-nowrap bigcal-rounded-md bigcal-border bigcal-bg-background bigcal-px-3 bigcal-py-2 bigcal-text-sm bigcal-shadow-black","data-[focus-within]:bigcal-outline-none data-[focus-within]:bigcal-ring-1 data-[focus-within]:bigcal-ring-ring","data-[disabled]:bigcal-cursor-not-allowed data-[disabled]:bigcal-opacity-50",l),children:c=>e.jsx(Ve.DateSegment,{segment:c,className:p("bigcal-inline bigcal-rounded bigcal-p-0.5 bigcal-caret-transparent bigcal-outline bigcal-outline-0","data-[focused]:bigcal-bg-foreground/10 data-[focused]:bigcal-text-foreground","data-[placeholder]:bigcal-text-muted-foreground","data-[disabled]:bigcal-cursor-not-allowed data-[disabled]:bigcal-opacity-50",i)})})}));W.displayName="TimeInput";function Me({className:a,classNames:l,showOutsideDays:i=!0,selected:t,...o}){const[g,s]=D.useState(t instanceof Date?t:void 0);return e.jsx(ki.DayPicker,{selected:t,showOutsideDays:i,month:g,onMonthChange:s,className:p("bigcal-p-3",a),classNames:{months:"bigcal-flex bigcal-flex-col sm:bigcal-flex-row bigcal-space-y-4 sm:bigcal-space-x-4 sm:bigcal-space-y-0",month:"bigcal-space-y-4",caption:"bigcal-flex bigcal-justify-center bigcal-pt-1 bigcal-relative bigcal-items-center",caption_label:"bigcal-text-sm bigcal-font-medium",nav:"bigcal-space-x-1 bigcal-flex bigcal-items-center",nav_button:p(Se({variant:"outline"}),"bigcal-h-7 bigcal-w-7 bigcal-bg-transparent bigcal-p-0 bigcal-opacity-50 hover:bigcal-opacity-100"),nav_button_previous:"bigcal-absolute bigcal-left-1",nav_button_next:"bigcal-absolute bigcal-right-1",table:"bigcal-w-full bigcal-border-collapse bigcal-space-y-1",head_row:"bigcal-flex",head_cell:"bigcal-text-muted-foreground bigcal-rounded-md bigcal-w-8 bigcal-font-normal bigcal-text-[0.8rem]",row:"bigcal-flex bigcal-w-full bigcal-mt-2",cell:p("bigcal-relative bigcal-p-0 bigcal-text-center bigcal-text-sm focus-within:bigcal-relative focus-within:bigcal-z-20 [&:has([aria-selected])]:bigcal-bg-accent [&:has([aria-selected].day-outside)]:bigcal-bg-accent/50 [&:has([aria-selected].day-range-end)]:bigcal-rounded-r-md","[&:has([aria-selected])]:bigcal-rounded-md"),day:p(Se({variant:"ghost"}),"bigcal-h-8 bigcal-w-8 bigcal-p-0 bigcal-font-normal aria-selected:bigcal-opacity-100"),day_range_start:"bigcal-day-range-start",day_range_end:"bigcal-day-range-end",day_selected:"bigcal-bg-primary bigcal-text-primary-foreground hover:bigcal-bg-primary hover:bigcal-text-primary-foreground focus:bigcal-bg-primary focus:bigcal-text-primary-foreground",day_today:"bigcal-bg-accent bigcal-text-accent-foreground",day_outside:"bigcal-day-outside bigcal-text-muted-foreground aria-selected:bigcal-bg-accent/50 aria-selected:bigcal-text-muted-foreground",day_disabled:"bigcal-text-muted-foreground bigcal-opacity-50",day_range_middle:"aria-selected:bigcal-bg-accent aria-selected:bigcal-text-accent-foreground",day_hidden:"bigcal-invisible",...l},components:{IconLeft:({className:c,...n})=>e.jsx(N.ChevronLeft,{className:p("bigcal-h-4 bigcal-w-4",c),...n}),IconRight:({className:c,...n})=>e.jsx(N.ChevronRight,{className:p("bigcal-h-4 bigcal-w-4",c),...n})},...o})}Me.displayName="Calendar";const La=te.Root,Wa=te.Trigger,Ki=te.Anchor,Ze=D.forwardRef(({className:a,align:l="center",sideOffset:i=4,...t},o)=>e.jsx(te.Portal,{children:e.jsx(te.Content,{ref:o,align:l,sideOffset:i,className:p("bigcal-z-50 bigcal-w-72 bigcal-origin-[--radix-popover-content-transform-origin] bigcal-rounded-md bigcal-border bigcal-bg-popover bigcal-p-4 bigcal-text-popover-foreground bigcal-shadow-md bigcal-outline-none data-[state=open]:bigcal-animate-in data-[state=closed]:bigcal-animate-out data-[state=closed]:bigcal-fade-out-0 data-[state=open]:bigcal-fade-in-0 data-[state=closed]:bigcal-zoom-out-95 data-[state=open]:bigcal-zoom-in-95 data-[side=bottom]:bigcal-slide-in-from-top-2 data-[side=left]:bigcal-slide-in-from-right-2 data-[side=right]:bigcal-slide-in-from-left-2 data-[side=top]:bigcal-slide-in-from-bottom-2",a),...t})}));Ze.displayName=te.Content.displayName;function de({id:a,onSelect:l,className:i,placeholder:t,labelVariant:o="PPP",value:g,...s}){const{isOpen:c,onClose:n,onToggle:d}=ke(),u=x=>{l(x),n()};return e.jsxs(La,{open:c,onOpenChange:d,modal:!0,children:[e.jsx(Wa,{asChild:!0,children:e.jsxs(O,{id:a,variant:"outline",className:p("bigcal-group bigcal-relative bigcal-h-9 bigcal-w-full bigcal-justify-start bigcal-whitespace-nowrap bigcal-px-3 bigcal-py-2 bigcal-font-normal hover:bigcal-bg-inherit",i),...s,children:[g&&e.jsx("span",{children:r.format(g,o)}),!g&&e.jsx("span",{className:"bigcal-text-muted-foreground",children:t})]})}),e.jsx(Ze,{align:"center",className:"bigcal-w-fit bigcal-p-0",children:e.jsx(Me,{mode:"single",selected:g,onSelect:u,initialFocus:!0})})]})}const Zi=ee.cva("bigcal-text-sm bigcal-font-medium bigcal-leading-none peer-disabled:bigcal-cursor-not-allowed peer-disabled:bigcal-opacity-70"),Xe=D.forwardRef(({className:a,...l},i)=>e.jsx(pa.Root,{ref:i,className:p(Zi(),a),...l}));Xe.displayName=pa.Root.displayName;const Je=ae.FormProvider,qa=D.createContext({});function A({...a}){return e.jsx(qa.Provider,{value:{name:a.name},children:e.jsx(ae.Controller,{...a})})}const ue=()=>{const a=D.useContext(qa),l=D.useContext($a),{getFieldState:i,formState:t}=ae.useFormContext(),o=i(a.name,t);if(!a)throw new Error("useFormField should be used within <FormField>");const{id:g}=l;return{id:g,name:a.name,formItemId:`${g}-form-item`,formDescriptionId:`${g}-form-item-description`,formMessageId:`${g}-form-item-message`,...o}},$a=D.createContext({}),E=D.forwardRef(({className:a,...l},i)=>{const t=D.useId();return e.jsx($a.Provider,{value:{id:t},children:e.jsx("div",{ref:i,className:p("bigcal-space-y-2",a),...l})})});E.displayName="FormItem";const T=D.forwardRef(({className:a,...l},i)=>{const{error:t,formItemId:o}=ue();return e.jsx(Xe,{ref:i,className:p(t&&"bigcal-text-destructive",a),htmlFor:o,...l})});T.displayName="FormLabel";const _=D.forwardRef(({...a},l)=>{const{error:i,formItemId:t,formDescriptionId:o,formMessageId:g}=ue();return e.jsx(ha.Slot,{ref:l,id:t,"aria-describedby":i?`${o} ${g}`:`${o}`,"aria-invalid":!!i,...a})});_.displayName="FormControl";const Ua=D.forwardRef(({className:a,...l},i)=>{const{formDescriptionId:t}=ue();return e.jsx("p",{ref:i,id:t,className:p("bigcal-text-[0.8rem] bigcal-text-muted-foreground",a),...l})});Ua.displayName="FormDescription";const z=D.forwardRef(({className:a,children:l,...i},t)=>{const{error:o,formMessageId:g}=ue(),s=o?String((o==null?void 0:o.message)??""):l;return s?e.jsx("p",{ref:t,id:g,className:p("bigcal-text-[0.8rem] bigcal-font-medium bigcal-text-destructive",a),...i,children:s}):null});z.displayName="FormMessage";function Qe(){const[a,l]=j.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark"));return j.useEffect(()=>{if(typeof document>"u")return;const i=new MutationObserver(()=>{l(document.documentElement.classList.contains("dark"))});return i.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>i.disconnect()},[]),a}function Xi({children:a,className:l}){const i=Qe();return e.jsx("div",{className:p("cal-root",i&&"cal-dark",l),children:a})}const Oe=R.Root,Ee=R.Trigger,Ya=R.Portal,ea=R.Close,aa=D.forwardRef(({className:a,...l},i)=>e.jsx(R.Overlay,{ref:i,className:p("bigcal-fixed bigcal-inset-0 bigcal-z-50 bigcal-bg-black/80 data-[state=open]:bigcal-animate-in data-[state=closed]:bigcal-animate-out data-[state=closed]:bigcal-fade-out-0 data-[state=open]:bigcal-fade-in-0",a),...l}));aa.displayName=R.Overlay.displayName;const me=D.forwardRef(({className:a,children:l,...i},t)=>{const o=Qe();return e.jsx(Ya,{children:e.jsxs("div",{className:p("cal-root",o&&"cal-dark"),children:[e.jsx(aa,{}),e.jsxs(R.Content,{ref:t,className:p("bigcal-fixed bigcal-left-[50%] bigcal-top-[50%] bigcal-z-50 bigcal-grid bigcal-w-full bigcal-max-w-lg bigcal-translate-x-[-50%] bigcal-translate-y-[-50%] bigcal-gap-4 bigcal-border bigcal-bg-background bigcal-p-6 bigcal-shadow-lg bigcal-duration-200 data-[state=open]:bigcal-animate-in data-[state=closed]:bigcal-animate-out data-[state=closed]:bigcal-fade-out-0 data-[state=open]:bigcal-fade-in-0 data-[state=closed]:bigcal-zoom-out-95 data-[state=open]:bigcal-zoom-in-95 data-[state=closed]:bigcal-slide-out-to-left-1/2 data-[state=closed]:bigcal-slide-out-to-top-[48%] data-[state=open]:bigcal-slide-in-from-left-1/2 data-[state=open]:bigcal-slide-in-from-top-[48%] sm:bigcal-rounded-lg",a),...i,children:[l,e.jsxs(R.Close,{className:"bigcal-absolute bigcal-right-4 bigcal-top-4 bigcal-rounded-sm bigcal-opacity-70 bigcal-ring-offset-background bigcal-transition-opacity hover:bigcal-opacity-100 focus:bigcal-outline-none focus:bigcal-ring-2 focus:bigcal-ring-ring focus:bigcal-ring-offset-2 disabled:bigcal-pointer-events-none data-[state=open]:bigcal-bg-accent data-[state=open]:bigcal-text-muted-foreground",children:[e.jsx(N.X,{className:"bigcal-size-4"}),e.jsx("span",{className:"bigcal-sr-only",children:"Close"})]})]})]})})});me.displayName=R.Content.displayName;function xe({className:a,...l}){return e.jsx("div",{className:p("bigcal-flex bigcal-flex-col bigcal-space-y-1.5 bigcal-text-center sm:bigcal-text-left",a),...l})}xe.displayName="DialogHeader";function fe({className:a,...l}){return e.jsx("div",{className:p("bigcal-flex bigcal-flex-col-reverse sm:bigcal-flex-row sm:bigcal-justify-end sm:bigcal-space-x-2",a),...l})}fe.displayName="DialogFooter";const he=D.forwardRef(({className:a,...l},i)=>e.jsx(R.Title,{ref:i,className:p("bigcal-text-lg bigcal-font-semibold bigcal-leading-none bigcal-tracking-tight",a),...l}));he.displayName=R.Title.displayName;const Te=D.forwardRef(({className:a,...l},i)=>e.jsx(R.Description,{ref:i,className:p("bigcal-text-sm bigcal-text-muted-foreground",a),...l}));Te.displayName=R.Description.displayName;const ia=(a=!1)=>V.z.object({user:a?V.z.string().optional():V.z.string(),title:V.z.string().min(1,"Title is required"),description:V.z.string().min(1,"Description is required"),startDate:V.z.date({required_error:"Start date is required"}),startTime:V.z.object({hour:V.z.number(),minute:V.z.number()},{required_error:"Start time is required"}),endDate:V.z.date({required_error:"End date is required"}),endTime:V.z.object({hour:V.z.number(),minute:V.z.number()},{required_error:"End time is required"}),color:V.z.enum(["blue","green","red","yellow","purple","orange","gray"],{required_error:"Color is required"})}).refine(l=>{const i=new Date(l.startDate);i.setHours(l.startTime.hour,l.startTime.minute,0,0);const t=new Date(l.endDate);return t.setHours(l.endTime.hour,l.endTime.minute,0,0),i<t},{message:"Start date cannot be after end date",path:["startDate"]}),Ji=ia(!1);function L({children:a,startDate:l,startTime:i,onEventCreated:t,showFormDisclaimer:o=!0}){const{users:g,createEvent:s,singleUser:c,currentUser:n}=C(),{isOpen:d,onClose:u,onToggle:x}=ke(),f=ae.useForm({resolver:Ba(ia(c)),defaultValues:{title:"",description:"",user:c&&n?n.id:void 0,startDate:typeof l<"u"?l:void 0,startTime:typeof i<"u"?i:void 0}}),m=async b=>{try{const h=c?n:g.find(H=>H.id===b.user);if(!h){c||f.setError("user",{message:"User not found"});return}const v=new Date(b.startDate);v.setHours(b.startTime.hour,b.startTime.minute,0,0);const S=new Date(b.endDate);S.setHours(b.endTime.hour,b.endTime.minute,0,0);const k={user:h,title:b.title,color:b.color,description:b.description,startDate:v.toISOString(),endDate:S.toISOString()},P=await s(k);t==null||t(P),u(),f.reset()}catch(h){console.error("Failed to create event:",h)}};return j.useEffect(()=>{f.reset({startDate:l,startTime:i})},[l,i,f]),e.jsxs(Oe,{open:d,onOpenChange:x,children:[e.jsx(Ee,{asChild:!0,children:a}),e.jsxs(me,{children:[e.jsxs(xe,{children:[e.jsx(he,{children:"Add New Event"}),o&&e.jsx(Te,{className:"bigcal-mt-2",children:"Create a new calendar event. The event will be saved according to your API configuration."})]}),e.jsx(Je,{...f,children:e.jsxs("form",{id:"event-form",onSubmit:f.handleSubmit(m),className:"bigcal-grid bigcal-gap-4 bigcal-py-4",children:[!c&&e.jsx(A,{control:f.control,name:"user",render:({field:b,fieldState:h})=>e.jsxs(E,{children:[e.jsx(T,{children:"Responsible"}),e.jsx(_,{children:e.jsxs(J,{value:b.value,onValueChange:b.onChange,children:[e.jsx(U,{"data-invalid":h.invalid,children:e.jsx(Q,{placeholder:"Select an option"})}),e.jsx(Y,{children:g.map(v=>e.jsx(I,{value:v.id,className:"bigcal-flex-1",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsxs(re,{className:"bigcal-size-6",children:[e.jsx(se,{src:v.picturePath??void 0,alt:v.name}),e.jsx(ne,{className:"bigcal-text-xxs",children:v.name[0]})]},v.id),e.jsx("p",{className:"bigcal-truncate",children:v.name})]})},v.id))})]})}),e.jsx(z,{})]})}),e.jsx(A,{control:f.control,name:"title",render:({field:b,fieldState:h})=>e.jsxs(E,{children:[e.jsx(T,{htmlFor:"title",children:"Title"}),e.jsx(_,{children:e.jsx(Ie,{id:"title",placeholder:"Enter a title","data-invalid":h.invalid,...b})}),e.jsx(z,{})]})}),e.jsxs("div",{className:"bigcal-flex bigcal-items-start bigcal-gap-2",children:[e.jsx(A,{control:f.control,name:"startDate",render:({field:b,fieldState:h})=>e.jsxs(E,{className:"bigcal-flex-1",children:[e.jsx(T,{htmlFor:"startDate",children:"Start Date"}),e.jsx(_,{children:e.jsx(de,{id:"startDate",value:b.value,onSelect:v=>b.onChange(v),placeholder:"Select a date","data-invalid":h.invalid})}),e.jsx(z,{})]})}),e.jsx(A,{control:f.control,name:"startTime",render:({field:b,fieldState:h})=>e.jsxs(E,{className:"bigcal-flex-1",children:[e.jsx(T,{children:"Start Time"}),e.jsx(_,{children:e.jsx(W,{value:b.value,onChange:b.onChange,hourCycle:12,"data-invalid":h.invalid})}),e.jsx(z,{})]})})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-start bigcal-gap-2",children:[e.jsx(A,{control:f.control,name:"endDate",render:({field:b,fieldState:h})=>e.jsxs(E,{className:"bigcal-flex-1",children:[e.jsx(T,{children:"End Date"}),e.jsx(_,{children:e.jsx(de,{value:b.value,onSelect:v=>b.onChange(v),placeholder:"Select a date","data-invalid":h.invalid})}),e.jsx(z,{})]})}),e.jsx(A,{control:f.control,name:"endTime",render:({field:b,fieldState:h})=>e.jsxs(E,{className:"bigcal-flex-1",children:[e.jsx(T,{children:"End Time"}),e.jsx(_,{children:e.jsx(W,{value:b.value,onChange:b.onChange,hourCycle:12,"data-invalid":h.invalid})}),e.jsx(z,{})]})})]}),e.jsx(A,{control:f.control,name:"color",render:({field:b,fieldState:h})=>e.jsxs(E,{children:[e.jsx(T,{children:"Color"}),e.jsx(_,{children:e.jsxs(J,{value:b.value,onValueChange:b.onChange,children:[e.jsx(U,{"data-invalid":h.invalid,children:e.jsx(Q,{placeholder:"Select an option"})}),e.jsxs(Y,{children:[e.jsx(I,{value:"blue",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-blue-600"}),"Blue"]})}),e.jsx(I,{value:"green",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-green-600"}),"Green"]})}),e.jsx(I,{value:"red",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-red-600"}),"Red"]})}),e.jsx(I,{value:"yellow",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-yellow-600"}),"Yellow"]})}),e.jsx(I,{value:"purple",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-purple-600"}),"Purple"]})}),e.jsx(I,{value:"orange",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-orange-600"}),"Orange"]})}),e.jsx(I,{value:"gray",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-neutral-600"}),"Gray"]})})]})]})}),e.jsx(z,{})]})}),e.jsx(A,{control:f.control,name:"description",render:({field:b,fieldState:h})=>e.jsxs(E,{children:[e.jsx(T,{children:"Description"}),e.jsx(_,{children:e.jsx(Ce,{...b,value:b.value,"data-invalid":h.invalid})}),e.jsx(z,{})]})})]})}),e.jsxs(fe,{children:[e.jsx(ea,{asChild:!0,children:e.jsx(O,{type:"button",variant:"outline",children:"Cancel"})}),e.jsx(O,{form:"event-form",type:"submit",children:"Create Event"})]})]})]})}function Ga({view:a,events:l,onViewChange:i,showTodayButton:t=!0,showDateNavigator:o=!0,showViewSwitcher:g=!0,showUserSelect:s=!0,showAddEventButton:c=!0,availableViews:n=["day","week","month","year","agenda"],className:d,leftSectionClassName:u,rightSectionClassName:x,viewSwitcherClassName:f,addButtonClassName:m}){const{singleUser:b}=C(),h=S=>{i&&i(S)},v=s&&!b;return e.jsxs("div",{className:p("bigcal-flex bigcal-flex-col bigcal-gap-4 bigcal-border-b bigcal-p-4 lg:bigcal-flex-row lg:bigcal-items-center lg:bigcal-justify-between",d),children:[(t||o)&&e.jsxs("div",{className:p("bigcal-flex bigcal-items-center bigcal-gap-3",u),children:[t&&e.jsx(Sa,{}),o&&e.jsx(za,{view:a,events:l})]}),(g||s||c)&&e.jsxs("div",{className:p("bigcal-flex bigcal-flex-col bigcal-items-center bigcal-gap-1.5 sm:bigcal-flex-row sm:bigcal-justify-between",x),children:[(g||s)&&e.jsxs("div",{className:"bigcal-flex bigcal-w-full bigcal-items-center bigcal-gap-1.5",children:[g&&e.jsxs("div",{className:p("bigcal-inline-flex bigcal-first:rounded-r-none bigcal-last:rounded-l-none bigcal-[&:not(:first-child):not(:last-child)]:bigcal-rounded-none",f),children:[n.includes("day")&&e.jsx(O,{"aria-label":"View by day",size:"icon",variant:a==="day"?"default":"outline",className:"bigcal-rounded-r-none bigcal-[&_svg]:bigcal-size-5",onClick:()=>h("day"),children:e.jsx(N.List,{strokeWidth:1.8})}),n.includes("week")&&e.jsx(O,{"aria-label":"View by week",size:"icon",variant:a==="week"?"default":"outline",className:"bigcal--ml-px bigcal-rounded-none bigcal-[&_svg]:bigcal-size-5",onClick:()=>h("week"),children:e.jsx(N.Columns,{strokeWidth:1.8})}),n.includes("month")&&e.jsx(O,{"aria-label":"View by month",size:"icon",variant:a==="month"?"default":"outline",className:"bigcal--ml-px bigcal-rounded-none bigcal-[&_svg]:bigcal-size-5",onClick:()=>h("month"),children:e.jsx(N.Grid2x2,{strokeWidth:1.8})}),n.includes("year")&&e.jsx(O,{"aria-label":"View by year",size:"icon",variant:a==="year"?"default":"outline",className:"bigcal--ml-px bigcal-rounded-none bigcal-[&_svg]:bigcal-size-5",onClick:()=>h("year"),children:e.jsx(N.Grid3x3,{strokeWidth:1.8})}),n.includes("agenda")&&e.jsx(O,{"aria-label":"View by agenda",size:"icon",variant:a==="agenda"?"default":"outline",className:"bigcal--ml-px bigcal-rounded-l-none bigcal-[&_svg]:bigcal-size-5",onClick:()=>h("agenda"),children:e.jsx(N.CalendarRange,{strokeWidth:1.8})})]}),v&&e.jsx(wa,{})]}),c&&e.jsx(L,{children:e.jsxs(O,{className:p("bigcal-w-full sm:bigcal-w-auto",m),children:[e.jsx(N.Plus,{}),"Add Event"]})})]})]})}function Qi({day:a,date:l,events:i}){const{setSelectedDate:t}=C(),o=3,g=i.length,s=()=>{t(l)};return e.jsxs("button",{onClick:s,type:"button",className:"bigcal-flex bigcal-h-11 bigcal-flex-1 bigcal-flex-col bigcal-items-center bigcal-justify-start bigcal-gap-0.5 bigcal-rounded-md bigcal-pt-1 hover:bigcal-bg-accent focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring",children:[e.jsx("div",{className:p("bigcal-flex bigcal-size-6 bigcal-items-center bigcal-justify-center bigcal-rounded-full bigcal-text-xs bigcal-font-medium",r.isToday(l)&&"bigcal-bg-primary bigcal-font-semibold bigcal-text-primary-foreground"),children:a}),g>0&&e.jsx("div",{className:"bigcal-mt-0.5 bigcal-flex bigcal-gap-0.5",children:g<=o?i.map(c=>e.jsx("div",{className:p("bigcal-size-1.5 bigcal-rounded-full",c.color==="blue"&&"bigcal-bg-blue-600",c.color==="green"&&"bigcal-bg-green-600",c.color==="red"&&"bigcal-bg-red-600",c.color==="yellow"&&"bigcal-bg-yellow-600",c.color==="purple"&&"bigcal-bg-purple-600",c.color==="orange"&&"bigcal-bg-orange-600",c.color==="gray"&&"bigcal-bg-neutral-600")},c.id)):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:p("bigcal-size-1.5 bigcal-rounded-full",i[0].color==="blue"&&"bigcal-bg-blue-600",i[0].color==="green"&&"bigcal-bg-green-600",i[0].color==="red"&&"bigcal-bg-red-600",i[0].color==="yellow"&&"bigcal-bg-yellow-600",i[0].color==="purple"&&"bigcal-bg-purple-600",i[0].color==="orange"&&"bigcal-bg-orange-600")}),e.jsxs("span",{className:"bigcal-text-[7px] bigcal-text-muted-foreground",children:["+",g-1]})]})})]})}function el({month:a,events:l}){const{setSelectedDate:i}=C(),t=r.format(a,"MMMM"),o=j.useMemo(()=>{const c=r.getDaysInMonth(a),n=r.startOfMonth(a).getDay(),d=Array.from({length:c},(x,f)=>f+1);return[...Array(n).fill(null),...d]},[a]),g=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],s=()=>{i(new Date(a.getFullYear(),a.getMonth(),1))};return e.jsxs("div",{className:"bigcal-flex bigcal-flex-col",children:[e.jsx("button",{type:"button",onClick:s,className:"bigcal-w-full bigcal-rounded-t-lg bigcal-border bigcal-px-3 bigcal-py-2 bigcal-text-sm bigcal-font-semibold hover:bigcal-bg-accent focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring",children:t}),e.jsxs("div",{className:"bigcal-flex-1 bigcal-space-y-2 bigcal-rounded-b-lg bigcal-border bigcal-border-t-0 bigcal-p-3",children:[e.jsx("div",{className:"bigcal-grid bigcal-grid-cols-7 bigcal-gap-x-0.5 bigcal-text-center",children:g.map((c,n)=>e.jsx("div",{className:"bigcal-text-xs bigcal-font-medium bigcal-text-muted-foreground",children:c},n))}),e.jsx("div",{className:"bigcal-grid bigcal-grid-cols-7 bigcal-gap-x-0.5 bigcal-gap-y-2",children:o.map((c,n)=>{if(c===null)return e.jsx("div",{className:"bigcal-h-10"},`blank-${n}`);const d=new Date(a.getFullYear(),a.getMonth(),c),u=l.filter(x=>r.isSameDay(r.parseISO(x.startDate),d)||r.isSameDay(r.parseISO(x.endDate),d));return e.jsx(Qi,{day:c,date:d,events:u},`day-${c}`)})})]})]})}function Ka({allEvents:a}){const{selectedDate:l}=C(),i=j.useMemo(()=>{const t=r.startOfYear(l);return Array.from({length:12},(o,g)=>r.addMonths(t,g))},[l]);return e.jsx("div",{className:"bigcal-p-4",children:e.jsx("div",{className:"bigcal-grid bigcal-grid-cols-1 bigcal-gap-4 md:bigcal-grid-cols-2 lg:bigcal-grid-cols-3 xl:bigcal-grid-cols-4",children:i.map(t=>e.jsx(el,{month:t,events:a},t.toString()))})})}const al=ee.cva("bigcal-size-2 bigcal-rounded-full",{variants:{color:{blue:"bigcal-bg-blue-600 dark:bigcal-bg-blue-500",green:"bigcal-bg-green-600 dark:bigcal-bg-green-500",red:"bigcal-bg-red-600 dark:bigcal-bg-red-500",yellow:"bigcal-bg-yellow-600 dark:bigcal-bg-yellow-500",purple:"bigcal-bg-purple-600 dark:bigcal-bg-purple-500",gray:"bigcal-bg-neutral-600 dark:bigcal-bg-neutral-500",orange:"bigcal-bg-orange-600 dark:bigcal-bg-orange-500"}},defaultVariants:{color:"blue"}});function il({color:a,className:l}){return e.jsx("div",{className:p(al({color:a,className:l}))})}function la(){const{updateEvent:a}=C();return{updateEvent:a}}const _e={EVENT:"event"};function ta({event:a,children:l}){const i=j.useRef(null),[{isDragging:t},o,g]=be.useDrag(()=>({type:_e.EVENT,item:()=>{var n,d;const s=((n=i.current)==null?void 0:n.offsetWidth)||0,c=((d=i.current)==null?void 0:d.offsetHeight)||0;return{event:a,children:l,width:s,height:c}},collect:s=>({isDragging:s.isDragging()})}));return j.useEffect(()=>{g(fa.getEmptyImage(),{captureDraggingState:!0})},[g]),o(i),e.jsx("div",{ref:i,className:p(t&&"bigcal-opacity-40"),children:l})}function Za({cell:a,children:l}){const{updateEvent:i}=la(),[{isOver:t,canDrop:o},g]=be.useDrop(()=>({accept:_e.EVENT,drop:s=>{const c=s.event,n=r.parseISO(c.startDate),d=r.parseISO(c.endDate),u=r.differenceInMilliseconds(d,n),x=new Date(a.date);x.setHours(n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds());const f=new Date(x.getTime()+u);return i({...c,startDate:x.toISOString(),endDate:f.toISOString()}),{moved:!0}},collect:s=>({isOver:s.isOver(),canDrop:s.canDrop()})}),[a.date,i]);return e.jsx("div",{ref:g,className:p(t&&o&&"bigcal-bg-accent/50"),children:l})}function Xa({children:a,event:l,onEventUpdated:i,showFormDisclaimer:t=!0}){const{isOpen:o,onClose:g,onToggle:s}=ke(),{users:c,updateEvent:n,singleUser:d,currentUser:u}=C(),x=ae.useForm({resolver:Ba(ia(d)),defaultValues:{user:d&&(u==null?void 0:u.id)||l.user.id,title:l.title,description:l.description,startDate:r.parseISO(l.startDate),startTime:{hour:r.parseISO(l.startDate).getHours(),minute:r.parseISO(l.startDate).getMinutes()},endDate:r.parseISO(l.endDate),endTime:{hour:r.parseISO(l.endDate).getHours(),minute:r.parseISO(l.endDate).getMinutes()},color:l.color}}),f=async m=>{try{const b=d?u:c.find(k=>k.id===m.user);if(!b){d||x.setError("user",{message:"User not found"});return}const h=new Date(m.startDate);h.setHours(m.startTime.hour,m.startTime.minute,0,0);const v=new Date(m.endDate);v.setHours(m.endTime.hour,m.endTime.minute,0,0);const S=await n({...l,user:b,title:m.title,color:m.color,description:m.description,startDate:h.toISOString(),endDate:v.toISOString()});i==null||i(S),g()}catch(b){console.error("Failed to update event:",b)}};return e.jsxs(Oe,{open:o,onOpenChange:s,children:[e.jsx(Ee,{asChild:!0,children:a}),e.jsxs(me,{children:[e.jsxs(xe,{children:[e.jsx(he,{children:"Edit Event"}),t&&e.jsx(Te,{className:"bigcal-mt-2",children:"Update the event details. Changes will be saved according to your API configuration."})]}),e.jsx(Je,{...x,children:e.jsxs("form",{id:"event-form",onSubmit:x.handleSubmit(f),className:"bigcal-grid bigcal-gap-4 bigcal-py-4",children:[!d&&e.jsx(A,{control:x.control,name:"user",render:({field:m,fieldState:b})=>e.jsxs(E,{children:[e.jsx(T,{children:"Responsible"}),e.jsx(_,{children:e.jsxs(J,{value:m.value,onValueChange:m.onChange,children:[e.jsx(U,{"data-invalid":b.invalid,children:e.jsx(Q,{placeholder:"Select an option"})}),e.jsx(Y,{children:c.map(h=>e.jsx(I,{value:h.id,className:"bigcal-flex-1",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsxs(re,{className:"bigcal-size-6",children:[e.jsx(se,{src:h.picturePath??void 0,alt:h.name}),e.jsx(ne,{className:"bigcal-text-xxs",children:h.name[0]})]},h.id),e.jsx("p",{className:"bigcal-truncate",children:h.name})]})},h.id))})]})}),e.jsx(z,{})]})}),e.jsx(A,{control:x.control,name:"title",render:({field:m,fieldState:b})=>e.jsxs(E,{children:[e.jsx(T,{htmlFor:"title",children:"Title"}),e.jsx(_,{children:e.jsx(Ie,{id:"title",placeholder:"Enter a title","data-invalid":b.invalid,...m})}),e.jsx(z,{})]})}),e.jsxs("div",{className:"bigcal-flex bigcal-items-start bigcal-gap-2",children:[e.jsx(A,{control:x.control,name:"startDate",render:({field:m,fieldState:b})=>e.jsxs(E,{className:"bigcal-flex-1",children:[e.jsx(T,{htmlFor:"startDate",children:"Start Date"}),e.jsx(_,{children:e.jsx(de,{id:"startDate",value:m.value,onSelect:h=>m.onChange(h),placeholder:"Select a date","data-invalid":b.invalid})}),e.jsx(z,{})]})}),e.jsx(A,{control:x.control,name:"startTime",render:({field:m,fieldState:b})=>e.jsxs(E,{className:"bigcal-flex-1",children:[e.jsx(T,{children:"Start Time"}),e.jsx(_,{children:e.jsx(W,{value:m.value,onChange:m.onChange,hourCycle:12,"data-invalid":b.invalid})}),e.jsx(z,{})]})})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-start bigcal-gap-2",children:[e.jsx(A,{control:x.control,name:"endDate",render:({field:m,fieldState:b})=>e.jsxs(E,{className:"bigcal-flex-1",children:[e.jsx(T,{children:"End Date"}),e.jsx(_,{children:e.jsx(de,{value:m.value,onSelect:h=>m.onChange(h),placeholder:"Select a date","data-invalid":b.invalid})}),e.jsx(z,{})]})}),e.jsx(A,{control:x.control,name:"endTime",render:({field:m,fieldState:b})=>e.jsxs(E,{className:"bigcal-flex-1",children:[e.jsx(T,{children:"End Time"}),e.jsx(_,{children:e.jsx(W,{value:m.value,onChange:m.onChange,hourCycle:12,"data-invalid":b.invalid})}),e.jsx(z,{})]})})]}),e.jsx(A,{control:x.control,name:"color",render:({field:m,fieldState:b})=>e.jsxs(E,{children:[e.jsx(T,{children:"Color"}),e.jsx(_,{children:e.jsxs(J,{value:m.value,onValueChange:m.onChange,children:[e.jsx(U,{"data-invalid":b.invalid,children:e.jsx(Q,{placeholder:"Select an option"})}),e.jsxs(Y,{children:[e.jsx(I,{value:"blue",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-blue-600"}),"Blue"]})}),e.jsx(I,{value:"green",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-green-600"}),"Green"]})}),e.jsx(I,{value:"red",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-red-600"}),"Red"]})}),e.jsx(I,{value:"yellow",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-yellow-600"}),"Yellow"]})}),e.jsx(I,{value:"purple",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-purple-600"}),"Purple"]})}),e.jsx(I,{value:"orange",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-orange-600"}),"Orange"]})}),e.jsx(I,{value:"gray",children:e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("div",{className:"bigcal-size-3.5 bigcal-rounded-full bigcal-bg-neutral-600"}),"Gray"]})})]})]})}),e.jsx(z,{})]})}),e.jsx(A,{control:x.control,name:"description",render:({field:m,fieldState:b})=>e.jsxs(E,{children:[e.jsx(T,{children:"Description"}),e.jsx(_,{children:e.jsx(Ce,{...m,value:m.value,"data-invalid":b.invalid})}),e.jsx(z,{})]})})]})}),e.jsxs(fe,{children:[e.jsx(ea,{asChild:!0,children:e.jsx(O,{type:"button",variant:"outline",children:"Cancel"})}),e.jsx(O,{form:"event-form",type:"submit",children:"Save changes"})]})]})]})}function ze({event:a,children:l}){const i=r.parseISO(a.startDate),t=r.parseISO(a.endDate);return e.jsx(e.Fragment,{children:e.jsxs(Oe,{children:[e.jsx(Ee,{asChild:!0,children:l}),e.jsxs(me,{children:[e.jsx(xe,{children:e.jsx(he,{children:a.title})}),e.jsxs("div",{className:"bigcal-space-y-4",children:[e.jsxs("div",{className:"bigcal-flex bigcal-items-start bigcal-gap-2",children:[e.jsx(N.User,{className:"bigcal-mt-1 bigcal-size-4 bigcal-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"bigcal-text-sm bigcal-font-medium",children:"Responsible"}),e.jsx("p",{className:"bigcal-text-sm bigcal-text-muted-foreground",children:a.user.name})]})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-start bigcal-gap-2",children:[e.jsx(N.Calendar,{className:"bigcal-mt-1 bigcal-size-4 bigcal-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"bigcal-text-sm bigcal-font-medium",children:"Start Date"}),e.jsx("p",{className:"bigcal-text-sm bigcal-text-muted-foreground",children:r.format(i,"MMM d, yyyy h:mm a")})]})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-start bigcal-gap-2",children:[e.jsx(N.Clock,{className:"bigcal-mt-1 bigcal-size-4 bigcal-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"bigcal-text-sm bigcal-font-medium",children:"End Date"}),e.jsx("p",{className:"bigcal-text-sm bigcal-text-muted-foreground",children:r.format(t,"MMM d, yyyy h:mm a")})]})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-start bigcal-gap-2",children:[e.jsx(N.Text,{className:"bigcal-mt-1 bigcal-size-4 bigcal-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"bigcal-text-sm bigcal-font-medium",children:"Description"}),e.jsx("p",{className:"bigcal-text-sm bigcal-text-muted-foreground",children:a.description})]})]})]}),e.jsx(fe,{children:e.jsx(Xa,{event:a,children:e.jsx(O,{type:"button",variant:"outline",children:"Edit"})})})]})]})})}const ll=ee.cva("bigcal-mx-1 bigcal-flex bigcal-size-auto bigcal-h-6.5 bigcal-select-none bigcal-items-center bigcal-justify-between bigcal-gap-1.5 bigcal-truncate bigcal-whitespace-nowrap bigcal-rounded-md bigcal-border bigcal-px-2 bigcal-text-xs focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring",{variants:{color:{blue:"bigcal-border-blue-200 bigcal-bg-blue-50 bigcal-text-blue-700 dark:bigcal-border-blue-800 dark:bigcal-bg-blue-950 dark:bigcal-text-blue-300 [&_.bigcal-event-dot]:bigcal-fill-blue-600",green:"bigcal-border-green-200 bigcal-bg-green-50 bigcal-text-green-700 dark:bigcal-border-green-800 dark:bigcal-bg-green-950 dark:bigcal-text-green-300 [&_.bigcal-event-dot]:bigcal-fill-green-600",red:"bigcal-border-red-200 bigcal-bg-red-50 bigcal-text-red-700 dark:bigcal-border-red-800 dark:bigcal-bg-red-950 dark:bigcal-text-red-300 [&_.bigcal-event-dot]:bigcal-fill-red-600",yellow:"bigcal-border-yellow-200 bigcal-bg-yellow-50 bigcal-text-yellow-700 dark:bigcal-border-yellow-800 dark:bigcal-bg-yellow-950 dark:bigcal-text-yellow-300 [&_.bigcal-event-dot]:bigcal-fill-yellow-600",purple:"bigcal-border-purple-200 bigcal-bg-purple-50 bigcal-text-purple-700 dark:bigcal-border-purple-800 dark:bigcal-bg-purple-950 dark:bigcal-text-purple-300 [&_.bigcal-event-dot]:bigcal-fill-purple-600",orange:"bigcal-border-orange-200 bigcal-bg-orange-50 bigcal-text-orange-700 dark:bigcal-border-orange-800 dark:bigcal-bg-orange-950 dark:bigcal-text-orange-300 [&_.bigcal-event-dot]:bigcal-fill-orange-600",gray:"bigcal-border-neutral-200 bigcal-bg-neutral-50 bigcal-text-neutral-900 dark:bigcal-border-neutral-700 dark:bigcal-bg-neutral-900 dark:bigcal-text-neutral-300 [&_.bigcal-event-dot]:bigcal-fill-neutral-600","blue-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-blue-600","green-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-green-600","red-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-red-600","yellow-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-yellow-600","purple-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-purple-600","orange-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-orange-600","gray-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-neutral-600"},multiDayPosition:{first:"bigcal-relative bigcal-z-10 bigcal-mr-0 bigcal-w-[calc(100%_+_1px)] bigcal-rounded-r-none bigcal-border-r-0 [&>span]:bigcal-mr-2.5",middle:"bigcal-relative bigcal-z-10 bigcal-mx-0 bigcal-w-[calc(100%_+_1px)] bigcal-rounded-none bigcal-border-x-0",last:"bigcal-ml-0 bigcal-rounded-l-none bigcal-border-l-0",none:""}},defaultVariants:{color:"blue-dot"}});function ca({event:a,cellDate:l,eventCurrentDay:i,eventTotalDays:t,className:o,position:g}){const{badgeVariant:s}=C(),c=r.startOfDay(r.parseISO(a.startDate)),n=r.endOfDay(r.parseISO(a.endDate));if(l<c||l>n)return null;let d;g?d=g:i&&t||r.isSameDay(c,n)?d="none":r.isSameDay(l,c)?d="first":r.isSameDay(l,n)?d="last":d="middle";const u=["first","none"].includes(d),x=s==="dot"?`${a.color}-dot`:a.color,f=p(ll({color:x,multiDayPosition:d,className:o})),m=b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),b.currentTarget instanceof HTMLElement&&b.currentTarget.click())};return e.jsx(ta,{event:a,children:e.jsx(ze,{event:a,children:e.jsxs("div",{role:"button",tabIndex:0,className:f,onKeyDown:m,children:[e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-1.5 bigcal-truncate",children:[!["middle","last"].includes(d)&&["mixed","dot"].includes(s)&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"bigcal-event-dot bigcal-shrink-0",children:e.jsx("circle",{cx:"4",cy:"4",r:"4"})}),u&&e.jsxs("p",{className:"bigcal-flex-1 bigcal-truncate bigcal-font-semibold",children:[i&&e.jsxs("span",{className:"bigcal-text-xs",children:["Day ",i," of ",t," •"," "]}),a.title]})]}),u&&e.jsx("span",{children:r.format(new Date(a.startDate),"h:mm a")})]})})})}const Re=3;function tl({cell:a,events:l,eventPositions:i}){const{setSelectedDate:t}=C(),{day:o,currentMonth:g,date:s}=a,c=j.useMemo(()=>_a(s,l,i),[s,l,i]),n=s.getDay()===0,d=()=>{t(s)};return e.jsx(Za,{cell:a,children:e.jsxs("div",{className:p("bigcal-flex bigcal-h-full bigcal-flex-col bigcal-gap-1 bigcal-border-l bigcal-border-t bigcal-py-1.5 lg:bigcal-pb-2 lg:bigcal-pt-1",n&&"bigcal-border-l-0"),children:[e.jsx("button",{onClick:d,className:p("bigcal-flex bigcal-size-6 bigcal-translate-x-1 bigcal-items-center bigcal-justify-center bigcal-rounded-full bigcal-text-xs bigcal-font-semibold hover:bigcal-bg-accent focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring lg:bigcal-px-2",!g&&"bigcal-opacity-20",r.isToday(s)&&"bigcal-bg-primary bigcal-font-bold bigcal-text-primary-foreground hover:bigcal-bg-primary"),children:o}),e.jsx("div",{className:p("bigcal-flex bigcal-h-6 bigcal-gap-1 bigcal-px-2 lg:bigcal-h-[94px] lg:bigcal-flex-col lg:bigcal-gap-2 lg:bigcal-px-0",!g&&"bigcal-opacity-50"),children:[0,1,2].map(u=>{const x=c.find(m=>m.position===u),f=x?`event-${x.id}-${u}`:`empty-${u}`;return e.jsx("div",{className:"lg:bigcal-flex-1",children:x&&e.jsxs(e.Fragment,{children:[e.jsx(il,{className:"lg:bigcal-hidden",color:x.color}),e.jsx(ca,{className:"bigcal-hidden lg:bigcal-flex",event:x,cellDate:r.startOfDay(s)})]})},f)})}),c.length>Re&&e.jsxs("p",{className:p("bigcal-h-4.5 bigcal-px-1.5 bigcal-text-xs bigcal-font-semibold bigcal-text-muted-foreground",!g&&"bigcal-opacity-50"),children:[e.jsxs("span",{className:"lg:bigcal-hidden",children:["+",c.length-Re]}),e.jsxs("span",{className:"lg:bigcal-hidden lg:bigcal-inline",children:[" ",c.length-Re," more..."]})]})]})})}const cl=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function Ja({singleDayEvents:a,multiDayEvents:l}){const{selectedDate:i}=C(),t=[...l,...a],o=j.useMemo(()=>Ea(i),[i]),g=j.useMemo(()=>Ta(l,a,i),[l,a,i]);return e.jsxs("div",{children:[e.jsx("div",{className:"bigcal-grid bigcal-grid-cols-7 bigcal-divide-x",children:cl.map(s=>e.jsx("div",{className:"bigcal-flex bigcal-items-center bigcal-justify-center bigcal-py-2",children:e.jsx("span",{className:"bigcal-text-xs bigcal-font-medium bigcal-text-muted-foreground",children:s})},s))}),e.jsx("div",{className:"bigcal-grid bigcal-grid-cols-7 bigcal-overflow-hidden",children:o.map(s=>e.jsx(tl,{cell:s,events:t,eventPositions:g},s.date.toISOString()))})]})}const oe=D.forwardRef(({className:a,children:l,...i},t)=>e.jsxs(Z.Root,{ref:t,className:p("bigcal-relative bigcal-overflow-hidden",a),...i,children:[e.jsx(Z.Viewport,{className:"bigcal-size-full bigcal-rounded-[inherit]",children:l}),e.jsx(ra,{}),e.jsx(Z.Corner,{})]}));oe.displayName=Z.Root.displayName;const ra=D.forwardRef(({className:a,orientation:l="vertical",...i},t)=>e.jsx(Z.ScrollAreaScrollbar,{ref:t,orientation:l,className:p("bigcal-flex bigcal-touch-none bigcal-select-none bigcal-transition-colors",l==="vertical"&&"bigcal-h-full bigcal-w-2.5 bigcal-border-l bigcal-border-l-transparent bigcal-p-[1px]",l==="horizontal"&&"bigcal-h-2.5 bigcal-flex-col bigcal-border-t bigcal-border-t-transparent bigcal-p-[1px]",a),...i,children:e.jsx(Z.ScrollAreaThumb,{className:"bigcal-relative bigcal-flex-1 bigcal-rounded-full bigcal-bg-border"})}));ra.displayName=Z.ScrollAreaScrollbar.displayName;const rl=ee.cva("bigcal-flex bigcal-select-none bigcal-items-center bigcal-justify-between bigcal-gap-3 bigcal-rounded-md bigcal-border bigcal-p-3 bigcal-text-sm focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring",{variants:{color:{blue:"bigcal-border-blue-200 bigcal-bg-blue-50 bigcal-text-blue-700 dark:bigcal-border-blue-800 dark:bigcal-bg-blue-950 dark:bigcal-text-blue-300 [&_.bigcal-event-dot]:bigcal-fill-blue-600",green:"bigcal-border-green-200 bigcal-bg-green-50 bigcal-text-green-700 dark:bigcal-border-green-800 dark:bigcal-bg-green-950 dark:bigcal-text-green-300 [&_.bigcal-event-dot]:bigcal-fill-green-600",red:"bigcal-border-red-200 bigcal-bg-red-50 bigcal-text-red-700 dark:bigcal-border-red-800 dark:bigcal-bg-red-950 dark:bigcal-text-red-300 [&_.bigcal-event-dot]:bigcal-fill-red-600",yellow:"bigcal-border-yellow-200 bigcal-bg-yellow-50 bigcal-text-yellow-700 dark:bigcal-border-yellow-800 dark:bigcal-bg-yellow-950 dark:bigcal-text-yellow-300 [&_.bigcal-event-dot]:bigcal-fill-yellow-600",purple:"bigcal-border-purple-200 bigcal-bg-purple-50 bigcal-text-purple-700 dark:bigcal-border-purple-800 dark:bigcal-bg-purple-950 dark:bigcal-text-purple-300 [&_.bigcal-event-dot]:bigcal-fill-purple-600",orange:"bigcal-border-orange-200 bigcal-bg-orange-50 bigcal-text-orange-700 dark:bigcal-border-orange-800 dark:bigcal-bg-orange-950 dark:bigcal-text-orange-300 [&_.bigcal-event-dot]:bigcal-fill-orange-600",gray:"bigcal-border-neutral-200 bigcal-bg-neutral-50 bigcal-text-neutral-900 dark:bigcal-border-neutral-700 dark:bigcal-bg-neutral-900 dark:bigcal-text-neutral-300 [&_.bigcal-event-dot]:bigcal-fill-neutral-600","blue-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-blue-600","green-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-green-600","red-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-red-600","orange-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-orange-600","purple-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-purple-600","yellow-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-yellow-600","gray-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-neutral-600"}},defaultVariants:{color:"blue-dot"}});function xa({event:a,eventCurrentDay:l,eventTotalDays:i,className:t}){const{badgeVariant:o}=C(),g=r.parseISO(a.startDate),s=r.parseISO(a.endDate),c=o==="dot"?`${a.color}-dot`:a.color,n=rl({color:c,className:t}),d=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.currentTarget instanceof HTMLElement&&u.currentTarget.click())};return e.jsx(ze,{event:a,children:e.jsx("div",{role:"button",tabIndex:0,className:n,onKeyDown:d,children:e.jsxs("div",{className:"bigcal-flex bigcal-flex-col bigcal-gap-2",children:[e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-1.5",children:[["mixed","dot"].includes(o)&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"bigcal-event-dot bigcal-shrink-0",children:e.jsx("circle",{cx:"4",cy:"4",r:"4"})}),e.jsxs("p",{className:"bigcal-font-medium",children:[l&&i&&e.jsxs("span",{className:"bigcal-mr-1 bigcal-text-xs",children:["Day ",l," of ",i," •"," "]}),a.title]})]}),e.jsxs("div",{className:"bigcal-mt-1 bigcal-flex bigcal-items-center bigcal-gap-1",children:[e.jsx(N.User,{className:"bigcal-size-3 bigcal-shrink-0"}),e.jsx("p",{className:"bigcal-text-xs bigcal-text-foreground",children:a.user.name})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-1",children:[e.jsx(N.Clock,{className:"bigcal-size-3 bigcal-shrink-0"}),e.jsxs("p",{className:"bigcal-text-xs bigcal-text-foreground",children:[r.format(g,"h:mm a")," - ",r.format(s,"h:mm a")]})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-1",children:[e.jsx(N.Text,{className:"bigcal-size-3 bigcal-shrink-0"}),e.jsx("p",{className:"bigcal-text-xs bigcal-text-foreground",children:a.description})]})]})})})}function sl({date:a,events:l,multiDayEvents:i}){const t=[...l].sort((o,g)=>new Date(o.startDate).getTime()-new Date(g.startDate).getTime());return e.jsxs("div",{className:"bigcal-space-y-4",children:[e.jsx("div",{className:"bigcal-sticky bigcal-top-0 bigcal-flex bigcal-items-center bigcal-gap-4 bigcal-bg-background bigcal-py-2",children:e.jsx("p",{className:"bigcal-text-sm bigcal-font-semibold",children:r.format(a,"EEEE, MMMM d, yyyy")})}),e.jsxs("div",{className:"bigcal-space-y-2",children:[i.length>0&&i.map(o=>{const g=r.startOfDay(r.parseISO(o.startDate)),s=r.startOfDay(r.parseISO(o.endDate)),c=r.startOfDay(a),n=r.differenceInDays(s,g)+1,d=r.differenceInDays(c,g)+1;return e.jsx(xa,{event:o,eventCurrentDay:d,eventTotalDays:n},o.id)}),t.length>0&&t.map(o=>e.jsx(xa,{event:o},o.id))]})]})}function Qa({singleDayEvents:a,multiDayEvents:l}){const{selectedDate:i}=C(),t=j.useMemo(()=>{const g=new Map;return a.forEach(s=>{var d;const c=r.parseISO(s.startDate);if(!r.isSameMonth(c,i))return;const n=r.format(c,"yyyy-MM-dd");g.has(n)||g.set(n,{date:r.startOfDay(c),events:[],multiDayEvents:[]}),(d=g.get(n))==null||d.events.push(s)}),l.forEach(s=>{var x;const c=r.parseISO(s.startDate),n=r.parseISO(s.endDate);let d=r.startOfDay(c);const u=r.endOfDay(n);for(;d<=u;){if(r.isSameMonth(d,i)){const f=r.format(d,"yyyy-MM-dd");g.has(f)||g.set(f,{date:new Date(d),events:[],multiDayEvents:[]}),(x=g.get(f))==null||x.multiDayEvents.push(s)}d=new Date(d.setDate(d.getDate()+1))}}),Array.from(g.values()).sort((s,c)=>s.date.getTime()-c.date.getTime())},[a,l,i]),o=a.length>0||l.length>0;return e.jsx("div",{className:"bigcal-h-[800px]",children:e.jsx(oe,{className:"bigcal-h-full",type:"always",children:e.jsxs("div",{className:"bigcal-space-y-6 bigcal-p-4",children:[t.map(g=>e.jsx(sl,{date:g.date,events:g.events,multiDayEvents:g.multiDayEvents},r.format(g.date,"yyyy-MM-dd"))),!o&&e.jsxs("div",{className:"bigcal-flex bigcal-flex-col bigcal-items-center bigcal-justify-center bigcal-gap-2 bigcal-py-20 bigcal-text-muted-foreground",children:[e.jsx(N.CalendarX2,{className:"bigcal-size-10"}),e.jsx("p",{className:"bigcal-text-sm md:bigcal-text-base",children:"No events scheduled for the selected month"})]})]})})})}const nl=ee.cva("bigcal-flex bigcal-select-none bigcal-flex-col bigcal-gap-0.5 bigcal-truncate bigcal-whitespace-nowrap bigcal-rounded-md bigcal-border bigcal-px-2 bigcal-py-1.5 bigcal-text-xs focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring",{variants:{color:{blue:"bigcal-border-blue-200 bigcal-bg-blue-50 bigcal-text-blue-700 dark:bigcal-border-blue-800 dark:bigcal-bg-blue-950 dark:bigcal-text-blue-300 [&_.bigcal-event-dot]:bigcal-fill-blue-600",green:"bigcal-border-green-200 bigcal-bg-green-50 bigcal-text-green-700 dark:bigcal-border-green-800 dark:bigcal-bg-green-950 dark:bigcal-text-green-300 [&_.bigcal-event-dot]:bigcal-fill-green-600",red:"bigcal-border-red-200 bigcal-bg-red-50 bigcal-text-red-700 dark:bigcal-border-red-800 dark:bigcal-bg-red-950 dark:bigcal-text-red-300 [&_.bigcal-event-dot]:bigcal-fill-red-600",yellow:"bigcal-border-yellow-200 bigcal-bg-yellow-50 bigcal-text-yellow-700 dark:bigcal-border-yellow-800 dark:bigcal-bg-yellow-950 dark:bigcal-text-yellow-300 [&_.bigcal-event-dot]:bigcal-fill-yellow-600",purple:"bigcal-border-purple-200 bigcal-bg-purple-50 bigcal-text-purple-700 dark:bigcal-border-purple-800 dark:bigcal-bg-purple-950 dark:bigcal-text-purple-300 [&_.bigcal-event-dot]:bigcal-fill-purple-600",orange:"bigcal-border-orange-200 bigcal-bg-orange-50 bigcal-text-orange-700 dark:bigcal-border-orange-800 dark:bigcal-bg-orange-950 dark:bigcal-text-orange-300 [&_.bigcal-event-dot]:bigcal-fill-orange-600",gray:"bigcal-border-neutral-200 bigcal-bg-neutral-50 bigcal-text-neutral-700 dark:bigcal-border-neutral-700 dark:bigcal-bg-neutral-900 dark:bigcal-text-neutral-300 [&_.bigcal-event-dot]:bigcal-fill-neutral-600","blue-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-blue-600","green-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-green-600","red-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-red-600","orange-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-orange-600","purple-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-purple-600","yellow-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-yellow-600","gray-dot":"bigcal-bg-neutral-50 dark:bigcal-bg-neutral-900 [&_.bigcal-event-dot]:bigcal-fill-neutral-600"}},defaultVariants:{color:"blue-dot"}});function ei({event:a,className:l}){const{badgeVariant:i}=C(),t=r.parseISO(a.startDate),o=r.parseISO(a.endDate),g=r.differenceInMinutes(o,t),s=g/60*96-8,c=i==="dot"?`${a.color}-dot`:a.color,n=p(nl({color:c,className:l}),g<35&&"bigcal-py-0 bigcal-justify-center"),d=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.currentTarget instanceof HTMLElement&&u.currentTarget.click())};return e.jsx(ta,{event:a,children:e.jsx(ze,{event:a,children:e.jsxs("div",{role:"button",tabIndex:0,className:n,style:{height:`${s}px`},onKeyDown:d,children:[e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-1.5 bigcal-truncate",children:[["mixed","dot"].includes(i)&&e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",className:"bigcal-event-dot bigcal-shrink-0",children:e.jsx("circle",{cx:"4",cy:"4",r:"4"})}),e.jsx("p",{className:"bigcal-truncate bigcal-font-semibold",children:a.title})]}),g>25&&e.jsxs("p",{children:[r.format(t,"h:mm a")," - ",r.format(o,"h:mm a")]})]})})})}function $({date:a,hour:l,minute:i,children:t}){const{updateEvent:o}=la(),[{isOver:g,canDrop:s},c]=be.useDrop(()=>({accept:_e.EVENT,drop:n=>{const d=n.event,u=r.parseISO(d.startDate),x=r.parseISO(d.endDate),f=r.differenceInMilliseconds(x,u),m=new Date(a);m.setHours(l,i,0,0);const b=new Date(m.getTime()+f);return o({...d,startDate:m.toISOString(),endDate:b.toISOString()}),{moved:!0}},collect:n=>({isOver:n.isOver(),canDrop:n.canDrop()})}),[a,l,i,o]);return e.jsx("div",{ref:c,className:p("bigcal-h-[24px]",g&&s&&"bigcal-bg-accent/50"),children:t})}function ai({firstVisibleHour:a,lastVisibleHour:l}){const[i,t]=j.useState(new Date);j.useEffect(()=>{const c=setInterval(()=>t(new Date),6e4);return()=>clearInterval(c)},[]);const o=()=>{const c=i.getHours()*60+i.getMinutes(),n=a*60,u=l*60-n;return(c-n)/u*100},g=()=>r.format(i,"h:mm a"),s=i.getHours();return s<a||s>=l?null:e.jsxs("div",{className:"bigcal-pointer-events-none bigcal-absolute bigcal-inset-x-0 bigcal-z-50 bigcal-border-t bigcal-border-primary",style:{top:`${o()}%`},children:[e.jsx("div",{className:"bigcal-absolute bigcal-left-0 bigcal-top-0 bigcal-size-3 bigcal--translate-x-1/2 bigcal--translate-y-1/2 bigcal-rounded-full bigcal-bg-primary"}),e.jsx("div",{className:"bigcal-absolute bigcal--left-18 bigcal-flex bigcal-w-16 bigcal--translate-y-1/2 bigcal-justify-end bigcal-bg-background bigcal-pr-1 bigcal-text-xs bigcal-font-medium bigcal-text-primary",children:g()})]})}function ol({selectedDate:a,multiDayEvents:l}){const i=r.startOfDay(a),t=r.endOfDay(a),o=l.filter(g=>{const s=r.parseISO(g.startDate),c=r.parseISO(g.endDate);return r.isWithinInterval(i,{start:s,end:c})||r.isWithinInterval(t,{start:s,end:c})||s<=i&&c>=t}).sort((g,s)=>{const c=r.differenceInDays(r.parseISO(g.endDate),r.parseISO(g.startDate));return r.differenceInDays(r.parseISO(s.endDate),r.parseISO(s.startDate))-c});return o.length===0?null:e.jsxs("div",{className:"bigcal-flex bigcal-border-b",children:[e.jsx("div",{className:"bigcal-w-18"}),e.jsx("div",{className:"bigcal-flex bigcal-flex-1 bigcal-flex-col bigcal-gap-1 bigcal-border-l bigcal-py-1",children:o.map(g=>{const s=r.startOfDay(r.parseISO(g.startDate)),c=r.startOfDay(r.parseISO(g.endDate)),n=r.startOfDay(a),d=r.differenceInDays(c,s)+1,u=r.differenceInDays(n,s)+1;return e.jsx(ca,{event:g,cellDate:a,eventCurrentDay:u,eventTotalDays:d},g.id)})})]})}function ii({singleDayEvents:a,multiDayEvents:l}){const{selectedDate:i,setSelectedDate:t,users:o,visibleHours:g,workingHours:s}=C(),{hours:c,earliestEventHour:n,latestEventHour:d}=Ke(g,a),u=Oa(a),x=a.filter(m=>{const b=r.parseISO(m.startDate);return b.getDate()===i.getDate()&&b.getMonth()===i.getMonth()&&b.getFullYear()===i.getFullYear()}),f=Ue(x);return e.jsxs("div",{className:"bigcal-flex",children:[e.jsxs("div",{className:"bigcal-flex bigcal-flex-1 bigcal-flex-col",children:[e.jsxs("div",{children:[e.jsx(ol,{selectedDate:i,multiDayEvents:l}),e.jsxs("div",{className:"bigcal-relative bigcal-z-20 bigcal-flex bigcal-border-b",children:[e.jsx("div",{className:"bigcal-w-18"}),e.jsxs("span",{className:"bigcal-flex-1 bigcal-border-l bigcal-py-2 bigcal-text-center bigcal-text-xs bigcal-font-medium bigcal-text-muted-foreground",children:[r.format(i,"EE")," ",e.jsx("span",{className:"bigcal-font-semibold bigcal-text-foreground",children:r.format(i,"d")})]})]})]}),e.jsx(oe,{className:"bigcal-h-[800px]",type:"always",children:e.jsxs("div",{className:"bigcal-flex",children:[e.jsx("div",{className:"bigcal-relative bigcal-w-18",children:c.map((m,b)=>e.jsx("div",{className:"bigcal-relative",style:{height:"96px"},children:e.jsx("div",{className:"bigcal-absolute bigcal--top-3 bigcal-right-2 bigcal-flex bigcal-h-6 bigcal-items-center",children:b!==0&&e.jsx("span",{className:"bigcal-text-xs bigcal-text-muted-foreground",children:r.format(new Date().setHours(m,0,0,0),"hh a")})})},m))}),e.jsxs("div",{className:"bigcal-relative bigcal-flex-1 bigcal-border-l",children:[e.jsxs("div",{className:"bigcal-relative",children:[c.map((m,b)=>{const h=!Ge(i,m,s);return e.jsxs("div",{className:p("bigcal-relative",h&&"bigcal-bg-calendar-disabled-hour"),style:{height:"96px"},children:[b!==0&&e.jsx("div",{className:"bigcal-pointer-events-none bigcal-absolute bigcal-inset-x-0 bigcal-top-0 bigcal-border-b"}),e.jsx($,{date:i,hour:m,minute:0,children:e.jsx(L,{startDate:i,startTime:{hour:m,minute:0},children:e.jsx("div",{className:"bigcal-absolute bigcal-inset-x-0 bigcal-top-0 bigcal-h-[24px] bigcal-cursor-pointer bigcal-transition-colors hover:bigcal-bg-accent"})})}),e.jsx($,{date:i,hour:m,minute:15,children:e.jsx(L,{startDate:i,startTime:{hour:m,minute:15},children:e.jsx("div",{className:"bigcal-absolute bigcal-inset-x-0 bigcal-top-[24px] bigcal-h-[24px] bigcal-cursor-pointer bigcal-transition-colors hover:bigcal-bg-accent"})})}),e.jsx("div",{className:"bigcal-pointer-events-none bigcal-absolute bigcal-inset-x-0 bigcal-top-1/2 bigcal-border-b bigcal-border-dashed"}),e.jsx($,{date:i,hour:m,minute:30,children:e.jsx(L,{startDate:i,startTime:{hour:m,minute:30},children:e.jsx("div",{className:"bigcal-absolute bigcal-inset-x-0 bigcal-top-[48px] bigcal-h-[24px] bigcal-cursor-pointer bigcal-transition-colors hover:bigcal-bg-accent"})})}),e.jsx($,{date:i,hour:m,minute:45,children:e.jsx(L,{startDate:i,startTime:{hour:m,minute:45},children:e.jsx("div",{className:"bigcal-absolute bigcal-inset-x-0 bigcal-top-[72px] bigcal-h-[24px] bigcal-cursor-pointer bigcal-transition-colors hover:bigcal-bg-accent"})})})]},m)}),f.map((m,b)=>m.map(h=>{let v=Ye(h,i,b,f.length,{from:n,to:d});return f.some((k,P)=>P!==b&&k.some(H=>r.areIntervalsOverlapping({start:r.parseISO(h.startDate),end:r.parseISO(h.endDate)},{start:r.parseISO(H.startDate),end:r.parseISO(H.endDate)})))||(v={...v,width:"100%",left:"0%"}),e.jsx("div",{className:"bigcal-absolute bigcal-p-1",style:v,children:e.jsx(ei,{event:h})},h.id)}))]}),e.jsx(ai,{firstVisibleHour:n,lastVisibleHour:d})]})]})})]}),e.jsxs("div",{className:"bigcal-hidden bigcal-w-64 bigcal-divide-y bigcal-border-l md:bigcal-block",children:[e.jsx(Me,{className:"bigcal-mx-auto bigcal-w-fit",mode:"single",selected:i,onSelect:t,initialFocus:!0}),e.jsxs("div",{className:"bigcal-flex-1 bigcal-space-y-3",children:[u.length>0?e.jsxs("div",{className:"bigcal-flex bigcal-items-start bigcal-gap-2 bigcal-px-4 bigcal-pt-4",children:[e.jsxs("span",{className:"bigcal-relative bigcal-mt-[5px] bigcal-flex bigcal-size-2.5",children:[e.jsx("span",{className:"bigcal-absolute bigcal-inline-flex bigcal-size-full bigcal-animate-ping bigcal-rounded-full bigcal-bg-green-400 bigcal-opacity-75"}),e.jsx("span",{className:"bigcal-relative bigcal-inline-flex bigcal-size-2.5 bigcal-rounded-full bigcal-bg-green-600"})]}),e.jsx("p",{className:"bigcal-text-sm bigcal-font-semibold bigcal-text-foreground",children:"Happening now"})]}):e.jsx("p",{className:"bigcal-p-4 bigcal-text-center bigcal-text-sm bigcal-italic bigcal-text-muted-foreground",children:"No appointments or consultations at the moment"}),u.length>0&&e.jsx(oe,{className:"bigcal-h-[422px] bigcal-px-4",type:"always",children:e.jsx("div",{className:"bigcal-space-y-6 bigcal-pb-4",children:u.map(m=>{const b=o.find(h=>h.id===m.user.id);return e.jsxs("div",{className:"bigcal-space-y-1.5",children:[e.jsx("p",{className:"bigcal-line-clamp-2 bigcal-text-sm bigcal-font-semibold",children:m.title}),b&&e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-1.5 bigcal-text-muted-foreground",children:[e.jsx(N.User,{className:"bigcal-size-3.5"}),e.jsx("span",{className:"bigcal-text-sm",children:b.name})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-1.5 bigcal-text-muted-foreground",children:[e.jsx(N.Calendar,{className:"bigcal-size-3.5"}),e.jsx("span",{className:"bigcal-text-sm",children:r.format(new Date,"MMM d, yyyy")})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-1.5 bigcal-text-muted-foreground",children:[e.jsx(N.Clock,{className:"bigcal-size-3.5"}),e.jsxs("span",{className:"bigcal-text-sm",children:[r.format(r.parseISO(m.startDate),"h:mm a")," - ",r.format(r.parseISO(m.endDate),"h:mm a")]})]})]},m.id)})})})]})]})]})}function gl({selectedDate:a,multiDayEvents:l}){const i=r.startOfWeek(a),t=r.endOfWeek(a),o=Array.from({length:7},(n,d)=>r.addDays(i,d)),g=j.useMemo(()=>l.map(n=>{const d=r.parseISO(n.startDate),u=r.parseISO(n.endDate),x=r.isBefore(d,i)?i:d,f=r.isAfter(u,t)?t:u,m=r.differenceInDays(x,i),b=r.differenceInDays(f,i);return{...n,adjustedStart:x,adjustedEnd:f,startIndex:m,endIndex:b}}).sort((n,d)=>{const u=n.adjustedStart.getTime()-d.adjustedStart.getTime();return u!==0?u:d.endIndex-d.startIndex-(n.endIndex-n.startIndex)}),[l,i,t]),s=j.useMemo(()=>{const n=[];return g.forEach(d=>{let u=n.findIndex(x=>x.every(f=>f.endIndex<d.startIndex||f.startIndex>d.endIndex));u===-1&&(u=n.length,n.push([])),n[u].push(d)}),n},[g]);return j.useMemo(()=>l.some(n=>{const d=r.parseISO(n.startDate),u=r.parseISO(n.endDate);return d>=i&&d<=t||u>=i&&u<=t||d<=i&&u>=t}),[l,i,t])?e.jsxs("div",{className:"bigcal-hidden bigcal-overflow-hidden sm:bigcal-flex",children:[e.jsx("div",{className:"bigcal-w-18 bigcal-border-b"}),e.jsx("div",{className:"bigcal-grid bigcal-flex-1 bigcal-grid-cols-7 bigcal-divide-x bigcal-border-b bigcal-border-l",children:o.map((n,d)=>e.jsx("div",{className:"bigcal-flex bigcal-h-full bigcal-flex-col bigcal-gap-1 bigcal-py-1",children:s.map((u,x)=>{const f=u.find(b=>b.startIndex<=d&&b.endIndex>=d);if(!f)return e.jsx("div",{className:"bigcal-h-6.5"},`${x}-${d}`);let m="none";return d===f.startIndex&&d===f.endIndex?m="none":d===f.startIndex?m="first":d===f.endIndex?m="last":m="middle",e.jsx(ca,{event:f,cellDate:r.startOfDay(n),position:m},`${f.id}-${d}`)})},n.toISOString()))})]}):null}function li({singleDayEvents:a,multiDayEvents:l}){const{selectedDate:i,workingHours:t,visibleHours:o}=C(),{hours:g,earliestEventHour:s,latestEventHour:c}=Ke(o,a),n=r.startOfWeek(i),d=Array.from({length:7},(u,x)=>r.addDays(n,x));return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"bigcal-flex bigcal-flex-col bigcal-items-center bigcal-justify-center bigcal-border-b bigcal-py-4 bigcal-text-sm bigcal-text-muted-foreground sm:bigcal-hidden",children:[e.jsx("p",{children:"Weekly view is not available on smaller devices."}),e.jsx("p",{children:"Please switch to daily or monthly view."})]}),e.jsxs("div",{className:"bigcal-hidden bigcal-flex-col sm:bigcal-flex",children:[e.jsxs("div",{children:[e.jsx(gl,{selectedDate:i,multiDayEvents:l}),e.jsxs("div",{className:"bigcal-relative bigcal-z-20 bigcal-flex bigcal-border-b",children:[e.jsx("div",{className:"bigcal-w-18"}),e.jsx("div",{className:"bigcal-grid bigcal-flex-1 bigcal-grid-cols-7 bigcal-divide-x bigcal-border-l",children:d.map((u,x)=>e.jsxs("span",{className:"bigcal-py-2 bigcal-text-center bigcal-text-xs bigcal-font-medium bigcal-text-muted-foreground",children:[r.format(u,"EE")," ",e.jsx("span",{className:"bigcal-ml-1 bigcal-font-semibold bigcal-text-foreground",children:r.format(u,"d")})]},x))})]})]}),e.jsx(oe,{className:"bigcal-h-[736px]",type:"always",children:e.jsxs("div",{className:"bigcal-flex bigcal-overflow-hidden",children:[e.jsx("div",{className:"bigcal-relative bigcal-w-18",children:g.map((u,x)=>e.jsx("div",{className:"bigcal-relative",style:{height:"96px"},children:e.jsx("div",{className:"bigcal-absolute bigcal--top-3 bigcal-right-2 bigcal-flex bigcal-h-6 bigcal-items-center",children:x!==0&&e.jsx("span",{className:"bigcal-text-xs bigcal-text-muted-foreground",children:r.format(new Date().setHours(u,0,0,0),"hh a")})})},u))}),e.jsxs("div",{className:"bigcal-relative bigcal-flex-1 bigcal-border-l",children:[e.jsx("div",{className:"bigcal-grid bigcal-grid-cols-7 bigcal-divide-x",children:d.map((u,x)=>{const f=a.filter(b=>r.isSameDay(r.parseISO(b.startDate),u)||r.isSameDay(r.parseISO(b.endDate),u)),m=Ue(f);return e.jsxs("div",{className:"bigcal-relative",children:[g.map((b,h)=>{const v=!Ge(u,b,t);return e.jsxs("div",{className:p("bigcal-relative bigcal-bg-background",v&&"bigcal-bg-calendar-disabled-hour"),style:{height:"96px"},children:[h!==0&&e.jsx("div",{className:"bigcal-pointer-events-none bigcal-absolute bigcal-inset-x-0 bigcal-top-0 bigcal-border-b"}),e.jsx($,{date:u,hour:b,minute:0,children:e.jsx(L,{startDate:u,startTime:{hour:b,minute:0},children:e.jsx("div",{className:"bigcal-absolute bigcal-inset-x-0 bigcal-top-0 bigcal-h-[24px] bigcal-cursor-pointer bigcal-transition-colors hover:bigcal-bg-accent"})})}),e.jsx($,{date:u,hour:b,minute:15,children:e.jsx(L,{startDate:u,startTime:{hour:b,minute:15},children:e.jsx("div",{className:"bigcal-absolute bigcal-inset-x-0 bigcal-top-[24px] bigcal-h-[24px] bigcal-cursor-pointer bigcal-transition-colors hover:bigcal-bg-accent"})})}),e.jsx("div",{className:"bigcal-pointer-events-none bigcal-absolute bigcal-inset-x-0 bigcal-top-1/2 bigcal-border-b bigcal-border-dashed"}),e.jsx($,{date:u,hour:b,minute:30,children:e.jsx(L,{startDate:u,startTime:{hour:b,minute:30},children:e.jsx("div",{className:"bigcal-absolute bigcal-inset-x-0 bigcal-top-[48px] bigcal-h-[24px] bigcal-cursor-pointer bigcal-transition-colors hover:bigcal-bg-accent"})})}),e.jsx($,{date:u,hour:b,minute:45,children:e.jsx(L,{startDate:u,startTime:{hour:b,minute:45},children:e.jsx("div",{className:"bigcal-absolute bigcal-inset-x-0 bigcal-top-[72px] bigcal-h-[24px] bigcal-cursor-pointer bigcal-transition-colors hover:bigcal-bg-accent"})})})]},b)}),m.map((b,h)=>b.map(v=>{let S=Ye(v,u,h,m.length,{from:s,to:c});return m.some((P,H)=>H!==h&&P.some(ie=>r.areIntervalsOverlapping({start:r.parseISO(v.startDate),end:r.parseISO(v.endDate)},{start:r.parseISO(ie.startDate),end:r.parseISO(ie.endDate)})))||(S={...S,width:"100%",left:"0%"}),e.jsx("div",{className:"bigcal-absolute bigcal-p-1",style:S,children:e.jsx(ei,{event:v})},v.id)}))]},x)})}),e.jsx(ai,{firstVisibleHour:s,lastVisibleHour:c})]})]})})]})]})}function dl({view:a,onViewChange:l,showHeader:i=!0,headerProps:t={},className:o,headerClassName:g,contentClassName:s}){const{selectedDate:c,selectedUserId:n,events:d}=C(),u=j.useMemo(()=>d.filter(b=>{const h=r.parseISO(b.startDate),v=r.parseISO(b.endDate);if(a==="year"){const S=new Date(c.getFullYear(),0,1),k=new Date(c.getFullYear(),11,31,23,59,59,999),P=h<=k&&v>=S,H=n==="all"||b.user.id===n;return P&&H}if(a==="month"||a==="agenda"){const S=new Date(c.getFullYear(),c.getMonth(),1),k=new Date(c.getFullYear(),c.getMonth()+1,0,23,59,59,999),P=h<=k&&v>=S,H=n==="all"||b.user.id===n;return P&&H}if(a==="week"){const S=c.getDay(),k=new Date(c);k.setDate(c.getDate()-S),k.setHours(0,0,0,0);const P=new Date(k);P.setDate(k.getDate()+6),P.setHours(23,59,59,999);const H=h<=P&&v>=k,ie=n==="all"||b.user.id===n;return H&&ie}if(a==="day"){const S=new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0),k=new Date(c.getFullYear(),c.getMonth(),c.getDate(),23,59,59),P=h<=k&&v>=S,H=n==="all"||b.user.id===n;return P&&H}}),[c,n,d,a]),x=u.filter(b=>{const h=r.parseISO(b.startDate),v=r.parseISO(b.endDate);return r.isSameDay(h,v)}),f=u.filter(b=>{const h=r.parseISO(b.startDate),v=r.parseISO(b.endDate);return!r.isSameDay(h,v)}),m=j.useMemo(()=>u.map(b=>({...b,endDate:b.startDate})),[u]);return e.jsxs("div",{className:p("bigcal-overflow-hidden bigcal-rounded-xl bigcal-border",o),children:[i&&e.jsx(Ga,{view:a,events:u,onViewChange:l,className:p(g,t.className),...t}),e.jsx(ya,{children:e.jsxs("div",{className:s,children:[a==="day"&&e.jsx(ii,{singleDayEvents:x,multiDayEvents:f}),a==="month"&&e.jsx(Ja,{singleDayEvents:x,multiDayEvents:f}),a==="week"&&e.jsx(li,{singleDayEvents:x,multiDayEvents:f}),a==="year"&&e.jsx(Ka,{allEvents:m}),a==="agenda"&&e.jsx(Qa,{singleDayEvents:x,multiDayEvents:f})]})})]})}function bl(){const{badgeVariant:a,setBadgeVariant:l}=C();return e.jsxs("div",{className:"bigcal-space-y-2",children:[e.jsx("p",{className:"bigcal-text-sm bigcal-font-semibold",children:"Change badge variant"}),e.jsxs(J,{value:a,onValueChange:l,children:[e.jsx(U,{className:"bigcal-w-48",children:e.jsx(Q,{})}),e.jsxs(Y,{children:[e.jsx(I,{value:"dot",children:"Dot"}),e.jsx(I,{value:"colored",children:"Colored"}),e.jsx(I,{value:"mixed",children:"Mixed"})]})]})]})}const sa=ce.Provider,na=ce.Root,oa=ce.Trigger,Pe=D.forwardRef(({className:a,sideOffset:l=4,...i},t)=>e.jsx(ce.Portal,{children:e.jsx(ce.Content,{ref:t,sideOffset:l,className:p("bigcal-z-50 bigcal-overflow-hidden bigcal-rounded-md bigcal-bg-primary bigcal-px-3 bigcal-py-1.5 bigcal-text-xs bigcal-text-primary-foreground bigcal-animate-in bigcal-fade-in-0 bigcal-zoom-in-95 data-[state=closed]:bigcal-animate-out data-[state=closed]:bigcal-fade-out-0 data-[state=closed]:bigcal-zoom-out-95 data-[side=bottom]:bigcal-slide-in-from-top-2 data-[side=left]:bigcal-slide-in-from-right-2 data-[side=right]:bigcal-slide-in-from-left-2 data-[side=top]:bigcal-slide-in-from-bottom-2 bigcal-origin-[--radix-tooltip-content-transform-origin]",a),...i})}));Pe.displayName=ce.Content.displayName;function ul(){const{visibleHours:a,setVisibleHours:l}=C(),[i,t]=j.useState({hour:a.from,minute:0}),[o,g]=j.useState({hour:a.to,minute:0}),s=()=>{const c=o.hour===0?24:o.hour;l({from:i.hour,to:c})};return e.jsxs("div",{className:"bigcal-flex bigcal-flex-col bigcal-gap-2",children:[e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("p",{className:"bigcal-text-sm bigcal-font-semibold",children:"Change visible hours"}),e.jsx(sa,{delayDuration:100,children:e.jsxs(na,{children:[e.jsx(oa,{children:e.jsx(N.Info,{className:"bigcal-size-3"})}),e.jsx(Pe,{className:"bigcal-max-w-80 bigcal-text-center",children:e.jsx("p",{children:"If an event falls outside the specified visible hours, the visible hours will automatically adjust to include that event."})})]})})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-4",children:[e.jsx("p",{children:"From"}),e.jsx(W,{id:"start-time",hourCycle:12,granularity:"hour",value:i,onChange:t}),e.jsx("p",{children:"To"}),e.jsx(W,{id:"end-time",hourCycle:12,granularity:"hour",value:o,onChange:g})]}),e.jsx(O,{className:"bigcal-mt-4 bigcal-w-fit",onClick:s,children:"Apply"})]})}const ga=D.forwardRef(({className:a,...l},i)=>e.jsx(Be.Root,{className:p("bigcal-peer bigcal-inline-flex bigcal-h-5 bigcal-w-9 bigcal-shrink-0 bigcal-cursor-pointer bigcal-items-center bigcal-rounded-full bigcal-border-2 bigcal-border-transparent bigcal-shadow-sm bigcal-transition-colors focus-visible:bigcal-outline-none focus-visible:bigcal-ring-2 focus-visible:bigcal-ring-ring focus-visible:bigcal-ring-offset-2 focus-visible:bigcal-ring-offset-background disabled:bigcal-cursor-not-allowed disabled:bigcal-opacity-50 data-[state=checked]:bigcal-bg-primary data-[state=unchecked]:bigcal-bg-input",a),...l,ref:i,children:e.jsx(Be.Thumb,{className:p("bigcal-pointer-events-none bigcal-block bigcal-h-4 bigcal-w-4 bigcal-rounded-full bigcal-bg-background bigcal-shadow-lg bigcal-ring-0 bigcal-transition-transform data-[state=checked]:bigcal-translate-x-4 data-[state=unchecked]:bigcal-translate-x-0")})}));ga.displayName=Be.Root.displayName;const ml=[{index:0,name:"Sunday"},{index:1,name:"Monday"},{index:2,name:"Tuesday"},{index:3,name:"Wednesday"},{index:4,name:"Thursday"},{index:5,name:"Friday"},{index:6,name:"Saturday"}];function xl(){const{workingHours:a,setWorkingHours:l}=C(),[i,t]=j.useState({...a}),o=c=>{t(n=>({...n,[c]:n[c].from>0||n[c].to>0?{from:0,to:0}:{from:9,to:17}}))},g=(c,n,d)=>{d&&t(u=>{const x={...u[c],[n]:d.hour};return n==="to"&&d.hour===0&&x.from===0&&(x.to=24),{...u,[c]:x}})},s=()=>{const c={...i};for(const n in c){const d=c[parseInt(n)];i[parseInt(n)].from>0||i[parseInt(n)].to>0?d.from===0&&d.to===0?c[n]={from:0,to:24}:d.to===0&&d.from>0&&(c[n]={...d,to:24}):c[n]={from:0,to:0}}l(c)};return e.jsxs("div",{className:"bigcal-flex bigcal-flex-col bigcal-gap-2",children:[e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("p",{className:"bigcal-text-sm bigcal-font-semibold",children:"Change working hours"}),e.jsx(sa,{delayDuration:100,children:e.jsxs(na,{children:[e.jsx(oa,{children:e.jsx(N.Info,{className:"bigcal-size-3"})}),e.jsx(Pe,{className:"bigcal-max-w-80 bigcal-text-center",children:e.jsx("p",{children:"This will apply a dashed background to the hour cells that fall outside the working hours — only for week and day views."})})]})})]}),e.jsx("div",{className:"bigcal-space-y-4",children:ml.map(c=>{const n=i[c.index].from>0||i[c.index].to>0;return e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-4",children:[e.jsxs("div",{className:"bigcal-flex bigcal-w-40 bigcal-items-center bigcal-gap-2",children:[e.jsx(ga,{checked:n,onCheckedChange:()=>o(c.index)}),e.jsx("span",{className:"bigcal-text-sm bigcal-font-medium",children:c.name})]}),n?e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-4",children:[e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("span",{children:"From"}),e.jsx(W,{id:`${c.name.toLowerCase()}-from`,hourCycle:12,granularity:"hour",value:{hour:i[c.index].from,minute:0},onChange:d=>g(c.index,"from",d)})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx("span",{children:"To"}),e.jsx(W,{id:`${c.name.toLowerCase()}-to`,hourCycle:12,granularity:"hour",value:{hour:i[c.index].to,minute:0},onChange:d=>g(c.index,"to",d)})]})]}):e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2 bigcal-text-muted-foreground",children:[e.jsx(N.Moon,{className:"bigcal-size-4"}),e.jsx("span",{children:"Closed"})]})]},c.index)})}),e.jsx(O,{className:"bigcal-mt-4 bigcal-w-fit",onClick:s,children:"Apply"})]})}const fl=X.Root,ti=D.forwardRef(({className:a,...l},i)=>e.jsx(X.Item,{ref:i,className:p("bigcal-border-b",a),...l}));ti.displayName="AccordionItem";const ci=D.forwardRef(({className:a,children:l,...i},t)=>e.jsx(X.Header,{className:"bigcal-flex",children:e.jsxs(X.Trigger,{ref:t,className:p("bigcal-flex bigcal-flex-1 bigcal-items-center bigcal-justify-between bigcal-py-4 bigcal-text-sm bigcal-font-medium bigcal-transition-all hover:bigcal-underline bigcal-text-left [&[data-state=open]>svg]:bigcal-rotate-180",a),...i,children:[l,e.jsx(N.ChevronDown,{className:"bigcal-h-4 bigcal-w-4 bigcal-shrink-0 bigcal-text-muted-foreground bigcal-transition-transform bigcal-duration-200"})]})}));ci.displayName=X.Trigger.displayName;const ri=D.forwardRef(({className:a,children:l,...i},t)=>e.jsx(X.Content,{ref:t,className:"bigcal-overflow-hidden bigcal-text-sm data-[state=closed]:bigcal-animate-accordion-up data-[state=open]:bigcal-animate-accordion-down",...i,children:e.jsx("div",{className:p("bigcal-pb-4 bigcal-pt-0",a),children:l})}));ri.displayName=X.Content.displayName;function si({className:a,...l}){return e.jsx("div",{className:p("bigcal-animate-pulse bigcal-rounded-md bigcal-bg-primary/10",a),...l})}const da="big-calendar-theme",ni=60*60*24*365,we={theme:"dark"};function oi(a){document.cookie=`${da}=${a}; path=/; max-age=${ni}`,document.documentElement.classList.remove("light","dark","bigcal-dark"),document.documentElement.classList.add(a),a==="dark"&&document.documentElement.classList.add("bigcal-dark")}function gi(){const[a,l]=j.useState();j.useEffect(()=>{const t=document.documentElement.classList.contains("dark")?"dark":"light";l(t)},[]);const i=()=>{const t=a==="light"?"dark":"light";oi(t),l(t)};return a?e.jsxs(O,{variant:"ghost",size:"icon",onClick:i,children:[a==="light"&&e.jsx(N.Sun,{}),a==="dark"&&e.jsx(N.Moon,{})]}):e.jsx(si,{className:"bigcal-size-9"})}function hl(){return e.jsx("header",{className:"bigcal-mx-auto bigcal-flex bigcal-h-[88px] bigcal-w-full bigcal-max-w-screen-2xl bigcal-items-center bigcal-justify-center",children:e.jsxs("div",{className:"bigcal-my-3 bigcal-flex bigcal-h-14 bigcal-w-full bigcal-items-center bigcal-justify-between bigcal-px-8",children:[e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-3.5",children:[e.jsx("div",{className:"bigcal-flex bigcal-size-12 bigcal-items-center bigcal-justify-center bigcal-rounded-full bigcal-border bigcal-p-3",children:e.jsx(N.Calendar,{className:"bigcal-size-6 bigcal-text-foreground"})}),e.jsxs("div",{className:"bigcal-space-y-1",children:[e.jsx("p",{className:"bigcal-text-lg bigcal-font-medium bigcal-leading-6",children:"Big calendar"}),e.jsxs("p",{className:"bigcal-text-sm bigcal-text-foreground",children:["Built with React and Tailwind by"," ",e.jsxs("a",{href:"https://github.com/lramos33",target:"_blank",className:"bigcal-inline-flex bigcal-gap-0.5 bigcal-text-sm bigcal-underline focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring",children:["lramos33",e.jsx(N.ArrowUpRight,{size:12,className:"bigcal-text-foreground"})]})]})]})]}),e.jsxs("div",{className:"bigcal-hidden bigcal-items-center bigcal-gap-4 md:bigcal-flex",children:[e.jsxs("a",{href:"https://github.com/lramos33/big-calendar",target:"_blank",className:"bigcal-inline-flex bigcal-gap-0.5 bigcal-text-sm hover:bigcal-underline focus-visible:bigcal-outline-none focus-visible:bigcal-ring-1 focus-visible:bigcal-ring-ring",children:["View on GitHub",e.jsx(N.ArrowUpRight,{size:14,className:"bigcal-text-foreground"})]}),e.jsxs("div",{className:"bigcal-flex bigcal-items-center bigcal-gap-2",children:[e.jsx(O,{size:"icon",asChild:!0,variant:"ghost",children:e.jsx("a",{href:"https://x.com/leoo_ramos1",target:"_blank",children:e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),e.jsx("path",{d:"M4 4l11.733 16h4.267l-11.733 -16z"}),e.jsx("path",{d:"M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772"})]})})}),e.jsx(gi,{})]})]})]})})}const di=["light","dark"];function pl(){var t;if(typeof document>"u")return we.theme;const l=document.cookie.split(";").find(o=>o.trim().startsWith(`${da}=`));if(!l)return we.theme;const i=(t=l.split("=")[1])==null?void 0:t.trim();return di.includes(i)?i:we.theme}const vl={variable:"--font-inter"};exports.Accordion=fl;exports.AccordionContent=ri;exports.AccordionItem=ti;exports.AccordionTrigger=ci;exports.AddEventDialog=L;exports.Avatar=re;exports.AvatarFallback=ne;exports.AvatarGroup=We;exports.AvatarImage=se;exports.Badge=Ia;exports.Button=O;exports.CalendarAgendaView=Qa;exports.CalendarDayView=ii;exports.CalendarHeader=Ga;exports.CalendarMonthView=Ja;exports.CalendarProvider=Ai;exports.CalendarRoot=Xi;exports.CalendarWeekView=li;exports.CalendarYearView=Ka;exports.ChangeBadgeVariantInput=bl;exports.ChangeVisibleHoursInput=ul;exports.ChangeWorkingHoursInput=xl;exports.ClientContainer=dl;exports.CustomDragLayer=ja;exports.DEFAULT_VALUES=we;exports.DateNavigator=za;exports.Dialog=Oe;exports.DialogClose=ea;exports.DialogContent=me;exports.DialogDescription=Te;exports.DialogFooter=fe;exports.DialogHeader=xe;exports.DialogOverlay=aa;exports.DialogPortal=Ya;exports.DialogTitle=he;exports.DialogTrigger=Ee;exports.DndProviderWrapper=ya;exports.DraggableEvent=ta;exports.DroppableDayCell=Za;exports.DroppableTimeBlock=$;exports.EditEventDialog=Xa;exports.EventDetailsDialog=ze;exports.Form=Je;exports.FormControl=_;exports.FormDescription=Ua;exports.FormField=A;exports.FormItem=E;exports.FormLabel=T;exports.FormMessage=z;exports.Header=hl;exports.Input=Ie;exports.ItemTypes=_e;exports.Label=Xe;exports.Popover=La;exports.PopoverAnchor=Ki;exports.PopoverContent=Ze;exports.PopoverTrigger=Wa;exports.ScrollArea=oe;exports.ScrollBar=ra;exports.Select=J;exports.SelectContent=Y;exports.SelectGroup=Hi;exports.SelectItem=I;exports.SelectLabel=Da;exports.SelectScrollDownButton=$e;exports.SelectScrollUpButton=qe;exports.SelectSeparator=Na;exports.SelectTrigger=U;exports.SelectValue=Q;exports.SingleCalendar=Me;exports.SingleDayPicker=de;exports.Skeleton=si;exports.Switch=ga;exports.THEMES_VALUES=di;exports.THEME_COOKIE_MAX_AGE=ni;exports.THEME_COOKIE_NAME=da;exports.Textarea=Ce;exports.TimeInput=W;exports.TodayButton=Sa;exports.ToggleTheme=gi;exports.Tooltip=na;exports.TooltipContent=Pe;exports.TooltipProvider=sa;exports.TooltipTrigger=oa;exports.UserSelect=wa;exports.badgeVariants=ka;exports.buttonVariants=Se;exports.calculateMonthEventPositions=Ta;exports.cn=p;exports.eventSchema=Ji;exports.getCalendarCells=Ea;exports.getCurrentEvents=Oa;exports.getEventBlockStyle=Ye;exports.getEventsCount=Ma;exports.getMonthCellEvents=_a;exports.getTheme=pl;exports.getVisibleHours=Ke;exports.groupEvents=Ue;exports.inter=vl;exports.isWorkingHour=Ge;exports.navigateDate=Le;exports.rangeText=Ca;exports.setTheme=oi;exports.useCalendar=C;exports.useDisclosure=ke;exports.useFormField=ue;exports.useIsDark=Qe;exports.useUpdateEvent=la;
2
2
  //# sourceMappingURL=big-calendar.cjs.map