Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

601 lines
19 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 36466d3530b7d918.083c839b6e.js
* Module id: 404059
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t = e.i(462214),
r = e.i(358379),
a = e.i(403557);
function n(e, t, r) {
return void 0 === t && void 0 === r
? e
: void 0 !== t && void 0 === r
? Math.max(e, t)
: void 0 === t && void 0 !== r
? Math.min(e, r)
: Math.min(Math.max(e, t), r);
}
e.s(["clamp", () => n], 404059);
var o = e.i(600354),
i = e.i(389435),
s = e.i(855698);
function l(e, t) {
return 0 === t.length
? e
: t.reduce((t, r) => (Math.abs(r - e) < Math.abs(t - e) ? r : t));
}
var c = e.i(938202);
e.i(7284);
var u = e.i(620428),
d = e.i(479324),
p = e.i(450943),
m = e.i(593307),
f = e.i(46978);
let [h, g] = (0, e.i(559394).createSafeContext)(
"SliderProvider was not found in tree",
);
var v = {
root: "m_dd36362e",
label: "m_c9357328",
thumb: "m_c9a9a60a",
trackContainer: "m_a8645c2",
track: "m_c9ade57f",
bar: "m_38aeed47",
markWrapper: "m_b7b0423a",
mark: "m_dd33bc19",
markLabel: "m_68c77a5b",
},
x = e.i(124859);
let b = (0, r.forwardRef)(
(
{
size: e,
disabled: r,
variant: a,
color: n,
thumbSize: o,
radius: i,
...s
},
l,
) => {
let { getStyles: c } = g();
return (0, t.jsx)(x.Box, {
tabIndex: -1,
variant: a,
size: e,
ref: l,
...c("root"),
...s,
});
},
);
b.displayName = "@mantine/core/SliderRoot";
var y = e.i(764218);
let w = (0, r.forwardRef)(
(
{
max: e,
min: a,
value: n,
position: o,
label: i,
dragging: s,
onMouseDown: l,
onKeyDownCapture: c,
labelTransitionProps: u,
labelAlwaysOn: d,
thumbLabel: p,
onFocus: m,
onBlur: f,
showLabelOnHover: h,
isHovered: v,
children: b = null,
disabled: w,
},
k,
) => {
let { getStyles: S } = g(),
[C, P] = (0, r.useState)(!1),
M = d || s || C || (h && v);
return (0, t.jsxs)(x.Box, {
tabIndex: 0,
role: "slider",
"aria-label": p,
"aria-valuemax": e,
"aria-valuemin": a,
"aria-valuenow": n,
ref: k,
__vars: { "--slider-thumb-offset": `${o}%` },
...S("thumb", { focusable: !0 }),
mod: { dragging: s, disabled: w },
onFocus: (e) => {
P(!0), "function" == typeof m && m(e);
},
onBlur: (e) => {
P(!1), "function" == typeof f && f(e);
},
onTouchStart: l,
onMouseDown: l,
onKeyDownCapture: c,
onClick: (e) => e.stopPropagation(),
children: [
b,
(0, t.jsx)(y.Transition, {
mounted: null != i && !!M,
transition: "fade",
duration: 0,
...u,
children: (e) =>
(0, t.jsx)("div", { ...S("label", { style: e }), children: i }),
}),
],
});
},
);
function k({ value: e, min: t, max: r }) {
return Math.min(Math.max(((e - t) / (r - t)) * 100, 0), 100);
}
function S({
marks: e,
min: a,
max: n,
disabled: o,
value: i,
offset: s,
inverted: l,
}) {
let { getStyles: c } = g();
if (!e) return null;
let u = e.map((e, u) =>
(0, r.createElement)(
x.Box,
{
...c("markWrapper"),
__vars: {
"--mark-offset": `${k({ value: e.value, min: a, max: n })}%`,
},
key: u,
},
(0, t.jsx)(x.Box, {
...c("mark"),
mod: {
filled: (function ({
mark: e,
offset: t,
value: r,
inverted: a = !1,
}) {
return a
? ("number" == typeof t && e.value <= t) || e.value >= r
: "number" == typeof t
? e.value >= t && e.value <= r
: e.value <= r;
})({ mark: e, value: i, offset: s, inverted: l }),
disabled: o,
},
}),
e.label &&
(0, t.jsx)("div", { ...c("markLabel"), children: e.label }),
),
);
return (0, t.jsx)("div", { children: u });
}
function C({
filled: e,
children: r,
offset: a,
disabled: n,
marksOffset: o,
inverted: i,
containerProps: s,
...l
}) {
let { getStyles: c } = g();
return (0, t.jsx)(x.Box, {
...c("trackContainer"),
mod: { disabled: n },
...s,
children: (0, t.jsxs)(x.Box, {
...c("track"),
mod: { inverted: i, disabled: n },
children: [
(0, t.jsx)(x.Box, {
mod: { inverted: i, disabled: n },
__vars: {
"--slider-bar-width": `calc(${e}% + 2 * var(--slider-size))`,
"--slider-bar-offset": `calc(${a}% - var(--slider-size))`,
},
...c("bar"),
}),
r,
(0, t.jsx)(S, { ...l, offset: o, disabled: n, inverted: i }),
],
}),
});
}
function P(e, t) {
return parseFloat(e.toFixed(t));
}
function M(e, t) {
let r = [...t].sort((e, t) => e.value - t.value).find((t) => t.value > e);
return r ? r.value : e;
}
function _(e, t) {
let r = [...t].sort((e, t) => t.value - e.value).find((t) => t.value < e);
return r ? r.value : e;
}
function T(e) {
let t = [...e].sort((e, t) => e.value - t.value);
return t.length > 0 ? t[0].value : 0;
}
function I(e) {
let t = [...e].sort((e, t) => e.value - t.value);
return t.length > 0 ? t[t.length - 1].value : 100;
}
(w.displayName = "@mantine/core/SliderThumb"),
(S.displayName = "@mantine/core/SliderMarks"),
(C.displayName = "@mantine/core/SliderTrack");
let j = {
radius: "xl",
min: 0,
max: 100,
step: 1,
marks: [],
label: (e) => e,
labelTransitionProps: { transition: "fade", duration: 0 },
thumbLabel: "",
showLabelOnHover: !0,
scale: (e) => e,
size: "md",
},
N = (0, c.createVarsResolver)(
(e, { size: t, color: r, thumbSize: a, radius: n }) => ({
root: {
"--slider-size": (0, s.getSize)(t, "slider-size"),
"--slider-color": r ? (0, u.getThemeColor)(r, e) : void 0,
"--slider-radius": void 0 === n ? void 0 : (0, s.getRadius)(n),
"--slider-thumb-size":
void 0 !== a ? (0, i.rem)(a) : "calc(var(--slider-size) * 2)",
},
}),
),
B = (0, m.factory)((e, i) => {
let s = (0, d.useProps)("Slider", j, e),
{
classNames: c,
styles: u,
value: m,
onChange: g,
onChangeEnd: x,
size: y,
min: S,
max: B,
domain: E,
step: D,
precision: A,
defaultValue: R,
name: L,
marks: O,
label: H,
labelTransitionProps: F,
labelAlwaysOn: $,
thumbLabel: K,
showLabelOnHover: V,
thumbChildren: z,
disabled: U,
unstyled: G,
scale: J,
inverted: Y,
className: q,
style: W,
vars: X,
hiddenInputProps: Z,
restrictToMarks: Q,
thumbProps: ee,
attributes: et,
...er
} = s,
ea = (0, p.useStyles)({
name: "Slider",
props: s,
classes: v,
classNames: c,
className: q,
styles: u,
style: W,
attributes: et,
vars: X,
varsResolver: N,
unstyled: G,
}),
{ dir: en } = (0, f.useDirection)(),
[eo, ei] = (0, r.useState)(!1),
[es, el] = (0, a.useUncontrolled)({
value: "number" == typeof m ? n(m, S, B) : m,
defaultValue: "number" == typeof R ? n(R, S, B) : R,
finalValue: n(0, S, B),
onChange: g,
}),
ec = (0, r.useRef)(es),
eu = (0, r.useRef)(x);
(0, r.useEffect)(() => {
eu.current = x;
}, [x]);
let ed = (0, r.useRef)(null),
ep = (0, r.useRef)(null),
[em, ef] = E || [S, B],
eh = k({ value: es, min: em, max: ef }),
eg = J(es),
ev = "function" == typeof H ? H(eg) : H,
ex =
A ??
(function (e) {
if (!e) return 0;
let t = e.toString().split(".");
return t.length > 1 ? t[1].length : 0;
})(D),
{ ref: eb, active: ey } = (function (e, t, a = "ltr") {
let o = (0, r.useRef)(!1),
i = (0, r.useRef)(!1),
s = (0, r.useRef)(0),
[l, c] = (0, r.useState)(!1),
u = (0, r.useRef)(null);
return (
(0, r.useEffect)(() => {
o.current = !0;
}, []),
{
ref: (0, r.useCallback)(
(r) => {
if ((u.current && (u.current(), (u.current = null)), !r))
return;
let l = ({ x: t, y: i }) => {
cancelAnimationFrame(s.current),
(s.current = requestAnimationFrame(() => {
if (o.current && r) {
r.style.userSelect = "none";
let o = r.getBoundingClientRect();
if (o.width && o.height) {
let r = n((t - o.left) / o.width, 0, 1);
e({
x: "ltr" === a ? r : 1 - r,
y: n((i - o.top) / o.height, 0, 1),
});
}
}
}));
},
d = () => {
!i.current &&
o.current &&
((i.current = !0),
"function" == typeof t?.onScrubStart &&
t.onScrubStart(),
c(!0),
document.addEventListener("mousemove", f),
document.addEventListener("mouseup", p),
document.addEventListener("touchmove", g, {
passive: !1,
}),
document.addEventListener("touchend", p));
},
p = () => {
i.current &&
o.current &&
((i.current = !1),
c(!1),
document.removeEventListener("mousemove", f),
document.removeEventListener("mouseup", p),
document.removeEventListener("touchmove", g),
document.removeEventListener("touchend", p),
setTimeout(() => {
"function" == typeof t?.onScrubEnd &&
t.onScrubEnd();
}, 0));
},
m = (e) => {
d(), e.preventDefault(), f(e);
},
f = (e) => l({ x: e.clientX, y: e.clientY }),
h = (e) => {
e.cancelable && e.preventDefault(), d(), g(e);
},
g = (e) => {
e.cancelable && e.preventDefault(),
l({
x: e.changedTouches[0].clientX,
y: e.changedTouches[0].clientY,
});
};
r.addEventListener("mousedown", m),
r.addEventListener("touchstart", h, { passive: !1 }),
(u.current = () => {
r.removeEventListener("mousedown", m),
r.removeEventListener("touchstart", h);
});
},
[a, e],
),
active: l,
}
);
})(
(0, r.useCallback)(
({ x: e }) => {
if (!U) {
let t = n(
(function ({
value: e,
containerWidth: t,
min: r,
max: a,
step: n,
precision: o,
}) {
let i =
(t ? Math.min(Math.max(e, 0), t) / t : e) * (a - r),
s = Math.max(
(0 !== i ? Math.round(i / n) * n : 0) + r,
r,
);
return void 0 !== o ? Number(s.toFixed(o)) : s;
})({ value: e, min: em, max: ef, step: D, precision: ex }),
S,
B,
);
el(
Q && O?.length
? l(
t,
O.map((e) => e.value),
)
: t,
),
(ec.current = t);
}
},
[U, S, B, em, ef, D, ex, el, O, Q],
),
{
onScrubEnd: (0, r.useCallback)(() => {
if (!U && eu.current) {
let e =
Q && O?.length
? l(
ec.current,
O.map((e) => e.value),
)
: ec.current;
eu.current(e);
}
}, [U, O, Q]),
},
en,
),
ew = (0, r.useCallback)(
(e) => {
!U && eu.current && eu.current(e);
},
[U],
);
return (0, t.jsx)(h, {
value: { getStyles: ea },
children: (0, t.jsxs)(b, {
...er,
ref: (0, o.useMergedRef)(i, ed),
onKeyDownCapture: (e) => {
if (!U)
switch (e.key) {
case "ArrowUp": {
if ((e.preventDefault(), ep.current?.focus(), Q && O)) {
let e = M(es, O);
el(e), ew(e);
break;
}
let t = P(Math.min(Math.max(es + D, S), B), ex);
el(t), ew(t);
break;
}
case "ArrowRight": {
if ((e.preventDefault(), ep.current?.focus(), Q && O)) {
let e = "rtl" === en ? _(es, O) : M(es, O);
el(e), ew(e);
break;
}
let t = P(
Math.min(Math.max("rtl" === en ? es - D : es + D, S), B),
ex,
);
el(t), ew(t);
break;
}
case "ArrowDown": {
if ((e.preventDefault(), ep.current?.focus(), Q && O)) {
let e = _(es, O);
el(e), ew(e);
break;
}
let t = P(Math.min(Math.max(es - D, S), B), ex);
el(t), ew(t);
break;
}
case "ArrowLeft": {
if ((e.preventDefault(), ep.current?.focus(), Q && O)) {
let e = "rtl" === en ? M(es, O) : _(es, O);
el(e), ew(e);
break;
}
let t = P(
Math.min(Math.max("rtl" === en ? es + D : es - D, S), B),
ex,
);
el(t), ew(t);
break;
}
case "Home":
if ((e.preventDefault(), ep.current?.focus(), Q && O)) {
el(T(O)), ew(T(O));
break;
}
el(S), ew(S);
break;
case "End":
if ((e.preventDefault(), ep.current?.focus(), Q && O)) {
el(I(O)), ew(I(O));
break;
}
el(B), ew(B);
}
},
onMouseDownCapture: () => ed.current?.focus(),
size: y,
disabled: U,
children: [
(0, t.jsx)(C, {
inverted: Y,
offset: 0,
filled: eh,
marks: O,
min: em,
max: ef,
value: eg,
disabled: U,
containerProps: {
ref: eb,
onMouseEnter: V ? () => ei(!0) : void 0,
onMouseLeave: V ? () => ei(!1) : void 0,
},
children: (0, t.jsx)(w, {
max: ef,
min: em,
value: eg,
position: eh,
dragging: ey,
label: ev,
ref: ep,
labelTransitionProps: F,
labelAlwaysOn: $,
thumbLabel: K,
showLabelOnHover: V,
isHovered: eo,
disabled: U,
...ee,
children: z,
}),
}),
(0, t.jsx)("input", { type: "hidden", name: L, value: eg, ...Z }),
],
}),
});
});
(B.classes = v),
(B.displayName = "@mantine/core/Slider"),
e.s(["Slider", () => B], 906328);
};
export default moduleFactory;