import{j as e,d5 as b,a4 as v,c5 as _,p as h,C as w}from"./vendor-rThclpOQ.js";import{b as y,B as N}from"./button-ZcsoqUQn.js";import{c as o}from"./utils-8KAaAB9H.js";import{P as S,a as C,b as P}from"./popover-otAaS-4X.js";import{S as x,a as p,b as g,c as f,d as m}from"./select-u0okJC03.js";import{u as M}from"./use-lang-BK6P2WMc.js";function j({className:r,classNames:d,showOutsideDays:u=!0,...c}){return e.jsx(b,{showOutsideDays:u,className:o("p-3",r),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:o(y({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:o("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",c.mode==="range"?"[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md":"[&:has([aria-selected])]:rounded-md"),day:o(y({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",...d},components:{IconLeft:({className:l,...n})=>e.jsx(_,{className:o("h-4 w-4",l),...n}),IconRight:({className:l,...n})=>e.jsx(v,{className:o("h-4 w-4",l),...n})},...c})}j.displayName="Calendar";function D({date:r,setDate:d}){const{button:u}=M(),c=Array.from({length:60},(a,s)=>s),l=Array.from({length:12},(a,s)=>s+1),n=(a,s)=>{const i=new Date(r);if(a==="hour"){let t=parseInt(s);r.getHours()>=12?t=t===12?12:t+12:t=t===12?0:t,i.setHours(t)}else if(a==="minute")i.setMinutes(parseInt(s));else if(a==="meridiem"){const t=i.getHours();s==="PM"&&t<12?i.setHours(t+12):s==="AM"&&t>=12&&i.setHours(t-12)}d(i)};return e.jsxs(S,{children:[e.jsx(C,{asChild:!0,children:e.jsxs(N,{variant:"outline",className:o("w-full justify-between px-3 text-left font-normal",!r&&"text-muted-foreground"),children:[r?h(r,"PPP p"):e.jsx("span",{children:u.pick_a_date}),e.jsx(w,{className:"ml-2 h-4 w-4"})]})}),e.jsxs(P,{className:"w-auto p-0",align:"start",children:[e.jsx(j,{mode:"single",selected:r,onSelect:a=>a&&d(a),initialFocus:!0}),e.jsxs("div",{className:"flex items-center gap-2 border-t p-3",children:[e.jsxs(x,{value:h(r,"h"),onValueChange:a=>n("hour",a),children:[e.jsx(p,{className:"w-[70px]",children:e.jsx(g,{})}),e.jsx(f,{children:l.map(a=>e.jsx(m,{value:a.toString(),children:a.toString().padStart(2,"0")},a))})]}),e.jsx("span",{children:":"}),e.jsxs(x,{value:r.getMinutes().toString(),onValueChange:a=>n("minute",a),children:[e.jsx(p,{className:"w-[70px]",children:e.jsx(g,{})}),e.jsx(f,{children:c.map(a=>e.jsx(m,{value:a.toString(),children:a.toString().padStart(2,"0")},a))})]}),e.jsxs(x,{value:h(r,"a"),onValueChange:a=>n("meridiem",a),children:[e.jsx(p,{className:"w-[70px]",children:e.jsx(g,{})}),e.jsxs(f,{children:[e.jsx(m,{value:"AM",children:"AM"}),e.jsx(m,{value:"PM",children:"PM"})]})]})]})]})]})}export{D};
