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

897 lines
27 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 7e519410fdb8d8cd.424e721e83.js
* Module id: 195099
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t = e.i(358379);
function i(e) {
let i = (0, t.useRef)(void 0);
return (
(0, t.useEffect)(() => {
i.current = e;
}, [e]),
i.current
);
}
function a(e) {
return e
? e.map((e) =>
(function e(t) {
return "string" == typeof t
? { value: t, label: t }
: "value" in t && !("label" in t)
? { value: t.value, label: t.value, disabled: t.disabled }
: "number" == typeof t
? { value: t.toString(), label: t.toString() }
: "group" in t
? { group: t.group, items: t.items.map((t) => e(t)) }
: t;
})(e),
)
: [];
}
e.s(["usePrevious", () => i], 162511),
e.s(["getParsedComboboxData", () => a], 718242),
e.s(
[
"getOptionsLockup",
() =>
function e(t) {
return t.reduce(
(t, i) =>
"group" in i
? { ...t, ...e(i.items) }
: ((t[i.value] = i), t),
{},
);
},
],
4329,
);
var r = e.i(462214),
n = e.i(389435),
o = e.i(855698),
s = e.i(938202);
e.i(7284);
var l = e.i(479324),
d = e.i(450943),
u = e.i(529833);
let [c, h] = (0, e.i(559394).createSafeContext)(
"Combobox component was not found in tree",
);
var m = {
dropdown: "m_88b62a41",
search: "m_985517d8",
options: "m_b2821a6e",
option: "m_92253aa5",
empty: "m_2530cd1d",
header: "m_858f94bd",
footer: "m_82b967cb",
group: "m_254f3e4f",
groupLabel: "m_2bb2e9e5",
chevron: "m_2943220b",
optionsDropdownOption: "m_390b5f4",
optionsDropdownCheckIcon: "m_8ee53fc2",
optionsDropdownCheckPlaceholder: "m_a530ee0a",
};
e.s(["default", () => m], 27797);
var p = e.i(620428),
v = e.i(124859),
b = e.i(593307);
let g = { error: null },
f = (0, s.createVarsResolver)((e, { size: t, color: i }) => ({
chevron: {
"--combobox-chevron-size": (0, o.getSize)(t, "combobox-chevron-size"),
"--combobox-chevron-color": i ? (0, p.getThemeColor)(i, e) : void 0,
},
})),
E = (0, b.factory)((e, t) => {
let i = (0, l.useProps)("ComboboxChevron", g, e),
{
size: a,
error: n,
style: o,
className: s,
classNames: u,
styles: c,
unstyled: h,
vars: p,
mod: b,
...E
} = i,
w = (0, d.useStyles)({
name: "ComboboxChevron",
classes: m,
props: i,
style: o,
className: s,
classNames: u,
styles: c,
unstyled: h,
vars: p,
varsResolver: f,
rootSelector: "chevron",
});
return (0, r.jsx)(v.Box, {
component: "svg",
...E,
...w("chevron"),
size: a,
viewBox: "0 0 15 15",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
mod: ["combobox-chevron", { error: n }, b],
ref: t,
children: (0, r.jsx)("path", {
d: "M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",
fill: "currentColor",
fillRule: "evenodd",
clipRule: "evenodd",
}),
});
});
(E.classes = m), (E.displayName = "@mantine/core/ComboboxChevron");
var w = e.i(525230);
let y = (0, t.forwardRef)(
({ size: e, onMouseDown: t, onClick: i, onClear: a, ...n }, o) =>
(0, r.jsx)(w.Input.ClearButton, {
ref: o,
tabIndex: -1,
"aria-hidden": !0,
...n,
onMouseDown: (e) => {
e.preventDefault(), t?.(e);
},
onClick: (e) => {
a(), i?.(e);
},
}),
);
y.displayName = "@mantine/core/ComboboxClearButton";
let x = (0, b.factory)((e, t) => {
let {
classNames: i,
styles: a,
className: n,
style: o,
hidden: s,
...d
} = (0, l.useProps)("ComboboxDropdown", null, e),
c = h();
return (0, r.jsx)(u.Popover.Dropdown, {
...d,
ref: t,
role: "presentation",
"data-hidden": s || void 0,
...c.getStyles("dropdown", {
className: n,
style: o,
classNames: i,
styles: a,
}),
});
});
(x.classes = m), (x.displayName = "@mantine/core/ComboboxDropdown");
var A = e.i(886979);
let k = { refProp: "ref" },
I = (0, b.factory)((e, t) => {
let { children: i, refProp: a } = (0, l.useProps)(
"ComboboxDropdownTarget",
k,
e,
);
if ((h(), !(0, A.isElement)(i)))
throw Error(
"Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported",
);
return (0, r.jsx)(u.Popover.Target, {
ref: t,
refProp: a,
children: i,
});
});
I.displayName = "@mantine/core/ComboboxDropdownTarget";
let C = (0, b.factory)((e, t) => {
let {
classNames: i,
className: a,
style: n,
styles: o,
vars: s,
...d
} = (0, l.useProps)("ComboboxEmpty", null, e),
u = h();
return (0, r.jsx)(v.Box, {
ref: t,
...u.getStyles("empty", {
className: a,
classNames: i,
styles: o,
style: n,
}),
...d,
});
});
(C.classes = m), (C.displayName = "@mantine/core/ComboboxEmpty");
var T = e.i(600354),
M = e.i(141460),
_ = e.i(142385);
function S({
onKeyDown: e,
withKeyboardNavigation: i,
withAriaAttributes: a,
withExpandedAttribute: r,
targetType: n,
autoComplete: o,
}) {
let s = h(),
[l, d] = (0, t.useState)(null);
return {
...(a
? {
"aria-haspopup": "listbox",
"aria-expanded": r
? !!(s.store.listId && s.store.dropdownOpened)
: void 0,
"aria-controls":
s.store.dropdownOpened && s.store.listId
? s.store.listId
: void 0,
"aria-activedescendant": (s.store.dropdownOpened && l) || void 0,
autoComplete: o,
"data-expanded": s.store.dropdownOpened || void 0,
"data-mantine-stop-propagation": s.store.dropdownOpened || void 0,
}
: {}),
onKeyDown: (t) => {
if ((e?.(t), !s.readOnly && i) && !t.nativeEvent.isComposing) {
if (
("ArrowDown" === t.nativeEvent.code &&
(t.preventDefault(),
s.store.dropdownOpened
? d(s.store.selectNextOption())
: (s.store.openDropdown("keyboard"),
d(s.store.selectActiveOption()),
s.store.updateSelectedOptionIndex("selected", {
scrollIntoView: !0,
}))),
"ArrowUp" === t.nativeEvent.code &&
(t.preventDefault(),
s.store.dropdownOpened
? d(s.store.selectPreviousOption())
: (s.store.openDropdown("keyboard"),
d(s.store.selectActiveOption()),
s.store.updateSelectedOptionIndex("selected", {
scrollIntoView: !0,
}))),
"Enter" === t.nativeEvent.code ||
"NumpadEnter" === t.nativeEvent.code)
) {
if (229 === t.nativeEvent.keyCode) return;
let e = s.store.getSelectedOptionIndex();
s.store.dropdownOpened && -1 !== e
? (t.preventDefault(), s.store.clickSelectedOption())
: "button" === n &&
(t.preventDefault(), s.store.openDropdown("keyboard"));
}
"Escape" === t.key && s.store.closeDropdown("keyboard"),
"Space" === t.nativeEvent.code &&
"button" === n &&
(t.preventDefault(), s.store.toggleDropdown("keyboard"));
}
},
};
}
let L = {
refProp: "ref",
targetType: "input",
withKeyboardNavigation: !0,
withAriaAttributes: !0,
withExpandedAttribute: !1,
autoComplete: "off",
},
R = (0, b.factory)((e, i) => {
let {
children: a,
refProp: r,
withKeyboardNavigation: n,
withAriaAttributes: o,
withExpandedAttribute: s,
targetType: d,
autoComplete: u,
...c
} = (0, l.useProps)("ComboboxEventsTarget", L, e),
m = (0, _.getSingleElementChild)(a);
if (!m)
throw Error(
"Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported",
);
let p = h(),
v = S({
targetType: d,
withAriaAttributes: o,
withKeyboardNavigation: n,
withExpandedAttribute: s,
onKeyDown: m.props.onKeyDown,
autoComplete: u,
});
return (0, t.cloneElement)(m, {
...v,
...c,
[r]: (0, T.useMergedRef)(i, p.store.targetRef, (0, M.getRefProp)(m)),
});
});
R.displayName = "@mantine/core/ComboboxEventsTarget";
let D = (0, b.factory)((e, t) => {
let {
classNames: i,
className: a,
style: n,
styles: o,
vars: s,
...d
} = (0, l.useProps)("ComboboxFooter", null, e),
u = h();
return (0, r.jsx)(v.Box, {
ref: t,
...u.getStyles("footer", {
className: a,
classNames: i,
style: n,
styles: o,
}),
...d,
onMouseDown: (e) => {
e.preventDefault();
},
});
});
(D.classes = m), (D.displayName = "@mantine/core/ComboboxFooter");
var N = e.i(192830);
let P = (0, b.factory)((e, t) => {
let {
classNames: i,
className: a,
style: n,
styles: o,
vars: s,
children: d,
label: u,
id: c,
...m
} = (0, l.useProps)("ComboboxGroup", null, e),
p = h(),
b = (0, N.useId)(c);
return (0, r.jsxs)(v.Box, {
ref: t,
role: "group",
"aria-labelledby": u ? b : void 0,
...p.getStyles("group", {
className: a,
classNames: i,
style: n,
styles: o,
}),
...m,
children: [
u &&
(0, r.jsx)("div", {
id: b,
...p.getStyles("groupLabel", { classNames: i, styles: o }),
children: u,
}),
d,
],
});
});
(P.classes = m), (P.displayName = "@mantine/core/ComboboxGroup");
let j = (0, b.factory)((e, t) => {
let {
classNames: i,
className: a,
style: n,
styles: o,
vars: s,
...d
} = (0, l.useProps)("ComboboxHeader", null, e),
u = h();
return (0, r.jsx)(v.Box, {
ref: t,
...u.getStyles("header", {
className: a,
classNames: i,
style: n,
styles: o,
}),
...d,
onMouseDown: (e) => {
e.preventDefault();
},
});
});
function O({ value: e, valuesDivider: t = ",", ...i }) {
return (0, r.jsx)("input", {
type: "hidden",
value: Array.isArray(e) ? e.join(t) : e || "",
...i,
});
}
(j.classes = m),
(j.displayName = "@mantine/core/ComboboxHeader"),
(O.displayName = "@mantine/core/ComboboxHiddenInput");
let U = (0, b.factory)((e, i) => {
let a = (0, l.useProps)("ComboboxOption", null, e),
{
classNames: n,
className: o,
style: s,
styles: d,
vars: u,
onClick: c,
id: m,
active: p,
onMouseDown: b,
onMouseOver: g,
disabled: f,
selected: E,
mod: w,
...y
} = a,
x = h(),
A = (0, t.useId)();
return (0, r.jsx)(v.Box, {
...x.getStyles("option", {
className: o,
classNames: n,
styles: d,
style: s,
}),
...y,
ref: i,
id: m || A,
mod: [
"combobox-option",
{
"combobox-active": p,
"combobox-disabled": f,
"combobox-selected": E,
},
w,
],
role: "option",
onClick: (e) => {
f ? e.preventDefault() : (x.onOptionSubmit?.(a.value, a), c?.(e));
},
onMouseDown: (e) => {
e.preventDefault(), b?.(e);
},
onMouseOver: (e) => {
x.resetSelectionOnOptionHover && x.store.resetSelectedOption(),
g?.(e);
},
});
});
(U.classes = m), (U.displayName = "@mantine/core/ComboboxOption");
let H = (0, b.factory)((e, i) => {
let {
classNames: a,
className: n,
style: o,
styles: s,
id: d,
onMouseDown: u,
labelledBy: c,
...m
} = (0, l.useProps)("ComboboxOptions", null, e),
p = h(),
b = (0, N.useId)(d);
return (
(0, t.useEffect)(() => {
p.store.setListId(b);
}, [b]),
(0, r.jsx)(v.Box, {
ref: i,
...p.getStyles("options", {
className: n,
style: o,
classNames: a,
styles: s,
}),
...m,
id: b,
role: "listbox",
"aria-labelledby": c,
onMouseDown: (e) => {
e.preventDefault(), u?.(e);
},
})
);
});
(H.classes = m), (H.displayName = "@mantine/core/ComboboxOptions");
let V = { withAriaAttributes: !0, withKeyboardNavigation: !0 },
W = (0, b.factory)((e, t) => {
let {
classNames: i,
styles: a,
unstyled: n,
vars: o,
withAriaAttributes: s,
onKeyDown: d,
withKeyboardNavigation: u,
size: c,
...m
} = (0, l.useProps)("ComboboxSearch", V, e),
p = h(),
v = p.getStyles("search"),
b = S({
targetType: "input",
withAriaAttributes: s,
withKeyboardNavigation: u,
withExpandedAttribute: !1,
onKeyDown: d,
autoComplete: "off",
});
return (0, r.jsx)(w.Input, {
ref: (0, T.useMergedRef)(t, p.store.searchRef),
classNames: [{ input: v.className }, i],
styles: [{ input: v.style }, a],
size: c || p.size,
...b,
...m,
__staticSelector: "Combobox",
});
});
(W.classes = m), (W.displayName = "@mantine/core/ComboboxSearch");
let $ = {
refProp: "ref",
targetType: "input",
withKeyboardNavigation: !0,
withAriaAttributes: !0,
withExpandedAttribute: !1,
autoComplete: "off",
},
B = (0, b.factory)((e, i) => {
let {
children: a,
refProp: n,
withKeyboardNavigation: o,
withAriaAttributes: s,
withExpandedAttribute: d,
targetType: c,
autoComplete: m,
...p
} = (0, l.useProps)("ComboboxTarget", $, e),
v = (0, _.getSingleElementChild)(a);
if (!v)
throw Error(
"Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported",
);
let b = h(),
g = S({
targetType: c,
withAriaAttributes: s,
withKeyboardNavigation: o,
withExpandedAttribute: d,
onKeyDown: v.props.onKeyDown,
autoComplete: m,
}),
f = (0, t.cloneElement)(v, { ...g, ...p });
return (0, r.jsx)(u.Popover.Target, {
ref: (0, T.useMergedRef)(i, b.store.targetRef),
children: f,
});
});
B.displayName = "@mantine/core/ComboboxTarget";
var F = e.i(403557);
function z(e, t = document) {
let i = t.querySelector(e);
if (i) return i;
let a = t.querySelectorAll("*");
for (let t = 0; t < a.length; t += 1) {
let i = a[t];
if (i.shadowRoot) {
let t = z(e, i.shadowRoot);
if (t) return t;
}
}
return null;
}
function G(e, t = document) {
let i = [],
a = t.querySelectorAll(e);
i.push(...Array.from(a));
let r = t.querySelectorAll("*");
for (let t = 0; t < r.length; t += 1) {
let a = r[t];
if (a.shadowRoot) {
let t = G(e, a.shadowRoot);
i.push(...t);
}
}
return i;
}
function q(e) {
if (!e) return document;
let t = e.getRootNode();
return t instanceof ShadowRoot || t instanceof Document ? t : document;
}
function Q({
defaultOpened: e,
opened: i,
onOpenedChange: a,
onDropdownClose: r,
onDropdownOpen: n,
loop: o = !0,
scrollBehavior: s = "instant",
} = {}) {
let [l, d] = (0, F.useUncontrolled)({
value: i,
defaultValue: e,
finalValue: !1,
onChange: a,
}),
u = (0, t.useRef)(null),
c = (0, t.useRef)(-1),
h = (0, t.useRef)(null),
m = (0, t.useRef)(null),
p = (0, t.useRef)(-1),
v = (0, t.useRef)(-1),
b = (0, t.useRef)(-1),
g = (0, t.useCallback)(
(e = "unknown") => {
l || (d(!0), n?.(e));
},
[d, n, l],
),
f = (0, t.useCallback)(
(e = "unknown") => {
l && (d(!1), r?.(e));
},
[d, r, l],
),
E = (0, t.useCallback)(
(e = "unknown") => {
l ? f(e) : g(e);
},
[f, g, l],
),
w = (0, t.useCallback)(() => {
let e = q(m.current),
t = z(`#${u.current} [data-combobox-selected]`, e);
t?.removeAttribute("data-combobox-selected"),
t?.removeAttribute("aria-selected");
}, []),
y = (0, t.useCallback)(
(e) => {
let t = q(m.current),
i = z(`#${u.current}`, t),
a = i ? G("[data-combobox-option]", i) : null;
if (!a) return null;
let r = e >= a.length ? 0 : e < 0 ? a.length - 1 : e;
return ((c.current = r),
a?.[r] && !a[r].hasAttribute("data-combobox-disabled"))
? (w(),
a[r].setAttribute("data-combobox-selected", "true"),
a[r].setAttribute("aria-selected", "true"),
a[r].scrollIntoView({ block: "nearest", behavior: s }),
a[r].id)
: null;
},
[s, w],
),
x = (0, t.useCallback)(() => {
let e = q(m.current),
t = z(`#${u.current} [data-combobox-active]`, e);
return t
? y(
G(`#${u.current} [data-combobox-option]`, e).findIndex(
(e) => e === t,
),
)
: y(0);
}, [y]),
A = (0, t.useCallback)(() => {
let e = q(m.current),
t = G(`#${u.current} [data-combobox-option]`, e);
return y(
(function (e, t, i) {
for (let i = e + 1; i < t.length; i += 1)
if (!t[i].hasAttribute("data-combobox-disabled")) return i;
if (i) {
for (let e = 0; e < t.length; e += 1)
if (!t[e].hasAttribute("data-combobox-disabled")) return e;
}
return e;
})(c.current, t, o),
);
}, [y, o]),
k = (0, t.useCallback)(() => {
let e = q(m.current),
t = G(`#${u.current} [data-combobox-option]`, e);
return y(
(function (e, t, i) {
for (let i = e - 1; i >= 0; i -= 1)
if (!t[i].hasAttribute("data-combobox-disabled")) return i;
if (i) {
for (let e = t.length - 1; e > -1; e -= 1)
if (!t[e].hasAttribute("data-combobox-disabled")) return e;
}
return e;
})(c.current, t, o),
);
}, [y, o]),
I = (0, t.useCallback)(() => {
let e = q(m.current);
return y(
(function (e) {
for (let t = 0; t < e.length; t += 1)
if (!e[t].hasAttribute("data-combobox-disabled")) return t;
return -1;
})(G(`#${u.current} [data-combobox-option]`, e)),
);
}, [y]),
C = (0, t.useCallback)((e = "selected", t) => {
b.current = window.setTimeout(() => {
let i = q(m.current),
a = G(`#${u.current} [data-combobox-option]`, i),
r = a.findIndex((t) => t.hasAttribute(`data-combobox-${e}`));
(c.current = r),
t?.scrollIntoView &&
a[r]?.scrollIntoView({ block: "nearest", behavior: s });
}, 0);
}, []),
T = (0, t.useCallback)(() => {
(c.current = -1), w();
}, [w]),
M = (0, t.useCallback)(() => {
let e = q(m.current),
t = G(`#${u.current} [data-combobox-option]`, e),
i = t?.[c.current];
i?.click();
}, []),
_ = (0, t.useCallback)((e) => {
u.current = e;
}, []),
S = (0, t.useCallback)(() => {
p.current = window.setTimeout(() => h.current?.focus(), 0);
}, []),
L = (0, t.useCallback)(() => {
v.current = window.setTimeout(() => m.current?.focus(), 0);
}, []),
R = (0, t.useCallback)(() => c.current, []);
return (
(0, t.useEffect)(
() => () => {
window.clearTimeout(p.current),
window.clearTimeout(v.current),
window.clearTimeout(b.current);
},
[],
),
{
dropdownOpened: l,
openDropdown: g,
closeDropdown: f,
toggleDropdown: E,
selectedOptionIndex: c.current,
getSelectedOptionIndex: R,
selectOption: y,
selectFirstOption: I,
selectActiveOption: x,
selectNextOption: A,
selectPreviousOption: k,
resetSelectedOption: T,
updateSelectedOptionIndex: C,
listId: u.current,
setListId: _,
clickSelectedOption: M,
searchRef: h,
focusSearchInput: S,
targetRef: m,
focusTarget: L,
}
);
}
e.s(["useCombobox", () => Q], 464588);
let K = {
keepMounted: !0,
withinPortal: !0,
resetSelectionOnOptionHover: !1,
width: "target",
transitionProps: { transition: "fade", duration: 0 },
size: "sm",
},
Y = (0, s.createVarsResolver)((e, { size: t, dropdownPadding: i }) => ({
options: {
"--combobox-option-fz": (0, o.getFontSize)(t),
"--combobox-option-padding": (0, o.getSize)(
t,
"combobox-option-padding",
),
},
dropdown: {
"--combobox-padding": void 0 === i ? void 0 : (0, n.rem)(i),
"--combobox-option-fz": (0, o.getFontSize)(t),
"--combobox-option-padding": (0, o.getSize)(
t,
"combobox-option-padding",
),
},
}));
function X(e) {
let t = (0, l.useProps)("Combobox", K, e),
{
classNames: i,
styles: a,
unstyled: n,
children: o,
store: s,
vars: h,
onOptionSubmit: p,
onClose: v,
size: b,
dropdownPadding: g,
resetSelectionOnOptionHover: f,
__staticSelector: E,
readOnly: w,
attributes: y,
...x
} = t,
A = Q(),
k = s || A,
I = (0, d.useStyles)({
name: E || "Combobox",
classes: m,
props: t,
classNames: i,
styles: a,
unstyled: n,
attributes: y,
vars: h,
varsResolver: Y,
});
return (0, r.jsx)(c, {
value: {
getStyles: I,
store: k,
onOptionSubmit: p,
size: b,
resetSelectionOnOptionHover: f,
readOnly: w,
},
children: (0, r.jsx)(u.Popover, {
opened: k.dropdownOpened,
preventPositionChangeWhenVisible: !1,
...x,
onChange: (e) => !e && void (v?.(), k.closeDropdown()),
withRoles: !1,
unstyled: n,
children: o,
}),
});
}
(X.extend = (e) => e),
(X.classes = m),
(X.displayName = "@mantine/core/Combobox"),
(X.Target = B),
(X.Dropdown = x),
(X.Options = H),
(X.Option = U),
(X.Search = W),
(X.Empty = C),
(X.Chevron = E),
(X.Footer = D),
(X.Header = j),
(X.EventsTarget = R),
(X.DropdownTarget = I),
(X.Group = P),
(X.ClearButton = y),
(X.HiddenInput = O),
e.s(["Combobox", () => X], 195099);
};
export default moduleFactory;