@aiquants/period-slider 0.9.0 → 0.10.1

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