asterui 0.12.19 → 0.12.21
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/components/Code.d.ts +2 -0
- package/dist/components/CopyButton.d.ts +34 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +205 -203
- package/dist/index.js.map +1 -1
- package/dist/index10.js +91 -121
- package/dist/index10.js.map +1 -1
- package/dist/index100.js +5 -13
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +11 -43
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +44 -11
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +10 -12
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +14 -7
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +7 -12
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +11 -29
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +29 -16
- package/dist/index107.js.map +1 -1
- package/dist/index108.js +21 -0
- package/dist/index108.js.map +1 -0
- package/dist/index11.js +123 -30
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +28 -263
- package/dist/index12.js.map +1 -1
- package/dist/index13.js +257 -105
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +108 -153
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +154 -146
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +150 -5
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +5 -71
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +70 -24
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +23 -194
- package/dist/index19.js.map +1 -1
- package/dist/index20.js +188 -106
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +107 -177
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +181 -107
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +110 -19
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +17 -41
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +43 -32
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +30 -170
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +171 -40
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +41 -17
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +17 -33
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +33 -52
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +50 -61
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +60 -181
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +184 -18
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +15 -271
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +270 -1083
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +1086 -16
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +17 -17
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +15 -120
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +119 -37
- package/dist/index39.js.map +1 -1
- package/dist/index40.js +40 -398
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +390 -89
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +91 -253
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +249 -145
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +155 -15
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +15 -17
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +16 -136
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +134 -10
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +13 -35
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +35 -34
- package/dist/index49.js.map +1 -1
- package/dist/index50.js +34 -81
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +71 -166
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +167 -144
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +152 -11
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +10 -20
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +55 -12
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +14 -7
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +6 -333
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +334 -47
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +47 -122
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +120 -108
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +107 -167
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +167 -29
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +30 -120
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +116 -80
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +85 -19
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +19 -73
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +71 -54
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +56 -44
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +42 -49
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +50 -121
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +118 -102
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +105 -72
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +73 -67
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +66 -19
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +18 -55
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +55 -251
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +254 -22
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +22 -31
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +30 -93
- package/dist/index79.js.map +1 -1
- package/dist/index80.js +89 -324
- package/dist/index80.js.map +1 -1
- package/dist/index81.js +322 -73
- package/dist/index81.js.map +1 -1
- package/dist/index82.js +79 -39
- package/dist/index82.js.map +1 -1
- package/dist/index83.js +40 -23
- package/dist/index83.js.map +1 -1
- package/dist/index84.js +21 -93
- package/dist/index84.js.map +1 -1
- package/dist/index85.js +87 -148
- package/dist/index85.js.map +1 -1
- package/dist/index86.js +147 -152
- package/dist/index86.js.map +1 -1
- package/dist/index87.js +159 -63
- package/dist/index87.js.map +1 -1
- package/dist/index88.js +65 -35
- package/dist/index88.js.map +1 -1
- package/dist/index89.js +35 -234
- package/dist/index89.js.map +1 -1
- package/dist/index90.js +231 -31
- package/dist/index90.js.map +1 -1
- package/dist/index91.js +34 -210
- package/dist/index91.js.map +1 -1
- package/dist/index92.js +195 -198
- package/dist/index92.js.map +1 -1
- package/dist/index93.js +159 -241
- package/dist/index93.js.map +1 -1
- package/dist/index94.js +283 -166
- package/dist/index94.js.map +1 -1
- package/dist/index95.js +173 -253
- package/dist/index95.js.map +1 -1
- package/dist/index96.js +253 -121
- package/dist/index96.js.map +1 -1
- package/dist/index97.js +126 -14
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +12 -31
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +32 -5
- package/dist/index99.js.map +1 -1
- package/package.json +1 -1
package/dist/index96.js
CHANGED
|
@@ -1,129 +1,261 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
fontSize: r,
|
|
22
|
-
fontWeight: t?.fontWeight ?? 600,
|
|
23
|
-
fontStyle: t?.fontStyle ?? "normal",
|
|
24
|
-
fontFamily: t?.fontFamily ?? "sans-serif",
|
|
25
|
-
lineHeight: t?.lineHeight ?? r * 1.2
|
|
26
|
-
};
|
|
27
|
-
}, X = ({
|
|
28
|
-
children: t,
|
|
29
|
-
className: c = "",
|
|
30
|
-
style: r,
|
|
31
|
-
content: i,
|
|
32
|
-
image: d,
|
|
33
|
-
width: s = 120,
|
|
34
|
-
height: a = 64,
|
|
35
|
-
gap: g,
|
|
36
|
-
offset: m,
|
|
37
|
-
rotate: T = -22,
|
|
38
|
-
zIndex: W = 1e3,
|
|
39
|
-
font: S,
|
|
40
|
-
...A
|
|
1
|
+
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as U, useRef as x } from "react";
|
|
3
|
+
const K = ({
|
|
4
|
+
action: N,
|
|
5
|
+
accept: O,
|
|
6
|
+
multiple: A = !1,
|
|
7
|
+
maxCount: v,
|
|
8
|
+
maxSize: b,
|
|
9
|
+
listType: y = "text",
|
|
10
|
+
fileList: L,
|
|
11
|
+
defaultFileList: I = [],
|
|
12
|
+
beforeUpload: D,
|
|
13
|
+
onChange: m,
|
|
14
|
+
onRemove: F,
|
|
15
|
+
customRequest: k,
|
|
16
|
+
showUploadList: B = !0,
|
|
17
|
+
disabled: i = !1,
|
|
18
|
+
children: R,
|
|
19
|
+
className: T = "",
|
|
20
|
+
...W
|
|
41
21
|
}) => {
|
|
42
|
-
const [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
22
|
+
const [z, H] = U(I), [E, w] = U(!1), j = x(null), P = x(0), h = x(0), d = L !== void 0 ? L : z, S = () => (P.current += 1, `upload-${Date.now()}-${P.current}`), f = (e) => {
|
|
23
|
+
L === void 0 && H(e);
|
|
24
|
+
}, $ = (e) => {
|
|
25
|
+
const r = {
|
|
26
|
+
uid: S(),
|
|
27
|
+
name: e.name,
|
|
28
|
+
status: "uploading",
|
|
29
|
+
percent: 0,
|
|
30
|
+
originFileObj: e
|
|
31
|
+
}, n = [...d, r];
|
|
32
|
+
f(n), m?.({ file: r, fileList: n });
|
|
33
|
+
const l = (o) => {
|
|
34
|
+
const s = n.map(
|
|
35
|
+
(a) => a.uid === r.uid ? { ...a, percent: o } : a
|
|
36
|
+
);
|
|
37
|
+
f(s), m?.({ file: { ...r, percent: o }, fileList: s });
|
|
38
|
+
}, u = (o) => {
|
|
39
|
+
const s = {
|
|
40
|
+
...r,
|
|
41
|
+
status: "done",
|
|
42
|
+
percent: 100,
|
|
43
|
+
response: o
|
|
44
|
+
}, a = n.map(
|
|
45
|
+
(c) => c.uid === r.uid ? s : c
|
|
46
|
+
);
|
|
47
|
+
f(a), m?.({ file: s, fileList: a });
|
|
48
|
+
}, g = (o) => {
|
|
49
|
+
const s = {
|
|
50
|
+
...r,
|
|
51
|
+
status: "error",
|
|
52
|
+
error: o
|
|
53
|
+
}, a = n.map(
|
|
54
|
+
(c) => c.uid === r.uid ? s : c
|
|
55
|
+
);
|
|
56
|
+
f(a), m?.({ file: s, fileList: a });
|
|
65
57
|
};
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
58
|
+
if (k)
|
|
59
|
+
k({
|
|
60
|
+
file: e,
|
|
61
|
+
onProgress: l,
|
|
62
|
+
onSuccess: u,
|
|
63
|
+
onError: g
|
|
64
|
+
});
|
|
65
|
+
else if (N) {
|
|
66
|
+
const o = new FormData();
|
|
67
|
+
o.append("file", e);
|
|
68
|
+
const s = new XMLHttpRequest();
|
|
69
|
+
s.upload.addEventListener("progress", (a) => {
|
|
70
|
+
if (a.lengthComputable) {
|
|
71
|
+
const c = Math.round(a.loaded / a.total * 100);
|
|
72
|
+
l(c);
|
|
73
|
+
}
|
|
74
|
+
}), s.addEventListener("load", () => {
|
|
75
|
+
s.status >= 200 && s.status < 300 ? u(s.response) : g(new Error(`Upload failed with status ${s.status}`));
|
|
76
|
+
}), s.addEventListener("error", () => {
|
|
77
|
+
g(new Error("Upload failed"));
|
|
78
|
+
}), s.open("POST", N), s.send(o);
|
|
83
79
|
} else
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
f,
|
|
92
|
-
a,
|
|
93
|
-
d,
|
|
94
|
-
h,
|
|
95
|
-
I,
|
|
96
|
-
s
|
|
97
|
-
]);
|
|
98
|
-
const H = ["relative", c].filter(Boolean).join(" ");
|
|
99
|
-
return /* @__PURE__ */ z(
|
|
100
|
-
"div",
|
|
101
|
-
{
|
|
102
|
-
className: H,
|
|
103
|
-
style: { position: r?.position ?? "relative", ...r },
|
|
104
|
-
...A,
|
|
105
|
-
children: [
|
|
106
|
-
t,
|
|
107
|
-
y && /* @__PURE__ */ R(
|
|
108
|
-
"div",
|
|
109
|
-
{
|
|
110
|
-
"aria-hidden": !0,
|
|
111
|
-
className: "pointer-events-none absolute inset-0",
|
|
112
|
-
style: {
|
|
113
|
-
zIndex: W,
|
|
114
|
-
backgroundImage: `url(${y.url})`,
|
|
115
|
-
backgroundRepeat: "repeat",
|
|
116
|
-
backgroundSize: `${y.width}px ${y.height}px`,
|
|
117
|
-
backgroundPosition: `${B}px ${F}px`
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
]
|
|
80
|
+
u(null);
|
|
81
|
+
}, C = async (e) => {
|
|
82
|
+
if (i) return;
|
|
83
|
+
const r = Array.from(e);
|
|
84
|
+
if (v && d.length + r.length > v) {
|
|
85
|
+
console.warn(`Cannot upload more than ${v} files`);
|
|
86
|
+
return;
|
|
122
87
|
}
|
|
123
|
-
|
|
88
|
+
if (b) {
|
|
89
|
+
const n = r.filter((l) => l.size > b);
|
|
90
|
+
if (n.length > 0) {
|
|
91
|
+
console.warn(
|
|
92
|
+
`Files exceed maximum size of ${b} bytes:`,
|
|
93
|
+
n.map((l) => l.name)
|
|
94
|
+
);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (D) {
|
|
99
|
+
const n = await Promise.all(
|
|
100
|
+
r.map((u) => D(u, r))
|
|
101
|
+
);
|
|
102
|
+
r.filter((u, g) => n[g] !== !1).forEach($);
|
|
103
|
+
} else
|
|
104
|
+
r.forEach($);
|
|
105
|
+
}, X = (e) => {
|
|
106
|
+
e.target.files && C(e.target.files), e.target.value = "";
|
|
107
|
+
}, _ = (e) => {
|
|
108
|
+
e.preventDefault(), e.stopPropagation(), i || (h.current++, w(!0));
|
|
109
|
+
}, q = (e) => {
|
|
110
|
+
e.preventDefault(), e.stopPropagation(), i || (h.current--, h.current === 0 && w(!1));
|
|
111
|
+
}, G = (e) => {
|
|
112
|
+
e.preventDefault(), e.stopPropagation();
|
|
113
|
+
}, J = (e) => {
|
|
114
|
+
e.preventDefault(), e.stopPropagation(), h.current = 0, w(!1), !i && e.dataTransfer.files && C(e.dataTransfer.files);
|
|
115
|
+
}, M = async (e) => {
|
|
116
|
+
if (F && await F(e) === !1)
|
|
117
|
+
return;
|
|
118
|
+
const r = d.filter((n) => n.uid !== e.uid);
|
|
119
|
+
f(r), m?.({ file: e, fileList: r });
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ p("div", { className: T, "data-state": E ? "dragging" : "idle", ...W, children: [
|
|
122
|
+
/* @__PURE__ */ t(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
onDragEnter: _,
|
|
126
|
+
onDragOver: G,
|
|
127
|
+
onDragLeave: q,
|
|
128
|
+
onDrop: J,
|
|
129
|
+
onClick: () => !i && j.current?.click(),
|
|
130
|
+
className: `
|
|
131
|
+
border-2 border-dashed rounded-lg p-4 cursor-pointer transition-colors
|
|
132
|
+
${E ? "border-primary bg-primary/5" : "border-base-content/20"}
|
|
133
|
+
${i ? "opacity-50 cursor-not-allowed" : "hover:border-primary"}
|
|
134
|
+
`,
|
|
135
|
+
children: R || /* @__PURE__ */ p("div", { className: "flex flex-col items-center gap-2 py-4", children: [
|
|
136
|
+
/* @__PURE__ */ t(
|
|
137
|
+
"svg",
|
|
138
|
+
{
|
|
139
|
+
className: "w-12 h-12 text-base-content/40",
|
|
140
|
+
fill: "none",
|
|
141
|
+
viewBox: "0 0 24 24",
|
|
142
|
+
stroke: "currentColor",
|
|
143
|
+
children: /* @__PURE__ */ t(
|
|
144
|
+
"path",
|
|
145
|
+
{
|
|
146
|
+
strokeLinecap: "round",
|
|
147
|
+
strokeLinejoin: "round",
|
|
148
|
+
strokeWidth: 2,
|
|
149
|
+
d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ p("div", { className: "text-sm text-center", children: [
|
|
155
|
+
/* @__PURE__ */ t("span", { className: "font-semibold text-primary", children: "Click to upload" }),
|
|
156
|
+
/* @__PURE__ */ t("span", { className: "text-base-content/60", children: " or drag and drop" })
|
|
157
|
+
] })
|
|
158
|
+
] })
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ t(
|
|
162
|
+
"input",
|
|
163
|
+
{
|
|
164
|
+
ref: j,
|
|
165
|
+
type: "file",
|
|
166
|
+
accept: O,
|
|
167
|
+
multiple: A,
|
|
168
|
+
onChange: X,
|
|
169
|
+
disabled: i,
|
|
170
|
+
className: "hidden"
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
!B || d.length === 0 ? null : y === "picture-card" ? /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2 mt-2", children: d.map((e) => /* @__PURE__ */ p(
|
|
174
|
+
"div",
|
|
175
|
+
{
|
|
176
|
+
className: "relative w-24 h-24 border border-base-content/20 rounded-lg overflow-hidden",
|
|
177
|
+
children: [
|
|
178
|
+
e.status === "uploading" && /* @__PURE__ */ t("div", { className: "absolute inset-0 bg-base-300/80 flex items-center justify-center", children: /* @__PURE__ */ t("span", { className: "loading loading-spinner loading-sm" }) }),
|
|
179
|
+
e.status === "done" && e.url && /* @__PURE__ */ t(
|
|
180
|
+
"img",
|
|
181
|
+
{
|
|
182
|
+
src: e.url,
|
|
183
|
+
alt: e.name,
|
|
184
|
+
className: "w-full h-full object-cover"
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
e.status === "error" && /* @__PURE__ */ t("div", { className: "absolute inset-0 bg-error/10 flex items-center justify-center", children: /* @__PURE__ */ t(
|
|
188
|
+
"svg",
|
|
189
|
+
{
|
|
190
|
+
className: "w-8 h-8 text-error",
|
|
191
|
+
fill: "none",
|
|
192
|
+
viewBox: "0 0 24 24",
|
|
193
|
+
stroke: "currentColor",
|
|
194
|
+
children: /* @__PURE__ */ t(
|
|
195
|
+
"path",
|
|
196
|
+
{
|
|
197
|
+
strokeLinecap: "round",
|
|
198
|
+
strokeLinejoin: "round",
|
|
199
|
+
strokeWidth: 2,
|
|
200
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
) }),
|
|
205
|
+
/* @__PURE__ */ t(
|
|
206
|
+
"button",
|
|
207
|
+
{
|
|
208
|
+
onClick: () => M(e),
|
|
209
|
+
className: "absolute top-1 right-1 btn btn-xs btn-circle btn-error",
|
|
210
|
+
type: "button",
|
|
211
|
+
children: "✕"
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
]
|
|
215
|
+
},
|
|
216
|
+
e.uid
|
|
217
|
+
)) }) : /* @__PURE__ */ t("div", { className: "mt-2 space-y-2", children: d.map((e) => /* @__PURE__ */ p(
|
|
218
|
+
"div",
|
|
219
|
+
{
|
|
220
|
+
className: "flex items-center gap-2 p-2 border border-base-content/10 rounded-lg",
|
|
221
|
+
children: [
|
|
222
|
+
y === "picture" && e.url && /* @__PURE__ */ t(
|
|
223
|
+
"img",
|
|
224
|
+
{
|
|
225
|
+
src: e.url,
|
|
226
|
+
alt: e.name,
|
|
227
|
+
className: "w-12 h-12 object-cover rounded"
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ p("div", { className: "flex-1 min-w-0", children: [
|
|
231
|
+
/* @__PURE__ */ t("div", { className: "truncate text-sm", children: e.name }),
|
|
232
|
+
e.status === "uploading" && e.percent !== void 0 && /* @__PURE__ */ t("div", { className: "w-full bg-base-200 rounded-full h-1.5 mt-1", children: /* @__PURE__ */ t(
|
|
233
|
+
"div",
|
|
234
|
+
{
|
|
235
|
+
className: "bg-primary h-1.5 rounded-full transition-all",
|
|
236
|
+
style: { width: `${e.percent}%` }
|
|
237
|
+
}
|
|
238
|
+
) }),
|
|
239
|
+
e.status === "error" && /* @__PURE__ */ t("div", { className: "text-xs text-error mt-1", children: "Upload failed" })
|
|
240
|
+
] }),
|
|
241
|
+
/* @__PURE__ */ t(
|
|
242
|
+
"button",
|
|
243
|
+
{
|
|
244
|
+
onClick: () => M(e),
|
|
245
|
+
className: "btn btn-xs btn-ghost btn-circle",
|
|
246
|
+
type: "button",
|
|
247
|
+
children: "✕"
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
e.uid
|
|
253
|
+
)) })
|
|
254
|
+
] });
|
|
124
255
|
};
|
|
125
|
-
|
|
256
|
+
K.displayName = "Upload";
|
|
126
257
|
export {
|
|
127
|
-
|
|
258
|
+
K as Upload,
|
|
259
|
+
K as default
|
|
128
260
|
};
|
|
129
261
|
//# sourceMappingURL=index96.js.map
|
package/dist/index96.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index96.js","sources":["../src/components/Watermark.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react'\n\nexport type WatermarkGap = [number, number]\nexport type WatermarkOffset = [number, number]\n\nexport interface WatermarkFontOptions {\n /** Text color for watermark content */\n color?: string\n /** Font size in pixels */\n fontSize?: number\n /** Font weight for watermark text */\n fontWeight?: number | 'normal' | 'bold' | 'bolder' | 'lighter'\n /** Font style for watermark text */\n fontStyle?: 'normal' | 'italic' | 'oblique'\n /** Font family for watermark text */\n fontFamily?: string\n /** Line height in pixels for multi-line content */\n lineHeight?: number\n}\n\nexport interface WatermarkProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {\n /** Text to render inside the watermark; falls back to \"asterui\" */\n content?: string | string[]\n /** Image source (URL or base64) to render instead of text */\n image?: string\n /** Width of a single watermark tile in pixels */\n width?: number\n /** Height of a single watermark tile in pixels */\n height?: number\n /** Horizontal/vertical gap between watermarks in pixels */\n gap?: WatermarkGap\n /** Offset for the first watermark tile from the top-left corner */\n offset?: WatermarkOffset\n /** Rotation angle in degrees */\n rotate?: number\n /** z-index for the overlay layer */\n zIndex?: number\n /** Font settings for text watermarks */\n font?: WatermarkFontOptions\n /** Content to protect with the watermark */\n children?: React.ReactNode\n}\n\ntype WatermarkImage = {\n url: string\n width: number\n height: number\n}\n\nconst DEFAULT_CONTENT = 'asterui'\nconst DEFAULT_OPACITY = 0.22\n\nconst resolveThemeColor = (requested?: string, opacity = DEFAULT_OPACITY) => {\n const fallback = `rgba(0,0,0,${opacity})`\n\n if (requested && requested.includes('var(--bc')) {\n if (typeof window !== 'undefined') {\n const docBase = getComputedStyle(document.documentElement).getPropertyValue('--bc').trim()\n const bodyBase = getComputedStyle(document.body).getPropertyValue('--bc').trim()\n const base = docBase || bodyBase\n if (base) {\n return requested.replace(/var\\(--bc\\)/g, base)\n }\n }\n return fallback\n }\n\n if (requested) return requested\n\n if (typeof window === 'undefined') return fallback\n\n const docBase = getComputedStyle(document.documentElement).getPropertyValue('--bc').trim()\n const bodyBase = getComputedStyle(document.body).getPropertyValue('--bc').trim()\n const base = docBase || bodyBase\n\n return base ? `hsl(${base} / ${opacity})` : fallback\n}\n\nconst getFontSettings = (font: WatermarkFontOptions | undefined, resolvedColor: string) => {\n const fontSize = font?.fontSize ?? 16\n\n return {\n color: resolvedColor,\n fontSize,\n fontWeight: font?.fontWeight ?? 600,\n fontStyle: font?.fontStyle ?? 'normal',\n fontFamily: font?.fontFamily ?? 'sans-serif',\n lineHeight: font?.lineHeight ?? fontSize * 1.2,\n }\n}\n\nexport const Watermark: React.FC<WatermarkProps> = ({\n children,\n className = '',\n style,\n content,\n image,\n width = 120,\n height = 64,\n gap,\n offset,\n rotate = -22,\n zIndex = 1000,\n font,\n ...rest\n}) => {\n const [watermark, setWatermark] = useState<WatermarkImage | null>(null)\n\n const gapX = gap?.[0] ?? 120\n const gapY = gap?.[1] ?? 120\n const offsetX = offset?.[0] ?? gapX / 2\n const offsetY = offset?.[1] ?? gapY / 2\n const textLines = useMemo(\n () =>\n typeof content === 'string'\n ? [content]\n : Array.isArray(content)\n ? content\n : [DEFAULT_CONTENT],\n [content]\n )\n const resolvedColor = resolveThemeColor(font?.color)\n const fontSettings = useMemo(\n () => getFontSettings(font, resolvedColor),\n [font, resolvedColor]\n )\n const rotationInRadians = (Math.PI / 180) * rotate\n const textKey = textLines.join('|')\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n let cancelled = false\n const ratio = window.devicePixelRatio || 1\n const tileWidth = width + gapX\n const tileHeight = height + gapY\n const canvas = document.createElement('canvas')\n canvas.width = tileWidth * ratio\n canvas.height = tileHeight * ratio\n const ctx = canvas.getContext('2d')\n\n if (!ctx) return\n\n const commitWatermark = () => {\n const url = canvas.toDataURL()\n if (!cancelled) {\n setWatermark({ url, width: tileWidth, height: tileHeight })\n }\n }\n\n const drawText = () => {\n ctx.save()\n ctx.translate((gapX / 2 + width / 2) * ratio, (gapY / 2 + height / 2) * ratio)\n ctx.rotate(rotationInRadians)\n ctx.fillStyle = fontSettings.color\n ctx.textAlign = 'center'\n ctx.textBaseline = 'middle'\n ctx.font = `${fontSettings.fontStyle} normal ${fontSettings.fontWeight} ${fontSettings.fontSize * ratio}px ${fontSettings.fontFamily}`\n\n const lineHeight = fontSettings.lineHeight * ratio\n const startY = -((textLines.length - 1) * lineHeight) / 2\n\n textLines.forEach((line, index) => {\n ctx.fillText(line, 0, startY + index * lineHeight)\n })\n\n ctx.restore()\n }\n\n if (image) {\n const img = new Image()\n img.crossOrigin = 'anonymous'\n img.referrerPolicy = 'no-referrer'\n\n const handleLoad = () => {\n ctx.save()\n ctx.translate((gapX / 2 + width / 2) * ratio, (gapY / 2 + height / 2) * ratio)\n ctx.rotate(rotationInRadians)\n ctx.drawImage(\n img,\n (-width / 2) * ratio,\n (-height / 2) * ratio,\n width * ratio,\n height * ratio\n )\n ctx.restore()\n commitWatermark()\n }\n\n const handleError = () => {\n if (!cancelled) setWatermark(null)\n }\n\n img.addEventListener('load', handleLoad)\n img.addEventListener('error', handleError)\n img.src = image\n\n return () => {\n cancelled = true\n img.removeEventListener('load', handleLoad)\n img.removeEventListener('error', handleError)\n }\n } else {\n drawText()\n commitWatermark()\n }\n\n return () => {\n cancelled = true\n }\n }, [\n fontSettings,\n gapX,\n gapY,\n height,\n image,\n rotationInRadians,\n textKey,\n width,\n ])\n\n const classes = ['relative', className].filter(Boolean).join(' ')\n\n return (\n <div\n className={classes}\n style={{ position: style?.position ?? 'relative', ...style }}\n {...rest}\n >\n {children}\n {watermark && (\n <div\n aria-hidden\n className=\"pointer-events-none absolute inset-0\"\n style={{\n zIndex,\n backgroundImage: `url(${watermark.url})`,\n backgroundRepeat: 'repeat',\n backgroundSize: `${watermark.width}px ${watermark.height}px`,\n backgroundPosition: `${offsetX}px ${offsetY}px`,\n }}\n />\n )}\n </div>\n )\n}\n\nWatermark.displayName = 'Watermark'\n"],"names":["DEFAULT_CONTENT","DEFAULT_OPACITY","resolveThemeColor","requested","opacity","fallback","docBase","bodyBase","base","getFontSettings","font","resolvedColor","fontSize","Watermark","children","className","style","content","image","width","height","gap","offset","rotate","zIndex","rest","watermark","setWatermark","useState","gapX","gapY","offsetX","offsetY","textLines","useMemo","fontSettings","rotationInRadians","textKey","useEffect","cancelled","ratio","tileWidth","tileHeight","canvas","ctx","commitWatermark","url","drawText","lineHeight","startY","line","index","img","handleLoad","handleError","classes","jsxs","jsx"],"mappings":";;AAkDA,MAAMA,IAAkB,WAClBC,IAAkB,MAElBC,IAAoB,CAACC,GAAoBC,IAAUH,MAAoB;AAC3E,QAAMI,IAAW,cAAcD,CAAO;AAEtC,MAAID,KAAaA,EAAU,SAAS,UAAU,GAAG;AAC/C,QAAI,OAAO,SAAW,KAAa;AACjC,YAAMG,IAAU,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,MAAM,EAAE,KAAA,GAC9EC,IAAW,iBAAiB,SAAS,IAAI,EAAE,iBAAiB,MAAM,EAAE,KAAA,GACpEC,IAAOF,KAAWC;AACxB,UAAIC;AACF,eAAOL,EAAU,QAAQ,gBAAgBK,CAAI;AAAA,IAEjD;AACA,WAAOH;AAAA,EACT;AAEA,MAAIF,EAAW,QAAOA;AAEtB,MAAI,OAAO,SAAW,IAAa,QAAOE;AAE1C,QAAMC,IAAU,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,MAAM,EAAE,KAAA,GAC9EC,IAAW,iBAAiB,SAAS,IAAI,EAAE,iBAAiB,MAAM,EAAE,KAAA,GACpEC,IAAOF,KAAWC;AAExB,SAAOC,IAAO,OAAOA,CAAI,MAAMJ,CAAO,MAAMC;AAC9C,GAEMI,IAAkB,CAACC,GAAwCC,MAA0B;AACzF,QAAMC,IAAWF,GAAM,YAAY;AAEnC,SAAO;AAAA,IACL,OAAOC;AAAA,IACP,UAAAC;AAAA,IACA,YAAYF,GAAM,cAAc;AAAA,IAChC,WAAWA,GAAM,aAAa;AAAA,IAC9B,YAAYA,GAAM,cAAc;AAAA,IAChC,YAAYA,GAAM,cAAcE,IAAW;AAAA,EAAA;AAE/C,GAEaC,IAAsC,CAAC;AAAA,EAClD,UAAAC;AAAA,EACA,WAA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ACX,QAAAqB,IAAY,IACZa,EAAI,oBAAoB,QAAQC,CAAU,GAC1CD,EAAI,oBAAoB,SAASE,CAAW;AAAA,MAC9C;AAAA,IACF;AACE,MAAAP,EAAA,GACAF,EAAA;AAGF,WAAO,MAAM;AACX,MAAAN,IAAY;AAAA,IACd;AAAA,EACF,GAAG;AAAA,IACDJ;AAAA,IACAN;AAAA,IACAC;AAAA,IACAV;AAAA,IACAF;AAAA,IACAkB;AAAA,IACAC;AAAA,IACAlB;AAAA,EAAA,CACD;AAED,QAAMoC,IAAU,CAAC,YAAYxC,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAEhE,SACE,gBAAAyC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWD;AAAA,MACX,OAAO,EAAE,UAAUvC,GAAO,YAAY,YAAY,GAAGA,EAAA;AAAA,MACpD,GAAGS;AAAA,MAEH,UAAA;AAAA,QAAAX;AAAA,QACAY,KACC,gBAAA+B;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,eAAW;AAAA,YACX,WAAU;AAAA,YACV,OAAO;AAAA,cACL,QAAAjC;AAAA,cACA,iBAAiB,OAAOE,EAAU,GAAG;AAAA,cACrC,kBAAkB;AAAA,cAClB,gBAAgB,GAAGA,EAAU,KAAK,MAAMA,EAAU,MAAM;AAAA,cACxD,oBAAoB,GAAGK,CAAO,MAAMC,CAAO;AAAA,YAAA;AAAA,UAC7C;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAIR;AAEAnB,EAAU,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index96.js","sources":["../src/components/Upload.tsx"],"sourcesContent":["import React, { useState, useRef, DragEvent, ChangeEvent } from 'react'\n\nexport interface UploadFile {\n uid: string\n name: string\n status: 'uploading' | 'done' | 'error'\n percent?: number\n url?: string\n response?: any\n error?: any\n originFileObj?: File\n}\n\nexport interface UploadProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n action?: string\n accept?: string\n multiple?: boolean\n maxCount?: number\n maxSize?: number // in bytes\n listType?: 'text' | 'picture' | 'picture-card'\n fileList?: UploadFile[]\n defaultFileList?: UploadFile[]\n beforeUpload?: (file: File, fileList: File[]) => boolean | Promise<boolean>\n onChange?: (info: { file: UploadFile; fileList: UploadFile[] }) => void\n onRemove?: (file: UploadFile) => void | boolean | Promise<void | boolean>\n customRequest?: (options: {\n file: File\n onProgress: (percent: number) => void\n onSuccess: (response: any) => void\n onError: (error: any) => void\n }) => void\n showUploadList?: boolean\n disabled?: boolean\n children?: React.ReactNode\n}\n\nexport const Upload: React.FC<UploadProps> = ({\n action,\n accept,\n multiple = false,\n maxCount,\n maxSize,\n listType = 'text',\n fileList: controlledFileList,\n defaultFileList = [],\n beforeUpload,\n onChange,\n onRemove,\n customRequest,\n showUploadList = true,\n disabled = false,\n children,\n className = '',\n ...rest\n}) => {\n const [internalFileList, setInternalFileList] = useState<UploadFile[]>(defaultFileList)\n const [isDragging, setIsDragging] = useState(false)\n const fileInputRef = useRef<HTMLInputElement>(null)\n const uidCounter = useRef(0)\n const dragCounter = useRef(0)\n\n const fileList = controlledFileList !== undefined ? controlledFileList : internalFileList\n\n const generateUid = () => {\n uidCounter.current += 1\n return `upload-${Date.now()}-${uidCounter.current}`\n }\n\n const updateFileList = (newFileList: UploadFile[]) => {\n if (controlledFileList === undefined) {\n setInternalFileList(newFileList)\n }\n }\n\n const uploadFile = (file: File) => {\n const uploadFile: UploadFile = {\n uid: generateUid(),\n name: file.name,\n status: 'uploading',\n percent: 0,\n originFileObj: file,\n }\n\n const newFileList = [...fileList, uploadFile]\n updateFileList(newFileList)\n onChange?.({ file: uploadFile, fileList: newFileList })\n\n const updateProgress = (percent: number) => {\n const updatedList = newFileList.map((f) =>\n f.uid === uploadFile.uid ? { ...f, percent } : f\n )\n updateFileList(updatedList)\n onChange?.({ file: { ...uploadFile, percent }, fileList: updatedList })\n }\n\n const onSuccess = (response: any) => {\n const successFile = {\n ...uploadFile,\n status: 'done' as const,\n percent: 100,\n response,\n }\n const updatedList = newFileList.map((f) =>\n f.uid === uploadFile.uid ? successFile : f\n )\n updateFileList(updatedList)\n onChange?.({ file: successFile, fileList: updatedList })\n }\n\n const onError = (error: any) => {\n const errorFile = {\n ...uploadFile,\n status: 'error' as const,\n error,\n }\n const updatedList = newFileList.map((f) =>\n f.uid === uploadFile.uid ? errorFile : f\n )\n updateFileList(updatedList)\n onChange?.({ file: errorFile, fileList: updatedList })\n }\n\n if (customRequest) {\n customRequest({\n file,\n onProgress: updateProgress,\n onSuccess,\n onError,\n })\n } else if (action) {\n const formData = new FormData()\n formData.append('file', file)\n\n const xhr = new XMLHttpRequest()\n\n xhr.upload.addEventListener('progress', (e) => {\n if (e.lengthComputable) {\n const percent = Math.round((e.loaded / e.total) * 100)\n updateProgress(percent)\n }\n })\n\n xhr.addEventListener('load', () => {\n if (xhr.status >= 200 && xhr.status < 300) {\n onSuccess(xhr.response)\n } else {\n onError(new Error(`Upload failed with status ${xhr.status}`))\n }\n })\n\n xhr.addEventListener('error', () => {\n onError(new Error('Upload failed'))\n })\n\n xhr.open('POST', action)\n xhr.send(formData)\n } else {\n // No upload action, just mark as done\n onSuccess(null)\n }\n }\n\n const handleFiles = async (files: FileList | File[]) => {\n if (disabled) return\n\n const fileArray = Array.from(files)\n\n // Check maxCount\n if (maxCount && fileList.length + fileArray.length > maxCount) {\n console.warn(`Cannot upload more than ${maxCount} files`)\n return\n }\n\n // Check maxSize\n if (maxSize) {\n const oversizedFiles = fileArray.filter((file) => file.size > maxSize)\n if (oversizedFiles.length > 0) {\n console.warn(\n `Files exceed maximum size of ${maxSize} bytes:`,\n oversizedFiles.map((f) => f.name)\n )\n return\n }\n }\n\n // beforeUpload hook\n if (beforeUpload) {\n const results = await Promise.all(\n fileArray.map((file) => beforeUpload(file, fileArray))\n )\n const filteredFiles = fileArray.filter((_, index) => results[index] !== false)\n filteredFiles.forEach(uploadFile)\n } else {\n fileArray.forEach(uploadFile)\n }\n }\n\n const handleChange = (e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n handleFiles(e.target.files)\n }\n // Reset input value to allow uploading the same file again\n e.target.value = ''\n }\n\n const handleDragEnter = (e: DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n if (!disabled) {\n dragCounter.current++\n setIsDragging(true)\n }\n }\n\n const handleDragLeave = (e: DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n if (!disabled) {\n dragCounter.current--\n if (dragCounter.current === 0) {\n setIsDragging(false)\n }\n }\n }\n\n const handleDragOver = (e: DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n }\n\n const handleDrop = (e: DragEvent) => {\n e.preventDefault()\n e.stopPropagation()\n dragCounter.current = 0\n setIsDragging(false)\n\n if (disabled) return\n\n if (e.dataTransfer.files) {\n handleFiles(e.dataTransfer.files)\n }\n }\n\n const handleRemove = async (file: UploadFile) => {\n if (onRemove) {\n const result = await onRemove(file)\n if (result === false) return\n }\n\n const newFileList = fileList.filter((f) => f.uid !== file.uid)\n updateFileList(newFileList)\n onChange?.({ file, fileList: newFileList })\n }\n\n const renderFileList = () => {\n if (!showUploadList || fileList.length === 0) return null\n\n if (listType === 'picture-card') {\n return (\n <div className=\"flex flex-wrap gap-2 mt-2\">\n {fileList.map((file) => (\n <div\n key={file.uid}\n className=\"relative w-24 h-24 border border-base-content/20 rounded-lg overflow-hidden\"\n >\n {file.status === 'uploading' && (\n <div className=\"absolute inset-0 bg-base-300/80 flex items-center justify-center\">\n <span className=\"loading loading-spinner loading-sm\"></span>\n </div>\n )}\n {file.status === 'done' && file.url && (\n <img\n src={file.url}\n alt={file.name}\n className=\"w-full h-full object-cover\"\n />\n )}\n {file.status === 'error' && (\n <div className=\"absolute inset-0 bg-error/10 flex items-center justify-center\">\n <svg\n className=\"w-8 h-8 text-error\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </div>\n )}\n <button\n onClick={() => handleRemove(file)}\n className=\"absolute top-1 right-1 btn btn-xs btn-circle btn-error\"\n type=\"button\"\n >\n ✕\n </button>\n </div>\n ))}\n </div>\n )\n }\n\n return (\n <div className=\"mt-2 space-y-2\">\n {fileList.map((file) => (\n <div\n key={file.uid}\n className=\"flex items-center gap-2 p-2 border border-base-content/10 rounded-lg\"\n >\n {listType === 'picture' && file.url && (\n <img\n src={file.url}\n alt={file.name}\n className=\"w-12 h-12 object-cover rounded\"\n />\n )}\n <div className=\"flex-1 min-w-0\">\n <div className=\"truncate text-sm\">{file.name}</div>\n {file.status === 'uploading' && file.percent !== undefined && (\n <div className=\"w-full bg-base-200 rounded-full h-1.5 mt-1\">\n <div\n className=\"bg-primary h-1.5 rounded-full transition-all\"\n style={{ width: `${file.percent}%` }}\n />\n </div>\n )}\n {file.status === 'error' && (\n <div className=\"text-xs text-error mt-1\">Upload failed</div>\n )}\n </div>\n <button\n onClick={() => handleRemove(file)}\n className=\"btn btn-xs btn-ghost btn-circle\"\n type=\"button\"\n >\n ✕\n </button>\n </div>\n ))}\n </div>\n )\n }\n\n return (\n <div className={className} data-state={isDragging ? 'dragging' : 'idle'} {...rest}>\n <div\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}\n onClick={() => !disabled && fileInputRef.current?.click()}\n className={`\n border-2 border-dashed rounded-lg p-4 cursor-pointer transition-colors\n ${isDragging ? 'border-primary bg-primary/5' : 'border-base-content/20'}\n ${disabled ? 'opacity-50 cursor-not-allowed' : 'hover:border-primary'}\n `}\n >\n {children || (\n <div className=\"flex flex-col items-center gap-2 py-4\">\n <svg\n className=\"w-12 h-12 text-base-content/40\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12\"\n />\n </svg>\n <div className=\"text-sm text-center\">\n <span className=\"font-semibold text-primary\">Click to upload</span>\n <span className=\"text-base-content/60\"> or drag and drop</span>\n </div>\n </div>\n )}\n </div>\n\n <input\n ref={fileInputRef}\n type=\"file\"\n accept={accept}\n multiple={multiple}\n onChange={handleChange}\n disabled={disabled}\n className=\"hidden\"\n />\n\n {renderFileList()}\n </div>\n )\n}\n\nUpload.displayName = 'Upload'\n\nexport default Upload\n"],"names":["Upload","action","accept","multiple","maxCount","maxSize","listType","controlledFileList","defaultFileList","beforeUpload","onChange","onRemove","customRequest","showUploadList","disabled","children","className","rest","internalFileList","setInternalFileList","useState","isDragging","setIsDragging","fileInputRef","useRef","uidCounter","dragCounter","fileList","generateUid","updateFileList","newFileList","uploadFile","file","updateProgress","percent","updatedList","f","onSuccess","response","successFile","onError","error","errorFile","formData","xhr","e","handleFiles","files","fileArray","oversizedFiles","results","_","index","handleChange","handleDragEnter","handleDragLeave","handleDragOver","handleDrop","handleRemove","jsxs","jsx"],"mappings":";;AAoCO,MAAMA,IAAgC,CAAC;AAAA,EAC5C,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAUC;AAAA,EACV,iBAAAC,IAAkB,CAAA;AAAA,EAClB,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,UAAAC,IAAW;AAAA,EACX,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAAuBZ,CAAe,GAChF,CAACa,GAAYC,CAAa,IAAIF,EAAS,EAAK,GAC5CG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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
1
|
+
import { jsxs as z, jsx as R } from "react/jsx-runtime";
|
|
2
|
+
import { useState as V, useMemo as P, useEffect as Y } from "react";
|
|
3
|
+
const D = "asterui", O = 0.22, U = (t, c = O) => {
|
|
4
|
+
const r = `rgba(0,0,0,${c})`;
|
|
5
|
+
if (t && t.includes("var(--bc")) {
|
|
6
|
+
if (typeof window < "u") {
|
|
7
|
+
const a = getComputedStyle(document.documentElement).getPropertyValue("--bc").trim(), g = getComputedStyle(document.body).getPropertyValue("--bc").trim(), m = a || g;
|
|
8
|
+
if (m)
|
|
9
|
+
return t.replace(/var\(--bc\)/g, m);
|
|
10
|
+
}
|
|
11
|
+
return r;
|
|
12
|
+
}
|
|
13
|
+
if (t) return t;
|
|
14
|
+
if (typeof window > "u") return r;
|
|
15
|
+
const i = getComputedStyle(document.documentElement).getPropertyValue("--bc").trim(), d = getComputedStyle(document.body).getPropertyValue("--bc").trim(), s = i || d;
|
|
16
|
+
return s ? `hsl(${s} / ${c})` : r;
|
|
17
|
+
}, M = (t, c) => {
|
|
18
|
+
const r = t?.fontSize ?? 16;
|
|
19
|
+
return {
|
|
20
|
+
color: c,
|
|
21
|
+
fontSize: r,
|
|
22
|
+
fontWeight: t?.fontWeight ?? 600,
|
|
23
|
+
fontStyle: t?.fontStyle ?? "normal",
|
|
24
|
+
fontFamily: t?.fontFamily ?? "sans-serif",
|
|
25
|
+
lineHeight: t?.lineHeight ?? r * 1.2
|
|
26
|
+
};
|
|
27
|
+
}, X = ({
|
|
28
|
+
children: t,
|
|
29
|
+
className: c = "",
|
|
30
|
+
style: r,
|
|
31
|
+
content: i,
|
|
32
|
+
image: d,
|
|
33
|
+
width: s = 120,
|
|
34
|
+
height: a = 64,
|
|
35
|
+
gap: g,
|
|
36
|
+
offset: m,
|
|
37
|
+
rotate: T = -22,
|
|
38
|
+
zIndex: W = 1e3,
|
|
39
|
+
font: S,
|
|
40
|
+
...A
|
|
41
|
+
}) => {
|
|
42
|
+
const [y, $] = V(null), u = g?.[0] ?? 120, f = g?.[1] ?? 120, B = m?.[0] ?? u / 2, F = m?.[1] ?? f / 2, E = P(
|
|
43
|
+
() => typeof i == "string" ? [i] : Array.isArray(i) ? i : [D],
|
|
44
|
+
[i]
|
|
45
|
+
), k = U(S?.color), l = P(
|
|
46
|
+
() => M(S, k),
|
|
47
|
+
[S, k]
|
|
48
|
+
), h = Math.PI / 180 * T, I = E.join("|");
|
|
49
|
+
Y(() => {
|
|
50
|
+
if (typeof window > "u") return;
|
|
51
|
+
let p = !1;
|
|
52
|
+
const n = window.devicePixelRatio || 1, w = s + u, C = a + f, v = document.createElement("canvas");
|
|
53
|
+
v.width = w * n, v.height = C * n;
|
|
54
|
+
const e = v.getContext("2d");
|
|
55
|
+
if (!e) return;
|
|
56
|
+
const L = () => {
|
|
57
|
+
const o = v.toDataURL();
|
|
58
|
+
p || $({ url: o, width: w, height: C });
|
|
59
|
+
}, N = () => {
|
|
60
|
+
e.save(), e.translate((u / 2 + s / 2) * n, (f / 2 + a / 2) * n), e.rotate(h), e.fillStyle = l.color, e.textAlign = "center", e.textBaseline = "middle", e.font = `${l.fontStyle} normal ${l.fontWeight} ${l.fontSize * n}px ${l.fontFamily}`;
|
|
61
|
+
const o = l.lineHeight * n, b = -((E.length - 1) * o) / 2;
|
|
62
|
+
E.forEach((x, j) => {
|
|
63
|
+
e.fillText(x, 0, b + j * o);
|
|
64
|
+
}), e.restore();
|
|
65
|
+
};
|
|
66
|
+
if (d) {
|
|
67
|
+
const o = new Image();
|
|
68
|
+
o.crossOrigin = "anonymous", o.referrerPolicy = "no-referrer";
|
|
69
|
+
const b = () => {
|
|
70
|
+
e.save(), e.translate((u / 2 + s / 2) * n, (f / 2 + a / 2) * n), e.rotate(h), e.drawImage(
|
|
71
|
+
o,
|
|
72
|
+
-s / 2 * n,
|
|
73
|
+
-a / 2 * n,
|
|
74
|
+
s * n,
|
|
75
|
+
a * n
|
|
76
|
+
), e.restore(), L();
|
|
77
|
+
}, x = () => {
|
|
78
|
+
p || $(null);
|
|
79
|
+
};
|
|
80
|
+
return o.addEventListener("load", b), o.addEventListener("error", x), o.src = d, () => {
|
|
81
|
+
p = !0, o.removeEventListener("load", b), o.removeEventListener("error", x);
|
|
82
|
+
};
|
|
83
|
+
} else
|
|
84
|
+
N(), L();
|
|
85
|
+
return () => {
|
|
86
|
+
p = !0;
|
|
87
|
+
};
|
|
88
|
+
}, [
|
|
89
|
+
l,
|
|
90
|
+
u,
|
|
91
|
+
f,
|
|
92
|
+
a,
|
|
93
|
+
d,
|
|
94
|
+
h,
|
|
95
|
+
I,
|
|
96
|
+
s
|
|
97
|
+
]);
|
|
98
|
+
const H = ["relative", c].filter(Boolean).join(" ");
|
|
99
|
+
return /* @__PURE__ */ z(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
className: H,
|
|
103
|
+
style: { position: r?.position ?? "relative", ...r },
|
|
104
|
+
...A,
|
|
105
|
+
children: [
|
|
106
|
+
t,
|
|
107
|
+
y && /* @__PURE__ */ R(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
"aria-hidden": !0,
|
|
111
|
+
className: "pointer-events-none absolute inset-0",
|
|
112
|
+
style: {
|
|
113
|
+
zIndex: W,
|
|
114
|
+
backgroundImage: `url(${y.url})`,
|
|
115
|
+
backgroundRepeat: "repeat",
|
|
116
|
+
backgroundSize: `${y.width}px ${y.height}px`,
|
|
117
|
+
backgroundPosition: `${B}px ${F}px`
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
X.displayName = "Watermark";
|
|
13
126
|
export {
|
|
14
|
-
|
|
15
|
-
h as Show
|
|
127
|
+
X as Watermark
|
|
16
128
|
};
|
|
17
129
|
//# sourceMappingURL=index97.js.map
|
package/dist/index97.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index97.js","sources":["../src/components/Responsive.tsx"],"sourcesContent":["import React, { ReactNode } from 'react'\nimport { useBreakpoint, Breakpoint } from '../hooks/useBreakpoint'\n\nexport interface ShowProps {\n children: ReactNode\n above?: Breakpoint\n below?: Breakpoint\n at?: Breakpoint | Breakpoint[]\n between?: [Breakpoint, Breakpoint]\n}\n\nexport function Show({ children, above, below, at, between }: ShowProps): React.ReactElement | null {\n const { isAbove, isBelow, isAt, isBetween } = useBreakpoint()\n\n let shouldShow = false\n\n if (above !== undefined) {\n shouldShow = isAbove(above)\n } else if (below !== undefined) {\n shouldShow = isBelow(below)\n } else if (at !== undefined) {\n if (Array.isArray(at)) {\n shouldShow = at.some((bp) => isAt(bp))\n } else {\n shouldShow = isAt(at)\n }\n } else if (between !== undefined) {\n shouldShow = isBetween(between[0], between[1])\n } else {\n shouldShow = true\n }\n\n return shouldShow ? <>{children}</> : null\n}\n\nexport interface HideProps {\n children: ReactNode\n above?: Breakpoint\n below?: Breakpoint\n at?: Breakpoint | Breakpoint[]\n between?: [Breakpoint, Breakpoint]\n}\n\nexport function Hide({ children, above, below, at, between }: HideProps): React.ReactElement | null {\n const { isAbove, isBelow, isAt, isBetween } = useBreakpoint()\n\n let shouldHide = false\n\n if (above !== undefined) {\n shouldHide = isAbove(above)\n } else if (below !== undefined) {\n shouldHide = isBelow(below)\n } else if (at !== undefined) {\n if (Array.isArray(at)) {\n shouldHide = at.some((bp) => isAt(bp))\n } else {\n shouldHide = isAt(at)\n }\n } else if (between !== undefined) {\n shouldHide = isBetween(between[0], between[1])\n }\n\n return shouldHide ? null : <>{children}</>\n}\n"],"names":["Show","children","above","below","at","between","isAbove","isBelow","isAt","isBetween","useBreakpoint","shouldShow","bp","jsx","Fragment","Hide","shouldHide"],"mappings":";;AAWO,SAASA,EAAK,EAAE,UAAAC,GAAU,OAAAC,GAAO,OAAAC,GAAO,IAAAC,GAAI,SAAAC,KAAiD;AAClG,QAAM,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAA;AAE9C,MAAIC,IAAa;AAEjB,SAAIT,MAAU,SACZS,IAAaL,EAAQJ,CAAK,IACjBC,MAAU,SACnBQ,IAAaJ,EAAQJ,CAAK,IACjBC,MAAO,SACZ,MAAM,QAAQA,CAAE,IAClBO,IAAaP,EAAG,KAAK,CAACQ,MAAOJ,EAAKI,CAAE,CAAC,IAErCD,IAAaH,EAAKJ,CAAE,IAEbC,MAAY,SACrBM,IAAaF,EAAUJ,EAAQ,CAAC,GAAGA,EAAQ,CAAC,CAAC,IAE7CM,IAAa,IAGRA,IAAa,gBAAAE,EAAAC,GAAA,EAAG,UAAAb,EAAA,CAAS,IAAM;AACxC;AAUO,SAASc,EAAK,EAAE,UAAAd,GAAU,OAAAC,GAAO,OAAAC,GAAO,IAAAC,GAAI,SAAAC,KAAiD;AAClG,QAAM,EAAE,SAAAC,GAAS,SAAAC,GAAS,MAAAC,GAAM,WAAAC,EAAA,IAAcC,EAAA;AAE9C,MAAIM,IAAa;AAEjB,SAAId,MAAU,SACZc,IAAaV,EAAQJ,CAAK,IACjBC,MAAU,SACnBa,IAAaT,EAAQJ,CAAK,IACjBC,MAAO,SACZ,MAAM,QAAQA,CAAE,IAClBY,IAAaZ,EAAG,KAAK,CAACQ,MAAOJ,EAAKI,CAAE,CAAC,IAErCI,IAAaR,EAAKJ,CAAE,IAEbC,MAAY,WACrBW,IAAaP,EAAUJ,EAAQ,CAAC,GAAGA,EAAQ,CAAC,CAAC,IAGxCW,IAAa,OAAO,gBAAAH,EAAAC,GAAA,EAAG,UAAAb,EAAA,CAAS;AACzC;"}
|
|
1
|
+
{"version":3,"file":"index97.js","sources":["../src/components/Watermark.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react'\n\nexport type WatermarkGap = [number, number]\nexport type WatermarkOffset = [number, number]\n\nexport interface WatermarkFontOptions {\n /** Text color for watermark content */\n color?: string\n /** Font size in pixels */\n fontSize?: number\n /** Font weight for watermark text */\n fontWeight?: number | 'normal' | 'bold' | 'bolder' | 'lighter'\n /** Font style for watermark text */\n fontStyle?: 'normal' | 'italic' | 'oblique'\n /** Font family for watermark text */\n fontFamily?: string\n /** Line height in pixels for multi-line content */\n lineHeight?: number\n}\n\nexport interface WatermarkProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {\n /** Text to render inside the watermark; falls back to \"asterui\" */\n content?: string | string[]\n /** Image source (URL or base64) to render instead of text */\n image?: string\n /** Width of a single watermark tile in pixels */\n width?: number\n /** Height of a single watermark tile in pixels */\n height?: number\n /** Horizontal/vertical gap between watermarks in pixels */\n gap?: WatermarkGap\n /** Offset for the first watermark tile from the top-left corner */\n offset?: WatermarkOffset\n /** Rotation angle in degrees */\n rotate?: number\n /** z-index for the overlay layer */\n zIndex?: number\n /** Font settings for text watermarks */\n font?: WatermarkFontOptions\n /** Content to protect with the watermark */\n children?: React.ReactNode\n}\n\ntype WatermarkImage = {\n url: string\n width: number\n height: number\n}\n\nconst DEFAULT_CONTENT = 'asterui'\nconst DEFAULT_OPACITY = 0.22\n\nconst resolveThemeColor = (requested?: string, opacity = DEFAULT_OPACITY) => {\n const fallback = `rgba(0,0,0,${opacity})`\n\n if (requested && requested.includes('var(--bc')) {\n if (typeof window !== 'undefined') {\n const docBase = getComputedStyle(document.documentElement).getPropertyValue('--bc').trim()\n const bodyBase = getComputedStyle(document.body).getPropertyValue('--bc').trim()\n const base = docBase || bodyBase\n if (base) {\n return requested.replace(/var\\(--bc\\)/g, base)\n }\n }\n return fallback\n }\n\n if (requested) return requested\n\n if (typeof window === 'undefined') return fallback\n\n const docBase = getComputedStyle(document.documentElement).getPropertyValue('--bc').trim()\n const bodyBase = getComputedStyle(document.body).getPropertyValue('--bc').trim()\n const base = docBase || bodyBase\n\n return base ? `hsl(${base} / ${opacity})` : fallback\n}\n\nconst getFontSettings = (font: WatermarkFontOptions | undefined, resolvedColor: string) => {\n const fontSize = font?.fontSize ?? 16\n\n return {\n color: resolvedColor,\n fontSize,\n fontWeight: font?.fontWeight ?? 600,\n fontStyle: font?.fontStyle ?? 'normal',\n fontFamily: font?.fontFamily ?? 'sans-serif',\n lineHeight: font?.lineHeight ?? fontSize * 1.2,\n }\n}\n\nexport const Watermark: React.FC<WatermarkProps> = ({\n children,\n className = '',\n style,\n content,\n image,\n width = 120,\n height = 64,\n gap,\n offset,\n rotate = -22,\n zIndex = 1000,\n font,\n ...rest\n}) => {\n const [watermark, setWatermark] = useState<WatermarkImage | null>(null)\n\n const gapX = gap?.[0] ?? 120\n const gapY = gap?.[1] ?? 120\n const offsetX = offset?.[0] ?? gapX / 2\n const offsetY = offset?.[1] ?? gapY / 2\n const textLines = useMemo(\n () =>\n typeof content === 'string'\n ? [content]\n : Array.isArray(content)\n ? content\n : [DEFAULT_CONTENT],\n [content]\n )\n const resolvedColor = resolveThemeColor(font?.color)\n const fontSettings = useMemo(\n () => getFontSettings(font, resolvedColor),\n [font, resolvedColor]\n )\n const rotationInRadians = (Math.PI / 180) * rotate\n const textKey = textLines.join('|')\n\n useEffect(() => {\n if (typeof window === 'undefined') return\n\n let cancelled = false\n const ratio = window.devicePixelRatio || 1\n const tileWidth = width + gapX\n const tileHeight = height + gapY\n const canvas = document.createElement('canvas')\n canvas.width = tileWidth * ratio\n canvas.height = tileHeight * ratio\n const ctx = canvas.getContext('2d')\n\n if (!ctx) return\n\n const commitWatermark = () => {\n const url = canvas.toDataURL()\n if (!cancelled) {\n setWatermark({ url, width: tileWidth, height: tileHeight })\n }\n }\n\n const drawText = () => {\n ctx.save()\n ctx.translate((gapX / 2 + width / 2) * ratio, (gapY / 2 + height / 2) * ratio)\n ctx.rotate(rotationInRadians)\n ctx.fillStyle = fontSettings.color\n ctx.textAlign = 'center'\n ctx.textBaseline = 'middle'\n ctx.font = `${fontSettings.fontStyle} normal ${fontSettings.fontWeight} ${fontSettings.fontSize * ratio}px ${fontSettings.fontFamily}`\n\n const lineHeight = fontSettings.lineHeight * ratio\n const startY = -((textLines.length - 1) * lineHeight) / 2\n\n textLines.forEach((line, index) => {\n ctx.fillText(line, 0, startY + index * lineHeight)\n })\n\n ctx.restore()\n }\n\n if (image) {\n const img = new Image()\n img.crossOrigin = 'anonymous'\n img.referrerPolicy = 'no-referrer'\n\n const handleLoad = () => {\n ctx.save()\n ctx.translate((gapX / 2 + width / 2) * ratio, (gapY / 2 + height / 2) * ratio)\n ctx.rotate(rotationInRadians)\n ctx.drawImage(\n img,\n (-width / 2) * ratio,\n (-height / 2) * ratio,\n width * ratio,\n height * ratio\n )\n ctx.restore()\n commitWatermark()\n }\n\n const handleError = () => {\n if (!cancelled) setWatermark(null)\n }\n\n img.addEventListener('load', handleLoad)\n img.addEventListener('error', handleError)\n img.src = image\n\n return () => {\n cancelled = true\n img.removeEventListener('load', handleLoad)\n img.removeEventListener('error', handleError)\n }\n } else {\n drawText()\n commitWatermark()\n }\n\n return () => {\n cancelled = true\n }\n }, [\n fontSettings,\n gapX,\n gapY,\n height,\n image,\n rotationInRadians,\n textKey,\n width,\n ])\n\n const classes = ['relative', className].filter(Boolean).join(' ')\n\n return (\n <div\n className={classes}\n style={{ position: style?.position ?? 'relative', ...style }}\n {...rest}\n >\n {children}\n {watermark && (\n <div\n aria-hidden\n className=\"pointer-events-none absolute inset-0\"\n style={{\n zIndex,\n backgroundImage: `url(${watermark.url})`,\n backgroundRepeat: 'repeat',\n backgroundSize: `${watermark.width}px ${watermark.height}px`,\n backgroundPosition: `${offsetX}px ${offsetY}px`,\n }}\n />\n )}\n </div>\n )\n}\n\nWatermark.displayName = 'Watermark'\n"],"names":["DEFAULT_CONTENT","DEFAULT_OPACITY","resolveThemeColor","requested","opacity","fallback","docBase","bodyBase","base","getFontSettings","font","resolvedColor","fontSize","Watermark","children","className","style","content","image","width","height","gap","offset","rotate","zIndex","rest","watermark","setWatermark","useState","gapX","gapY","offsetX","offsetY","textLines","useMemo","fontSettings","rotationInRadians","textKey","useEffect","cancelled","ratio","tileWidth","tileHeight","canvas","ctx","commitWatermark","url","drawText","lineHeight","startY","line","index","img","handleLoad","handleError","classes","jsxs","jsx"],"mappings":";;AAkDA,MAAMA,IAAkB,WAClBC,IAAkB,MAElBC,IAAoB,CAACC,GAAoBC,IAAUH,MAAoB;AAC3E,QAAMI,IAAW,cAAcD,CAAO;AAEtC,MAAID,KAAaA,EAAU,SAAS,UAAU,GAAG;AAC/C,QAAI,OAAO,SAAW,KAAa;AACjC,YAAMG,IAAU,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,MAAM,EAAE,KAAA,GAC9EC,IAAW,iBAAiB,SAAS,IAAI,EAAE,iBAAiB,MAAM,EAAE,KAAA,GACpEC,IAAOF,KAAWC;AACxB,UAAIC;AACF,eAAOL,EAAU,QAAQ,gBAAgBK,CAAI;AAAA,IAEjD;AACA,WAAOH;AAAA,EACT;AAEA,MAAIF,EAAW,QAAOA;AAEtB,MAAI,OAAO,SAAW,IAAa,QAAOE;AAE1C,QAAMC,IAAU,iBAAiB,SAAS,eAAe,EAAE,iBAAiB,MAAM,EAAE,KAAA,GAC9EC,IAAW,iBAAiB,SAAS,IAAI,EAAE,iBAAiB,MAAM,EAAE,KAAA,GACpEC,IAAOF,KAAWC;AAExB,SAAOC,IAAO,OAAOA,CAAI,MAAMJ,CAAO,MAAMC;AAC9C,GAEMI,IAAkB,CAACC,GAAwCC,MAA0B;AACzF,QAAMC,IAAWF,GAAM,YAAY;AAEnC,SAAO;AAAA,IACL,OAAOC;AAAA,IACP,UAAAC;AAAA,IACA,YAAYF,GAAM,cAAc;AAAA,IAChC,WAAWA,GAAM,aAAa;AAAA,IAC9B,YAAYA,GAAM,cAAc;AAAA,IAChC,YAAYA,GAAM,cAAcE,IAAW;AAAA,EAAA;AAE/C,GAEaC,IAAsC,CAAC;AAAA,EAClD,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,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