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