"use client"
import{q as u}from"./chunk-D2UYR6SE.mjs";import{addYears as P,format as O,isSameMonth as K}from"date-fns";import{ChevronLeft as k,ChevronRight as C,ChevronsLeft as S,ChevronsRight as H}from"lucide-react";import{forwardRef as E,useRef as G}from"react";import{DayPicker as I,useDayPicker as j,useDayRender as Y,useNavigation as A}from"react-day-picker";import{Fragment as z,jsx as e,jsxs as T}from"react/jsx-runtime";var c=E(({onClick:w,icon:N,disabled:m,...y},i)=>e("button",{ref:i,type:"button",disabled:m,className:u("flex h-7 w-7 shrink-0 select-none items-center justify-center rounded border p-1 outline-none transition","border-gray-200 text-gray-600 hover:text-gray-800","hover:bg-gray-50 active:bg-gray-100","disabled:pointer-events-none disabled:text-gray-400"),onClick:w,...y,children:e(N,{className:"h-full w-full shrink-0"})}));c.displayName="NavigationButton";function X({mode:w="single",weekStartsOn:N=1,numberOfMonths:m=1,showYearNavigation:y=!1,disableNavigation:i,locale:M,className:L,classNames:D,...R}){return e(I,{mode:w,weekStartsOn:N,numberOfMonths:m,locale:M,showOutsideDays:m===1,className:L,classNames:{months:"flex space-y-0",month:"space-y-4 p-3 w-full",nav:"gap-1 flex items-center rounded-full w-full h-full justify-between p-4",table:"w-full border-separate border-spacing-y-1",head_cell:"w-9 font-medium text-xs text-center text-gray-400 pb-2",row:"w-full",cell:"relative p-0 text-center focus-within:relative text-gray-900",day:u("relative h-10 w-full sm:h-9 sm:w-9 rounded-md text-sm text-gray-900","hover:bg-gray-100 active:bg-gray-200 outline outline-offset-2 outline-0 focus-visible:outline-2 outline-blue-500"),day_today:"font-semibold",day_selected:"rounded aria-selected:bg-blue-500 aria-selected:text-white",day_disabled:"!text-gray-300 line-through disabled:hover:bg-transparent",day_outside:"text-gray-400",day_range_middle:"!rounded-none aria-selected:!bg-blue-100 aria-selected:!text-blue-900",day_range_start:"rounded-r-none !rounded-l",day_range_end:"rounded-l-none !rounded-r",day_hidden:"invisible",...D},components:{IconLeft:()=>e(k,{className:"h-4 w-4"}),IconRight:()=>e(C,{className:"h-4 w-4"}),Caption:({...p})=>{let{goToMonth:r,nextMonth:t,previousMonth:n,currentMonth:s,displayMonths:d}=A(),{numberOfMonths:g,fromDate:l,toDate:o}=j(),b=d.findIndex(a=>K(p.displayMonth,a)),f=b===0,h=b===d.length-1,v=g>1&&(f||!h),x=g>1&&(h||!f),_=()=>{let a=P(s,-1);n&&(!l||a.getTime()>=l.getTime())&&r(a)},B=()=>{let a=P(s,1);t&&(!o||a.getTime()<=o.getTime())&&r(a)};return T("div",{className:"flex items-center justify-between",children:[T("div",{className:"flex items-center gap-1",children:[y&&!x&&e(c,{disabled:i||!n||l&&P(s,-1).getTime()<l.getTime(),"aria-label":"Go to previous year",onClick:_,icon:S}),!x&&e(c,{disabled:i||!n,"aria-label":"Go to previous month",onClick:()=>n&&r(n),icon:k})]}),e("div",{role:"presentation","aria-live":"polite",className:"text-sm font-medium capitalize tabular-nums text-gray-900",children:O(p.displayMonth,"LLLL yyy",{locale:M})}),T("div",{className:"flex items-center gap-1",children:[!v&&e(c,{disabled:i||!t,"aria-label":"Go to next month",onClick:()=>t&&r(t),icon:C}),y&&!v&&e(c,{disabled:i||!t||o&&P(s,1).getTime()>o.getTime(),"aria-label":"Go to next year",onClick:B,icon:H})]})]})},Day:({date:p,displayMonth:r})=>{let t=G(null),{activeModifiers:n,buttonProps:s,divProps:d,isButton:g,isHidden:l}=Y(p,r,t),{selected:o,today:b,disabled:f,range_middle:h}=n;if(l)return e(z,{});if(!g)return e("div",{...d,className:u("flex items-center justify-center",d.className)});let{children:v,...x}=s;return T("button",{ref:t,...x,type:"button",children:[v,b&&e("span",{className:u("absolute inset-x-1/2 bottom-1.5 h-0.5 w-4 -translate-x-1/2 rounded-[2px]",{"bg-blue-500":!o,"!bg-white":o,"!bg-blue-400":o&&h,"text-gray-400":f})})]})}},...R})}export{X as a};
