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

1585 lines
50 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 495c32611aa3cc4b.f38a372c79.js
* Module id: 672291
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t = e.i(462214),
n = e.i(358379),
o = e.i(334583);
e.i(272253);
var i = e.i(27755),
r = e.i(325528);
e.i(370357);
var a = e.i(492394);
e.i(693602);
var s = e.i(40456),
l = e.i(691411),
d = e.i(151449),
u = e.i(140500),
c = e.i(734911),
f = e.i(909243),
p = e.i(646283),
m = e.i(124859),
h = e.i(422676),
v = e.i(524961);
let x = (0, n.createContext)(null);
function E({
id: e,
cancelProps: o,
confirmProps: i,
labels: r = { cancel: "", confirm: "" },
closeOnConfirm: a = !0,
closeOnCancel: s = !0,
groupProps: l,
onCancel: d,
onConfirm: u,
children: c,
}) {
let { cancel: f, confirm: p } = r,
E = (function () {
let e = (0, n.useContext)(x);
if (!e)
throw Error(
"[@mantine/modals] useModals hook was called outside of context, wrap your app with ModalsProvider component",
);
return e;
})();
return (0, t.jsxs)(t.Fragment, {
children: [
c && (0, t.jsx)(m.Box, { mb: "md", children: c }),
(0, t.jsxs)(h.Group, {
mt: c ? 0 : "md",
justify: "flex-end",
...l,
children: [
(0, t.jsx)(v.Button, {
variant: "default",
...o,
onClick: (t) => {
"function" == typeof o?.onClick && o?.onClick(t),
"function" == typeof d && d(),
s && E.closeModal(e);
},
children: o?.children || f,
}),
(0, t.jsx)(v.Button, {
...i,
onClick: (t) => {
"function" == typeof i?.onClick && i?.onClick(t),
"function" == typeof u && u(),
a && E.closeModal(e);
},
children: i?.children || p,
}),
],
}),
],
});
}
x.displayName = "@mantine/modals/ModalsContext";
var C = e.i(19803);
function g(e, t) {
t && "confirm" === e.type && e.props.onCancel?.(), e.props.onClose?.();
}
function _(e, t) {
switch (t.type) {
case "OPEN":
return { current: t.modal, modals: [...e.modals, t.modal] };
case "CLOSE": {
let n = e.modals.find((e) => e.id === t.modalId);
if (!n) return e;
g(n, t.canceled);
let o = e.modals.filter((e) => e.id !== t.modalId);
return { current: o[o.length - 1] || e.current, modals: o };
}
case "CLOSE_ALL":
if (!e.modals.length) return e;
return (
e.modals
.concat()
.reverse()
.forEach((e) => {
g(e, t.canceled);
}),
{ current: e.current, modals: [] }
);
case "UPDATE": {
let { modalId: n, newProps: o } = t,
i = e.modals.map((e) =>
e.id !== n
? e
: "content" === e.type || "confirm" === e.type
? { ...e, props: { ...e.props, ...o } }
: "context" === e.type
? {
...e,
props: {
...e.props,
...o,
innerProps: {
...e.props.innerProps,
...o.innerProps,
},
},
}
: e,
),
r = (e.current?.id === n && i.find((e) => e.id === n)) || e.current;
return { ...e, modals: i, current: r };
}
default:
return e;
}
}
function b({ children: e, modalProps: o, labels: i, modals: r }) {
let [a, s] = (0, n.useReducer)(_, { modals: [], current: null }),
l = (0, n.useRef)(a);
l.current = a;
let d = (0, n.useCallback)(
(e) => {
s({ type: "CLOSE_ALL", canceled: e });
},
[l, s],
),
u = (0, n.useCallback)(
({ modalId: e, ...t }) => {
let n = e || (0, p.randomId)();
return (
s({ type: "OPEN", modal: { id: n, type: "content", props: t } }),
n
);
},
[s],
),
m = (0, n.useCallback)(
({ modalId: e, ...t }) => {
let n = e || (0, p.randomId)();
return (
s({ type: "OPEN", modal: { id: n, type: "confirm", props: t } }),
n
);
},
[s],
),
h = (0, n.useCallback)(
(e, { modalId: t, ...n }) => {
let o = t || (0, p.randomId)();
return (
s({
type: "OPEN",
modal: { id: o, type: "context", props: n, ctx: e },
}),
o
);
},
[s],
),
v = (0, n.useCallback)(
(e, t) => {
s({ type: "CLOSE", modalId: e, canceled: t });
},
[l, s],
),
g = (0, n.useCallback)(
({ modalId: e, ...t }) => {
s({ type: "UPDATE", modalId: e, newProps: t });
},
[s],
),
b = (0, n.useCallback)(
({ modalId: e, ...t }) => {
s({ type: "UPDATE", modalId: e, newProps: t });
},
[s],
);
(0, C.useModalsEvents)({
openModal: u,
openConfirmModal: m,
openContextModal: ({ modal: e, ...t }) => h(e, t),
closeModal: v,
closeContextModal: v,
closeAllModals: d,
updateModal: g,
updateContextModal: b,
});
let y = {
modalProps: o || {},
modals: a.modals,
openModal: u,
openConfirmModal: m,
openContextModal: h,
closeModal: v,
closeContextModal: v,
closeAll: d,
updateModal: g,
updateContextModal: b,
},
{ modalProps: S, content: j } = (() => {
let e = l.current.current;
switch (e?.type) {
case "context": {
let { innerProps: n, ...o } = e.props,
i = r[e.ctx];
return {
modalProps: o,
content: (0, t.jsx)(i, { innerProps: n, context: y, id: e.id }),
};
}
case "confirm": {
let { modalProps: n, confirmProps: o } = (function (e) {
if (!e) return { confirmProps: {}, modalProps: {} };
let {
id: t,
children: n,
onCancel: o,
onConfirm: i,
closeOnConfirm: r,
closeOnCancel: a,
cancelProps: s,
confirmProps: l,
groupProps: d,
labels: u,
...c
} = e;
return {
confirmProps: {
id: t,
children: n,
onCancel: o,
onConfirm: i,
closeOnConfirm: r,
closeOnCancel: a,
cancelProps: s,
confirmProps: l,
groupProps: d,
labels: u,
},
modalProps: { id: t, ...c },
};
})(e.props);
return {
modalProps: n,
content: (0, t.jsx)(E, {
...o,
id: e.id,
labels: e.props.labels || i,
}),
};
}
case "content": {
let { children: t, ...n } = e.props;
return { modalProps: n, content: t };
}
default:
return { modalProps: {}, content: null };
}
})();
return (0, t.jsxs)(x.Provider, {
value: y,
children: [
(0, t.jsx)(c.Modal, {
zIndex: (0, f.getDefaultZIndex)("modal") + 1,
...o,
...S,
opened: a.modals.length > 0,
onClose: () => v(a.current?.id),
children: j,
}),
e,
],
});
}
e.i(23741);
var y = e.i(318680),
S = e.i(363537);
function j(e, t) {
(e.prototype = Object.create(t.prototype)),
(e.prototype.constructor = e),
(0, S.default)(e, t);
}
var k = e.i(111558);
let A = n.default.createContext(null);
var O = "unmounted",
N = "exited",
T = "entering",
I = "entered",
w = "exiting",
L = (function (e) {
function t(t, n) {
var o,
i = e.call(this, t, n) || this,
r = n && !n.isMounting ? t.enter : t.appear;
return (
(i.appearStatus = null),
t.in
? r
? ((o = N), (i.appearStatus = T))
: (o = I)
: (o = t.unmountOnExit || t.mountOnEnter ? O : N),
(i.state = { status: o }),
(i.nextCallback = null),
i
);
}
j(t, e),
(t.getDerivedStateFromProps = function (e, t) {
return e.in && t.status === O ? { status: N } : null;
});
var o = t.prototype;
return (
(o.componentDidMount = function () {
this.updateStatus(!0, this.appearStatus);
}),
(o.componentDidUpdate = function (e) {
var t = null;
if (e !== this.props) {
var n = this.state.status;
this.props.in
? n !== T && n !== I && (t = T)
: (n === T || n === I) && (t = w);
}
this.updateStatus(!1, t);
}),
(o.componentWillUnmount = function () {
this.cancelNextCallback();
}),
(o.getTimeouts = function () {
var e,
t,
n,
o = this.props.timeout;
return (
(e = t = n = o),
null != o &&
"number" != typeof o &&
((e = o.exit),
(t = o.enter),
(n = void 0 !== o.appear ? o.appear : t)),
{ exit: e, enter: t, appear: n }
);
}),
(o.updateStatus = function (e, t) {
if ((void 0 === e && (e = !1), null !== t))
if ((this.cancelNextCallback(), t === T)) {
if (this.props.unmountOnExit || this.props.mountOnEnter) {
var n = this.props.nodeRef
? this.props.nodeRef.current
: k.default.findDOMNode(this);
n && n.scrollTop;
}
this.performEnter(e);
} else this.performExit();
else
this.props.unmountOnExit &&
this.state.status === N &&
this.setState({ status: O });
}),
(o.performEnter = function (e) {
var t = this,
n = this.props.enter,
o = this.context ? this.context.isMounting : e,
i = this.props.nodeRef ? [o] : [k.default.findDOMNode(this), o],
r = i[0],
a = i[1],
s = this.getTimeouts(),
l = o ? s.appear : s.enter;
(e || n) && 1
? (this.props.onEnter(r, a),
this.safeSetState({ status: T }, function () {
t.props.onEntering(r, a),
t.onTransitionEnd(l, function () {
t.safeSetState({ status: I }, function () {
t.props.onEntered(r, a);
});
});
}))
: this.safeSetState({ status: I }, function () {
t.props.onEntered(r);
});
}),
(o.performExit = function () {
var e = this,
t = this.props.exit,
n = this.getTimeouts(),
o = this.props.nodeRef ? void 0 : k.default.findDOMNode(this);
t
? (this.props.onExit(o),
this.safeSetState({ status: w }, function () {
e.props.onExiting(o),
e.onTransitionEnd(n.exit, function () {
e.safeSetState({ status: N }, function () {
e.props.onExited(o);
});
});
}))
: this.safeSetState({ status: N }, function () {
e.props.onExited(o);
});
}),
(o.cancelNextCallback = function () {
null !== this.nextCallback &&
(this.nextCallback.cancel(), (this.nextCallback = null));
}),
(o.safeSetState = function (e, t) {
(t = this.setNextCallback(t)), this.setState(e, t);
}),
(o.setNextCallback = function (e) {
var t = this,
n = !0;
return (
(this.nextCallback = function (o) {
n && ((n = !1), (t.nextCallback = null), e(o));
}),
(this.nextCallback.cancel = function () {
n = !1;
}),
this.nextCallback
);
}),
(o.onTransitionEnd = function (e, t) {
this.setNextCallback(t);
var n = this.props.nodeRef
? this.props.nodeRef.current
: k.default.findDOMNode(this),
o = null == e && !this.props.addEndListener;
if (!n || o) return void setTimeout(this.nextCallback, 0);
if (this.props.addEndListener) {
var i = this.props.nodeRef
? [this.nextCallback]
: [n, this.nextCallback],
r = i[0],
a = i[1];
this.props.addEndListener(r, a);
}
null != e && setTimeout(this.nextCallback, e);
}),
(o.render = function () {
var e = this.state.status;
if (e === O) return null;
var t = this.props,
o = t.children,
i =
(t.in,
t.mountOnEnter,
t.unmountOnExit,
t.appear,
t.enter,
t.exit,
t.timeout,
t.addEndListener,
t.onEnter,
t.onEntering,
t.onEntered,
t.onExit,
t.onExiting,
t.onExited,
t.nodeRef,
(0, y.default)(t, [
"children",
"in",
"mountOnEnter",
"unmountOnExit",
"appear",
"enter",
"exit",
"timeout",
"addEndListener",
"onEnter",
"onEntering",
"onEntered",
"onExit",
"onExiting",
"onExited",
"nodeRef",
]));
return n.default.createElement(
A.Provider,
{ value: null },
"function" == typeof o
? o(e, i)
: n.default.cloneElement(n.default.Children.only(o), i),
);
}),
t
);
})(n.default.Component);
function R() {}
(L.contextType = A),
(L.propTypes = {}),
(L.defaultProps = {
in: !1,
mountOnEnter: !1,
unmountOnExit: !1,
appear: !1,
enter: !0,
exit: !0,
onEnter: R,
onEntering: R,
onEntered: R,
onExit: R,
onExiting: R,
onExited: R,
}),
(L.UNMOUNTED = O),
(L.EXITED = N),
(L.ENTERING = T),
(L.ENTERED = I),
(L.EXITING = w);
var M = e.i(511334),
P = e.i(892388);
function U(e, t) {
var o = Object.create(null);
return (
e &&
n.Children.map(e, function (e) {
return e;
}).forEach(function (e) {
o[e.key] = t && (0, n.isValidElement)(e) ? t(e) : e;
}),
o
);
}
function D(e, t, n) {
return null != n[t] ? n[t] : e.props[t];
}
var B =
Object.values ||
function (e) {
return Object.keys(e).map(function (t) {
return e[t];
});
},
z = (function (e) {
function t(t, n) {
var o = e.call(this, t, n) || this,
i = o.handleExited.bind((0, P.default)(o));
return (
(o.state = {
contextValue: { isMounting: !0 },
handleExited: i,
firstRender: !0,
}),
o
);
}
j(t, e);
var o = t.prototype;
return (
(o.componentDidMount = function () {
(this.mounted = !0),
this.setState({ contextValue: { isMounting: !1 } });
}),
(o.componentWillUnmount = function () {
this.mounted = !1;
}),
(t.getDerivedStateFromProps = function (e, t) {
var o,
i,
r = t.children,
a = t.handleExited;
return {
children: t.firstRender
? U(e.children, function (t) {
return (0, n.cloneElement)(t, {
onExited: a.bind(null, t),
in: !0,
appear: D(t, "appear", e),
enter: D(t, "enter", e),
exit: D(t, "exit", e),
});
})
: (Object.keys(
(i = (function (e, t) {
function n(n) {
return n in t ? t[n] : e[n];
}
(e = e || {}), (t = t || {});
var o,
i = Object.create(null),
r = [];
for (var a in e)
a in t ? r.length && ((i[a] = r), (r = [])) : r.push(a);
var s = {};
for (var l in t) {
if (i[l])
for (o = 0; o < i[l].length; o++) {
var d = i[l][o];
s[i[l][o]] = n(d);
}
s[l] = n(l);
}
for (o = 0; o < r.length; o++) s[r[o]] = n(r[o]);
return s;
})(r, (o = U(e.children)))),
).forEach(function (t) {
var s = i[t];
if ((0, n.isValidElement)(s)) {
var l = t in r,
d = t in o,
u = r[t],
c = (0, n.isValidElement)(u) && !u.props.in;
d && (!l || c)
? (i[t] = (0, n.cloneElement)(s, {
onExited: a.bind(null, s),
in: !0,
exit: D(s, "exit", e),
enter: D(s, "enter", e),
}))
: d || !l || c
? d &&
l &&
(0, n.isValidElement)(u) &&
(i[t] = (0, n.cloneElement)(s, {
onExited: a.bind(null, s),
in: u.props.in,
exit: D(s, "exit", e),
enter: D(s, "enter", e),
}))
: (i[t] = (0, n.cloneElement)(s, { in: !1 }));
}
}),
i),
firstRender: !1,
};
}),
(o.handleExited = function (e, t) {
var n = U(this.props.children);
e.key in n ||
(e.props.onExited && e.props.onExited(t),
this.mounted &&
this.setState(function (t) {
var n = (0, M.default)({}, t.children);
return delete n[e.key], { children: n };
}));
}),
(o.render = function () {
var e = this.props,
t = e.component,
o = e.childFactory,
i = (0, y.default)(e, ["component", "childFactory"]),
r = this.state.contextValue,
a = B(this.state.children).map(o);
return (delete i.appear, delete i.enter, delete i.exit, null === t)
? n.default.createElement(A.Provider, { value: r }, a)
: n.default.createElement(
A.Provider,
{ value: r },
n.default.createElement(t, i, a),
);
}),
t
);
})(n.default.Component);
(z.propTypes = {}),
(z.defaultProps = {
component: "div",
childFactory: function (e) {
return e;
},
});
var H = e.i(938202),
W = e.i(389435),
F = e.i(593307),
V = e.i(479324),
K = e.i(830744),
Y = e.i(450943),
$ = e.i(754654),
G = e.i(948833);
let X = (e) => (e + 1) % 1e6;
var J = e.i(621600),
Q = e.i(361752);
let Z = [
"bottom-center",
"bottom-left",
"bottom-right",
"top-center",
"top-left",
"top-right",
],
q = {
left: "translateX(-100%)",
right: "translateX(100%)",
"top-center": "translateY(-100%)",
"bottom-center": "translateY(100%)",
},
ee = {
left: "translateX(0)",
right: "translateX(0)",
"top-center": "translateY(0)",
"bottom-center": "translateY(0)",
};
var et = e.i(855698);
e.i(7284);
var en = e.i(620428),
eo = e.i(709172),
ei = e.i(403094),
er = {
root: "m_a513464",
icon: "m_a4ceffb",
loader: "m_b0920b15",
body: "m_a49ed24",
title: "m_3feedf16",
description: "m_3d733a3a",
closeButton: "m_919a4d88",
};
let ea = { withCloseButton: !0 },
es = (0, H.createVarsResolver)((e, { radius: t, color: n }) => ({
root: {
"--notification-radius": void 0 === t ? void 0 : (0, et.getRadius)(t),
"--notification-color": n ? (0, en.getThemeColor)(n, e) : void 0,
},
})),
el = (0, F.factory)((e, n) => {
let o = (0, V.useProps)("Notification", ea, e),
{
className: i,
color: r,
radius: a,
loading: s,
withCloseButton: l,
withBorder: d,
title: u,
icon: c,
children: f,
onClose: p,
closeButtonProps: h,
classNames: v,
style: x,
styles: E,
unstyled: C,
vars: g,
mod: _,
loaderProps: b,
role: y,
attributes: S,
...j
} = o,
k = (0, Y.useStyles)({
name: "Notification",
classes: er,
props: o,
className: i,
style: x,
classNames: v,
styles: E,
unstyled: C,
attributes: S,
vars: g,
varsResolver: es,
});
return (0, t.jsxs)(m.Box, {
...k("root"),
mod: [{ "data-with-icon": !!c || s, "data-with-border": d }, _],
ref: n,
role: y || "alert",
...j,
children: [
c && !s && (0, t.jsx)("div", { ...k("icon"), children: c }),
s &&
(0, t.jsx)(ei.Loader, {
size: 28,
color: r,
...b,
...k("loader"),
}),
(0, t.jsxs)("div", {
...k("body"),
children: [
u && (0, t.jsx)("div", { ...k("title"), children: u }),
(0, t.jsx)(m.Box, {
...k("description"),
mod: { "data-with-title": !!u },
children: f,
}),
],
}),
l &&
(0, t.jsx)(eo.CloseButton, {
iconSize: 16,
color: "gray",
...h,
unstyled: C,
onClick: p,
...k("closeButton"),
}),
],
});
});
(el.classes = er), (el.displayName = "@mantine/core/Notification");
let ed = (0, n.forwardRef)(
({ data: e, onHide: o, autoClose: i, ...r }, a) => {
var s;
let { autoClose: l, message: d, ...u } = e,
c =
"number" == typeof (s = e.autoClose)
? s
: !1 !== s && !1 !== i && i,
f = (0, n.useRef)(-1),
p = () => window.clearTimeout(f.current),
m = () => {
o(e.id), p();
},
h = () => {
"number" == typeof c && (f.current = window.setTimeout(m, c));
};
return (
(0, n.useEffect)(() => {
e.onOpen?.(e);
}, []),
(0, n.useEffect)(() => (h(), p), [c]),
(0, t.jsx)(el, {
...r,
...u,
onClose: m,
ref: a,
onMouseEnter: p,
onMouseLeave: h,
children: d,
})
);
},
);
ed.displayName = "@mantine/notifications/NotificationContainer";
var eu = { root: "m_b37d9ac7", notification: "m_5ed0edd0" },
ec = e.i(70730);
let ef = {
position: "bottom-right",
autoClose: 4e3,
transitionDuration: 250,
containerWidth: 440,
notificationMaxHeight: 200,
limit: 5,
zIndex: (0, f.getDefaultZIndex)("overlay"),
store: ec.notificationsStore,
withinPortal: !0,
},
ep = (0, H.createVarsResolver)((e, { zIndex: t, containerWidth: n }) => ({
root: {
"--notifications-z-index": t?.toString(),
"--notifications-container-width": (0, W.rem)(n),
},
})),
em = (0, F.factory)((e, o) => {
var i;
let r = (0, V.useProps)("Notifications", ef, e),
{
classNames: a,
className: s,
style: l,
styles: d,
unstyled: u,
vars: c,
position: f,
autoClose: p,
transitionDuration: h,
containerWidth: v,
notificationMaxHeight: x,
limit: E,
zIndex: C,
store: g,
portalProps: _,
withinPortal: b,
...y
} = r,
S = (0, K.useMantineTheme)(),
j = (0, ec.useNotifications)(g),
k = (function () {
let [, e] = (0, n.useReducer)(X, 0);
return e;
})(),
A = (0, J.useReducedMotion)(),
O = (0, n.useRef)({}),
N = (0, n.useRef)(0),
T = S.respectReducedMotion && A ? 1 : h,
I = (0, Y.useStyles)({
name: "Notifications",
classes: eu,
props: r,
className: s,
style: l,
classNames: a,
styles: d,
unstyled: u,
vars: c,
varsResolver: ep,
});
(0, n.useEffect)(() => {
g?.updateState((e) => ({ ...e, limit: E || 5, defaultPosition: f }));
}, [E, f]),
(0, Q.useDidUpdate)(() => {
j.notifications.length > N.current && setTimeout(() => k(), 0),
(N.current = j.notifications.length);
}, [j.notifications]);
let w =
((i = j.notifications),
i.reduce(
(e, t) => (e[t.position || f].push(t), e),
Z.reduce((e, t) => ((e[t] = []), e), {}),
)),
R = Z.reduce(
(e, n) => (
(e[n] = w[n].map(({ style: e, ...o }) =>
(0, t.jsx)(
L,
{
timeout: T,
onEnter: () => O.current[o.id].offsetHeight,
nodeRef: { current: O.current[o.id] },
children: (i) =>
(0, t.jsx)(ed, {
ref: (e) => {
e && (O.current[o.id] = e);
},
data: o,
onHide: (e) => (0, ec.hideNotification)(e, g),
autoClose: p,
...I("notification", {
style: {
...(function ({
state: e,
maxHeight: t,
position: n,
transitionDuration: o,
}) {
let [i, r] = n.split("-"),
a = "center" === r ? `${i}-center` : r,
s = {
opacity: 0,
maxHeight: t,
transform: q[a],
transitionDuration: `${o}ms, ${o}ms, ${o}ms`,
transitionTimingFunction:
"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",
transitionProperty:
"opacity, transform, max-height",
},
l = { opacity: 1, transform: ee[a] },
d = {
opacity: 0,
maxHeight: 0,
transform: q[a],
};
return {
...s,
...{
entering: l,
entered: l,
exiting: d,
exited: d,
}[e],
};
})({
state: i,
position: n,
transitionDuration: T,
maxHeight: x,
}),
...e,
},
}),
}),
},
o.id,
),
)),
e
),
{},
);
return (0, t.jsxs)($.OptionalPortal, {
withinPortal: b,
..._,
children: [
(0, t.jsx)(m.Box, {
...I("root"),
"data-position": "top-center",
ref: o,
...y,
children: (0, t.jsx)(z, { children: R["top-center"] }),
}),
(0, t.jsx)(m.Box, {
...I("root"),
"data-position": "top-left",
...y,
children: (0, t.jsx)(z, { children: R["top-left"] }),
}),
(0, t.jsx)(m.Box, {
...I("root", { className: G.RemoveScroll.classNames.fullWidth }),
"data-position": "top-right",
...y,
children: (0, t.jsx)(z, { children: R["top-right"] }),
}),
(0, t.jsx)(m.Box, {
...I("root", { className: G.RemoveScroll.classNames.fullWidth }),
"data-position": "bottom-right",
...y,
children: (0, t.jsx)(z, { children: R["bottom-right"] }),
}),
(0, t.jsx)(m.Box, {
...I("root"),
"data-position": "bottom-left",
...y,
children: (0, t.jsx)(z, { children: R["bottom-left"] }),
}),
(0, t.jsx)(m.Box, {
...I("root"),
"data-position": "bottom-center",
...y,
children: (0, t.jsx)(z, { children: R["bottom-center"] }),
}),
],
});
});
(em.classes = eu),
(em.displayName = "@mantine/notifications/Notifications"),
(em.show = ec.notifications.show),
(em.hide = ec.notifications.hide),
(em.update = ec.notifications.update),
(em.clean = ec.notifications.clean),
(em.cleanQueue = ec.notifications.cleanQueue),
(em.updateState = ec.notifications.updateState);
var eh = e.i(371636),
eh = eh,
ev = e.i(466679),
ex = e.i(777784);
e.i(963527);
var eE = e.i(284309),
eC = e.i(41671),
eg = e.i(211478),
e_ = e.i(505e3),
eb = e.i(930686),
ey = e.i(254119),
eS = e.i(637591),
ej = e.i(135623),
ek = e.i(168823),
eA = e.i(883836);
function eO() {
let e = (0, eE.usePathname)(),
o = (0, eE.useRouter)(),
{ isOpen: i } = (0, eg.useLogin)(),
r = (0, ey.useIsMobileSimple)(),
[a, s] = (0, n.useState)(""),
[l, d] = (0, n.useState)(!1),
[u, f] = (0, n.useState)(null),
p = (0, n.useRef)("");
(0, n.useEffect)(() => {
let e = new URLSearchParams(window.location.search).get("invite");
e && s(e);
}, []),
(0, n.useEffect)(() => {
if (!a || p.current === a || i) return;
let e = (0, ek.getCookie)(e_.USER_TOKEN_COOKIE_KEY);
if (!e || "string" != typeof e) return;
let t = !0;
return (
(p.current = a),
Promise.allSettled([
(0, eS.getInviteCodeDetail)(a),
(0, eS.getInviteCodeInfo)(a),
])
.then(([e, n]) => {
let o, i, r, a, s, l, u, c, p, m;
if (!t || ("rejected" === e.status && "rejected" === n.status))
return;
let h = "fulfilled" === e.status ? (e.value?.data ?? []) : [],
v = "fulfilled" === n.status ? n.value?.data : void 0;
f(
((i = (o = h ?? [])[0]),
(r = i?.rewards?.find(
(e) => "invitee" === e.rewardRecipientType,
)?.rewardAmount),
(a =
i?.inviteeRewardAmount || i?.inviteRewardAmount || r || 10),
(s = i?.maxRewardAmount || 13 * a),
(l = new Set()),
o.forEach((e) => {
e.rewards?.forEach((e) => {
let t = e.inviteeAvatar;
"string" == typeof t && t.length > 0 && l.add(t);
});
}),
(u = Array.from(l).slice(0, 3)),
(c = o.length),
(p = v?.inviteCount || v?.memberCount || c),
(m = v?.inviteLimit || v?.maxMemberCount || p),
{
inviterNickname:
v?.nickname?.trim() ||
v?.leaderNickname?.trim() ||
v?.inviterNickname?.trim() ||
i?.inviterNickname?.trim() ||
"好友",
inviterAvatar:
v?.avatar ||
v?.leaderAvatar ||
v?.inviterAvatar ||
i?.inviterAvatar ||
eb.DEFAULT_AVATAR,
inviteRewardAmount: a,
maxRewardAmount: s,
joinedCount: p,
maxMemberCount: m,
joinedAvatars: u,
teamName: (function (e) {
if (!e) return "";
try {
let t = JSON.parse(e);
return "string" == typeof t.teamName
? t.teamName.trim()
: "";
} catch {
return "";
}
})(v?.ext),
}),
),
d(!0);
})
.catch(() => {}),
() => {
t = !1;
}
);
}, [a, i]),
(0, n.useCallback)(() => {
let e = `https://www.liblib.tv/?invite=${a}`,
t = (e) => {
let t = document.createElement("textarea");
(t.value = e),
(t.style.cssText = "position:fixed;left:-9999px"),
document.body.appendChild(t),
t.select(),
document.execCommand("copy"),
document.body.removeChild(t);
};
navigator.clipboard
? navigator.clipboard.writeText(e).catch(() => t(e))
: t(e),
ex.Notify.success("邀请链接已复制"),
d(!1);
}, [a]);
let m = (0, n.useCallback)(() => {
{
let t = new URLSearchParams(window.location.search);
if (t.has("invite")) {
t.delete("invite");
let n = t.toString();
o.replace(n ? `${e}?${n}` : e, { scroll: !1 });
}
}
s(""), d(!1);
}, [e, o]),
h = [
u?.inviterAvatar || eb.DEFAULT_AVATAR,
...(u?.joinedAvatars ?? []),
],
v = h.length - 4,
x = h.slice(0, 4);
u?.joinedCount ?? (u?.joinedAvatars ?? []).length, u?.maxMemberCount;
let E = (0, t.jsxs)("div", {
className: eA.default.panel,
children: [
(0, t.jsx)("button", {
className: eA.default.closeButton,
type: "button",
onClick: m,
children: (0, t.jsx)(eC.Icons.Close, { width: 14, height: 14 }),
}),
(0, t.jsxs)("div", {
className: eA.default.info,
children: [
(0, t.jsx)("span", {
className: eA.default.title,
children: "活动已结束",
}),
(0, t.jsx)("span", {
className: eA.default.endBody,
children: "活动已结束~感谢你的关注!",
}),
],
}),
(0, t.jsx)("button", {
className: eA.default.receiveButton,
type: "button",
onClick: m,
children: "知道了",
}),
],
});
return (
r
? (eA.default.panel,
eA.default.closeButton,
eC.Icons.Close,
eA.default.info,
eA.default.inviterColumn,
u?.inviterNickname,
eA.default.inviterAvatar,
u?.inviterAvatar || eb.DEFAULT_AVATAR,
eA.default.inviterName,
u?.teamName,
eA.default.title,
eA.default.subTitle,
eA.default.copyLinkButton,
eC.Icons.CopyLink)
: (eA.default.panel,
eA.default.closeButton,
eC.Icons.Close,
eA.default.info,
eA.default.inviter,
u?.inviterNickname,
eA.default.inviterAvatar,
u?.inviterAvatar || eb.DEFAULT_AVATAR,
eA.default.inviterName,
u?.teamName,
eA.default.title,
eA.default.subTitle,
eA.default.actions,
eA.default.joinedInfo,
eA.default.joinedAvatars,
x.map((e, n) => {
let o = v > 0 && n === x.length - 1;
return (0, t.jsxs)(
"div",
{
className: eA.default.joinedAvatarWrap,
style: { zIndex: n + 1 },
children: [
(0, t.jsx)("img", {
alt: "",
className: eA.default.joinedAvatar,
src: e,
}),
o &&
(0, t.jsx)("div", {
className: eA.default.joinedAvatarOverlay,
children: (0, t.jsxs)("span", {
className: eA.default.joinedAvatarOverlayText,
children: ["+", v],
}),
}),
],
},
n,
);
}),
h.length < 2 &&
(eA.default.joinedAvatarWrap, eA.default.joinedAvatarPlaceholder),
eA.default.joinedText,
eA.default.receiveButton),
(0, t.jsx)(c.Modal, {
centered: !0,
opened: l,
onClose: () => d(!1),
withCloseButton: !1,
closeOnClickOutside: !1,
closeOnEscape: !1,
padding: 0,
radius: 16,
zIndex: "var(--z-critical)",
size: r ? 313 : 400,
styles: {
content: {
background: "transparent",
boxShadow: "none",
overflow: "visible",
},
body: { padding: 0, display: "flex", justifyContent: "center" },
overlay: {
backgroundColor: "rgba(0, 0, 0, 0.75)",
backdropFilter: "blur(4px)",
},
},
children: E,
})
);
}
var eN = e.i(944733);
function eT({ children: e }) {
let o = (0, n.useRef)(null);
return (
(0, n.useEffect)(() => {
o.current && (0, eN.setConfirmRef)(o.current);
}, []),
(0, t.jsxs)(t.Fragment, {
children: [e, (0, t.jsx)(eN.default, { ref: o })],
})
);
}
e.i(204347);
var eI = e.i(212546),
eI = eI,
ew = e.i(216257),
eL = e.i(791997),
eR = e.i(840984);
let eM = {
breakpoints: {
b640: "640px",
b768: "768px",
b1024: "1024px",
b1280: "1280px",
b1440: "1440px",
b1600: "1600px",
b1520: "1520px",
b1920: "1920px",
b2240: "2240px",
},
colors: {
"ocean-blue": [
"#7AD1DD",
"#5FCCDB",
"#44CADC",
"#2AC9DE",
"#1AC2D9",
"#11B7CD",
"#09ADC3",
"#0E99AC",
"#128797",
"#147885",
],
"bright-pink": [
"#F0BBDD",
"#ED9BCF",
"#EC7CC3",
"#ED5DB8",
"#F13EAF",
"#F71FA7",
"#FF00A1",
"#E00890",
"#C50E82",
"#AD1374",
],
},
};
var eP = e.i(704839),
eU = e.i(260245);
function eD({ forceTheme: e, children: t }) {
let { setColorScheme: o } = (0, u.useMantineColorScheme)(),
i = (0, n.useRef)(o);
i.current = o;
let r = (0, eL.useCanvasThemeStore)((e) => e.theme),
a = (0, eL.useCanvasThemeStore)((e) => e.forcedTheme),
s = e ?? a ?? r,
l = null != e || null != a;
return (
(0, n.useLayoutEffect)(() => {
if (l) (0, eU.applyThemeClasses)(s);
else {
(0, eU.applyThemeClasses)(s);
try {
document.cookie = `__color_mode=${s};path=/;max-age=31536000;SameSite=Lax`;
} catch {}
}
i.current(s);
}, [s, l, r]),
t
);
}
function eB() {
let { openLogin: e } = (0, eg.useLogin)();
return (
(0, n.useEffect)(() => {
if (!new URLSearchParams(window.location.search).get("invite"))
return;
let t = (0, ek.getCookie)(e_.USER_TOKEN_COOKIE_KEY);
(t && "string" == typeof t) || e({ closeOnClickOutside: !1 });
}, [e]),
null
);
}
function ez() {
let { openLogin: e, isOpen: t } = (0, eg.useLogin)(),
o = (0, n.useRef)(!1),
i = (0, n.useRef)(!1);
return (
(0, n.useEffect)(
() =>
eP.authGuard.on401(() => {
(0, eN.confirm)({
title: "登录失效",
message: "登录失效,请重新登录",
confirmText: "登录",
showCancel: !1,
closeOnEscape: !1,
onConfirm: () => {
(i.current = !0),
e({
hideCloseButton: !0,
closeOnClickOutside: !1,
closeOnEscape: !1,
});
},
});
}),
[e],
),
(0, n.useEffect)(() => {
let e = o.current;
(o.current = t),
e &&
!t &&
i.current &&
((i.current = !1), eP.authGuard.resetUnauthorizedLock());
}, [t]),
null
);
}
function eH(u) {
let {
children: c,
cookieTheme: f,
forceLightTheme: p,
forceDarkTheme: m,
initialUser: h,
lang: v,
locale: x,
} = u,
E = p ? "light" : m ? "dark" : null;
(0, n.useState)(() => {
let e = "light" === f ? "light" : "dark";
return (
eL.useCanvasThemeStore.getState().theme !== e &&
eL.useCanvasThemeStore.setState({ theme: e }),
null
);
}),
(0, n.useEffect)(() => {
e.A(952247).then(({ preloadLocale: e }) => {
e(v).catch(console.warn);
});
}, [v]),
(0, n.useEffect)(
() => (
(0, i.setConfirmModalVariant)("liblibtv"),
() => (0, i.setConfirmModalVariant)("mantine-default")
),
[],
);
let { updateUserInfo: C } = (0, a.useUserInfo)();
(0, n.useEffect)(() => {
h && C(h);
}, [h]);
let [g, _] = (0, n.useState)("");
return (
(0, n.useEffect)(() => {
"zh" !== (0, ek.getCookie)(e_.LOCALE_COOKIE_KEY) &&
(0, ej.setCookieLongTerm)(e_.LOCALE_COOKIE_KEY, "zh"),
"new" !== (0, ek.getCookie)(e_.SYS_VERSION) &&
(0, ej.setCookieLongTerm)(e_.SYS_VERSION, "new");
}, [v]),
(0, n.useEffect)(() => {
let e = (0, ek.getCookie)(e_.USER_TOKEN_COOKIE_KEY);
e && "string" == typeof e && (0, eR.initWatermarkPreference)(e);
}, []),
(0, n.useEffect)(() => {
let e = (e) => {
(e.ctrlKey || e.metaKey) && e.preventDefault();
},
t = (e) => {
e.target?.closest?.(".react-flow") === null && e.preventDefault();
};
return (
document.addEventListener("wheel", e, { passive: !1, capture: !0 }),
document.addEventListener("gesturestart", t, { capture: !0 }),
document.addEventListener("gesturechange", t, { capture: !0 }),
() => {
document.removeEventListener("wheel", e, { capture: !0 }),
document.removeEventListener("gesturestart", t, {
capture: !0,
}),
document.removeEventListener("gesturechange", t, {
capture: !0,
});
}
);
}, []),
(0, n.useEffect)(() => {
let e = (e) => {
let t = e.target;
(t instanceof HTMLImageElement ||
t instanceof HTMLVideoElement ||
t instanceof HTMLAudioElement) &&
e.preventDefault();
};
return (
document.addEventListener("contextmenu", e, { capture: !0 }),
() =>
document.removeEventListener("contextmenu", e, { capture: !0 })
);
}, []),
(0, n.useEffect)(() => {
try {
let e =
window.__LIBLIB_SSO_SITE_ID__ ??
(r.config.siteUrl
? new URL(r.config.siteUrl).host
: window.location.host) ??
r.config.tv.domain,
t = window.__LIBLIB_SSO_BRIDGE_URL__ ?? r.config.tv.bridgeUrl,
n = (0, s.getSSOClient)({ siteId: e, bridgeUrl: t });
setTimeout(() => {
let e = (0, ek.getCookie)(e_.USER_TOKEN_COOKIE_KEY);
if (e) {
let t = (0, ej.getCookieWebid)();
n.notifyLogin({ token: e, webid: t, type: "login" });
} else n.notifyLogout();
}, 500);
} catch {}
}, []),
(0, t.jsx)(ew.RootStoreProvider, {
initialUser: h,
initialLang: v,
initialAreaCode: g,
children: (0, t.jsx)(d.MantineProvider, {
theme: eM,
defaultColorScheme: f,
...(E ? { forceColorScheme: E } : {}),
children: (0, t.jsx)(b, {
modalProps: {
centered: !0,
styles: {
content: {
backgroundColor: "var(--color-modal-background)",
color: "var(--color-modal-text)",
},
header: { backgroundColor: "var(--color-modal-background)" },
title: { color: "var(--color-modal-text)" },
},
},
children: (0, t.jsxs)(l.I18nProvider, {
value: { lang: v, locale: x },
children: [
(0, t.jsx)(eD, {
forceTheme: E,
children: (0, t.jsx)(eh.default, {
children: (0, t.jsx)(eT, {
children: (0, t.jsxs)(eg.LoginProvider, {
children: [
(0, t.jsx)(eB, {}),
(0, t.jsx)(ez, {}),
(0, t.jsx)(eO, {}),
c,
],
}),
}),
}),
}),
(0, t.jsx)(o.FreeTeamModal, {}),
(0, t.jsx)(ex.NotifyContainer, {}),
(0, t.jsx)(em, { position: "top-center", zIndex: 700 }),
(0, t.jsx)(eI.default, {}),
],
}),
}),
}),
})
);
}
(0, ev.enableMapSet)(), e.s(["default", () => eH], 672291);
};
export default moduleFactory;