ono-react-element 0.0.12 → 0.0.13
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/es/{AutoSliderList-DCpCHe1X.js → AutoSliderList-w9mw0JCN.js} +9 -9
- package/dist/es/InjunctiveBox-DUNoNHCO.js +11 -0
- package/dist/es/{Input-CYA8Q8B5.js → Input-DLOeg2pz.js} +30 -30
- package/dist/es/Message-BGDILiLc.js +105 -0
- package/dist/es/{Modal-D4gV43Cy.js → Modal-BIFxRjSt.js} +10 -10
- package/dist/es/{Select-CJuIMAoG.js → Select-DAU6TuBu.js} +6 -6
- package/dist/es/{Switch-CN3M5pXb.js → Switch-CRJejHP9.js} +13 -13
- package/dist/es/{TemplateDialog-DKEBuvXA.js → TemplateDialog-dD8BcnbA.js} +9 -9
- package/dist/es/{Toast-DHu6WOZ0.js → Toast-CQEsbqUJ.js} +27 -27
- package/dist/es/{Tooltip-Dj8ZeMVG.js → Tooltip-j2AKREfX.js} +13 -13
- package/dist/es/VirtualList-w16-kBkT.js +65 -0
- package/dist/es/{Waterfall-Ce9ZeKxm.js → Waterfall-CFVkuuCO.js} +17 -17
- package/dist/es/colorUtils.ts-DYuRvCXZ.js +145 -0
- package/dist/es/common.ts-DQOEx8k3.js +126 -0
- package/dist/es/fileFormatConversion.ts-tUlewYon.js +38 -0
- package/dist/es/formatTimeUtils.ts-CkdWJ_Sl.js +32 -0
- package/dist/es/index.js +96 -185
- package/dist/es/useClickOutSide.tsx-CMvd2uTW.js +15 -0
- package/dist/es/useCountdown.tsx-Btzj-keH.js +16 -0
- package/dist/es/useEventListener.tsx-BBGVcI5T.js +12 -0
- package/dist/es/useGetElementSize.tsx-Dtshth0Y.js +22 -0
- package/dist/es/useKeyPress.tsx-Db44HXXz.js +18 -0
- package/dist/es/useMouseClick.tsx-C7uAH4n4.js +12 -0
- package/dist/es/useTheme.tsx-C5b7BRYz.js +24 -0
- package/dist/es/useThemePro.tsx-DQuSI8J7.js +20 -0
- package/dist/es/viewTransitionUtils.ts-CHa9uBpi.js +19 -0
- package/dist/index.css +1 -1
- package/dist/style/Button.css +1 -1
- package/dist/style/Message.css +1 -1
- package/dist/style/Modal.css +1 -1
- package/dist/style/Toast.css +1 -1
- package/dist/style/index.css +1 -1
- package/dist/types/hooks/useClickOutSide.d.ts +2 -2
- package/dist/types/hooks/useCountdown.d.ts +2 -1
- package/dist/types/hooks/useEventListener.d.ts +2 -2
- package/dist/types/hooks/useGetElementSize.d.ts +2 -1
- package/dist/types/hooks/useKeyPress.d.ts +2 -2
- package/dist/types/hooks/useMouseClick.d.ts +2 -1
- package/dist/types/hooks/useTheme.d.ts +2 -2
- package/dist/types/hooks/useThemePro.d.ts +2 -2
- package/dist/types/index.d.ts +8 -1
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.css.br +0 -0
- package/dist/umd/index.css.gz +0 -0
- package/dist/umd/index.umd.cjs +393 -393
- package/dist/umd/index.umd.cjs.br +0 -0
- package/dist/umd/index.umd.cjs.gz +0 -0
- package/package.json +1 -1
- package/dist/es/InjunctiveBox-DsntB_UW.js +0 -11
- package/dist/es/Message-GvTC61N0.js +0 -68
- package/dist/es/VirtualList-BBvdkGKk.js +0 -65
- package/dist/es/utils-BxXROOPY.js +0 -394
- package/dist/types/hooks/index.d.ts +0 -8
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { j as e, R as o } from "./dependencies-CbQbPZZ-.js";
|
|
2
|
-
import { useEventListener as n } from "./index.js";
|
|
3
|
-
let s, l = null;
|
|
4
|
-
const t = ({ className: o2, content: s2, style: t2, onClick: u2, onDoubleClick: i2, onContextMenu: c, onMouseDown: r, onMouseUp: M, onMouseEnter: a, onMouseLeave: d, onMouseMove: m, isClickBoxToClose: p }) => (n("click", () => {
|
|
5
|
-
p && l && (l.remove(), l = null);
|
|
6
|
-
}), e.jsx("div", { className: o2, style: t2, onClick: u2, onDoubleClick: i2, onContextMenu: c, onMouseDown: r, onMouseUp: M, onMouseEnter: a, onMouseLeave: d, onMouseMove: m, children: "function" == typeof s2 ? s2((e2) => {
|
|
7
|
-
l && (l.remove(), l = null, e2 && e2());
|
|
8
|
-
}) : s2 })), u = (o2) => (i(o2.isSingle || false).render(e.jsx(t, { ...o2 })), l), i = (e2) => (e2 && l && s || (l = document.createElement("div"), document.body.appendChild(l), s = o.createRoot(l)), s);
|
|
9
|
-
export {
|
|
10
|
-
u as i
|
|
11
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./dependencies-CbQbPZZ-.js";
|
|
2
|
-
import { useState as s, useRef as a, useMemo as o, useCallback as n, useEffect as t } from "react";
|
|
3
|
-
import { c as r, g as c, a as l, b as i, d, e as u } from "./utils-BxXROOPY.js";
|
|
4
|
-
const f = { info: { light: "#1677ff", dark: "#1677ff" }, success: { light: "#52c41a", dark: "#49aa19" }, error: { light: "#ff4d4f", dark: "#a61d24" }, warning: { light: "#faad14", dark: "#d89614" }, loading: { light: "#9254de", dark: "#f5f5f5" } }, m = (e2, s2) => f[e2][s2], g = (s2) => {
|
|
5
|
-
switch (s2) {
|
|
6
|
-
case "success":
|
|
7
|
-
return e.jsx("svg", { className: "ono-type-icon", viewBox: "0 0 1024 1024", focusable: "false", "data-icon": "check-circle", fill: m(s2, "light"), "aria-hidden": "true", children: e.jsx("path", { d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" }) });
|
|
8
|
-
case "error":
|
|
9
|
-
return e.jsx("svg", { className: "ono-type-icon", viewBox: "0 0 1024 1024", focusable: "false", "data-icon": "close-circle", fill: m(s2, "light"), "aria-hidden": "true", children: e.jsx("path", { d: "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" }) });
|
|
10
|
-
case "loading":
|
|
11
|
-
return e.jsx("svg", { className: ["ono-info-icon", "ono-loading"].join(" "), viewBox: "0 0 1024 1024", focusable: "false", "data-icon": "loading", fill: m(s2, "light"), "aria-hidden": "true", children: e.jsx("path", { d: "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" }) });
|
|
12
|
-
default:
|
|
13
|
-
return e.jsx("svg", { className: "ono-info-icon", viewBox: "64 64 896 896", focusable: "false", "data-icon": "exclamation-circle", fill: m(s2, "light"), "aria-hidden": "true", children: e.jsx("path", { d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" }) });
|
|
14
|
-
}
|
|
15
|
-
}, h = ({ handleDestroy: s2 }) => e.jsx("button", { onClick: s2, children: e.jsx("svg", { className: "ono-clear-icon", viewBox: "64 64 896 896", focusable: "false", "data-icon": "close-circle", fill: "currentColor", "aria-hidden": "true", children: e.jsx("path", { d: "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" }) }) }), p = ({ id: r2, instancesKey: f2, duration: m2 = 3e3, speed: p2 = 300, offset: y2 = 20, message: x2, type: j, plain: v = true, showClose: C = false, zIndex: w, onClose: z = () => {
|
|
16
|
-
}, destroy: L }) => {
|
|
17
|
-
const [, k] = s(false), [b, B] = s(0), [M, N] = s(c(r2)), [$, S] = s({ duration: m2, speed: p2, message: x2, type: j, showClose: C, onClose: z }), T = a(null), D = a(null), F = a(null), I = M + b, K = o(() => ({ transform: `translate(-50%, ${M}px)`, transition: `transform ${p2}ms ease-in-out`, zIndex: w }), [M, p2]), O = () => {
|
|
18
|
-
F.current && (F.current.classList.remove("ono-message-enter"), F.current.classList.add("ono-message-leave"), F.current.style.transform = `translate(-50%, ${d(r2) - b}px)`, u(r2), setTimeout(() => L($.onClose), p2));
|
|
19
|
-
}, q = (e2, s2, a2) => {
|
|
20
|
-
"loading" !== e2 && (T.current = setTimeout(O, s2 - a2));
|
|
21
|
-
}, A = () => {
|
|
22
|
-
const e2 = d(r2);
|
|
23
|
-
k((s2) => (s2 && N(e2 + y2), true)), requestAnimationFrame(A);
|
|
24
|
-
}, E = n(() => {
|
|
25
|
-
if ("loading" === $.type) {
|
|
26
|
-
if (D.current) return;
|
|
27
|
-
D.current = setTimeout(() => {
|
|
28
|
-
D.current = null;
|
|
29
|
-
const e2 = l(f2 || "");
|
|
30
|
-
e2 && (((e3) => {
|
|
31
|
-
S((s2) => ({ ...s2, ...e3 }));
|
|
32
|
-
})({ ...e2 }), q($.type, e2.duration || $.duration, e2.speed || $.speed), E());
|
|
33
|
-
}, 100);
|
|
34
|
-
}
|
|
35
|
-
}, [$]);
|
|
36
|
-
return t(() => {
|
|
37
|
-
q($.type, $.duration, $.speed), A(), E();
|
|
38
|
-
}, [$.type, $.duration, $.speed]), t(() => {
|
|
39
|
-
(() => {
|
|
40
|
-
if (!F.current) return;
|
|
41
|
-
const { height: e2 } = F.current.getBoundingClientRect();
|
|
42
|
-
F.current.style.setProperty("--speed", `${$.speed}ms`), B(e2);
|
|
43
|
-
})();
|
|
44
|
-
}, [F]), t(() => {
|
|
45
|
-
i(r2, { topOffset: M, height: b, bottomOffset: I });
|
|
46
|
-
}, [I]), e.jsx("div", { ref: F, className: ["ono-message", `ono-message-${$.type}`, "ono-message-enter", v ? "" : "ono-message-color"].filter(Boolean).join(" "), style: K, onMouseEnter: () => {
|
|
47
|
-
T.current && (clearTimeout(T.current), T.current = null);
|
|
48
|
-
}, onMouseLeave: () => q($.type, $.duration, $.speed), children: "function" == typeof $.message ? $.message(g($.type), $.showClose && e.jsx(h, { handleDestroy: O })) : e.jsxs(e.Fragment, { children: [g($.type), e.jsx("div", { children: $.message }), $.showClose && e.jsx(h, { handleDestroy: O })] }) });
|
|
49
|
-
}, y = (e2) => {
|
|
50
|
-
if ("string" == typeof e2) return { message: e2 };
|
|
51
|
-
{
|
|
52
|
-
const s2 = { ...e2, instancesKey: e2.key };
|
|
53
|
-
return delete s2.key, { ...s2 };
|
|
54
|
-
}
|
|
55
|
-
}, x = { info: (e2) => {
|
|
56
|
-
r(p, { ...y(e2), type: "info" }, "ono-message");
|
|
57
|
-
}, success: (e2) => {
|
|
58
|
-
r(p, { ...y(e2), type: "success" }, "ono-message");
|
|
59
|
-
}, warning: (e2) => {
|
|
60
|
-
r(p, { ...y(e2), type: "warning" }, "ono-message");
|
|
61
|
-
}, error: (e2) => {
|
|
62
|
-
r(p, { ...y(e2), type: "error" }, "ono-message");
|
|
63
|
-
}, loading: (e2) => {
|
|
64
|
-
r(p, { ...y(e2), type: "loading" }, "ono-message");
|
|
65
|
-
} };
|
|
66
|
-
export {
|
|
67
|
-
x as m
|
|
68
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./dependencies-CbQbPZZ-.js";
|
|
2
|
-
import { memo as t, useState as r, useMemo as i, useRef as n, useEffect as l } from "react";
|
|
3
|
-
import { useEventListener as a } from "./index.js";
|
|
4
|
-
const d = t(({ containerClassName: t2, dataSource: d2, containerStyle: s2 = {}, onEndCallback: c, refreshSpeed: o = 50, wrapperClassName: h, wrapperStyle: u = {}, estimatedSize: p = 35, updateDataSourceScroll2Top: f, direction: g = "vertical" }) => {
|
|
5
|
-
const [v, x] = r({ viewSize: 0, startIndex: 0, listSize: 0, renderCount: 0, prevLen: 0 }), [S, m] = r([]), z = "number" == typeof p ? p : p(), w = i(() => Math.min(d2.length, v.startIndex + v.renderCount), [d2, v]), I = i(() => {
|
|
6
|
-
var _a;
|
|
7
|
-
return v.startIndex > 0 ? (_a = S[v.startIndex - 1]) == null ? void 0 : _a.end : 0;
|
|
8
|
-
}, [v.startIndex, S]), y = i(() => d2.slice(v.startIndex, w).map(({ id: t3, data: r2 }) => e.jsx("li", { "data-virtual-id": t3, style: "vertical" === g ? { width: "100%" } : { height: "100%" }, children: r2 }, t3)), [w, d2, v.startIndex, g]), C = i(() => ({ display: "flex", listStyle: "none", flexDirection: "vertical" === g ? "column" : "row", height: "vertical" === g ? v.listSize - I + "px" : "100%", width: "vertical" === g ? "auto" : v.listSize - I + "px", transform: "vertical" === g ? `translate3d(0, ${I}px, 0)` : `translate3d(${I}px, 0, 0)` }), [v.listSize, I, g]), j = n(null), L = n(null), N = (e2) => x((t3) => ({ ...t3, ...e2 })), b = /* @__PURE__ */ ((e2, t3 = 300) => {
|
|
9
|
-
let r2 = 0;
|
|
10
|
-
return () => {
|
|
11
|
-
const i2 = Date.now();
|
|
12
|
-
i2 - r2 >= t3 && (e2(), r2 = i2);
|
|
13
|
-
};
|
|
14
|
-
})(() => {
|
|
15
|
-
const { scrollTop: e2, clientHeight: t3, scrollHeight: r2, scrollLeft: i2, clientWidth: n2, scrollWidth: l2 } = j.current, a2 = "vertical" === g ? r2 - t3 - e2 : l2 - n2 - i2;
|
|
16
|
-
N({ startIndex: A(S, "vertical" === g ? e2 : i2) }), ("vertical" === g ? e2 === z / 2 : i2 === z / 2) && N({ startIndex: 0 }), a2 <= 20 && c && c();
|
|
17
|
-
}, o), A = (e2, t3) => {
|
|
18
|
-
let r2 = 0, i2 = e2.length - 1, n2 = -1;
|
|
19
|
-
for (; r2 <= i2; ) {
|
|
20
|
-
const l2 = r2 + Math.floor((i2 - r2) / 2), a2 = e2[l2].end;
|
|
21
|
-
if (a2 === t3) return l2 + 1;
|
|
22
|
-
a2 < t3 ? r2 = l2 + 1 : ((-1 === n2 || n2 > l2) && (n2 = l2), i2 = l2 - 1);
|
|
23
|
-
}
|
|
24
|
-
return n2;
|
|
25
|
-
};
|
|
26
|
-
return a("scroll", b, { target: j.current, deps: [S, g] }), l(() => {
|
|
27
|
-
(() => {
|
|
28
|
-
if (!j.current) return;
|
|
29
|
-
const e2 = ("vertical" === g ? j.current.offsetHeight : j.current.offsetWidth) || 0;
|
|
30
|
-
N({ viewSize: e2, renderCount: Math.ceil(e2 / z) + 1 });
|
|
31
|
-
})();
|
|
32
|
-
}, [j, g]), l(() => {
|
|
33
|
-
d2.length && L && (() => {
|
|
34
|
-
var _a;
|
|
35
|
-
const e2 = [], t3 = d2.length - v.prevLen, r2 = t3 > 0 ? S.length : 0, i2 = r2 > 0 ? S[r2 - 1].end : 0;
|
|
36
|
-
for (let r3 = 0; r3 < (t3 > 0 ? t3 : d2.length); r3++) {
|
|
37
|
-
const n2 = d2[(t3 > 0 ? v.prevLen : 0) + r3];
|
|
38
|
-
e2.push({ index: n2.id, size: z, start: i2 ? i2 + r3 * z : n2.id * z, end: i2 ? i2 + (r3 + 1) * z : (n2.id + 1) * z, dSize: 0 });
|
|
39
|
-
}
|
|
40
|
-
m((r3) => [...t3 > 0 ? r3 : [], ...e2]), N({ prevLen: d2.length }), f && ((_a = j.current) == null ? void 0 : _a.scrollTo(0, 0));
|
|
41
|
-
})();
|
|
42
|
-
}, [L, d2, f]), l(() => {
|
|
43
|
-
(() => {
|
|
44
|
-
if (!L.current || 0 === S.length) return;
|
|
45
|
-
const e2 = Array.from(L.current.childNodes);
|
|
46
|
-
if (!e2.length) return;
|
|
47
|
-
e2.forEach((e3) => {
|
|
48
|
-
const t4 = e3.getBoundingClientRect(), r3 = +e3.getAttribute("data-virtual-id"), i3 = S[r3], n2 = i3.size - ("vertical" === g ? t4.height : t4.width);
|
|
49
|
-
n2 && (i3.size = "vertical" === g ? t4.height : t4.width, i3.end = i3.end - n2, i3.dSize = n2);
|
|
50
|
-
});
|
|
51
|
-
const t3 = +e2[0].getAttribute("data-virtual-id"), r2 = S.length;
|
|
52
|
-
let i2 = S[t3].dSize;
|
|
53
|
-
S[t3].dSize = 0;
|
|
54
|
-
for (let e3 = t3 + 1; e3 < r2; e3++) {
|
|
55
|
-
const t4 = S[e3];
|
|
56
|
-
t4.start = S[e3 - 1].end, t4.end = t4.end - i2, t4.dSize && (i2 += t4.dSize, t4.dSize = 0);
|
|
57
|
-
}
|
|
58
|
-
N({ listSize: S[r2 - 1].end });
|
|
59
|
-
})();
|
|
60
|
-
}, [L, S, v.startIndex, g]), e.jsx("div", { ref: j, className: t2, style: { width: "100%", height: "100%", overflow: "auto", ...s2 }, children: e.jsx("ul", { ref: L, className: h, style: { ...C, ...u }, children: y }) });
|
|
61
|
-
}), s = (e2, t2) => e2.map((e3, r2) => ({ id: r2, data: t2(e3, r2) }));
|
|
62
|
-
export {
|
|
63
|
-
d as E,
|
|
64
|
-
s as c
|
|
65
|
-
};
|
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
import { p as t } from "./PortalRenderer-CDAzQJgm.js";
|
|
2
|
-
const e = { changeThemeClipPathCircle: (t2) => {
|
|
3
|
-
const e2 = "ono-view-transition-clip-path-circle", { element: n2, duration: r2 = 300, themeRules: s2, onChangeTheme: a2 } = t2, o2 = (s2 == null ? void 0 : s2()) || document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
4
|
-
if (!document.startViewTransition) return a2("dark" === o2 ? "light" : "dark");
|
|
5
|
-
const i2 = document.startViewTransition(() => {
|
|
6
|
-
const t3 = document.documentElement.classList.contains("dark");
|
|
7
|
-
a2(t3 ? "light" : "dark");
|
|
8
|
-
}), { top: c2, left: l2, width: h2, height: u2 } = n2.getBoundingClientRect(), d2 = l2 + h2 / 2, p2 = c2 + u2 / 2, g2 = [`circle(0% at ${d2}px ${p2}px)`, `circle(${Math.hypot(Math.max(d2, window.innerWidth - d2), Math.max(p2, window.innerHeight - p2))}px at ${d2}px ${p2}px)`];
|
|
9
|
-
((t3, e3) => {
|
|
10
|
-
const n3 = document.createElement("style");
|
|
11
|
-
n3.setAttribute("type", "text/css"), n3.setAttribute("data-style-tag", e3), n3.textContent = "\n ::view-transition-old(root),\n ::view-transition-new(root) {\n animation: none;\n }\n .dark::view-transition-old(root) {\n z-index: 1;\n }\n\n .dark::view-transition-new(root) {\n z-index: 999;\n }\n\n ::view-transition-old(root) {\n z-index: 999;\n }\n\n ::view-transition-new(root) {\n z-index: 1;\n }\n ", document.head.appendChild(n3);
|
|
12
|
-
})(0, e2), i2.ready.then(() => {
|
|
13
|
-
document.documentElement.animate({ clipPath: "light" === o2 ? g2 : g2.reverse() }, { duration: r2, easing: "ease-in-out", pseudoElement: "light" === o2 ? "::view-transition-new(root)" : "::view-transition-old(root)" }), setTimeout(() => ((t3) => {
|
|
14
|
-
document.head.querySelectorAll("style").forEach((e3) => e3.getAttribute("data-style-tag") === t3 && e3.remove());
|
|
15
|
-
})(e2), r2 + 100);
|
|
16
|
-
});
|
|
17
|
-
} }, n = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+])[\da-zA-Z]{8,}$/, r = (t2) => t2 <= 11 ? Math.random().toString(36).substring(2, 2 + t2).padEnd(t2, "0") : r(11) + r(t2 - 11), s = ({ el: t2, str: e2 = "hello world", speed: n2 = 100, isExtendStr: r2 = true, onDone: s2 }) => {
|
|
18
|
-
let a2 = 0, o2 = null;
|
|
19
|
-
t2.textContent && r2 && (a2 = t2.textContent.length, e2 = t2.textContent + e2);
|
|
20
|
-
const i2 = () => {
|
|
21
|
-
clearTimeout(o2);
|
|
22
|
-
const r3 = e2.substring(0, a2 + 1);
|
|
23
|
-
t2.textContent = r3, a2++, a2 !== e2.length ? o2 = setTimeout(i2, n2) : s2 && s2();
|
|
24
|
-
};
|
|
25
|
-
i2();
|
|
26
|
-
}, a = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), o = async (t2, e2) => {
|
|
27
|
-
const n2 = (t3, e3) => {
|
|
28
|
-
const n3 = window.URL.createObjectURL(t3), r2 = document.createElement("a");
|
|
29
|
-
r2.href = n3, r2.download = encodeURIComponent(e3), document.body.appendChild(r2), r2.click(), document.body.removeChild(r2), window.URL.revokeObjectURL(n3);
|
|
30
|
-
};
|
|
31
|
-
try {
|
|
32
|
-
if ("string" == typeof t2) {
|
|
33
|
-
const r2 = await fetch(t2);
|
|
34
|
-
if (!r2.ok) throw new Error(`Network response was not ok: ${r2.statusText}`);
|
|
35
|
-
n2(await r2.blob(), e2);
|
|
36
|
-
} else n2(t2, e2);
|
|
37
|
-
} catch (t3) {
|
|
38
|
-
console.error("文件下载失败:", t3 instanceof Error ? t3.message : String(t3));
|
|
39
|
-
}
|
|
40
|
-
}, i = (t2, e2) => {
|
|
41
|
-
t2.toString().startsWith("2") ? e2.onSuccess && e2.onSuccess() : (t2.toString().startsWith("4") || t2.toString().startsWith("5")) && e2.onFail && e2.onFail();
|
|
42
|
-
}, c = (t2) => {
|
|
43
|
-
const e2 = t2.getBoundingClientRect();
|
|
44
|
-
return { x: e2.left + e2.width / 2, y: e2.top + e2.height / 2 };
|
|
45
|
-
}, l = (t2, e2, n2) => {
|
|
46
|
-
const r2 = new IntersectionObserver(e2, n2);
|
|
47
|
-
t2 instanceof HTMLElement ? r2.observe(t2) : t2.forEach((t3) => r2.observe(t3));
|
|
48
|
-
}, h = (t2) => {
|
|
49
|
-
const e2 = Math.floor(t2 / 3600), n2 = Math.floor(t2 % 3600 / 60), r2 = Math.floor(t2 % 60), s2 = (t3) => t3.toString().padStart(2, "0");
|
|
50
|
-
return (e2 > 0 ? `${s2(e2)}:${s2(n2)}:${s2(r2)}` : `${s2(n2)}:${s2(r2)}`) + (t2 < 10 ? ".00" : t2 < 100 ? ".0" : "");
|
|
51
|
-
}, u = (t2) => {
|
|
52
|
-
if (t2.length < 2) return t2;
|
|
53
|
-
const e2 = t2[0], n2 = t2.slice(1).filter((t3) => t3 <= e2), r2 = t2.slice(1).filter((t3) => t3 > e2);
|
|
54
|
-
return [...u(n2), e2, ...u(r2)];
|
|
55
|
-
}, d = (t2, e2) => {
|
|
56
|
-
const n2 = ["B", "KB", "MB", "GB", "TB"], r2 = 1024;
|
|
57
|
-
let s2 = n2.indexOf((e2 == null ? void 0 : e2.unit) ?? "B");
|
|
58
|
-
if (-1 === s2) throw new Error("Invalid unit");
|
|
59
|
-
if (!(e2 == null ? void 0 : e2.unit)) for (; t2 / Math.pow(r2, s2) >= r2; ) s2++;
|
|
60
|
-
return `${(t2 / Math.pow(r2, s2)).toFixed((e2 == null ? void 0 : e2.decimalPlaces) ?? 0)} ${n2[s2]}`;
|
|
61
|
-
}, p = (t2, e2) => `${Math.floor(t2 / g(t2, e2))}:${Math.floor(e2 / g(t2, e2))}`, g = (t2, e2) => {
|
|
62
|
-
for (; 0 !== e2; ) {
|
|
63
|
-
const n2 = e2;
|
|
64
|
-
e2 = t2 % e2, t2 = n2;
|
|
65
|
-
}
|
|
66
|
-
return t2;
|
|
67
|
-
}, m = (t2, e2, n2) => {
|
|
68
|
-
t2.muted = true, t2.play();
|
|
69
|
-
const r2 = new AudioContext(), s2 = "running" === r2.state;
|
|
70
|
-
r2.close(), s2 ? (t2.muted = false, e2 == null ? void 0 : e2()) : n2 == null ? void 0 : n2();
|
|
71
|
-
}, b = (t2) => new URLSearchParams(window.location.search).get(t2), f = (t2) => {
|
|
72
|
-
let e2;
|
|
73
|
-
const n2 = new Proxy(t2, { construct: (t3, n3) => (e2 || (e2 = Reflect.construct(t3, n3)), e2) });
|
|
74
|
-
return n2.prototype.construct = n2, n2;
|
|
75
|
-
}, w = (t2) => "string" != typeof t2 || 0 === t2.length ? "" : t2.charAt(0).toUpperCase() + t2.slice(1), M = (t2) => {
|
|
76
|
-
if ("object" != typeof t2 || null === t2) return t2;
|
|
77
|
-
const e2 = Array.isArray(t2) ? [] : {};
|
|
78
|
-
for (const n2 in t2) Object.prototype.hasOwnProperty.call(t2, n2) && (e2[n2] = M(t2[n2]));
|
|
79
|
-
return e2;
|
|
80
|
-
}, $ = (t2) => new Promise((e2) => {
|
|
81
|
-
const n2 = new Image();
|
|
82
|
-
n2.src = "string" == typeof t2 ? t2 : URL.createObjectURL(t2), n2.onload = () => e2({ width: n2.width, height: n2.height });
|
|
83
|
-
}), y = (t2, e2) => {
|
|
84
|
-
let n2 = 0;
|
|
85
|
-
const r2 = (s2) => {
|
|
86
|
-
n2 || (n2 = s2), s2 - n2 >= e2 ? t2() : requestAnimationFrame(r2);
|
|
87
|
-
};
|
|
88
|
-
requestAnimationFrame(r2);
|
|
89
|
-
}, x = (t2, e2, n2) => {
|
|
90
|
-
const r2 = t2[e2];
|
|
91
|
-
t2[e2] = function(t3) {
|
|
92
|
-
r2 && "function" == typeof r2 && r2.call(this, t3), n2.call(this, t3);
|
|
93
|
-
};
|
|
94
|
-
}, S = (t2) => {
|
|
95
|
-
if ("number" != typeof t2 || isNaN(t2)) throw new Error("请输入有效的数字");
|
|
96
|
-
const e2 = t2.toString().split(".");
|
|
97
|
-
return e2[0] = e2[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), e2.join(".");
|
|
98
|
-
}, N = (t2) => parseFloat(t2.replace(/[^0-9.]/g, "")), I = (t2, e2, n2, r2) => Math.sqrt((t2 - n2) ** 2 + (e2 - r2) ** 2), k = (t2) => navigator.clipboard.writeText(t2), C = (t2) => Math.ceil((t2.getTime() - new Date(t2.getFullYear(), 0, 1).getTime()) / 864e5), v = (t2, e2, n2) => 0.2126 * t2 + 0.7152 * e2 + 0.0722 * n2, A = (t2) => {
|
|
99
|
-
const e2 = {};
|
|
100
|
-
return t2.replace(/([^?=&]+)=([^&]+)/g, (t3, n2, r2) => e2[n2] = r2), e2;
|
|
101
|
-
}, O = (t2, ...e2) => Object.fromEntries(Object.entries(t2).filter(([t3]) => e2.includes(t3))), D = (t2) => {
|
|
102
|
-
if (!t2) return "";
|
|
103
|
-
const e2 = t2.lastIndexOf(".");
|
|
104
|
-
return -1 === e2 ? D(t2.substring(t2.lastIndexOf("/") + 1)) : t2.substring(0, e2);
|
|
105
|
-
}, E = (t2) => {
|
|
106
|
-
if (!t2) return "";
|
|
107
|
-
const e2 = t2.lastIndexOf(".");
|
|
108
|
-
return t2.substring(e2 + 1);
|
|
109
|
-
}, F = { addCommasToNumber: S, addEventWithOriginHandler: x, calculateAspectRatio: p, checkDeviceIsMobile: a, checkStatusCode: i, copy2Clipboard: k, createIntersectionObserver: l, dayOfYear: C, deepCopy: M, downloadFile: o, formatFileSize: d, formatSecondes: h, getElementCenterPosition: c, getFileName: D, getFileSuffix: E, getImageSIze: $, getPointDistance: I, getURLSearchParams: b, grayColor: v, mediaAutoplayPolicies: m, parseQuery: A, passwordStrength: n, pick: O, printStr: s, pureNumber: N, quickSort: u, rafTimeout: y, randomString: r, safeCapitalizeWord: w, singleton: f };
|
|
110
|
-
let j = 1;
|
|
111
|
-
const R = [], P = (t2, e2, n2) => (0 === R.length && (j = 1), Y(e2.instancesKey || "", t2, { id: `${n2}-${j++}`, key: e2.instancesKey || "", reactNode: t2, props: e2, offsetOptions: { topOffset: 0, height: 0, bottomOffset: 0 } }), R), T = (t2) => {
|
|
112
|
-
const e2 = R.findIndex((e3) => e3.id === t2);
|
|
113
|
-
-1 !== e2 && R.splice(e2, 1);
|
|
114
|
-
}, U = (t2, e2) => {
|
|
115
|
-
const n2 = R.findIndex((e3) => e3.id === t2);
|
|
116
|
-
n2 < 0 || (R[n2].offsetOptions = e2);
|
|
117
|
-
}, B = (t2) => {
|
|
118
|
-
const e2 = R.findIndex((e3) => e3.id === t2);
|
|
119
|
-
return e2 <= 0 ? 0 : R[e2 - 1].offsetOptions.topOffset;
|
|
120
|
-
}, L = (t2) => {
|
|
121
|
-
const e2 = R.findIndex((e3) => e3.id === t2);
|
|
122
|
-
return e2 <= 0 ? 0 : R[e2 - 1].offsetOptions.bottomOffset;
|
|
123
|
-
}, Y = (e2, n2, r2) => {
|
|
124
|
-
const s2 = (e3) => t(n2, { zIndex: 999 + j - 1, ...e3.props, id: e3.id }, e3.id, "ono-message-root");
|
|
125
|
-
if (!e2) {
|
|
126
|
-
const t2 = s2(r2);
|
|
127
|
-
R.push({ ...r2, props: { ...r2.props, id: r2.id, destroy: t2 }, destroy: t2 });
|
|
128
|
-
}
|
|
129
|
-
let a2 = false;
|
|
130
|
-
const o2 = R.map((t2) => {
|
|
131
|
-
if (t2.key === e2) {
|
|
132
|
-
a2 = true;
|
|
133
|
-
const e3 = { ...t2.props, ...r2.props };
|
|
134
|
-
return { ...t2, props: e3 };
|
|
135
|
-
}
|
|
136
|
-
{
|
|
137
|
-
const e3 = s2(t2);
|
|
138
|
-
return { ...t2, props: { ...t2.props, id: t2.id, destroy: e3 }, destroy: e3 };
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
if (Object.assign(R, o2), !a2) {
|
|
142
|
-
const t2 = s2(r2);
|
|
143
|
-
R.push({ ...r2, props: { ...r2.props, id: r2.id, destroy: t2 }, destroy: t2 });
|
|
144
|
-
}
|
|
145
|
-
}, z = (t2) => {
|
|
146
|
-
var _a;
|
|
147
|
-
return t2 ? (_a = R.find((e2) => e2.key === t2)) == null ? void 0 : _a.props : null;
|
|
148
|
-
}, W = /\d+/g, q = (t2) => {
|
|
149
|
-
const e2 = t2.match(W), n2 = (t3) => Number(t3).toString(16).padStart(2, "0"), r2 = (t3) => t3.reduce((t4, e3) => t4 + n2(e3), "#"), s2 = (t3) => {
|
|
150
|
-
const e3 = t3, s3 = 1 !== Number(t3[t3.length - 1]) ? Number(t3[t3.length - 1]) : 100;
|
|
151
|
-
return e3.pop(), r2(e3) + n2(2.56 * s3);
|
|
152
|
-
};
|
|
153
|
-
return 3 === e2.length ? r2(e2) : 5 === e2.length ? s2([e2[0], e2[1], e2[2], 10 * Number(e2[e2.length - 1])]) : s2(e2);
|
|
154
|
-
}, H = (t2) => {
|
|
155
|
-
const e2 = t2.split("#")[1], n2 = (t3) => [parseInt(t3.slice(0, 2), 16), parseInt(t3.slice(2, 4), 16), parseInt(t3.slice(4, 6), 16)];
|
|
156
|
-
if (8 === e2.length) {
|
|
157
|
-
const t3 = parseInt(e2.slice(-2), 16) / 256, r2 = n2(e2.slice(0, -2));
|
|
158
|
-
return r2.push(t3), "rgba(" + r2.join(", ") + ")";
|
|
159
|
-
}
|
|
160
|
-
return "rgb(" + n2(e2).join(", ") + ")";
|
|
161
|
-
}, J = (t2) => {
|
|
162
|
-
const e2 = t2.match(W), n2 = Number(e2[0]) / 255, r2 = Number(e2[1]) / 255, s2 = Number(e2[2]) / 255, a2 = Math.min(n2, r2, s2), o2 = Math.max(n2, r2, s2);
|
|
163
|
-
let i2 = 0, c2 = 0, l2 = (o2 + a2) / 2;
|
|
164
|
-
if (o2 === a2) i2 = c2 = 0;
|
|
165
|
-
else {
|
|
166
|
-
const t3 = o2 - a2;
|
|
167
|
-
switch (c2 = l2 > 0.5 ? t3 / (2 - o2 - a2) : t3 / (o2 + a2), o2) {
|
|
168
|
-
case n2:
|
|
169
|
-
i2 = (r2 - s2) / t3 + (r2 < s2 ? 6 : 0);
|
|
170
|
-
break;
|
|
171
|
-
case r2:
|
|
172
|
-
i2 = (s2 - n2) / t3 + 2;
|
|
173
|
-
break;
|
|
174
|
-
case s2:
|
|
175
|
-
i2 = (n2 - r2) / t3 + 4;
|
|
176
|
-
}
|
|
177
|
-
i2 /= 6;
|
|
178
|
-
}
|
|
179
|
-
return `hsl(${Math.round(360 * i2)}, ${Math.round(100 * c2)}%, ${Math.round(100 * l2)}%)`;
|
|
180
|
-
}, K = (t2) => {
|
|
181
|
-
const e2 = t2.match(W), n2 = Number(e2[0]) / 360, r2 = Number(e2[1]) / 100, s2 = Number(e2[2]) / 100;
|
|
182
|
-
let a2, o2, i2;
|
|
183
|
-
function c2(t3, e3, n3) {
|
|
184
|
-
return n3 < 0 && (n3 += 1), n3 > 1 && (n3 -= 1), n3 < 1 / 6 ? t3 + 6 * (e3 - t3) * n3 : n3 < 0.5 ? e3 : n3 < 2 / 3 ? t3 + (e3 - t3) * (2 / 3 - n3) * 6 : t3;
|
|
185
|
-
}
|
|
186
|
-
let l2 = s2 < 0.5 ? s2 * (1 + r2) : s2 + r2 - s2 * r2, h2 = 2 * s2 - l2;
|
|
187
|
-
return a2 = c2(h2, l2, n2 + 1 / 3), o2 = c2(h2, l2, n2), i2 = c2(h2, l2, n2 - 1 / 3), `rgb(${Math.round(255 * a2)}, ${Math.round(255 * o2)}, ${Math.round(255 * i2)})`;
|
|
188
|
-
}, V = (t2) => J(H(t2)), Z = (t2) => q(K(t2)), G = (t2) => {
|
|
189
|
-
const e2 = t2.match(W);
|
|
190
|
-
let n2 = Number(e2[0]) / 255, r2 = Number(e2[1]) / 255, s2 = Number(e2[2]) / 255;
|
|
191
|
-
const a2 = Math.max(n2, r2, s2), o2 = Math.min(n2, r2, s2);
|
|
192
|
-
let i2 = 0, c2 = 0, l2 = a2;
|
|
193
|
-
const h2 = a2 - o2;
|
|
194
|
-
if (c2 = 0 === a2 ? 0 : h2 / a2, a2 === o2) i2 = 0;
|
|
195
|
-
else {
|
|
196
|
-
switch (a2) {
|
|
197
|
-
case n2:
|
|
198
|
-
i2 = (r2 - s2) / h2 + (r2 < s2 ? 6 : 0);
|
|
199
|
-
break;
|
|
200
|
-
case r2:
|
|
201
|
-
i2 = (s2 - n2) / h2 + 2;
|
|
202
|
-
break;
|
|
203
|
-
case s2:
|
|
204
|
-
i2 = (n2 - r2) / h2 + 4;
|
|
205
|
-
}
|
|
206
|
-
i2 /= 6;
|
|
207
|
-
}
|
|
208
|
-
return `hsv(${360 * i2}, ${100 * c2}, ${100 * l2})`;
|
|
209
|
-
}, Q = (t2) => {
|
|
210
|
-
const e2 = t2.match(W);
|
|
211
|
-
let n2, r2, s2, a2, o2, i2, c2, l2, h2 = Number(e2[0]) / 360, u2 = Number(e2[1]) / 100, d2 = Number(e2[2]) / 100;
|
|
212
|
-
if (h2 && 0 === u2) n2 = r2 = s2 = d2;
|
|
213
|
-
else switch (h2 /= 60, a2 = Math.floor(h2), o2 = h2 - a2, i2 = d2 * (1 - u2), c2 = d2 * (1 - u2 * o2), l2 = d2 * (1 - u2 * (1 - o2)), a2) {
|
|
214
|
-
case 0:
|
|
215
|
-
n2 = d2, r2 = l2, s2 = i2;
|
|
216
|
-
break;
|
|
217
|
-
case 1:
|
|
218
|
-
n2 = c2, r2 = d2, s2 = i2;
|
|
219
|
-
break;
|
|
220
|
-
case 2:
|
|
221
|
-
n2 = i2, r2 = d2, s2 = l2;
|
|
222
|
-
break;
|
|
223
|
-
case 3:
|
|
224
|
-
n2 = i2, r2 = c2, s2 = d2;
|
|
225
|
-
break;
|
|
226
|
-
case 4:
|
|
227
|
-
n2 = l2, r2 = i2, s2 = d2;
|
|
228
|
-
break;
|
|
229
|
-
default:
|
|
230
|
-
n2 = d2, r2 = i2, s2 = c2;
|
|
231
|
-
}
|
|
232
|
-
return `rgb(${Math.round(255 * n2)}, ${Math.round(255 * r2)}, ${Math.round(255 * s2)})`;
|
|
233
|
-
}, _ = (t2) => /^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/.test(t2) ? "hex" : /^rgb\((1?\d{1,3},\s*1?\d{1,3},\s*1?\d{1,3})\)$/.test(t2) ? "rgb" : "unknown", X = (t2, e2, n2) => {
|
|
234
|
-
let r2 = [];
|
|
235
|
-
if (t2.includes("#")) r2 = V(t2).match(W);
|
|
236
|
-
else if (t2.includes("rgb")) r2 = J(t2).match(W);
|
|
237
|
-
else {
|
|
238
|
-
if (!t2.includes("hsl")) throw new Error("颜色格式错误");
|
|
239
|
-
r2 = t2.match(W);
|
|
240
|
-
}
|
|
241
|
-
return Z(`${r2[0]}, ${r2[1]}%, ${"light" === e2 ? Number(r2[2]) + n2 > 100 ? 100 : Number(r2[2]) + n2 : Number(r2[2]) - n2 < 0 ? 0 : Number(r2[2]) - n2}%`);
|
|
242
|
-
}, tt = { randomColor: () => "#" + Math.random().toString(16).slice(2, 8).padEnd(6, "0"), rgb2hex: q, hex2rgb: H, rgb2rgba: (t2, e2) => {
|
|
243
|
-
if (!e2) return t2;
|
|
244
|
-
if (t2.includes("rgba")) {
|
|
245
|
-
const n2 = t2.split(",");
|
|
246
|
-
return n2.pop(), n2.push(e2 + ")"), n2.join(",");
|
|
247
|
-
}
|
|
248
|
-
if (t2.includes("rgb")) {
|
|
249
|
-
const n2 = t2.split(","), r2 = "rgba(" + n2[0].split("(")[1], s2 = n2[n2.length - 1].split(")")[0];
|
|
250
|
-
return [r2, n2[1], s2, " " + e2 + ")"].join(",");
|
|
251
|
-
}
|
|
252
|
-
}, rgb2hsl: J, hsl2rgb: K, hex2hsl: V, hsl2hex: Z, rgb2hsv: G, hsv2rgb: Q, hex2hsv: (t2) => G(H(t2)), hsv2hex: (t2) => q(Q(t2)), formatColor: (t2, e2, n2 = "rgba") => {
|
|
253
|
-
const r2 = t2.match(W);
|
|
254
|
-
let s2 = Number(r2[0]) / 255, a2 = Number(r2[1]) / 255, o2 = Number(r2[2]) / 255;
|
|
255
|
-
return "rgba" === n2 ? `rgba(${s2},${a2},${o2},${e2})` : "rgb" === n2 ? t2 : "hex" === n2 ? q(t2) : "hsl" === n2 ? J(`rgba(${s2},${a2},${o2},${e2})`) : `rgba(${s2},${a2},${o2},${e2})`;
|
|
256
|
-
}, getContrastColor: (t2) => {
|
|
257
|
-
const e2 = (function(t3) {
|
|
258
|
-
if (t3.startsWith("#")) return 4 === t3.length && (t3 = `#${t3.slice(1).repeat(2)}`), [parseInt(t3.substr(1, 2), 16), parseInt(t3.substr(3, 2), 16), parseInt(t3.substr(5, 2), 16)];
|
|
259
|
-
if (t3.startsWith("rgb")) {
|
|
260
|
-
const e3 = t3.match(/\d+/g);
|
|
261
|
-
return [parseInt(e3[0]), parseInt(e3[1]), parseInt(e3[2])];
|
|
262
|
-
}
|
|
263
|
-
return null;
|
|
264
|
-
})(t2);
|
|
265
|
-
return null === e2 ? null : (299 * (n2 = e2)[0] + 587 * n2[1] + 114 * n2[2]) / 1e3 > 128 ? "#000" : "#fff";
|
|
266
|
-
var n2;
|
|
267
|
-
}, adjustColor: (t2, e2, n2) => {
|
|
268
|
-
const r2 = _(t2);
|
|
269
|
-
if ("hex" === r2) {
|
|
270
|
-
const r3 = t2.replace("#", ""), s2 = parseInt(r3.slice(0, 2), 16), a2 = parseInt(r3.slice(2, 4), 16), o2 = parseInt(r3.slice(4, 6), 16);
|
|
271
|
-
if ("lighten" === e2) {
|
|
272
|
-
const t3 = Math.min(255, Math.max(0, s2 + (255 - s2) * n2 / 100)), e3 = Math.min(255, Math.max(0, a2 + (255 - a2) * n2 / 100)), r4 = Math.min(255, Math.max(0, o2 + (255 - o2) * n2 / 100));
|
|
273
|
-
return `#${t3.toString(16).padStart(2, "0")}${e3.toString(16).padStart(2, "0")}${r4.toString(16).padStart(2, "0")}`;
|
|
274
|
-
}
|
|
275
|
-
if ("darken" === e2) {
|
|
276
|
-
const t3 = Math.min(255, Math.max(0, s2 - s2 * n2 / 100)), e3 = Math.min(255, Math.max(0, a2 - a2 * n2 / 100)), r4 = Math.min(255, Math.max(0, o2 - o2 * n2 / 100));
|
|
277
|
-
return `#${t3.toString(16).padStart(2, "0")}${e3.toString(16).padStart(2, "0")}${r4.toString(16).padStart(2, "0")}`;
|
|
278
|
-
}
|
|
279
|
-
} else if ("rgb" === r2) {
|
|
280
|
-
const r3 = t2.match(/\d+/g), s2 = parseInt(r3[0]), a2 = parseInt(r3[1]), o2 = parseInt(r3[2]);
|
|
281
|
-
if ("lighten" === e2) return `rgb(${Math.min(255, Math.max(0, s2 + (255 - s2) * n2 / 100))},${Math.min(255, Math.max(0, a2 + (255 - a2) * n2 / 100))},${Math.min(255, Math.max(0, o2 + (255 - o2) * n2 / 100))})`;
|
|
282
|
-
if ("darken" === e2) return `rgb(${Math.min(255, Math.max(0, s2 - s2 * n2 / 100))},${Math.min(255, Math.max(0, a2 - a2 * n2 / 100))},${Math.min(255, Math.max(0, o2 - o2 * n2 / 100))})`;
|
|
283
|
-
}
|
|
284
|
-
return t2;
|
|
285
|
-
}, isValidColor: (t2) => !(!/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/.test(t2) && !/^rgb\((1?\d{1,3},\s*1?\d{1,3},\s*1?\d{1,3})\)$/.test(t2)), getColorType: _, hex3To6: (t2) => {
|
|
286
|
-
const e2 = t2.replace("#", "").split("");
|
|
287
|
-
return `#${e2[0] + e2[0] + e2[1] + e2[1] + e2[2] + e2[2]}`;
|
|
288
|
-
}, adjustingColors: X }, et = (t2) => {
|
|
289
|
-
const e2 = t2.split(","), n2 = e2[0].match(/:(.*?);/)[1], r2 = atob(e2[1]);
|
|
290
|
-
let s2 = r2.length;
|
|
291
|
-
const a2 = new Uint8Array(s2);
|
|
292
|
-
for (; s2--; ) a2[s2] = r2.charCodeAt(s2);
|
|
293
|
-
return new Blob([a2], { type: n2 });
|
|
294
|
-
}, nt = (t2, e2) => {
|
|
295
|
-
const n2 = t2.split(","), r2 = n2[0].match(/:(.*?);/u)[1], s2 = atob(n2[1]);
|
|
296
|
-
let a2 = s2.length, o2 = "jpeg" === r2.split("/")[1] ? ".jpg" : "." + r2.split("/")[1];
|
|
297
|
-
const i2 = new Uint8Array(a2);
|
|
298
|
-
for (; a2--; ) i2[a2] = s2.charCodeAt(a2);
|
|
299
|
-
const c2 = new Blob([i2], { type: r2 });
|
|
300
|
-
return new File([c2], e2 + o2, { type: r2, lastModified: (/* @__PURE__ */ new Date()).getTime() });
|
|
301
|
-
}, rt = (t2) => new Promise((e2) => {
|
|
302
|
-
const n2 = new FileReader();
|
|
303
|
-
n2.readAsDataURL(t2), n2.onload = (t3) => {
|
|
304
|
-
var _a;
|
|
305
|
-
const n3 = (_a = t3.target) == null ? void 0 : _a.result, r2 = n3.split(",")[1];
|
|
306
|
-
e2(r2);
|
|
307
|
-
};
|
|
308
|
-
}), st = (t2, e2 = "abc.jpg") => new File([t2], e2, { type: t2.type }), at = (t2) => new Promise((e2) => {
|
|
309
|
-
const n2 = new FileReader();
|
|
310
|
-
n2.readAsDataURL(t2), n2.onload = (t3) => {
|
|
311
|
-
var _a;
|
|
312
|
-
return e2((_a = t3.target) == null ? void 0 : _a.result);
|
|
313
|
-
};
|
|
314
|
-
}), ot = (t2) => t2.slice(0, t2.size, t2.type), it = async (t2) => await (await fetch(t2)).blob(), ct = async (t2) => st(await it(t2)), lt = async (t2) => await rt(await it(t2)), ht = (t2) => t2 < 10 ? `0${t2}` : `${t2}`, ut = (t2) => t2.toString().length > 13 ? new Date(Number(t2.toString().substring(0, 13))) : 13 === t2.toString().length ? new Date(t2) : t2.toString().length < 13 && t2.toString().length > 10 ? new Date(Number((t2.toString() + "000").substring(0, 13))) : 10 === t2.toString().length ? new Date(1e3 * t2) : new Date(Number((t2.toString() + "000000000000").substring(0, 13))), dt = (t2, e2 = "YY-MM-DD hh:mm:ss") => {
|
|
315
|
-
const n2 = ["YY", "MM", "DD", "hh", "mm", "ss"], r2 = [], s2 = ut(t2);
|
|
316
|
-
r2.push(s2.getFullYear().toString()), r2.push(ht(s2.getMonth() + 1)), r2.push(ht(s2.getDate())), r2.push(ht(s2.getHours())), r2.push(ht(s2.getMinutes())), r2.push(ht(s2.getSeconds()));
|
|
317
|
-
for (let t3 in r2) e2 = e2.replace(n2[t3], r2[t3]);
|
|
318
|
-
return e2;
|
|
319
|
-
}, pt = (t2, e2 = "YY-MM-DD hh:mm:ss", n2 = "cn") => {
|
|
320
|
-
const r2 = ["YY", "MM", "DD", "hh", "mm", "ss"], s2 = [], a2 = ut(t2);
|
|
321
|
-
s2.push(((t3, e3) => {
|
|
322
|
-
const n3 = { en: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], cn: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"] };
|
|
323
|
-
return t3.split("").map((t4) => n3[e3][Number(t4)]).join("");
|
|
324
|
-
})(a2.getFullYear().toString(), n2)), s2.push(((t3, e3) => ({ en: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"], cn: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"] })[e3][Number(t3) - 1])(ht(a2.getMonth() + 1), n2)), s2.push(((t3, e3) => {
|
|
325
|
-
let n3;
|
|
326
|
-
return "en" === e3 ? n3 = "01" === t3 || "21" === t3 || "31" === t3 ? Number(t3) + "st" : "02" === t3 || "22" === t3 ? Number(t3) + "nd" : "03" === t3 || "23" === t3 ? Number(t3) + "rd" : Number(t3) + "th" : "01" === t3 ? n3 = "一日" : "02" === t3 ? n3 = "二日" : "03" === t3 ? n3 = "三日" : "04" === t3 ? n3 = "四日" : "05" === t3 ? n3 = "五日" : "06" === t3 ? n3 = "六日" : "07" === t3 ? n3 = "七日" : "08" === t3 ? n3 = "八日" : "09" === t3 ? n3 = "九日" : "10" === t3 ? n3 = "十日" : "11" === t3 ? n3 = "十一日" : "12" === t3 ? n3 = "十二日" : "13" === t3 ? n3 = "十三日" : "14" === t3 ? n3 = "十四日" : "15" === t3 ? n3 = "十五日" : "16" === t3 ? n3 = "十六日" : "17" === t3 ? n3 = "十七日" : "18" === t3 ? n3 = "十八日" : "19" === t3 ? n3 = "十九日" : "20" === t3 ? n3 = "二十日" : "21" === t3 ? n3 = "二十一日" : "22" === t3 ? n3 = "二十二日" : "23" === t3 ? n3 = "二十三日" : "24" === t3 ? n3 = "二十四日" : "25" === t3 ? n3 = "二十五日" : "26" === t3 ? n3 = "二十六日" : "27" === t3 ? n3 = "二十七日" : "28" === t3 ? n3 = "二十八日" : "29" === t3 ? n3 = "二十九日" : "30" === t3 ? n3 = "三十日" : "31" === t3 && (n3 = "三十一日"), n3 ?? t3;
|
|
327
|
-
})(ht(a2.getDate()), n2)), s2.push(ht(a2.getHours())), s2.push(ht(a2.getMinutes())), s2.push(ht(a2.getSeconds()));
|
|
328
|
-
for (let t3 in s2) e2 = e2.replace(r2[t3], s2[t3]);
|
|
329
|
-
return e2;
|
|
330
|
-
}, gt = (t2, e2) => {
|
|
331
|
-
const n2 = ["DD", "hh", "mm", "ss"], r2 = [];
|
|
332
|
-
r2.push(Math.floor(t2 / 86400)), r2.push(ht(Math.floor(t2 % 86400 / 3600))), r2.push(ht(Math.floor(t2 % 3600 / 60))), r2.push(ht(t2 % 60));
|
|
333
|
-
for (let t3 = 0; t3 < n2.length; t3++) e2 = e2.replace(n2[t3], r2[t3].toString());
|
|
334
|
-
return e2;
|
|
335
|
-
}, mt = (t2, e2) => {
|
|
336
|
-
const n2 = { year: 31536e3, month: 2592e3, day: 86400, hour: 3600, minute: 60, second: 1 };
|
|
337
|
-
if (!n2[e2]) throw new Error('Invalid type. Please use "day", "hour", "minute", or "second".');
|
|
338
|
-
return Math.floor(t2 / n2[e2]);
|
|
339
|
-
};
|
|
340
|
-
export {
|
|
341
|
-
o as A,
|
|
342
|
-
at as B,
|
|
343
|
-
ot as C,
|
|
344
|
-
d as D,
|
|
345
|
-
h as E,
|
|
346
|
-
dt as F,
|
|
347
|
-
D as G,
|
|
348
|
-
E as H,
|
|
349
|
-
$ as I,
|
|
350
|
-
I as J,
|
|
351
|
-
b as K,
|
|
352
|
-
v as L,
|
|
353
|
-
pt as M,
|
|
354
|
-
m as N,
|
|
355
|
-
A as O,
|
|
356
|
-
n as P,
|
|
357
|
-
O as Q,
|
|
358
|
-
s as R,
|
|
359
|
-
u as S,
|
|
360
|
-
y as T,
|
|
361
|
-
r as U,
|
|
362
|
-
w as V,
|
|
363
|
-
gt as W,
|
|
364
|
-
f as X,
|
|
365
|
-
lt as Y,
|
|
366
|
-
it as Z,
|
|
367
|
-
ct as _,
|
|
368
|
-
z as a,
|
|
369
|
-
U as b,
|
|
370
|
-
P as c,
|
|
371
|
-
L as d,
|
|
372
|
-
T as e,
|
|
373
|
-
X as f,
|
|
374
|
-
B as g,
|
|
375
|
-
c as h,
|
|
376
|
-
S as i,
|
|
377
|
-
x as j,
|
|
378
|
-
et as k,
|
|
379
|
-
nt as l,
|
|
380
|
-
rt as m,
|
|
381
|
-
st as n,
|
|
382
|
-
p as o,
|
|
383
|
-
N as p,
|
|
384
|
-
a as q,
|
|
385
|
-
i as r,
|
|
386
|
-
tt as s,
|
|
387
|
-
F as t,
|
|
388
|
-
mt as u,
|
|
389
|
-
e as v,
|
|
390
|
-
k as w,
|
|
391
|
-
l as x,
|
|
392
|
-
C as y,
|
|
393
|
-
M as z
|
|
394
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './useClickOutSide';
|
|
2
|
-
export * from './useCountdown';
|
|
3
|
-
export * from './useEventListener';
|
|
4
|
-
export * from './useGetElementSize';
|
|
5
|
-
export * from './useKeyPress';
|
|
6
|
-
export * from './useMouseClick';
|
|
7
|
-
export * from './useTheme';
|
|
8
|
-
export * from './useThemePro';
|