impact-nova 1.6.0 → 1.6.1

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.
@@ -1,192 +1,192 @@
1
- import { jsxs as C, jsx as c } from "react/jsx-runtime";
2
- import * as u from "react";
1
+ import { jsxs as Y, jsx as c } from "react/jsx-runtime";
2
+ import * as d from "react";
3
3
  import { ChevronLeftIcon as we, ChevronRightIcon as ye } from "lucide-react";
4
- import { getDefaultClassNames as Fe, DayPicker as He } from "react-day-picker";
5
- import { cn as d } from "../../lib/utils.js";
6
- import { Button as A } from "./button.js";
4
+ import { getDefaultClassNames as He, DayPicker as Be } from "react-day-picker";
5
+ import { cn as f } from "../../lib/utils.js";
6
+ import { Button as R } from "./button.js";
7
7
  import "./button-variants.js";
8
8
  import ce from "./select/select.js";
9
- import { FISCAL_PATTERNS as Be, resolveWeekSelection as Te } from "../../lib/fiscal-calendar.js";
10
- import { getIntlLocale as We, getDateFnsLocale as qe } from "../../i18n/getDateFnsLocale.js";
11
- import { useImpactNovaI18n as Ge } from "../../i18n/ImpactNovaI18nContext.js";
12
- const de = u.createContext(0);
9
+ import { FISCAL_PATTERNS as Fe, resolveWeekSelection as Te } from "../../lib/fiscal-calendar.js";
10
+ import { getIntlLocale as Ke, getDateFnsLocale as We } from "../../i18n/getDateFnsLocale.js";
11
+ import { useImpactNovaI18n as qe } from "../../i18n/ImpactNovaI18nContext.js";
12
+ const ue = d.createContext(0);
13
13
  function st({
14
14
  className: ae,
15
- classNames: J,
16
- showOutsideDays: D = !1,
17
- captionLayout: K = "dropdown",
18
- buttonVariant: H = "ghost",
15
+ classNames: G,
16
+ showOutsideDays: y = !1,
17
+ captionLayout: J = "dropdown",
18
+ buttonVariant: B = "ghost",
19
19
  formatters: Q,
20
20
  components: Ne,
21
21
  showFooter: x = !0,
22
22
  onApply: X,
23
- onCancel: ue,
24
- onClear: fe,
25
- mode: B = "single",
26
- selected: b,
27
- onSelect: P,
23
+ onCancel: fe,
24
+ onClear: de,
25
+ mode: F = "single",
26
+ selected: D,
27
+ onSelect: U,
28
28
  // Week picker props
29
- pickerType: f = "date",
30
- weekMode: w = "single",
31
- selectedWeeks: _,
32
- onWeekSelect: S,
33
- calendarType: k = "calendar",
29
+ pickerType: m = "date",
30
+ weekMode: v = "single",
31
+ selectedWeeks: C,
32
+ onWeekSelect: A,
33
+ calendarType: L = "calendar",
34
34
  fiscalMode: Z = "basic",
35
35
  selectionMode: se = "week",
36
- fiscalMonthPattern: oe,
36
+ fiscalMonthPattern: le,
37
37
  fiscalYearStartMonth: me = 1,
38
38
  weekStartsOn: T = 1,
39
39
  // Default Monday
40
40
  // Month picker props
41
- monthMode: v = "single",
42
- selectedMonths: y,
43
- onMonthSelect: N,
44
- month: E,
41
+ monthMode: w = "single",
42
+ selectedMonths: N,
43
+ onMonthSelect: _,
44
+ month: H,
45
45
  defaultMonth: ge,
46
46
  onMonthChange: Ce,
47
- startMonth: _e,
48
- endMonth: Se,
47
+ startMonth: Se,
48
+ endMonth: _e,
49
49
  ...he
50
50
  }) {
51
- const { locale: V, t: m } = Ge(), W = u.useMemo(() => We(V), [V]), Ye = u.useMemo(() => qe(V), [V]), xe = u.useMemo(
51
+ const { locale: V, t: h } = qe(), K = d.useMemo(() => Ke(V), [V]), Ye = d.useMemo(() => We(V), [V]), xe = d.useMemo(
52
52
  () => Array.from(
53
53
  { length: 12 },
54
- (e, n) => new Date(2024, n, 1).toLocaleString(W, { month: "long" })
54
+ (e, n) => new Date(2024, n, 1).toLocaleString(K, { month: "long" })
55
55
  ),
56
- [W]
57
- ), Me = u.useMemo(
56
+ [K]
57
+ ), Ae = d.useMemo(
58
58
  () => Array.from(
59
59
  { length: 12 },
60
- (e, n) => new Date(2024, n, 1).toLocaleString(W, { month: "short" })
60
+ (e, n) => new Date(2024, n, 1).toLocaleString(K, { month: "short" })
61
61
  ),
62
- [W]
63
- ), ee = u.useMemo(() => {
64
- if (k === "fiscal") {
65
- if (oe) return oe;
66
- if (Z === "advanced") return Be["4-4-5"];
62
+ [K]
63
+ ), ee = d.useMemo(() => {
64
+ if (L === "fiscal") {
65
+ if (le) return le;
66
+ if (Z === "advanced") return Fe["4-4-5"];
67
67
  }
68
- }, [k, Z, oe]), g = Fe(), je = u.useMemo(() => new Date(1900, 0, 1), []), Ae = u.useMemo(() => new Date(2100, 11, 31), []), z = _e || je, R = Se || Ae, [q, te] = u.useState(b), [Y, be] = u.useState(() => {
69
- if (E) return E;
68
+ }, [L, Z, le]), b = He(), je = d.useMemo(() => new Date(1900, 0, 1), []), Me = d.useMemo(() => new Date(2100, 11, 31), []), E = Se || je, P = _e || Me, [W, te] = d.useState(D), [j, be] = d.useState(() => {
69
+ if (H) return H;
70
70
  if (ge) return ge;
71
- if (b) {
72
- if (Array.isArray(b))
73
- return b[0] || /* @__PURE__ */ new Date();
74
- if (b instanceof Date)
75
- return b;
76
- if ("from" in b && b.from)
77
- return b.from;
71
+ if (D) {
72
+ if (Array.isArray(D))
73
+ return D[0] || /* @__PURE__ */ new Date();
74
+ if (D instanceof Date)
75
+ return D;
76
+ if ("from" in D && D.from)
77
+ return D.from;
78
78
  }
79
79
  return /* @__PURE__ */ new Date();
80
80
  });
81
- u.useEffect(() => {
82
- E && (be(E), ve(E.getFullYear()));
83
- }, [E]);
84
- const [O, ne] = u.useState(_), [j, re] = u.useState(y), [ke, ve] = u.useState(Y.getFullYear());
85
- u.useEffect(() => {
86
- te(b), ne(_), re(y);
87
- }, [b, _, y]);
88
- const L = (e) => {
81
+ d.useEffect(() => {
82
+ H && (be(H), ve(H.getFullYear()));
83
+ }, [H]);
84
+ const [$, ne] = d.useState(C), [M, re] = d.useState(N), [ke, ve] = d.useState(j.getFullYear());
85
+ d.useEffect(() => {
86
+ te(D), ne(C), re(N);
87
+ }, [D, C, N]);
88
+ const O = (e) => {
89
89
  be(e), ve(e.getFullYear()), Ce?.(e);
90
- }, le = u.useCallback((e) => {
90
+ }, oe = d.useCallback((e) => {
91
91
  let n;
92
92
  return e instanceof Date ? n = e : n = e.days.find((t) => !t.outside)?.date || e.days[0]?.date || /* @__PURE__ */ new Date(), Te(n, {
93
- calendarType: k,
93
+ calendarType: L,
94
94
  fiscalMode: Z,
95
95
  selectionMode: se,
96
96
  fiscalMonthPattern: ee,
97
97
  fiscalYearStartMonth: me,
98
98
  weekStartsOn: T
99
99
  });
100
- }, [k, Z, se, ee, me, T]), ie = u.useCallback((e) => {
100
+ }, [L, Z, se, ee, me, T]), ie = d.useCallback((e) => {
101
101
  const n = (t, r) => t.year === r.year && t.month === r.month && t.weekOfMonth === r.weekOfMonth;
102
102
  if (x)
103
103
  ne((t) => {
104
104
  let r;
105
- if (w === "single")
105
+ if (v === "single")
106
106
  r = e;
107
- else if (w === "multiple") {
107
+ else if (v === "multiple") {
108
108
  const a = t || [];
109
- r = a.some((s) => n(s, e)) ? a.filter((s) => !n(s, e)) : [...a, e];
110
- } else if (w === "range") {
109
+ r = a.some((l) => n(l, e)) ? a.filter((l) => !n(l, e)) : [...a, e];
110
+ } else if (v === "range") {
111
111
  const a = t;
112
112
  if (!a?.from || a.to)
113
113
  r = { from: e };
114
114
  else {
115
- const o = { from: a.from, to: e };
116
- e.startDate < a.from.startDate && (o.from = e, o.to = a.from), r = o;
115
+ const s = { from: a.from, to: e };
116
+ e.startDate < a.from.startDate && (s.from = e, s.to = a.from), r = s;
117
117
  }
118
118
  }
119
- return S?.(r), r;
119
+ return A?.(r), r;
120
120
  });
121
- else if (w === "single")
122
- S?.(e);
123
- else if (w === "multiple") {
124
- const t = _ || [], a = t.some((o) => n(o, e)) ? t.filter((o) => !n(o, e)) : [...t, e];
125
- S?.(a.length > 0 ? a : void 0);
126
- } else if (w === "range") {
127
- const t = _;
121
+ else if (v === "single")
122
+ A?.(e);
123
+ else if (v === "multiple") {
124
+ const t = C || [], a = t.some((s) => n(s, e)) ? t.filter((s) => !n(s, e)) : [...t, e];
125
+ A?.(a.length > 0 ? a : void 0);
126
+ } else if (v === "range") {
127
+ const t = C;
128
128
  if (!t?.from || t.to)
129
- S?.({ from: e });
129
+ A?.({ from: e });
130
130
  else {
131
131
  const r = { from: t.from, to: e };
132
- e.startDate < t.from.startDate && (r.from = e, r.to = t.from), S?.(r);
132
+ e.startDate < t.from.startDate && (r.from = e, r.to = t.from), A?.(r);
133
133
  }
134
134
  }
135
- }, [w, x, _, S]), ze = u.useCallback((e, n) => {
136
- const t = { year: e, month: n }, r = (a, o) => a.year === o.year && a.month === o.month;
135
+ }, [v, x, C, A]), ze = d.useCallback((e, n) => {
136
+ const t = { year: e, month: n }, r = (a, s) => a.year === s.year && a.month === s.month;
137
137
  if (x)
138
138
  re((a) => {
139
- let o;
140
- if (v === "single")
141
- o = t;
142
- else if (v === "multiple") {
143
- const s = a || [];
144
- o = s.some((i) => r(i, t)) ? s.filter((i) => !r(i, t)) : [...s, t];
145
- } else if (v === "range") {
146
- const s = a;
147
- if (!s?.from || s.to)
148
- o = { from: t };
139
+ let s;
140
+ if (w === "single")
141
+ s = t;
142
+ else if (w === "multiple") {
143
+ const l = a || [];
144
+ s = l.some((u) => r(u, t)) ? l.filter((u) => !r(u, t)) : [...l, t];
145
+ } else if (w === "range") {
146
+ const l = a;
147
+ if (!l?.from || l.to)
148
+ s = { from: t };
149
149
  else {
150
- const l = new Date(s.from.year, s.from.month, 1);
151
- new Date(t.year, t.month, 1) < l ? o = { from: t, to: s.from } : o = { from: s.from, to: t };
150
+ const o = new Date(l.from.year, l.from.month, 1);
151
+ new Date(t.year, t.month, 1) < o ? s = { from: t, to: l.from } : s = { from: l.from, to: t };
152
152
  }
153
153
  }
154
- return N?.(o), o;
154
+ return _?.(s), s;
155
155
  });
156
- else if (v === "single")
157
- N?.(t);
158
- else if (v === "multiple") {
159
- const a = y || [], s = a.some((l) => r(l, t)) ? a.filter((l) => !r(l, t)) : [...a, t];
160
- N?.(s.length > 0 ? s : void 0);
161
- } else if (v === "range") {
162
- const a = y;
156
+ else if (w === "single")
157
+ _?.(t);
158
+ else if (w === "multiple") {
159
+ const a = N || [], l = a.some((o) => r(o, t)) ? a.filter((o) => !r(o, t)) : [...a, t];
160
+ _?.(l.length > 0 ? l : void 0);
161
+ } else if (w === "range") {
162
+ const a = N;
163
163
  if (!a?.from || a.to)
164
- N?.({ from: t });
164
+ _?.({ from: t });
165
165
  else {
166
- const o = new Date(a.from.year, a.from.month, 1);
167
- new Date(t.year, t.month, 1) < o ? N?.({ from: t, to: a.from }) : N?.({ from: a.from, to: t });
166
+ const s = new Date(a.from.year, a.from.month, 1);
167
+ new Date(t.year, t.month, 1) < s ? _?.({ from: t, to: a.from }) : _?.({ from: a.from, to: t });
168
168
  }
169
169
  }
170
- }, [v, x, y, N]), pe = u.useCallback(() => {
171
- const e = z.getFullYear(), n = R.getFullYear(), t = [];
170
+ }, [w, x, N, _]), pe = d.useCallback(() => {
171
+ const e = E.getFullYear(), n = P.getFullYear(), t = [];
172
172
  for (let r = e; r <= n; r++)
173
173
  t.push({ label: r.toString(), value: r.toString() });
174
174
  return t;
175
- }, [z, R]), Re = u.useCallback((e) => xe.map((t, r) => ({
175
+ }, [E, P]), Ie = d.useCallback((e) => xe.map((t, r) => ({
176
176
  label: t,
177
177
  value: r.toString()
178
178
  })).filter((t, r) => {
179
179
  const a = new Date(e, r, 1);
180
- return !(z && a < new Date(z.getFullYear(), z.getMonth(), 1) || R && a > new Date(R.getFullYear(), R.getMonth(), 1));
181
- }), [z, R, xe]), G = u.useMemo(() => {
182
- if (f !== "week") return;
183
- const e = x ? O : _;
180
+ return !(E && a < new Date(E.getFullYear(), E.getMonth(), 1) || P && a > new Date(P.getFullYear(), P.getMonth(), 1));
181
+ }), [E, P, xe]), q = d.useMemo(() => {
182
+ if (m !== "week") return;
183
+ const e = x ? $ : C;
184
184
  if (!e) return;
185
185
  const n = [], t = (r) => {
186
186
  let a = new Date(r.startDate);
187
187
  a.setHours(0, 0, 0, 0);
188
- const o = new Date(r.endDate);
189
- for (o.setHours(0, 0, 0, 0); a <= o; )
188
+ const s = new Date(r.endDate);
189
+ for (s.setHours(0, 0, 0, 0); a <= s; )
190
190
  n.push(new Date(a)), a.setDate(a.getDate() + 1);
191
191
  };
192
192
  if (Array.isArray(e))
@@ -205,77 +205,82 @@ function st({
205
205
  } else
206
206
  t(e);
207
207
  return n;
208
- }, [f, x, O, _]), Le = u.useMemo(() => {
209
- if (f !== "week" || !G || G.length === 0)
208
+ }, [m, x, $, C]), Re = d.useMemo(() => {
209
+ if (m !== "week" || !q || q.length === 0)
210
210
  return { range_start: [], range_middle: [], range_end: [] };
211
- const e = [...G].sort((s, l) => s.getTime() - l.getTime()), n = [], t = [], r = [], a = (s, l) => {
212
- if (l === 0) return !1;
213
- const i = e[l - 1];
214
- return s.getTime() - i.getTime() <= 1440 * 60 * 1e3;
215
- }, o = (s, l) => l === e.length - 1 ? !1 : e[l + 1].getTime() - s.getTime() <= 1440 * 60 * 1e3;
216
- return e.forEach((s, l) => {
217
- const i = a(s, l), h = o(s, l);
218
- !i && !h ? (n.push(s), r.push(s)) : i ? h ? t.push(s) : r.push(s) : n.push(s);
211
+ const e = [...q].sort((i, g) => i.getTime() - g.getTime()), n = [], t = [], r = [], a = x ? $ : C, s = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
212
+ v === "multiple" && Array.isArray(a) && a.forEach((i) => {
213
+ const g = i.startDate.toISOString().split("T")[0], p = i.endDate.toISOString().split("T")[0];
214
+ s.add(g), l.add(p);
215
+ });
216
+ const o = (i, g) => {
217
+ if (g === 0) return !1;
218
+ const p = e[g - 1];
219
+ return i.getTime() - p.getTime() <= 1440 * 60 * 1e3;
220
+ }, u = (i, g) => g === e.length - 1 ? !1 : e[g + 1].getTime() - i.getTime() <= 1440 * 60 * 1e3;
221
+ return e.forEach((i, g) => {
222
+ const p = i.toISOString().split("T")[0], k = s.has(p), S = l.has(p), z = o(i, g), I = u(i, g);
223
+ v === "multiple" ? k ? n.push(i) : S ? r.push(i) : t.push(i) : !z && !I ? (n.push(i), r.push(i)) : z ? I ? t.push(i) : r.push(i) : n.push(i);
219
224
  }), {
220
225
  range_start: n,
221
226
  range_middle: t,
222
227
  range_end: r
223
228
  };
224
- }, [f, G]), Ie = u.useCallback((e) => {
225
- if (f === "week" && e) {
229
+ }, [m, q, v, x, $, C]), Le = d.useCallback((e) => {
230
+ if (m === "week" && e) {
226
231
  const n = Array.isArray(e) ? e[e.length - 1] : e instanceof Date ? e : void 0;
227
232
  if (n) {
228
- const t = le(n);
233
+ const t = oe(n);
229
234
  ie(t);
230
235
  return;
231
236
  }
232
237
  }
233
- x && te(e), P?.(e);
234
- }, [x, P, f, le, ie]), Pe = u.useCallback(() => {
235
- f === "week" ? (S?.(O), X?.(O)) : f === "month" ? (N?.(j), X?.(j)) : (P?.(q), X?.(q));
236
- }, [q, O, j, P, S, N, X, f]), $e = u.useCallback(() => {
237
- f === "week" ? ne(_) : f === "month" ? re(y) : te(b), ue?.();
238
- }, [b, _, y, ue, f]), Ee = u.useCallback(() => {
239
- f === "week" ? (ne(void 0), x || S?.(void 0)) : f === "month" ? (re(void 0), x || N?.(void 0)) : (te(void 0), x || P?.(void 0)), fe?.();
240
- }, [x, P, S, N, fe, f]), Oe = u.useCallback((e, n) => {
241
- const t = x ? j : y;
238
+ x && te(e), U?.(e);
239
+ }, [x, U, m, oe, ie]), Ee = d.useCallback(() => {
240
+ m === "week" ? (A?.($), X?.($)) : m === "month" ? (_?.(M), X?.(M)) : (U?.(W), X?.(W));
241
+ }, [W, $, M, U, A, _, X, m]), Pe = d.useCallback(() => {
242
+ m === "week" ? ne(C) : m === "month" ? re(N) : te(D), fe?.();
243
+ }, [D, C, N, fe, m]), $e = d.useCallback(() => {
244
+ m === "week" ? (ne(void 0), x || A?.(void 0)) : m === "month" ? (re(void 0), x || _?.(void 0)) : (te(void 0), x || U?.(void 0)), de?.();
245
+ }, [x, U, A, _, de, m]), Oe = d.useCallback((e, n) => {
246
+ const t = x ? M : N;
242
247
  if (!t) return !1;
243
248
  if (Array.isArray(t))
244
249
  return t.some((r) => r.year === e && r.month === n);
245
250
  if ("from" in t) {
246
- const r = t, a = r.from, o = r.to, s = new Date(e, n, 1).getTime(), l = new Date(a.year, a.month, 1).getTime();
247
- if (!o) return s === l;
248
- const i = new Date(o.year, o.month, 1).getTime();
249
- return s >= l && s <= i;
251
+ const r = t, a = r.from, s = r.to, l = new Date(e, n, 1).getTime(), o = new Date(a.year, a.month, 1).getTime();
252
+ if (!s) return l === o;
253
+ const u = new Date(s.year, s.month, 1).getTime();
254
+ return l >= o && l <= u;
250
255
  } else {
251
256
  const r = t;
252
257
  return r.year === e && r.month === n;
253
258
  }
254
- }, [x, j, y]), Ue = u.useCallback((e, n) => {
255
- const t = x ? j : y;
259
+ }, [x, M, N]), Ue = d.useCallback((e, n) => {
260
+ const t = x ? M : N;
256
261
  if (!t || !("from" in t)) return { isStart: !1, isEnd: !1, isMiddle: !1 };
257
- const r = t, a = r.from, o = r.to, s = new Date(e, n, 1).getTime(), l = new Date(a.year, a.month, 1).getTime();
258
- if (!o) return { isStart: s === l, isEnd: !1, isMiddle: !1 };
259
- const i = new Date(o.year, o.month, 1).getTime();
262
+ const r = t, a = r.from, s = r.to, l = new Date(e, n, 1).getTime(), o = new Date(a.year, a.month, 1).getTime();
263
+ if (!s) return { isStart: l === o, isEnd: !1, isMiddle: !1 };
264
+ const u = new Date(s.year, s.month, 1).getTime();
260
265
  return {
261
- isStart: s === l,
262
- isEnd: s === i,
263
- isMiddle: s > l && s < i
266
+ isStart: l === o,
267
+ isEnd: l === u,
268
+ isMiddle: l > o && l < u
264
269
  };
265
- }, [x, j, y]), De = ({ yearOffset: e = 0 }) => {
270
+ }, [x, M, N]), De = ({ yearOffset: e = 0 }) => {
266
271
  const n = ke + e;
267
- return /* @__PURE__ */ C("div", { className: "flex flex-col gap-4 p-3 min-w-[280px]", children: [
268
- /* @__PURE__ */ C("div", { className: "flex items-center justify-between", children: [
272
+ return /* @__PURE__ */ Y("div", { className: "flex flex-col gap-4 p-3 min-w-[280px]", children: [
273
+ /* @__PURE__ */ Y("div", { className: "flex items-center justify-between", children: [
269
274
  e === 0 && /* @__PURE__ */ c(
270
- A,
275
+ R,
271
276
  {
272
277
  variant: "ghost",
273
278
  size: "icon",
274
279
  className: "h-7 w-7",
275
- "aria-label": m("calendar.previousYear"),
276
- title: m("calendar.previousYear"),
277
- disabled: n <= z.getFullYear(),
278
- onClick: () => L(new Date(n - 1, Y.getMonth(), 1)),
280
+ "aria-label": h("calendar.previousYear"),
281
+ title: h("calendar.previousYear"),
282
+ disabled: n <= E.getFullYear(),
283
+ onClick: () => O(new Date(n - 1, j.getMonth(), 1)),
279
284
  children: /* @__PURE__ */ c(we, { className: "h-4 w-4" })
280
285
  }
281
286
  ),
@@ -286,7 +291,7 @@ function st({
286
291
  onChange: (t) => {
287
292
  if (t && "value" in t) {
288
293
  const r = parseInt(t.value) - e;
289
- L(new Date(r, Y.getMonth(), 1));
294
+ O(new Date(r, j.getMonth(), 1));
290
295
  }
291
296
  },
292
297
  scrollToSelectedOnOpen: !0,
@@ -296,41 +301,41 @@ function st({
296
301
  menuWidth: "140px"
297
302
  }
298
303
  ) }),
299
- (v === "single" || e === 1) && /* @__PURE__ */ c(
300
- A,
304
+ (w === "single" || e === 1) && /* @__PURE__ */ c(
305
+ R,
301
306
  {
302
307
  variant: "ghost",
303
308
  size: "icon",
304
309
  className: "h-7 w-7",
305
- "aria-label": m("calendar.nextYear"),
306
- title: m("calendar.nextYear"),
307
- disabled: n >= R.getFullYear(),
308
- onClick: () => L(new Date(n + 1, Y.getMonth(), 1)),
310
+ "aria-label": h("calendar.nextYear"),
311
+ title: h("calendar.nextYear"),
312
+ disabled: n >= P.getFullYear(),
313
+ onClick: () => O(new Date(n + 1, j.getMonth(), 1)),
309
314
  children: /* @__PURE__ */ c(ye, { className: "h-4 w-4" })
310
315
  }
311
316
  )
312
317
  ] }),
313
- /* @__PURE__ */ c("div", { className: "grid grid-cols-4 gap-y-4 gap-x-0", children: Me.map((t, r) => {
314
- const a = Oe(n, r), { isStart: o, isEnd: s, isMiddle: l } = Ue(n, r), i = v === "range", h = x ? j : y, p = h && "to" in h && !!h.to;
315
- return /* @__PURE__ */ C("div", { className: "relative flex items-center justify-center h-10 w-full group", children: [
316
- i && p && (l || o || s) && /* @__PURE__ */ c("div", { className: d(
318
+ /* @__PURE__ */ c("div", { className: "grid grid-cols-4 gap-y-4 gap-x-0", children: Ae.map((t, r) => {
319
+ const a = Oe(n, r), { isStart: s, isEnd: l, isMiddle: o } = Ue(n, r), u = w === "range", i = x ? M : N, g = i && "to" in i && !!i.to;
320
+ return /* @__PURE__ */ Y("div", { className: "relative flex items-center justify-center h-10 w-full group", children: [
321
+ u && g && (o || s || l) && /* @__PURE__ */ c("div", { className: f(
317
322
  "absolute inset-y-0 inset-x-0 bg-accent",
318
- o && "rounded-l-full left-1/2 -ml-5",
319
- s && "rounded-r-full right-1/2 -mr-5",
320
- l && "inset-x-0",
321
- o && s && "rounded-full inset-x-2"
323
+ s && "rounded-l-full left-1/2 -ml-5",
324
+ l && "rounded-r-full right-1/2 -mr-5",
325
+ o && "inset-x-0",
326
+ s && l && "rounded-full inset-x-2"
322
327
  ) }),
323
328
  /* @__PURE__ */ c(
324
- A,
329
+ R,
325
330
  {
326
331
  variant: "ghost",
327
332
  onClick: () => ze(n, r),
328
- className: d(
333
+ className: f(
329
334
  "relative z-10 w-10 h-10 p-0 text-sm font-normal rounded-lg transition-all",
330
- a && !i && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground",
331
- i && (o || s) && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground rounded-lg",
335
+ a && !u && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground",
336
+ u && (s || l) && "bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground rounded-lg",
332
337
  !a && "hover:bg-accent hover:text-accent-foreground border border-transparent hover:border-brand",
333
- l && "text-accent-foreground"
338
+ o && "text-accent-foreground"
334
339
  ),
335
340
  children: t
336
341
  }
@@ -339,10 +344,10 @@ function st({
339
344
  }) })
340
345
  ] });
341
346
  };
342
- return /* @__PURE__ */ C("div", { className: "flex flex-col ", "data-component": "calendar", children: [
343
- f === "month" ? /* @__PURE__ */ C("div", { className: "flex flex-col md:flex-row", children: [
347
+ return /* @__PURE__ */ Y("div", { className: "flex flex-col ", "data-component": "calendar", children: [
348
+ m === "month" ? /* @__PURE__ */ Y("div", { className: "flex flex-col md:flex-row", children: [
344
349
  /* @__PURE__ */ c(De, { yearOffset: 0 }),
345
- (v === "range" || v === "multiple") && /* @__PURE__ */ C("div", { className: "flex flex-row gap-0", children: [
350
+ (w === "range" || w === "multiple") && /* @__PURE__ */ Y("div", { className: "flex flex-row gap-0", children: [
346
351
  /* @__PURE__ */ c("div", { className: "w-[1px] bg-stroke-hairline my-4" }),
347
352
  /* @__PURE__ */ c(De, { yearOffset: 1 })
348
353
  ] })
@@ -350,114 +355,114 @@ function st({
350
355
  // @ts-ignore: TS mismatch due to dynamic union types.
351
356
  // FIX: Split rendering into separate `DayPicker` calls for 'single' | 'multiple' | 'range' to strictly match discriminated unions.
352
357
  /* @__PURE__ */ c(
353
- He,
358
+ Be,
354
359
  {
355
- mode: f === "week" ? "multiple" : B,
356
- selected: f === "week" ? G : x ? q : b,
357
- onSelect: Ie,
358
- month: Y,
359
- onMonthChange: L,
360
- showOutsideDays: k === "fiscal" ? !0 : D,
360
+ mode: m === "week" ? "multiple" : F,
361
+ selected: m === "week" ? q : x ? W : D,
362
+ onSelect: Le,
363
+ month: j,
364
+ onMonthChange: O,
365
+ showOutsideDays: L === "fiscal" ? !0 : y,
361
366
  weekStartsOn: T,
362
- modifiers: f === "week" ? Le : void 0,
367
+ modifiers: m === "week" ? Re : void 0,
363
368
  locale: Ye,
364
- className: d(
369
+ className: f(
365
370
  "bg-canvas group/calendar p-2 [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",
366
371
  String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
367
372
  String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
368
373
  ae
369
374
  ),
370
- captionLayout: K,
371
- startMonth: z,
372
- endMonth: R,
375
+ captionLayout: J,
376
+ startMonth: E,
377
+ endMonth: P,
373
378
  disabled: he.disabled,
374
- numberOfMonths: B === "range" || B === "multiple" || w === "range" || w === "multiple" ? 2 : 1,
379
+ numberOfMonths: F === "range" || F === "multiple" || v === "range" || v === "multiple" ? 2 : 1,
375
380
  showWeekNumber: !0,
376
381
  formatters: {
377
- formatMonthDropdown: (e) => e.toLocaleString(W, { month: "short" }),
378
- formatWeekNumber: (e) => m("calendar.weekNumber", { number: e }),
382
+ formatMonthDropdown: (e) => e.toLocaleString(K, { month: "short" }),
383
+ formatWeekNumber: (e) => h("calendar.weekNumber", { number: e }),
379
384
  ...Q
380
385
  },
381
386
  classNames: {
382
- root: d("w-fit", g.root),
383
- months: d(
387
+ root: f("w-fit", b.root),
388
+ months: f(
384
389
  "relative flex flex-col gap-2 md:flex-row",
385
- g.months
390
+ b.months
386
391
  ),
387
- month: d(
392
+ month: f(
388
393
  "flex flex-1 min-w-[252px] flex-col gap-2 relative after:absolute after:top-[5.5rem] after:bottom-0 after:left-[30px] after:w-[1px] after:bg-stroke-hairline",
389
- g.month
394
+ b.month
390
395
  ),
391
- nav: d(
396
+ nav: f(
392
397
  "absolute inset-x-0 top-[2px] h-[--cell-size] flex w-full items-center justify-between px-2 gap-1",
393
- g.nav
398
+ b.nav
394
399
  ),
395
- button_previous: d(
400
+ button_previous: f(
396
401
  "h-7 w-7 select-none p-0 z-10 aria-disabled:opacity-50 flex items-center justify-center relative",
397
- g.button_previous
402
+ b.button_previous
398
403
  ),
399
- button_next: d(
404
+ button_next: f(
400
405
  "h-7 w-7 select-none p-0 z-10 aria-disabled:opacity-50 flex items-center justify-center relative",
401
- g.button_next
406
+ b.button_next
402
407
  ),
403
- month_caption: d(
408
+ month_caption: f(
404
409
  "flex h-[--cell-size] w-full items-center justify-center px-[--cell-size] relative ",
405
- g.month_caption
410
+ b.month_caption
406
411
  ),
407
- dropdowns: d(
412
+ dropdowns: f(
408
413
  "flex h-[--cell-size] gap-1 items-center justify-center text-sm font-medium relative ",
409
- g.dropdowns
414
+ b.dropdowns
410
415
  ),
411
- caption_label: d(
416
+ caption_label: f(
412
417
  "select-none font-medium text-sm",
413
- g.caption_label
418
+ b.caption_label
414
419
  ),
415
420
  table: "w-full border-collapse",
416
- weekdays: d("flex w-full relative after:absolute after:bottom-0 after:right-0 after:h-[1px] after:bg-stroke-hairline after:left-[30px]", g.weekdays),
417
- weekday: d(
421
+ weekdays: f("flex w-full relative after:absolute after:bottom-0 after:right-0 after:h-[1px] after:bg-stroke-hairline after:left-[30px]", b.weekdays),
422
+ weekday: f(
418
423
  "flex-1 select-none rounded-md font-normal text-center",
419
424
  "text-[11px] text-content-muted pb-2",
420
425
  "[&:nth-child(2)]:pl-2",
421
- g.weekday
426
+ b.weekday
422
427
  ),
423
- week: d("mt-1 flex w-full items-stretch group/week", g.week),
424
- week_number_header: d(
428
+ week: f("mt-1 flex w-full items-stretch group/week", b.week),
429
+ week_number_header: f(
425
430
  "select-none font-normal text-center h-[30px] flex items-center justify-center",
426
431
  "text-[11px] text-content-muted w-[30px] flex-shrink-0",
427
- g.week_number_header
432
+ b.week_number_header
428
433
  ),
429
- week_number: d(
434
+ week_number: f(
430
435
  "select-none flex items-center justify-center h-[30px]",
431
436
  "text-[11px] text-content-muted w-[30px] flex-shrink-0 transition-colors",
432
- f === "week" && "group-hover/week:bg-accent group-hover/week:rounded-l-lg",
433
- g.week_number
437
+ m === "week" && "group-hover/week:bg-accent group-hover/week:rounded-l-lg",
438
+ b.week_number
434
439
  ),
435
- day: d(
440
+ day: f(
436
441
  "group/day relative select-none p-0 text-center flex-1 h-[30px] flex items-center justify-center [&:nth-child(2)]:pl-2 rdp-day",
437
- f === "week" && "group-hover/week:bg-accent [&:nth-child(2)]:group-hover/week:rounded-l-full [&:nth-child(8)]:group-hover/week:rounded-r-full",
438
- f === "week" && "[&.rdp-selected:nth-child(2)]:rounded-l-full [&.rdp-selected:nth-child(8)]:rounded-r-full",
439
- J?.day
442
+ m === "week" && "group-hover/week:bg-accent [&:nth-child(2)]:group-hover/week:rounded-l-full [&:nth-child(8)]:group-hover/week:rounded-r-full",
443
+ m === "week" && "[&.rdp-selected:nth-child(2)]:rounded-l-full [&.rdp-selected:nth-child(8)]:rounded-r-full",
444
+ G?.day
440
445
  ),
441
- range_start: d(
446
+ range_start: f(
442
447
  "bg-accent rounded-l-full",
443
- g.range_start
448
+ b.range_start
444
449
  ),
445
- range_middle: d("bg-accent rounded-none", g.range_middle),
446
- range_end: d("bg-accent rounded-r-full", g.range_end),
447
- today: d(
450
+ range_middle: f("bg-accent rounded-none", b.range_middle),
451
+ range_end: f("bg-accent rounded-r-full", b.range_end),
452
+ today: f(
448
453
  "text-brand",
449
- g.today
454
+ b.today
450
455
  ),
451
- outside: d(
452
- k === "fiscal" || D ? "text-content-muted opacity-50" : "invisible",
453
- g.outside
456
+ outside: f(
457
+ L === "fiscal" || y ? "text-content-muted opacity-50" : "invisible",
458
+ b.outside
454
459
  ),
455
- disabled: d(
460
+ disabled: f(
456
461
  "text-content-muted opacity-50",
457
- g.disabled
462
+ b.disabled
458
463
  ),
459
- hidden: d("invisible", g.hidden),
460
- ...J
464
+ hidden: f("invisible", b.hidden),
465
+ ...G
461
466
  },
462
467
  components: {
463
468
  Root: ({ className: e, rootRef: n, ...t }) => /* @__PURE__ */ c(
@@ -465,83 +470,83 @@ function st({
465
470
  {
466
471
  "data-slot": "calendar",
467
472
  ref: n,
468
- className: d(e),
473
+ className: f(e),
469
474
  ...t
470
475
  }
471
476
  ),
472
- Chevron: ({ className: e, orientation: n, ...t }) => n === "left" ? /* @__PURE__ */ c(we, { className: d("size-4 text-content", e), ...t }) : n === "right" ? /* @__PURE__ */ c(
477
+ Chevron: ({ className: e, orientation: n, ...t }) => n === "left" ? /* @__PURE__ */ c(we, { className: f("size-4 text-content", e), ...t }) : n === "right" ? /* @__PURE__ */ c(
473
478
  ye,
474
479
  {
475
- className: d("size-4 text-content", e),
480
+ className: f("size-4 text-content", e),
476
481
  ...t
477
482
  }
478
483
  ) : /* @__PURE__ */ c("span", {}),
479
484
  PreviousMonthButton: (e) => /* @__PURE__ */ c(
480
- A,
485
+ R,
481
486
  {
482
- variant: H,
487
+ variant: B,
483
488
  size: "icon",
484
489
  className: "h-7 w-7",
485
- "aria-label": m("calendar.previousMonth"),
486
- title: m("calendar.previousMonth"),
490
+ "aria-label": h("calendar.previousMonth"),
491
+ title: h("calendar.previousMonth"),
487
492
  ...e
488
493
  }
489
494
  ),
490
495
  NextMonthButton: (e) => /* @__PURE__ */ c(
491
- A,
496
+ R,
492
497
  {
493
- variant: H,
498
+ variant: B,
494
499
  size: "icon",
495
500
  className: "h-7 w-7",
496
- "aria-label": m("calendar.nextMonth"),
497
- title: m("calendar.nextMonth"),
501
+ "aria-label": h("calendar.nextMonth"),
502
+ title: h("calendar.nextMonth"),
498
503
  ...e
499
504
  }
500
505
  ),
501
- MonthCaption: ({ displayIndex: e, ...n }) => /* @__PURE__ */ c(de.Provider, { value: e, children: /* @__PURE__ */ c("div", { ...n }) }),
506
+ MonthCaption: ({ displayIndex: e, ...n }) => /* @__PURE__ */ c(ue.Provider, { value: e, children: /* @__PURE__ */ c("div", { ...n }) }),
502
507
  MonthsDropdown: ({ value: e }) => {
503
- const n = u.useContext(de), t = n > 0, a = new Date(Y.getFullYear(), Y.getMonth() + n, 1).getFullYear(), o = Re(a);
508
+ const n = d.useContext(ue), t = n > 0, a = new Date(j.getFullYear(), j.getMonth() + n, 1).getFullYear(), s = Ie(a);
504
509
  return /* @__PURE__ */ c(
505
510
  ce,
506
511
  {
507
- value: o.find((s) => s.value === e?.toString()),
508
- onChange: (s) => {
509
- if (s && "value" in s) {
510
- const l = parseInt(s.value);
512
+ value: s.find((l) => l.value === e?.toString()),
513
+ onChange: (l) => {
514
+ if (l && "value" in l) {
515
+ const o = parseInt(l.value);
511
516
  if (t) {
512
- const i = new Date(a, l - 1, 1);
513
- L(i);
517
+ const u = new Date(a, o - 1, 1);
518
+ O(u);
514
519
  } else {
515
- const i = new Date(a, l, 1);
516
- L(i);
520
+ const u = new Date(a, o, 1);
521
+ O(u);
517
522
  }
518
523
  }
519
524
  },
520
525
  scrollToSelectedOnOpen: !0,
521
- options: o,
526
+ options: s,
522
527
  className: "w-[95px]",
523
528
  menuWidth: "140px",
524
529
  isSearchable: !0,
525
530
  isClearable: !1,
526
- placeholder: m("calendar.monthPlaceholder")
531
+ placeholder: h("calendar.monthPlaceholder")
527
532
  }
528
533
  );
529
534
  },
530
535
  YearsDropdown: ({ value: e }) => {
531
- const t = u.useContext(de) > 0, r = pe();
536
+ const t = d.useContext(ue) > 0, r = pe();
532
537
  return /* @__PURE__ */ c(
533
538
  ce,
534
539
  {
535
540
  value: r.find((a) => a.value === e?.toString()),
536
541
  onChange: (a) => {
537
542
  if (a && "value" in a) {
538
- const o = parseInt(a.value);
543
+ const s = parseInt(a.value);
539
544
  if (t) {
540
- const s = new Date(Y.getFullYear(), Y.getMonth() + 1, 1).getMonth(), l = new Date(o, s - 1, 1);
541
- L(l);
545
+ const l = new Date(j.getFullYear(), j.getMonth() + 1, 1).getMonth(), o = new Date(s, l - 1, 1);
546
+ O(o);
542
547
  } else {
543
- const s = new Date(o, Y.getMonth(), 1);
544
- L(s);
548
+ const l = new Date(s, j.getMonth(), 1);
549
+ O(l);
545
550
  }
546
551
  }
547
552
  },
@@ -551,54 +556,54 @@ function st({
551
556
  menuWidth: "140px",
552
557
  isSearchable: !0,
553
558
  isClearable: !1,
554
- placeholder: m("calendar.yearPlaceholder")
559
+ placeholder: h("calendar.yearPlaceholder")
555
560
  }
556
561
  );
557
562
  },
558
563
  DayButton: (e) => /* @__PURE__ */ c(
559
- Je,
564
+ Ge,
560
565
  {
561
566
  ...e,
562
- pickerType: f
567
+ pickerType: m
563
568
  }
564
569
  ),
565
570
  WeekNumber: ({ week: e, ...n }) => {
566
- const t = e.days.find((F) => !F.outside)?.date;
571
+ const t = e.days.find((I) => !I.outside)?.date;
567
572
  if (!t)
568
- return /* @__PURE__ */ c("td", { ...n, className: d("select-none flex items-center justify-center h-8 text-[11px] text-content-muted w-8 flex-shrink-0 rdp-week_number", n.className), children: /* @__PURE__ */ c("div", { className: "flex size-[--cell-size] items-center justify-center text-center" }) });
569
- const r = t.getFullYear(), a = t.getMonth(), l = (new Date(r, a, 1).getDay() + 7 - T) % 7, i = new Date(r, a, 1 - l), h = new Date(t), I = (t.getDay() + 7 - T) % 7;
570
- h.setDate(t.getDate() - I);
571
- const M = Math.round((h.getTime() - i.getTime()) / (10080 * 60 * 1e3)) + 1, U = m("calendar.weekLabel", { number: M });
572
- return f === "week" ? /* @__PURE__ */ c(
573
+ return /* @__PURE__ */ c("td", { ...n, className: f("select-none flex items-center justify-center h-8 text-[11px] text-content-muted w-8 flex-shrink-0 rdp-week_number", n.className), children: /* @__PURE__ */ c("div", { className: "flex size-[--cell-size] items-center justify-center text-center" }) });
574
+ const r = t.getFullYear(), a = t.getMonth(), o = (new Date(r, a, 1).getDay() + 7 - T) % 7, u = new Date(r, a, 1 - o), i = new Date(t), p = (t.getDay() + 7 - T) % 7;
575
+ i.setDate(t.getDate() - p);
576
+ const S = Math.round((i.getTime() - u.getTime()) / (10080 * 60 * 1e3)) + 1, z = h("calendar.weekLabel", { number: S });
577
+ return m === "week" ? /* @__PURE__ */ c(
573
578
  "td",
574
579
  {
575
580
  ...n,
576
- "aria-label": U,
577
- "data-week-index": M,
578
- "data-week-number": M,
579
- className: d(
581
+ "aria-label": z,
582
+ "data-week-index": S,
583
+ "data-week-number": S,
584
+ className: f(
580
585
  "select-none flex items-center justify-center h-[30px] w-[30px] flex-shrink-0 rdp-week_number cursor-pointer hover:bg-accent hover:text-accent-foreground group-hover/week:bg-accent group-hover/week:rounded-l-lg rounded-lg transition-colors",
581
586
  n.className
582
587
  ),
583
588
  scope: "row",
584
589
  role: "rowheader",
585
- onClick: (F) => {
586
- F.preventDefault(), F.stopPropagation(), ie(le(e));
590
+ onClick: (I) => {
591
+ I.preventDefault(), I.stopPropagation(), ie(oe(e));
587
592
  },
588
- children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center text-[11px] text-content-muted", children: m("calendar.weekNumber", { number: M }) })
593
+ children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center text-[11px] text-content-muted", children: h("calendar.weekNumber", { number: S }) })
589
594
  }
590
595
  ) : /* @__PURE__ */ c(
591
596
  "td",
592
597
  {
593
598
  ...n,
594
- "aria-label": U,
595
- className: d(
599
+ "aria-label": z,
600
+ className: f(
596
601
  "select-none flex items-center justify-center h-[30px] text-[11px] text-content-muted w-[30px] flex-shrink-0 rdp-week_number",
597
602
  n.className
598
603
  ),
599
604
  scope: "row",
600
605
  role: "rowheader",
601
- children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center", children: m("calendar.weekNumber", { number: M }) })
606
+ children: /* @__PURE__ */ c("div", { className: "flex h-8 w-full items-center justify-center text-center", children: h("calendar.weekNumber", { number: S }) })
602
607
  }
603
608
  );
604
609
  },
@@ -608,11 +613,11 @@ function st({
608
613
  }
609
614
  )
610
615
  ),
611
- x && /* @__PURE__ */ C("div", { className: d("flex items-center gap-2 border-t pt-3 p-3", f === "month" && v !== "single" || B === "range" || w === "range" || w === "multiple" ? "justify-between" : "justify-end"), children: [
612
- B === "range" && f === "date" && /* @__PURE__ */ C("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
616
+ x && /* @__PURE__ */ Y("div", { className: f("flex items-center gap-2 border-t pt-3 p-3", m === "month" && w !== "single" || F === "range" || v === "range" || v === "multiple" ? "justify-between" : "justify-end"), children: [
617
+ F === "range" && m === "date" && /* @__PURE__ */ Y("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
613
618
  "Selected:",
614
619
  /* @__PURE__ */ c("span", { className: "text-content font-semibold", children: (() => {
615
- const e = q;
620
+ const e = W;
616
621
  if (e?.from && e?.to) {
617
622
  const n = Math.abs(e.to.getTime() - e.from.getTime()), t = Math.ceil(n / (1e3 * 60 * 60 * 24)) + 1;
618
623
  return `${t} day${t !== 1 ? "s" : ""}`;
@@ -620,123 +625,123 @@ function st({
620
625
  return "0 days";
621
626
  })() })
622
627
  ] }),
623
- f === "week" && (w === "range" || w === "multiple") && /* @__PURE__ */ C("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
628
+ m === "week" && (v === "range" || v === "multiple") && /* @__PURE__ */ Y("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
624
629
  "Selected:",
625
630
  /* @__PURE__ */ c("span", { className: "text-content font-semibold", children: (() => {
626
- const e = O;
631
+ const e = $;
627
632
  if (!e) return "0 weeks";
628
- const n = (l) => Date.UTC(l.getFullYear(), l.getMonth(), l.getDate()), t = (l) => {
629
- const i = Math.floor(l / 7), h = l % 7, p = [];
630
- return i > 0 && p.push(`${i} week${i !== 1 ? "s" : ""}`), (h > 0 || i === 0) && p.push(`${h} day${h !== 1 ? "s" : ""}`), p.join(" ");
631
- }, r = k === "fiscal" && se === "fiscalMonth", a = k === "fiscal", o = r ? "fiscal month" : a ? "fiscal week" : "week", s = r ? "fiscal months" : a ? "fiscal weeks" : "weeks";
633
+ const n = (o) => Date.UTC(o.getFullYear(), o.getMonth(), o.getDate()), t = (o) => {
634
+ const u = Math.floor(o / 7), i = o % 7, g = [];
635
+ return u > 0 && g.push(`${u} week${u !== 1 ? "s" : ""}`), (i > 0 || u === 0) && g.push(`${i} day${i !== 1 ? "s" : ""}`), g.join(" ");
636
+ }, r = L === "fiscal" && se === "fiscalMonth", a = L === "fiscal", s = r ? "fiscal month" : a ? "fiscal week" : "week", l = r ? "fiscal months" : a ? "fiscal weeks" : "weeks";
632
637
  if (Array.isArray(e))
633
638
  if (a || r) {
634
- const l = e.length;
635
- return `${l} ${l !== 1 ? s : o}`;
639
+ const o = e.length;
640
+ return `${o} ${o !== 1 ? l : s}`;
636
641
  } else {
637
- let l = 0;
638
- return e.forEach((i) => {
639
- const h = n(i.startDate), p = n(i.endDate);
640
- l += Math.round((p - h) / (1e3 * 60 * 60 * 24)) + 1;
641
- }), t(l);
642
+ let o = 0;
643
+ return e.forEach((u) => {
644
+ const i = n(u.startDate), g = n(u.endDate);
645
+ o += Math.round((g - i) / (1e3 * 60 * 60 * 24)) + 1;
646
+ }), t(o);
642
647
  }
643
648
  else if ("from" in e) {
644
- const { from: l, to: i } = e;
649
+ const { from: o, to: u } = e;
645
650
  if (r) {
646
- if (!i) return `1 ${o}`;
647
- const h = n(l.startDate), p = n(i.endDate), I = Math.round(Math.abs(p - h) / (1e3 * 60 * 60 * 24)) + 1, $ = ee ? ee.reduce((U, F) => U + F, 0) / 12 : 4.33, M = Math.max(1, Math.round(I / ($ * 7)));
648
- return `${M} ${M !== 1 ? s : o}`;
651
+ if (!u) return `1 ${s}`;
652
+ const i = n(o.startDate), g = n(u.endDate), p = Math.round(Math.abs(g - i) / (1e3 * 60 * 60 * 24)) + 1, k = ee ? ee.reduce((z, I) => z + I, 0) / 12 : 4.33, S = Math.max(1, Math.round(p / (k * 7)));
653
+ return `${S} ${S !== 1 ? l : s}`;
649
654
  } else if (a) {
650
- if (!i) return `1 ${o}`;
651
- const h = n(l.startDate), p = n(i.endDate), I = Math.round((p - h) / (10080 * 60 * 1e3)), $ = I > 0 ? I : 1;
652
- return `${$} ${$ !== 1 ? s : o}`;
655
+ if (!u) return `1 ${s}`;
656
+ const i = n(o.startDate), g = n(u.endDate), p = Math.round((g - i) / (10080 * 60 * 1e3)), k = p > 0 ? p : 1;
657
+ return `${k} ${k !== 1 ? l : s}`;
653
658
  } else {
654
- if (!i) {
655
- const $ = n(l.startDate), M = n(l.endDate), U = Math.round((M - $) / (1e3 * 60 * 60 * 24)) + 1;
656
- return t(U);
659
+ if (!u) {
660
+ const k = n(o.startDate), S = n(o.endDate), z = Math.round((S - k) / (1e3 * 60 * 60 * 24)) + 1;
661
+ return t(z);
657
662
  }
658
- const h = n(l.startDate), p = n(i.endDate), I = Math.round(Math.abs(p - h) / (1e3 * 60 * 60 * 24)) + 1;
659
- return t(I);
663
+ const i = n(o.startDate), g = n(u.endDate), p = Math.round(Math.abs(g - i) / (1e3 * 60 * 60 * 24)) + 1;
664
+ return t(p);
660
665
  }
661
666
  } else
662
- return `1 ${o}`;
667
+ return `1 ${s}`;
663
668
  })() })
664
669
  ] }),
665
- f === "month" && (v === "range" || v === "multiple") && /* @__PURE__ */ C("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
670
+ m === "month" && (w === "range" || w === "multiple") && /* @__PURE__ */ Y("div", { className: "flex flex-row items-center gap-1 text-content-tertiary text-xs leading-[18px] font-medium", children: [
666
671
  "Selected:",
667
672
  /* @__PURE__ */ c("span", { className: "text-content font-semibold", children: (() => {
668
- const e = j;
673
+ const e = M;
669
674
  if (!e) return "0 months";
670
675
  if (Array.isArray(e)) {
671
676
  const n = e.length;
672
- return n === 1 ? m("calendar.monthRange") : m("calendar.monthRangePlural", { count: n });
677
+ return n === 1 ? h("calendar.monthRange") : h("calendar.monthRangePlural", { count: n });
673
678
  } else if ("from" in e) {
674
679
  const n = e;
675
- if (!n.to) return m("calendar.monthRange");
680
+ if (!n.to) return h("calendar.monthRange");
676
681
  const t = new Date(n.from.year, n.from.month, 1), r = new Date(n.to.year, n.to.month, 1), a = (r.getFullYear() - t.getFullYear()) * 12 + (r.getMonth() - t.getMonth()) + 1;
677
- return a === 1 ? m("calendar.monthRange") : m("calendar.monthRangePlural", { count: a });
682
+ return a === 1 ? h("calendar.monthRange") : h("calendar.monthRangePlural", { count: a });
678
683
  } else
679
- return m("calendar.monthRange");
684
+ return h("calendar.monthRange");
680
685
  })() })
681
686
  ] }),
682
- /* @__PURE__ */ C("div", { className: "flex items-center gap-2", children: [
687
+ /* @__PURE__ */ Y("div", { className: "flex items-center gap-2", children: [
683
688
  /* @__PURE__ */ c(
684
- A,
689
+ R,
685
690
  {
686
691
  variant: "link",
687
692
  size: "sm",
688
- onClick: Ee,
689
- children: m("calendar.clear")
693
+ onClick: $e,
694
+ children: h("calendar.clear")
690
695
  }
691
696
  ),
692
697
  /* @__PURE__ */ c(
693
- A,
698
+ R,
694
699
  {
695
700
  variant: "outline",
696
701
  size: "sm",
697
- onClick: $e,
698
- children: m("calendar.cancel")
702
+ onClick: Pe,
703
+ children: h("calendar.cancel")
699
704
  }
700
705
  ),
701
706
  /* @__PURE__ */ c(
702
- A,
707
+ R,
703
708
  {
704
709
  variant: "default",
705
710
  size: "sm",
706
- onClick: Pe,
707
- children: m("calendar.apply")
711
+ onClick: Ee,
712
+ children: h("calendar.apply")
708
713
  }
709
714
  )
710
715
  ] })
711
716
  ] })
712
717
  ] });
713
718
  }
714
- function Je({
719
+ function Ge({
715
720
  className: ae,
716
- day: J,
717
- modifiers: D,
718
- pickerType: K,
719
- ...H
721
+ day: G,
722
+ modifiers: y,
723
+ pickerType: J,
724
+ ...B
720
725
  }) {
721
- const Q = u.useRef(null);
722
- return u.useEffect(() => {
723
- D.focused && Q.current?.focus();
724
- }, [D.focused]), /* @__PURE__ */ c(
725
- A,
726
+ const Q = d.useRef(null);
727
+ return d.useEffect(() => {
728
+ y.focused && Q.current?.focus();
729
+ }, [y.focused]), /* @__PURE__ */ c(
730
+ R,
726
731
  {
727
732
  ref: Q,
728
733
  variant: "ghost",
729
734
  size: "sm",
730
- "data-day": J.date.toLocaleDateString(),
731
- "data-selected-single": D.selected && !D.range_start && !D.range_end && !D.range_middle,
732
- "data-range-start": D.range_start,
733
- "data-range-end": D.range_end,
734
- "data-range-middle": D.range_middle,
735
- className: d(
735
+ "data-day": G.date.toLocaleDateString(),
736
+ "data-selected-single": y.selected && !y.range_start && !y.range_end && !y.range_middle,
737
+ "data-range-start": y.range_start,
738
+ "data-range-end": y.range_end,
739
+ "data-range-middle": y.range_middle,
740
+ className: f(
736
741
  "gap-2 whitespace-nowrap focus-visible:ring-1 focus-visible:ring-focus-ring disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 px-3 rounded-lg flex items-center justify-center font-normal transition-colors w-5 h-5 border border-transparent focus-visible:outline-none text-sm rdp-day rdp-day_button",
737
742
  // Hover styling
738
- K !== "week" && "hover:bg-accent hover:text-accent-foreground hover:border-brand",
739
- K === "week" && "hover:bg-transparent hover:text-inherit hover:border-transparent",
743
+ J !== "week" && "hover:bg-accent hover:text-accent-foreground hover:border-brand",
744
+ J === "week" && "hover:bg-transparent hover:text-inherit hover:border-transparent",
740
745
  // Selection state
741
746
  "data-[selected-single=true]:bg-brand data-[selected-single=true]:text-brand-foreground data-[selected-single=true]:rounded-lg data-[selected-single=true]:border-transparent",
742
747
  "data-[range-start=true]:bg-brand data-[range-start=true]:text-brand-foreground data-[range-start=true]:rounded-lg data-[range-start=true]:border-transparent",
@@ -745,12 +750,12 @@ function Je({
745
750
  ae
746
751
  ),
747
752
  "data-component": "calendar-day",
748
- ...H,
749
- disabled: H.disabled || D.disabled
753
+ ...B,
754
+ disabled: B.disabled || y.disabled
750
755
  }
751
756
  );
752
757
  }
753
758
  export {
754
759
  st as Calendar,
755
- Je as CalendarDayButton
760
+ Ge as CalendarDayButton
756
761
  };