"use strict";const e=require("react/jsx-runtime"),a=require("react"),y=require("../global.module.cjs"),j=require("../tools/icons.cjs"),r=require("../tools/tools.cjs"),p=require("../lite.cjs"),C=new Date,i=N=>N.toString().padStart(2,"0"),I=function(O){const{as:_="div",className:b,dropOldClass:S,locale:d,onDateClick:x,selectedDate:m,style:D,variables:M,...B}=O,o=m??C,[c,R]=a.useState(C.getFullYear()),[l,T]=a.useState(C.getMonth()),[Y,f]=a.useState(r.generateCalendar(c,l,[],6,1,void 0,m,d)),[h,k]=a.useState(i(o.getHours())),[g,w]=a.useState(i(o.getMinutes())),[v,H]=a.useState(i(o.getSeconds())),W=a.useMemo(()=>{const t=r.classx(!S&&"card card-body border-0 p-0",b),n=r.stylex((s,u)=>({tKey:r.convertBsKeyToVar(u)}),M,D);return{className:t,style:n}},[b,S,D,M]),P=a.useCallback(t=>{const n=new Date(c,l+t);R(n.getFullYear()),T(n.getMonth())},[l,c]),F=a.useCallback(t=>{const n=parseInt(h,10)||0,s=parseInt(g,10)||0,u=parseInt(v,10)||0,A=p.setSeconds(p.setMinutes(p.setHours(t.date,n),s),u),q={...t,active:!0,date:A};f(E=>r.updateCalendarActiveState(q,E)),x==null||x(q)},[h,g,x,v]),K=t=>{k(t.target.value.trim())},L=t=>{w(t.target.value.trim())},$=t=>{H(t.target.value.trim())};return a.useEffect(()=>{f(r.generateCalendar(c,l,[],6,1,void 0,m,d)),k(i(o.getHours())),w(i(o.getMinutes())),H(i(o.getSeconds()))},[l,c,o,d,m]),e.jsxs(_,{...B,...W,children:[e.jsxs("div",{className:"list-group border-0 row-gap-1 px-3",children:[e.jsxs("div",{className:"row align-items-center position-relative text-center mb-2",children:[e.jsx("div",{className:"col px-1",onClick:()=>P(-1),children:e.jsx("div",{className:r.classxWithOptions(null,"user-select-none list-group-item list-group-item-action border-0 px-0 py-1 rounded text-secondary",y.treeStyles.brlCursorPointer),children:e.jsx(j.BiChevronLeft,{})})}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1"}),e.jsx("div",{className:"col px-1",onClick:()=>P(1),children:e.jsx("div",{className:r.classxWithOptions(null,"user-select-none list-group-item list-group-item-action border-0 px-0 py-1 rounded text-secondary",y.treeStyles.brlCursorPointer),children:e.jsx(j.BiChevronRight,{})})}),e.jsx("div",{className:"position-absolute top-50 start-50 translate-middle w-auto text-nowrap",children:p.format(new Date(c,l),"MMMM yyyy",{locale:d})})]}),Y.rows.map((t,n)=>e.jsx("div",{className:"row text-center",children:t.map((s,u)=>n===0?e.jsx("div",{className:"col px-1",children:e.jsx("div",{className:"list-group-item border-0 px-0 py-1 rounded text-body-secondary",children:s.value})},`${s.value}${u}`):e.jsx("div",{className:"col px-1",onClick:()=>F(s),children:e.jsx("div",{className:r.classxWithOptions(null,"list-group-item list-group-item-action px-0 py-1 rounded",y.treeStyles.brlCursorPointer,!s.isCurrentMonth&&!s.active&&"text-body-tertiary",s.active&&"active",s.isToday?"border-secondary-subtle":"border-0"),children:p.format(s.date,"d",{locale:d})})},s.date.toISOString()))},n))]}),e.jsxs("div",{className:"input-group mt-4 mb-1",children:[e.jsxs("span",{className:"input-group-text text-primary-emphasis",children:[e.jsx(j.BiClock,{}),e.jsx("span",{className:"ps-1",children:"Time"})]}),e.jsx("input",{className:"form-control",onChange:K,placeholder:"HH",type:"text",value:h}),e.jsx("span",{className:"input-group-text text-secondary",children:":"}),e.jsx("input",{className:"form-control",onChange:L,placeholder:"MM",type:"text",value:g}),e.jsx("span",{className:"input-group-text text-secondary",children:":"}),e.jsx("input",{className:"form-control",onChange:$,placeholder:"SS",type:"text",value:v})]})]})};I.displayName="BRL.DatePickerDatetime";exports.DatePickerDatetime=I;
//# sourceMappingURL=date-picker-datetime.cjs.map
