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