const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DW-9igjg.js","assets/index-AbGWey75.js","assets/index-DbNk79Za.css"])))=>i.map(i=>d[i]);
import{r as p,j as t,$ as v,bZ as y,b_ as h,ao as f,b1 as b,b9 as R,b$ as T,c0 as E,c1 as I,c2 as S,c3 as x,c4 as w,M as L,T as D,c5 as k,c6 as M,c7 as O,c8 as j,al as $}from"./index-AbGWey75.js";const _=(e,n)=>{const s=e.getDay();return s===0?n:s-1},N=(e,n)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()-_(e,n)),z=(e,n)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+(n-_(e,n))),P=(e,n,s=6)=>n&&E(N(n,s),z(n,s),e),C=e=>{const[n,s]=p.useState(null),[c,o]=p.useState(null),{onChange:g,onDateChange:a,...i}=e;return t.jsxs(v,{className:`week-picker-wrapper ${e.view}`,gap:"md",justify:"center",align:"flex-start",direction:"row",wrap:"nowrap",children:[t.jsx(y,{...i,onChange:h(g),onDateChange:a?h(a):void 0,level:"month",withCellSpacing:!1,getDayProps:u=>{const r=R(u),l=P(r,n),m=P(r,c),d=l||m;return{onMouseEnter:()=>s(r),onMouseLeave:()=>s(null),inRange:d,firstInRange:d&&r.getDay()===1,lastInRange:d&&r.getDay()===0,selected:m,onClick:()=>o(r),className:f(b(r),new Date,"day")?"current-day-picker":""}}}),t.jsx(T,{...i,onChange:h(g),onDateChange:a?h(a):void 0})]})},V=x(()=>w(()=>import("./index-DW-9igjg.js"),__vite__mapDeps([0,1,2])),{resolveComponent:e=>e.DatePicker}),A=x(()=>w(()=>import("./index-DW-9igjg.js"),__vite__mapDeps([0,1,2])),{resolveComponent:e=>e.MonthPicker}),W=x(()=>w(()=>import("./index-DW-9igjg.js"),__vite__mapDeps([0,1,2])),{resolveComponent:e=>e.YearPicker}),Y=e=>{const n=I(),{onChange:s,onDateChange:c,...o}=e,g=e.view,a={...o,onChange:h(s),onDateChange:c?h(c):void 0},i={month:t.jsx(A,{...a}),year:t.jsx(W,{...a}),week:t.jsx(C,{...e}),work_week:t.jsx(C,{...e}),day:t.jsx(V,{...a})};return t.jsx(S,{settings:{timezone:n},children:i[g]})},F=({label:e,date:n,goToDate:s,view:c,endDate:o})=>{const[g,a]=p.useState(!1),{i18n:i}=L(),u={value:n,date:n,onDateChange:s,onChange:s,locale:i.language,size:"sm",p:"md",view:c,endDate:o},r=()=>{const l=m=>$(m,"LLLL yyyy",!1,i.language);return o&&j(n).isSame(o,"month")&&j(n).isSame(o,"year")?l(n):`${l(n)}${o?" - "+l(o):""}`};return c==="agenda"?t.jsx(D,{className:"date-label",mr:5,children:r()}):t.jsxs(k,{opened:g,onChange:a,position:"bottom-start",withArrow:!0,arrowSize:12,shadow:"md",children:[t.jsx(k.Target,{children:t.jsx(M,{onClick:()=>a(l=>!l),children:t.jsxs(v,{align:"center",className:"date-picker-box",children:[t.jsx(D,{className:"date-label",mr:5,children:e}),t.jsx(O,{size:16,color:"#98A2B3"})]})})}),t.jsx(k.Dropdown,{children:t.jsx(Y,{...u})})]})};export{F as default};
