@aiquants/period-slider 0.8.0 → 0.10.0

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.
package/dist/index.js CHANGED
@@ -1,7 +1,133 @@
1
- import { jsx as p, jsxs as we, Fragment as on } from "react/jsx-runtime";
2
- import { addYears as Ha, addMonths as Oa, addDays as Hr, format as Jt, getDaysInMonth as _n, parseISO as Xn } from "date-fns";
3
- import { memo as br, useId as Fa, useRef as G, useMemo as T, useCallback as B, useState as Te, useEffect as Yt } from "react";
4
- const Ua = {
1
+ import { jsx as I, jsxs as Me, Fragment as jn } from "react/jsx-runtime";
2
+ import { addYears as Si, addMonths as yi, addDays as gn, format as gr, getDaysInMonth as ro, parseISO as no } from "date-fns";
3
+ import { memo as zr, useId as Ti, useRef as O, useMemo as C, useCallback as U, useState as ye, useEffect as Dt, useLayoutEffect as Cr } from "react";
4
+ const ao = 120, qn = "data-drag-snap", Zn = "--ps-drag-snap-duration", Hr = {
5
+ flat: ["--ps-drag-low", "--ps-drag-high"],
6
+ macro: ["--ps-drag-macro-low", "--ps-drag-macro-high"],
7
+ micro: ["--ps-drag-micro-low", "--ps-drag-micro-high"]
8
+ }, To = ["low", "high"], Po = ["tx", "ty", "rot"], xn = {
9
+ flat: { low: "--ps-drag-label-low", high: "--ps-drag-label-high" },
10
+ macro: { low: "--ps-drag-macro-label-low", high: "--ps-drag-macro-label-high" },
11
+ micro: { low: "--ps-drag-micro-label-low", high: "--ps-drag-micro-label-high" }
12
+ }, ca = (e, t) => `${e}-${t}`, Jn = (e, t, r) => `var(${ca(e, t)}, ${r})`, Pi = (e, t, r) => {
13
+ const n = xn[t];
14
+ for (const a of To)
15
+ for (const i of Po) e.style.setProperty(ca(n[a], i), r[a][i]);
16
+ }, Ao = (e) => Math.max(0, Math.min(1, e)), hn = (e, t, r, n) => {
17
+ const a = Ao(t);
18
+ if (e === "point") return [a, a];
19
+ const i = e === "low" ? n : r;
20
+ return [Math.min(a, i), Math.max(a, i)];
21
+ }, ua = (e, t, r) => {
22
+ const n = r - t, a = Math.max(0, Math.min(1 - n, t + e));
23
+ return [a, a + n];
24
+ }, da = (e, t, r, n) => {
25
+ const a = Ao(t);
26
+ return e === "low" ? a > n ? "high" : "low" : a < r ? "low" : "high";
27
+ }, Qn = (e, t, r, n) => {
28
+ if (r) {
29
+ const l = (1 - e) * 100, c = (1 - t) * 100;
30
+ return n ? `M 12 ${c} L 12 ${l} L 20 100 L 20 0 Z` : `M 12 0 L 12 100 L 20 ${l} L 20 ${c} Z`;
31
+ }
32
+ const a = e * 100, i = t * 100;
33
+ return n ? `M ${a} 12 L ${i} 12 L 100 20 L 0 20 Z` : `M 0 12 L 100 12 L ${i} 20 L ${a} 20 Z`;
34
+ }, It = (e, t) => `var(${e}, ${t}%)`, Ai = (e, t, r, n) => {
35
+ const [a, i] = Hr[t];
36
+ e.style.setProperty(a, `${r * 100}%`), e.style.setProperty(i, `${n * 100}%`);
37
+ }, $i = (e) => {
38
+ for (const [t, r] of Object.values(Hr))
39
+ e.style.removeProperty(t), e.style.removeProperty(r);
40
+ for (const t of Object.values(xn))
41
+ for (const r of To)
42
+ for (const n of Po) e.style.removeProperty(ca(t[r], n));
43
+ }, ea = (e, t) => e !== null && t !== null && "nodeType" in t && e.contains(t), oo = /* @__PURE__ */ new Set(["hidden", "clip", "scroll", "auto", "overlay"]), io = ["paint", "strict", "content"], Ei = ["layout", "paint", "strict", "content"], Ii = ["transform", "perspective", "filter"], Vr = (e) => e !== void 0 && e !== "" && e !== "none", Ci = (e) => e.position === "fixed" ? "fixed" : e.position === "absolute" ? "absolute" : null, Vi = (e, t) => t === "absolute" && Vr(e.position) && e.position !== "static" || Vr(e.transform) || Vr(e.perspective) || Vr(e.filter) || Vr(e.backdropFilter) || Ei.some((r) => e.contain.includes(r)) ? !0 : Ii.some((r) => e.willChange.includes(r)), Ni = (e, t, r, n, a, i) => {
44
+ const l = t.ownerDocument.defaultView;
45
+ if (l === null) return !1;
46
+ const c = e.getBoundingClientRect();
47
+ if (c.width === 0 || c.height === 0) return !1;
48
+ const f = n ? 0 : r, g = n ? r : 0;
49
+ if (a < c.left - f || a >= c.right + f || i < c.top - g || i >= c.bottom + g) return !1;
50
+ const D = l.getComputedStyle(t);
51
+ if (D.visibility !== "visible") return !1;
52
+ let R = null;
53
+ for (let s = t; s !== null; s = s.parentElement) {
54
+ const S = s === t ? D : l.getComputedStyle(s);
55
+ if (R !== null && !Vi(S, R)) continue;
56
+ const Z = oo.has(S.overflowX) || io.some((x) => S.contain.includes(x)), ee = oo.has(S.overflowY) || io.some((x) => S.contain.includes(x));
57
+ if (Z || ee) {
58
+ const x = s.getBoundingClientRect();
59
+ if (Z && (a < x.left || a >= x.right) || ee && (i < x.top || i >= x.bottom)) return !1;
60
+ }
61
+ R = Ci(S);
62
+ }
63
+ return !0;
64
+ }, ta = /* @__PURE__ */ new Map(), ki = (e, t) => {
65
+ if (!(t.shiftKey && t.cancelable)) return;
66
+ for (const a of e)
67
+ if (a.ownsHit(t.target)) {
68
+ a.step(t);
69
+ return;
70
+ }
71
+ let r = null, n = Number.POSITIVE_INFINITY;
72
+ for (const a of e) {
73
+ const i = a.distanceToRailPx(t.clientX, t.clientY);
74
+ i === null || i >= n || (r = a, n = i);
75
+ }
76
+ r?.step(t);
77
+ }, Yi = (e, t) => {
78
+ let r = ta.get(e);
79
+ if (r === void 0) {
80
+ const i = /* @__PURE__ */ new Set(), l = (c) => ki(i, c);
81
+ r = { participants: i, listener: l }, ta.set(e, r), e.addEventListener("wheel", l, { passive: !1, capture: !0 });
82
+ }
83
+ const { participants: n, listener: a } = r;
84
+ return n.add(t), () => {
85
+ n.delete(t), !(n.size > 0) && (ta.delete(e), e.removeEventListener("wheel", a, { capture: !0 }));
86
+ };
87
+ }, Fr = "gap-[11px]", mt = 6, ft = mt * 2, Ct = mt * 4 / 3, Oi = {
88
+ left: `0,${ft / 2} ${mt},0 ${mt},${ft}`,
89
+ right: `${Ct},${ft / 2} ${Ct - mt},0 ${Ct - mt},${ft}`,
90
+ up: `${ft / 2},0 0,${mt} ${ft},${mt}`,
91
+ down: `${ft / 2},${Ct} 0,${Ct - mt} ${ft},${Ct - mt}`
92
+ }, ra = (e) => {
93
+ e.preventDefault(), e.stopPropagation();
94
+ }, Hi = {
95
+ onMouseDownCapture: ra,
96
+ onMouseUpCapture: ra,
97
+ onClickCapture: ra
98
+ }, _i = "period-slider-step", Fi = `${_i} relative inline-flex size-[22px] shrink-0 items-center justify-center rounded-md after:absolute after:content-['']`, zi = "transition-colors motion-reduce:transition-none not-aria-disabled:cursor-pointer aria-disabled:cursor-not-allowed focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 dark:focus-visible:ring-blue-400 forced-colors:not-aria-disabled:hover:text-[Highlight] forced-colors:aria-disabled:text-[GrayText]", Bi = {
99
+ control: "text-slate-500 not-aria-disabled:hover:bg-slate-500/15 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-500/25 aria-disabled:text-slate-500/40 dark:text-slate-400 dark:not-aria-disabled:hover:text-slate-50 dark:aria-disabled:text-slate-400/40",
100
+ rail: "border border-slate-300 bg-white text-slate-700 shadow-2xs not-aria-disabled:hover:border-slate-400 not-aria-disabled:hover:bg-slate-100 not-aria-disabled:hover:text-slate-900 not-aria-disabled:active:bg-slate-200 aria-disabled:border-slate-300/40 aria-disabled:bg-white/40 aria-disabled:text-slate-700/40 aria-disabled:shadow-none dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:not-aria-disabled:hover:border-slate-500 dark:not-aria-disabled:hover:bg-slate-700 dark:not-aria-disabled:hover:text-white dark:not-aria-disabled:active:bg-slate-600 dark:aria-disabled:border-slate-700/40 dark:aria-disabled:bg-slate-800/40 dark:aria-disabled:text-slate-200/40"
101
+ }, sn = "after:inset-[calc((100%-var(--ps-target-size))/2)]", lo = { horizontal: "px-[19px]", vertical: "py-[19px]" }, Ui = {
102
+ control: {
103
+ left: sn,
104
+ right: sn,
105
+ up: sn,
106
+ down: sn
107
+ },
108
+ rail: {
109
+ left: "after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:left-[calc(100%-var(--ps-target-size)+4px)] after:-right-[4px]",
110
+ right: "after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-left-[4px] after:right-[calc(100%-var(--ps-target-size)+4px)]",
111
+ up: "after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-[calc(100%-var(--ps-target-size)+4px)] after:-bottom-[4px]",
112
+ down: "after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-[4px] after:bottom-[calc(100%-var(--ps-target-size)+4px)]"
113
+ }
114
+ }, Ut = ({ direction: e, neighbour: t, disabled: r, canStep: n, onStep: a, ariaLabel: i, className: l, ref: c }) => {
115
+ const f = e === "up" || e === "down", g = f ? ft : Ct, D = f ? Ct : ft, R = r || !n;
116
+ return /* @__PURE__ */ I(
117
+ "button",
118
+ {
119
+ ref: c,
120
+ type: "button",
121
+ "aria-label": i,
122
+ disabled: r,
123
+ "aria-disabled": R ? !0 : void 0,
124
+ ...R ? Hi : null,
125
+ onClick: R ? void 0 : a,
126
+ className: `${l === void 0 ? "" : `${l} `}${Fi} ${zi} ${Bi[t]} ${Ui[t][e]}`,
127
+ children: /* @__PURE__ */ I("svg", { "aria-hidden": "true", focusable: "false", "data-arrow": e, width: g, height: D, viewBox: `0 0 ${g} ${D}`, fill: "currentColor", className: "pointer-events-none block shrink-0", children: /* @__PURE__ */ I("polygon", { points: Oi[e] }) })
128
+ }
129
+ );
130
+ }, Wi = {
5
131
  "blue-rose": {
6
132
  macro: "#0284c7",
7
133
  macroLight: "#38bdf8",
@@ -44,33 +170,36 @@ const Ua = {
44
170
  microLight: "#71717a",
45
171
  accent: "#27272a"
46
172
  }
47
- }, wt = (e) => e instanceof Date && !Number.isNaN(e.getTime()), Le = (e) => e instanceof Date ? Number.isNaN(e.getTime()) ? "Invalid Date" : e.toISOString() : String(e), ut = (e, t) => {
48
- if (!wt(t)) throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${Le(t)})`);
173
+ }, et = (e) => e instanceof Date && !Number.isNaN(e.getTime()), De = (e) => e instanceof Date ? Number.isNaN(e.getTime()) ? "Invalid Date" : e.toISOString() : String(e), je = (e, t) => {
174
+ if (!et(t)) throw new RangeError(`normalizeDateByUnit: d must be a valid Date (received: ${De(t)})`);
49
175
  const r = new Date(t.getTime());
50
176
  return e === "year" ? (r.setMonth(0, 1), r.setHours(0, 0, 0, 0)) : (e === "month" && r.setDate(1), r.setHours(0, 0, 0, 0)), r;
51
- }, oe = (e, t) => {
52
- const r = ut(e, t), n = r.getFullYear(), a = r.getMonth() + 1, l = r.getDate();
177
+ }, Q = (e, t) => {
178
+ const r = je(e, t), n = r.getFullYear(), a = r.getMonth() + 1, i = r.getDate();
53
179
  if (e === "year") return n;
54
180
  if (e === "month") return n * 12 + (a - 1);
55
- const o = /* @__PURE__ */ new Date(0);
56
- return o.setUTCFullYear(n, a - 1, l), o.setUTCHours(0, 0, 0, 0), Math.floor(o.getTime() / (1440 * 60 * 1e3));
57
- }, ge = (e, t) => {
181
+ const l = /* @__PURE__ */ new Date(0);
182
+ return l.setUTCFullYear(n, a - 1, i), l.setUTCHours(0, 0, 0, 0), Math.floor(l.getTime() / (1440 * 60 * 1e3));
183
+ }, ie = (e, t) => {
58
184
  const r = /* @__PURE__ */ new Date(0);
59
185
  if (r.setHours(0, 0, 0, 0), e === "year")
60
186
  return r.setFullYear(t, 0, 1), r;
61
187
  if (e === "month") {
62
- const a = Math.floor(t / 12), l = t - a * 12;
63
- return r.setFullYear(a, l, 1), r;
188
+ const a = Math.floor(t / 12), i = t - a * 12;
189
+ return r.setFullYear(a, i, 1), r;
64
190
  }
65
191
  const n = new Date(t * 24 * 60 * 60 * 1e3);
66
192
  return r.setFullYear(n.getUTCFullYear(), n.getUTCMonth(), n.getUTCDate()), r;
67
- }, Ee = (e, t, r) => {
68
- if (!wt(t)) throw new RangeError(`addUnit: d must be a valid Date (received: ${Le(t)})`);
69
- return e === "year" ? Ha(t, r) : e === "month" ? Oa(t, r) : Hr(t, r);
70
- }, et = (e, t, r) => {
71
- if (!wt(r)) throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${Le(r)})`);
193
+ }, Oe = (e, t, r) => {
194
+ if (!et(t)) throw new RangeError(`addUnit: d must be a valid Date (received: ${De(t)})`);
195
+ return e === "year" ? Si(t, r) : e === "month" ? yi(t, r) : gn(t, r);
196
+ }, Xi = (e, t, r) => {
197
+ if (!et(r)) throw new RangeError(`getMacroWindowStartDate: d must be a valid Date (received: ${De(r)})`);
198
+ return je(t, je(e, r));
199
+ }, Gi = (e, t, r) => {
200
+ if (!et(r)) throw new RangeError(`getMacroWindowEndDate: d must be a valid Date (received: ${De(r)})`);
72
201
  if (e === t)
73
- return ut(t, r);
202
+ return je(t, r);
74
203
  const n = r.getFullYear(), a = r.getMonth();
75
204
  if (e === "year") {
76
205
  if (t === "month")
@@ -78,742 +207,826 @@ const Ua = {
78
207
  if (t === "day")
79
208
  return new Date(n, 11, 31);
80
209
  }
81
- return e === "month" && t === "day" ? new Date(n, a + 1, 0) : ut(t, r);
82
- }, Ba = {
210
+ return e === "month" && t === "day" ? new Date(n, a + 1, 0) : je(t, r);
211
+ }, so = (e, t, r) => e < t ? t : e > r ? r : e, xt = (e, t, r, n, a) => {
212
+ if (_r("macroRange", r, "resolveMacroWindow"), !et(n)) throw new RangeError(`resolveMacroWindow: minDate must be a valid Date (received: ${De(n)})`);
213
+ if (!et(a)) throw new RangeError(`resolveMacroWindow: maxDate must be a valid Date (received: ${De(a)})`);
214
+ if (a.getTime() < n.getTime()) throw new RangeError(`resolveMacroWindow: maxDate must not precede minDate (minDate: ${De(n)}, maxDate: ${De(a)})`);
215
+ return [je(t, so(Xi(e, t, r[0]), n, a)), je(t, so(Gi(e, t, r[1]), n, a))];
216
+ }, Ki = {
83
217
  year: { year: "numeric" },
84
218
  month: { year: "numeric", month: "2-digit" },
85
219
  day: { year: "numeric", month: "2-digit", day: "2-digit" }
86
- }, Kn = /* @__PURE__ */ new Map(), za = (e, t) => {
87
- const r = `${e}\0${t}`, n = Kn.get(r);
220
+ }, co = /* @__PURE__ */ new Map(), ji = (e, t) => {
221
+ const r = `${e}\0${t}`, n = co.get(r);
88
222
  if (n !== void 0) return n;
89
- const a = new Intl.DateTimeFormat(t, Ba[e]);
90
- return Kn.set(r, a), a;
91
- }, _a = (e, t) => {
223
+ const a = new Intl.DateTimeFormat(t, Ki[e]);
224
+ return co.set(r, a), a;
225
+ }, qi = (e, t) => {
92
226
  const r = String(t.getFullYear()).padStart(4, "0");
93
227
  if (e === "year") return r;
94
228
  const n = String(t.getMonth() + 1).padStart(2, "0");
95
229
  if (e === "month") return `${r}-${n}`;
96
230
  const a = String(t.getDate()).padStart(2, "0");
97
231
  return `${r}-${n}-${a}`;
98
- }, je = (e, t, r, n) => wt(t) ? r ? r(t) : n === void 0 ? _a(e, t) : za(e, n).format(t) : "", jt = (e, t, r, n) => je(e, t, r, n), Ae = (e, t, r) => {
232
+ }, Ke = (e, t, r, n) => et(t) ? r ? r(t) : n === void 0 ? qi(e, t) : ji(e, n).format(t) : "", dr = (e, t, r, n) => Ke(e, t, r, n), be = (e, t, r) => {
99
233
  if (!e || e.length === 0 || e.length === 1) return 0;
100
- const n = oe(r, t);
101
- let a = 0, l = e.length - 1;
102
- if (n <= oe(r, e[a])) return 0;
103
- if (n >= oe(r, e[l])) return l;
104
- for (; a <= l; ) {
105
- const f = a + l >> 1, m = oe(r, e[f]);
106
- if (m === n) return f;
107
- m < n ? a = f + 1 : l = f - 1;
234
+ const n = Q(r, t);
235
+ let a = 0, i = e.length - 1;
236
+ if (n <= Q(r, e[a])) return 0;
237
+ if (n >= Q(r, e[i])) return i;
238
+ for (; a <= i; ) {
239
+ const f = a + i >> 1, g = Q(r, e[f]);
240
+ if (g === n) return f;
241
+ g < n ? a = f + 1 : i = f - 1;
108
242
  }
109
- const o = Math.abs(oe(r, e[a]) - n), s = Math.abs(oe(r, e[l]) - n);
110
- return o < s ? a : l;
111
- }, Zt = (e, t, r, n) => {
243
+ const l = Math.abs(Q(r, e[a]) - n), c = Math.abs(Q(r, e[i]) - n);
244
+ return l < c ? a : i;
245
+ }, Vt = (e, t, r, n) => {
112
246
  if (!Array.isArray(e) || e.length === 0) return [];
113
- const a = oe(t, r), l = oe(t, n), o = /* @__PURE__ */ new Map();
114
- for (const s of e) {
115
- const f = ut(t, s), m = oe(t, f);
116
- m < a || m > l || o.has(m) || o.set(m, f);
247
+ const a = Q(t, r), i = Q(t, n), l = /* @__PURE__ */ new Map();
248
+ for (const c of e) {
249
+ const f = je(t, c), g = Q(t, f);
250
+ g < a || g > i || l.has(g) || l.set(g, f);
117
251
  }
118
- if (o.size === 0)
119
- throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${Le(r)}, maxDate: ${Le(n)}, entries: ${e.length})`);
120
- return Array.from(o.keys()).sort((s, f) => s - f).map((s) => o.get(s));
121
- }, kr = (e, t, r, n) => {
252
+ if (l.size === 0)
253
+ throw new RangeError(`getSortedAllowedDates: every allowedDates entry falls outside [minDate, maxDate] (minDate: ${De(r)}, maxDate: ${De(n)}, entries: ${e.length})`);
254
+ return Array.from(l.keys()).sort((c, f) => c - f).map((c) => l.get(c));
255
+ }, cn = (e, t, r, n) => {
122
256
  const a = e.length - 1;
123
257
  if (a <= 0) return 0;
124
- const l = Ae(e, n, t);
258
+ const i = be(e, n, t);
125
259
  if (r === "time") {
126
- const o = e[0].getTime(), s = e[a].getTime() - o;
127
- return s <= 0 ? 0 : Math.max(0, Math.min(1, (e[l].getTime() - o) / s));
260
+ const l = e[0].getTime(), c = e[a].getTime() - l;
261
+ return c <= 0 ? 0 : Math.max(0, Math.min(1, (e[i].getTime() - l) / c));
128
262
  }
129
- return l / a;
130
- }, Ar = (e, t, r, n) => {
263
+ return i / a;
264
+ }, un = (e, t, r, n) => {
131
265
  const a = e.length - 1;
132
266
  if (a <= 0) return 0;
133
- const l = Math.max(0, Math.min(1, n));
267
+ const i = Math.max(0, Math.min(1, n));
134
268
  if (r === "time") {
135
- const o = e[0].getTime(), s = e[a].getTime() - o;
136
- return s <= 0 ? 0 : Ae(e, new Date(o + l * s), t);
269
+ const l = e[0].getTime(), c = e[a].getTime() - l;
270
+ return c <= 0 ? 0 : be(e, new Date(l + i * c), t);
137
271
  }
138
- return Math.max(0, Math.min(a, Math.round(l * a)));
139
- }, qn = (e, t, r, n, a, l, o) => {
140
- let s = r, f = n;
141
- return o ? (s = t, f = t) : e === "low" ? t > n ? (s = n, f = t) : s = t : t < r ? (f = r, s = t) : f = t, [Math.max(a, Math.min(l, s)), Math.max(a, Math.min(l, f))];
142
- }, Xa = (e, t, r, n, a) => a ? "low" : e === "low" ? t > n ? "high" : "low" : t < r ? "low" : "high", Ka = ({ posDiffPct: e, startLowVal: t, startHighVal: r, rangeMin: n, rangeMax: a, isDiscrete: l, sortedAllowedDates: o, snapMode: s, unit: f }) => {
143
- if (l) {
144
- const E = o.length - 1;
145
- if (E <= 0) return [0, 0];
146
- const J = Math.max(0, Math.min(E, Math.round(t))), x = Math.max(J, Math.min(E, Math.round(r)));
147
- if (s === "time") {
148
- const D = o[0].getTime(), F = o[E].getTime(), A = o[J].getTime(), C = o[x].getTime() - A;
149
- let V = A + e * (F - D), O = V + C;
150
- V < D && (V = D, O = D + C), O > F && (O = F, V = F - C);
151
- const v = Ae(o, new Date(V), f), $ = Ae(o, new Date(O), f);
152
- return [v, Math.max(v, $)];
272
+ return Math.max(0, Math.min(a, Math.round(i * a)));
273
+ }, uo = (e, t, r, n, a, i, l) => {
274
+ let c = r, f = n;
275
+ return l ? (c = t, f = t) : e === "low" ? t > n ? (c = n, f = t) : c = t : t < r ? (f = r, c = t) : f = t, [Math.max(a, Math.min(i, c)), Math.max(a, Math.min(i, f))];
276
+ }, Zi = ({ posDiffPct: e, startLowVal: t, startHighVal: r, rangeMin: n, rangeMax: a, isDiscrete: i, sortedAllowedDates: l, snapMode: c, unit: f }) => {
277
+ if (i) {
278
+ const Z = l.length - 1;
279
+ if (Z <= 0) return [0, 0];
280
+ const ee = Math.max(0, Math.min(Z, Math.round(t))), x = Math.max(ee, Math.min(Z, Math.round(r)));
281
+ if (c === "time") {
282
+ const H = l[0].getTime(), W = l[Z].getTime(), oe = l[ee].getTime(), q = l[x].getTime() - oe;
283
+ let X = oe + e * (W - H), y = X + q;
284
+ X < H && (X = H, y = H + q), y > W && (y = W, X = W - q);
285
+ const L = be(l, new Date(X), f), T = be(l, new Date(y), f);
286
+ return [L, Math.max(L, T)];
153
287
  }
154
- const le = Math.round(e * E);
155
- let y = J + le, j = x + le;
156
- return y < 0 && (j += -y, y = 0), j > E && (y -= j - E, j = E), [Math.max(0, Math.min(E, y)), Math.max(0, Math.min(E, j))];
288
+ const ue = Math.round(e * Z);
289
+ let ae = ee + ue, $ = x + ue;
290
+ return ae < 0 && ($ += -ae, ae = 0), $ > Z && (ae -= $ - Z, $ = Z), [Math.max(0, Math.min(Z, ae)), Math.max(0, Math.min(Z, $))];
157
291
  }
158
- const m = (E) => Math.max(n, Math.min(a, E)), L = a - n;
159
- if (L <= 0) return [m(t), m(r)];
160
- const M = Math.round(e * L);
161
- let u = t + M, P = r + M;
162
- return u < n && (P += n - u, u = n), P > a && (u -= P - a, P = a), [m(u), m(P)];
163
- }, qa = (e, t, r, n, a, l, o, s) => {
164
- let f = 0, m = !1, L = !1;
292
+ const g = (Z) => Math.max(n, Math.min(a, Z)), D = a - n;
293
+ if (D <= 0) return [g(t), g(r)];
294
+ const R = Math.round(e * D);
295
+ let s = t + R, S = r + R;
296
+ return s < n && (S += n - s, s = n), S > a && (s -= S - a, S = a), [g(s), g(S)];
297
+ }, Ji = (e, t, r, n, a, i, l, c) => {
298
+ let f = 0, g = !1, D = !1;
165
299
  switch (e) {
166
300
  case "ArrowRight":
167
301
  case "ArrowUp":
168
- f = s;
302
+ f = c;
169
303
  break;
170
304
  case "ArrowLeft":
171
305
  case "ArrowDown":
172
- f = -s;
306
+ f = -c;
173
307
  break;
174
308
  case "PageUp":
175
- f = s * 5;
309
+ f = c * 5;
176
310
  break;
177
311
  case "PageDown":
178
- f = -s * 5;
312
+ f = -c * 5;
179
313
  break;
180
314
  case "Home":
181
- m = !0;
315
+ g = !0;
182
316
  break;
183
317
  case "End":
184
- L = !0;
318
+ D = !0;
185
319
  break;
186
320
  default:
187
321
  return null;
188
322
  }
189
- if (o) {
190
- let P = r;
191
- return m ? P = a : L ? P = l : P = Math.max(a, Math.min(l, r + f)), [P, P];
323
+ if (l) {
324
+ let S = r;
325
+ return g ? S = a : D ? S = i : S = Math.max(a, Math.min(i, r + f)), [S, S];
192
326
  }
193
- let M = r, u = n;
194
- return t === "low" ? m ? M = a : L ? M = n : M = Math.max(a, Math.min(n, r + f)) : m ? u = r : L ? u = l : u = Math.max(r, Math.min(l, n + f)), [M, u];
195
- }, aa = 8, oa = 2, ia = 16, ja = 12, Wa = 90, fn = (e, t) => {
196
- const r = t?.estimatedHeightPx ?? ia, a = aa + (t?.anchorGapY ?? oa) + r / 2, l = e === "top" ? -a : a;
327
+ let R = r, s = n;
328
+ return t === "low" ? g ? R = a : D ? R = n : R = Math.max(a, Math.min(n, r + f)) : g ? s = r : D ? s = i : s = Math.max(r, Math.min(i, n + f)), [R, s];
329
+ }, $o = 8, Eo = 2, Io = 16, Qi = 12, el = 90, Co = (e, t, r) => {
330
+ const n = r * Math.PI / 180, a = Math.abs(Math.sin(n)), i = Math.abs(Math.cos(n));
331
+ return { alongPx: (e * i + t * a) / 2, acrossPx: (e * a + t * i) / 2 };
332
+ }, ma = (e, t) => {
333
+ const r = t?.estimatedHeightPx ?? Io, a = $o + (t?.anchorGapY ?? Eo) + r / 2, i = e === "top" ? -a : a;
197
334
  return {
198
335
  lowAngleDeg: 0,
199
336
  highAngleDeg: 0,
200
337
  lowOffsetX: 0,
201
338
  highOffsetX: 0,
202
- lowOffsetY: l,
203
- highOffsetY: l,
339
+ lowOffsetY: i,
340
+ highOffsetY: i,
204
341
  isSlanted: !1,
205
342
  proximity: 0
206
343
  };
207
- }, la = (e, t, r, n = "top", a) => {
208
- const l = a?.estimatedWidthPx, o = a?.estimatedHeightPx ?? ia, s = a?.paddingPx ?? ja, f = a?.maxAngleDeg ?? Wa, m = aa + (a?.anchorGapY ?? oa), L = fn(n, a);
209
- if (!(Number.isFinite(r) && r > 0) || l === void 0 || !Number.isFinite(l) || l <= 0) return L;
210
- const M = Math.max(0, t - e) / 100 * r, u = l + s;
211
- if (M >= u) return L;
212
- const P = Math.max(0, Math.min(1, (u - M) / u)), J = P * P * P * (P * (P * 6 - 15) + 10) * f, x = n === "top" ? -J : J, le = J * Math.PI / 180, y = l / 2 * Math.abs(Math.sin(le)) + o / 2 * Math.abs(Math.cos(le)), j = m + y, D = n === "top" ? -j : +j, F = l * Math.abs(Math.cos(le)) + o * Math.abs(Math.sin(le)), A = Math.max(0, (F + s - M) / 2);
344
+ }, Vo = (e, t, r, n = "top", a) => {
345
+ const i = a?.estimatedWidthPx, l = a?.estimatedHeightPx ?? Io, c = a?.paddingPx ?? Qi, f = a?.maxAngleDeg ?? el, g = $o + (a?.anchorGapY ?? Eo), D = ma(n, a);
346
+ if (!(Number.isFinite(r) && r > 0) || i === void 0 || !Number.isFinite(i) || i <= 0) return D;
347
+ const R = Math.max(0, t - e) / 100 * r, s = i + c;
348
+ if (R >= s) return D;
349
+ const S = Math.max(0, Math.min(1, (s - R) / s)), ee = S * S * S * (S * (S * 6 - 15) + 10) * f, x = n === "top" ? -ee : ee, ue = Co(i, l, ee), ae = g + ue.acrossPx, $ = n === "top" ? -ae : +ae, H = 2 * ue.alongPx, W = Math.max(0, (H + c - R) / 2);
213
350
  return {
214
351
  lowAngleDeg: x,
215
352
  highAngleDeg: x,
216
- lowOffsetX: -A,
217
- highOffsetX: A,
218
- lowOffsetY: D,
219
- highOffsetY: D,
220
- isSlanted: P > 1e-3,
221
- proximity: P
353
+ lowOffsetX: -W,
354
+ highOffsetX: W,
355
+ lowOffsetY: $,
356
+ highOffsetY: $,
357
+ isSlanted: S > 1e-3,
358
+ proximity: S
222
359
  };
223
- }, sa = (e) => ({ ...e, lowOffsetX: 0, highOffsetX: 0 });
224
- function Ga(e, t, r, n, a, l, o = "macro-top", s = 0.05, f = !0, m = "range") {
225
- const L = o === "macro-top" || o === "macro-left", M = t <= 0;
226
- if (L && M || !(L || M)) {
227
- const E = Math.abs(e - r), J = Math.abs(e - n);
228
- return E <= s && E <= J ? "macro-low" : J <= s && J < E ? "macro-high" : f && e >= r && e <= n ? "macro-connect" : E < J ? "macro-low" : "macro-high";
360
+ }, No = (e) => ({ ...e, lowOffsetX: 0, highOffsetX: 0 }), ko = (e, t) => {
361
+ const r = t === "macro-top" || t === "macro-left", n = e < 0;
362
+ return r && n || !(r || n) ? "macro" : "micro";
363
+ }, tl = (e, t, r) => {
364
+ const n = Math.abs(e) > Math.abs(t) ? e : t;
365
+ return !Number.isFinite(n) || n === 0 ? 0 : (r ? n < 0 : n > 0) ? 1 : -1;
366
+ };
367
+ function rl(e, t, r, n, a, i, l = "macro-top", c = 0.05, f = !0, g = "range") {
368
+ if (ko(t, l) === "macro") {
369
+ const s = Math.abs(e - r), S = Math.abs(e - n);
370
+ return s <= c && s <= S ? "macro-low" : S <= c && S < s ? "macro-high" : f && e >= r && e <= n ? "macro-connect" : s < S ? "macro-low" : "macro-high";
229
371
  }
230
- if (m === "point")
372
+ if (g === "point")
231
373
  return "micro-point";
232
- const u = Math.abs(e - a), P = Math.abs(e - l);
233
- return u <= s && u <= P ? "micro-low" : P <= s && P < u ? "micro-high" : f && e >= a && e <= l ? "micro-connect" : u < P ? "micro-low" : "micro-high";
374
+ const D = Math.abs(e - a), R = Math.abs(e - i);
375
+ return D <= c && D <= R ? "micro-low" : R <= c && R < D ? "micro-high" : f && e >= a && e <= i ? "micro-connect" : D < R ? "micro-low" : "micro-high";
234
376
  }
235
- function Ja(e, t, r, n, a) {
377
+ function nl(e, t, r, n, a) {
236
378
  if (e === "macro-connect") {
237
- const o = t - r, s = a - n, f = Math.max(0, Math.min(1 - s, n + o)), m = f + s;
238
- return [f, m, "macro-connect"];
239
- }
240
- if (e === "macro-low") {
241
- const o = Math.max(0, Math.min(1, t));
242
- return o > a ? [a, o, "macro-high"] : [o, a, "macro-low"];
379
+ const [g, D] = ua(t - r, n, a);
380
+ return [g, D, "macro-connect"];
243
381
  }
244
- const l = Math.max(0, Math.min(1, t));
245
- return l < n ? [l, n, "macro-low"] : [n, l, "macro-high"];
382
+ const i = e === "macro-low" ? "low" : "high", [l, c] = hn(i, t, n, a), f = da(i, t, n, a);
383
+ return [l, c, f === "low" ? "macro-low" : "macro-high"];
246
384
  }
247
- function Za(e, t, r, n, a) {
385
+ function al(e, t, r, n, a) {
248
386
  if (e === "micro-point") {
249
- const o = Math.max(0, Math.min(1, t));
250
- return [o, o, "micro-point"];
387
+ const [g] = hn("point", t, n, a);
388
+ return [g, g, "micro-point"];
251
389
  }
252
390
  if (e === "micro-connect") {
253
- const o = t - r, s = a - n, f = Math.max(0, Math.min(1 - s, n + o)), m = f + s;
254
- return [f, m, "micro-connect"];
391
+ const [g, D] = ua(t - r, n, a);
392
+ return [g, D, "micro-connect"];
255
393
  }
256
- if (e === "micro-low") {
257
- const o = Math.max(0, Math.min(1, t));
258
- return o > a ? [a, o, "micro-high"] : [o, a, "micro-low"];
259
- }
260
- const l = Math.max(0, Math.min(1, t));
261
- return l < n ? [l, n, "micro-low"] : [n, l, "micro-high"];
394
+ const i = e === "micro-low" ? "low" : "high", [l, c] = hn(i, t, n, a), f = da(i, t, n, a);
395
+ return [l, c, f === "low" ? "micro-low" : "micro-high"];
262
396
  }
263
- const gr = br(({ type: e, isTop: t = !0, isVertical: r = !1, isLeft: n = !0 }) => {
264
- let a, l;
265
- return r ? (a = n ? "M 7.375 0.625 A 7.375 7.375 0 0 0 7.375 15.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 1 0.625 15.375 Z", l = `period-slider-knob period-slider-knob-svg is-vertical ${n ? "is-semicircle-left" : "is-semicircle-right"}`) : (a = t ? "M 0.625 7.375 A 7.375 7.375 0 0 1 15.375 7.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 0 15.375 0.625 Z", l = `period-slider-knob period-slider-knob-svg ${t ? "is-semicircle-top" : "is-semicircle-bottom"}`), /* @__PURE__ */ p("svg", { className: l, width: r ? "8" : "16", height: r ? "16" : "8", viewBox: r ? "0 0 8 16" : "0 0 16 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ p("path", { d: a, className: e === "macro" ? "period-slider-knob-path-macro" : "period-slider-knob-path-micro", shapeRendering: "geometricPrecision", strokeWidth: "1.25" }) });
397
+ const Yr = zr(({ type: e, isTop: t = !0, isVertical: r = !1, isLeft: n = !0 }) => {
398
+ let a, i;
399
+ return r ? (a = n ? "M 7.375 0.625 A 7.375 7.375 0 0 0 7.375 15.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 1 0.625 15.375 Z", i = `period-slider-knob period-slider-knob-svg is-vertical ${n ? "is-semicircle-left" : "is-semicircle-right"}`) : (a = t ? "M 0.625 7.375 A 7.375 7.375 0 0 1 15.375 7.375 Z" : "M 0.625 0.625 A 7.375 7.375 0 0 0 15.375 0.625 Z", i = `period-slider-knob period-slider-knob-svg ${t ? "is-semicircle-top" : "is-semicircle-bottom"}`), /* @__PURE__ */ I("svg", { className: i, width: r ? "8" : "16", height: r ? "16" : "8", viewBox: r ? "0 0 8 16" : "0 0 16 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ I("path", { d: a, className: e === "macro" ? "period-slider-knob-path-macro" : "period-slider-knob-path-micro", shapeRendering: "geometricPrecision", strokeWidth: "1.25" }) });
266
400
  });
267
- gr.displayName = "VernierKnobSvg";
268
- const Qa = (e, t) => {
269
- if (!wt(e)) throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${Le(e)})`);
270
- if (!wt(t)) throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${Le(t)})`);
401
+ Yr.displayName = "VernierKnobSvg";
402
+ const ol = (e, t) => {
403
+ if (!et(e)) throw new RangeError(`PeriodSlider: minDate is required and must be a valid Date (received: ${De(e)})`);
404
+ if (!et(t)) throw new RangeError(`PeriodSlider: maxDate is required and must be a valid Date (received: ${De(t)})`);
271
405
  if (t.getTime() <= e.getTime())
272
- throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${Le(e)}, maxDate: ${Le(t)})`);
273
- }, Ir = (e, t) => {
406
+ throw new RangeError(`PeriodSlider: maxDate must be strictly later than minDate (minDate: ${De(e)}, maxDate: ${De(t)})`);
407
+ }, _r = (e, t, r = "PeriodSlider") => {
274
408
  if (!Array.isArray(t) || t.length !== 2)
275
- throw new RangeError(`PeriodSlider: ${e} is required and must be a [start, end] Date tuple (received: ${Le(t)})`);
276
- const [r, n] = t;
277
- if (!wt(r)) throw new RangeError(`PeriodSlider: ${e}[0] must be a valid Date (received: ${Le(r)})`);
278
- if (!wt(n)) throw new RangeError(`PeriodSlider: ${e}[1] must be a valid Date (received: ${Le(n)})`);
279
- if (n.getTime() < r.getTime())
280
- throw new RangeError(`PeriodSlider: ${e} must not be inverted (start: ${Le(r)}, end: ${Le(n)})`);
281
- }, mn = (e, t) => {
282
- if (!wt(t)) throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${Le(t)})`);
283
- }, ln = (e, t, r, n) => {
284
- if (t.getTime() < r.getTime() || t.getTime() > n.getTime())
285
- throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${Le(t)}, minDate: ${Le(r)}, maxDate: ${Le(n)})`);
286
- }, eo = (e, t, r) => {
409
+ throw new RangeError(`${r}: ${e} is required and must be a [start, end] Date tuple (received: ${De(t)})`);
410
+ const [n, a] = t;
411
+ if (!et(n)) throw new RangeError(`${r}: ${e}[0] must be a valid Date (received: ${De(n)})`);
412
+ if (!et(a)) throw new RangeError(`${r}: ${e}[1] must be a valid Date (received: ${De(a)})`);
413
+ if (a.getTime() < n.getTime())
414
+ throw new RangeError(`${r}: ${e} must not be inverted (start: ${De(n)}, end: ${De(a)})`);
415
+ }, sa = (e, t) => {
416
+ if (!et(t)) throw new RangeError(`PeriodSlider: ${e} must be a valid Date (received: ${De(t)})`);
417
+ }, Mt = (e, t, r, n, a) => {
418
+ const i = Q(r, t);
419
+ if (i < Q(r, n) || i > Q(r, a))
420
+ throw new RangeError(`PeriodSlider: ${e} must lie within [minDate, maxDate] (received: ${De(t)}, minDate: ${De(n)}, maxDate: ${De(a)})`);
421
+ }, il = (e, t, r) => {
287
422
  if (e.mode === "range") {
288
423
  for (const n of ["range", "defaultRange"]) {
289
424
  const a = e[n];
290
- a !== void 0 && (Ir(n, a), ln(`${n}[0]`, a[0], t, r), ln(`${n}[1]`, a[1], t, r));
425
+ a !== void 0 && (_r(n, a), Mt(`${n}[0]`, a[0], e.unit, t, r), Mt(`${n}[1]`, a[1], e.unit, t, r));
291
426
  }
292
427
  return;
293
428
  }
294
429
  if (e.mode === "point")
295
430
  for (const n of ["value", "defaultValue"]) {
296
431
  const a = e[n];
297
- a !== void 0 && (mn(n, a), ln(n, a, t, r));
432
+ a !== void 0 && (sa(n, a), Mt(n, a, e.unit, t, r));
298
433
  }
299
- }, to = (e) => {
300
- Ir("macroRange", e.macroRange);
301
- const t = e.microRange !== void 0 || e.defaultMicroRange !== void 0 || e.onChangeMicroRange !== void 0, r = e.microValue !== void 0 || e.defaultMicroValue !== void 0 || e.onChangeMicroPoint !== void 0;
302
- if (t && r)
434
+ }, ll = (e, t, r) => {
435
+ _r("macroRange", e.macroRange);
436
+ const n = e.microUnit ?? e.unit, a = e.microRange !== void 0 || e.defaultMicroRange !== void 0 || e.onChangeMicroRange !== void 0, i = e.microValue !== void 0 || e.defaultMicroValue !== void 0 || e.onChangeMicroPoint !== void 0;
437
+ if (a && i)
303
438
  throw new RangeError("PeriodSlider: vernier mode takes either a micro range (microRange / defaultMicroRange / onChangeMicroRange) or a micro point (microValue / defaultMicroValue / onChangeMicroPoint), never both");
304
- if (r) {
439
+ if (i) {
305
440
  if (e.microValue !== void 0)
306
- return mn("microValue", e.microValue), { shape: "point", selection: [e.microValue, e.microValue] };
441
+ return sa("microValue", e.microValue), Mt("microValue", e.microValue, n, t, r), { shape: "point", selection: [e.microValue, e.microValue] };
307
442
  if (e.defaultMicroValue !== void 0)
308
- return mn("defaultMicroValue", e.defaultMicroValue), { shape: "point", selection: [e.defaultMicroValue, e.defaultMicroValue] };
443
+ return sa("defaultMicroValue", e.defaultMicroValue), Mt("defaultMicroValue", e.defaultMicroValue, n, t, r), { shape: "point", selection: [e.defaultMicroValue, e.defaultMicroValue] };
309
444
  throw new RangeError("PeriodSlider: vernier point mode requires a micro selection; supply microValue (controlled) or defaultMicroValue (uncontrolled)");
310
445
  }
311
446
  if (e.microRange !== void 0)
312
- return Ir("microRange", e.microRange), { shape: "range", selection: e.microRange };
447
+ return _r("microRange", e.microRange), Mt("microRange[0]", e.microRange[0], n, t, r), Mt("microRange[1]", e.microRange[1], n, t, r), { shape: "range", selection: e.microRange };
313
448
  if (e.defaultMicroRange !== void 0)
314
- return Ir("defaultMicroRange", e.defaultMicroRange), { shape: "range", selection: e.defaultMicroRange };
315
- throw t ? new RangeError("PeriodSlider: vernier range mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)") : new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange / defaultMicroRange for a period, or microValue / defaultMicroValue for a point");
316
- }, mr = (e, t, r, n, a, l, o, s) => {
317
- const f = Ae(e, n, t), m = Ae(e, a, t);
318
- return o ? f : s ? m : Math.max(f, Math.min(m, Ae(e, r, t) + l));
319
- }, sn = (e) => {
449
+ return _r("defaultMicroRange", e.defaultMicroRange), Mt("defaultMicroRange[0]", e.defaultMicroRange[0], n, t, r), Mt("defaultMicroRange[1]", e.defaultMicroRange[1], n, t, r), { shape: "range", selection: e.defaultMicroRange };
450
+ throw a ? new RangeError("PeriodSlider: vernier range mode requires a micro selection; supply microRange (controlled) or defaultMicroRange (uncontrolled)") : new RangeError("PeriodSlider: vernier mode requires a micro selection; supply microRange / defaultMicroRange for a period, or microValue / defaultMicroValue for a point");
451
+ }, Nr = (e, t, r, n, a, i, l, c) => {
452
+ const f = be(e, n, t), g = be(e, a, t);
453
+ return l ? f : c ? g : Math.max(f, Math.min(g, be(e, r, t) + i));
454
+ }, na = (e) => {
320
455
  e.timerId !== null && clearTimeout(e.timerId), e.timerId = null, e.emit = null;
321
- }, ro = (e, t) => {
456
+ }, sl = (e, t) => {
322
457
  try {
323
458
  Intl.DateTimeFormat.supportedLocalesOf([t]);
324
459
  } catch {
325
460
  throw new RangeError(`PeriodSlider: ${e} must be a valid BCP 47 language tag (received: ${JSON.stringify(t)})`);
326
461
  }
327
- }, Wt = () => {
328
- const [e, t] = Te(null), r = G(null), n = B((a) => {
462
+ }, mr = () => {
463
+ const [e, t] = ye(null), r = O(null), n = U((a) => {
329
464
  if (r.current?.disconnect(), r.current = null, a === null) {
330
465
  t(null);
331
466
  return;
332
467
  }
333
468
  if (typeof ResizeObserver > "u") return;
334
- const l = new ResizeObserver((o) => {
335
- for (const s of o) {
336
- const f = s.borderBoxSize?.[0];
337
- f !== void 0 && t((m) => m !== null && Math.abs(m.widthPx - f.inlineSize) < 0.5 && Math.abs(m.heightPx - f.blockSize) < 0.5 ? m : { widthPx: f.inlineSize, heightPx: f.blockSize });
469
+ const i = new ResizeObserver((l) => {
470
+ for (const c of l) {
471
+ const f = c.borderBoxSize?.[0];
472
+ f !== void 0 && t((g) => g !== null && Math.abs(g.widthPx - f.inlineSize) < 0.5 && Math.abs(g.heightPx - f.blockSize) < 0.5 ? g : { widthPx: f.inlineSize, heightPx: f.blockSize });
338
473
  }
339
474
  });
340
- l.observe(a), r.current = l;
475
+ i.observe(a), r.current = i;
341
476
  }, []);
342
- return Yt(
477
+ return Dt(
343
478
  () => () => {
344
479
  r.current?.disconnect(), r.current = null;
345
480
  },
346
481
  []
347
482
  ), [n, e];
348
- }, cn = (e, t) => {
349
- if (!(e === null || t === null))
350
- return { estimatedWidthPx: Math.max(e.widthPx, t.widthPx), estimatedHeightPx: Math.max(e.heightPx, t.heightPx) };
351
- }, jn = (e, t, r) => ({
352
- "--ps-tooltip-tx": `calc(-50% + ${e}px)`,
353
- "--ps-tooltip-ty": `${t}px`,
354
- "--ps-tooltip-rot": `${r}deg`
355
- }), Wn = (e, t, r, n, a, l, o) => {
356
- const s = fn(n, a);
357
- if (!o) return { slant: s, lowStyle: void 0, highStyle: void 0 };
358
- const f = la(e * 100, t * 100, r, n, a), m = l ? sa(f) : f;
483
+ }, aa = (e, t) => {
484
+ const r = fn(e, t);
485
+ return r === null ? void 0 : { estimatedWidthPx: r.widthPx, estimatedHeightPx: r.heightPx };
486
+ }, fn = (e, t) => e === null || t === null ? null : { widthPx: Math.max(e.widthPx, t.widthPx), heightPx: Math.max(e.heightPx, t.heightPx) }, cl = (e) => {
487
+ const t = {};
488
+ let r = 0;
489
+ for (const a of e) {
490
+ const { side: i, box: l } = a;
491
+ if (l === null) continue;
492
+ let c;
493
+ if (a.reach === "inline-size")
494
+ c = l.widthPx, r = Math.max(r, l.heightPx / 2);
495
+ else {
496
+ const f = Co(l.widthPx, l.heightPx, a.angleDeg);
497
+ c = a.centreOffsetPx === null ? 2 * f.acrossPx : Math.abs(a.centreOffsetPx) + f.acrossPx, r = Math.max(r, f.alongPx + Math.abs(a.alongPushPx));
498
+ }
499
+ t[`--ps-label-reach-${i}`] = `${Math.ceil(c)}px`;
500
+ }
501
+ if (Object.keys(t).length === 0) return;
502
+ const n = Math.ceil(r);
503
+ return t["--ps-label-reach-main"] = `${n}px`, { style: t, mainPx: n };
504
+ }, mo = (e, t, r) => ({
505
+ tx: `calc(-50% + ${e}px)`,
506
+ ty: `${t}px`,
507
+ rot: `${r}deg`
508
+ }), fo = (e, t, r) => ({
509
+ tx: `calc(-50% + ${e}px)`,
510
+ ty: `calc(-50% + ${t}px)`,
511
+ rot: `${r}deg`
512
+ }), bn = (e, t) => ({
513
+ "--ps-tooltip-tx": Jn(e, "tx", t.tx),
514
+ "--ps-tooltip-ty": Jn(e, "ty", t.ty),
515
+ "--ps-tooltip-rot": Jn(e, "rot", t.rot)
516
+ }), oa = (e, t, r, n) => {
517
+ const a = ma(n.labelPosition, n.config);
518
+ if (!n.isSlantable) return { slant: a, lowStyle: void 0, highStyle: void 0, placements: null };
519
+ const i = Vo(t * 100, r * 100, n.trackLengthPx, n.labelPosition, n.config), l = n.isMerged ? No(i) : i, c = xn[e], f = {
520
+ low: mo(l.lowOffsetX, l.lowOffsetY - a.lowOffsetY, l.lowAngleDeg),
521
+ high: mo(l.highOffsetX, l.highOffsetY - a.highOffsetY, l.highAngleDeg)
522
+ };
359
523
  return {
360
- slant: m,
361
- lowStyle: jn(m.lowOffsetX, m.lowOffsetY - s.lowOffsetY, m.lowAngleDeg),
362
- highStyle: jn(m.highOffsetX, m.highOffsetY - s.highOffsetY, m.highAngleDeg)
524
+ slant: l,
525
+ lowStyle: bn(c.low, f.low),
526
+ highStyle: bn(c.high, f.high),
527
+ placements: f
363
528
  };
364
- }, no = {
365
- horizontal: { decrease: "◀", increase: "▶" },
366
- vertical: { decrease: "▼", increase: "▲" }
367
- }, ao = {
529
+ }, go = {
530
+ "--ps-tooltip-origin": "100% 50%",
531
+ "--ps-tooltip-tx": "0px",
532
+ "--ps-tooltip-ty": "-50%",
533
+ "--ps-tooltip-rot": "0deg"
534
+ }, ho = (e, t, r) => {
535
+ const n = ma(r.labelPosition, r.config);
536
+ if (r.isVertical) return { slant: n, lowStyle: go, highStyle: go, placements: null };
537
+ const a = r.autoSlantLabels && !r.isPointMode;
538
+ let i = n;
539
+ if (a) {
540
+ const f = Vo(e, t, r.trackLengthPx, r.labelPosition, r.config);
541
+ i = r.isMerged ? No(f) : f;
542
+ }
543
+ const l = xn.flat, c = {
544
+ low: fo(i.lowOffsetX, i.lowOffsetY, i.lowAngleDeg),
545
+ high: fo(i.highOffsetX, i.highOffsetY, i.highAngleDeg)
546
+ };
547
+ return {
548
+ slant: i,
549
+ lowStyle: { "--ps-tooltip-origin": "50% 50%", ...bn(l.low, c.low) },
550
+ highStyle: { "--ps-tooltip-origin": "50% 50%", ...bn(l.high, c.high) },
551
+ placements: a ? c : null
552
+ };
553
+ }, ul = {
554
+ horizontal: { decrease: "left", increase: "right" },
555
+ vertical: { decrease: "down", increase: "up" }
556
+ }, dl = {
368
557
  horizontal: { decrease: "period-slider-stepper-prev", increase: "period-slider-stepper-next" },
369
558
  vertical: { decrease: "period-slider-stepper-prev period-slider-stepper-down", increase: "period-slider-stepper-next period-slider-stepper-up" }
370
- }, oo = (e) => {
559
+ }, bo = { horizontal: "px-[calc(var(--ps-target-size)/2)]", vertical: "py-[calc(var(--ps-target-size)/2)]" }, ml = {
560
+ horizontal: { withSteppers: `grid-cols-[auto_minmax(0,1fr)_auto] ${Fr} ${lo.horizontal}`, railOnly: `grid-cols-[minmax(0,1fr)] ${bo.horizontal}` },
561
+ vertical: { withSteppers: `grid-rows-[auto_minmax(0,1fr)_auto] ${Fr} ${lo.vertical}`, railOnly: `grid-rows-[minmax(0,1fr)] ${bo.vertical}` }
562
+ }, wo = {
563
+ horizontal: { leading: "col-start-1 row-start-1", rail: "col-start-2 row-start-1", railOnly: "col-start-1 row-start-1", trailing: "col-start-3 row-start-1" },
564
+ vertical: { leading: "col-start-1 row-start-1", rail: "col-start-1 row-start-2", railOnly: "col-start-1 row-start-1", trailing: "col-start-1 row-start-3" }
565
+ }, vo = (e, t) => {
566
+ e.setPointerCapture(t);
567
+ }, fl = (e) => {
371
568
  const {
372
569
  unit: t,
373
570
  minDate: r,
374
571
  maxDate: n,
375
572
  allowedDates: a,
376
- snapMode: l = "index",
377
- disabled: o = !1,
378
- className: s = "",
573
+ snapMode: i = "index",
574
+ disabled: l = !1,
575
+ className: c = "",
379
576
  showStepper: f = !0,
380
- tooltipStyle: m = "always",
381
- labelPosition: L = "top",
382
- autoSlantLabels: M = !0,
383
- isVertical: u = !1,
384
- hideConnectBar: P = !1,
385
- showTicks: E = !1,
386
- colorScheme: J = "blue-rose",
577
+ tooltipStyle: g = "always",
578
+ labelPosition: D = "top",
579
+ autoSlantLabels: R = !0,
580
+ isVertical: s = !1,
581
+ hideConnectBar: S = !1,
582
+ showTicks: Z = !1,
583
+ colorScheme: ee = "blue-rose",
387
584
  locale: x,
388
- decreaseAriaLabel: le = "Decrease",
389
- increaseAriaLabel: y = "Increase"
585
+ decreaseAriaLabel: ue = "Decrease",
586
+ increaseAriaLabel: ae = "Increase"
390
587
  } = e;
391
- Qa(r, n), eo(e, r, n), x !== void 0 && ro("locale", x);
392
- const j = e.mode === "vernier" ? to(e) : null, D = j !== null && j.shape === "point", F = Ua[J], A = Fa(), C = G(e);
393
- C.current = e;
394
- const V = r.getTime(), O = n.getTime(), v = T(() => Zt(a, t, r, n), [a, t, V, O]), $ = v.length > 0, { rangeMin: R, rangeMax: w } = T(() => $ ? { rangeMin: 0, rangeMax: v.length - 1 } : { rangeMin: oe(t, r), rangeMax: oe(t, n) }, [$, v, t, V, O]), K = e.mode === "point", re = B(
395
- (i) => {
396
- if ($) {
397
- const c = Math.max(0, Math.min(v.length - 1, Math.round(i)));
398
- return v[c];
588
+ ol(r, n), il(e, r, n), x !== void 0 && sl("locale", x);
589
+ const $ = e.mode === "vernier" ? ll(e, r, n) : null, H = $ !== null && $.shape === "point", W = Wi[ee], oe = Ti(), q = O(e), X = r.getTime(), y = n.getTime(), L = C(() => Vt(a, t, r, n), [a, t, X, y]), T = L.length > 0, { rangeMin: k, rangeMax: V } = C(() => T ? { rangeMin: 0, rangeMax: L.length - 1 } : { rangeMin: Q(t, r), rangeMax: Q(t, n) }, [T, L, t, X, y]), ne = e.mode === "point", ce = U(
590
+ (o) => {
591
+ if (T) {
592
+ const u = Math.max(0, Math.min(L.length - 1, Math.round(o)));
593
+ return L[u];
399
594
  }
400
- return ge(t, Math.round(i));
595
+ return ie(t, Math.round(o));
401
596
  },
402
- [$, v, t]
403
- ), Z = B(
404
- (i) => {
405
- if (i === void 0) return R;
406
- const c = ut(t, i);
407
- return $ ? Ae(v, c, t) : oe(t, c);
597
+ [T, L, t]
598
+ ), G = U(
599
+ (o) => {
600
+ if (o === void 0) return k;
601
+ const u = je(t, o);
602
+ return T ? be(L, u, t) : Q(t, u);
408
603
  },
409
- [$, v, t, R]
410
- ), [me, De] = Te(() => j === null ? null : j.selection);
411
- let se = me ?? (j === null ? null : j.selection);
412
- if (D && se !== null && se[0].getTime() !== se[1].getTime()) {
413
- const i = [se[0], se[0]];
414
- se = i, De(i);
604
+ [T, L, t, k]
605
+ ), [J, z] = ye(() => $ === null ? null : $.selection);
606
+ let _ = J ?? ($ === null ? null : $.selection);
607
+ if (H && _ !== null && _[0].getTime() !== _[1].getTime()) {
608
+ const o = [_[0], _[0]];
609
+ _ = o, z(o);
415
610
  }
416
- const ne = e.mode === "vernier" ? e.microValue?.getTime() : void 0, te = T(() => e.mode !== "vernier" || e.microValue === void 0 ? null : [e.microValue, e.microValue], [e.mode, ne]), Me = e.mode !== "vernier" ? null : D ? te ?? se : e.microRange !== void 0 ? e.microRange : se, We = e.mode === "range" ? e.range?.[0] ?? e.defaultRange?.[0] : e.mode === "vernier" ? Me?.[0] : void 0, q = e.mode === "range" ? e.range?.[1] ?? e.defaultRange?.[1] : e.mode === "vernier" ? Me?.[1] : void 0, Q = e.mode === "point" ? e.value ?? e.defaultValue : void 0, ce = e.mode === "point" ? Q?.getTime() : We?.getTime(), k = e.mode === "range" ? q?.getTime() : ce, [z, ue] = T(() => {
611
+ const me = e.mode === "vernier" ? e.microValue?.getTime() : void 0, ge = C(() => e.mode !== "vernier" || e.microValue === void 0 ? null : [e.microValue, e.microValue], [e.mode, me]), le = e.mode !== "vernier" ? null : H ? ge ?? _ : e.microRange !== void 0 ? e.microRange : _, ze = e.mode === "range" ? e.range?.[0] ?? e.defaultRange?.[0] : e.mode === "vernier" ? le?.[0] : void 0, Ee = e.mode === "range" ? e.range?.[1] ?? e.defaultRange?.[1] : e.mode === "vernier" ? le?.[1] : void 0, Te = e.mode === "point" ? e.value ?? e.defaultValue : void 0, Pe = e.mode === "point" ? Te?.getTime() : ze?.getTime(), qe = e.mode === "range" ? Ee?.getTime() : Pe, [Be, tt] = C(() => {
417
612
  if (e.mode === "point") {
418
- const d = Z(Q);
613
+ const d = G(Te);
419
614
  return [d, d];
420
615
  }
421
- const i = Z(We), c = Z(q);
422
- return [Math.min(i, c), Math.max(i, c)];
423
- }, [e.mode, ce, k, Z, Q, We, q]), be = e.mode === "point" ? e.value !== void 0 : e.mode === "range" ? e.range !== void 0 : D ? e.microValue !== void 0 : e.microRange !== void 0, [$e, Xe] = Te(() => [z, ue]), [Ge, at] = Te(null), [ie, Re] = Te(null), Ve = G(null);
424
- Ve.current = ie;
425
- const [kt, W] = Te("high"), [de, Mt] = Te(null), [ot, mt] = Te(null), he = Ge ? Ge[0] : be ? z : $e[0], ve = Ge ? Ge[1] : be ? ue : $e[1], er = G([he, ve]);
426
- er.current = [he, ve];
427
- const fe = e.mode === "vernier", At = e.mode === "vernier" ? e.vernierOrientation ?? (u ? "macro-left" : "macro-top") : "macro-top", Y = At === "macro-top" || At === "macro-left", Xr = e.mode === "vernier" ? e.showVernierProjection ?? !0 : !1, Kr = e.mode === "vernier" ? e.showVernierTicks ?? !0 : !1, ft = e.mode === "vernier" ? e.showHairline ?? !0 : !1, U = fe ? e.macroUnit ?? t : t, b = fe ? e.microUnit ?? t : t, g = fe ? e.macroIsDiscrete ?? !1 : $, I = fe ? e.microIsDiscrete ?? !1 : $, He = fe ? e.macroAllowedDates ?? a : a, Ct = fe ? e.microAllowedDates ?? a : a, it = fe ? e.formatMacroLabel ?? e.formatLabel : e.formatLabel, Je = fe ? e.formatMicroLabel ?? e.formatLabel : e.formatLabel, gn = e.mode === "vernier" ? e.macroRange[0].getTime() : void 0, hn = e.mode === "vernier" ? e.macroRange[1].getTime() : void 0, ca = We?.getTime(), ua = q?.getTime(), [Oe, wr] = Te(null), vt = G(null);
428
- vt.current = Oe;
429
- const [tr, Et] = Te(() => D ? "micro-point" : "micro-high");
430
- let Ne = tr;
431
- const qr = D ? tr === "micro-low" || tr === "micro-high" || tr === "micro-connect" ? "micro-point" : null : tr === "micro-point" ? "micro-high" : null;
432
- qr !== null && (Ne = qr, Et(qr));
433
- const Ke = T(() => oe(U, r), [V, U]), Vt = T(() => {
434
- const i = oe(U, n);
435
- if (fe && i <= Ke)
436
- throw new RangeError(`PeriodSlider: macroUnit "${U}" cannot distinguish minDate from maxDate (minDate: ${Le(r)}, maxDate: ${Le(n)})`);
437
- return i;
438
- }, [fe, V, O, Ke, U]), Ye = T(() => fe ? Zt(He, U, r, n) : [], [fe, He, U, V, O]), Fe = T(() => e.mode !== "vernier" ? Ke : oe(U, e.macroRange[0]), [e.mode, gn, Ke, U]), Ue = T(() => e.mode !== "vernier" ? Vt : oe(U, e.macroRange[1]), [e.mode, hn, Vt, U]), Mr = T(() => ge(U, Fe), [U, Fe]), vr = T(() => ge(U, Ue), [U, Ue]), Pe = T(() => e.mode !== "vernier" ? oe(b, r) : Math.max(oe(b, e.macroRange[0]), oe(b, r)), [e.mode, gn, b, V]), Be = T(() => e.mode !== "vernier" ? oe(b, n) : Math.min(oe(b, et(U, b, e.macroRange[1])), oe(b, n)), [e.mode, hn, U, b, O]), ae = T(() => fe ? Zt(Ct, b, r, n).filter((c) => {
439
- const d = oe(b, c);
440
- return d >= Pe && d <= Be;
441
- }) : [], [fe, Ct, b, V, O, Pe, Be]), It = g && Ye.length > 0, tt = I && ae.length > 0, pe = T(() => Me === null ? Pe : oe(b, Me[0]), [ca, Pe, b, Me]), Se = T(() => Me === null ? Be : oe(b, Me[1]), [ua, Be, b, Me]), Dt = T(() => ge(b, pe), [b, pe]), pt = T(() => ge(b, Se), [b, Se]), rr = Math.max(1, Vt - Ke), ke = It ? kr(Ye, U, l, Mr) : Math.max(0, Math.min(1, (Fe - Ke) / rr)), ze = Math.max(ke, It ? kr(Ye, U, l, vr) : Math.min(1, (Ue - Ke) / rr)), nr = Math.max(1, Be - Pe), Ze = tt ? kr(ae, b, l, Dt) : Math.max(0, Math.min(1, (pe - Pe) / nr)), gt = Math.max(Ze, tt ? kr(ae, b, l, pt) : Math.min(1, (Se - Pe) / nr)), jr = G({ timerId: null, emit: null }), Wr = G({ timerId: null, emit: null }), Gr = G({ timerId: null, emit: null });
442
- Yt(() => {
443
- const i = [jr, Wr, Gr];
616
+ const o = G(ze), u = G(Ee);
617
+ return [Math.min(o, u), Math.max(o, u)];
618
+ }, [e.mode, Pe, qe, G, Te, ze, Ee]), Ue = e.mode === "point" ? e.value !== void 0 : e.mode === "range" ? e.range !== void 0 : H ? e.microValue !== void 0 : e.microRange !== void 0, [it, K] = ye(() => [Be, tt]), [B, te] = ye(null), [v, Y] = ye(null), p = O(null), [j, de] = ye("high"), [we, Ae] = ye(null), [He, rt] = ye(null), ve = B ? B[0] : Ue ? Be : it[0], pe = B ? B[1] : Ue ? tt : it[1], Br = O([ve, pe]), fe = e.mode === "vernier", Nt = e.mode === "vernier" ? e.vernierOrientation ?? (s ? "macro-left" : "macro-top") : "macro-top", A = Nt === "macro-top" || Nt === "macro-left", Wt = e.mode === "vernier" ? e.showVernierProjection ?? !0 : !1, fa = e.mode === "vernier" ? e.showVernierTicks ?? !0 : !1, w = e.mode === "vernier" ? e.showHairline ?? !0 : !1, h = fe ? e.macroUnit ?? t : t, b = fe ? e.microUnit ?? t : t, wr = fe ? e.macroIsDiscrete ?? !1 : T, ht = fe ? e.microIsDiscrete ?? !1 : T, lt = fe ? e.macroAllowedDates ?? a : a, ga = fe ? e.microAllowedDates ?? a : a, Ur = fe ? e.formatMacroLabel ?? e.formatLabel : e.formatLabel, Wr = fe ? e.formatMicroLabel ?? e.formatLabel : e.formatLabel, Yo = e.mode === "vernier" ? e.macroRange[0].getTime() : void 0, Oo = e.mode === "vernier" ? e.macroRange[1].getTime() : void 0, Ho = ze?.getTime(), _o = Ee?.getTime(), [We, Xr] = ye(null), Rt = O(null), [vr, Xt] = ye(() => H ? "micro-point" : "micro-high");
619
+ let Ne = vr;
620
+ const Sn = H ? vr === "micro-low" || vr === "micro-high" || vr === "micro-connect" ? "micro-point" : null : vr === "micro-point" ? "micro-high" : null;
621
+ Sn !== null && (Ne = Sn, Xt(Sn));
622
+ const Ie = C(() => Q(h, r), [X, h]), Ze = C(() => {
623
+ const o = Q(h, n);
624
+ if (fe && o <= Ie)
625
+ throw new RangeError(`PeriodSlider: macroUnit "${h}" cannot distinguish minDate from maxDate (minDate: ${De(r)}, maxDate: ${De(n)})`);
626
+ return o;
627
+ }, [fe, X, y, Ie, h]), Le = C(() => fe ? Vt(lt, h, r, n) : [], [fe, lt, h, X, y]), ke = C(() => e.mode !== "vernier" ? Ie : Math.max(Ie, Math.min(Ze, Q(h, e.macroRange[0]))), [e.mode, Yo, Ie, Ze, h]), Ye = C(() => e.mode !== "vernier" ? Ze : Math.max(Ie, Math.min(Ze, Q(h, e.macroRange[1]))), [e.mode, Oo, Ie, Ze, h]), bt = C(() => ie(h, ke), [h, ke]), kt = C(() => ie(h, Ye), [h, Ye]), Gr = C(() => e.mode !== "vernier" ? [r, n] : xt(h, b, [bt, kt], r, n), [e.mode, bt, kt, h, b, X, y]), xe = C(() => Q(b, Gr[0]), [b, Gr]), $e = C(() => Q(b, Gr[1]), [b, Gr]), ha = C(() => fe ? Vt(ga, b, r, n) : [], [fe, ga, b, X, y]), yn = (o, u) => ha.filter((d) => {
628
+ const m = Q(b, d);
629
+ return m >= o && m <= u;
630
+ }), se = C(() => yn(xe, $e), [ha, b, xe, $e]), Gt = wr && Le.length > 0, nt = ht && se.length > 0, Lt = (o, u, d, m) => u.length > 0 ? Q(b, u[be(u, o, b)]) : Math.max(d, Math.min(m, Q(b, o))), Kt = nt ? se : [], Ce = C(() => le === null ? xe : Lt(le[0], Kt, xe, $e), [Ho, xe, $e, b, le, Kt]), _e = C(() => le === null ? $e : Lt(le[1], Kt, xe, $e), [_o, xe, $e, b, le, Kt]), St = C(() => ie(b, Ce), [b, Ce]), yt = C(() => ie(b, _e), [b, _e]), ba = !fe || le === null ? null : { macroUnit: h, macroLowEnc: ke, macroHighEnc: Ye, microUnit: b, microLowEnc: Q(b, le[0]), microHighEnc: Q(b, le[1]) }, Tn = O(ba), Kr = Math.max(1, Ze - Ie), at = Gt ? cn(Le, h, i, bt) : Math.max(0, Math.min(1, (ke - Ie) / Kr)), st = Math.max(at, Gt ? cn(Le, h, i, kt) : Math.min(1, (Ye - Ie) / Kr)), jr = Math.max(1, $e - xe), jt = nt ? cn(se, b, i, St) : Math.max(0, Math.min(1, (Ce - xe) / jr)), pr = Math.max(jt, nt ? cn(se, b, i, yt) : Math.min(1, (_e - xe) / jr)), Pn = O({ timerId: null, emit: null }), qr = O({ timerId: null, emit: null }), Zr = O({ timerId: null, emit: null });
631
+ Dt(() => {
632
+ const o = [Pn, qr, Zr];
444
633
  return () => {
445
- for (const c of i)
446
- sn(c.current);
634
+ for (const u of o)
635
+ na(u.current);
447
636
  };
448
637
  }, []);
449
- const Ht = B((i, c, d) => {
450
- sn(i);
451
- const { debounceMs: h } = C.current;
452
- if (d || !h || h <= 0) {
453
- c();
638
+ const qt = U((o, u, d) => {
639
+ na(o);
640
+ const { debounceMs: m } = q.current;
641
+ if (d || !m || m <= 0) {
642
+ u();
454
643
  return;
455
644
  }
456
- i.emit = c, i.timerId = setTimeout(() => {
457
- i.timerId = null, i.emit = null, c();
458
- }, h);
459
- }, []), Jr = B((i) => {
460
- const c = i.emit;
461
- sn(i), c?.();
462
- }, []), Ot = B((i) => new Date(Math.min(Math.max(i.getTime(), V), O)), [V, O]), lt = B(
463
- (i, c, d = !1) => {
464
- const [h, S] = er.current;
465
- if ((C.current.mode === "point" ? i === h : i === h && c === S) && jr.current.timerId === null)
645
+ o.emit = u, o.timerId = setTimeout(() => {
646
+ o.timerId = null, o.emit = null, u();
647
+ }, m);
648
+ }, []), wa = U((o) => {
649
+ const u = o.emit;
650
+ na(o), u?.();
651
+ }, []), Zt = U((o) => new Date(Math.min(Math.max(o.getTime(), X), y)), [X, y]), Tt = U(
652
+ (o, u, d = !1) => {
653
+ const [m, M] = Br.current;
654
+ if ((q.current.mode === "point" ? o === m : o === m && u === M) && Pn.current.timerId === null)
466
655
  return;
467
- const X = re(i), H = re(c), ee = () => {
468
- const N = C.current;
469
- N.mode === "point" ? N.onChangePoint?.(X) : N.mode === "range" && N.onChangeRange?.(X, H);
656
+ const N = ce(o), E = ce(u), re = () => {
657
+ const he = q.current;
658
+ he.mode === "point" ? he.onChangePoint?.(N) : he.mode === "range" && he.onChangeRange?.(N, E);
470
659
  };
471
- Ht(jr.current, ee, d);
660
+ qt(Pn.current, re, d);
472
661
  },
473
- [re, Ht]
474
- ), Ft = B(
475
- (i, c, d = !1) => {
476
- if (C.current.mode !== "vernier") return;
477
- const h = Ot(i), S = Ot(c);
478
- Ht(
479
- Wr.current,
662
+ [ce, qt]
663
+ ), Yt = U(
664
+ (o, u, d = !1) => {
665
+ const m = Tn.current;
666
+ if (q.current.mode !== "vernier" || m === null) return;
667
+ const M = Zt(o), P = Zt(u);
668
+ Q(m.macroUnit, M) === m.macroLowEnc && Q(m.macroUnit, P) === m.macroHighEnc && qr.current.timerId === null || qt(
669
+ qr.current,
480
670
  () => {
481
- const _ = C.current;
482
- _.mode === "vernier" && _.onChangeMacroRange?.(h, S);
671
+ const N = q.current;
672
+ N.mode === "vernier" && N.onChangeMacroRange?.(M, P);
483
673
  },
484
674
  d
485
675
  );
486
676
  },
487
- [Ot, Ht]
488
- ), qe = B(
489
- (i, c, d = !1) => {
490
- const h = C.current;
491
- if (h.mode !== "vernier") return;
492
- const S = Ot(i), _ = Ot(c);
493
- (D ? h.microValue === void 0 : h.microRange === void 0) && De([S, _]), Ht(
494
- Gr.current,
677
+ [Zt, qt]
678
+ ), Je = U(
679
+ (o, u, d = !1) => {
680
+ const m = q.current, M = Tn.current;
681
+ if (m.mode !== "vernier" || M === null) return;
682
+ const P = Zt(o), N = Zt(u);
683
+ Q(M.microUnit, P) === M.microLowEnc && Q(M.microUnit, N) === M.microHighEnc && Zr.current.timerId === null || ((H ? m.microValue === void 0 : m.microRange === void 0) && z([P, N]), qt(
684
+ Zr.current,
495
685
  () => {
496
- const X = C.current;
497
- if (X.mode === "vernier") {
498
- if (D) {
499
- X.onChangeMicroPoint?.(S);
686
+ const E = q.current;
687
+ if (E.mode === "vernier") {
688
+ if (H) {
689
+ E.onChangeMicroPoint?.(P);
500
690
  return;
501
691
  }
502
- X.onChangeMicroRange?.(S, _);
692
+ E.onChangeMicroRange?.(P, N);
503
693
  }
504
694
  },
505
695
  d
506
- );
696
+ ));
507
697
  },
508
- [Ot, Ht, D]
509
- ), bn = B(
510
- (i, c = !1) => {
511
- qe(i, i, c);
698
+ [Zt, qt, H]
699
+ ), va = U(
700
+ (o, u = !1) => {
701
+ Je(o, o, u);
512
702
  },
513
- [qe]
514
- ), Dr = B(
515
- (i) => {
516
- if ($ && l === "time" && v.length > 1) {
517
- const h = Math.max(0, Math.min(v.length - 1, Math.round(i))), S = v[0].getTime(), X = v[v.length - 1].getTime() - S;
518
- if (X <= 0) return 0;
519
- const H = v[h].getTime();
520
- return Math.max(0, Math.min(100, (H - S) / X * 100));
703
+ [Je]
704
+ ), Ot = U(
705
+ (o) => {
706
+ if (T && i === "time" && L.length > 1) {
707
+ const m = Math.max(0, Math.min(L.length - 1, Math.round(o))), M = L[0].getTime(), N = L[L.length - 1].getTime() - M;
708
+ if (N <= 0) return 0;
709
+ const E = L[m].getTime();
710
+ return Math.max(0, Math.min(100, (E - M) / N * 100));
521
711
  }
522
- const c = w - R;
523
- if (c <= 0) return 0;
524
- const d = (i - R) / c * 100;
712
+ const u = V - k;
713
+ if (u <= 0) return 0;
714
+ const d = (o - k) / u * 100;
525
715
  return Math.max(0, Math.min(100, d));
526
716
  },
527
- [$, l, v, R, w]
528
- ), pr = B(
529
- (i) => {
530
- const c = Math.max(0, Math.min(100, i));
531
- if ($) {
532
- if (l === "time" && v.length > 1) {
533
- const S = v[0].getTime(), X = v[v.length - 1].getTime() - S, H = S + c / 100 * X;
534
- return Ae(v, new Date(H), t);
717
+ [T, i, L, k, V]
718
+ ), An = U(
719
+ (o) => {
720
+ const u = Math.max(0, Math.min(100, o));
721
+ if (T) {
722
+ if (i === "time" && L.length > 1) {
723
+ const M = L[0].getTime(), N = L[L.length - 1].getTime() - M, E = M + u / 100 * N;
724
+ return be(L, new Date(E), t);
535
725
  }
536
- const h = Math.round(c / 100 * (v.length - 1));
537
- return Math.max(0, Math.min(v.length - 1, h));
726
+ const m = Math.round(u / 100 * (L.length - 1));
727
+ return Math.max(0, Math.min(L.length - 1, m));
538
728
  }
539
- const d = R + c / 100 * (w - R);
729
+ const d = k + u / 100 * (V - k);
540
730
  return Math.round(d);
541
731
  },
542
- [$, l, v, R, w, t]
543
- ), ht = G(null), [Ut, wn] = Te(0), [da, ar] = Wt(), [ma, Mn] = Wt(), [fa, vn] = Wt(), [ga, Dn] = Wt(), [ha, pn] = Wt(), [ba, xn] = Wt();
544
- Yt(() => {
545
- const i = ht.current;
546
- if (!i) return;
547
- const c = () => {
548
- const d = i.getBoundingClientRect(), h = u ? d.height : d.width;
549
- h > 0 && wn((S) => Math.abs(S - h) < 0.5 ? S : h);
732
+ [T, i, L, k, V, t]
733
+ ), Mr = O(null), pa = O(null), Ma = O(0), Xe = O(null), $n = O(null), Da = O(null), xa = O(null), [En, Ra] = ye(0), [Fo, Jt] = mr(), [zo, La] = mr(), [Bo, Sa] = mr(), [Uo, ya] = mr(), [Wo, In] = mr(), [Xo, Ta] = mr(), Go = ne ? Jt === null ? void 0 : { estimatedWidthPx: Jt.widthPx, estimatedHeightPx: Jt.heightPx } : aa(Jt, La), Cn = !ne && ve === pe, Vn = ke === Ye, Nn = !H && Ce === _e, Ko = A ? "top" : "bottom", jo = A ? "bottom" : "top", Pa = R && !s, qo = Pa && !H, kn = { isPointMode: ne, isVertical: s, autoSlantLabels: R, isMerged: Cn, trackLengthPx: En, labelPosition: D, config: Go }, Yn = { trackLengthPx: En, labelPosition: Ko, config: aa(Sa, ya), isMerged: Vn, isSlantable: Pa }, On = { trackLengthPx: En, labelPosition: jo, config: aa(In, Ta), isMerged: Nn, isSlantable: qo };
734
+ Dt(() => {
735
+ const o = Xe.current;
736
+ if (!o) return;
737
+ const u = () => {
738
+ const m = o.getBoundingClientRect(), M = s ? m.height : m.width;
739
+ M > 0 && Ra((P) => Math.abs(P - M) < 0.5 ? P : M);
550
740
  };
551
- if (c(), typeof ResizeObserver < "u") {
552
- const d = new ResizeObserver((h) => {
553
- for (const S of h) {
554
- const _ = u ? S.contentRect.height : S.contentRect.width;
555
- _ > 0 && wn((X) => Math.abs(X - _) < 0.5 ? X : _);
741
+ if (u(), typeof ResizeObserver < "u") {
742
+ const m = new ResizeObserver((M) => {
743
+ for (const P of M) {
744
+ const N = s ? P.contentRect.height : P.contentRect.width;
745
+ N > 0 && Ra((E) => Math.abs(E - N) < 0.5 ? E : N);
556
746
  }
557
747
  });
558
- return d.observe(i), () => d.disconnect();
748
+ return m.observe(o), () => m.disconnect();
559
749
  }
560
- return window.addEventListener("resize", c), () => window.removeEventListener("resize", c);
561
- }, [u]);
562
- const Pt = B(
563
- (i, c, d) => {
564
- const h = u ? d.height : d.width;
565
- if (!(Number.isFinite(h) && h > 0)) return null;
566
- const S = u ? d.bottom - c : i - d.left;
567
- return Number.isFinite(S) ? Math.max(0, Math.min(1, S / h)) : null;
750
+ const d = o.ownerDocument.defaultView;
751
+ if (d)
752
+ return d.addEventListener("resize", u), () => d.removeEventListener("resize", u);
753
+ }, [s]);
754
+ const Qt = U(
755
+ (o, u, d) => {
756
+ const m = s ? d.height : d.width;
757
+ if (!(Number.isFinite(m) && m > 0)) return null;
758
+ const M = s ? d.bottom - u : o - d.left;
759
+ return Number.isFinite(M) ? Math.max(0, Math.min(1, M / m)) : null;
568
760
  },
569
- [u]
570
- ), yn = B(
571
- (i, c) => {
572
- const d = ht.current;
761
+ [s]
762
+ ), Aa = U(
763
+ (o, u) => {
764
+ const d = Xe.current;
573
765
  if (!d) return null;
574
- const h = Pt(i, c, d.getBoundingClientRect());
575
- return h === null ? null : h * 100;
766
+ const m = Qt(o, u, d.getBoundingClientRect());
767
+ return m === null ? null : m * 100;
576
768
  },
577
- [Pt]
578
- ), xr = G(null), Zr = G(null), st = G(null), Qr = G(null), or = G(null), Tn = B(
579
- (i) => {
580
- if (o) return;
581
- if (fe) {
582
- const N = Zr.current;
583
- if (!N || i.pointerId !== 0 && i.pointerId !== N.pointerId || !ht.current) return;
584
- const xe = Pt(i.clientX, i.clientY, ht.current.getBoundingClientRect());
585
- if (xe === null) return;
586
- if (N.handle === "macro-low" || N.handle === "macro-high" || N.handle === "macro-connect") {
587
- const [rt, yt, Ie] = Ja(N.handle, xe, N.startPointerRatio, N.startMacroLowRatio, N.startMacroHighRatio);
588
- Ie !== vt.current && (vt.current = Ie, wr(Ie), Et(Ie));
589
- let ye, nt;
590
- if (It) {
591
- const Lt = Ar(Ye, U, l, rt), Rt = Math.max(Lt, Ar(Ye, U, l, yt));
592
- ye = Ye[Lt], nt = Ye[Rt];
593
- } else {
594
- const Lt = Math.round(Ke + rt * rr), Rt = Math.round(Ke + yt * rr);
595
- ye = ge(U, Lt), nt = ge(U, Rt);
596
- }
597
- const sr = `${ye.getTime()}_${nt.getTime()}`;
598
- sr !== Qr.current && (Qr.current = sr, Ft(ye, nt));
599
- let bt, Tt;
600
- if (N.handle === "macro-connect") {
601
- const Lt = ut(b, ye), Rt = et(U, b, nt);
602
- let Xt, Kt;
603
- if (U === "year") {
604
- const St = ye.getFullYear() - N.startMacroLowDate.getFullYear();
605
- Xt = Ee("year", N.initialMicroLowDate, St), Kt = Ee("year", N.initialMicroHighDate, St);
606
- } else if (U === "month") {
607
- const St = (ye.getFullYear() - N.startMacroLowDate.getFullYear()) * 12 + (ye.getMonth() - N.startMacroLowDate.getMonth());
608
- Xt = Ee("month", N.initialMicroLowDate, St), Kt = Ee("month", N.initialMicroHighDate, St);
609
- } else {
610
- const St = Math.round((ye.getTime() - N.startMacroLowDate.getTime()) / 864e5);
611
- Xt = Ee("day", N.initialMicroLowDate, St), Kt = Ee("day", N.initialMicroHighDate, St);
612
- }
613
- const qt = Lt.getTime(), cr = Rt.getTime(), zn = N.initialMicroHighDate.getTime() - N.initialMicroLowDate.getTime();
614
- let ur = Xt.getTime(), dr = Kt.getTime();
615
- ur < qt && (ur = qt, dr = Math.min(cr, ur + zn)), dr > cr && (dr = cr, ur = Math.max(qt, dr - zn)), bt = ut(b, new Date(ur)), Tt = ut(b, new Date(dr));
616
- } else {
617
- const Lt = ye.getTime(), Rt = et(U, b, nt).getTime(), Xt = N.initialMicroLowDate.getTime(), Kt = N.initialMicroHighDate.getTime(), qt = Math.max(Lt, Math.min(Rt, Xt)), cr = Math.max(qt, Math.min(Rt, Kt));
618
- bt = ut(b, new Date(qt)), Tt = ut(b, new Date(cr));
619
- }
620
- const Bn = `${bt.getTime()}_${Tt.getTime()}`;
621
- Bn !== or.current && (or.current = Bn, qe(bt, Tt));
622
- } else if (N.handle === "micro-low" || N.handle === "micro-high" || N.handle === "micro-connect" || N.handle === "micro-point") {
623
- const [rt, yt, Ie] = Za(N.handle, xe, N.startPointerRatio, N.startMicroLowRatio, N.startMicroHighRatio);
624
- Ie !== vt.current && (vt.current = Ie, wr(Ie), Et(Ie));
625
- let ye, nt;
626
- if (tt) {
627
- const bt = Ar(ae, b, l, rt), Tt = Math.max(bt, Ar(ae, b, l, yt));
628
- ye = ae[bt], nt = ae[Tt];
769
+ [Qt]
770
+ ), Dr = O(null), wt = O(null), Jr = O({ macroLowRatio: at, macroHighRatio: st, isVertical: s, isMacroFirstRail: A }), $a = O({ flat: kn, macro: Yn, micro: On });
771
+ Cr(() => {
772
+ Jr.current = { macroLowRatio: at, macroHighRatio: st, isVertical: s, isMacroFirstRail: A }, $a.current = { flat: kn, macro: Yn, micro: On }, q.current = e, Br.current = [ve, pe], Tn.current = ba, p.current = v, Rt.current = We;
773
+ });
774
+ const Ea = (o, u) => {
775
+ const d = Jr.current;
776
+ $n.current?.setAttribute("d", Qn(o, u, d.isVertical, d.isMacroFirstRail));
777
+ }, Zo = (o, u, d) => {
778
+ const m = $a.current;
779
+ return o === "flat" ? ho(u * 100, d * 100, m.flat).placements : oa(o, u, d, o === "macro" ? m.macro : m.micro).placements;
780
+ }, xr = (o, u, d) => {
781
+ const m = Xe.current;
782
+ if (!m) return;
783
+ Dr.current = { rail: o, lowRatio: u, highRatio: d }, Ai(m, o, u, d);
784
+ const M = Zo(o, u, d);
785
+ M !== null && Pi(m, o, M), o === "macro" && Ea(u, d);
786
+ }, Ht = U(() => {
787
+ wt.current !== null && (clearTimeout(wt.current), wt.current = null);
788
+ const o = Xe.current;
789
+ o && (o.removeAttribute(qn), o.style.removeProperty(Zn));
790
+ }, []), Ia = () => {
791
+ const o = Xe.current;
792
+ if (Dr.current === null || !o) {
793
+ Dr.current = null;
794
+ return;
795
+ }
796
+ Dr.current = null, wt.current !== null && clearTimeout(wt.current), o.style.setProperty(Zn, `${ao}ms`), o.setAttribute(qn, "true"), $i(o), Ea(Jr.current.macroLowRatio, Jr.current.macroHighRatio), wt.current = setTimeout(() => {
797
+ wt.current = null, o.removeAttribute(qn), o.style.removeProperty(Zn);
798
+ }, ao);
799
+ };
800
+ Cr(() => {
801
+ const o = Dr.current;
802
+ o !== null && xr(o.rail, o.lowRatio, o.highRatio);
803
+ }), Dt(
804
+ () => () => {
805
+ wt.current !== null && clearTimeout(wt.current);
806
+ },
807
+ []
808
+ );
809
+ const Rr = O(null), Lr = O(null), ct = O(null), Hn = O(null), Sr = O(null), Pt = U(() => Rr.current !== null || Lr.current !== null, []), Ca = (o) => {
810
+ if (l) return;
811
+ if (fe) {
812
+ const F = Lr.current;
813
+ if (!F || o.pointerId !== F.pointerId || !Xe.current) return;
814
+ const ot = Qt(o.clientX, o.clientY, Xe.current.getBoundingClientRect());
815
+ if (ot === null) return;
816
+ if (F.handle === "macro-low" || F.handle === "macro-high" || F.handle === "macro-connect") {
817
+ const [Ve, Se, vt] = nl(F.handle, ot, F.startPointerRatio, F.startMacroLowRatio, F.startMacroHighRatio);
818
+ xr("macro", Ve, Se), vt !== Rt.current && (Rt.current = vt, Xr(vt), Xt(vt));
819
+ let Ge, dt;
820
+ if (Gt) {
821
+ const At = un(Le, h, i, Ve), $t = Math.max(At, un(Le, h, i, Se));
822
+ Ge = Le[At], dt = Le[$t];
823
+ } else {
824
+ const At = Math.round(Ie + Ve * Kr), $t = Math.round(Ie + Se * Kr);
825
+ Ge = ie(h, At), dt = ie(h, $t);
826
+ }
827
+ const Ar = `${Ge.getTime()}_${dt.getTime()}`;
828
+ Ar !== Hn.current && (Hn.current = Ar, Yt(Ge, dt));
829
+ const [pt, Ft] = xt(h, b, [Ge, dt], r, n), Gn = Q(b, pt), Kn = Q(b, Ft), Ja = ht ? yn(Gn, Kn) : [];
830
+ let ir, lr;
831
+ if (F.handle === "macro-connect") {
832
+ const At = pt, $t = Ft;
833
+ let sr, cr;
834
+ if (h === "year") {
835
+ const Et = Ge.getFullYear() - F.startMacroLowDate.getFullYear();
836
+ sr = Oe("year", F.initialMicroLowDate, Et), cr = Oe("year", F.initialMicroHighDate, Et);
837
+ } else if (h === "month") {
838
+ const Et = (Ge.getFullYear() - F.startMacroLowDate.getFullYear()) * 12 + (Ge.getMonth() - F.startMacroLowDate.getMonth());
839
+ sr = Oe("month", F.initialMicroLowDate, Et), cr = Oe("month", F.initialMicroHighDate, Et);
629
840
  } else {
630
- const bt = Math.round(Pe + rt * nr), Tt = Math.round(Pe + yt * nr);
631
- ye = ge(b, bt), nt = ge(b, Tt);
841
+ const Et = Math.round((Ge.getTime() - F.startMacroLowDate.getTime()) / 864e5);
842
+ sr = Oe("day", F.initialMicroLowDate, Et), cr = Oe("day", F.initialMicroHighDate, Et);
632
843
  }
633
- const sr = `${ye.getTime()}_${nt.getTime()}`;
634
- sr !== or.current && (or.current = sr, qe(ye, nt));
844
+ const ur = At.getTime(), $r = $t.getTime(), to = F.initialMicroHighDate.getTime() - F.initialMicroLowDate.getTime();
845
+ let Er = sr.getTime(), Ir = cr.getTime();
846
+ Er < ur && (Er = ur, Ir = Math.min($r, Er + to)), Ir > $r && (Ir = $r, Er = Math.max(ur, Ir - to)), ir = je(b, new Date(Er)), lr = je(b, new Date(Ir));
847
+ } else {
848
+ const At = pt.getTime(), $t = Ft.getTime(), sr = F.initialMicroLowDate.getTime(), cr = F.initialMicroHighDate.getTime(), ur = Math.max(At, Math.min($t, sr)), $r = Math.max(ur, Math.min($t, cr));
849
+ ir = je(b, new Date(ur)), lr = je(b, new Date($r));
635
850
  }
636
- return;
637
- }
638
- const c = xr.current;
639
- if (!c || i.pointerId !== 0 && i.pointerId !== c.pointerId || !ht.current) return;
640
- const d = ht.current.getBoundingClientRect(), h = u ? i.clientY : i.clientX, S = u ? d.height : d.width;
641
- if (!(Number.isFinite(S) && S > 0)) return;
642
- if (c.handle === "connect") {
643
- const N = u ? (c.startPointerPos - h) / S : (h - c.startPointerPos) / S, xe = Ka({
644
- posDiffPct: N,
645
- startLowVal: c.startLowVal,
646
- startHighVal: c.startHighVal,
647
- rangeMin: R,
648
- rangeMax: w,
649
- isDiscrete: $,
650
- sortedAllowedDates: v,
651
- snapMode: l,
652
- unit: t
653
- });
654
- if (st.current && st.current[0] === xe[0] && st.current[1] === xe[1])
655
- return;
656
- st.current = xe, at(xe), lt(xe[0], xe[1], !1);
657
- return;
658
- }
659
- const _ = Pt(i.clientX, i.clientY, d);
660
- if (_ === null) return;
661
- const X = pr(_ * 100), [H, ee] = qn(c.handle, X, c.startLowVal, c.startHighVal, R, w, K);
662
- if ((!st.current || st.current[0] !== H || st.current[1] !== ee) && (st.current = [H, ee], at([H, ee]), lt(H, ee, !1)), !K && (c.handle === "low" || c.handle === "high")) {
663
- const N = Xa(c.handle, X, c.startLowVal, c.startHighVal, K);
664
- Ve.current !== N && (Ve.current = N, Re(N), W(N));
851
+ const Qa = Lt(ir, Ja, Gn, Kn), Li = Math.max(Qa, Lt(lr, Ja, Gn, Kn));
852
+ ir = ie(b, Qa), lr = ie(b, Li);
853
+ const eo = `${ir.getTime()}_${lr.getTime()}`;
854
+ eo !== Sr.current && (Sr.current = eo, Je(ir, lr));
855
+ } else if (F.handle === "micro-low" || F.handle === "micro-high" || F.handle === "micro-connect" || F.handle === "micro-point") {
856
+ const [Ve, Se, vt] = al(F.handle, ot, F.startPointerRatio, F.startMicroLowRatio, F.startMicroHighRatio);
857
+ xr("micro", Ve, Se), vt !== Rt.current && (Rt.current = vt, Xr(vt), Xt(vt));
858
+ let Ge, dt;
859
+ if (nt) {
860
+ const pt = un(se, b, i, Ve), Ft = Math.max(pt, un(se, b, i, Se));
861
+ Ge = se[pt], dt = se[Ft];
862
+ } else {
863
+ const pt = Lt(ie(b, Math.round(xe + Ve * jr)), Kt, xe, $e), Ft = Math.max(pt, Lt(ie(b, Math.round(xe + Se * jr)), Kt, xe, $e));
864
+ Ge = ie(b, pt), dt = ie(b, Ft);
865
+ }
866
+ const Ar = `${Ge.getTime()}_${dt.getTime()}`;
867
+ Ar !== Sr.current && (Sr.current = Ar, Je(Ge, dt));
665
868
  }
666
- },
667
- [
668
- o,
669
- fe,
670
- u,
671
- U,
672
- b,
673
- It,
674
- tt,
675
- Ye,
676
- ae,
677
- Ke,
678
- rr,
679
- Pe,
680
- nr,
681
- R,
682
- w,
683
- $,
684
- v,
685
- l,
686
- t,
687
- Pt,
688
- pr,
689
- lt,
690
- Ft,
691
- qe,
692
- K
693
- ]
694
- ), Ln = B(
695
- (i) => {
696
- if (fe) {
697
- Qr.current = null, or.current = null, Zr.current = null, vt.current = null, wr(null), Jr(Wr.current), Jr(Gr.current);
869
+ return;
870
+ }
871
+ const u = Rr.current;
872
+ if (!u || o.pointerId !== u.pointerId || !Xe.current) return;
873
+ const d = Xe.current.getBoundingClientRect(), m = s ? o.clientY : o.clientX, M = s ? d.height : d.width;
874
+ if (!(Number.isFinite(M) && M > 0)) return;
875
+ if (u.handle === "connect") {
876
+ const F = s ? (u.startPointerPos - m) / M : (m - u.startPointerPos) / M, [ot, Ve] = ua(F, u.startLowRatio, u.startHighRatio);
877
+ xr("flat", ot, Ve);
878
+ const Se = Zi({
879
+ posDiffPct: F,
880
+ startLowVal: u.startLowVal,
881
+ startHighVal: u.startHighVal,
882
+ rangeMin: k,
883
+ rangeMax: V,
884
+ isDiscrete: T,
885
+ sortedAllowedDates: L,
886
+ snapMode: i,
887
+ unit: t
888
+ });
889
+ if (ct.current && ct.current[0] === Se[0] && ct.current[1] === Se[1])
698
890
  return;
699
- }
700
- const c = xr.current;
701
- if (!c || i.pointerId !== 0 && i.pointerId !== c.pointerId) return;
702
- const d = st.current ?? Ge;
703
- d && (lt(d[0], d[1], !0), Xe(d)), st.current = null, at(null), xr.current = null, Ve.current = null, Re(null);
704
- },
705
- [fe, Ge, lt, Jr]
706
- ), Rn = G(Tn);
707
- Rn.current = Tn;
708
- const Sn = G(Ln);
709
- Sn.current = Ln;
710
- const Pn = ie !== null || Oe !== null;
711
- Yt(() => {
712
- if (!Pn) return;
713
- const i = (d) => Rn.current(d), c = (d) => Sn.current(d);
714
- return window.addEventListener("pointermove", i), window.addEventListener("pointerup", c), window.addEventListener("pointercancel", c), () => {
715
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", c), window.removeEventListener("pointercancel", c);
891
+ ct.current = Se, te(Se), Tt(Se[0], Se[1], !1);
892
+ return;
893
+ }
894
+ const P = Qt(o.clientX, o.clientY, d);
895
+ if (P === null) return;
896
+ const [N, E] = hn(ne ? "point" : u.handle, P, u.startLowRatio, u.startHighRatio);
897
+ xr("flat", N, E);
898
+ const re = An(P * 100), [he, Re] = uo(u.handle, re, u.startLowVal, u.startHighVal, k, V, ne);
899
+ if ((!ct.current || ct.current[0] !== he || ct.current[1] !== Re) && (ct.current = [he, Re], te([he, Re]), Tt(he, Re, !1)), !ne && (u.handle === "low" || u.handle === "high")) {
900
+ const F = da(u.handle, P, u.startLowRatio, u.startHighRatio);
901
+ p.current !== F && (p.current = F, Y(F), de(F));
902
+ }
903
+ }, Va = (o) => {
904
+ if (fe) {
905
+ const m = Lr.current;
906
+ if (!m || o.pointerId !== m.pointerId) return;
907
+ Ia(), Hn.current = null, Sr.current = null, Lr.current = null, Rt.current = null, Xr(null), wa(qr.current), wa(Zr.current);
908
+ return;
909
+ }
910
+ const u = Rr.current;
911
+ if (!u || o.pointerId !== u.pointerId) return;
912
+ Ia();
913
+ const d = ct.current ?? B;
914
+ d && (Tt(d[0], d[1], !0), K(d)), ct.current = null, te(null), Rr.current = null, p.current = null, Y(null);
915
+ }, _n = O(Ca), Na = O(Va);
916
+ Cr(() => {
917
+ _n.current = Ca, Na.current = Va;
918
+ });
919
+ const ka = v !== null || We !== null;
920
+ Dt(() => {
921
+ if (!ka) return;
922
+ const o = Mr.current?.ownerDocument.defaultView;
923
+ if (!o) return;
924
+ const u = (m) => _n.current(m), d = (m) => Na.current(m);
925
+ return o.addEventListener("pointermove", u), o.addEventListener("pointerup", d), o.addEventListener("pointercancel", d), o.addEventListener("lostpointercapture", d), () => {
926
+ o.removeEventListener("pointermove", u), o.removeEventListener("pointerup", d), o.removeEventListener("pointercancel", d), o.removeEventListener("lostpointercapture", d);
716
927
  };
717
- }, [Pn]);
718
- const en = B(
719
- (i, c, d) => {
720
- xr.current = {
721
- pointerId: i,
722
- handle: c,
723
- startPointerPos: d,
724
- startLowVal: he,
725
- startHighVal: ve
726
- }, Ve.current = c, Re(c), c !== "connect" && W(c);
928
+ }, [ka]);
929
+ const Fn = U(
930
+ (o, u, d, m) => {
931
+ Ht(), vo(o, u), Rr.current = {
932
+ pointerId: u,
933
+ handle: d,
934
+ startPointerPos: m,
935
+ startLowVal: ve,
936
+ startHighVal: pe,
937
+ // 表示の出発点は「いま描かれている位置」。値を基準にすると、時間比例スナップのように
938
+ // 値と位置が線形でないレールで、掴んでいない側の支点が実際の描画位置からずれる
939
+ startLowRatio: Ot(ve) / 100,
940
+ startHighRatio: Ot(pe) / 100
941
+ }, p.current = d, Y(d), d !== "connect" && de(d);
727
942
  },
728
- [he, ve]
729
- ), $n = B(
730
- (i, c, d) => {
731
- const h = C.current;
732
- h.mode === "vernier" && (Zr.current = {
733
- pointerId: i,
734
- handle: c,
735
- startPointerRatio: d,
736
- startMacroLowRatio: ke,
737
- startMacroHighRatio: ze,
738
- startMicroLowRatio: Ze,
739
- startMicroHighRatio: gt,
740
- startMacroLowEnc: Fe,
741
- startMacroHighEnc: Ue,
742
- startMicroLowEnc: pe,
743
- startMicroHighEnc: Se,
744
- startMacroLowDate: h.macroRange[0],
745
- startMacroHighDate: h.macroRange[1],
746
- initialMicroLowDate: Dt,
747
- initialMicroHighDate: pt
748
- }, vt.current = c, wr(c), Et(c));
943
+ [ve, pe, Ot]
944
+ ), Ya = U(
945
+ (o, u, d, m) => {
946
+ q.current.mode === "vernier" && (Ht(), vo(o, u), Lr.current = {
947
+ pointerId: u,
948
+ handle: d,
949
+ startPointerRatio: m,
950
+ startMacroLowRatio: at,
951
+ startMacroHighRatio: st,
952
+ startMicroLowRatio: jt,
953
+ startMicroHighRatio: pr,
954
+ // 平行移動量は暦差分で求めるため、基準は表示しているマクロ値 (期間先頭・定義域内) でなければならない。
955
+ // 生の Props を基準にすると、期間の途中や定義域の外を指す開始日で日差分が半端になり、
956
+ // 動いていない押下でも丸めで 1 単位ずれる
957
+ startMacroLowDate: bt,
958
+ initialMicroLowDate: St,
959
+ initialMicroHighDate: yt
960
+ }, Rt.current = d, Xr(d), Xt(d));
749
961
  },
750
- [ke, ze, Ze, gt, Fe, Ue, pe, Se, Dt, pt]
751
- ), Nn = (i) => (c) => {
752
- if (o) return;
753
- c.stopPropagation(), c.preventDefault(), W(i);
754
- const d = u ? c.clientY : c.clientX;
755
- en(c.pointerId, i, d);
756
- }, Yn = (i) => () => {
757
- o || Ve.current !== null || W(i);
758
- }, yr = (i) => () => {
759
- o || vt.current !== null || Et(i);
760
- }, Bt = (i) => (c) => {
761
- if (o) return;
762
- c.stopPropagation(), c.preventDefault();
763
- const d = ht.current;
962
+ [at, st, jt, pr, bt, St, yt]
963
+ ), Oa = (o) => (u) => {
964
+ if (l || Pt()) return;
965
+ u.stopPropagation(), u.preventDefault(), de(o);
966
+ const d = s ? u.clientY : u.clientX;
967
+ Fn(u.currentTarget, u.pointerId, o, d);
968
+ }, Ha = (o) => () => {
969
+ l || p.current !== null || de(o);
970
+ }, Qr = (o) => () => {
971
+ l || Rt.current !== null || Xt(o);
972
+ }, er = (o) => (u) => {
973
+ if (l || Pt()) return;
974
+ u.stopPropagation(), u.preventDefault();
975
+ const d = Xe.current;
764
976
  if (!d) return;
765
- const h = Pt(c.clientX, c.clientY, d.getBoundingClientRect());
766
- h !== null && $n(c.pointerId, i, h);
767
- }, wa = (i) => {
768
- if (o || P) return;
769
- i.stopPropagation(), i.preventDefault();
770
- const c = u ? i.clientY : i.clientX;
771
- en(i.pointerId, "connect", c);
772
- }, Ma = (i) => {
773
- if (o) return;
977
+ const m = Qt(u.clientX, u.clientY, d.getBoundingClientRect());
978
+ m !== null && Ya(u.currentTarget, u.pointerId, o, m);
979
+ }, Jo = (o) => {
980
+ if (l || S || Pt()) return;
981
+ o.stopPropagation(), o.preventDefault();
982
+ const u = s ? o.clientY : o.clientX;
983
+ Fn(o.currentTarget, o.pointerId, "connect", u);
984
+ }, Qo = (o) => {
985
+ if (l || Pt()) return;
774
986
  if (fe) {
775
- const H = ht.current;
776
- if (!H) return;
777
- const ee = H.getBoundingClientRect(), N = Pt(i.clientX, i.clientY, ee);
778
- if (N === null) return;
779
- const xe = u ? i.clientX - (ee.left + ee.width / 2) : i.clientY - (ee.top + ee.height / 2), rt = Ga(N, xe, ke, ze, Ze, gt, At, void 0, !P, D ? "point" : "range");
780
- $n(i.pointerId, rt, N);
987
+ const E = Xe.current;
988
+ if (!E) return;
989
+ const re = E.getBoundingClientRect(), he = Qt(o.clientX, o.clientY, re);
990
+ if (he === null) return;
991
+ const Re = s ? o.clientX - (re.left + re.width / 2) : o.clientY - (re.top + re.height / 2), F = rl(he, Re, at, st, jt, pr, Nt, void 0, !S, H ? "point" : "range");
992
+ Ya(o.currentTarget, o.pointerId, F, he), _n.current(o.nativeEvent);
781
993
  return;
782
994
  }
783
- const c = yn(i.clientX, i.clientY);
784
- if (c === null) return;
785
- const d = pr(c);
786
- let h = "low";
787
- if (!K) {
788
- const H = Math.abs(d - he), ee = Math.abs(d - ve);
789
- H < ee ? h = "low" : ee < H ? h = "high" : h = d > ve ? "high" : "low";
995
+ const u = Aa(o.clientX, o.clientY);
996
+ if (u === null) return;
997
+ const d = An(u);
998
+ let m = "low";
999
+ if (!ne) {
1000
+ const E = Math.abs(d - ve), re = Math.abs(d - pe);
1001
+ E < re ? m = "low" : re < E ? m = "high" : m = d > pe ? "high" : "low";
790
1002
  }
791
- W(h);
792
- const [S, _] = qn(h, d, he, ve, R, w, K);
793
- at([S, _]), lt(S, _, !0);
794
- const X = u ? i.clientY : i.clientX;
795
- en(i.pointerId, h, X);
796
- }, va = (i) => {
797
- if (o || ie !== null) return;
798
- const c = yn(i.clientX, i.clientY);
799
- if (c === null) return;
800
- const d = pr(c);
801
- Mt(d), mt(Dr(d));
802
- }, Da = () => {
803
- Mt(null), mt(null);
804
- }, kn = (i) => (c) => {
805
- if (o) return;
806
- W(i);
807
- const d = qa(c.key, i, he, ve, R, w, K, 1);
808
- d && (c.preventDefault(), be || Xe(d), lt(d[0], d[1], !0));
809
- }, Tr = (i, c) => {
810
- const d = Math.max(oe(b, i), oe(b, r)), h = Math.min(oe(b, et(U, b, c)), oe(b, n)), S = Math.max(d, Math.min(h, pe)), _ = Math.max(S, Math.min(h, Se));
811
- S === pe && _ === Se || qe(ge(b, S), ge(b, _), !0);
812
- }, Lr = (i) => (c) => {
813
- if (o || !fe || e.mode !== "vernier") return;
814
- Et(i);
815
- let d = 0, h = !1, S = !1;
816
- switch (c.key) {
1003
+ de(m);
1004
+ const [M, P] = uo(m, d, ve, pe, k, V, ne);
1005
+ te([M, P]), Tt(M, P, !0);
1006
+ const N = s ? o.clientY : o.clientX;
1007
+ Fn(o.currentTarget, o.pointerId, m, N);
1008
+ }, ei = (o) => {
1009
+ if (l || fe || v !== null) return;
1010
+ const u = Aa(o.clientX, o.clientY);
1011
+ if (u === null) return;
1012
+ const d = An(u);
1013
+ Ae(d), rt(Ot(d));
1014
+ }, ti = () => {
1015
+ Ae(null), rt(null);
1016
+ }, _a = (o) => (u) => {
1017
+ if (l || Pt()) return;
1018
+ de(o);
1019
+ const d = Ji(u.key, o, ve, pe, k, V, ne, 1);
1020
+ d && (u.preventDefault(), Ht(), Ue || K(d), Tt(d[0], d[1], !0));
1021
+ }, tr = (o, u) => {
1022
+ if (le === null) return;
1023
+ const [d, m] = xt(h, b, [o, u], r, n), M = Q(b, d), P = Q(b, m), N = ht ? yn(M, P) : [], E = Lt(le[0], N, M, P), re = Math.max(E, Lt(le[1], N, M, P));
1024
+ Je(ie(b, E), ie(b, re), !0);
1025
+ }, en = (o) => (u) => {
1026
+ if (l || !fe || e.mode !== "vernier" || Pt()) return;
1027
+ Xt(o);
1028
+ let d = 0, m = !1, M = !1;
1029
+ switch (u.key) {
817
1030
  case "ArrowRight":
818
1031
  case "ArrowUp":
819
1032
  d = 1;
@@ -829,549 +1042,598 @@ const Qa = (e, t) => {
829
1042
  d = -5;
830
1043
  break;
831
1044
  case "Home":
832
- h = !0;
1045
+ m = !0;
833
1046
  break;
834
1047
  case "End":
835
- S = !0;
1048
+ M = !0;
836
1049
  break;
837
1050
  default:
838
1051
  return;
839
1052
  }
840
- if (c.preventDefault(), i === "macro-low") {
841
- const _ = ge(U, Fe), X = ge(U, Ue);
842
- if (It) {
843
- const N = mr(Ye, U, _, Ye[0], X, d, h, S);
844
- if (N === Ae(Ye, _, U)) return;
845
- const xe = Ye[N];
846
- Ft(xe, X, !0), Tr(xe, X);
1053
+ if (u.preventDefault(), Ht(), o === "macro-low") {
1054
+ const P = ie(h, ke), N = ie(h, Ye);
1055
+ if (Gt) {
1056
+ const he = Nr(Le, h, P, Le[0], N, d, m, M);
1057
+ if (he === be(Le, P, h)) return;
1058
+ const Re = Le[he];
1059
+ Yt(Re, N, !0), tr(Re, N);
847
1060
  return;
848
1061
  }
849
- let H;
850
- if (h ? H = Ke : S ? H = Ue : H = Math.max(Ke, Math.min(Ue, Fe + d)), H === Fe) return;
851
- const ee = ge(U, H);
852
- Ft(ee, X, !0), Tr(ee, X);
853
- } else if (i === "macro-high") {
854
- const _ = ge(U, Fe), X = ge(U, Ue);
855
- if (It) {
856
- const N = mr(Ye, U, X, _, Ye[Ye.length - 1], d, h, S);
857
- if (N === Ae(Ye, X, U)) return;
858
- const xe = Ye[N];
859
- Ft(_, xe, !0), Tr(_, xe);
1062
+ let E;
1063
+ if (m ? E = Ie : M ? E = Ye : E = Math.max(Ie, Math.min(Ye, ke + d)), E === ke) return;
1064
+ const re = ie(h, E);
1065
+ Yt(re, N, !0), tr(re, N);
1066
+ } else if (o === "macro-high") {
1067
+ const P = ie(h, ke), N = ie(h, Ye);
1068
+ if (Gt) {
1069
+ const he = Nr(Le, h, N, P, Le[Le.length - 1], d, m, M);
1070
+ if (he === be(Le, N, h)) return;
1071
+ const Re = Le[he];
1072
+ Yt(P, Re, !0), tr(P, Re);
860
1073
  return;
861
1074
  }
862
- let H;
863
- if (h ? H = Fe : S ? H = Vt : H = Math.max(Fe, Math.min(Vt, Ue + d)), H === Ue) return;
864
- const ee = ge(U, H);
865
- Ft(_, ee, !0), Tr(_, ee);
866
- } else if (i === "micro-low") {
867
- const _ = ge(b, pe), X = ge(b, Se);
868
- if (tt) {
869
- const ee = mr(ae, b, _, ae[0], X, d, h, S);
870
- if (ee === Ae(ae, _, b)) return;
871
- qe(ae[ee], X, !0);
1075
+ let E;
1076
+ if (m ? E = ke : M ? E = Ze : E = Math.max(ke, Math.min(Ze, Ye + d)), E === Ye) return;
1077
+ const re = ie(h, E);
1078
+ Yt(P, re, !0), tr(P, re);
1079
+ } else if (o === "micro-low") {
1080
+ const P = ie(b, Ce), N = ie(b, _e);
1081
+ if (nt) {
1082
+ const re = Nr(se, b, P, se[0], N, d, m, M);
1083
+ if (re === be(se, P, b)) return;
1084
+ Je(se[re], N, !0);
872
1085
  return;
873
1086
  }
874
- let H;
875
- if (h ? H = Pe : S ? H = Se : H = Math.max(Pe, Math.min(Se, pe + d)), H === pe) return;
876
- qe(ge(b, H), X, !0);
877
- } else if (i === "micro-high") {
878
- const _ = ge(b, pe), X = ge(b, Se);
879
- if (tt) {
880
- const ee = mr(ae, b, X, _, ae[ae.length - 1], d, h, S);
881
- if (ee === Ae(ae, X, b)) return;
882
- qe(_, ae[ee], !0);
1087
+ let E;
1088
+ if (m ? E = xe : M ? E = _e : E = Math.max(xe, Math.min(_e, Ce + d)), E === Ce) return;
1089
+ Je(ie(b, E), N, !0);
1090
+ } else if (o === "micro-high") {
1091
+ const P = ie(b, Ce), N = ie(b, _e);
1092
+ if (nt) {
1093
+ const re = Nr(se, b, N, P, se[se.length - 1], d, m, M);
1094
+ if (re === be(se, N, b)) return;
1095
+ Je(P, se[re], !0);
883
1096
  return;
884
1097
  }
885
- let H;
886
- if (h ? H = pe : S ? H = Be : H = Math.max(pe, Math.min(Be, Se + d)), H === Se) return;
887
- qe(_, ge(b, H), !0);
888
- } else if (i === "micro-point") {
889
- const _ = ge(b, pe);
890
- if (tt) {
891
- const H = mr(ae, b, _, ae[0], ae[ae.length - 1], d, h, S);
892
- if (H === Ae(ae, _, b)) return;
893
- bn(ae[H], !0);
1098
+ let E;
1099
+ if (m ? E = Ce : M ? E = $e : E = Math.max(Ce, Math.min($e, _e + d)), E === _e) return;
1100
+ Je(P, ie(b, E), !0);
1101
+ } else if (o === "micro-point") {
1102
+ const P = ie(b, Ce);
1103
+ if (nt) {
1104
+ const E = Nr(se, b, P, se[0], se[se.length - 1], d, m, M);
1105
+ if (E === be(se, P, b)) return;
1106
+ va(se[E], !0);
894
1107
  return;
895
1108
  }
896
- let X;
897
- if (h ? X = Pe : S ? X = Be : X = Math.max(Pe, Math.min(Be, pe + d)), X === pe) return;
898
- bn(ge(b, X), !0);
1109
+ let N;
1110
+ if (m ? N = xe : M ? N = $e : N = Math.max(xe, Math.min($e, Ce + d)), N === Ce) return;
1111
+ va(ie(b, N), !0);
899
1112
  }
900
- }, pa = B(
901
- (i) => {
902
- const c = C.current;
903
- if (!c.disabled)
904
- if (c.mode === "point") {
905
- const d = Math.max(R, Math.min(w, he + i));
906
- be || Xe([d, d]), lt(d, d, !0);
907
- } else if (c.mode === "vernier") {
908
- if (tt) {
909
- const N = ae.length - 1, xe = Ae(ae, Dt, b), rt = Ae(ae, pt, b), yt = rt - xe;
910
- let Ie = xe + i, ye = rt + i;
911
- i < 0 && Ie < 0 ? (Ie = 0, ye = Math.min(N, yt)) : i > 0 && ye > N && (ye = N, Ie = Math.max(0, N - yt)), (Ie !== xe || ye !== rt) && qe(ae[Ie], ae[ye], !0);
1113
+ }, ri = (o) => {
1114
+ if (e.mode !== "vernier") return;
1115
+ if (Ht(), Gt) {
1116
+ const N = Le.length - 1, E = be(Le, bt, h), re = be(Le, kt, h), he = re - E;
1117
+ let Re = E + o, F = re + o;
1118
+ if (o < 0 && Re < 0 ? (Re = 0, F = Math.min(N, he)) : o > 0 && F > N && (F = N, Re = Math.max(0, N - he)), Re === E && F === re) return;
1119
+ const ot = Le[Re], Ve = Le[F];
1120
+ Yt(ot, Ve, !0), tr(ot, Ve);
1121
+ return;
1122
+ }
1123
+ const u = Ye - ke;
1124
+ let d = ke + o, m = Ye + o;
1125
+ if (o < 0 && d < Ie ? (d = Ie, m = Math.min(Ze, d + u)) : o > 0 && m > Ze && (m = Ze, d = Math.max(Ie, m - u)), d === ke && m === Ye) return;
1126
+ const M = ie(h, d), P = ie(h, m);
1127
+ Yt(M, P, !0), tr(M, P);
1128
+ }, zn = U(
1129
+ (o) => {
1130
+ const u = q.current;
1131
+ if (!(u.disabled || Pt()))
1132
+ if (Ht(), u.mode === "point") {
1133
+ const d = Math.max(k, Math.min(V, ve + o));
1134
+ Ue || K([d, d]), Tt(d, d, !0);
1135
+ } else if (u.mode === "vernier") {
1136
+ if (nt) {
1137
+ const he = se.length - 1, Re = be(se, St, b), F = be(se, yt, b), ot = F - Re;
1138
+ let Ve = Re + o, Se = F + o;
1139
+ o < 0 && Ve < 0 ? (Ve = 0, Se = Math.min(he, ot)) : o > 0 && Se > he && (Se = he, Ve = Math.max(0, he - ot)), (Ve !== Re || Se !== F) && Je(se[Ve], se[Se], !0);
912
1140
  return;
913
1141
  }
914
- const d = pe, h = Se, S = Pe, _ = Be, X = h - d;
915
- let H = d + i, ee = h + i;
916
- i < 0 && H < S ? (H = S, ee = Math.min(_, H + X)) : i > 0 && ee > _ && (ee = _, H = Math.max(S, ee - X)), (H !== d || ee !== h) && qe(ge(b, H), ge(b, ee), !0);
1142
+ const d = Ce, m = _e, M = xe, P = $e, N = m - d;
1143
+ let E = d + o, re = m + o;
1144
+ o < 0 && E < M ? (E = M, re = Math.min(P, E + N)) : o > 0 && re > P && (re = P, E = Math.max(M, re - N)), (E !== d || re !== m) && Je(ie(b, E), ie(b, re), !0);
917
1145
  } else {
918
- const d = ve - he;
919
- let h = he + i, S = ve + i;
920
- i < 0 && h < R ? (h = R, S = Math.min(w, h + d)) : i > 0 && S > w && (S = w, h = Math.max(R, S - d)), h <= S && (be || Xe([h, S]), lt(h, S, !0));
1146
+ const d = pe - ve;
1147
+ let m = ve + o, M = pe + o;
1148
+ o < 0 && m < k ? (m = k, M = Math.min(V, m + d)) : o > 0 && M > V && (M = V, m = Math.max(k, M - d)), m <= M && (Ue || K([m, M]), Tt(m, M, !0));
921
1149
  }
922
1150
  },
923
1151
  [
924
- he,
925
1152
  ve,
926
- R,
927
- w,
928
- be,
929
- lt,
930
- qe,
931
1153
  pe,
932
- Se,
933
- Pe,
934
- Be,
1154
+ k,
1155
+ V,
1156
+ Ue,
1157
+ Tt,
1158
+ Je,
1159
+ Ce,
1160
+ _e,
1161
+ xe,
1162
+ $e,
935
1163
  b,
936
- tt,
937
- ae,
938
- Dt,
939
- pt
1164
+ nt,
1165
+ se,
1166
+ St,
1167
+ yt,
1168
+ Ht
940
1169
  ]
941
- ), zt = Dr(he), _t = Dr(ve), tn = re(he), rn = re(ve), nn = T(() => K ? ar === null ? void 0 : { estimatedWidthPx: ar.widthPx, estimatedHeightPx: ar.heightPx } : cn(ar, Mn), [K, ar, Mn]), Rr = !K && he === ve, _e = T(() => {
942
- if (K || !M || u) return fn(L, nn);
943
- const i = la(zt, _t, Ut, L, nn);
944
- return Rr ? sa(i) : i;
945
- }, [K, Rr, M, u, zt, _t, Ut, L, nn]), ir = ie === "low" || ie !== "high" && kt === "low", lr = !K && (ie === "high" || ie !== "low" && kt === "high"), Sr = Fe === Ue, Pr = !D && pe === Se, xa = Sr && Ne !== "macro-low", ya = Sr && Ne === "macro-low", Ta = Pr && Ne !== "micro-low", La = Pr && Ne === "micro-low", An = Y ? "top" : "bottom", Cn = Y ? "bottom" : "top", En = T(() => cn(vn, Dn), [vn, Dn]), Vn = T(() => cn(pn, xn), [pn, xn]), an = M && !u, $r = T(
946
- () => Wn(ke, ze, Ut, An, En, Sr, an),
947
- [ke, ze, Ut, An, En, Sr, an]
948
- ), In = an && !D, Nr = T(
949
- () => Wn(Ze, gt, Ut, Cn, Vn, Pr, In),
950
- [Ze, gt, Ut, Cn, Vn, Pr, In]
951
- ), Ra = T(() => u ? {
952
- "--ps-tooltip-origin": "100% 50%",
953
- "--ps-tooltip-tx": "0px",
954
- "--ps-tooltip-ty": "-50%",
955
- "--ps-tooltip-rot": "0deg"
956
- } : {
957
- "--ps-tooltip-origin": "50% 50%",
958
- "--ps-tooltip-tx": `calc(-50% + ${_e.lowOffsetX}px)`,
959
- "--ps-tooltip-ty": `calc(-50% + ${_e.lowOffsetY}px)`,
960
- "--ps-tooltip-rot": `${_e.lowAngleDeg}deg`
961
- }, [u, _e.lowOffsetX, _e.lowOffsetY, _e.lowAngleDeg]), Sa = T(() => u ? {
962
- "--ps-tooltip-origin": "100% 50%",
963
- "--ps-tooltip-tx": "0px",
964
- "--ps-tooltip-ty": "-50%",
965
- "--ps-tooltip-rot": "0deg"
966
- } : {
967
- "--ps-tooltip-origin": "50% 50%",
968
- "--ps-tooltip-tx": `calc(-50% + ${_e.highOffsetX}px)`,
969
- "--ps-tooltip-ty": `calc(-50% + ${_e.highOffsetY}px)`,
970
- "--ps-tooltip-rot": `${_e.highAngleDeg}deg`
971
- }, [u, _e.highOffsetX, _e.highOffsetY, _e.highAngleDeg]), Yr = Math.min(zt, _t), Hn = Math.max(zt, _t), Pa = u ? {
972
- bottom: `${Yr}%`,
973
- height: `${Hn - Yr}%`,
1170
+ ), Fa = (o) => !l && ea(Mr.current, o), za = (o, u) => {
1171
+ const d = pa.current, m = Xe.current, M = Mr.current;
1172
+ if (l || d === null || m === null || M === null || !Ni(d, M, Ma.current, s, o, u)) return null;
1173
+ const P = m.getBoundingClientRect();
1174
+ return Math.abs(s ? o - (P.left + P.width / 2) : u - (P.top + P.height / 2));
1175
+ }, Ba = (o) => {
1176
+ if (l || Pt()) return;
1177
+ const u = tl(o.deltaX, o.deltaY, s);
1178
+ if (u === 0) return;
1179
+ o.preventDefault();
1180
+ const d = o.target, m = ea(Da.current, d) || ea(xa.current, d);
1181
+ if (!fe || m) {
1182
+ zn(u);
1183
+ return;
1184
+ }
1185
+ const M = Xe.current;
1186
+ if (!M) return;
1187
+ const P = M.getBoundingClientRect(), N = s ? o.clientX - (P.left + P.width / 2) : o.clientY - (P.top + P.height / 2);
1188
+ if (ko(N, Nt) === "macro") {
1189
+ ri(u);
1190
+ return;
1191
+ }
1192
+ zn(u);
1193
+ }, tn = O({ ownsWheelHit: Fa, distanceToRailPx: za, stepFromRangeAreaWheel: Ba });
1194
+ Cr(() => {
1195
+ tn.current = { ownsWheelHit: Fa, distanceToRailPx: za, stepFromRangeAreaWheel: Ba };
1196
+ }), Dt(() => {
1197
+ const o = Mr.current?.ownerDocument.defaultView;
1198
+ if (o)
1199
+ return Yi(o, {
1200
+ ownsHit: (u) => tn.current.ownsWheelHit(u),
1201
+ distanceToRailPx: (u, d) => tn.current.distanceToRailPx(u, d),
1202
+ step: (u) => tn.current.stepFromRangeAreaWheel(u)
1203
+ });
1204
+ }, []);
1205
+ const rn = Ot(ve), nn = Ot(pe), Bn = ce(ve), Un = ce(pe), Wn = ho(rn, nn, kn), yr = Wn.slant, Tr = v === "low" || v !== "high" && j === "low", Pr = !ne && (v === "high" || v !== "low" && j === "high"), ni = Vn && Ne !== "macro-low", ai = Vn && Ne === "macro-low", oi = Nn && Ne !== "micro-low", ii = Nn && Ne === "micro-low", rr = oa("macro", at, st, Yn), nr = oa("micro", jt, pr, On), li = Math.min(rn, nn), si = Math.max(rn, nn), [Ua, Wa] = Hr.flat, [ci, ui] = Hr.macro, [di, mi] = Hr.micro, Xa = It(Ua, rn), Ga = It(Wa, nn), Xn = It(Ua, li), Ka = `calc(${It(Wa, si)} - ${Xn})`, ar = It(ci, at * 100), an = It(ui, st * 100), or = It(di, jt * 100), on = It(mi, pr * 100), fi = s ? {
1206
+ bottom: Xn,
1207
+ height: Ka,
974
1208
  top: "auto",
975
1209
  left: "0",
976
1210
  right: "0"
977
1211
  } : {
978
- left: `${Yr}%`,
979
- width: `${Hn - Yr}%`,
1212
+ left: Xn,
1213
+ width: Ka,
980
1214
  top: "0",
981
1215
  bottom: "0"
982
- }, $a = Math.max(0.01, ze - ke), On = Math.max(0.06, Math.min(0.25, 0.28 * Math.sqrt($a))), Na = u ? { bottom: `${zt}%`, left: "50%", transform: "translate(-50%, 50%)", zIndex: ir ? 40 : 30 } : { left: `${zt}%`, top: "50%", transform: "translate(-50%, -50%)", zIndex: ir ? 40 : 30 }, Ya = u ? { bottom: `${_t}%`, left: "50%", transform: "translate(-50%, 50%)", zIndex: lr ? 40 : 30 } : { left: `${_t}%`, top: "50%", transform: "translate(-50%, -50%)", zIndex: lr ? 40 : 30 }, ka = u ? { bottom: `${ot}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${ot}%`, top: "50%", transform: "translate(-50%, -50%)" }, Fn = de !== null ? re(de) : null, Aa = m !== "hover" && de !== null && (de === he || !K && de === ve), Ca = tt ? oe(b, ae[0]) : Pe, Ea = tt ? oe(b, ae[ae.length - 1]) : Be, Va = o || (fe ? pe <= Ca : K ? he <= R : he <= R && ve <= R), Ia = o || (fe ? Se >= Ea : (K || he >= w) && ve >= w), ct = D ? "micro-point" : "micro-low", xt = o ? "cursor-not-allowed opacity-50" : "cursor-pointer", Un = (i) => {
983
- const c = u ? "vertical" : "horizontal", d = i === "decrease", h = ao[c][i];
984
- return /* @__PURE__ */ p(
985
- "button",
1216
+ }, gi = Math.max(0.01, st - at), ja = Math.max(0.06, Math.min(0.25, 0.28 * Math.sqrt(gi))), hi = s ? { bottom: Xa, left: "50%", transform: "translate(-50%, 50%)", zIndex: Tr ? 40 : 30 } : { left: Xa, top: "50%", transform: "translate(-50%, -50%)", zIndex: Tr ? 40 : 30 }, bi = s ? { bottom: Ga, left: "50%", transform: "translate(-50%, 50%)", zIndex: Pr ? 40 : 30 } : { left: Ga, top: "50%", transform: "translate(-50%, -50%)", zIndex: Pr ? 40 : 30 }, wi = s ? { bottom: `${He}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${He}%`, top: "50%", transform: "translate(-50%, -50%)" }, qa = we !== null ? ce(we) : null, vi = g !== "hover" && we !== null && (we === ve || !ne && we === pe), pi = nt ? Q(b, se[0]) : xe, Mi = nt ? Q(b, se[se.length - 1]) : $e, Di = fe ? Ce > pi : ve > k, xi = fe ? _e < Mi : pe < V, ln = cl(
1217
+ fe ? [
1218
+ {
1219
+ side: A ? "before" : "after",
1220
+ box: fn(Sa, ya),
1221
+ ...s ? { reach: "inline-size" } : { reach: "rotated", angleDeg: rr.slant.lowAngleDeg, centreOffsetPx: null, alongPushPx: rr.slant.lowOffsetX }
1222
+ },
1223
+ {
1224
+ side: A ? "after" : "before",
1225
+ box: H ? In : fn(In, Ta),
1226
+ ...s ? { reach: "inline-size" } : { reach: "rotated", angleDeg: nr.slant.lowAngleDeg, centreOffsetPx: null, alongPushPx: nr.slant.lowOffsetX }
1227
+ }
1228
+ ] : [
1229
+ {
1230
+ // 縦向きのラベルは labelPosition に関わらずスタイルシートが左へ置く
1231
+ side: s || D === "top" ? "before" : "after",
1232
+ box: ne ? Jt : fn(Jt, La),
1233
+ ...s ? { reach: "inline-size" } : { reach: "rotated", angleDeg: yr.lowAngleDeg, centreOffsetPx: yr.lowOffsetY, alongPushPx: yr.lowOffsetX }
1234
+ }
1235
+ ]
1236
+ ), Ri = ln === void 0 ? e.style : { ...e.style, ...ln.style };
1237
+ Cr(() => {
1238
+ Ma.current = ln === void 0 ? 0 : ln.mainPx;
1239
+ });
1240
+ const ut = H ? "micro-point" : "micro-low", _t = l ? "cursor-not-allowed opacity-50" : "cursor-pointer", Za = (o) => {
1241
+ const u = s ? "vertical" : "horizontal", d = o === "decrease", m = s ? !d : d;
1242
+ return /* @__PURE__ */ I(
1243
+ Ut,
986
1244
  {
987
- type: "button",
988
- className: `period-slider-stepper-btn relative after:absolute after:inset-[-11px] after:content-[''] ${h} flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-slate-300 bg-white font-bold text-[10px] text-slate-700 leading-none shadow-2xs transition-all hover:bg-slate-100 hover:text-indigo-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 active:scale-95 disabled:cursor-not-allowed disabled:opacity-30 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 ${xt}`,
989
- onClick: () => pa(d ? -1 : 1),
990
- disabled: d ? Va : Ia,
991
- "aria-label": d ? le : y,
992
- children: no[c][i]
1245
+ ref: d ? Da : xa,
1246
+ neighbour: "rail",
1247
+ direction: ul[u][o],
1248
+ disabled: l,
1249
+ canStep: d ? Di : xi,
1250
+ onStep: () => zn(d ? -1 : 1),
1251
+ ariaLabel: d ? ue : ae,
1252
+ className: `period-slider-stepper-btn ${dl[u][o]} ${wo[u][m ? "leading" : "trailing"]}`
993
1253
  }
994
1254
  );
995
1255
  };
996
- return /* @__PURE__ */ we(
1256
+ return /* @__PURE__ */ Me(
997
1257
  "div",
998
1258
  {
999
- style: e.style,
1000
- className: `period-slider flex select-none items-center gap-2 ${u ? "flex-col" : "flex-row"} ${s}`,
1001
- "data-disabled": o ? "true" : void 0,
1259
+ ref: Mr,
1260
+ style: Ri,
1261
+ className: `period-slider grid select-none place-items-center ${ml[s ? "vertical" : "horizontal"][f ? "withSteppers" : "railOnly"]} ${c}`,
1262
+ "data-disabled": l ? "true" : void 0,
1002
1263
  "data-unit": t,
1003
1264
  "data-mode": e.mode,
1004
- "data-orientation": u ? "vertical" : "horizontal",
1005
- "data-label-position": L,
1006
- "data-color-scheme": J,
1265
+ "data-orientation": s ? "vertical" : "horizontal",
1266
+ "data-label-position": D,
1267
+ "data-color-scheme": ee,
1007
1268
  children: [
1008
- f && Un(u ? "increase" : "decrease"),
1009
- /* @__PURE__ */ p(
1269
+ /* @__PURE__ */ I("div", { ref: pa, "data-range-area": "true", "aria-hidden": "true", className: "period-slider-range-area" }),
1270
+ f && Za(s ? "increase" : "decrease"),
1271
+ /* @__PURE__ */ I(
1010
1272
  "div",
1011
1273
  {
1012
- ref: ht,
1274
+ ref: Xe,
1013
1275
  "data-testid": "period-slider-track",
1014
- "data-orientation": u ? "vertical" : "horizontal",
1015
- "data-vernier-orientation": fe ? At : void 0,
1016
- className: `period-slider-track relative flex-1 touch-none rounded-full bg-slate-200 dark:bg-slate-700 ${u ? "h-48 w-2" : "h-2 w-full"} ${xt}`,
1017
- onPointerDown: Ma,
1018
- onPointerMove: va,
1019
- onPointerLeave: Da,
1020
- children: fe ? /* @__PURE__ */ we(on, { children: [
1021
- Xr && (u ? /* @__PURE__ */ we("svg", { className: "period-slider-vernier-projection is-vertical", role: "presentation", "aria-hidden": "true", width: "32", height: "100%", viewBox: "0 0 32 100", preserveAspectRatio: "none", children: [
1022
- /* @__PURE__ */ p("defs", { children: /* @__PURE__ */ we("linearGradient", { id: A, x1: "0", y1: "0", x2: "1", y2: "0", children: [
1023
- /* @__PURE__ */ p("stop", { offset: "0%", stopColor: Y ? F.macro : F.micro, stopOpacity: "0.28" }),
1024
- /* @__PURE__ */ p("stop", { offset: "100%", stopColor: Y ? F.micro : F.macro, stopOpacity: On })
1276
+ "data-orientation": s ? "vertical" : "horizontal",
1277
+ "data-vernier-orientation": fe ? Nt : void 0,
1278
+ className: `period-slider-track relative touch-none rounded-full ${wo[s ? "vertical" : "horizontal"][f ? "rail" : "railOnly"]} ${_t}`,
1279
+ onPointerDown: Qo,
1280
+ onPointerMove: ei,
1281
+ onPointerLeave: ti,
1282
+ children: fe ? /* @__PURE__ */ Me(jn, { children: [
1283
+ Wt && (s ? /* @__PURE__ */ Me("svg", { className: "period-slider-vernier-projection is-vertical", role: "presentation", "aria-hidden": "true", width: "32", height: "100%", viewBox: "0 0 32 100", preserveAspectRatio: "none", children: [
1284
+ /* @__PURE__ */ I("defs", { children: /* @__PURE__ */ Me("linearGradient", { id: oe, x1: "0", y1: "0", x2: "1", y2: "0", children: [
1285
+ /* @__PURE__ */ I("stop", { offset: "0%", stopColor: A ? W.macro : W.micro, stopOpacity: "0.28" }),
1286
+ /* @__PURE__ */ I("stop", { offset: "100%", stopColor: A ? W.micro : W.macro, stopOpacity: ja })
1025
1287
  ] }) }),
1026
- /* @__PURE__ */ p("polygon", { points: Y ? `12,${(1 - ze) * 100} 12,${(1 - ke) * 100} 20,100 20,0` : `12,0 12,100 20,${(1 - ke) * 100} 20,${(1 - ze) * 100}`, fill: `url(#${A})` })
1027
- ] }) : /* @__PURE__ */ we("svg", { className: "period-slider-vernier-projection", role: "presentation", "aria-hidden": "true", width: "100%", height: "32", viewBox: "0 0 100 32", preserveAspectRatio: "none", children: [
1028
- /* @__PURE__ */ p("defs", { children: /* @__PURE__ */ we("linearGradient", { id: A, x1: "0", y1: "0", x2: "0", y2: "1", children: [
1029
- /* @__PURE__ */ p("stop", { offset: "0%", stopColor: Y ? F.macro : F.micro, stopOpacity: "0.28" }),
1030
- /* @__PURE__ */ p("stop", { offset: "100%", stopColor: Y ? F.micro : F.macro, stopOpacity: On })
1288
+ /* @__PURE__ */ I("path", { ref: $n, "data-testid": "period-slider-vernier-projection", d: Qn(at, st, s, A), fill: `url(#${oe})` })
1289
+ ] }) : /* @__PURE__ */ Me("svg", { className: "period-slider-vernier-projection", role: "presentation", "aria-hidden": "true", width: "100%", height: "32", viewBox: "0 0 100 32", preserveAspectRatio: "none", children: [
1290
+ /* @__PURE__ */ I("defs", { children: /* @__PURE__ */ Me("linearGradient", { id: oe, x1: "0", y1: "0", x2: "0", y2: "1", children: [
1291
+ /* @__PURE__ */ I("stop", { offset: "0%", stopColor: A ? W.macro : W.micro, stopOpacity: "0.28" }),
1292
+ /* @__PURE__ */ I("stop", { offset: "100%", stopColor: A ? W.micro : W.macro, stopOpacity: ja })
1031
1293
  ] }) }),
1032
- /* @__PURE__ */ p("polygon", { points: Y ? `${ke * 100},12 ${ze * 100},12 100,20 0,20` : `0,12 100,12 ${ze * 100},20 ${ke * 100},20`, fill: `url(#${A})` })
1294
+ /* @__PURE__ */ I("path", { ref: $n, "data-testid": "period-slider-vernier-projection", d: Qn(at, st, s, A), fill: `url(#${oe})` })
1033
1295
  ] })),
1034
- !P && /* @__PURE__ */ we(on, { children: [
1035
- /* @__PURE__ */ p(
1296
+ !S && /* @__PURE__ */ Me(jn, { children: [
1297
+ /* @__PURE__ */ I(
1036
1298
  "div",
1037
1299
  {
1038
1300
  "data-testid": "period-slider-connect-macro",
1039
1301
  className: "period-slider-connect-macro",
1040
- style: u ? {
1041
- bottom: `calc(${ke * 100}% - 8px)`,
1042
- height: `calc(${Math.max(0, (ze - ke) * 100)}% + 16px)`
1302
+ style: s ? {
1303
+ bottom: `calc(${ar} - 8px)`,
1304
+ height: `calc(${an} - ${ar} + 16px)`
1043
1305
  } : {
1044
- left: `calc(${ke * 100}% - 8px)`,
1045
- width: `calc(${Math.max(0, (ze - ke) * 100)}% + 16px)`
1306
+ left: `calc(${ar} - 8px)`,
1307
+ width: `calc(${an} - ${ar} + 16px)`
1046
1308
  },
1047
- onPointerDown: Bt("macro-connect")
1309
+ onPointerDown: er("macro-connect")
1048
1310
  }
1049
1311
  ),
1050
- !D && /* @__PURE__ */ p(
1312
+ !H && /* @__PURE__ */ I(
1051
1313
  "div",
1052
1314
  {
1053
1315
  "data-testid": "period-slider-connect-micro",
1054
1316
  className: "period-slider-connect-micro",
1055
- style: u ? {
1056
- bottom: `calc(${Ze * 100}% - 8px)`,
1057
- height: `calc(${Math.max(0, (gt - Ze) * 100)}% + 16px)`
1317
+ style: s ? {
1318
+ bottom: `calc(${or} - 8px)`,
1319
+ height: `calc(${on} - ${or} + 16px)`
1058
1320
  } : {
1059
- left: `calc(${Ze * 100}% - 8px)`,
1060
- width: `calc(${Math.max(0, (gt - Ze) * 100)}% + 16px)`
1321
+ left: `calc(${or} - 8px)`,
1322
+ width: `calc(${on} - ${or} + 16px)`
1061
1323
  },
1062
- onPointerDown: Bt("micro-connect")
1324
+ onPointerDown: er("micro-connect")
1063
1325
  }
1064
1326
  )
1065
1327
  ] }),
1066
- Kr && /* @__PURE__ */ we("div", { className: "period-slider-vernier-ticks pointer-events-none absolute inset-0", children: [
1067
- [0.2, 0.4, 0.6, 0.8].map((i) => /* @__PURE__ */ p("div", { "data-testid": "period-slider-tick", "data-tick-scale": "macro", className: "period-slider-tick period-slider-tick-macro", style: u ? { bottom: `${i * 100}%` } : { left: `${i * 100}%` } }, `macro-tick-${i}`)),
1068
- [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9].map((i) => /* @__PURE__ */ p("div", { "data-testid": "period-slider-tick", "data-tick-scale": "micro", className: "period-slider-tick period-slider-tick-micro", style: u ? { bottom: `${i * 100}%` } : { left: `${i * 100}%` } }, `micro-tick-${i}`))
1328
+ fa && /* @__PURE__ */ Me("div", { className: "period-slider-vernier-ticks pointer-events-none absolute inset-0", children: [
1329
+ [0.2, 0.4, 0.6, 0.8].map((o) => /* @__PURE__ */ I("div", { "data-testid": "period-slider-tick", "data-tick-scale": "macro", className: "period-slider-tick period-slider-tick-macro", style: s ? { bottom: `${o * 100}%` } : { left: `${o * 100}%` } }, `macro-tick-${o}`)),
1330
+ [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9].map((o) => /* @__PURE__ */ I("div", { "data-testid": "period-slider-tick", "data-tick-scale": "micro", className: "period-slider-tick period-slider-tick-micro", style: s ? { bottom: `${o * 100}%` } : { left: `${o * 100}%` } }, `micro-tick-${o}`))
1069
1331
  ] }),
1070
- /* @__PURE__ */ we(
1332
+ /* @__PURE__ */ Me(
1071
1333
  "div",
1072
1334
  {
1073
- tabIndex: o ? -1 : 0,
1335
+ tabIndex: l ? -1 : 0,
1074
1336
  role: "slider",
1075
1337
  "aria-label": e.macroLowerAriaLabel ?? "Macro range start",
1076
- "aria-disabled": o ? "true" : void 0,
1077
- "aria-valuemin": Ke,
1078
- "aria-valuemax": Ue,
1079
- "aria-valuenow": Fe,
1080
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Mr, U) : jt(U, Mr, it, x),
1081
- "aria-orientation": u ? "vertical" : "horizontal",
1082
- className: `period-slider-handle period-slider-handle-vernier ${u ? "is-vertical" : ""} group absolute touch-none ${u ? Y ? "after:absolute after:-inset-y-3 after:right-0 after:-left-4" : "after:absolute after:-inset-y-3 after:-right-4 after:left-0" : Y ? "after:absolute after:-inset-x-3 after:-top-4 after:bottom-0" : "after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${xt}`,
1083
- style: u ? {
1084
- bottom: `${ke * 100}%`,
1085
- left: Y ? 0 : "auto",
1086
- right: Y ? "auto" : 0,
1087
- transform: Y ? "translate(-100%, 50%)" : "translate(100%, 50%)",
1088
- zIndex: Oe === "macro-low" || Ne === "macro-low" ? 30 : 15
1338
+ "aria-disabled": l ? "true" : void 0,
1339
+ "aria-valuemin": Ie,
1340
+ "aria-valuemax": Ye,
1341
+ "aria-valuenow": ke,
1342
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(bt, h) : dr(h, bt, Ur, x),
1343
+ "aria-orientation": s ? "vertical" : "horizontal",
1344
+ className: `period-slider-handle period-slider-handle-vernier ${s ? "is-vertical" : ""} group absolute touch-none ${s ? A ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : A ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1345
+ style: s ? {
1346
+ bottom: ar,
1347
+ left: A ? 0 : "auto",
1348
+ right: A ? "auto" : 0,
1349
+ transform: A ? "translate(-100%, 50%)" : "translate(100%, 50%)",
1350
+ zIndex: We === "macro-low" || Ne === "macro-low" ? 30 : 15
1089
1351
  } : {
1090
- left: `${ke * 100}%`,
1091
- top: Y ? 0 : "auto",
1092
- bottom: Y ? "auto" : 0,
1093
- transform: Y ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
1094
- zIndex: Oe === "macro-low" || Ne === "macro-low" ? 30 : 15
1352
+ left: ar,
1353
+ top: A ? 0 : "auto",
1354
+ bottom: A ? "auto" : 0,
1355
+ transform: A ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
1356
+ zIndex: We === "macro-low" || Ne === "macro-low" ? 30 : 15
1095
1357
  },
1096
- onPointerDown: Bt("macro-low"),
1097
- onKeyDown: Lr("macro-low"),
1098
- onFocus: yr("macro-low"),
1099
- "data-active": Oe === "macro-low" ? "true" : void 0,
1358
+ onPointerDown: er("macro-low"),
1359
+ onKeyDown: en("macro-low"),
1360
+ onFocus: Qr("macro-low"),
1361
+ "data-active": We === "macro-low" ? "true" : void 0,
1100
1362
  "data-front": Ne === "macro-low" ? "true" : void 0,
1101
- "data-vernier-pos": u ? Y ? "left" : "right" : Y ? "top" : "bottom",
1363
+ "data-vernier-pos": s ? A ? "left" : "right" : A ? "top" : "bottom",
1102
1364
  "data-handle-type": "macro-low",
1103
1365
  children: [
1104
- /* @__PURE__ */ p(gr, { type: "macro", isTop: Y, isVertical: u, isLeft: Y }),
1105
- ft && /* @__PURE__ */ p("div", { className: "period-slider-hairline" }),
1106
- m !== "hover" && /* @__PURE__ */ p(
1366
+ /* @__PURE__ */ I(Yr, { type: "macro", isTop: A, isVertical: s, isLeft: A }),
1367
+ w && /* @__PURE__ */ I("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1368
+ g !== "hover" && /* @__PURE__ */ I(
1107
1369
  "div",
1108
1370
  {
1109
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${m === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1110
- "data-tooltip-style": m,
1111
- "data-duplicate": xa ? "true" : void 0,
1112
- "data-slanted": $r.slant.isSlanted ? "true" : void 0,
1113
- ref: fa,
1114
- style: $r.lowStyle,
1115
- children: je(U, Mr, it, x)
1371
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1372
+ "data-tooltip-style": g,
1373
+ "data-duplicate": ni ? "true" : void 0,
1374
+ "data-slanted": rr.slant.isSlanted ? "true" : void 0,
1375
+ ref: Bo,
1376
+ style: rr.lowStyle,
1377
+ children: Ke(h, bt, Ur, x)
1116
1378
  }
1117
1379
  )
1118
1380
  ]
1119
1381
  }
1120
1382
  ),
1121
- /* @__PURE__ */ we(
1383
+ /* @__PURE__ */ Me(
1122
1384
  "div",
1123
1385
  {
1124
- tabIndex: o ? -1 : 0,
1386
+ tabIndex: l ? -1 : 0,
1125
1387
  role: "slider",
1126
1388
  "aria-label": e.macroUpperAriaLabel ?? "Macro range end",
1127
- "aria-disabled": o ? "true" : void 0,
1128
- "aria-valuemin": Fe,
1129
- "aria-valuemax": Vt,
1130
- "aria-valuenow": Ue,
1131
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(vr, U) : jt(U, vr, it, x),
1132
- "aria-orientation": u ? "vertical" : "horizontal",
1133
- className: `period-slider-handle period-slider-handle-vernier ${u ? "is-vertical" : ""} group absolute touch-none ${u ? Y ? "after:absolute after:-inset-y-3 after:right-0 after:-left-4" : "after:absolute after:-inset-y-3 after:-right-4 after:left-0" : Y ? "after:absolute after:-inset-x-3 after:-top-4 after:bottom-0" : "after:absolute after:-inset-x-3 after:top-0 after:-bottom-4"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${xt}`,
1134
- style: u ? {
1135
- bottom: `${ze * 100}%`,
1136
- left: Y ? 0 : "auto",
1137
- right: Y ? "auto" : 0,
1138
- transform: Y ? "translate(-100%, 50%)" : "translate(100%, 50%)",
1139
- zIndex: Oe === "macro-high" || Ne === "macro-high" ? 30 : 15
1389
+ "aria-disabled": l ? "true" : void 0,
1390
+ "aria-valuemin": ke,
1391
+ "aria-valuemax": Ze,
1392
+ "aria-valuenow": Ye,
1393
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(kt, h) : dr(h, kt, Ur, x),
1394
+ "aria-orientation": s ? "vertical" : "horizontal",
1395
+ className: `period-slider-handle period-slider-handle-vernier ${s ? "is-vertical" : ""} group absolute touch-none ${s ? A ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : A ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1396
+ style: s ? {
1397
+ bottom: an,
1398
+ left: A ? 0 : "auto",
1399
+ right: A ? "auto" : 0,
1400
+ transform: A ? "translate(-100%, 50%)" : "translate(100%, 50%)",
1401
+ zIndex: We === "macro-high" || Ne === "macro-high" ? 30 : 15
1140
1402
  } : {
1141
- left: `${ze * 100}%`,
1142
- top: Y ? 0 : "auto",
1143
- bottom: Y ? "auto" : 0,
1144
- transform: Y ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
1145
- zIndex: Oe === "macro-high" || Ne === "macro-high" ? 30 : 15
1403
+ left: an,
1404
+ top: A ? 0 : "auto",
1405
+ bottom: A ? "auto" : 0,
1406
+ transform: A ? "translate(-50%, -100%)" : "translate(-50%, 100%)",
1407
+ zIndex: We === "macro-high" || Ne === "macro-high" ? 30 : 15
1146
1408
  },
1147
- onPointerDown: Bt("macro-high"),
1148
- onKeyDown: Lr("macro-high"),
1149
- onFocus: yr("macro-high"),
1150
- "data-active": Oe === "macro-high" ? "true" : void 0,
1409
+ onPointerDown: er("macro-high"),
1410
+ onKeyDown: en("macro-high"),
1411
+ onFocus: Qr("macro-high"),
1412
+ "data-active": We === "macro-high" ? "true" : void 0,
1151
1413
  "data-front": Ne === "macro-high" ? "true" : void 0,
1152
- "data-vernier-pos": u ? Y ? "left" : "right" : Y ? "top" : "bottom",
1414
+ "data-vernier-pos": s ? A ? "left" : "right" : A ? "top" : "bottom",
1153
1415
  "data-handle-type": "macro-high",
1154
1416
  children: [
1155
- /* @__PURE__ */ p(gr, { type: "macro", isTop: Y, isVertical: u, isLeft: Y }),
1156
- ft && /* @__PURE__ */ p("div", { className: "period-slider-hairline" }),
1157
- m !== "hover" && /* @__PURE__ */ p(
1417
+ /* @__PURE__ */ I(Yr, { type: "macro", isTop: A, isVertical: s, isLeft: A }),
1418
+ w && /* @__PURE__ */ I("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1419
+ g !== "hover" && /* @__PURE__ */ I(
1158
1420
  "div",
1159
1421
  {
1160
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${m === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1161
- "data-tooltip-style": m,
1162
- "data-duplicate": ya ? "true" : void 0,
1163
- "data-slanted": $r.slant.isSlanted ? "true" : void 0,
1164
- ref: ga,
1165
- style: $r.highStyle,
1166
- children: je(U, vr, it, x)
1422
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1423
+ "data-tooltip-style": g,
1424
+ "data-duplicate": ai ? "true" : void 0,
1425
+ "data-slanted": rr.slant.isSlanted ? "true" : void 0,
1426
+ ref: Uo,
1427
+ style: rr.highStyle,
1428
+ children: Ke(h, kt, Ur, x)
1167
1429
  }
1168
1430
  )
1169
1431
  ]
1170
1432
  }
1171
1433
  ),
1172
- /* @__PURE__ */ we(
1434
+ /* @__PURE__ */ Me(
1173
1435
  "div",
1174
1436
  {
1175
- tabIndex: o ? -1 : 0,
1437
+ tabIndex: l ? -1 : 0,
1176
1438
  role: "slider",
1177
- "aria-label": D ? e.pointAriaLabel ?? "Micro selected date" : e.lowerAriaLabel ?? "Micro range start",
1178
- "aria-disabled": o ? "true" : void 0,
1179
- "aria-valuemin": Pe,
1180
- "aria-valuemax": D ? Be : Se,
1181
- "aria-valuenow": pe,
1182
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Dt, b) : jt(b, Dt, Je, x),
1183
- "aria-orientation": u ? "vertical" : "horizontal",
1184
- className: `period-slider-handle period-slider-handle-vernier ${u ? "is-vertical" : ""} group absolute touch-none ${u ? Y ? "after:absolute after:-inset-y-3 after:-right-4 after:left-0" : "after:absolute after:-inset-y-3 after:right-0 after:-left-4" : Y ? "after:absolute after:-inset-x-3 after:top-0 after:-bottom-4" : "after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${xt}`,
1185
- style: u ? {
1186
- bottom: `${Ze * 100}%`,
1187
- left: Y ? "auto" : 0,
1188
- right: Y ? 0 : "auto",
1189
- transform: Y ? "translate(100%, 50%)" : "translate(-100%, 50%)",
1190
- zIndex: Oe === ct || Ne === ct ? 30 : 20
1439
+ "aria-label": H ? e.pointAriaLabel ?? "Micro selected date" : e.lowerAriaLabel ?? "Micro range start",
1440
+ "aria-disabled": l ? "true" : void 0,
1441
+ "aria-valuemin": xe,
1442
+ "aria-valuemax": H ? $e : _e,
1443
+ "aria-valuenow": Ce,
1444
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(St, b) : dr(b, St, Wr, x),
1445
+ "aria-orientation": s ? "vertical" : "horizontal",
1446
+ className: `period-slider-handle period-slider-handle-vernier ${s ? "is-vertical" : ""} group absolute touch-none ${s ? A ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : A ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1447
+ style: s ? {
1448
+ bottom: or,
1449
+ left: A ? "auto" : 0,
1450
+ right: A ? 0 : "auto",
1451
+ transform: A ? "translate(100%, 50%)" : "translate(-100%, 50%)",
1452
+ zIndex: We === ut || Ne === ut ? 30 : 20
1191
1453
  } : {
1192
- left: `${Ze * 100}%`,
1193
- top: Y ? "auto" : 0,
1194
- bottom: Y ? 0 : "auto",
1195
- transform: Y ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
1196
- zIndex: Oe === ct || Ne === ct ? 30 : 20
1454
+ left: or,
1455
+ top: A ? "auto" : 0,
1456
+ bottom: A ? 0 : "auto",
1457
+ transform: A ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
1458
+ zIndex: We === ut || Ne === ut ? 30 : 20
1197
1459
  },
1198
- onPointerDown: Bt(ct),
1199
- onKeyDown: Lr(ct),
1200
- onFocus: yr(ct),
1201
- "data-active": Oe === ct ? "true" : void 0,
1202
- "data-front": Ne === ct ? "true" : void 0,
1203
- "data-vernier-pos": u ? Y ? "right" : "left" : Y ? "bottom" : "top",
1204
- "data-handle-type": ct,
1460
+ onPointerDown: er(ut),
1461
+ onKeyDown: en(ut),
1462
+ onFocus: Qr(ut),
1463
+ "data-active": We === ut ? "true" : void 0,
1464
+ "data-front": Ne === ut ? "true" : void 0,
1465
+ "data-vernier-pos": s ? A ? "right" : "left" : A ? "bottom" : "top",
1466
+ "data-handle-type": ut,
1205
1467
  children: [
1206
- /* @__PURE__ */ p(gr, { type: "micro", isTop: !Y, isVertical: u, isLeft: !Y }),
1207
- ft && /* @__PURE__ */ p("div", { className: "period-slider-hairline" }),
1208
- m !== "hover" && /* @__PURE__ */ p(
1468
+ /* @__PURE__ */ I(Yr, { type: "micro", isTop: !A, isVertical: s, isLeft: !A }),
1469
+ w && /* @__PURE__ */ I("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1470
+ g !== "hover" && /* @__PURE__ */ I(
1209
1471
  "div",
1210
1472
  {
1211
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${m === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1212
- "data-tooltip-style": m,
1213
- "data-duplicate": Ta ? "true" : void 0,
1214
- "data-slanted": Nr.slant.isSlanted ? "true" : void 0,
1215
- ref: ha,
1216
- style: Nr.lowStyle,
1217
- children: je(b, Dt, Je, x)
1473
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1474
+ "data-tooltip-style": g,
1475
+ "data-duplicate": oi ? "true" : void 0,
1476
+ "data-slanted": nr.slant.isSlanted ? "true" : void 0,
1477
+ ref: Wo,
1478
+ style: nr.lowStyle,
1479
+ children: Ke(b, St, Wr, x)
1218
1480
  }
1219
1481
  )
1220
1482
  ]
1221
1483
  }
1222
1484
  ),
1223
- !D && /* @__PURE__ */ we(
1485
+ !H && /* @__PURE__ */ Me(
1224
1486
  "div",
1225
1487
  {
1226
- tabIndex: o ? -1 : 0,
1488
+ tabIndex: l ? -1 : 0,
1227
1489
  role: "slider",
1228
1490
  "aria-label": e.upperAriaLabel ?? "Micro range end",
1229
- "aria-disabled": o ? "true" : void 0,
1230
- "aria-valuemin": pe,
1231
- "aria-valuemax": Be,
1232
- "aria-valuenow": Se,
1233
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(pt, b) : jt(b, pt, Je, x),
1234
- "aria-orientation": u ? "vertical" : "horizontal",
1235
- className: `period-slider-handle period-slider-handle-vernier ${u ? "is-vertical" : ""} group absolute touch-none ${u ? Y ? "after:absolute after:-inset-y-3 after:-right-4 after:left-0" : "after:absolute after:-inset-y-3 after:right-0 after:-left-4" : Y ? "after:absolute after:-inset-x-3 after:top-0 after:-bottom-4" : "after:absolute after:-inset-x-3 after:-top-4 after:bottom-0"} after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 ${xt}`,
1236
- style: u ? {
1237
- bottom: `${gt * 100}%`,
1238
- left: Y ? "auto" : 0,
1239
- right: Y ? 0 : "auto",
1240
- transform: Y ? "translate(100%, 50%)" : "translate(-100%, 50%)",
1241
- zIndex: Oe === "micro-high" || Ne === "micro-high" ? 30 : 20
1491
+ "aria-disabled": l ? "true" : void 0,
1492
+ "aria-valuemin": Ce,
1493
+ "aria-valuemax": $e,
1494
+ "aria-valuenow": _e,
1495
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(yt, b) : dr(b, yt, Wr, x),
1496
+ "aria-orientation": s ? "vertical" : "horizontal",
1497
+ className: `period-slider-handle period-slider-handle-vernier ${s ? "is-vertical" : ""} group absolute touch-none ${s ? A ? "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:-right-4 after:left-0" : "after:absolute after:inset-y-[calc((100%-var(--ps-target-size))/2)] after:right-0 after:-left-4" : A ? "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:top-0 after:-bottom-4" : "after:absolute after:inset-x-[calc((100%-var(--ps-target-size))/2)] after:-top-4 after:bottom-0"} after:content-[''] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-600 focus-visible:ring-offset-2 dark:focus-visible:ring-blue-400 ${_t}`,
1498
+ style: s ? {
1499
+ bottom: on,
1500
+ left: A ? "auto" : 0,
1501
+ right: A ? 0 : "auto",
1502
+ transform: A ? "translate(100%, 50%)" : "translate(-100%, 50%)",
1503
+ zIndex: We === "micro-high" || Ne === "micro-high" ? 30 : 20
1242
1504
  } : {
1243
- left: `${gt * 100}%`,
1244
- top: Y ? "auto" : 0,
1245
- bottom: Y ? 0 : "auto",
1246
- transform: Y ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
1247
- zIndex: Oe === "micro-high" || Ne === "micro-high" ? 30 : 20
1505
+ left: on,
1506
+ top: A ? "auto" : 0,
1507
+ bottom: A ? 0 : "auto",
1508
+ transform: A ? "translate(-50%, 100%)" : "translate(-50%, -100%)",
1509
+ zIndex: We === "micro-high" || Ne === "micro-high" ? 30 : 20
1248
1510
  },
1249
- onPointerDown: Bt("micro-high"),
1250
- onKeyDown: Lr("micro-high"),
1251
- onFocus: yr("micro-high"),
1252
- "data-active": Oe === "micro-high" ? "true" : void 0,
1511
+ onPointerDown: er("micro-high"),
1512
+ onKeyDown: en("micro-high"),
1513
+ onFocus: Qr("micro-high"),
1514
+ "data-active": We === "micro-high" ? "true" : void 0,
1253
1515
  "data-front": Ne === "micro-high" ? "true" : void 0,
1254
- "data-vernier-pos": u ? Y ? "right" : "left" : Y ? "bottom" : "top",
1516
+ "data-vernier-pos": s ? A ? "right" : "left" : A ? "bottom" : "top",
1255
1517
  "data-handle-type": "micro-high",
1256
1518
  children: [
1257
- /* @__PURE__ */ p(gr, { type: "micro", isTop: !Y, isVertical: u, isLeft: !Y }),
1258
- ft && /* @__PURE__ */ p("div", { className: "period-slider-hairline" }),
1259
- m !== "hover" && /* @__PURE__ */ p(
1519
+ /* @__PURE__ */ I(Yr, { type: "micro", isTop: !A, isVertical: s, isLeft: !A }),
1520
+ w && /* @__PURE__ */ I("div", { "data-testid": "period-slider-hairline", className: "period-slider-hairline" }),
1521
+ g !== "hover" && /* @__PURE__ */ I(
1260
1522
  "div",
1261
1523
  {
1262
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${m === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1263
- "data-tooltip-style": m,
1264
- "data-duplicate": La ? "true" : void 0,
1265
- "data-slanted": Nr.slant.isSlanted ? "true" : void 0,
1266
- ref: ba,
1267
- style: Nr.highStyle,
1268
- children: je(b, pt, Je, x)
1524
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1525
+ "data-tooltip-style": g,
1526
+ "data-duplicate": ii ? "true" : void 0,
1527
+ "data-slanted": nr.slant.isSlanted ? "true" : void 0,
1528
+ ref: Xo,
1529
+ style: nr.highStyle,
1530
+ children: Ke(b, yt, Wr, x)
1269
1531
  }
1270
1532
  )
1271
1533
  ]
1272
1534
  }
1273
1535
  )
1274
- ] }) : /* @__PURE__ */ we(on, { children: [
1275
- !P && /* @__PURE__ */ p("div", { "data-testid": "period-slider-connect", className: "period-slider-connect absolute rounded-full", style: Pa, onPointerDown: wa }),
1276
- E && $ && v.length > 1 && /* @__PURE__ */ p("div", { className: "period-slider-ticks pointer-events-none absolute inset-0", children: v.map((i, c) => {
1277
- const d = oe(t, i), h = Dr(c), S = u ? { bottom: `${h}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${h}%`, top: "50%", transform: "translate(-50%, -50%)" };
1278
- return /* @__PURE__ */ p("div", { "data-testid": "period-slider-tick", className: "period-slider-tick absolute h-1.5 w-1.5 rounded-full bg-slate-400/60 dark:bg-slate-500/60", style: S }, `tick-${d}`);
1536
+ ] }) : /* @__PURE__ */ Me(jn, { children: [
1537
+ !S && /* @__PURE__ */ I("div", { "data-testid": "period-slider-connect", className: "period-slider-connect absolute rounded-full", style: fi, onPointerDown: Jo }),
1538
+ Z && T && L.length > 1 && /* @__PURE__ */ I("div", { className: "period-slider-ticks pointer-events-none absolute inset-0", children: L.map((o, u) => {
1539
+ const d = Q(t, o), m = Ot(u), M = s ? { bottom: `${m}%`, left: "50%", transform: "translate(-50%, 50%)" } : { left: `${m}%`, top: "50%", transform: "translate(-50%, -50%)" };
1540
+ return /* @__PURE__ */ I("div", { "data-testid": "period-slider-tick", className: "period-slider-tick absolute h-1.5 w-1.5 rounded-full", style: M }, `tick-${d}`);
1279
1541
  }) }),
1280
- !o && de !== null && ot !== null && ie === null && Fn && /* @__PURE__ */ we("div", { "data-testid": "period-slider-hover-guide", className: "period-slider-hover-guide pointer-events-none absolute h-2 w-2", style: ka, children: [
1281
- /* @__PURE__ */ p("div", { "data-testid": "period-slider-hover-dot", className: "period-slider-hover-dot h-full w-full rounded-full border border-white/80 bg-[var(--aqps-accent-light)] shadow-[0_0_6px_var(--aqps-accent-glow)] dark:border-slate-800" }),
1282
- /* @__PURE__ */ p(
1542
+ !l && we !== null && He !== null && v === null && qa && /* @__PURE__ */ Me("div", { "data-testid": "period-slider-hover-guide", className: "period-slider-hover-guide pointer-events-none absolute h-2 w-2", style: wi, children: [
1543
+ /* @__PURE__ */ I("div", { "data-testid": "period-slider-hover-dot", className: "period-slider-hover-dot h-full w-full rounded-full border border-white/80 bg-[var(--aqps-accent-light)] shadow-[0_0_6px_var(--aqps-accent-glow)] dark:border-slate-800" }),
1544
+ /* @__PURE__ */ I(
1283
1545
  "div",
1284
1546
  {
1285
1547
  "data-testid": "period-slider-hover-tooltip",
1286
- "data-duplicate": Aa ? "true" : void 0,
1287
- className: `period-slider-hover-tooltip ${L === "bottom" && !u ? "period-slider-hover-tooltip-bottom" : ""} rounded bg-slate-800/90 px-2 py-0.5 font-medium text-white text-xs shadow-lg backdrop-blur-xs dark:bg-slate-900/90`,
1288
- children: je(t, Fn, e.formatLabel, x)
1548
+ "data-duplicate": vi ? "true" : void 0,
1549
+ className: `period-slider-hover-tooltip ${D === "bottom" && !s ? "period-slider-hover-tooltip-bottom" : ""} rounded bg-slate-800/90 px-2 py-0.5 font-medium text-white text-xs shadow-lg backdrop-blur-xs dark:bg-slate-900/90`,
1550
+ children: Ke(t, qa, e.formatLabel, x)
1289
1551
  }
1290
1552
  )
1291
1553
  ] }),
1292
- /* @__PURE__ */ we(
1554
+ /* @__PURE__ */ Me(
1293
1555
  "div",
1294
1556
  {
1295
- tabIndex: o ? -1 : 0,
1557
+ tabIndex: l ? -1 : 0,
1296
1558
  role: "slider",
1297
- "aria-label": K ? e.pointAriaLabel ?? "Selected date" : e.lowerAriaLabel ?? "Range start",
1298
- "aria-disabled": o ? "true" : void 0,
1299
- "aria-valuemin": R,
1300
- "aria-valuemax": K ? w : ve,
1301
- "aria-valuenow": he,
1302
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(tn, t) : jt(t, tn, e.formatLabel, x),
1303
- "aria-orientation": u ? "vertical" : "horizontal",
1304
- className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${xt}`,
1305
- style: Na,
1306
- onPointerDown: Nn("low"),
1307
- onKeyDown: kn("low"),
1308
- onFocus: Yn("low"),
1309
- "data-active": ie === "low" ? "true" : void 0,
1310
- "data-front": ir ? "true" : void 0,
1559
+ "aria-label": ne ? e.pointAriaLabel ?? "Selected date" : e.lowerAriaLabel ?? "Range start",
1560
+ "aria-disabled": l ? "true" : void 0,
1561
+ "aria-valuemin": k,
1562
+ "aria-valuemax": ne ? V : pe,
1563
+ "aria-valuenow": ve,
1564
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Bn, t) : dr(t, Bn, e.formatLabel, x),
1565
+ "aria-orientation": s ? "vertical" : "horizontal",
1566
+ className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${_t}`,
1567
+ style: hi,
1568
+ onPointerDown: Oa("low"),
1569
+ onKeyDown: _a("low"),
1570
+ onFocus: Ha("low"),
1571
+ "data-active": v === "low" ? "true" : void 0,
1572
+ "data-front": Tr ? "true" : void 0,
1311
1573
  children: [
1312
- /* @__PURE__ */ p(
1574
+ /* @__PURE__ */ I(
1313
1575
  "div",
1314
1576
  {
1315
1577
  "data-testid": "period-slider-knob",
1316
- className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${ie === "low" ? "" : "shadow-md"}`
1578
+ className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] dark:group-focus-visible:ring-blue-400 ${v === "low" ? "" : "shadow-md"}`
1317
1579
  }
1318
1580
  ),
1319
- m !== "hover" && /* @__PURE__ */ p(
1581
+ g !== "hover" && /* @__PURE__ */ I(
1320
1582
  "div",
1321
1583
  {
1322
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${m === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1323
- "data-tooltip-style": m,
1324
- "data-label-position": L,
1325
- "data-slanted": _e.isSlanted ? "true" : void 0,
1326
- "data-front": ir ? "true" : void 0,
1327
- "data-duplicate": Rr && !ir ? "true" : void 0,
1328
- ref: da,
1329
- style: Ra,
1330
- children: je(t, tn, e.formatLabel, x)
1584
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1585
+ "data-tooltip-style": g,
1586
+ "data-label-position": D,
1587
+ "data-slanted": yr.isSlanted ? "true" : void 0,
1588
+ "data-front": Tr ? "true" : void 0,
1589
+ "data-duplicate": Cn && !Tr ? "true" : void 0,
1590
+ ref: Fo,
1591
+ style: Wn.lowStyle,
1592
+ children: Ke(t, Bn, e.formatLabel, x)
1331
1593
  }
1332
1594
  )
1333
1595
  ]
1334
1596
  }
1335
1597
  ),
1336
- !K && /* @__PURE__ */ we(
1598
+ !ne && /* @__PURE__ */ Me(
1337
1599
  "div",
1338
1600
  {
1339
- tabIndex: o ? -1 : 0,
1601
+ tabIndex: l ? -1 : 0,
1340
1602
  role: "slider",
1341
1603
  "aria-label": e.upperAriaLabel ?? "Range end",
1342
- "aria-disabled": o ? "true" : void 0,
1343
- "aria-valuemin": he,
1344
- "aria-valuemax": w,
1345
- "aria-valuenow": ve,
1346
- "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(rn, t) : jt(t, rn, e.formatLabel, x),
1347
- "aria-orientation": u ? "vertical" : "horizontal",
1348
- className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:outline-none ${xt}`,
1349
- style: Ya,
1350
- onPointerDown: Nn("high"),
1351
- onKeyDown: kn("high"),
1352
- onFocus: Yn("high"),
1353
- "data-active": ie === "high" ? "true" : void 0,
1354
- "data-front": lr ? "true" : void 0,
1604
+ "aria-disabled": l ? "true" : void 0,
1605
+ "aria-valuemin": ve,
1606
+ "aria-valuemax": V,
1607
+ "aria-valuenow": pe,
1608
+ "aria-valuetext": e.formatAriaValueText ? e.formatAriaValueText(Un, t) : dr(t, Un, e.formatLabel, x),
1609
+ "aria-orientation": s ? "vertical" : "horizontal",
1610
+ className: `period-slider-handle group absolute h-4 w-4 touch-none after:absolute after:inset-[calc((100%-var(--ps-target-size))/2)] after:content-[''] focus-visible:outline-hidden ${_t}`,
1611
+ style: bi,
1612
+ onPointerDown: Oa("high"),
1613
+ onKeyDown: _a("high"),
1614
+ onFocus: Ha("high"),
1615
+ "data-active": v === "high" ? "true" : void 0,
1616
+ "data-front": Pr ? "true" : void 0,
1355
1617
  children: [
1356
- /* @__PURE__ */ p(
1618
+ /* @__PURE__ */ I(
1357
1619
  "div",
1358
1620
  {
1359
1621
  "data-testid": "period-slider-knob",
1360
- className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] ${ie === "high" ? "" : "shadow-md"}`
1622
+ className: `period-slider-knob h-full w-full rounded-full border-2 border-white bg-[var(--aqps-accent-color)] group-focus-visible:ring-2 group-focus-visible:ring-blue-600 group-focus-visible:ring-offset-2 dark:border-slate-800 dark:bg-[var(--aqps-accent-light)] dark:group-focus-visible:ring-blue-400 ${v === "high" ? "" : "shadow-md"}`
1361
1623
  }
1362
1624
  ),
1363
- m !== "hover" && /* @__PURE__ */ p(
1625
+ g !== "hover" && /* @__PURE__ */ I(
1364
1626
  "div",
1365
1627
  {
1366
- className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${m === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1367
- "data-tooltip-style": m,
1368
- "data-label-position": L,
1369
- "data-slanted": _e.isSlanted ? "true" : void 0,
1370
- "data-front": lr ? "true" : void 0,
1371
- "data-duplicate": Rr && !lr ? "true" : void 0,
1372
- ref: ma,
1373
- style: Sa,
1374
- children: je(t, rn, e.formatLabel, x)
1628
+ className: `period-slider-tooltip absolute whitespace-nowrap font-medium shadow-md ${g === "balloon" ? "period-slider-tooltip-balloon" : ""}`,
1629
+ "data-tooltip-style": g,
1630
+ "data-label-position": D,
1631
+ "data-slanted": yr.isSlanted ? "true" : void 0,
1632
+ "data-front": Pr ? "true" : void 0,
1633
+ "data-duplicate": Cn && !Pr ? "true" : void 0,
1634
+ ref: zo,
1635
+ style: Wn.highStyle,
1636
+ children: Ke(t, Un, e.formatLabel, x)
1375
1637
  }
1376
1638
  )
1377
1639
  ]
@@ -1380,17 +1642,17 @@ const Qa = (e, t) => {
1380
1642
  ] })
1381
1643
  }
1382
1644
  ),
1383
- f && Un(u ? "decrease" : "increase")
1645
+ f && Za(s ? "decrease" : "increase")
1384
1646
  ]
1385
1647
  }
1386
1648
  );
1387
- }, un = (e, t) => {
1649
+ }, ia = (e, t) => {
1388
1650
  if (e === t) return !0;
1389
1651
  if (!(e && t) || e.length !== t.length) return !1;
1390
1652
  for (let r = 0; r < e.length; r++)
1391
1653
  if (e[r].getTime() !== t[r].getTime()) return !1;
1392
1654
  return !0;
1393
- }, io = (e, t) => {
1655
+ }, gl = (e, t) => {
1394
1656
  if (e === t) return !0;
1395
1657
  if (!(e && t)) return !1;
1396
1658
  const r = Object.keys(e), n = Object.keys(t);
@@ -1398,270 +1660,250 @@ const Qa = (e, t) => {
1398
1660
  for (const a of r)
1399
1661
  if (e[a] !== t[a]) return !1;
1400
1662
  return !0;
1401
- }, lo = (e, t) => e === t ? !0 : e.mode !== t.mode || e.unit !== t.unit || e.minDate.getTime() !== t.minDate.getTime() || e.maxDate.getTime() !== t.maxDate.getTime() || e.labelPosition !== t.labelPosition || e.autoSlantLabels !== t.autoSlantLabels || e.isVertical !== t.isVertical || e.hideConnectBar !== t.hideConnectBar || e.showTicks !== t.showTicks || e.disabled !== t.disabled || e.showStepper !== t.showStepper || e.debounceMs !== t.debounceMs || e.tooltipStyle !== t.tooltipStyle || e.colorScheme !== t.colorScheme || e.className !== t.className || !io(e.style, t.style) || e.snapMode !== t.snapMode || e.formatLabel !== t.formatLabel || e.locale !== t.locale || e.lowerAriaLabel !== t.lowerAriaLabel || e.upperAriaLabel !== t.upperAriaLabel || e.pointAriaLabel !== t.pointAriaLabel || e.macroLowerAriaLabel !== t.macroLowerAriaLabel || e.macroUpperAriaLabel !== t.macroUpperAriaLabel || e.decreaseAriaLabel !== t.decreaseAriaLabel || e.increaseAriaLabel !== t.increaseAriaLabel || e.formatAriaValueText !== t.formatAriaValueText || !un(e.allowedDates, t.allowedDates) ? !1 : e.mode === "point" && t.mode === "point" ? !((e.value?.getTime() ?? null) !== (t.value?.getTime() ?? null) || (e.defaultValue?.getTime() ?? null) !== (t.defaultValue?.getTime() ?? null) || e.onChangePoint !== t.onChangePoint) : e.mode === "range" && t.mode === "range" ? !((e.range?.[0]?.getTime() ?? null) !== (t.range?.[0]?.getTime() ?? null) || (e.range?.[1]?.getTime() ?? null) !== (t.range?.[1]?.getTime() ?? null) || (e.defaultRange?.[0]?.getTime() ?? null) !== (t.defaultRange?.[0]?.getTime() ?? null) || (e.defaultRange?.[1]?.getTime() ?? null) !== (t.defaultRange?.[1]?.getTime() ?? null) || e.onChangeRange !== t.onChangeRange) : e.mode === "vernier" && t.mode === "vernier" ? !((e.microRange?.[0]?.getTime() ?? null) !== (t.microRange?.[0]?.getTime() ?? null) || (e.microRange?.[1]?.getTime() ?? null) !== (t.microRange?.[1]?.getTime() ?? null) || (e.defaultMicroRange?.[0]?.getTime() ?? null) !== (t.defaultMicroRange?.[0]?.getTime() ?? null) || (e.defaultMicroRange?.[1]?.getTime() ?? null) !== (t.defaultMicroRange?.[1]?.getTime() ?? null) || (e.microValue?.getTime() ?? null) !== (t.microValue?.getTime() ?? null) || (e.defaultMicroValue?.getTime() ?? null) !== (t.defaultMicroValue?.getTime() ?? null) || e.macroRange[0].getTime() !== t.macroRange[0].getTime() || e.macroRange[1].getTime() !== t.macroRange[1].getTime() || e.vernierOrientation !== t.vernierOrientation || e.showVernierProjection !== t.showVernierProjection || e.showVernierTicks !== t.showVernierTicks || e.showHairline !== t.showHairline || e.macroUnit !== t.macroUnit || e.microUnit !== t.microUnit || e.macroIsDiscrete !== t.macroIsDiscrete || e.microIsDiscrete !== t.microIsDiscrete || e.formatMacroLabel !== t.formatMacroLabel || e.formatMicroLabel !== t.formatMicroLabel || e.onChangeMicroRange !== t.onChangeMicroRange || e.onChangeMicroPoint !== t.onChangeMicroPoint || e.onChangeMacroRange !== t.onChangeMacroRange || !un(e.macroAllowedDates, t.macroAllowedDates) || !un(e.microAllowedDates, t.microAllowedDates)) : !1, so = br(oo, lo);
1402
- so.displayName = "PeriodSlider";
1403
- const dt = (e) => {
1663
+ }, hl = (e, t) => e === t ? !0 : e.mode !== t.mode || e.unit !== t.unit || e.minDate.getTime() !== t.minDate.getTime() || e.maxDate.getTime() !== t.maxDate.getTime() || e.labelPosition !== t.labelPosition || e.autoSlantLabels !== t.autoSlantLabels || e.isVertical !== t.isVertical || e.hideConnectBar !== t.hideConnectBar || e.showTicks !== t.showTicks || e.disabled !== t.disabled || e.showStepper !== t.showStepper || e.debounceMs !== t.debounceMs || e.tooltipStyle !== t.tooltipStyle || e.colorScheme !== t.colorScheme || e.className !== t.className || !gl(e.style, t.style) || e.snapMode !== t.snapMode || e.formatLabel !== t.formatLabel || e.locale !== t.locale || e.lowerAriaLabel !== t.lowerAriaLabel || e.upperAriaLabel !== t.upperAriaLabel || e.pointAriaLabel !== t.pointAriaLabel || e.macroLowerAriaLabel !== t.macroLowerAriaLabel || e.macroUpperAriaLabel !== t.macroUpperAriaLabel || e.decreaseAriaLabel !== t.decreaseAriaLabel || e.increaseAriaLabel !== t.increaseAriaLabel || e.formatAriaValueText !== t.formatAriaValueText || !ia(e.allowedDates, t.allowedDates) ? !1 : e.mode === "point" && t.mode === "point" ? !((e.value?.getTime() ?? null) !== (t.value?.getTime() ?? null) || (e.defaultValue?.getTime() ?? null) !== (t.defaultValue?.getTime() ?? null) || e.onChangePoint !== t.onChangePoint) : e.mode === "range" && t.mode === "range" ? !((e.range?.[0]?.getTime() ?? null) !== (t.range?.[0]?.getTime() ?? null) || (e.range?.[1]?.getTime() ?? null) !== (t.range?.[1]?.getTime() ?? null) || (e.defaultRange?.[0]?.getTime() ?? null) !== (t.defaultRange?.[0]?.getTime() ?? null) || (e.defaultRange?.[1]?.getTime() ?? null) !== (t.defaultRange?.[1]?.getTime() ?? null) || e.onChangeRange !== t.onChangeRange) : e.mode === "vernier" && t.mode === "vernier" ? !((e.microRange?.[0]?.getTime() ?? null) !== (t.microRange?.[0]?.getTime() ?? null) || (e.microRange?.[1]?.getTime() ?? null) !== (t.microRange?.[1]?.getTime() ?? null) || (e.defaultMicroRange?.[0]?.getTime() ?? null) !== (t.defaultMicroRange?.[0]?.getTime() ?? null) || (e.defaultMicroRange?.[1]?.getTime() ?? null) !== (t.defaultMicroRange?.[1]?.getTime() ?? null) || (e.microValue?.getTime() ?? null) !== (t.microValue?.getTime() ?? null) || (e.defaultMicroValue?.getTime() ?? null) !== (t.defaultMicroValue?.getTime() ?? null) || e.macroRange[0].getTime() !== t.macroRange[0].getTime() || e.macroRange[1].getTime() !== t.macroRange[1].getTime() || e.vernierOrientation !== t.vernierOrientation || e.showVernierProjection !== t.showVernierProjection || e.showVernierTicks !== t.showVernierTicks || e.showHairline !== t.showHairline || e.macroUnit !== t.macroUnit || e.microUnit !== t.microUnit || e.macroIsDiscrete !== t.macroIsDiscrete || e.microIsDiscrete !== t.microIsDiscrete || e.formatMacroLabel !== t.formatMacroLabel || e.formatMicroLabel !== t.formatMicroLabel || e.onChangeMicroRange !== t.onChangeMicroRange || e.onChangeMicroPoint !== t.onChangeMicroPoint || e.onChangeMacroRange !== t.onChangeMacroRange || !ia(e.macroAllowedDates, t.macroAllowedDates) || !ia(e.microAllowedDates, t.microAllowedDates)) : !1, bl = zr(fl, hl);
1664
+ bl.displayName = "PeriodSlider";
1665
+ const gt = (e) => {
1404
1666
  const t = new Date(e);
1405
1667
  return t.setHours(0, 0, 0, 0), t;
1406
- }, hr = (e, t) => {
1668
+ }, Or = (e, t) => {
1407
1669
  if (Number.isNaN(t.getTime()))
1408
1670
  throw new RangeError(`DateSelector: "${e}" must be a valid Date (received ${String(t)})`);
1409
- }, co = (e) => {
1671
+ }, wl = (e) => {
1410
1672
  if (e !== void 0)
1411
1673
  try {
1412
1674
  Intl.DateTimeFormat.supportedLocalesOf([e]);
1413
1675
  } catch {
1414
1676
  throw new RangeError(`DateSelector: "locale" must be a valid BCP 47 language tag (received ${JSON.stringify(e)})`);
1415
1677
  }
1416
- }, Nt = (e, t, r) => {
1678
+ }, Bt = (e, t, r) => {
1417
1679
  const n = new Date(e, t - 1, r);
1418
1680
  return n.setFullYear(e), n.setHours(0, 0, 0, 0), n;
1419
- }, Gn = (e) => Nt(e, 1, 1), uo = (e) => Nt(e, 12, 31), mo = {
1681
+ }, po = (e) => Bt(e, 1, 1), vl = (e) => Bt(e, 12, 31), pl = {
1420
1682
  year: { year: "numeric" },
1421
1683
  month: { month: "2-digit" },
1422
1684
  day: { day: "2-digit" }
1423
- }, fo = {
1685
+ }, Ml = {
1424
1686
  year: 4,
1425
1687
  month: 2,
1426
1688
  day: 2
1427
- }, go = {
1689
+ }, Dl = {
1428
1690
  year: (e) => e.getFullYear(),
1429
1691
  month: (e) => e.getMonth() + 1,
1430
1692
  day: (e) => e.getDate()
1431
- }, Jn = /* @__PURE__ */ new Map(), ho = (e, t) => {
1432
- const r = `${e}\0${t}`, n = Jn.get(r);
1693
+ }, Mo = /* @__PURE__ */ new Map(), xl = (e, t) => {
1694
+ const r = `${e}\0${t}`, n = Mo.get(r);
1433
1695
  if (n !== void 0) return n;
1434
- const a = new Intl.DateTimeFormat(t, mo[e]);
1435
- return Jn.set(r, a), a;
1436
- }, dn = (e, t, r) => r === void 0 ? String(go[e](t)).padStart(fo[e], "0") : ho(e, r).format(t), bo = (e, t, r) => {
1437
- const n = t?.getTime() ?? null, a = r?.getTime() ?? null, l = /* @__PURE__ */ new Map();
1438
- return e.forEach((o, s) => {
1439
- hr(`allowedDates[${s}]`, o);
1440
- const f = dt(o), m = f.getTime();
1441
- n !== null && m < n || a !== null && m > a || l.has(m) || l.set(m, f);
1442
- }), Array.from(l.keys()).sort((o, s) => o - s).map((o) => l.get(o));
1443
- }, wo = (e, t) => {
1696
+ const a = new Intl.DateTimeFormat(t, pl[e]);
1697
+ return Mo.set(r, a), a;
1698
+ }, la = (e, t, r) => r === void 0 ? String(Dl[e](t)).padStart(Ml[e], "0") : xl(e, r).format(t), Rl = (e, t, r) => {
1699
+ const n = t?.getTime() ?? null, a = r?.getTime() ?? null, i = /* @__PURE__ */ new Map();
1700
+ return e.forEach((l, c) => {
1701
+ Or(`allowedDates[${c}]`, l);
1702
+ const f = gt(l), g = f.getTime();
1703
+ n !== null && g < n || a !== null && g > a || i.has(g) || i.set(g, f);
1704
+ }), Array.from(i.keys()).sort((l, c) => l - c).map((l) => i.get(l));
1705
+ }, Ll = (e, t) => {
1444
1706
  const r = [];
1445
- let n = dt(e);
1446
- const a = dt(t).getTime();
1707
+ let n = gt(e);
1708
+ const a = gt(t).getTime();
1447
1709
  for (; n.getTime() <= a; )
1448
- r.push(n), n = Hr(n, 1);
1710
+ r.push(n), n = gn(n, 1);
1449
1711
  return r;
1450
- }, Zn = (e, t) => {
1712
+ }, Do = (e, t) => {
1451
1713
  const r = [];
1452
1714
  for (let n = e.length - 1; n >= 0; n--)
1453
- r.push({ label: je("day", e[n], void 0, t), value: Jt(e[n], "yyyy-MM-dd") });
1715
+ r.push({ label: Ke("day", e[n], void 0, t), value: gr(e[n], "yyyy-MM-dd") });
1454
1716
  return r;
1455
- }, Mo = (e) => {
1717
+ }, Sl = (e) => {
1456
1718
  const {
1457
1719
  value: t,
1458
1720
  initialDate: r,
1459
1721
  onChange: n,
1460
1722
  children: a,
1461
- minYear: l,
1462
- maxYear: o,
1463
- minDate: s,
1723
+ minYear: i,
1724
+ maxYear: l,
1725
+ minDate: c,
1464
1726
  maxDate: f,
1465
- allowedDates: m,
1466
- variant: L = "date",
1467
- className: M = "",
1468
- style: u,
1469
- disabled: P = !1,
1470
- prevDateAriaLabel: E = "Previous day",
1471
- nextDateAriaLabel: J = "Next day",
1727
+ allowedDates: g,
1728
+ variant: D = "date",
1729
+ className: R = "",
1730
+ style: s,
1731
+ disabled: S = !1,
1732
+ prevDateAriaLabel: Z = "Previous day",
1733
+ nextDateAriaLabel: ee = "Next day",
1472
1734
  selectAriaLabel: x = "Date",
1473
- yearAriaLabel: le = "Year",
1474
- monthAriaLabel: y = "Month",
1475
- dayAriaLabel: j = "Day",
1476
- locale: D,
1477
- formatYearOption: F,
1478
- formatMonthOption: A,
1479
- formatDayOption: C
1735
+ yearAriaLabel: ue = "Year",
1736
+ monthAriaLabel: ae = "Month",
1737
+ dayAriaLabel: $ = "Day",
1738
+ locale: H,
1739
+ formatYearOption: W,
1740
+ formatMonthOption: oe,
1741
+ formatDayOption: q
1480
1742
  } = e;
1481
- if (co(D), t !== void 0 && hr("value", t), r !== void 0 && hr("initialDate", r), s !== void 0 && hr("minDate", s), f !== void 0 && hr("maxDate", f), l !== void 0 && !Number.isInteger(l))
1482
- throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(l)})`);
1483
- if (o !== void 0 && !Number.isInteger(o))
1484
- throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(o)})`);
1485
- if (L === "split-dropdown" && m !== void 0)
1743
+ if (wl(H), t !== void 0 && Or("value", t), r !== void 0 && Or("initialDate", r), c !== void 0 && Or("minDate", c), f !== void 0 && Or("maxDate", f), i !== void 0 && !Number.isInteger(i))
1744
+ throw new RangeError(`DateSelector: "minYear" must be an integer year (received ${String(i)})`);
1745
+ if (l !== void 0 && !Number.isInteger(l))
1746
+ throw new RangeError(`DateSelector: "maxYear" must be an integer year (received ${String(l)})`);
1747
+ if (D === "split-dropdown" && g !== void 0)
1486
1748
  throw new RangeError('DateSelector: variant="split-dropdown" cannot honour "allowedDates"; use variant="dropdown" or variant="date" for a discrete date set');
1487
- const V = t ?? r;
1488
- if (V === void 0)
1749
+ const X = t ?? r;
1750
+ if (X === void 0)
1489
1751
  throw new RangeError("DateSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected date is never inferred from the wall clock.");
1490
- const [O, v] = Te(() => dt(V)), $ = t !== void 0, R = t?.getTime(), w = T(() => t !== void 0 ? dt(t) : O, [R, O]), K = s?.getTime(), re = f?.getTime(), Z = T(() => {
1491
- const g = s ? dt(s) : null, I = l !== void 0 ? Gn(l) : null;
1492
- return g === null ? I : I === null || g.getTime() >= I.getTime() ? g : I;
1493
- }, [K, l]), me = T(() => {
1494
- const g = f ? dt(f) : null, I = o !== void 0 ? uo(o) : null;
1495
- return g === null ? I : I === null || g.getTime() <= I.getTime() ? g : I;
1496
- }, [re, o]), De = Z?.getTime() ?? null, se = me?.getTime() ?? null;
1497
- if (Z !== null && me !== null && Z.getTime() > me.getTime())
1498
- throw new RangeError(`DateSelector: the resolved range is empty (min ${Jt(Z, "yyyy-MM-dd")} is after max ${Jt(me, "yyyy-MM-dd")})`);
1499
- if (L !== "date" && m === void 0 && (Z === null || me === null))
1500
- throw new RangeError(`DateSelector: variant="${L}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${L === "dropdown" ? ' or supply "allowedDates"' : ""}`);
1501
- const ne = m === void 0 ? null : m.map((g) => g.getTime()).join(","), te = T(() => m === void 0 ? null : bo(m, Z, me), [ne, De, se]), Me = (g) => {
1502
- const I = g.getTime();
1503
- return te !== null ? te.some((He) => He.getTime() === I) : !(De !== null && I < De || se !== null && I > se);
1504
- }, We = V.getTime();
1505
- Yt(() => {
1506
- $ || v(dt(V));
1507
- }, [$, We]);
1508
- const q = (g) => {
1509
- if (P) return;
1510
- const I = dt(g);
1511
- Me(I) && ($ || v(I), n?.(I));
1512
- }, Q = w.getTime(), ce = Me(w), k = T(() => {
1513
- if (te !== null) {
1514
- for (let I = te.length - 1; I >= 0; I--)
1515
- if (te[I].getTime() < Q) return te[I];
1752
+ const [y, L] = ye(() => gt(X)), T = t !== void 0, k = t?.getTime(), V = C(() => t !== void 0 ? gt(t) : y, [k, y]), ne = c?.getTime(), ce = f?.getTime(), G = C(() => {
1753
+ const w = c ? gt(c) : null, h = i !== void 0 ? po(i) : null;
1754
+ return w === null ? h : h === null || w.getTime() >= h.getTime() ? w : h;
1755
+ }, [ne, i]), J = C(() => {
1756
+ const w = f ? gt(f) : null, h = l !== void 0 ? vl(l) : null;
1757
+ return w === null ? h : h === null || w.getTime() <= h.getTime() ? w : h;
1758
+ }, [ce, l]), z = G?.getTime() ?? null, _ = J?.getTime() ?? null;
1759
+ if (G !== null && J !== null && G.getTime() > J.getTime())
1760
+ throw new RangeError(`DateSelector: the resolved range is empty (min ${gr(G, "yyyy-MM-dd")} is after max ${gr(J, "yyyy-MM-dd")})`);
1761
+ if (D !== "date" && g === void 0 && (G === null || J === null))
1762
+ throw new RangeError(`DateSelector: variant="${D}" needs a bounded range; supply minDate/minYear and maxDate/maxYear${D === "dropdown" ? ' or supply "allowedDates"' : ""}`);
1763
+ const me = g === void 0 ? null : g.map((w) => w.getTime()).join(","), ge = C(() => g === void 0 ? null : Rl(g, G, J), [me, z, _]), le = (w) => {
1764
+ const h = w.getTime();
1765
+ return ge !== null ? ge.some((b) => b.getTime() === h) : !(z !== null && h < z || _ !== null && h > _);
1766
+ }, ze = X.getTime();
1767
+ Dt(() => {
1768
+ T || L(gt(X));
1769
+ }, [T, ze]);
1770
+ const Ee = (w) => {
1771
+ if (S) return;
1772
+ const h = gt(w);
1773
+ le(h) && (T || L(h), n?.(h));
1774
+ }, Te = V.getTime(), Pe = le(V), qe = C(() => {
1775
+ if (ge !== null) {
1776
+ for (let h = ge.length - 1; h >= 0; h--)
1777
+ if (ge[h].getTime() < Te) return ge[h];
1516
1778
  return null;
1517
1779
  }
1518
- const g = Hr(new Date(Q), -1);
1519
- return Me(g) ? g : null;
1520
- }, [te, Q, De, se]), z = T(() => {
1521
- if (te !== null) {
1522
- for (const I of te)
1523
- if (I.getTime() > Q) return I;
1780
+ const w = gn(new Date(Te), -1);
1781
+ return le(w) ? w : null;
1782
+ }, [ge, Te, z, _]), Be = C(() => {
1783
+ if (ge !== null) {
1784
+ for (const h of ge)
1785
+ if (h.getTime() > Te) return h;
1524
1786
  return null;
1525
1787
  }
1526
- const g = Hr(new Date(Q), 1);
1527
- return Me(g) ? g : null;
1528
- }, [te, Q, De, se]), ue = P || k === null, be = P || z === null, $e = () => {
1529
- k !== null && q(k);
1530
- }, Xe = () => {
1531
- z !== null && q(z);
1532
- }, Ge = (g) => {
1533
- if (g.target.value) {
1534
- const I = Xn(g.target.value);
1535
- Number.isNaN(I.getTime()) || q(I);
1788
+ const w = gn(new Date(Te), 1);
1789
+ return le(w) ? w : null;
1790
+ }, [ge, Te, z, _]), tt = () => {
1791
+ qe !== null && Ee(qe);
1792
+ }, Ue = () => {
1793
+ Be !== null && Ee(Be);
1794
+ }, it = (w) => {
1795
+ if (w.target.value) {
1796
+ const h = no(w.target.value);
1797
+ Number.isNaN(h.getTime()) || Ee(h);
1536
1798
  }
1537
- }, at = (g) => {
1538
- if (g.target.value) {
1539
- const I = Xn(g.target.value);
1540
- Number.isNaN(I.getTime()) || q(I);
1799
+ }, K = (w) => {
1800
+ if (w.target.value) {
1801
+ const h = no(w.target.value);
1802
+ Number.isNaN(h.getTime()) || Ee(h);
1541
1803
  }
1542
- }, ie = w.getFullYear(), Re = w.getMonth() + 1, Ve = w.getDate(), kt = T(() => L !== "dropdown" ? [] : te !== null ? Zn(te, D) : Z === null || me === null ? [] : Zn(wo(Z, me), D), [L, te, De, se, D]), W = T(() => {
1543
- if (L !== "split-dropdown" || Z === null || me === null) return [];
1544
- const g = [];
1545
- for (let I = me.getFullYear(); I >= Z.getFullYear(); I--)
1546
- g.push(I);
1547
- return g;
1548
- }, [L, De, se]), de = T(() => {
1549
- if (L !== "split-dropdown" || Z === null || me === null) return [];
1550
- const g = Z, I = me, He = ie === g.getFullYear() ? g.getMonth() + 1 : 1, Ct = ie === I.getFullYear() ? I.getMonth() + 1 : 12, it = [];
1551
- for (let Je = He; Je <= Ct; Je++)
1552
- it.push(Je);
1553
- return it;
1554
- }, [L, De, se, ie]), Mt = T(() => {
1555
- if (L !== "split-dropdown" || Z === null || me === null) return [];
1556
- const g = Z, I = me, He = ie === g.getFullYear() && Re === g.getMonth() + 1 ? g.getDate() : 1, Ct = ie === I.getFullYear() && Re === I.getMonth() + 1 ? I.getDate() : _n(new Date(Q)), it = [];
1557
- for (let Je = He; Je <= Ct; Je++)
1558
- it.push(Je);
1559
- return it;
1560
- }, [L, De, se, Q, ie, Re]), ot = (g, I, He) => He > _n(Nt(g, I, 1)) ? !1 : Me(Nt(g, I, He)), mt = (g, I, He) => {
1561
- ot(g, I, He) && q(Nt(g, I, He));
1562
- }, he = (g) => F ? F(g) : dn("year", Gn(g), D), ve = (g) => A ? A(g) : dn("month", Nt(ie, g, 1), D), er = (g) => C ? C(g) : dn("day", Nt(ie, Re, g), D), fe = Jt(w, "yyyy-MM-dd"), At = je("day", w, void 0, D), Y = Z ? Jt(Z, "yyyy-MM-dd") : void 0, Xr = me ? Jt(me, "yyyy-MM-dd") : void 0, Kr = ce ? fe : "", ft = "text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400";
1563
- return /* @__PURE__ */ we("div", { className: `inline-flex items-center ${L === "split-dropdown" ? "w-auto" : "w-38"} ${M}`, style: u, "data-variant": L, "data-out-of-range": ce ? void 0 : "true", children: [
1564
- /* @__PURE__ */ p(
1565
- "button",
1566
- {
1567
- type: "button",
1568
- "aria-label": E,
1569
- disabled: ue,
1570
- className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
1571
- onClick: $e,
1572
- children: /* @__PURE__ */ p("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200" })
1573
- }
1574
- ),
1575
- L === "dropdown" ? /* @__PURE__ */ we("select", { "aria-label": x, disabled: P, className: "mx-1 my-auto w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", value: Kr, onChange: at, children: [
1576
- ce ? null : /* @__PURE__ */ p("option", { value: "", disabled: !0, className: ft, children: At }),
1577
- kt.map((g) => /* @__PURE__ */ p("option", { value: g.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: g.label }, g.value))
1578
- ] }) : L === "split-dropdown" ? /* @__PURE__ */ we("div", { className: "mx-1 my-auto inline-flex items-center gap-1", children: [
1579
- /* @__PURE__ */ we(
1804
+ }, B = V.getFullYear(), te = V.getMonth() + 1, v = V.getDate(), Y = C(() => D !== "dropdown" ? [] : ge !== null ? Do(ge, H) : G === null || J === null ? [] : Do(Ll(G, J), H), [D, ge, z, _, H]), p = C(() => {
1805
+ if (D !== "split-dropdown" || G === null || J === null) return [];
1806
+ const w = [];
1807
+ for (let h = J.getFullYear(); h >= G.getFullYear(); h--)
1808
+ w.push(h);
1809
+ return w;
1810
+ }, [D, z, _]), j = C(() => {
1811
+ if (D !== "split-dropdown" || G === null || J === null) return [];
1812
+ const w = G, h = J, b = B === w.getFullYear() ? w.getMonth() + 1 : 1, wr = B === h.getFullYear() ? h.getMonth() + 1 : 12, ht = [];
1813
+ for (let lt = b; lt <= wr; lt++)
1814
+ ht.push(lt);
1815
+ return ht;
1816
+ }, [D, z, _, B]), de = C(() => {
1817
+ if (D !== "split-dropdown" || G === null || J === null) return [];
1818
+ const w = G, h = J, b = B === w.getFullYear() && te === w.getMonth() + 1 ? w.getDate() : 1, wr = B === h.getFullYear() && te === h.getMonth() + 1 ? h.getDate() : ro(new Date(Te)), ht = [];
1819
+ for (let lt = b; lt <= wr; lt++)
1820
+ ht.push(lt);
1821
+ return ht;
1822
+ }, [D, z, _, Te, B, te]), we = (w, h, b) => b > ro(Bt(w, h, 1)) ? !1 : le(Bt(w, h, b)), Ae = (w, h, b) => {
1823
+ we(w, h, b) && Ee(Bt(w, h, b));
1824
+ }, He = (w) => W ? W(w) : la("year", po(w), H), rt = (w) => oe ? oe(w) : la("month", Bt(B, w, 1), H), ve = (w) => q ? q(w) : la("day", Bt(B, te, w), H), pe = gr(V, "yyyy-MM-dd"), Br = Ke("day", V, void 0, H), fe = G ? gr(G, "yyyy-MM-dd") : void 0, Nt = J ? gr(J, "yyyy-MM-dd") : void 0, A = Pe ? pe : "", Wt = "text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400";
1825
+ return /* @__PURE__ */ Me("div", { className: `inline-flex items-center ${Fr} ${R}`, style: s, "data-variant": D, "data-out-of-range": Pe ? void 0 : "true", children: [
1826
+ /* @__PURE__ */ I(Ut, { neighbour: "control", direction: "left", disabled: S, canStep: qe !== null, onStep: tt, ariaLabel: Z }),
1827
+ D === "dropdown" ? /* @__PURE__ */ Me("select", { "aria-label": x, disabled: S, className: "w-28 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", value: A, onChange: K, children: [
1828
+ Pe ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: Wt, children: Br }),
1829
+ Y.map((w) => /* @__PURE__ */ I("option", { value: w.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: w.label }, w.value))
1830
+ ] }) : D === "split-dropdown" ? /* @__PURE__ */ Me("div", { className: "inline-flex items-center gap-1", children: [
1831
+ /* @__PURE__ */ Me(
1580
1832
  "select",
1581
1833
  {
1582
- "aria-label": le,
1583
- disabled: P,
1834
+ "aria-label": ue,
1835
+ disabled: S,
1584
1836
  className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
1585
- value: ce ? ie : "",
1586
- onChange: (g) => mt(Number(g.target.value), Re, Ve),
1837
+ value: Pe ? B : "",
1838
+ onChange: (w) => Ae(Number(w.target.value), te, v),
1587
1839
  children: [
1588
- ce ? null : /* @__PURE__ */ p("option", { value: "", disabled: !0, className: ft, children: he(ie) }),
1589
- W.map((g) => /* @__PURE__ */ p("option", { value: g, disabled: !ot(g, Re, Ve), className: "dark:bg-slate-700 dark:text-slate-100", children: he(g) }, g))
1840
+ Pe ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: Wt, children: He(B) }),
1841
+ p.map((w) => /* @__PURE__ */ I("option", { value: w, disabled: !we(w, te, v), className: "dark:bg-slate-700 dark:text-slate-100", children: He(w) }, w))
1590
1842
  ]
1591
1843
  }
1592
1844
  ),
1593
- /* @__PURE__ */ we(
1845
+ /* @__PURE__ */ Me(
1594
1846
  "select",
1595
1847
  {
1596
- "aria-label": y,
1597
- disabled: P,
1848
+ "aria-label": ae,
1849
+ disabled: S,
1598
1850
  className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
1599
- value: ce ? Re : "",
1600
- onChange: (g) => mt(ie, Number(g.target.value), Ve),
1851
+ value: Pe ? te : "",
1852
+ onChange: (w) => Ae(B, Number(w.target.value), v),
1601
1853
  children: [
1602
- ce ? null : /* @__PURE__ */ p("option", { value: "", disabled: !0, className: ft, children: ve(Re) }),
1603
- de.map((g) => /* @__PURE__ */ p("option", { value: g, disabled: !ot(ie, g, Ve), className: "dark:bg-slate-700 dark:text-slate-100", children: ve(g) }, g))
1854
+ Pe ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: Wt, children: rt(te) }),
1855
+ j.map((w) => /* @__PURE__ */ I("option", { value: w, disabled: !we(B, w, v), className: "dark:bg-slate-700 dark:text-slate-100", children: rt(w) }, w))
1604
1856
  ]
1605
1857
  }
1606
1858
  ),
1607
- /* @__PURE__ */ we(
1859
+ /* @__PURE__ */ Me(
1608
1860
  "select",
1609
1861
  {
1610
- "aria-label": j,
1611
- disabled: P,
1862
+ "aria-label": $,
1863
+ disabled: S,
1612
1864
  className: "rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100",
1613
- value: ce ? Ve : "",
1614
- onChange: (g) => mt(ie, Re, Number(g.target.value)),
1865
+ value: Pe ? v : "",
1866
+ onChange: (w) => Ae(B, te, Number(w.target.value)),
1615
1867
  children: [
1616
- ce ? null : /* @__PURE__ */ p("option", { value: "", disabled: !0, className: ft, children: er(Ve) }),
1617
- Mt.map((g) => /* @__PURE__ */ p("option", { value: g, className: "dark:bg-slate-700 dark:text-slate-100", children: er(g) }, g))
1868
+ Pe ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: Wt, children: ve(v) }),
1869
+ de.map((w) => /* @__PURE__ */ I("option", { value: w, className: "dark:bg-slate-700 dark:text-slate-100", children: ve(w) }, w))
1618
1870
  ]
1619
1871
  }
1620
1872
  )
1621
- ] }) : /* @__PURE__ */ p(
1873
+ ] }) : /* @__PURE__ */ I(
1622
1874
  "input",
1623
1875
  {
1624
1876
  "aria-label": x,
1625
- disabled: P,
1626
- className: "mx-1 my-auto w-28 rounded-md border border-gray-300 bg-gray-50 px-1 py-0.5 text-gray-900 text-xs focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500 dark:placeholder:text-gray-400",
1627
- value: fe,
1628
- min: Y,
1629
- max: Xr,
1630
- onChange: Ge,
1877
+ disabled: S,
1878
+ className: "period-slider-native-date-field w-28 rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500 dark:placeholder:text-gray-400",
1879
+ value: pe,
1880
+ min: fe,
1881
+ max: Nt,
1882
+ onChange: it,
1631
1883
  type: "date"
1632
1884
  }
1633
1885
  ),
1634
- /* @__PURE__ */ p(
1635
- "button",
1636
- {
1637
- type: "button",
1638
- "aria-label": J,
1639
- disabled: be,
1640
- className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
1641
- onClick: Xe,
1642
- children: /* @__PURE__ */ p("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200" })
1643
- }
1644
- ),
1886
+ /* @__PURE__ */ I(Ut, { neighbour: "control", direction: "right", disabled: S, canStep: Be !== null, onStep: Ue, ariaLabel: ee }),
1645
1887
  a
1646
1888
  ] });
1647
- }, Gt = (e) => e === void 0 ? null : dt(e).getTime(), vo = br(Mo, (e, t) => !(Gt(e.value ?? e.initialDate) !== Gt(t.value ?? t.initialDate) || Gt(e.minDate) !== Gt(t.minDate) || Gt(e.maxDate) !== Gt(t.maxDate) || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear || e.onChange !== t.onChange || e.allowedDates !== t.allowedDates || e.children !== t.children || e.prevDateAriaLabel !== t.prevDateAriaLabel || e.nextDateAriaLabel !== t.nextDateAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.yearAriaLabel !== t.yearAriaLabel || e.monthAriaLabel !== t.monthAriaLabel || e.dayAriaLabel !== t.dayAriaLabel || e.locale !== t.locale || e.formatYearOption !== t.formatYearOption || e.formatMonthOption !== t.formatMonthOption || e.formatDayOption !== t.formatDayOption));
1648
- vo.displayName = "DateSelector";
1889
+ }, fr = (e) => e === void 0 ? null : gt(e).getTime(), yl = zr(Sl, (e, t) => !(fr(e.value ?? e.initialDate) !== fr(t.value ?? t.initialDate) || fr(e.minDate) !== fr(t.minDate) || fr(e.maxDate) !== fr(t.maxDate) || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear || e.onChange !== t.onChange || e.allowedDates !== t.allowedDates || e.children !== t.children || e.prevDateAriaLabel !== t.prevDateAriaLabel || e.nextDateAriaLabel !== t.nextDateAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.yearAriaLabel !== t.yearAriaLabel || e.monthAriaLabel !== t.monthAriaLabel || e.dayAriaLabel !== t.dayAriaLabel || e.locale !== t.locale || e.formatYearOption !== t.formatYearOption || e.formatMonthOption !== t.formatMonthOption || e.formatDayOption !== t.formatDayOption));
1890
+ yl.displayName = "DateSelector";
1649
1891
  function Qe(e, t) {
1650
1892
  const r = e + Math.floor(t / 12), n = (t % 12 + 12) % 12, a = new Date(r, n, 1);
1651
1893
  return a.setFullYear(r), a;
1652
1894
  }
1653
- function $t(e) {
1895
+ function zt(e) {
1654
1896
  return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
1655
1897
  }
1656
- function fr(e, t) {
1898
+ function kr(e, t) {
1657
1899
  if (e !== void 0 && (!(e instanceof Date) || Number.isNaN(e.getTime())))
1658
1900
  throw new RangeError(`MonthSelector: \`${t}\` must be a valid Date, received ${String(e)}.`);
1659
1901
  }
1660
- function Qn(e, t) {
1902
+ function xo(e, t) {
1661
1903
  if (e !== void 0 && !Number.isInteger(e))
1662
1904
  throw new RangeError(`MonthSelector: \`${t}\` must be an integer year, received ${String(e)}.`);
1663
1905
  }
1664
- function Do(e) {
1906
+ function Tl(e) {
1665
1907
  if (e !== void 0)
1666
1908
  try {
1667
1909
  Intl.DateTimeFormat.supportedLocalesOf([e]);
@@ -1669,619 +1911,674 @@ function Do(e) {
1669
1911
  throw new RangeError(`MonthSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`);
1670
1912
  }
1671
1913
  }
1672
- function po(e, t) {
1914
+ function Pl(e, t) {
1673
1915
  const r = e === void 0 ? null : Qe(e, 0), n = t === void 0 ? null : Qe(t.getFullYear(), t.getMonth());
1674
1916
  return r !== null && n !== null ? r >= n ? r : n : r !== null ? r : n;
1675
1917
  }
1676
- function xo(e, t) {
1918
+ function Al(e, t) {
1677
1919
  const r = e === void 0 ? null : Qe(e, 11), n = t === void 0 ? null : Qe(t.getFullYear(), t.getMonth());
1678
1920
  return r !== null && n !== null ? r <= n ? r : n : r !== null ? r : n;
1679
1921
  }
1680
- function yo(e, t, r) {
1922
+ function $l(e, t, r) {
1681
1923
  const n = /* @__PURE__ */ new Map();
1682
1924
  for (const a of e) {
1683
- const l = Qe(a.getFullYear(), a.getMonth());
1684
- t !== null && l < t || r !== null && l > r || n.has(l.getTime()) || n.set(l.getTime(), l);
1925
+ const i = Qe(a.getFullYear(), a.getMonth());
1926
+ t !== null && i < t || r !== null && i > r || n.has(i.getTime()) || n.set(i.getTime(), i);
1685
1927
  }
1686
- return Array.from(n.values()).sort((a, l) => a.getTime() - l.getTime());
1928
+ return Array.from(n.values()).sort((a, i) => a.getTime() - i.getTime());
1687
1929
  }
1688
- function To(e, t) {
1930
+ function El(e, t) {
1689
1931
  const r = e.getFullYear() * 12 + e.getMonth(), n = t.getFullYear() * 12 + t.getMonth(), a = [];
1690
- for (let l = r; l <= n; l++)
1691
- a.push(Qe(Math.floor(l / 12), l % 12));
1932
+ for (let i = r; i <= n; i++)
1933
+ a.push(Qe(Math.floor(i / 12), i % 12));
1692
1934
  return a;
1693
1935
  }
1694
- function ea(e, t) {
1936
+ function Ro(e, t) {
1695
1937
  const r = [];
1696
1938
  for (let n = e.length - 1; n >= 0; n--)
1697
- r.push({ label: je("month", e[n], void 0, t), value: $t(e[n]) });
1939
+ r.push({ label: Ke("month", e[n], void 0, t), value: zt(e[n]) });
1698
1940
  return r;
1699
1941
  }
1700
- const Lo = (e) => {
1942
+ const Il = (e) => {
1701
1943
  const {
1702
1944
  value: t,
1703
1945
  initialDate: r,
1704
1946
  onChange: n,
1705
1947
  children: a,
1706
- variant: l = "date",
1707
- minYear: o,
1708
- maxYear: s,
1948
+ variant: i = "date",
1949
+ minYear: l,
1950
+ maxYear: c,
1709
1951
  minDate: f,
1710
- maxDate: m,
1711
- allowedMonths: L,
1712
- isWarning: M = !1,
1713
- className: u = "",
1714
- style: P,
1715
- disabled: E = !1,
1716
- prevMonthAriaLabel: J = "Previous month",
1952
+ maxDate: g,
1953
+ allowedMonths: D,
1954
+ isWarning: R = !1,
1955
+ className: s = "",
1956
+ style: S,
1957
+ disabled: Z = !1,
1958
+ prevMonthAriaLabel: ee = "Previous month",
1717
1959
  nextMonthAriaLabel: x = "Next month",
1718
- selectAriaLabel: le = "Month",
1719
- locale: y
1960
+ selectAriaLabel: ue = "Month",
1961
+ locale: ae
1720
1962
  } = e;
1721
- Do(y), fr(t, "value"), fr(r, "initialDate"), fr(f, "minDate"), fr(m, "maxDate"), Qn(o, "minYear"), Qn(s, "maxYear"), L?.forEach((W, de) => {
1722
- fr(W, `allowedMonths[${de}]`);
1963
+ Tl(ae), kr(t, "value"), kr(r, "initialDate"), kr(f, "minDate"), kr(g, "maxDate"), xo(l, "minYear"), xo(c, "maxYear"), D?.forEach((p, j) => {
1964
+ kr(p, `allowedMonths[${j}]`);
1723
1965
  });
1724
- const j = t ?? r;
1725
- if (j === void 0)
1966
+ const $ = t ?? r;
1967
+ if ($ === void 0)
1726
1968
  throw new RangeError("MonthSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected month is never inferred from the wall clock.");
1727
- const [D, F] = Te(() => Qe(j.getFullYear(), j.getMonth())), A = t !== void 0, C = T(() => t !== void 0 ? Qe(t.getFullYear(), t.getMonth()) : D, [t?.getTime(), D]), V = f?.getTime(), O = m?.getTime(), v = T(() => po(o, f), [o, V]), $ = T(() => xo(s, m), [s, O]), R = v?.getTime() ?? null, w = $?.getTime() ?? null;
1728
- if (v !== null && $ !== null && v > $)
1729
- throw new RangeError(`MonthSelector: the resolved lower bound ${$t(v)} is after the resolved upper bound ${$t($)}.`);
1730
- if (l === "dropdown" && L === void 0 && (v === null || $ === null))
1969
+ const [H, W] = ye(() => Qe($.getFullYear(), $.getMonth())), oe = t !== void 0, q = C(() => t !== void 0 ? Qe(t.getFullYear(), t.getMonth()) : H, [t?.getTime(), H]), X = f?.getTime(), y = g?.getTime(), L = C(() => Pl(l, f), [l, X]), T = C(() => Al(c, g), [c, y]), k = L?.getTime() ?? null, V = T?.getTime() ?? null;
1970
+ if (L !== null && T !== null && L > T)
1971
+ throw new RangeError(`MonthSelector: the resolved lower bound ${zt(L)} is after the resolved upper bound ${zt(T)}.`);
1972
+ if (i === "dropdown" && D === void 0 && (L === null || T === null))
1731
1973
  throw new RangeError('MonthSelector: variant="dropdown" requires a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`), or `allowedMonths`; the option window is never invented.');
1732
- const K = L === void 0 ? null : L.map((W) => W.getTime()).join(","), re = T(() => L === void 0 ? null : yo(L, v, $), [K, R, w]), Z = (W) => {
1733
- const de = W.getTime();
1734
- return re !== null ? re.some((Mt) => Mt.getTime() === de) : !(R !== null && de < R || w !== null && de > w);
1735
- }, me = j.getTime();
1736
- Yt(() => {
1737
- if (A) return;
1738
- const W = Qe(j.getFullYear(), j.getMonth());
1739
- F((de) => de.getTime() === W.getTime() ? de : W);
1740
- }, [A, me]);
1741
- const De = (W) => {
1742
- if (E) return;
1743
- if (!Z(W))
1744
- throw new RangeError(`MonthSelector: refusing to emit ${$t(W)}, which lies outside the selectable months.`);
1745
- A || F(W);
1746
- const de = W.getFullYear() * 100 + (W.getMonth() + 1);
1747
- n?.(W, de);
1748
- }, se = C.getTime(), ne = Z(C), te = T(() => {
1749
- if (re !== null) {
1750
- for (let de = re.length - 1; de >= 0; de--)
1751
- if (re[de].getTime() < se) return re[de];
1974
+ const ne = D === void 0 ? null : D.map((p) => p.getTime()).join(","), ce = C(() => D === void 0 ? null : $l(D, L, T), [ne, k, V]), G = (p) => {
1975
+ const j = p.getTime();
1976
+ return ce !== null ? ce.some((de) => de.getTime() === j) : !(k !== null && j < k || V !== null && j > V);
1977
+ }, J = $.getTime();
1978
+ Dt(() => {
1979
+ if (oe) return;
1980
+ const p = Qe($.getFullYear(), $.getMonth());
1981
+ W((j) => j.getTime() === p.getTime() ? j : p);
1982
+ }, [oe, J]);
1983
+ const z = (p) => {
1984
+ if (Z) return;
1985
+ if (!G(p))
1986
+ throw new RangeError(`MonthSelector: refusing to emit ${zt(p)}, which lies outside the selectable months.`);
1987
+ oe || W(p);
1988
+ const j = p.getFullYear() * 100 + (p.getMonth() + 1);
1989
+ n?.(p, j);
1990
+ }, _ = q.getTime(), me = G(q), ge = C(() => {
1991
+ if (ce !== null) {
1992
+ for (let j = ce.length - 1; j >= 0; j--)
1993
+ if (ce[j].getTime() < _) return ce[j];
1752
1994
  return null;
1753
1995
  }
1754
- const W = Qe(C.getFullYear(), C.getMonth() - 1);
1755
- return Z(W) ? W : null;
1756
- }, [re, se, R, w]), Me = T(() => {
1757
- if (re !== null) {
1758
- for (const de of re)
1759
- if (de.getTime() > se) return de;
1996
+ const p = Qe(q.getFullYear(), q.getMonth() - 1);
1997
+ return G(p) ? p : null;
1998
+ }, [ce, _, k, V]), le = C(() => {
1999
+ if (ce !== null) {
2000
+ for (const j of ce)
2001
+ if (j.getTime() > _) return j;
1760
2002
  return null;
1761
2003
  }
1762
- const W = Qe(C.getFullYear(), C.getMonth() + 1);
1763
- return Z(W) ? W : null;
1764
- }, [re, se, R, w]), We = E || te === null, q = E || Me === null, Q = () => {
1765
- te !== null && De(te);
1766
- }, ce = () => {
1767
- Me !== null && De(Me);
1768
- }, k = (W) => {
1769
- if (!W) return;
1770
- const [de, Mt] = W.split("-"), ot = Number(de), mt = Number(Mt) - 1;
1771
- if (!(Number.isInteger(ot) && Number.isInteger(mt))) return;
1772
- const he = Qe(ot, mt);
1773
- Z(he) && De(he);
1774
- }, z = (W) => {
1775
- k(W.target.value);
1776
- }, ue = (W) => {
1777
- k(W.target.value);
1778
- }, be = $t(C), $e = je("month", C, void 0, y), Xe = v ? $t(v) : void 0, Ge = $ ? $t($) : void 0, at = T(() => l !== "dropdown" ? [] : re !== null ? ea(re, y) : v === null || $ === null ? [] : ea(To(v, $), y), [l, re, R, w, y]), ie = ne ? be : "", Re = M ? "border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200" : "border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", Ve = `mx-1 my-auto w-28 rounded-md border py-0.5 px-1 text-xs dark:placeholder:text-gray-400 disabled:opacity-50 ${Re}`, kt = `mx-1 my-auto w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${Re}`;
1779
- return /* @__PURE__ */ we("div", { className: `inline-flex w-38 items-center ${u}`, style: P, "data-out-of-range": ne ? void 0 : "true", children: [
1780
- /* @__PURE__ */ p(
1781
- "button",
1782
- {
1783
- type: "button",
1784
- "aria-label": J,
1785
- disabled: We,
1786
- className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
1787
- onClick: Q,
1788
- children: /* @__PURE__ */ p("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200" })
1789
- }
1790
- ),
1791
- l === "dropdown" ? /* @__PURE__ */ we("select", { "aria-label": le, disabled: E, className: kt, value: ie, onChange: ue, children: [
1792
- ne ? null : /* @__PURE__ */ p("option", { value: "", disabled: !0, className: "text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400", children: $e }),
1793
- at.map((W) => /* @__PURE__ */ p("option", { value: W.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: W.label }, W.value))
1794
- ] }) : /* @__PURE__ */ p("input", { "aria-label": le, disabled: E, className: Ve, value: be, min: Xe, max: Ge, onChange: z, type: "month" }),
1795
- /* @__PURE__ */ p(
1796
- "button",
1797
- {
1798
- type: "button",
1799
- "aria-label": x,
1800
- disabled: q,
1801
- className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
1802
- onClick: ce,
1803
- children: /* @__PURE__ */ p("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200" })
1804
- }
1805
- ),
2004
+ const p = Qe(q.getFullYear(), q.getMonth() + 1);
2005
+ return G(p) ? p : null;
2006
+ }, [ce, _, k, V]), ze = () => {
2007
+ ge !== null && z(ge);
2008
+ }, Ee = () => {
2009
+ le !== null && z(le);
2010
+ }, Te = (p) => {
2011
+ if (!p) return;
2012
+ const [j, de] = p.split("-"), we = Number(j), Ae = Number(de) - 1;
2013
+ if (!(Number.isInteger(we) && Number.isInteger(Ae))) return;
2014
+ const He = Qe(we, Ae);
2015
+ G(He) && z(He);
2016
+ }, Pe = (p) => {
2017
+ Te(p.target.value);
2018
+ }, qe = (p) => {
2019
+ Te(p.target.value);
2020
+ }, Be = zt(q), tt = Ke("month", q, void 0, ae), Ue = L ? zt(L) : void 0, it = T ? zt(T) : void 0, K = C(() => i !== "dropdown" ? [] : ce !== null ? Ro(ce, ae) : L === null || T === null ? [] : Ro(El(L, T), ae), [i, ce, k, V, ae]), B = me ? Be : "", te = R ? "border-amber-300 bg-amber-50 text-amber-900 focus:border-amber-500 focus:ring-amber-500 dark:border-amber-900/50 dark:bg-amber-950/20 dark:text-amber-200" : "border-gray-300 bg-gray-100 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500", v = `period-slider-native-date-field w-28 rounded-md border py-0.5 px-1 text-center font-mono text-xs tabular-nums dark:placeholder:text-gray-400 disabled:opacity-50 ${te}`, Y = `w-28 appearance-none rounded-md border px-1 py-0.5 text-center font-mono text-xs tabular-nums [text-align-last:center] [text-align:center] disabled:opacity-50 ${te}`;
2021
+ return /* @__PURE__ */ Me("div", { className: `inline-flex items-center ${Fr} ${s}`, style: S, "data-out-of-range": me ? void 0 : "true", children: [
2022
+ /* @__PURE__ */ I(Ut, { neighbour: "control", direction: "left", disabled: Z, canStep: ge !== null, onStep: ze, ariaLabel: ee }),
2023
+ i === "dropdown" ? /* @__PURE__ */ Me("select", { "aria-label": ue, disabled: Z, className: Y, value: B, onChange: qe, children: [
2024
+ me ? null : /* @__PURE__ */ I("option", { value: "", disabled: !0, className: "text-center font-mono text-gray-500 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-400", children: tt }),
2025
+ K.map((p) => /* @__PURE__ */ I("option", { value: p.value, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: p.label }, p.value))
2026
+ ] }) : /* @__PURE__ */ I("input", { "aria-label": ue, disabled: Z, className: v, value: Be, min: Ue, max: it, onChange: Pe, type: "month" }),
2027
+ /* @__PURE__ */ I(Ut, { neighbour: "control", direction: "right", disabled: Z, canStep: le !== null, onStep: Ee, ariaLabel: x }),
1806
2028
  a
1807
2029
  ] });
1808
- }, Ro = br(Lo, (e, t) => {
1809
- const r = e.value ?? e.initialDate, n = t.value ?? t.initialDate, a = r ? r.getFullYear() * 12 + r.getMonth() : null, l = n ? n.getFullYear() * 12 + n.getMonth() : null;
1810
- if (a !== l || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.isWarning !== t.isWarning || e.minYear !== t.minYear || e.maxYear !== t.maxYear) return !1;
1811
- const o = e.minDate ? e.minDate.getFullYear() * 12 + e.minDate.getMonth() : null, s = t.minDate ? t.minDate.getFullYear() * 12 + t.minDate.getMonth() : null;
1812
- if (o !== s) return !1;
1813
- const f = e.maxDate ? e.maxDate.getFullYear() * 12 + e.maxDate.getMonth() : null, m = t.maxDate ? t.maxDate.getFullYear() * 12 + t.maxDate.getMonth() : null;
1814
- return !(f !== m || e.allowedMonths !== t.allowedMonths || e.onChange !== t.onChange || e.children !== t.children || e.prevMonthAriaLabel !== t.prevMonthAriaLabel || e.nextMonthAriaLabel !== t.nextMonthAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.locale !== t.locale);
2030
+ }, Cl = zr(Il, (e, t) => {
2031
+ const r = e.value ?? e.initialDate, n = t.value ?? t.initialDate, a = r ? r.getFullYear() * 12 + r.getMonth() : null, i = n ? n.getFullYear() * 12 + n.getMonth() : null;
2032
+ if (a !== i || e.variant !== t.variant || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.isWarning !== t.isWarning || e.minYear !== t.minYear || e.maxYear !== t.maxYear) return !1;
2033
+ const l = e.minDate ? e.minDate.getFullYear() * 12 + e.minDate.getMonth() : null, c = t.minDate ? t.minDate.getFullYear() * 12 + t.minDate.getMonth() : null;
2034
+ if (l !== c) return !1;
2035
+ const f = e.maxDate ? e.maxDate.getFullYear() * 12 + e.maxDate.getMonth() : null, g = t.maxDate ? t.maxDate.getFullYear() * 12 + t.maxDate.getMonth() : null;
2036
+ return !(f !== g || e.allowedMonths !== t.allowedMonths || e.onChange !== t.onChange || e.children !== t.children || e.prevMonthAriaLabel !== t.prevMonthAriaLabel || e.nextMonthAriaLabel !== t.nextMonthAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.locale !== t.locale);
1815
2037
  });
1816
- Ro.displayName = "MonthSelector";
1817
- function Qt(e, t, r) {
2038
+ Cl.displayName = "MonthSelector";
2039
+ function br(e, t, r) {
1818
2040
  if (!(r instanceof Date) || Number.isNaN(r.getTime()))
1819
2041
  throw new RangeError(`${e}: ${t} is required and must be a valid Date (received: ${String(r)})`);
1820
2042
  }
1821
- function zr(e, t, r) {
1822
- if (Qt(e, "minDate", t), Qt(e, "maxDate", r), r.getTime() <= t.getTime())
2043
+ function Rn(e, t, r) {
2044
+ if (br(e, "minDate", t), br(e, "maxDate", r), r.getTime() <= t.getTime())
1823
2045
  throw new RangeError(`${e}: maxDate must be strictly later than minDate (minDate: ${t.toISOString()}, maxDate: ${r.toISOString()})`);
1824
2046
  }
1825
- function Or(e, t, r) {
2047
+ function wn(e, t, r) {
1826
2048
  if (!Array.isArray(r) || r.length !== 2)
1827
2049
  throw new RangeError(`${e}: ${t} is required and must be a [lower, upper] Date tuple (received: ${String(r)})`);
1828
- if (Qt(e, `${t}[0]`, r[0]), Qt(e, `${t}[1]`, r[1]), r[0].getTime() > r[1].getTime())
2050
+ if (br(e, `${t}[0]`, r[0]), br(e, `${t}[1]`, r[1]), r[0].getTime() > r[1].getTime())
1829
2051
  throw new RangeError(`${e}: ${t} upper must not be earlier than lower (lower: ${r[0].toISOString()}, upper: ${r[1].toISOString()})`);
1830
2052
  }
1831
- function Fr(e, t, r, n, a, l) {
1832
- if (r.getTime() < n.getTime() || r.getTime() > a.getTime())
1833
- throw new RangeError(`${e}: ${t} must lie within ${l} (value: ${r.toISOString()}, lower: ${n.toISOString()}, upper: ${a.toISOString()})`);
2053
+ function vn(e, t, r, n, a, i, l) {
2054
+ const c = Q(r, n);
2055
+ if (c < Q(r, a) || c > Q(r, i))
2056
+ throw new RangeError(`${e}: ${t} must lie within ${l} (value: ${n.toISOString()}, lower: ${a.toISOString()}, upper: ${i.toISOString()})`);
1834
2057
  }
1835
- function Ur(e, t, r, n, a, l) {
1836
- Fr(e, `${t}[0]`, r[0], n, a, l), Fr(e, `${t}[1]`, r[1], n, a, l);
2058
+ function pn(e, t, r, n, a, i, l) {
2059
+ vn(e, `${t}[0]`, r, n[0], a, i, l), vn(e, `${t}[1]`, r, n[1], a, i, l);
1837
2060
  }
1838
- function Ce(e, t, r) {
2061
+ function Fe(e, t, r) {
1839
2062
  return e < t ? t : e > r ? r : e;
1840
2063
  }
1841
- function Cr(e, t, r, n) {
1842
- const a = et(t, r, n[1]);
1843
- return [Ce(e[0], n[0], a), Ce(e[1], n[0], a)];
2064
+ function Mn(e, t, r, n, a, i) {
2065
+ if (r !== !0) return [];
2066
+ const l = e[0].getTime(), c = e[1].getTime();
2067
+ return Vt(n, t, a, i).filter((f) => f.getTime() >= l && f.getTime() <= c);
2068
+ }
2069
+ function hr(e, t, r, n) {
2070
+ if (n.length === 0) return Fe(e, r[0], r[1]);
2071
+ const a = n[be(n, e, t)];
2072
+ return a.getTime() === e.getTime() ? e : a;
1844
2073
  }
1845
- function Er(e, t, r, n) {
1846
- return Ce(e, n[0], et(t, r, n[1]));
2074
+ function dn(e, t, r, n) {
2075
+ const a = hr(e[0], t, r, n), i = hr(e[1], t, r, n);
2076
+ return [a, i < a ? a : i];
1847
2077
  }
1848
- function Br(e, t, r, n) {
1849
- const a = Ae(e, r, t) + n;
2078
+ function Dn(e, t, r, n) {
2079
+ const a = be(e, r, t) + n;
1850
2080
  return e[Math.max(0, Math.min(e.length - 1, a))];
1851
2081
  }
1852
- function _r(e) {
1853
- const t = G(e), r = t.current, n = e, a = Object.keys(r), l = Object.keys(n);
1854
- return a.length === l.length && l.every((s) => Object.is(r[s], n[s])) || (t.current = e), t.current;
2082
+ function Ln(e) {
2083
+ const t = O(e), r = t.current, n = e, a = Object.keys(r), i = Object.keys(n);
2084
+ return a.length === i.length && i.every((c) => Object.is(r[c], n[c])) || (t.current = e), t.current;
1855
2085
  }
1856
- function Ao(e) {
1857
- const { unit: t, minDate: r, maxDate: n, initialRange: a, onChangeRange: l, ...o } = e;
1858
- zr("usePeriodSliderRange", r, n), Or("usePeriodSliderRange", "initialRange", a), Ur("usePeriodSliderRange", "initialRange", a, r, n, "[minDate, maxDate]");
1859
- const s = _r(o), f = G(a), [m, L] = Te(a);
1860
- let M = m;
1861
- const u = [Ce(m[0], r, n), Ce(m[1], r, n)];
1862
- (u[0] !== m[0] || u[1] !== m[1]) && (M = u, L(u));
1863
- const P = G(M);
1864
- P.current = M;
1865
- const E = G({ minDate: r, maxDate: n, allowedDates: s.allowedDates });
1866
- E.current = { minDate: r, maxDate: n, allowedDates: s.allowedDates };
1867
- const J = G(l);
1868
- J.current = l;
1869
- const x = B((O) => {
1870
- const { minDate: v, maxDate: $ } = E.current, R = Ce(O[0], v, $), w = Ce(O[1], v, $), K = P.current;
1871
- R.getTime() === K[0].getTime() && w.getTime() === K[1].getTime() || (P.current = [R, w], L([R, w]), J.current?.(R, w));
1872
- }, []), le = B(
1873
- (O) => {
1874
- const v = P.current, $ = O.getTime() > v[1].getTime() ? O : v[1];
1875
- x([O, $]);
2086
+ function Fl(e) {
2087
+ const { unit: t, minDate: r, maxDate: n, initialRange: a, onChangeRange: i, ...l } = e;
2088
+ Rn("usePeriodSliderRange", r, n), wn("usePeriodSliderRange", "initialRange", a), pn("usePeriodSliderRange", "initialRange", t, a, r, n, "[minDate, maxDate]");
2089
+ const c = Ln(l), f = O(a), [g, D] = ye(a);
2090
+ let R = g;
2091
+ const s = [Fe(g[0], r, n), Fe(g[1], r, n)];
2092
+ (s[0] !== g[0] || s[1] !== g[1]) && (R = s, D(s));
2093
+ const S = O(R);
2094
+ S.current = R;
2095
+ const Z = O({ minDate: r, maxDate: n, allowedDates: c.allowedDates });
2096
+ Z.current = { minDate: r, maxDate: n, allowedDates: c.allowedDates };
2097
+ const ee = O(i);
2098
+ ee.current = i;
2099
+ const x = U((y) => {
2100
+ const { minDate: L, maxDate: T } = Z.current, k = Fe(y[0], L, T), V = Fe(y[1], L, T), ne = S.current;
2101
+ k.getTime() === ne[0].getTime() && V.getTime() === ne[1].getTime() || (S.current = [k, V], D([k, V]), ee.current?.(k, V));
2102
+ }, []), ue = U(
2103
+ (y) => {
2104
+ const L = S.current, T = y.getTime() > L[1].getTime() ? y : L[1];
2105
+ x([y, T]);
1876
2106
  },
1877
2107
  [x]
1878
- ), y = B(
1879
- (O) => {
1880
- const v = P.current, $ = O.getTime() < v[0].getTime() ? O : v[0];
1881
- x([$, O]);
2108
+ ), ae = U(
2109
+ (y) => {
2110
+ const L = S.current, T = y.getTime() < L[0].getTime() ? y : L[0];
2111
+ x([T, y]);
1882
2112
  },
1883
2113
  [x]
1884
- ), j = B(
1885
- (O, v) => {
1886
- x([O, v]);
2114
+ ), $ = U(
2115
+ (y, L) => {
2116
+ x([y, L]);
1887
2117
  },
1888
2118
  [x]
1889
- ), D = B(
1890
- (O) => {
1891
- const { minDate: v, maxDate: $, allowedDates: R } = E.current, w = P.current, K = Zt(R, t, v, $);
1892
- if (K.length > 0) {
1893
- x([Br(K, t, w[0], O), Br(K, t, w[1], O)]);
2119
+ ), H = U(
2120
+ (y) => {
2121
+ const { minDate: L, maxDate: T, allowedDates: k } = Z.current, V = S.current, ne = Vt(k, t, L, T);
2122
+ if (ne.length > 0) {
2123
+ x([Dn(ne, t, V[0], y), Dn(ne, t, V[1], y)]);
1894
2124
  return;
1895
2125
  }
1896
- x([Ee(t, w[0], O), Ee(t, w[1], O)]);
2126
+ x([Oe(t, V[0], y), Oe(t, V[1], y)]);
1897
2127
  },
1898
2128
  [t, x]
1899
- ), F = B(() => {
2129
+ ), W = U(() => {
1900
2130
  x(f.current);
1901
- }, [x]), A = T(
2131
+ }, [x]), oe = C(
1902
2132
  () => ({
1903
- value: M[0],
1904
- onChange: le,
2133
+ value: R[0],
2134
+ onChange: ue,
1905
2135
  minDate: r,
1906
- maxDate: M[1],
2136
+ maxDate: R[1],
1907
2137
  unit: t
1908
2138
  }),
1909
- [M[0], M[1], le, r, t]
1910
- ), C = T(
2139
+ [R[0], R[1], ue, r, t]
2140
+ ), q = C(
1911
2141
  () => ({
1912
- value: M[1],
1913
- onChange: y,
1914
- minDate: M[0],
2142
+ value: R[1],
2143
+ onChange: ae,
2144
+ minDate: R[0],
1915
2145
  maxDate: n,
1916
2146
  unit: t
1917
2147
  }),
1918
- [M[0], M[1], y, n, t]
1919
- ), V = T(
2148
+ [R[0], R[1], ae, n, t]
2149
+ ), X = C(
1920
2150
  () => ({
1921
- ...s,
2151
+ ...c,
1922
2152
  mode: "range",
1923
2153
  unit: t,
1924
- range: M,
2154
+ range: R,
1925
2155
  minDate: r,
1926
2156
  maxDate: n,
1927
- onChangeRange: j
2157
+ onChangeRange: $
1928
2158
  }),
1929
- [s, t, M, r, n, j]
2159
+ [c, t, R, r, n, $]
1930
2160
  );
1931
2161
  return {
1932
- range: M,
1933
- lowerDate: M[0],
1934
- upperDate: M[1],
1935
- setRange: L,
1936
- setLowerDate: le,
1937
- setUpperDate: y,
1938
- shiftRange: D,
1939
- resetRange: F,
1940
- startSelectorProps: A,
1941
- endSelectorProps: C,
1942
- sliderProps: V
2162
+ range: R,
2163
+ lowerDate: R[0],
2164
+ upperDate: R[1],
2165
+ setRange: D,
2166
+ setLowerDate: ue,
2167
+ setUpperDate: ae,
2168
+ shiftRange: H,
2169
+ resetRange: W,
2170
+ startSelectorProps: oe,
2171
+ endSelectorProps: q,
2172
+ sliderProps: X
1943
2173
  };
1944
2174
  }
1945
- function Co(e) {
1946
- const { unit: t, minDate: r, maxDate: n, initialValue: a, onChangePoint: l, ...o } = e;
1947
- zr("usePeriodSliderPoint", r, n), Qt("usePeriodSliderPoint", "initialValue", a), Fr("usePeriodSliderPoint", "initialValue", a, r, n, "[minDate, maxDate]");
1948
- const s = _r(o), f = G(a), [m, L] = Te(a);
1949
- let M = m;
1950
- const u = Ce(m, r, n);
1951
- u !== m && (M = u, L(u));
1952
- const P = G(M);
1953
- P.current = M;
1954
- const E = G({ minDate: r, maxDate: n, allowedDates: s.allowedDates });
1955
- E.current = { minDate: r, maxDate: n, allowedDates: s.allowedDates };
1956
- const J = G(l);
1957
- J.current = l;
1958
- const x = B((F) => {
1959
- const { minDate: A, maxDate: C } = E.current, V = Ce(F, A, C);
1960
- V.getTime() !== P.current.getTime() && (P.current = V, L(V), J.current?.(V));
1961
- }, []), le = B(
1962
- (F) => {
1963
- const { minDate: A, maxDate: C, allowedDates: V } = E.current, O = Zt(V, t, A, C);
1964
- if (O.length > 0) {
1965
- x(Br(O, t, P.current, F));
2175
+ function zl(e) {
2176
+ const { unit: t, minDate: r, maxDate: n, initialValue: a, onChangePoint: i, ...l } = e;
2177
+ Rn("usePeriodSliderPoint", r, n), br("usePeriodSliderPoint", "initialValue", a), vn("usePeriodSliderPoint", "initialValue", t, a, r, n, "[minDate, maxDate]");
2178
+ const c = Ln(l), f = O(a), [g, D] = ye(a);
2179
+ let R = g;
2180
+ const s = Fe(g, r, n);
2181
+ s !== g && (R = s, D(s));
2182
+ const S = O(R);
2183
+ S.current = R;
2184
+ const Z = O({ minDate: r, maxDate: n, allowedDates: c.allowedDates });
2185
+ Z.current = { minDate: r, maxDate: n, allowedDates: c.allowedDates };
2186
+ const ee = O(i);
2187
+ ee.current = i;
2188
+ const x = U((W) => {
2189
+ const { minDate: oe, maxDate: q } = Z.current, X = Fe(W, oe, q);
2190
+ X.getTime() !== S.current.getTime() && (S.current = X, D(X), ee.current?.(X));
2191
+ }, []), ue = U(
2192
+ (W) => {
2193
+ const { minDate: oe, maxDate: q, allowedDates: X } = Z.current, y = Vt(X, t, oe, q);
2194
+ if (y.length > 0) {
2195
+ x(Dn(y, t, S.current, W));
1966
2196
  return;
1967
2197
  }
1968
- x(Ee(t, P.current, F));
2198
+ x(Oe(t, S.current, W));
1969
2199
  },
1970
2200
  [t, x]
1971
- ), y = B(() => {
2201
+ ), ae = U(() => {
1972
2202
  x(f.current);
1973
- }, [x]), j = T(
2203
+ }, [x]), $ = C(
1974
2204
  () => ({
1975
- value: M,
2205
+ value: R,
1976
2206
  onChange: x,
1977
2207
  minDate: r,
1978
2208
  maxDate: n,
1979
2209
  unit: t
1980
2210
  }),
1981
- [M, x, r, n, t]
1982
- ), D = T(
2211
+ [R, x, r, n, t]
2212
+ ), H = C(
1983
2213
  () => ({
1984
- ...s,
2214
+ ...c,
1985
2215
  mode: "point",
1986
2216
  unit: t,
1987
- value: M,
2217
+ value: R,
1988
2218
  minDate: r,
1989
2219
  maxDate: n,
1990
2220
  onChangePoint: x
1991
2221
  }),
1992
- [s, t, M, r, n, x]
2222
+ [c, t, R, r, n, x]
1993
2223
  );
1994
2224
  return {
1995
- value: M,
1996
- setValue: L,
1997
- shiftValue: le,
1998
- resetValue: y,
1999
- selectorProps: j,
2000
- sliderProps: D
2225
+ value: R,
2226
+ setValue: D,
2227
+ shiftValue: ue,
2228
+ resetValue: ae,
2229
+ selectorProps: $,
2230
+ sliderProps: H
2001
2231
  };
2002
2232
  }
2003
- function Eo(e) {
2004
- const { unit: t, minDate: r, maxDate: n, initialMacroRange: a, initialMicroRange: l, macroUnit: o = t, microUnit: s = t, onChangeMacroRange: f, onChangeMicroRange: m, ...L } = e;
2005
- zr("useVernierSlider", r, n), Or("useVernierSlider", "initialMacroRange", a), Or("useVernierSlider", "initialMicroRange", l), Ur("useVernierSlider", "initialMacroRange", a, r, n, "[minDate, maxDate]"), Ur("useVernierSlider", "initialMicroRange", l, a[0], et(o, s, a[1]), "the initial macro window");
2006
- const M = _r(L), u = G(a), P = G(l), [E, J] = Te(a), [x, le] = Te(l);
2007
- let y = E;
2008
- const j = [Ce(E[0], r, n), Ce(E[1], r, n)];
2009
- (j[0] !== E[0] || j[1] !== E[1]) && (y = j, J(j));
2010
- let D = x;
2011
- const F = Cr(x, o, s, y);
2012
- (F[0] !== x[0] || F[1] !== x[1]) && (D = F, le(F));
2013
- const A = G(y);
2014
- A.current = y;
2015
- const C = G(D);
2016
- C.current = D;
2017
- const V = G({ minDate: r, maxDate: n });
2018
- V.current = { minDate: r, maxDate: n };
2019
- const O = G(f);
2020
- O.current = f;
2021
- const v = G(m);
2022
- v.current = m;
2023
- const $ = B((k, z) => {
2024
- const ue = A.current, be = C.current;
2025
- (k[0].getTime() !== ue[0].getTime() || k[1].getTime() !== ue[1].getTime()) && (A.current = k, J(k), O.current?.(k[0], k[1])), (z[0].getTime() !== be[0].getTime() || z[1].getTime() !== be[1].getTime()) && (C.current = z, le(z), v.current?.(z[0], z[1]));
2026
- }, []), R = B(
2027
- (k, z) => {
2028
- const { minDate: ue, maxDate: be } = V.current, $e = [Ce(k, ue, be), Ce(z, ue, be)];
2029
- $($e, Cr(C.current, o, s, $e));
2233
+ function Bl(e) {
2234
+ const { unit: t, minDate: r, maxDate: n, initialMacroRange: a, initialMicroRange: i, macroUnit: l = t, microUnit: c = t, onChangeMacroRange: f, onChangeMicroRange: g, ...D } = e;
2235
+ Rn("useVernierSliderRange", r, n), wn("useVernierSliderRange", "initialMacroRange", a), wn("useVernierSliderRange", "initialMicroRange", i), pn("useVernierSliderRange", "initialMacroRange", l, a, r, n, "[minDate, maxDate]");
2236
+ const R = xt(l, c, a, r, n);
2237
+ pn("useVernierSliderRange", "initialMicroRange", c, i, R[0], R[1], "the initial macro window");
2238
+ const s = Ln(D), S = O(a), Z = O(i), [ee, x] = ye(a), [ue, ae] = ye(i);
2239
+ let $ = ee;
2240
+ const H = [Fe(ee[0], r, n), Fe(ee[1], r, n)];
2241
+ (H[0] !== ee[0] || H[1] !== ee[1]) && ($ = H, x(H));
2242
+ const W = C(() => xt(l, c, $, r, n), [l, c, $, r, n]), oe = C(
2243
+ () => Mn(W, c, s.microIsDiscrete, s.microAllowedDates ?? s.allowedDates, r, n),
2244
+ [W, c, s.microIsDiscrete, s.microAllowedDates, s.allowedDates, r, n]
2245
+ ), q = C(
2246
+ () => s.macroIsDiscrete === !0 ? Vt(s.macroAllowedDates ?? s.allowedDates, l, r, n) : [],
2247
+ [s.macroIsDiscrete, s.macroAllowedDates, s.allowedDates, l, r, n]
2248
+ ), X = O(q);
2249
+ X.current = q;
2250
+ let y = ue;
2251
+ const L = dn(ue, c, W, oe);
2252
+ (L[0] !== ue[0] || L[1] !== ue[1]) && (y = L, ae(L));
2253
+ const T = O($);
2254
+ T.current = $;
2255
+ const k = O(y);
2256
+ k.current = y;
2257
+ const V = O({ minDate: r, maxDate: n, macroIsDiscrete: s.macroIsDiscrete, macroAllowedDates: s.macroAllowedDates, microIsDiscrete: s.microIsDiscrete, microAllowedDates: s.microAllowedDates, allowedDates: s.allowedDates });
2258
+ V.current = { minDate: r, maxDate: n, macroIsDiscrete: s.macroIsDiscrete, macroAllowedDates: s.macroAllowedDates, microIsDiscrete: s.microIsDiscrete, microAllowedDates: s.microAllowedDates, allowedDates: s.allowedDates };
2259
+ const ne = O(f);
2260
+ ne.current = f;
2261
+ const ce = O(g);
2262
+ ce.current = g;
2263
+ const G = U(
2264
+ (v) => {
2265
+ const { minDate: Y, maxDate: p } = V.current;
2266
+ return xt(l, c, v, Y, p);
2267
+ },
2268
+ [l, c]
2269
+ ), J = U(
2270
+ (v) => {
2271
+ const { microIsDiscrete: Y, microAllowedDates: p, allowedDates: j, minDate: de, maxDate: we } = V.current;
2272
+ return Mn(v, c, Y, p ?? j, de, we);
2273
+ },
2274
+ [c]
2275
+ ), z = U((v, Y) => {
2276
+ const p = T.current, j = k.current;
2277
+ (v[0].getTime() !== p[0].getTime() || v[1].getTime() !== p[1].getTime()) && (T.current = v, x(v), ne.current?.(v[0], v[1])), (Y[0].getTime() !== j[0].getTime() || Y[1].getTime() !== j[1].getTime()) && (k.current = Y, ae(Y), ce.current?.(Y[0], Y[1]));
2278
+ }, []), _ = U(
2279
+ (v, Y) => {
2280
+ const { minDate: p, maxDate: j } = V.current, de = [Fe(v, p, j), Fe(Y, p, j)], we = G(de);
2281
+ z(de, dn(k.current, c, we, J(we)));
2030
2282
  },
2031
- [o, s, $]
2032
- ), w = B(
2033
- (k, z) => {
2034
- $(A.current, Cr([k, z], o, s, A.current));
2283
+ [c, G, J, z]
2284
+ ), me = U(
2285
+ (v, Y) => {
2286
+ const p = G(T.current);
2287
+ z(T.current, dn([v, Y], c, p, J(p)));
2035
2288
  },
2036
- [o, s, $]
2037
- ), K = B(
2038
- (k) => {
2039
- const z = A.current[1], ue = k > z ? k : z;
2040
- R(k, ue);
2289
+ [c, G, J, z]
2290
+ ), ge = U(
2291
+ (v) => {
2292
+ const Y = T.current[1], p = v > Y ? v : Y;
2293
+ _(v, p);
2041
2294
  },
2042
- [R]
2043
- ), re = B(
2044
- (k) => {
2045
- const z = A.current[0], ue = k < z ? k : z;
2046
- R(ue, k);
2295
+ [_]
2296
+ ), le = U(
2297
+ (v) => {
2298
+ const Y = T.current[0], p = v < Y ? v : Y;
2299
+ _(p, v);
2047
2300
  },
2048
- [R]
2049
- ), Z = B(
2050
- (k) => {
2051
- const z = C.current[1], ue = k > z ? k : z;
2052
- w(k, ue);
2301
+ [_]
2302
+ ), ze = U(
2303
+ (v) => {
2304
+ const Y = k.current[1], p = v > Y ? v : Y;
2305
+ me(v, p);
2053
2306
  },
2054
- [w]
2055
- ), me = B(
2056
- (k) => {
2057
- const z = C.current[0], ue = k < z ? k : z;
2058
- w(ue, k);
2307
+ [me]
2308
+ ), Ee = U(
2309
+ (v) => {
2310
+ const Y = k.current[0], p = v < Y ? v : Y;
2311
+ me(p, v);
2059
2312
  },
2060
- [w]
2061
- ), De = B(
2062
- (k) => {
2063
- const { minDate: z, maxDate: ue } = V.current, be = A.current, $e = Ee(o, be[0], k), Xe = Ee(o, be[1], k);
2064
- $e < z || Xe > ue || R($e, Xe);
2313
+ [me]
2314
+ ), Te = U(
2315
+ (v) => {
2316
+ const { minDate: Y, maxDate: p } = V.current, j = T.current, de = X.current;
2317
+ if (de.length > 0) {
2318
+ const He = be(de, j[0], l) + v, rt = be(de, j[1], l) + v;
2319
+ if (He < 0 || rt > de.length - 1) return;
2320
+ _(de[He], de[rt]);
2321
+ return;
2322
+ }
2323
+ const we = Oe(l, j[0], v), Ae = Oe(l, j[1], v);
2324
+ we < Y || Ae > p || _(we, Ae);
2065
2325
  },
2066
- [o, R]
2067
- ), se = B(
2068
- (k) => {
2069
- const z = A.current, ue = C.current, be = Ee(s, ue[0], k), $e = Ee(s, ue[1], k);
2070
- be < z[0] || $e > et(o, s, z[1]) || w(be, $e);
2326
+ [l, _]
2327
+ ), Pe = U(
2328
+ (v) => {
2329
+ const Y = T.current, p = k.current, j = G(Y), [de, we] = j, Ae = J(j);
2330
+ if (Ae.length > 0) {
2331
+ const ve = be(Ae, p[0], c) + v, pe = be(Ae, p[1], c) + v;
2332
+ if (ve < 0 || pe > Ae.length - 1) return;
2333
+ me(Ae[ve], Ae[pe]);
2334
+ return;
2335
+ }
2336
+ const He = Oe(c, p[0], v), rt = Oe(c, p[1], v);
2337
+ He < de || rt > we || me(He, rt);
2071
2338
  },
2072
- [o, s, w]
2073
- ), ne = B(() => {
2074
- const k = u.current;
2075
- $(k, Cr(P.current, o, s, k));
2076
- }, [o, s, $]), te = T(() => et(o, s, y[1]), [o, s, y[1]]), Me = T(
2339
+ [c, G, J, me]
2340
+ ), qe = U(() => {
2341
+ const v = S.current, Y = G(v);
2342
+ z(v, dn(Z.current, c, Y, J(Y)));
2343
+ }, [c, G, J, z]), [Be, tt] = W, Ue = C(
2077
2344
  () => ({
2078
- value: y[0],
2079
- onChange: K,
2345
+ value: $[0],
2346
+ onChange: ge,
2080
2347
  minDate: r,
2081
- maxDate: y[1],
2082
- unit: o
2348
+ maxDate: $[1],
2349
+ unit: l
2083
2350
  }),
2084
- [y, K, r, o]
2085
- ), We = T(
2351
+ [$, ge, r, l]
2352
+ ), it = C(
2086
2353
  () => ({
2087
- value: y[1],
2088
- onChange: re,
2089
- minDate: y[0],
2354
+ value: $[1],
2355
+ onChange: le,
2356
+ minDate: $[0],
2090
2357
  maxDate: n,
2091
- unit: o
2358
+ unit: l
2092
2359
  }),
2093
- [y, re, n, o]
2094
- ), q = T(
2360
+ [$, le, n, l]
2361
+ ), K = C(
2095
2362
  () => ({
2096
- value: D[0],
2097
- onChange: Z,
2098
- minDate: y[0],
2099
- maxDate: D[1],
2100
- unit: s
2363
+ value: y[0],
2364
+ onChange: ze,
2365
+ minDate: Be,
2366
+ maxDate: y[1],
2367
+ unit: c
2101
2368
  }),
2102
- [D, Z, y, s]
2103
- ), Q = T(
2369
+ [y, ze, Be, c]
2370
+ ), B = C(
2104
2371
  () => ({
2105
- value: D[1],
2106
- onChange: me,
2107
- minDate: D[0],
2108
- maxDate: te,
2109
- unit: s
2372
+ value: y[1],
2373
+ onChange: Ee,
2374
+ minDate: y[0],
2375
+ maxDate: tt,
2376
+ unit: c
2110
2377
  }),
2111
- [D, me, te, s]
2112
- ), ce = T(
2378
+ [y, Ee, tt, c]
2379
+ ), te = C(
2113
2380
  () => ({
2114
- ...M,
2381
+ ...s,
2115
2382
  mode: "vernier",
2116
2383
  unit: t,
2117
- macroUnit: o,
2118
- microUnit: s,
2384
+ macroUnit: l,
2385
+ microUnit: c,
2119
2386
  minDate: r,
2120
2387
  maxDate: n,
2121
- macroRange: y,
2122
- microRange: D,
2123
- onChangeMacroRange: R,
2124
- onChangeMicroRange: w
2388
+ macroRange: $,
2389
+ microRange: y,
2390
+ onChangeMacroRange: _,
2391
+ onChangeMicroRange: me
2125
2392
  }),
2126
- [M, t, o, s, r, n, y, D, R, w]
2393
+ [s, t, l, c, r, n, $, y, _, me]
2127
2394
  );
2128
2395
  return {
2129
- macroRange: y,
2130
- setMacroRange: J,
2131
- microRange: D,
2132
- setMicroRange: le,
2133
- setMacroLowerDate: K,
2134
- setMacroUpperDate: re,
2135
- setMicroLowerDate: Z,
2136
- setMicroUpperDate: me,
2137
- shiftMacroRange: De,
2138
- shiftMicroRange: se,
2139
- resetVernier: ne,
2140
- macroStartSelectorProps: Me,
2141
- macroEndSelectorProps: We,
2142
- microStartSelectorProps: q,
2143
- microEndSelectorProps: Q,
2144
- sliderProps: ce
2396
+ macroRange: $,
2397
+ setMacroRange: x,
2398
+ microRange: y,
2399
+ setMicroRange: ae,
2400
+ setMacroLowerDate: ge,
2401
+ setMacroUpperDate: le,
2402
+ setMicroLowerDate: ze,
2403
+ setMicroUpperDate: Ee,
2404
+ shiftMacroRange: Te,
2405
+ shiftMicroRange: Pe,
2406
+ resetVernier: qe,
2407
+ macroStartSelectorProps: Ue,
2408
+ macroEndSelectorProps: it,
2409
+ microStartSelectorProps: K,
2410
+ microEndSelectorProps: B,
2411
+ sliderProps: te
2145
2412
  };
2146
2413
  }
2147
- function Vo(e) {
2148
- const { unit: t, minDate: r, maxDate: n, initialMacroRange: a, initialMicroValue: l, macroUnit: o = t, microUnit: s = t, onChangeMacroRange: f, onChangeMicroPoint: m, ...L } = e;
2149
- zr("useVernierSliderPoint", r, n), Or("useVernierSliderPoint", "initialMacroRange", a), Qt("useVernierSliderPoint", "initialMicroValue", l), Ur("useVernierSliderPoint", "initialMacroRange", a, r, n, "[minDate, maxDate]"), Fr("useVernierSliderPoint", "initialMicroValue", l, a[0], et(o, s, a[1]), "the initial macro window");
2150
- const M = _r(L), u = G(a), P = G(l), [E, J] = Te(a), [x, le] = Te(l);
2151
- let y = E;
2152
- const j = [Ce(E[0], r, n), Ce(E[1], r, n)];
2153
- (j[0] !== E[0] || j[1] !== E[1]) && (y = j, J(j));
2154
- let D = x;
2155
- const F = Er(x, o, s, y);
2156
- F !== x && (D = F, le(F));
2157
- const A = G(y);
2158
- A.current = y;
2159
- const C = G(D);
2160
- C.current = D;
2161
- const V = G({ minDate: r, maxDate: n, microIsDiscrete: M.microIsDiscrete, microAllowedDates: M.microAllowedDates, allowedDates: M.allowedDates });
2162
- V.current = { minDate: r, maxDate: n, microIsDiscrete: M.microIsDiscrete, microAllowedDates: M.microAllowedDates, allowedDates: M.allowedDates };
2163
- const O = G(f);
2164
- O.current = f;
2165
- const v = G(m);
2166
- v.current = m;
2167
- const $ = B((q, Q) => {
2168
- const ce = A.current, k = C.current;
2169
- (q[0].getTime() !== ce[0].getTime() || q[1].getTime() !== ce[1].getTime()) && (A.current = q, J(q), O.current?.(q[0], q[1])), Q.getTime() !== k.getTime() && (C.current = Q, le(Q), v.current?.(Q));
2170
- }, []), R = B(
2171
- (q, Q) => {
2172
- const { minDate: ce, maxDate: k } = V.current, z = [Ce(q, ce, k), Ce(Q, ce, k)];
2173
- $(z, Er(C.current, o, s, z));
2414
+ function Ul(e) {
2415
+ const { unit: t, minDate: r, maxDate: n, initialMacroRange: a, initialMicroValue: i, macroUnit: l = t, microUnit: c = t, onChangeMacroRange: f, onChangeMicroPoint: g, ...D } = e;
2416
+ Rn("useVernierSliderPoint", r, n), wn("useVernierSliderPoint", "initialMacroRange", a), br("useVernierSliderPoint", "initialMicroValue", i), pn("useVernierSliderPoint", "initialMacroRange", l, a, r, n, "[minDate, maxDate]");
2417
+ const R = xt(l, c, a, r, n);
2418
+ vn("useVernierSliderPoint", "initialMicroValue", c, i, R[0], R[1], "the initial macro window");
2419
+ const s = Ln(D), S = O(a), Z = O(i), [ee, x] = ye(a), [ue, ae] = ye(i);
2420
+ let $ = ee;
2421
+ const H = [Fe(ee[0], r, n), Fe(ee[1], r, n)];
2422
+ (H[0] !== ee[0] || H[1] !== ee[1]) && ($ = H, x(H));
2423
+ const W = C(() => xt(l, c, $, r, n), [l, c, $, r, n]), oe = C(
2424
+ () => Mn(W, c, s.microIsDiscrete, s.microAllowedDates ?? s.allowedDates, r, n),
2425
+ [W, c, s.microIsDiscrete, s.microAllowedDates, s.allowedDates, r, n]
2426
+ ), q = C(
2427
+ () => s.macroIsDiscrete === !0 ? Vt(s.macroAllowedDates ?? s.allowedDates, l, r, n) : [],
2428
+ [s.macroIsDiscrete, s.macroAllowedDates, s.allowedDates, l, r, n]
2429
+ ), X = O(q);
2430
+ X.current = q;
2431
+ let y = ue;
2432
+ const L = hr(ue, c, W, oe);
2433
+ L !== ue && (y = L, ae(L));
2434
+ const T = O($);
2435
+ T.current = $;
2436
+ const k = O(y);
2437
+ k.current = y;
2438
+ const V = O({ minDate: r, maxDate: n, macroIsDiscrete: s.macroIsDiscrete, macroAllowedDates: s.macroAllowedDates, microIsDiscrete: s.microIsDiscrete, microAllowedDates: s.microAllowedDates, allowedDates: s.allowedDates });
2439
+ V.current = { minDate: r, maxDate: n, macroIsDiscrete: s.macroIsDiscrete, macroAllowedDates: s.macroAllowedDates, microIsDiscrete: s.microIsDiscrete, microAllowedDates: s.microAllowedDates, allowedDates: s.allowedDates };
2440
+ const ne = O(f);
2441
+ ne.current = f;
2442
+ const ce = O(g);
2443
+ ce.current = g;
2444
+ const G = U(
2445
+ (K) => {
2446
+ const { minDate: B, maxDate: te } = V.current;
2447
+ return xt(l, c, K, B, te);
2174
2448
  },
2175
- [o, s, $]
2176
- ), w = B(
2177
- (q) => {
2178
- $(A.current, Er(q, o, s, A.current));
2449
+ [l, c]
2450
+ ), J = U(
2451
+ (K) => {
2452
+ const { microIsDiscrete: B, microAllowedDates: te, allowedDates: v, minDate: Y, maxDate: p } = V.current;
2453
+ return Mn(K, c, B, te ?? v, Y, p);
2179
2454
  },
2180
- [o, s, $]
2181
- ), K = B(
2182
- (q) => {
2183
- const Q = A.current[1], ce = q > Q ? q : Q;
2184
- R(q, ce);
2455
+ [c]
2456
+ ), z = U((K, B) => {
2457
+ const te = T.current, v = k.current;
2458
+ (K[0].getTime() !== te[0].getTime() || K[1].getTime() !== te[1].getTime()) && (T.current = K, x(K), ne.current?.(K[0], K[1])), B.getTime() !== v.getTime() && (k.current = B, ae(B), ce.current?.(B));
2459
+ }, []), _ = U(
2460
+ (K, B) => {
2461
+ const { minDate: te, maxDate: v } = V.current, Y = [Fe(K, te, v), Fe(B, te, v)], p = G(Y);
2462
+ z(Y, hr(k.current, c, p, J(p)));
2185
2463
  },
2186
- [R]
2187
- ), re = B(
2188
- (q) => {
2189
- const Q = A.current[0], ce = q < Q ? q : Q;
2190
- R(ce, q);
2464
+ [c, G, J, z]
2465
+ ), me = U(
2466
+ (K) => {
2467
+ const B = G(T.current);
2468
+ z(T.current, hr(K, c, B, J(B)));
2191
2469
  },
2192
- [R]
2193
- ), Z = B(
2194
- (q) => {
2195
- const { minDate: Q, maxDate: ce } = V.current, k = A.current, z = Ee(o, k[0], q), ue = Ee(o, k[1], q);
2196
- z < Q || ue > ce || R(z, ue);
2470
+ [c, G, J, z]
2471
+ ), ge = U(
2472
+ (K) => {
2473
+ const B = T.current[1], te = K > B ? K : B;
2474
+ _(K, te);
2197
2475
  },
2198
- [o, R]
2199
- ), me = B(
2200
- (q) => {
2201
- const Q = A.current, ce = et(o, s, Q[1]), { microIsDiscrete: k, microAllowedDates: z, allowedDates: ue, minDate: be, maxDate: $e } = V.current, Xe = k === !0 ? Zt(z ?? ue, s, be, $e) : [], Ge = Q[0].getTime(), at = ce.getTime(), ie = Xe.filter((Re) => Re.getTime() >= Ge && Re.getTime() <= at);
2202
- if (ie.length > 0) {
2203
- w(Br(ie, s, C.current, q));
2476
+ [_]
2477
+ ), le = U(
2478
+ (K) => {
2479
+ const B = T.current[0], te = K < B ? K : B;
2480
+ _(te, K);
2481
+ },
2482
+ [_]
2483
+ ), ze = U(
2484
+ (K) => {
2485
+ const { minDate: B, maxDate: te } = V.current, v = T.current, Y = X.current;
2486
+ if (Y.length > 0) {
2487
+ const de = be(Y, v[0], l) + K, we = be(Y, v[1], l) + K;
2488
+ if (de < 0 || we > Y.length - 1) return;
2489
+ _(Y[de], Y[we]);
2204
2490
  return;
2205
2491
  }
2206
- w(Ee(s, C.current, q));
2492
+ const p = Oe(l, v[0], K), j = Oe(l, v[1], K);
2493
+ p < B || j > te || _(p, j);
2207
2494
  },
2208
- [o, s, w]
2209
- ), De = B(() => {
2210
- const q = u.current;
2211
- $(q, Er(P.current, o, s, q));
2212
- }, [o, s, $]), se = T(() => et(o, s, y[1]), [o, s, y[1]]), ne = T(
2495
+ [l, _]
2496
+ ), Ee = U(
2497
+ (K) => {
2498
+ const B = T.current, te = G(B), v = J(te);
2499
+ if (v.length > 0) {
2500
+ me(Dn(v, c, k.current, K));
2501
+ return;
2502
+ }
2503
+ me(Oe(c, k.current, K));
2504
+ },
2505
+ [c, G, J, me]
2506
+ ), Te = U(() => {
2507
+ const K = S.current, B = G(K);
2508
+ z(K, hr(Z.current, c, B, J(B)));
2509
+ }, [c, G, J, z]), [Pe, qe] = W, Be = C(
2213
2510
  () => ({
2214
- value: y[0],
2215
- onChange: K,
2511
+ value: $[0],
2512
+ onChange: ge,
2216
2513
  minDate: r,
2217
- maxDate: y[1],
2218
- unit: o
2514
+ maxDate: $[1],
2515
+ unit: l
2219
2516
  }),
2220
- [y, K, r, o]
2221
- ), te = T(
2517
+ [$, ge, r, l]
2518
+ ), tt = C(
2222
2519
  () => ({
2223
- value: y[1],
2224
- onChange: re,
2225
- minDate: y[0],
2520
+ value: $[1],
2521
+ onChange: le,
2522
+ minDate: $[0],
2226
2523
  maxDate: n,
2227
- unit: o
2524
+ unit: l
2228
2525
  }),
2229
- [y, re, n, o]
2230
- ), Me = T(
2526
+ [$, le, n, l]
2527
+ ), Ue = C(
2231
2528
  () => ({
2232
- value: D,
2233
- onChange: w,
2234
- minDate: y[0],
2235
- maxDate: se,
2236
- unit: s
2529
+ value: y,
2530
+ onChange: me,
2531
+ minDate: Pe,
2532
+ maxDate: qe,
2533
+ unit: c
2237
2534
  }),
2238
- [D, w, y, se, s]
2239
- ), We = T(
2535
+ [y, me, Pe, qe, c]
2536
+ ), it = C(
2240
2537
  () => ({
2241
- ...M,
2538
+ ...s,
2242
2539
  mode: "vernier",
2243
2540
  unit: t,
2244
- macroUnit: o,
2245
- microUnit: s,
2541
+ macroUnit: l,
2542
+ microUnit: c,
2246
2543
  minDate: r,
2247
2544
  maxDate: n,
2248
- macroRange: y,
2249
- microValue: D,
2250
- onChangeMacroRange: R,
2251
- onChangeMicroPoint: w
2545
+ macroRange: $,
2546
+ microValue: y,
2547
+ onChangeMacroRange: _,
2548
+ onChangeMicroPoint: me
2252
2549
  }),
2253
- [M, t, o, s, r, n, y, D, R, w]
2550
+ [s, t, l, c, r, n, $, y, _, me]
2254
2551
  );
2255
2552
  return {
2256
- macroRange: y,
2257
- setMacroRange: J,
2258
- microValue: D,
2259
- setMicroValue: le,
2260
- setMacroLowerDate: K,
2261
- setMacroUpperDate: re,
2262
- setMicroDate: w,
2263
- shiftMacroRange: Z,
2264
- shiftMicroValue: me,
2265
- resetVernier: De,
2266
- macroStartSelectorProps: ne,
2267
- macroEndSelectorProps: te,
2268
- microSelectorProps: Me,
2269
- sliderProps: We
2553
+ macroRange: $,
2554
+ setMacroRange: x,
2555
+ microValue: y,
2556
+ setMicroValue: ae,
2557
+ setMacroLowerDate: ge,
2558
+ setMacroUpperDate: le,
2559
+ setMicroDate: me,
2560
+ shiftMacroRange: ze,
2561
+ shiftMicroValue: Ee,
2562
+ resetVernier: Te,
2563
+ macroStartSelectorProps: Be,
2564
+ macroEndSelectorProps: tt,
2565
+ microSelectorProps: Ue,
2566
+ sliderProps: it
2270
2567
  };
2271
2568
  }
2272
- function ta(e) {
2569
+ function Lo(e) {
2273
2570
  const t = new Date(e, 0, 1);
2274
2571
  return t.setFullYear(e), t;
2275
2572
  }
2276
- function Vr(e, t) {
2573
+ function mn(e, t) {
2277
2574
  if (e !== void 0 && (!(e instanceof Date) || Number.isNaN(e.getTime())))
2278
2575
  throw new RangeError(`YearSelector: \`${t}\` must be a valid Date, received ${String(e)}.`);
2279
2576
  }
2280
- function ra(e, t) {
2577
+ function So(e, t) {
2281
2578
  if (e !== void 0 && !Number.isInteger(e))
2282
2579
  throw new RangeError(`YearSelector: \`${t}\` must be an integer year, received ${String(e)}.`);
2283
2580
  }
2284
- function So(e) {
2581
+ function Vl(e) {
2285
2582
  if (e !== void 0)
2286
2583
  try {
2287
2584
  Intl.DateTimeFormat.supportedLocalesOf([e]);
@@ -2289,112 +2586,96 @@ function So(e) {
2289
2586
  throw new RangeError(`YearSelector: \`locale\` must be a valid BCP 47 language tag, received ${JSON.stringify(e)}.`);
2290
2587
  }
2291
2588
  }
2292
- function na(e, t, r) {
2589
+ function yo(e, t, r) {
2293
2590
  const n = e === void 0 ? null : e, a = t === void 0 ? null : t.getFullYear();
2294
2591
  return n !== null && a !== null ? r(n, a) : n !== null ? n : a;
2295
2592
  }
2296
- const Po = (e) => {
2297
- const { value: t, initialDate: r, onChange: n, children: a, minYear: l, maxYear: o, minDate: s, maxDate: f, className: m = "", style: L, disabled: M = !1, prevYearAriaLabel: u = "Previous year", nextYearAriaLabel: P = "Next year", selectAriaLabel: E = "Year", locale: J } = e;
2298
- Vr(t, "value"), Vr(r, "initialDate"), Vr(s, "minDate"), Vr(f, "maxDate"), ra(l, "minYear"), ra(o, "maxYear"), So(J);
2593
+ const Nl = (e) => {
2594
+ const { value: t, initialDate: r, onChange: n, children: a, minYear: i, maxYear: l, minDate: c, maxDate: f, className: g = "", style: D, disabled: R = !1, prevYearAriaLabel: s = "Previous year", nextYearAriaLabel: S = "Next year", selectAriaLabel: Z = "Year", locale: ee } = e;
2595
+ mn(t, "value"), mn(r, "initialDate"), mn(c, "minDate"), mn(f, "maxDate"), So(i, "minYear"), So(l, "maxYear"), Vl(ee);
2299
2596
  const x = t ?? r;
2300
2597
  if (x === void 0)
2301
2598
  throw new RangeError("YearSelector: either `value` (controlled) or `initialDate` (uncontrolled) is required; the selected year is never inferred from the wall clock.");
2302
- const [le, y] = Te(() => x.getFullYear()), j = s?.getTime(), D = f?.getTime(), F = T(() => na(l, s, Math.max), [l, j]), A = T(() => na(o, f, Math.min), [o, D]);
2303
- if (F === null || A === null)
2599
+ const [ue, ae] = ye(() => x.getFullYear()), $ = c?.getTime(), H = f?.getTime(), W = C(() => yo(i, c, Math.max), [i, $]), oe = C(() => yo(l, f, Math.min), [l, H]);
2600
+ if (W === null || oe === null)
2304
2601
  throw new RangeError("YearSelector: a lower bound (`minYear` or `minDate`) and an upper bound (`maxYear` or `maxDate`) are both required; the year option list is never invented.");
2305
- if (F > A)
2306
- throw new RangeError(`YearSelector: the resolved lower bound ${F} is after the resolved upper bound ${A}.`);
2307
- const C = t !== void 0, V = t !== void 0 ? t.getFullYear() : le, O = V < F || V > A, v = x.getTime();
2308
- Yt(() => {
2309
- C || y(x.getFullYear());
2310
- }, [C, v]);
2311
- const $ = (ne) => ne >= F && ne <= A, R = (ne) => {
2312
- if (!M) {
2313
- if (!$(ne))
2314
- throw new RangeError(`YearSelector: refusing to emit ${ne}, which lies outside the declared bounds ${F}-${A}.`);
2315
- C || y(ne), n?.(ta(ne), ne);
2602
+ if (W > oe)
2603
+ throw new RangeError(`YearSelector: the resolved lower bound ${W} is after the resolved upper bound ${oe}.`);
2604
+ const q = t !== void 0, X = t !== void 0 ? t.getFullYear() : ue, y = X < W || X > oe, L = x.getTime();
2605
+ Dt(() => {
2606
+ q || ae(x.getFullYear());
2607
+ }, [q, L]);
2608
+ const T = (z) => z >= W && z <= oe, k = (z) => {
2609
+ if (!R) {
2610
+ if (!T(z))
2611
+ throw new RangeError(`YearSelector: refusing to emit ${z}, which lies outside the declared bounds ${W}-${oe}.`);
2612
+ q || ae(z), n?.(Lo(z), z);
2316
2613
  }
2317
- }, w = $(V - 1) ? V - 1 : null, K = $(V + 1) ? V + 1 : null, re = M || w === null, Z = M || K === null, me = () => {
2318
- w !== null && R(w);
2319
- }, De = () => {
2320
- K !== null && R(K);
2321
- }, se = T(() => {
2322
- const ne = [];
2323
- for (let te = A; te >= F; te--)
2324
- ne.push(te);
2325
- return O && (ne.push(V), ne.sort((te, Me) => Me - te)), ne;
2326
- }, [F, A, O, V]);
2327
- return /* @__PURE__ */ we("div", { className: `inline-flex w-32 items-center ${m}`, style: L, children: [
2328
- /* @__PURE__ */ p(
2329
- "button",
2330
- {
2331
- type: "button",
2332
- "aria-label": u,
2333
- disabled: re,
2334
- className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
2335
- onClick: me,
2336
- children: /* @__PURE__ */ p("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-r-[6px] border-r-slate-500 border-solid hover:border-r-slate-700 dark:border-r-slate-400 dark:hover:border-r-slate-200" })
2337
- }
2338
- ),
2339
- /* @__PURE__ */ p(
2614
+ }, V = T(X - 1) ? X - 1 : null, ne = T(X + 1) ? X + 1 : null, ce = () => {
2615
+ V !== null && k(V);
2616
+ }, G = () => {
2617
+ ne !== null && k(ne);
2618
+ }, J = C(() => {
2619
+ const z = [];
2620
+ for (let _ = oe; _ >= W; _--)
2621
+ z.push(_);
2622
+ return y && (z.push(X), z.sort((_, me) => me - _)), z;
2623
+ }, [W, oe, y, X]);
2624
+ return /* @__PURE__ */ Me("div", { className: `inline-flex items-center ${Fr} ${g}`, style: D, children: [
2625
+ /* @__PURE__ */ I(Ut, { neighbour: "control", direction: "left", disabled: R, canStep: V !== null, onStep: ce, ariaLabel: s }),
2626
+ /* @__PURE__ */ I(
2340
2627
  "select",
2341
2628
  {
2342
- "aria-label": E,
2343
- disabled: M,
2344
- className: "mx-1 my-auto w-18 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",
2345
- value: V,
2346
- onChange: (ne) => {
2347
- if (!ne.target.value) return;
2348
- const te = Number(ne.target.value);
2349
- Number.isInteger(te) && R(te);
2629
+ "aria-label": Z,
2630
+ disabled: R,
2631
+ className: "w-18 appearance-none rounded-md border border-gray-300 bg-gray-100 px-1 py-0.5 text-center font-mono text-gray-900 text-xs tabular-nums [text-align-last:center] [text-align:center] focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 dark:border-slate-600 dark:bg-slate-700 dark:text-slate-100 dark:focus:border-blue-500 dark:focus:ring-blue-500",
2632
+ value: X,
2633
+ onChange: (z) => {
2634
+ if (!z.target.value) return;
2635
+ const _ = Number(z.target.value);
2636
+ Number.isInteger(_) && k(_);
2350
2637
  },
2351
- children: se.map((ne) => /* @__PURE__ */ p("option", { value: ne, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: je("year", ta(ne), void 0, J) }, ne))
2352
- }
2353
- ),
2354
- /* @__PURE__ */ p(
2355
- "button",
2356
- {
2357
- type: "button",
2358
- "aria-label": P,
2359
- disabled: Z,
2360
- className: "relative my-auto inline-flex h-5 w-4 cursor-pointer items-center justify-center rounded p-0 after:absolute after:inset-[-14px] after:content-[''] focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:opacity-40",
2361
- onClick: De,
2362
- children: /* @__PURE__ */ p("span", { className: "h-0 w-0 border-y-[6px] border-y-transparent border-l-[6px] border-l-slate-500 border-solid hover:border-l-slate-700 dark:border-l-slate-400 dark:hover:border-l-slate-200" })
2638
+ children: J.map((z) => /* @__PURE__ */ I("option", { value: z, className: "text-center font-mono text-gray-900 tabular-nums [text-align-last:center] [text-align:center] dark:bg-slate-700 dark:text-slate-100", children: Ke("year", Lo(z), void 0, ee) }, z))
2363
2639
  }
2364
2640
  ),
2641
+ /* @__PURE__ */ I(Ut, { neighbour: "control", direction: "right", disabled: R, canStep: ne !== null, onStep: G, ariaLabel: S }),
2365
2642
  a
2366
2643
  ] });
2367
- }, $o = br(Po, (e, t) => {
2368
- const r = e.value ?? e.initialDate, n = t.value ?? t.initialDate, a = r ? r.getFullYear() : null, l = n ? n.getFullYear() : null;
2369
- return !(a !== l || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear || e.minDate?.getFullYear() !== t.minDate?.getFullYear() || e.maxDate?.getFullYear() !== t.maxDate?.getFullYear() || e.onChange !== t.onChange || e.children !== t.children || e.prevYearAriaLabel !== t.prevYearAriaLabel || e.nextYearAriaLabel !== t.nextYearAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.locale !== t.locale);
2644
+ }, kl = zr(Nl, (e, t) => {
2645
+ const r = e.value ?? e.initialDate, n = t.value ?? t.initialDate, a = r ? r.getFullYear() : null, i = n ? n.getFullYear() : null;
2646
+ return !(a !== i || e.disabled !== t.disabled || e.className !== t.className || e.style !== t.style || e.minYear !== t.minYear || e.maxYear !== t.maxYear || e.minDate?.getFullYear() !== t.minDate?.getFullYear() || e.maxDate?.getFullYear() !== t.maxDate?.getFullYear() || e.onChange !== t.onChange || e.children !== t.children || e.prevYearAriaLabel !== t.prevYearAriaLabel || e.nextYearAriaLabel !== t.nextYearAriaLabel || e.selectAriaLabel !== t.selectAriaLabel || e.locale !== t.locale);
2370
2647
  });
2371
- $o.displayName = "YearSelector";
2648
+ kl.displayName = "YearSelector";
2372
2649
  export {
2373
- Ua as COLOR_SCHEME_PALETTES,
2374
- vo as DateSelector,
2375
- Ro as MonthSelector,
2376
- so as PeriodSlider,
2377
- $o as YearSelector,
2378
- Ee as addUnit,
2379
- io as areStylesEqual,
2380
- Ka as calculateConnectDragValues,
2381
- qn as calculateHandleDragValues,
2382
- qa as calculateKeyboardActionValues,
2383
- la as calculateLabelSlant,
2384
- Ja as calculateVernierMacroDrag,
2385
- Za as calculateVernierMicroDrag,
2386
- ge as decode,
2387
- oe as encode,
2388
- Ae as findNearestDateIndex,
2389
- je as formatLabel,
2390
- jt as formatScreenReaderLabel,
2391
- Xa as getActiveDragHandle,
2392
- et as getMacroWindowEndDate,
2393
- Zt as getSortedAllowedDates,
2394
- ut as normalizeDateByUnit,
2395
- Ga as resolveVernierTargetHandle,
2396
- Co as usePeriodSliderPoint,
2397
- Ao as usePeriodSliderRange,
2398
- Eo as useVernierSlider,
2399
- Vo as useVernierSliderPoint
2650
+ Wi as COLOR_SCHEME_PALETTES,
2651
+ yl as DateSelector,
2652
+ Cl as MonthSelector,
2653
+ bl as PeriodSlider,
2654
+ kl as YearSelector,
2655
+ Oe as addUnit,
2656
+ gl as areStylesEqual,
2657
+ Zi as calculateConnectDragValues,
2658
+ uo as calculateHandleDragValues,
2659
+ Ji as calculateKeyboardActionValues,
2660
+ Vo as calculateLabelSlant,
2661
+ nl as calculateVernierMacroDrag,
2662
+ al as calculateVernierMicroDrag,
2663
+ ie as decode,
2664
+ Q as encode,
2665
+ be as findNearestDateIndex,
2666
+ Ke as formatLabel,
2667
+ dr as formatScreenReaderLabel,
2668
+ Gi as getMacroWindowEndDate,
2669
+ Xi as getMacroWindowStartDate,
2670
+ Vt as getSortedAllowedDates,
2671
+ je as normalizeDateByUnit,
2672
+ da as resolveDraggedEdge,
2673
+ xt as resolveMacroWindow,
2674
+ ko as resolveVernierRailZone,
2675
+ rl as resolveVernierTargetHandle,
2676
+ tl as resolveWheelStep,
2677
+ zl as usePeriodSliderPoint,
2678
+ Fl as usePeriodSliderRange,
2679
+ Ul as useVernierSliderPoint,
2680
+ Bl as useVernierSliderRange
2400
2681
  };