@web-mods/articles 1.1.0
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/README.md +250 -0
- package/dist/components/ui/Modal.d.ts +13 -0
- package/dist/components/ui/ToastContainer.d.ts +1 -0
- package/dist/components/ui/Tooltip.d.ts +8 -0
- package/dist/components/ui/toast.d.ts +15 -0
- package/dist/context/index.d.ts +15 -0
- package/dist/index.cjs +135 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +2220 -0
- package/dist/pages/ArticleDetail.d.ts +10 -0
- package/dist/pages/ArticleEdit.d.ts +10 -0
- package/dist/pages/ArticleList.d.ts +3 -0
- package/dist/renderArticle.d.ts +20 -0
- package/dist/router/ReactRouterAdapter.d.ts +15 -0
- package/dist/router/context.d.ts +9 -0
- package/dist/server.cjs +124 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.js +194 -0
- package/dist/service.d.ts +3 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +33 -0
- package/dist/utils/validateHtml.d.ts +22 -0
- package/package.json +63 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2220 @@
|
|
|
1
|
+
import { jsx as a, jsxs as l, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
+
import ie, { createContext as Le, useContext as _e, useState as A, useEffect as K, forwardRef as Je, createElement as Se, useRef as Y, memo as Te, useCallback as je } from "react";
|
|
3
|
+
import { defaultArticleService as ht } from "./server.js";
|
|
4
|
+
import { createArticleService as Cn, renderArticleByPathname as Sn } from "./server.js";
|
|
5
|
+
import { useNavigate as ft, useParams as mt, useLocation as pt } from "react-router";
|
|
6
|
+
import { createPortal as gt } from "react-dom";
|
|
7
|
+
const Ae = Le({
|
|
8
|
+
navigate: () => {
|
|
9
|
+
},
|
|
10
|
+
params: {},
|
|
11
|
+
locationState: null
|
|
12
|
+
});
|
|
13
|
+
function Ee() {
|
|
14
|
+
return _e(Ae);
|
|
15
|
+
}
|
|
16
|
+
let ne = [];
|
|
17
|
+
const Oe = /* @__PURE__ */ new Set();
|
|
18
|
+
function He() {
|
|
19
|
+
Oe.forEach((e) => e([...ne]));
|
|
20
|
+
}
|
|
21
|
+
function xe(e, t) {
|
|
22
|
+
const r = Math.random().toString(36).slice(2);
|
|
23
|
+
ne = [...ne, { id: r, type: e, content: t }], He(), setTimeout(() => {
|
|
24
|
+
ne = ne.filter((n) => n.id !== r), He();
|
|
25
|
+
}, 3e3);
|
|
26
|
+
}
|
|
27
|
+
const Z = {
|
|
28
|
+
success: (e) => xe("success", e),
|
|
29
|
+
error: (e) => xe("error", e),
|
|
30
|
+
warning: (e) => xe("warning", e)
|
|
31
|
+
};
|
|
32
|
+
function yt(e) {
|
|
33
|
+
return Oe.add(e), () => {
|
|
34
|
+
Oe.delete(e);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function bt() {
|
|
38
|
+
return ne;
|
|
39
|
+
}
|
|
40
|
+
const xt = {
|
|
41
|
+
success: "bg-emerald-500",
|
|
42
|
+
error: "bg-red-500",
|
|
43
|
+
warning: "bg-amber-500"
|
|
44
|
+
}, vt = {
|
|
45
|
+
success: "✓",
|
|
46
|
+
error: "✕",
|
|
47
|
+
warning: "⚠"
|
|
48
|
+
};
|
|
49
|
+
function wt() {
|
|
50
|
+
const [e, t] = A(bt());
|
|
51
|
+
return K(() => yt(t), []), e.length === 0 ? null : /* @__PURE__ */ a("div", { className: "fixed top-4 right-4 z-[9999] flex flex-col gap-2 pointer-events-none", children: e.map((r) => /* @__PURE__ */ l(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
className: `flex items-center gap-2 px-4 py-2.5 rounded-lg shadow-lg text-sm text-white font-medium pointer-events-auto ${xt[r.type]}`,
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ a("span", { className: "shrink-0 font-bold", children: vt[r.type] }),
|
|
57
|
+
r.content
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
r.id
|
|
61
|
+
)) });
|
|
62
|
+
}
|
|
63
|
+
const Ke = Le(null);
|
|
64
|
+
function xn({
|
|
65
|
+
children: e,
|
|
66
|
+
basePath: t,
|
|
67
|
+
service: r = ht,
|
|
68
|
+
previewBaseUrl: n,
|
|
69
|
+
previewTailwind: s,
|
|
70
|
+
navigate: u
|
|
71
|
+
}) {
|
|
72
|
+
const y = /* @__PURE__ */ l(
|
|
73
|
+
Ke.Provider,
|
|
74
|
+
{
|
|
75
|
+
value: { basePath: t, service: r, previewBaseUrl: n, previewTailwind: s },
|
|
76
|
+
children: [
|
|
77
|
+
e,
|
|
78
|
+
/* @__PURE__ */ a(wt, {})
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
return u ? /* @__PURE__ */ a(
|
|
83
|
+
Ae.Provider,
|
|
84
|
+
{
|
|
85
|
+
value: { navigate: u, params: {}, locationState: null },
|
|
86
|
+
children: y
|
|
87
|
+
}
|
|
88
|
+
) : y;
|
|
89
|
+
}
|
|
90
|
+
function ze() {
|
|
91
|
+
const e = _e(Ke);
|
|
92
|
+
if (!e)
|
|
93
|
+
throw new Error(
|
|
94
|
+
"useArticlesConfig must be used within ArticlesProvider"
|
|
95
|
+
);
|
|
96
|
+
return e;
|
|
97
|
+
}
|
|
98
|
+
function vn({ children: e }) {
|
|
99
|
+
const t = ft(), r = mt(), n = pt();
|
|
100
|
+
return /* @__PURE__ */ a(
|
|
101
|
+
Ae.Provider,
|
|
102
|
+
{
|
|
103
|
+
value: {
|
|
104
|
+
navigate: (s, u) => t(s, u),
|
|
105
|
+
params: r,
|
|
106
|
+
locationState: n.state
|
|
107
|
+
},
|
|
108
|
+
children: e
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @license lucide-react v1.11.0 - ISC
|
|
114
|
+
*
|
|
115
|
+
* This source code is licensed under the ISC license.
|
|
116
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
+
*/
|
|
118
|
+
const Ge = (...e) => e.filter((t, r, n) => !!t && t.trim() !== "" && n.indexOf(t) === r).join(" ").trim();
|
|
119
|
+
/**
|
|
120
|
+
* @license lucide-react v1.11.0 - ISC
|
|
121
|
+
*
|
|
122
|
+
* This source code is licensed under the ISC license.
|
|
123
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
+
*/
|
|
125
|
+
const Nt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
126
|
+
/**
|
|
127
|
+
* @license lucide-react v1.11.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/
|
|
132
|
+
const kt = (e) => e.replace(
|
|
133
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
134
|
+
(t, r, n) => n ? n.toUpperCase() : r.toLowerCase()
|
|
135
|
+
);
|
|
136
|
+
/**
|
|
137
|
+
* @license lucide-react v1.11.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/
|
|
142
|
+
const Ie = (e) => {
|
|
143
|
+
const t = kt(e);
|
|
144
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* @license lucide-react v1.11.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/
|
|
152
|
+
var ve = {
|
|
153
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
154
|
+
width: 24,
|
|
155
|
+
height: 24,
|
|
156
|
+
viewBox: "0 0 24 24",
|
|
157
|
+
fill: "none",
|
|
158
|
+
stroke: "currentColor",
|
|
159
|
+
strokeWidth: 2,
|
|
160
|
+
strokeLinecap: "round",
|
|
161
|
+
strokeLinejoin: "round"
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @license lucide-react v1.11.0 - ISC
|
|
165
|
+
*
|
|
166
|
+
* This source code is licensed under the ISC license.
|
|
167
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
+
*/
|
|
169
|
+
const $t = (e) => {
|
|
170
|
+
for (const t in e)
|
|
171
|
+
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
172
|
+
return !0;
|
|
173
|
+
return !1;
|
|
174
|
+
}, Mt = Le({}), Ct = () => _e(Mt), St = Je(
|
|
175
|
+
({ color: e, size: t, strokeWidth: r, absoluteStrokeWidth: n, className: s = "", children: u, iconNode: y, ...$ }, M) => {
|
|
176
|
+
const {
|
|
177
|
+
size: j = 24,
|
|
178
|
+
strokeWidth: m = 2,
|
|
179
|
+
absoluteStrokeWidth: S = !1,
|
|
180
|
+
color: W = "currentColor",
|
|
181
|
+
className: P = ""
|
|
182
|
+
} = Ct() ?? {}, E = n ?? S ? Number(r ?? m) * 24 / Number(t ?? j) : r ?? m;
|
|
183
|
+
return Se(
|
|
184
|
+
"svg",
|
|
185
|
+
{
|
|
186
|
+
ref: M,
|
|
187
|
+
...ve,
|
|
188
|
+
width: t ?? j ?? ve.width,
|
|
189
|
+
height: t ?? j ?? ve.height,
|
|
190
|
+
stroke: e ?? W,
|
|
191
|
+
strokeWidth: E,
|
|
192
|
+
className: Ge("lucide", P, s),
|
|
193
|
+
...!u && !$t($) && { "aria-hidden": "true" },
|
|
194
|
+
...$
|
|
195
|
+
},
|
|
196
|
+
[
|
|
197
|
+
...y.map(([I, H]) => Se(I, H)),
|
|
198
|
+
...Array.isArray(u) ? u : [u]
|
|
199
|
+
]
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
/**
|
|
204
|
+
* @license lucide-react v1.11.0 - ISC
|
|
205
|
+
*
|
|
206
|
+
* This source code is licensed under the ISC license.
|
|
207
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
+
*/
|
|
209
|
+
const U = (e, t) => {
|
|
210
|
+
const r = Je(
|
|
211
|
+
({ className: n, ...s }, u) => Se(St, {
|
|
212
|
+
ref: u,
|
|
213
|
+
iconNode: t,
|
|
214
|
+
className: Ge(
|
|
215
|
+
`lucide-${Nt(Ie(e))}`,
|
|
216
|
+
`lucide-${e}`,
|
|
217
|
+
n
|
|
218
|
+
),
|
|
219
|
+
...s
|
|
220
|
+
})
|
|
221
|
+
);
|
|
222
|
+
return r.displayName = Ie(e), r;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* @license lucide-react v1.11.0 - ISC
|
|
226
|
+
*
|
|
227
|
+
* This source code is licensed under the ISC license.
|
|
228
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
229
|
+
*/
|
|
230
|
+
const jt = [
|
|
231
|
+
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
232
|
+
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
233
|
+
], Qe = U("arrow-left", jt);
|
|
234
|
+
/**
|
|
235
|
+
* @license lucide-react v1.11.0 - ISC
|
|
236
|
+
*
|
|
237
|
+
* This source code is licensed under the ISC license.
|
|
238
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
239
|
+
*/
|
|
240
|
+
const Ot = [
|
|
241
|
+
["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
|
|
242
|
+
["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
|
|
243
|
+
], Xe = U("code", Ot);
|
|
244
|
+
/**
|
|
245
|
+
* @license lucide-react v1.11.0 - ISC
|
|
246
|
+
*
|
|
247
|
+
* This source code is licensed under the ISC license.
|
|
248
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
+
*/
|
|
250
|
+
const Pt = [
|
|
251
|
+
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
252
|
+
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
253
|
+
], Dt = U("copy", Pt);
|
|
254
|
+
/**
|
|
255
|
+
* @license lucide-react v1.11.0 - ISC
|
|
256
|
+
*
|
|
257
|
+
* This source code is licensed under the ISC license.
|
|
258
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
259
|
+
*/
|
|
260
|
+
const Lt = [
|
|
261
|
+
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
262
|
+
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
263
|
+
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
264
|
+
], _t = U("external-link", Lt);
|
|
265
|
+
/**
|
|
266
|
+
* @license lucide-react v1.11.0 - ISC
|
|
267
|
+
*
|
|
268
|
+
* This source code is licensed under the ISC license.
|
|
269
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
+
*/
|
|
271
|
+
const Tt = [
|
|
272
|
+
[
|
|
273
|
+
"path",
|
|
274
|
+
{
|
|
275
|
+
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
|
|
276
|
+
key: "1nclc0"
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
280
|
+
], Pe = U("eye", Tt);
|
|
281
|
+
/**
|
|
282
|
+
* @license lucide-react v1.11.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/
|
|
287
|
+
const At = [
|
|
288
|
+
[
|
|
289
|
+
"path",
|
|
290
|
+
{
|
|
291
|
+
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
292
|
+
key: "1oefj6"
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
|
|
296
|
+
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
297
|
+
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
298
|
+
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
299
|
+
], Et = U("file-text", At);
|
|
300
|
+
/**
|
|
301
|
+
* @license lucide-react v1.11.0 - ISC
|
|
302
|
+
*
|
|
303
|
+
* This source code is licensed under the ISC license.
|
|
304
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
+
*/
|
|
306
|
+
const zt = [
|
|
307
|
+
["polyline", { points: "22 12 16 12 14 15 10 15 8 12 2 12", key: "o97t9d" }],
|
|
308
|
+
[
|
|
309
|
+
"path",
|
|
310
|
+
{
|
|
311
|
+
d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",
|
|
312
|
+
key: "oot6mr"
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
], Ht = U("inbox", zt);
|
|
316
|
+
/**
|
|
317
|
+
* @license lucide-react v1.11.0 - ISC
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the ISC license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/
|
|
322
|
+
const It = [
|
|
323
|
+
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
324
|
+
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
325
|
+
], Wt = U("link", It);
|
|
326
|
+
/**
|
|
327
|
+
* @license lucide-react v1.11.0 - ISC
|
|
328
|
+
*
|
|
329
|
+
* This source code is licensed under the ISC license.
|
|
330
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
+
*/
|
|
332
|
+
const Rt = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], Vt = U("loader-circle", Rt);
|
|
333
|
+
/**
|
|
334
|
+
* @license lucide-react v1.11.0 - ISC
|
|
335
|
+
*
|
|
336
|
+
* This source code is licensed under the ISC license.
|
|
337
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
338
|
+
*/
|
|
339
|
+
const Yt = [
|
|
340
|
+
["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
|
|
341
|
+
["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
|
|
342
|
+
["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
|
|
343
|
+
], et = U("monitor", Yt);
|
|
344
|
+
/**
|
|
345
|
+
* @license lucide-react v1.11.0 - ISC
|
|
346
|
+
*
|
|
347
|
+
* This source code is licensed under the ISC license.
|
|
348
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
349
|
+
*/
|
|
350
|
+
const Ut = [
|
|
351
|
+
[
|
|
352
|
+
"path",
|
|
353
|
+
{
|
|
354
|
+
d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
355
|
+
key: "1a8usu"
|
|
356
|
+
}
|
|
357
|
+
],
|
|
358
|
+
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
359
|
+
], qt = U("pencil", Ut);
|
|
360
|
+
/**
|
|
361
|
+
* @license lucide-react v1.11.0 - ISC
|
|
362
|
+
*
|
|
363
|
+
* This source code is licensed under the ISC license.
|
|
364
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
+
*/
|
|
366
|
+
const Bt = [
|
|
367
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
368
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
369
|
+
], Ft = U("plus", Bt);
|
|
370
|
+
/**
|
|
371
|
+
* @license lucide-react v1.11.0 - ISC
|
|
372
|
+
*
|
|
373
|
+
* This source code is licensed under the ISC license.
|
|
374
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
+
*/
|
|
376
|
+
const Zt = [
|
|
377
|
+
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
378
|
+
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
379
|
+
], Jt = U("rotate-ccw", Zt);
|
|
380
|
+
/**
|
|
381
|
+
* @license lucide-react v1.11.0 - ISC
|
|
382
|
+
*
|
|
383
|
+
* This source code is licensed under the ISC license.
|
|
384
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
+
*/
|
|
386
|
+
const Kt = [
|
|
387
|
+
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
388
|
+
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
389
|
+
], we = U("search", Kt);
|
|
390
|
+
/**
|
|
391
|
+
* @license lucide-react v1.11.0 - ISC
|
|
392
|
+
*
|
|
393
|
+
* This source code is licensed under the ISC license.
|
|
394
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
+
*/
|
|
396
|
+
const Gt = [
|
|
397
|
+
[
|
|
398
|
+
"path",
|
|
399
|
+
{
|
|
400
|
+
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
401
|
+
key: "oel41y"
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
405
|
+
], We = U("shield-check", Gt);
|
|
406
|
+
/**
|
|
407
|
+
* @license lucide-react v1.11.0 - ISC
|
|
408
|
+
*
|
|
409
|
+
* This source code is licensed under the ISC license.
|
|
410
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
411
|
+
*/
|
|
412
|
+
const Qt = [
|
|
413
|
+
["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
|
|
414
|
+
["path", { d: "M12 18h.01", key: "mhygvu" }]
|
|
415
|
+
], tt = U("smartphone", Qt);
|
|
416
|
+
/**
|
|
417
|
+
* @license lucide-react v1.11.0 - ISC
|
|
418
|
+
*
|
|
419
|
+
* This source code is licensed under the ISC license.
|
|
420
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
421
|
+
*/
|
|
422
|
+
const Xt = [
|
|
423
|
+
["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
|
|
424
|
+
["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
|
|
425
|
+
], rt = U("tablet", Xt);
|
|
426
|
+
function er(e) {
|
|
427
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
428
|
+
}
|
|
429
|
+
var me = { exports: {} }, tr = me.exports, Re;
|
|
430
|
+
function rr() {
|
|
431
|
+
return Re || (Re = 1, (function(e, t) {
|
|
432
|
+
(function(r, n) {
|
|
433
|
+
e.exports = n();
|
|
434
|
+
})(tr, (function() {
|
|
435
|
+
var r = 1e3, n = 6e4, s = 36e5, u = "millisecond", y = "second", $ = "minute", M = "hour", j = "day", m = "week", S = "month", W = "quarter", P = "year", E = "date", I = "Invalid Date", H = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, B = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, z = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(x) {
|
|
436
|
+
var i = ["th", "st", "nd", "rd"], o = x % 100;
|
|
437
|
+
return "[" + x + (i[(o - 20) % 10] || i[o] || i[0]) + "]";
|
|
438
|
+
} }, p = function(x, i, o) {
|
|
439
|
+
var d = String(x);
|
|
440
|
+
return !d || d.length >= i ? x : "" + Array(i + 1 - d.length).join(o) + x;
|
|
441
|
+
}, T = { s: p, z: function(x) {
|
|
442
|
+
var i = -x.utcOffset(), o = Math.abs(i), d = Math.floor(o / 60), c = o % 60;
|
|
443
|
+
return (i <= 0 ? "+" : "-") + p(d, 2, "0") + ":" + p(c, 2, "0");
|
|
444
|
+
}, m: function x(i, o) {
|
|
445
|
+
if (i.date() < o.date()) return -x(o, i);
|
|
446
|
+
var d = 12 * (o.year() - i.year()) + (o.month() - i.month()), c = i.clone().add(d, S), v = o - c < 0, k = i.clone().add(d + (v ? -1 : 1), S);
|
|
447
|
+
return +(-(d + (o - c) / (v ? c - k : k - c)) || 0);
|
|
448
|
+
}, a: function(x) {
|
|
449
|
+
return x < 0 ? Math.ceil(x) || 0 : Math.floor(x);
|
|
450
|
+
}, p: function(x) {
|
|
451
|
+
return { M: S, y: P, w: m, d: j, D: E, h: M, m: $, s: y, ms: u, Q: W }[x] || String(x || "").toLowerCase().replace(/s$/, "");
|
|
452
|
+
}, u: function(x) {
|
|
453
|
+
return x === void 0;
|
|
454
|
+
} }, O = "en", b = {};
|
|
455
|
+
b[O] = z;
|
|
456
|
+
var w = "$isDayjsObject", R = function(x) {
|
|
457
|
+
return x instanceof q || !(!x || !x[w]);
|
|
458
|
+
}, L = function x(i, o, d) {
|
|
459
|
+
var c;
|
|
460
|
+
if (!i) return O;
|
|
461
|
+
if (typeof i == "string") {
|
|
462
|
+
var v = i.toLowerCase();
|
|
463
|
+
b[v] && (c = v), o && (b[v] = o, c = v);
|
|
464
|
+
var k = i.split("-");
|
|
465
|
+
if (!c && k.length > 1) return x(k[0]);
|
|
466
|
+
} else {
|
|
467
|
+
var f = i.name;
|
|
468
|
+
b[f] = i, c = f;
|
|
469
|
+
}
|
|
470
|
+
return !d && c && (O = c), c || !d && O;
|
|
471
|
+
}, g = function(x, i) {
|
|
472
|
+
if (R(x)) return x.clone();
|
|
473
|
+
var o = typeof i == "object" ? i : {};
|
|
474
|
+
return o.date = x, o.args = arguments, new q(o);
|
|
475
|
+
}, C = T;
|
|
476
|
+
C.l = L, C.i = R, C.w = function(x, i) {
|
|
477
|
+
return g(x, { locale: i.$L, utc: i.$u, x: i.$x, $offset: i.$offset });
|
|
478
|
+
};
|
|
479
|
+
var q = (function() {
|
|
480
|
+
function x(o) {
|
|
481
|
+
this.$L = L(o.locale, null, !0), this.parse(o), this.$x = this.$x || o.x || {}, this[w] = !0;
|
|
482
|
+
}
|
|
483
|
+
var i = x.prototype;
|
|
484
|
+
return i.parse = function(o) {
|
|
485
|
+
this.$d = (function(d) {
|
|
486
|
+
var c = d.date, v = d.utc;
|
|
487
|
+
if (c === null) return /* @__PURE__ */ new Date(NaN);
|
|
488
|
+
if (C.u(c)) return /* @__PURE__ */ new Date();
|
|
489
|
+
if (c instanceof Date) return new Date(c);
|
|
490
|
+
if (typeof c == "string" && !/Z$/i.test(c)) {
|
|
491
|
+
var k = c.match(H);
|
|
492
|
+
if (k) {
|
|
493
|
+
var f = k[2] - 1 || 0, N = (k[7] || "0").substring(0, 3);
|
|
494
|
+
return v ? new Date(Date.UTC(k[1], f, k[3] || 1, k[4] || 0, k[5] || 0, k[6] || 0, N)) : new Date(k[1], f, k[3] || 1, k[4] || 0, k[5] || 0, k[6] || 0, N);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return new Date(c);
|
|
498
|
+
})(o), this.init();
|
|
499
|
+
}, i.init = function() {
|
|
500
|
+
var o = this.$d;
|
|
501
|
+
this.$y = o.getFullYear(), this.$M = o.getMonth(), this.$D = o.getDate(), this.$W = o.getDay(), this.$H = o.getHours(), this.$m = o.getMinutes(), this.$s = o.getSeconds(), this.$ms = o.getMilliseconds();
|
|
502
|
+
}, i.$utils = function() {
|
|
503
|
+
return C;
|
|
504
|
+
}, i.isValid = function() {
|
|
505
|
+
return this.$d.toString() !== I;
|
|
506
|
+
}, i.isSame = function(o, d) {
|
|
507
|
+
var c = g(o);
|
|
508
|
+
return this.startOf(d) <= c && c <= this.endOf(d);
|
|
509
|
+
}, i.isAfter = function(o, d) {
|
|
510
|
+
return g(o) < this.startOf(d);
|
|
511
|
+
}, i.isBefore = function(o, d) {
|
|
512
|
+
return this.endOf(d) < g(o);
|
|
513
|
+
}, i.$g = function(o, d, c) {
|
|
514
|
+
return C.u(o) ? this[d] : this.set(c, o);
|
|
515
|
+
}, i.unix = function() {
|
|
516
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
517
|
+
}, i.valueOf = function() {
|
|
518
|
+
return this.$d.getTime();
|
|
519
|
+
}, i.startOf = function(o, d) {
|
|
520
|
+
var c = this, v = !!C.u(d) || d, k = C.p(o), f = function(ee, V) {
|
|
521
|
+
var te = C.w(c.$u ? Date.UTC(c.$y, V, ee) : new Date(c.$y, V, ee), c);
|
|
522
|
+
return v ? te : te.endOf(j);
|
|
523
|
+
}, N = function(ee, V) {
|
|
524
|
+
return C.w(c.toDate()[ee].apply(c.toDate("s"), (v ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(V)), c);
|
|
525
|
+
}, D = this.$W, h = this.$M, _ = this.$D, Q = "set" + (this.$u ? "UTC" : "");
|
|
526
|
+
switch (k) {
|
|
527
|
+
case P:
|
|
528
|
+
return v ? f(1, 0) : f(31, 11);
|
|
529
|
+
case S:
|
|
530
|
+
return v ? f(1, h) : f(0, h + 1);
|
|
531
|
+
case m:
|
|
532
|
+
var F = this.$locale().weekStart || 0, X = (D < F ? D + 7 : D) - F;
|
|
533
|
+
return f(v ? _ - X : _ + (6 - X), h);
|
|
534
|
+
case j:
|
|
535
|
+
case E:
|
|
536
|
+
return N(Q + "Hours", 0);
|
|
537
|
+
case M:
|
|
538
|
+
return N(Q + "Minutes", 1);
|
|
539
|
+
case $:
|
|
540
|
+
return N(Q + "Seconds", 2);
|
|
541
|
+
case y:
|
|
542
|
+
return N(Q + "Milliseconds", 3);
|
|
543
|
+
default:
|
|
544
|
+
return this.clone();
|
|
545
|
+
}
|
|
546
|
+
}, i.endOf = function(o) {
|
|
547
|
+
return this.startOf(o, !1);
|
|
548
|
+
}, i.$set = function(o, d) {
|
|
549
|
+
var c, v = C.p(o), k = "set" + (this.$u ? "UTC" : ""), f = (c = {}, c[j] = k + "Date", c[E] = k + "Date", c[S] = k + "Month", c[P] = k + "FullYear", c[M] = k + "Hours", c[$] = k + "Minutes", c[y] = k + "Seconds", c[u] = k + "Milliseconds", c)[v], N = v === j ? this.$D + (d - this.$W) : d;
|
|
550
|
+
if (v === S || v === P) {
|
|
551
|
+
var D = this.clone().set(E, 1);
|
|
552
|
+
D.$d[f](N), D.init(), this.$d = D.set(E, Math.min(this.$D, D.daysInMonth())).$d;
|
|
553
|
+
} else f && this.$d[f](N);
|
|
554
|
+
return this.init(), this;
|
|
555
|
+
}, i.set = function(o, d) {
|
|
556
|
+
return this.clone().$set(o, d);
|
|
557
|
+
}, i.get = function(o) {
|
|
558
|
+
return this[C.p(o)]();
|
|
559
|
+
}, i.add = function(o, d) {
|
|
560
|
+
var c, v = this;
|
|
561
|
+
o = Number(o);
|
|
562
|
+
var k = C.p(d), f = function(h) {
|
|
563
|
+
var _ = g(v);
|
|
564
|
+
return C.w(_.date(_.date() + Math.round(h * o)), v);
|
|
565
|
+
};
|
|
566
|
+
if (k === S) return this.set(S, this.$M + o);
|
|
567
|
+
if (k === P) return this.set(P, this.$y + o);
|
|
568
|
+
if (k === j) return f(1);
|
|
569
|
+
if (k === m) return f(7);
|
|
570
|
+
var N = (c = {}, c[$] = n, c[M] = s, c[y] = r, c)[k] || 1, D = this.$d.getTime() + o * N;
|
|
571
|
+
return C.w(D, this);
|
|
572
|
+
}, i.subtract = function(o, d) {
|
|
573
|
+
return this.add(-1 * o, d);
|
|
574
|
+
}, i.format = function(o) {
|
|
575
|
+
var d = this, c = this.$locale();
|
|
576
|
+
if (!this.isValid()) return c.invalidDate || I;
|
|
577
|
+
var v = o || "YYYY-MM-DDTHH:mm:ssZ", k = C.z(this), f = this.$H, N = this.$m, D = this.$M, h = c.weekdays, _ = c.months, Q = c.meridiem, F = function(V, te, oe, de) {
|
|
578
|
+
return V && (V[te] || V(d, v)) || oe[te].slice(0, de);
|
|
579
|
+
}, X = function(V) {
|
|
580
|
+
return C.s(f % 12 || 12, V, "0");
|
|
581
|
+
}, ee = Q || function(V, te, oe) {
|
|
582
|
+
var de = V < 12 ? "AM" : "PM";
|
|
583
|
+
return oe ? de.toLowerCase() : de;
|
|
584
|
+
};
|
|
585
|
+
return v.replace(B, (function(V, te) {
|
|
586
|
+
return te || (function(oe) {
|
|
587
|
+
switch (oe) {
|
|
588
|
+
case "YY":
|
|
589
|
+
return String(d.$y).slice(-2);
|
|
590
|
+
case "YYYY":
|
|
591
|
+
return C.s(d.$y, 4, "0");
|
|
592
|
+
case "M":
|
|
593
|
+
return D + 1;
|
|
594
|
+
case "MM":
|
|
595
|
+
return C.s(D + 1, 2, "0");
|
|
596
|
+
case "MMM":
|
|
597
|
+
return F(c.monthsShort, D, _, 3);
|
|
598
|
+
case "MMMM":
|
|
599
|
+
return F(_, D);
|
|
600
|
+
case "D":
|
|
601
|
+
return d.$D;
|
|
602
|
+
case "DD":
|
|
603
|
+
return C.s(d.$D, 2, "0");
|
|
604
|
+
case "d":
|
|
605
|
+
return String(d.$W);
|
|
606
|
+
case "dd":
|
|
607
|
+
return F(c.weekdaysMin, d.$W, h, 2);
|
|
608
|
+
case "ddd":
|
|
609
|
+
return F(c.weekdaysShort, d.$W, h, 3);
|
|
610
|
+
case "dddd":
|
|
611
|
+
return h[d.$W];
|
|
612
|
+
case "H":
|
|
613
|
+
return String(f);
|
|
614
|
+
case "HH":
|
|
615
|
+
return C.s(f, 2, "0");
|
|
616
|
+
case "h":
|
|
617
|
+
return X(1);
|
|
618
|
+
case "hh":
|
|
619
|
+
return X(2);
|
|
620
|
+
case "a":
|
|
621
|
+
return ee(f, N, !0);
|
|
622
|
+
case "A":
|
|
623
|
+
return ee(f, N, !1);
|
|
624
|
+
case "m":
|
|
625
|
+
return String(N);
|
|
626
|
+
case "mm":
|
|
627
|
+
return C.s(N, 2, "0");
|
|
628
|
+
case "s":
|
|
629
|
+
return String(d.$s);
|
|
630
|
+
case "ss":
|
|
631
|
+
return C.s(d.$s, 2, "0");
|
|
632
|
+
case "SSS":
|
|
633
|
+
return C.s(d.$ms, 3, "0");
|
|
634
|
+
case "Z":
|
|
635
|
+
return k;
|
|
636
|
+
}
|
|
637
|
+
return null;
|
|
638
|
+
})(V) || k.replace(":", "");
|
|
639
|
+
}));
|
|
640
|
+
}, i.utcOffset = function() {
|
|
641
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
642
|
+
}, i.diff = function(o, d, c) {
|
|
643
|
+
var v, k = this, f = C.p(d), N = g(o), D = (N.utcOffset() - this.utcOffset()) * n, h = this - N, _ = function() {
|
|
644
|
+
return C.m(k, N);
|
|
645
|
+
};
|
|
646
|
+
switch (f) {
|
|
647
|
+
case P:
|
|
648
|
+
v = _() / 12;
|
|
649
|
+
break;
|
|
650
|
+
case S:
|
|
651
|
+
v = _();
|
|
652
|
+
break;
|
|
653
|
+
case W:
|
|
654
|
+
v = _() / 3;
|
|
655
|
+
break;
|
|
656
|
+
case m:
|
|
657
|
+
v = (h - D) / 6048e5;
|
|
658
|
+
break;
|
|
659
|
+
case j:
|
|
660
|
+
v = (h - D) / 864e5;
|
|
661
|
+
break;
|
|
662
|
+
case M:
|
|
663
|
+
v = h / s;
|
|
664
|
+
break;
|
|
665
|
+
case $:
|
|
666
|
+
v = h / n;
|
|
667
|
+
break;
|
|
668
|
+
case y:
|
|
669
|
+
v = h / r;
|
|
670
|
+
break;
|
|
671
|
+
default:
|
|
672
|
+
v = h;
|
|
673
|
+
}
|
|
674
|
+
return c ? v : C.a(v);
|
|
675
|
+
}, i.daysInMonth = function() {
|
|
676
|
+
return this.endOf(S).$D;
|
|
677
|
+
}, i.$locale = function() {
|
|
678
|
+
return b[this.$L];
|
|
679
|
+
}, i.locale = function(o, d) {
|
|
680
|
+
if (!o) return this.$L;
|
|
681
|
+
var c = this.clone(), v = L(o, d, !0);
|
|
682
|
+
return v && (c.$L = v), c;
|
|
683
|
+
}, i.clone = function() {
|
|
684
|
+
return C.w(this.$d, this);
|
|
685
|
+
}, i.toDate = function() {
|
|
686
|
+
return new Date(this.valueOf());
|
|
687
|
+
}, i.toJSON = function() {
|
|
688
|
+
return this.isValid() ? this.toISOString() : null;
|
|
689
|
+
}, i.toISOString = function() {
|
|
690
|
+
return this.$d.toISOString();
|
|
691
|
+
}, i.toString = function() {
|
|
692
|
+
return this.$d.toUTCString();
|
|
693
|
+
}, x;
|
|
694
|
+
})(), G = q.prototype;
|
|
695
|
+
return g.prototype = G, [["$ms", u], ["$s", y], ["$m", $], ["$H", M], ["$W", j], ["$M", S], ["$y", P], ["$D", E]].forEach((function(x) {
|
|
696
|
+
G[x[1]] = function(i) {
|
|
697
|
+
return this.$g(i, x[0], x[1]);
|
|
698
|
+
};
|
|
699
|
+
})), g.extend = function(x, i) {
|
|
700
|
+
return x.$i || (x(i, q, g), x.$i = !0), g;
|
|
701
|
+
}, g.locale = L, g.isDayjs = R, g.unix = function(x) {
|
|
702
|
+
return g(1e3 * x);
|
|
703
|
+
}, g.en = b[O], g.Ls = b, g.p = {}, g;
|
|
704
|
+
}));
|
|
705
|
+
})(me)), me.exports;
|
|
706
|
+
}
|
|
707
|
+
var nr = rr();
|
|
708
|
+
const De = /* @__PURE__ */ er(nr);
|
|
709
|
+
function nt() {
|
|
710
|
+
const [e, t] = A(!1), [r, n] = A(!1), s = Y({ title: "" }), u = {
|
|
711
|
+
confirm: (S) => {
|
|
712
|
+
s.current = S, n(!1), t(!0);
|
|
713
|
+
}
|
|
714
|
+
}, y = async () => {
|
|
715
|
+
var S, W;
|
|
716
|
+
n(!0);
|
|
717
|
+
try {
|
|
718
|
+
await ((W = (S = s.current).onOk) == null ? void 0 : W.call(S)), t(!1);
|
|
719
|
+
} finally {
|
|
720
|
+
n(!1);
|
|
721
|
+
}
|
|
722
|
+
}, $ = () => {
|
|
723
|
+
var S, W;
|
|
724
|
+
(W = (S = s.current).onCancel) == null || W.call(S), t(!1);
|
|
725
|
+
}, M = s.current, j = M.okType === "danger", m = e ? gt(
|
|
726
|
+
/* @__PURE__ */ l("div", { className: "fixed inset-0 z-[9998] flex items-center justify-center", children: [
|
|
727
|
+
/* @__PURE__ */ a(
|
|
728
|
+
"div",
|
|
729
|
+
{
|
|
730
|
+
className: "absolute inset-0 bg-black/40",
|
|
731
|
+
onClick: $
|
|
732
|
+
}
|
|
733
|
+
),
|
|
734
|
+
/* @__PURE__ */ l("div", { className: "relative bg-white rounded-2xl shadow-xl w-full max-w-md mx-4 p-6", children: [
|
|
735
|
+
/* @__PURE__ */ a("div", { className: "text-base font-semibold text-gray-800 mb-2", children: M.title }),
|
|
736
|
+
M.content && /* @__PURE__ */ a("div", { className: "text-sm text-gray-600 mt-3", children: M.content }),
|
|
737
|
+
/* @__PURE__ */ l("div", { className: "flex justify-end gap-2 mt-5", children: [
|
|
738
|
+
/* @__PURE__ */ a(
|
|
739
|
+
"button",
|
|
740
|
+
{
|
|
741
|
+
className: "px-4 py-1.5 rounded-lg border border-gray-200 text-sm text-gray-600 hover:bg-gray-50 transition-colors cursor-pointer",
|
|
742
|
+
onClick: $,
|
|
743
|
+
children: M.cancelText ?? "取消"
|
|
744
|
+
}
|
|
745
|
+
),
|
|
746
|
+
/* @__PURE__ */ a(
|
|
747
|
+
"button",
|
|
748
|
+
{
|
|
749
|
+
disabled: r,
|
|
750
|
+
className: `px-4 py-1.5 rounded-lg text-white text-sm font-medium transition-colors disabled:opacity-50 cursor-pointer ${j ? "bg-red-500 hover:bg-red-600" : "bg-blue-500 hover:bg-blue-600"}`,
|
|
751
|
+
onClick: y,
|
|
752
|
+
children: r ? "处理中…" : M.okText ?? "确定"
|
|
753
|
+
}
|
|
754
|
+
)
|
|
755
|
+
] })
|
|
756
|
+
] })
|
|
757
|
+
] }),
|
|
758
|
+
document.body
|
|
759
|
+
) : null;
|
|
760
|
+
return [u, m];
|
|
761
|
+
}
|
|
762
|
+
const wn = () => {
|
|
763
|
+
const { navigate: e } = Ee(), { basePath: t, service: r } = ze(), [n, s] = nt(), [u, y] = A(""), [$, M] = A(""), [j, m] = A(!1), [S, W] = A([]), [P, E] = A({
|
|
764
|
+
current: 1,
|
|
765
|
+
size: 15,
|
|
766
|
+
total: 0
|
|
767
|
+
}), I = (p) => {
|
|
768
|
+
const T = p.trim();
|
|
769
|
+
if (!T) return "";
|
|
770
|
+
try {
|
|
771
|
+
return new URL(
|
|
772
|
+
T.startsWith("http") ? T : `https://${T}`
|
|
773
|
+
).origin;
|
|
774
|
+
} catch {
|
|
775
|
+
return T;
|
|
776
|
+
}
|
|
777
|
+
}, H = async (p = P.current, T = P.size, O = u, b = $) => {
|
|
778
|
+
m(!0);
|
|
779
|
+
try {
|
|
780
|
+
const w = { page: p, size: T };
|
|
781
|
+
O && (w.pathname = O);
|
|
782
|
+
const R = I(b);
|
|
783
|
+
R && (w.host = R);
|
|
784
|
+
const L = await r.getList(w);
|
|
785
|
+
W(L.items), E((g) => ({
|
|
786
|
+
...g,
|
|
787
|
+
current: p,
|
|
788
|
+
size: T,
|
|
789
|
+
total: L.total ?? g.total
|
|
790
|
+
}));
|
|
791
|
+
} catch (w) {
|
|
792
|
+
Z.error(w.message || "获取数据失败");
|
|
793
|
+
} finally {
|
|
794
|
+
m(!1);
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
K(() => {
|
|
798
|
+
H(1);
|
|
799
|
+
}, []);
|
|
800
|
+
const B = (p) => {
|
|
801
|
+
n.confirm({
|
|
802
|
+
title: "确认删除",
|
|
803
|
+
content: `确认删除 /${p.pathname}?`,
|
|
804
|
+
okText: "删除",
|
|
805
|
+
okType: "danger",
|
|
806
|
+
cancelText: "取消",
|
|
807
|
+
onOk: async () => {
|
|
808
|
+
await r.delete(p.id), Z.success("删除成功"), H(1);
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
}, z = Math.ceil(P.total / P.size) || 1;
|
|
812
|
+
return /* @__PURE__ */ l("div", { className: "bg-white rounded-xl shadow-sm border border-gray-100 p-5", children: [
|
|
813
|
+
s,
|
|
814
|
+
/* @__PURE__ */ l(
|
|
815
|
+
"form",
|
|
816
|
+
{
|
|
817
|
+
className: "flex items-center gap-2 mb-5",
|
|
818
|
+
onSubmit: (p) => {
|
|
819
|
+
p.preventDefault(), H(1);
|
|
820
|
+
},
|
|
821
|
+
children: [
|
|
822
|
+
/* @__PURE__ */ l("div", { className: "relative w-52", children: [
|
|
823
|
+
/* @__PURE__ */ a(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400" }),
|
|
824
|
+
/* @__PURE__ */ a(
|
|
825
|
+
"input",
|
|
826
|
+
{
|
|
827
|
+
className: "w-full pl-9 pr-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition",
|
|
828
|
+
placeholder: "搜索 Pathname",
|
|
829
|
+
value: u,
|
|
830
|
+
onChange: (p) => y(p.target.value)
|
|
831
|
+
}
|
|
832
|
+
)
|
|
833
|
+
] }),
|
|
834
|
+
/* @__PURE__ */ l("div", { className: "relative w-52", children: [
|
|
835
|
+
/* @__PURE__ */ a(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-gray-400" }),
|
|
836
|
+
/* @__PURE__ */ a(
|
|
837
|
+
"input",
|
|
838
|
+
{
|
|
839
|
+
className: "w-full pl-9 pr-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition",
|
|
840
|
+
placeholder: "搜索 Website URL",
|
|
841
|
+
value: $,
|
|
842
|
+
onChange: (p) => M(p.target.value)
|
|
843
|
+
}
|
|
844
|
+
)
|
|
845
|
+
] }),
|
|
846
|
+
/* @__PURE__ */ l(
|
|
847
|
+
"button",
|
|
848
|
+
{
|
|
849
|
+
type: "submit",
|
|
850
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-sm rounded-lg transition cursor-pointer",
|
|
851
|
+
children: [
|
|
852
|
+
/* @__PURE__ */ a(we, { className: "w-3.5 h-3.5" }),
|
|
853
|
+
"搜索"
|
|
854
|
+
]
|
|
855
|
+
}
|
|
856
|
+
),
|
|
857
|
+
/* @__PURE__ */ l(
|
|
858
|
+
"button",
|
|
859
|
+
{
|
|
860
|
+
type: "button",
|
|
861
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 border border-gray-200 hover:bg-gray-50 text-gray-600 text-sm rounded-lg transition cursor-pointer",
|
|
862
|
+
onClick: () => {
|
|
863
|
+
y(""), M(""), H(1, P.size, "", "");
|
|
864
|
+
},
|
|
865
|
+
children: [
|
|
866
|
+
/* @__PURE__ */ a(Jt, { className: "w-3.5 h-3.5" }),
|
|
867
|
+
"重置"
|
|
868
|
+
]
|
|
869
|
+
}
|
|
870
|
+
),
|
|
871
|
+
/* @__PURE__ */ a("div", { className: "flex-1" }),
|
|
872
|
+
/* @__PURE__ */ l(
|
|
873
|
+
"button",
|
|
874
|
+
{
|
|
875
|
+
type: "button",
|
|
876
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-sm rounded-lg transition cursor-pointer",
|
|
877
|
+
onClick: () => e(`${t}/create`),
|
|
878
|
+
children: [
|
|
879
|
+
/* @__PURE__ */ a(Ft, { className: "w-3.5 h-3.5" }),
|
|
880
|
+
"新增"
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
)
|
|
884
|
+
]
|
|
885
|
+
}
|
|
886
|
+
),
|
|
887
|
+
/* @__PURE__ */ a("div", { className: "relative", children: /* @__PURE__ */ l("table", { className: "w-full text-sm", children: [
|
|
888
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ l("tr", { className: "border-b border-gray-100", children: [
|
|
889
|
+
/* @__PURE__ */ a("th", { className: "text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-44", children: "Pathname" }),
|
|
890
|
+
/* @__PURE__ */ a("th", { className: "text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-44", children: "Website URL" }),
|
|
891
|
+
/* @__PURE__ */ a("th", { className: "text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide", children: "HTML 摘要" }),
|
|
892
|
+
/* @__PURE__ */ a("th", { className: "text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-44", children: "创建时间" }),
|
|
893
|
+
/* @__PURE__ */ a("th", { className: "text-left py-2.5 px-3 font-medium text-gray-400 text-xs uppercase tracking-wide w-56", children: "操作" })
|
|
894
|
+
] }) }),
|
|
895
|
+
/* @__PURE__ */ a("tbody", { children: j ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: 5, className: "py-16 text-center", children: /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-2 text-gray-400", children: [
|
|
896
|
+
/* @__PURE__ */ a(Vt, { className: "w-6 h-6 text-blue-400 animate-spin" }),
|
|
897
|
+
/* @__PURE__ */ a("span", { className: "text-sm", children: "加载中…" })
|
|
898
|
+
] }) }) }) : S.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: 5, className: "py-16 text-center", children: /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-2 text-gray-300", children: [
|
|
899
|
+
/* @__PURE__ */ a(Ht, { className: "w-10 h-10" }),
|
|
900
|
+
/* @__PURE__ */ a("span", { className: "text-sm", children: "暂无数据" })
|
|
901
|
+
] }) }) }) : S.map((p) => {
|
|
902
|
+
const T = (p.content || "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim().slice(0, 80);
|
|
903
|
+
return /* @__PURE__ */ l(
|
|
904
|
+
"tr",
|
|
905
|
+
{
|
|
906
|
+
className: "border-b border-gray-50 hover:bg-gray-50/60 transition-colors",
|
|
907
|
+
children: [
|
|
908
|
+
/* @__PURE__ */ a("td", { className: "py-3 px-3", children: /* @__PURE__ */ l("span", { className: "font-mono text-xs text-gray-700", children: [
|
|
909
|
+
"/",
|
|
910
|
+
p.pathname
|
|
911
|
+
] }) }),
|
|
912
|
+
/* @__PURE__ */ a("td", { className: "py-3 px-3", children: p.host ? /* @__PURE__ */ l(
|
|
913
|
+
"a",
|
|
914
|
+
{
|
|
915
|
+
href: p.host,
|
|
916
|
+
target: "_blank",
|
|
917
|
+
rel: "noopener noreferrer",
|
|
918
|
+
className: "inline-flex items-center gap-1 max-w-[160px] text-xs text-blue-600 underline underline-offset-2 hover:text-blue-800 transition-colors",
|
|
919
|
+
title: p.host,
|
|
920
|
+
children: [
|
|
921
|
+
/* @__PURE__ */ a("span", { className: "truncate", children: p.host.replace(/^https?:\/\//, "") }),
|
|
922
|
+
/* @__PURE__ */ a(_t, { className: "w-3 h-3 shrink-0" })
|
|
923
|
+
]
|
|
924
|
+
}
|
|
925
|
+
) : /* @__PURE__ */ a("span", { className: "text-xs text-gray-300", children: "—" }) }),
|
|
926
|
+
/* @__PURE__ */ a("td", { className: "py-3 px-3", children: T ? /* @__PURE__ */ a(
|
|
927
|
+
"span",
|
|
928
|
+
{
|
|
929
|
+
className: "text-sm text-gray-500 truncate block max-w-sm",
|
|
930
|
+
title: T,
|
|
931
|
+
children: T
|
|
932
|
+
}
|
|
933
|
+
) : /* @__PURE__ */ a("span", { className: "text-xs text-gray-300", children: "暂无内容" }) }),
|
|
934
|
+
/* @__PURE__ */ a("td", { className: "py-3 px-3 text-xs text-gray-400", children: p.createdAt ? De(p.createdAt).format(
|
|
935
|
+
"YYYY/MM/DD HH:mm"
|
|
936
|
+
) : "—" }),
|
|
937
|
+
/* @__PURE__ */ a("td", { className: "py-3 px-3", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
938
|
+
p.host && /* @__PURE__ */ a(
|
|
939
|
+
"button",
|
|
940
|
+
{
|
|
941
|
+
className: "px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 text-gray-600 transition cursor-pointer",
|
|
942
|
+
onClick: () => window.open(
|
|
943
|
+
`${p.host.replace(/\/$/, "")}/${p.pathname}`,
|
|
944
|
+
"_blank"
|
|
945
|
+
),
|
|
946
|
+
children: "跳转"
|
|
947
|
+
}
|
|
948
|
+
),
|
|
949
|
+
/* @__PURE__ */ a(
|
|
950
|
+
"button",
|
|
951
|
+
{
|
|
952
|
+
className: "px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 text-gray-600 transition cursor-pointer",
|
|
953
|
+
onClick: () => e(
|
|
954
|
+
`${t}/${p.id}/detail`,
|
|
955
|
+
{ state: { record: p } }
|
|
956
|
+
),
|
|
957
|
+
children: "详情"
|
|
958
|
+
}
|
|
959
|
+
),
|
|
960
|
+
/* @__PURE__ */ a(
|
|
961
|
+
"button",
|
|
962
|
+
{
|
|
963
|
+
className: "px-2.5 py-1 text-xs bg-blue-500 hover:bg-blue-600 text-white rounded-md transition cursor-pointer",
|
|
964
|
+
onClick: () => e(
|
|
965
|
+
`${t}/${p.id}/edit`,
|
|
966
|
+
{ state: { record: p } }
|
|
967
|
+
),
|
|
968
|
+
children: "编辑"
|
|
969
|
+
}
|
|
970
|
+
),
|
|
971
|
+
/* @__PURE__ */ a(
|
|
972
|
+
"button",
|
|
973
|
+
{
|
|
974
|
+
className: "px-2.5 py-1 text-xs bg-red-500 hover:bg-red-600 text-white rounded-md transition cursor-pointer",
|
|
975
|
+
onClick: () => B(p),
|
|
976
|
+
children: "删除"
|
|
977
|
+
}
|
|
978
|
+
)
|
|
979
|
+
] }) })
|
|
980
|
+
]
|
|
981
|
+
},
|
|
982
|
+
p.id
|
|
983
|
+
);
|
|
984
|
+
}) })
|
|
985
|
+
] }) }),
|
|
986
|
+
P.total > 0 && /* @__PURE__ */ l("div", { className: "flex items-center justify-between pt-4 mt-2 border-t border-gray-100", children: [
|
|
987
|
+
/* @__PURE__ */ l("span", { className: "text-xs text-gray-400", children: [
|
|
988
|
+
"共 ",
|
|
989
|
+
P.total,
|
|
990
|
+
" 条"
|
|
991
|
+
] }),
|
|
992
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
993
|
+
/* @__PURE__ */ a(
|
|
994
|
+
"button",
|
|
995
|
+
{
|
|
996
|
+
className: "px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed text-gray-600 transition cursor-pointer",
|
|
997
|
+
disabled: P.current <= 1,
|
|
998
|
+
onClick: () => H(P.current - 1),
|
|
999
|
+
children: "上一页"
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
1002
|
+
/* @__PURE__ */ l("span", { className: "px-3 py-1 text-xs text-gray-500", children: [
|
|
1003
|
+
P.current,
|
|
1004
|
+
" / ",
|
|
1005
|
+
z
|
|
1006
|
+
] }),
|
|
1007
|
+
/* @__PURE__ */ a(
|
|
1008
|
+
"button",
|
|
1009
|
+
{
|
|
1010
|
+
className: "px-2.5 py-1 text-xs border border-gray-200 rounded-md hover:bg-gray-50 disabled:opacity-40 disabled:cursor-not-allowed text-gray-600 transition cursor-pointer",
|
|
1011
|
+
disabled: P.current >= z,
|
|
1012
|
+
onClick: () => H(P.current + 1),
|
|
1013
|
+
children: "下一页"
|
|
1014
|
+
}
|
|
1015
|
+
),
|
|
1016
|
+
/* @__PURE__ */ a(
|
|
1017
|
+
"select",
|
|
1018
|
+
{
|
|
1019
|
+
className: "ml-2 text-xs border border-gray-200 rounded-md px-1.5 py-1 text-gray-600 focus:outline-none focus:ring-1 focus:ring-blue-400 cursor-pointer",
|
|
1020
|
+
value: P.size,
|
|
1021
|
+
onChange: (p) => H(1, Number(p.target.value)),
|
|
1022
|
+
children: [10, 15, 20, 50].map((p) => /* @__PURE__ */ l("option", { value: p, children: [
|
|
1023
|
+
p,
|
|
1024
|
+
" 条/页"
|
|
1025
|
+
] }, p))
|
|
1026
|
+
}
|
|
1027
|
+
)
|
|
1028
|
+
] })
|
|
1029
|
+
] })
|
|
1030
|
+
] });
|
|
1031
|
+
};
|
|
1032
|
+
async function Ve(e) {
|
|
1033
|
+
const t = new AbortController(), r = setTimeout(() => t.abort(), 1e4);
|
|
1034
|
+
try {
|
|
1035
|
+
const n = await fetch("https://validator.w3.org/nu/?out=json", {
|
|
1036
|
+
method: "POST",
|
|
1037
|
+
headers: {
|
|
1038
|
+
"Content-Type": "text/html; charset=utf-8",
|
|
1039
|
+
"User-Agent": "AiSee-Manage/1.0"
|
|
1040
|
+
},
|
|
1041
|
+
body: e,
|
|
1042
|
+
signal: t.signal
|
|
1043
|
+
});
|
|
1044
|
+
if (!n.ok) throw new Error(`W3C validator responded with ${n.status}`);
|
|
1045
|
+
const y = ((await n.json()).messages || []).filter(($) => $.type === "error");
|
|
1046
|
+
return { isValid: y.length === 0, errors: y };
|
|
1047
|
+
} catch (n) {
|
|
1048
|
+
return console.error("W3C 校验请求失败:", n), { isValid: !0, errors: [], networkError: !0 };
|
|
1049
|
+
} finally {
|
|
1050
|
+
clearTimeout(r);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
function Ye(e, t) {
|
|
1054
|
+
(t == null || t > e.length) && (t = e.length);
|
|
1055
|
+
for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r];
|
|
1056
|
+
return n;
|
|
1057
|
+
}
|
|
1058
|
+
function ar(e) {
|
|
1059
|
+
if (Array.isArray(e)) return e;
|
|
1060
|
+
}
|
|
1061
|
+
function ir(e, t, r) {
|
|
1062
|
+
return (t = hr(t)) in e ? Object.defineProperty(e, t, {
|
|
1063
|
+
value: r,
|
|
1064
|
+
enumerable: !0,
|
|
1065
|
+
configurable: !0,
|
|
1066
|
+
writable: !0
|
|
1067
|
+
}) : e[t] = r, e;
|
|
1068
|
+
}
|
|
1069
|
+
function or(e, t) {
|
|
1070
|
+
var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
1071
|
+
if (r != null) {
|
|
1072
|
+
var n, s, u, y, $ = [], M = !0, j = !1;
|
|
1073
|
+
try {
|
|
1074
|
+
if (u = (r = r.call(e)).next, t !== 0) for (; !(M = (n = u.call(r)).done) && ($.push(n.value), $.length !== t); M = !0) ;
|
|
1075
|
+
} catch (m) {
|
|
1076
|
+
j = !0, s = m;
|
|
1077
|
+
} finally {
|
|
1078
|
+
try {
|
|
1079
|
+
if (!M && r.return != null && (y = r.return(), Object(y) !== y)) return;
|
|
1080
|
+
} finally {
|
|
1081
|
+
if (j) throw s;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
return $;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
function sr() {
|
|
1088
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1089
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1090
|
+
}
|
|
1091
|
+
function Ue(e, t) {
|
|
1092
|
+
var r = Object.keys(e);
|
|
1093
|
+
if (Object.getOwnPropertySymbols) {
|
|
1094
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
1095
|
+
t && (n = n.filter(function(s) {
|
|
1096
|
+
return Object.getOwnPropertyDescriptor(e, s).enumerable;
|
|
1097
|
+
})), r.push.apply(r, n);
|
|
1098
|
+
}
|
|
1099
|
+
return r;
|
|
1100
|
+
}
|
|
1101
|
+
function qe(e) {
|
|
1102
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
1103
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
1104
|
+
t % 2 ? Ue(Object(r), !0).forEach(function(n) {
|
|
1105
|
+
ir(e, n, r[n]);
|
|
1106
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Ue(Object(r)).forEach(function(n) {
|
|
1107
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
return e;
|
|
1111
|
+
}
|
|
1112
|
+
function cr(e, t) {
|
|
1113
|
+
if (e == null) return {};
|
|
1114
|
+
var r, n, s = lr(e, t);
|
|
1115
|
+
if (Object.getOwnPropertySymbols) {
|
|
1116
|
+
var u = Object.getOwnPropertySymbols(e);
|
|
1117
|
+
for (n = 0; n < u.length; n++) r = u[n], t.indexOf(r) === -1 && {}.propertyIsEnumerable.call(e, r) && (s[r] = e[r]);
|
|
1118
|
+
}
|
|
1119
|
+
return s;
|
|
1120
|
+
}
|
|
1121
|
+
function lr(e, t) {
|
|
1122
|
+
if (e == null) return {};
|
|
1123
|
+
var r = {};
|
|
1124
|
+
for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
|
|
1125
|
+
if (t.indexOf(n) !== -1) continue;
|
|
1126
|
+
r[n] = e[n];
|
|
1127
|
+
}
|
|
1128
|
+
return r;
|
|
1129
|
+
}
|
|
1130
|
+
function ur(e, t) {
|
|
1131
|
+
return ar(e) || or(e, t) || fr(e, t) || sr();
|
|
1132
|
+
}
|
|
1133
|
+
function dr(e, t) {
|
|
1134
|
+
if (typeof e != "object" || !e) return e;
|
|
1135
|
+
var r = e[Symbol.toPrimitive];
|
|
1136
|
+
if (r !== void 0) {
|
|
1137
|
+
var n = r.call(e, t);
|
|
1138
|
+
if (typeof n != "object") return n;
|
|
1139
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1140
|
+
}
|
|
1141
|
+
return (t === "string" ? String : Number)(e);
|
|
1142
|
+
}
|
|
1143
|
+
function hr(e) {
|
|
1144
|
+
var t = dr(e, "string");
|
|
1145
|
+
return typeof t == "symbol" ? t : t + "";
|
|
1146
|
+
}
|
|
1147
|
+
function fr(e, t) {
|
|
1148
|
+
if (e) {
|
|
1149
|
+
if (typeof e == "string") return Ye(e, t);
|
|
1150
|
+
var r = {}.toString.call(e).slice(8, -1);
|
|
1151
|
+
return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Ye(e, t) : void 0;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
function mr(e, t, r) {
|
|
1155
|
+
return t in e ? Object.defineProperty(e, t, {
|
|
1156
|
+
value: r,
|
|
1157
|
+
enumerable: !0,
|
|
1158
|
+
configurable: !0,
|
|
1159
|
+
writable: !0
|
|
1160
|
+
}) : e[t] = r, e;
|
|
1161
|
+
}
|
|
1162
|
+
function Be(e, t) {
|
|
1163
|
+
var r = Object.keys(e);
|
|
1164
|
+
if (Object.getOwnPropertySymbols) {
|
|
1165
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
1166
|
+
t && (n = n.filter(function(s) {
|
|
1167
|
+
return Object.getOwnPropertyDescriptor(e, s).enumerable;
|
|
1168
|
+
})), r.push.apply(r, n);
|
|
1169
|
+
}
|
|
1170
|
+
return r;
|
|
1171
|
+
}
|
|
1172
|
+
function Fe(e) {
|
|
1173
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
1174
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
1175
|
+
t % 2 ? Be(Object(r), !0).forEach(function(n) {
|
|
1176
|
+
mr(e, n, r[n]);
|
|
1177
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Be(Object(r)).forEach(function(n) {
|
|
1178
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
return e;
|
|
1182
|
+
}
|
|
1183
|
+
function pr() {
|
|
1184
|
+
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
1185
|
+
t[r] = arguments[r];
|
|
1186
|
+
return function(n) {
|
|
1187
|
+
return t.reduceRight(function(s, u) {
|
|
1188
|
+
return u(s);
|
|
1189
|
+
}, n);
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
function se(e) {
|
|
1193
|
+
return function t() {
|
|
1194
|
+
for (var r = this, n = arguments.length, s = new Array(n), u = 0; u < n; u++)
|
|
1195
|
+
s[u] = arguments[u];
|
|
1196
|
+
return s.length >= e.length ? e.apply(this, s) : function() {
|
|
1197
|
+
for (var y = arguments.length, $ = new Array(y), M = 0; M < y; M++)
|
|
1198
|
+
$[M] = arguments[M];
|
|
1199
|
+
return t.apply(r, [].concat(s, $));
|
|
1200
|
+
};
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
function ge(e) {
|
|
1204
|
+
return {}.toString.call(e).includes("Object");
|
|
1205
|
+
}
|
|
1206
|
+
function gr(e) {
|
|
1207
|
+
return !Object.keys(e).length;
|
|
1208
|
+
}
|
|
1209
|
+
function le(e) {
|
|
1210
|
+
return typeof e == "function";
|
|
1211
|
+
}
|
|
1212
|
+
function yr(e, t) {
|
|
1213
|
+
return Object.prototype.hasOwnProperty.call(e, t);
|
|
1214
|
+
}
|
|
1215
|
+
function br(e, t) {
|
|
1216
|
+
return ge(t) || re("changeType"), Object.keys(t).some(function(r) {
|
|
1217
|
+
return !yr(e, r);
|
|
1218
|
+
}) && re("changeField"), t;
|
|
1219
|
+
}
|
|
1220
|
+
function xr(e) {
|
|
1221
|
+
le(e) || re("selectorType");
|
|
1222
|
+
}
|
|
1223
|
+
function vr(e) {
|
|
1224
|
+
le(e) || ge(e) || re("handlerType"), ge(e) && Object.values(e).some(function(t) {
|
|
1225
|
+
return !le(t);
|
|
1226
|
+
}) && re("handlersType");
|
|
1227
|
+
}
|
|
1228
|
+
function wr(e) {
|
|
1229
|
+
e || re("initialIsRequired"), ge(e) || re("initialType"), gr(e) && re("initialContent");
|
|
1230
|
+
}
|
|
1231
|
+
function Nr(e, t) {
|
|
1232
|
+
throw new Error(e[t] || e.default);
|
|
1233
|
+
}
|
|
1234
|
+
var kr = {
|
|
1235
|
+
initialIsRequired: "initial state is required",
|
|
1236
|
+
initialType: "initial state should be an object",
|
|
1237
|
+
initialContent: "initial state shouldn't be an empty object",
|
|
1238
|
+
handlerType: "handler should be an object or a function",
|
|
1239
|
+
handlersType: "all handlers should be a functions",
|
|
1240
|
+
selectorType: "selector should be a function",
|
|
1241
|
+
changeType: "provided value of changes should be an object",
|
|
1242
|
+
changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
|
|
1243
|
+
default: "an unknown error accured in `state-local` package"
|
|
1244
|
+
}, re = se(Nr)(kr), he = {
|
|
1245
|
+
changes: br,
|
|
1246
|
+
selector: xr,
|
|
1247
|
+
handler: vr,
|
|
1248
|
+
initial: wr
|
|
1249
|
+
};
|
|
1250
|
+
function $r(e) {
|
|
1251
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1252
|
+
he.initial(e), he.handler(t);
|
|
1253
|
+
var r = {
|
|
1254
|
+
current: e
|
|
1255
|
+
}, n = se(Sr)(r, t), s = se(Cr)(r), u = se(he.changes)(e), y = se(Mr)(r);
|
|
1256
|
+
function $() {
|
|
1257
|
+
var j = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(m) {
|
|
1258
|
+
return m;
|
|
1259
|
+
};
|
|
1260
|
+
return he.selector(j), j(r.current);
|
|
1261
|
+
}
|
|
1262
|
+
function M(j) {
|
|
1263
|
+
pr(n, s, u, y)(j);
|
|
1264
|
+
}
|
|
1265
|
+
return [$, M];
|
|
1266
|
+
}
|
|
1267
|
+
function Mr(e, t) {
|
|
1268
|
+
return le(t) ? t(e.current) : t;
|
|
1269
|
+
}
|
|
1270
|
+
function Cr(e, t) {
|
|
1271
|
+
return e.current = Fe(Fe({}, e.current), t), t;
|
|
1272
|
+
}
|
|
1273
|
+
function Sr(e, t, r) {
|
|
1274
|
+
return le(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
|
|
1275
|
+
var s;
|
|
1276
|
+
return (s = t[n]) === null || s === void 0 ? void 0 : s.call(t, e.current[n]);
|
|
1277
|
+
}), r;
|
|
1278
|
+
}
|
|
1279
|
+
var jr = {
|
|
1280
|
+
create: $r
|
|
1281
|
+
}, Or = {
|
|
1282
|
+
paths: {
|
|
1283
|
+
vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"
|
|
1284
|
+
}
|
|
1285
|
+
};
|
|
1286
|
+
function Pr(e) {
|
|
1287
|
+
return function t() {
|
|
1288
|
+
for (var r = this, n = arguments.length, s = new Array(n), u = 0; u < n; u++)
|
|
1289
|
+
s[u] = arguments[u];
|
|
1290
|
+
return s.length >= e.length ? e.apply(this, s) : function() {
|
|
1291
|
+
for (var y = arguments.length, $ = new Array(y), M = 0; M < y; M++)
|
|
1292
|
+
$[M] = arguments[M];
|
|
1293
|
+
return t.apply(r, [].concat(s, $));
|
|
1294
|
+
};
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
function Dr(e) {
|
|
1298
|
+
return {}.toString.call(e).includes("Object");
|
|
1299
|
+
}
|
|
1300
|
+
function Lr(e) {
|
|
1301
|
+
return e || Ze("configIsRequired"), Dr(e) || Ze("configType"), e.urls ? (_r(), {
|
|
1302
|
+
paths: {
|
|
1303
|
+
vs: e.urls.monacoBase
|
|
1304
|
+
}
|
|
1305
|
+
}) : e;
|
|
1306
|
+
}
|
|
1307
|
+
function _r() {
|
|
1308
|
+
console.warn(at.deprecation);
|
|
1309
|
+
}
|
|
1310
|
+
function Tr(e, t) {
|
|
1311
|
+
throw new Error(e[t] || e.default);
|
|
1312
|
+
}
|
|
1313
|
+
var at = {
|
|
1314
|
+
configIsRequired: "the configuration object is required",
|
|
1315
|
+
configType: "the configuration object should be an object",
|
|
1316
|
+
default: "an unknown error accured in `@monaco-editor/loader` package",
|
|
1317
|
+
deprecation: `Deprecation warning!
|
|
1318
|
+
You are using deprecated way of configuration.
|
|
1319
|
+
|
|
1320
|
+
Instead of using
|
|
1321
|
+
monaco.config({ urls: { monacoBase: '...' } })
|
|
1322
|
+
use
|
|
1323
|
+
monaco.config({ paths: { vs: '...' } })
|
|
1324
|
+
|
|
1325
|
+
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
1326
|
+
`
|
|
1327
|
+
}, Ze = Pr(Tr)(at), Ar = {
|
|
1328
|
+
config: Lr
|
|
1329
|
+
}, Er = function() {
|
|
1330
|
+
for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
|
|
1331
|
+
r[n] = arguments[n];
|
|
1332
|
+
return function(s) {
|
|
1333
|
+
return r.reduceRight(function(u, y) {
|
|
1334
|
+
return y(u);
|
|
1335
|
+
}, s);
|
|
1336
|
+
};
|
|
1337
|
+
};
|
|
1338
|
+
function it(e, t) {
|
|
1339
|
+
return Object.keys(t).forEach(function(r) {
|
|
1340
|
+
t[r] instanceof Object && e[r] && Object.assign(t[r], it(e[r], t[r]));
|
|
1341
|
+
}), qe(qe({}, e), t);
|
|
1342
|
+
}
|
|
1343
|
+
var zr = {
|
|
1344
|
+
type: "cancelation",
|
|
1345
|
+
msg: "operation is manually canceled"
|
|
1346
|
+
};
|
|
1347
|
+
function Ne(e) {
|
|
1348
|
+
var t = !1, r = new Promise(function(n, s) {
|
|
1349
|
+
e.then(function(u) {
|
|
1350
|
+
return t ? s(zr) : n(u);
|
|
1351
|
+
}), e.catch(s);
|
|
1352
|
+
});
|
|
1353
|
+
return r.cancel = function() {
|
|
1354
|
+
return t = !0;
|
|
1355
|
+
}, r;
|
|
1356
|
+
}
|
|
1357
|
+
var Hr = ["monaco"], Ir = jr.create({
|
|
1358
|
+
config: Or,
|
|
1359
|
+
isInitialized: !1,
|
|
1360
|
+
resolve: null,
|
|
1361
|
+
reject: null,
|
|
1362
|
+
monaco: null
|
|
1363
|
+
}), ot = ur(Ir, 2), ue = ot[0], be = ot[1];
|
|
1364
|
+
function Wr(e) {
|
|
1365
|
+
var t = Ar.config(e), r = t.monaco, n = cr(t, Hr);
|
|
1366
|
+
be(function(s) {
|
|
1367
|
+
return {
|
|
1368
|
+
config: it(s.config, n),
|
|
1369
|
+
monaco: r
|
|
1370
|
+
};
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
function Rr() {
|
|
1374
|
+
var e = ue(function(t) {
|
|
1375
|
+
var r = t.monaco, n = t.isInitialized, s = t.resolve;
|
|
1376
|
+
return {
|
|
1377
|
+
monaco: r,
|
|
1378
|
+
isInitialized: n,
|
|
1379
|
+
resolve: s
|
|
1380
|
+
};
|
|
1381
|
+
});
|
|
1382
|
+
if (!e.isInitialized) {
|
|
1383
|
+
if (be({
|
|
1384
|
+
isInitialized: !0
|
|
1385
|
+
}), e.monaco)
|
|
1386
|
+
return e.resolve(e.monaco), Ne(ke);
|
|
1387
|
+
if (window.monaco && window.monaco.editor)
|
|
1388
|
+
return st(window.monaco), e.resolve(window.monaco), Ne(ke);
|
|
1389
|
+
Er(Vr, Ur)(qr);
|
|
1390
|
+
}
|
|
1391
|
+
return Ne(ke);
|
|
1392
|
+
}
|
|
1393
|
+
function Vr(e) {
|
|
1394
|
+
return document.body.appendChild(e);
|
|
1395
|
+
}
|
|
1396
|
+
function Yr(e) {
|
|
1397
|
+
var t = document.createElement("script");
|
|
1398
|
+
return e && (t.src = e), t;
|
|
1399
|
+
}
|
|
1400
|
+
function Ur(e) {
|
|
1401
|
+
var t = ue(function(n) {
|
|
1402
|
+
var s = n.config, u = n.reject;
|
|
1403
|
+
return {
|
|
1404
|
+
config: s,
|
|
1405
|
+
reject: u
|
|
1406
|
+
};
|
|
1407
|
+
}), r = Yr("".concat(t.config.paths.vs, "/loader.js"));
|
|
1408
|
+
return r.onload = function() {
|
|
1409
|
+
return e();
|
|
1410
|
+
}, r.onerror = t.reject, r;
|
|
1411
|
+
}
|
|
1412
|
+
function qr() {
|
|
1413
|
+
var e = ue(function(r) {
|
|
1414
|
+
var n = r.config, s = r.resolve, u = r.reject;
|
|
1415
|
+
return {
|
|
1416
|
+
config: n,
|
|
1417
|
+
resolve: s,
|
|
1418
|
+
reject: u
|
|
1419
|
+
};
|
|
1420
|
+
}), t = window.require;
|
|
1421
|
+
t.config(e.config), t(["vs/editor/editor.main"], function(r) {
|
|
1422
|
+
var n = r.m || r;
|
|
1423
|
+
st(n), e.resolve(n);
|
|
1424
|
+
}, function(r) {
|
|
1425
|
+
e.reject(r);
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
function st(e) {
|
|
1429
|
+
ue().monaco || be({
|
|
1430
|
+
monaco: e
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
function Br() {
|
|
1434
|
+
return ue(function(e) {
|
|
1435
|
+
var t = e.monaco;
|
|
1436
|
+
return t;
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
var ke = new Promise(function(e, t) {
|
|
1440
|
+
return be({
|
|
1441
|
+
resolve: e,
|
|
1442
|
+
reject: t
|
|
1443
|
+
});
|
|
1444
|
+
}), ct = {
|
|
1445
|
+
config: Wr,
|
|
1446
|
+
init: Rr,
|
|
1447
|
+
__getMonacoInstance: Br
|
|
1448
|
+
}, Fr = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, $e = Fr, Zr = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, Jr = Zr;
|
|
1449
|
+
function Kr({ children: e }) {
|
|
1450
|
+
return ie.createElement("div", { style: Jr.container }, e);
|
|
1451
|
+
}
|
|
1452
|
+
var Gr = Kr, Qr = Gr;
|
|
1453
|
+
function Xr({ width: e, height: t, isEditorReady: r, loading: n, _ref: s, className: u, wrapperProps: y }) {
|
|
1454
|
+
return ie.createElement("section", { style: { ...$e.wrapper, width: e, height: t }, ...y }, !r && ie.createElement(Qr, null, n), ie.createElement("div", { ref: s, style: { ...$e.fullWidth, ...!r && $e.hide }, className: u }));
|
|
1455
|
+
}
|
|
1456
|
+
var en = Xr, lt = Te(en);
|
|
1457
|
+
function tn(e) {
|
|
1458
|
+
K(e, []);
|
|
1459
|
+
}
|
|
1460
|
+
var ut = tn;
|
|
1461
|
+
function rn(e, t, r = !0) {
|
|
1462
|
+
let n = Y(!0);
|
|
1463
|
+
K(n.current || !r ? () => {
|
|
1464
|
+
n.current = !1;
|
|
1465
|
+
} : e, t);
|
|
1466
|
+
}
|
|
1467
|
+
var J = rn;
|
|
1468
|
+
function ce() {
|
|
1469
|
+
}
|
|
1470
|
+
function ae(e, t, r, n) {
|
|
1471
|
+
return nn(e, n) || an(e, t, r, n);
|
|
1472
|
+
}
|
|
1473
|
+
function nn(e, t) {
|
|
1474
|
+
return e.editor.getModel(dt(e, t));
|
|
1475
|
+
}
|
|
1476
|
+
function an(e, t, r, n) {
|
|
1477
|
+
return e.editor.createModel(t, r, n ? dt(e, n) : void 0);
|
|
1478
|
+
}
|
|
1479
|
+
function dt(e, t) {
|
|
1480
|
+
return e.Uri.parse(t);
|
|
1481
|
+
}
|
|
1482
|
+
function on({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: s, originalModelPath: u, modifiedModelPath: y, keepCurrentOriginalModel: $ = !1, keepCurrentModifiedModel: M = !1, theme: j = "light", loading: m = "Loading...", options: S = {}, height: W = "100%", width: P = "100%", className: E, wrapperProps: I = {}, beforeMount: H = ce, onMount: B = ce }) {
|
|
1483
|
+
let [z, p] = A(!1), [T, O] = A(!0), b = Y(null), w = Y(null), R = Y(null), L = Y(B), g = Y(H), C = Y(!1);
|
|
1484
|
+
ut(() => {
|
|
1485
|
+
let i = ct.init();
|
|
1486
|
+
return i.then((o) => (w.current = o) && O(!1)).catch((o) => (o == null ? void 0 : o.type) !== "cancelation" && console.error("Monaco initialization: error:", o)), () => b.current ? x() : i.cancel();
|
|
1487
|
+
}), J(() => {
|
|
1488
|
+
if (b.current && w.current) {
|
|
1489
|
+
let i = b.current.getOriginalEditor(), o = ae(w.current, e || "", n || r || "text", u || "");
|
|
1490
|
+
o !== i.getModel() && i.setModel(o);
|
|
1491
|
+
}
|
|
1492
|
+
}, [u], z), J(() => {
|
|
1493
|
+
if (b.current && w.current) {
|
|
1494
|
+
let i = b.current.getModifiedEditor(), o = ae(w.current, t || "", s || r || "text", y || "");
|
|
1495
|
+
o !== i.getModel() && i.setModel(o);
|
|
1496
|
+
}
|
|
1497
|
+
}, [y], z), J(() => {
|
|
1498
|
+
let i = b.current.getModifiedEditor();
|
|
1499
|
+
i.getOption(w.current.editor.EditorOption.readOnly) ? i.setValue(t || "") : t !== i.getValue() && (i.executeEdits("", [{ range: i.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), i.pushUndoStop());
|
|
1500
|
+
}, [t], z), J(() => {
|
|
1501
|
+
var i, o;
|
|
1502
|
+
(o = (i = b.current) == null ? void 0 : i.getModel()) == null || o.original.setValue(e || "");
|
|
1503
|
+
}, [e], z), J(() => {
|
|
1504
|
+
let { original: i, modified: o } = b.current.getModel();
|
|
1505
|
+
w.current.editor.setModelLanguage(i, n || r || "text"), w.current.editor.setModelLanguage(o, s || r || "text");
|
|
1506
|
+
}, [r, n, s], z), J(() => {
|
|
1507
|
+
var i;
|
|
1508
|
+
(i = w.current) == null || i.editor.setTheme(j);
|
|
1509
|
+
}, [j], z), J(() => {
|
|
1510
|
+
var i;
|
|
1511
|
+
(i = b.current) == null || i.updateOptions(S);
|
|
1512
|
+
}, [S], z);
|
|
1513
|
+
let q = je(() => {
|
|
1514
|
+
var d;
|
|
1515
|
+
if (!w.current) return;
|
|
1516
|
+
g.current(w.current);
|
|
1517
|
+
let i = ae(w.current, e || "", n || r || "text", u || ""), o = ae(w.current, t || "", s || r || "text", y || "");
|
|
1518
|
+
(d = b.current) == null || d.setModel({ original: i, modified: o });
|
|
1519
|
+
}, [r, t, s, e, n, u, y]), G = je(() => {
|
|
1520
|
+
var i;
|
|
1521
|
+
!C.current && R.current && (b.current = w.current.editor.createDiffEditor(R.current, { automaticLayout: !0, ...S }), q(), (i = w.current) == null || i.editor.setTheme(j), p(!0), C.current = !0);
|
|
1522
|
+
}, [S, j, q]);
|
|
1523
|
+
K(() => {
|
|
1524
|
+
z && L.current(b.current, w.current);
|
|
1525
|
+
}, [z]), K(() => {
|
|
1526
|
+
!T && !z && G();
|
|
1527
|
+
}, [T, z, G]);
|
|
1528
|
+
function x() {
|
|
1529
|
+
var o, d, c, v;
|
|
1530
|
+
let i = (o = b.current) == null ? void 0 : o.getModel();
|
|
1531
|
+
$ || ((d = i == null ? void 0 : i.original) == null || d.dispose()), M || ((c = i == null ? void 0 : i.modified) == null || c.dispose()), (v = b.current) == null || v.dispose();
|
|
1532
|
+
}
|
|
1533
|
+
return ie.createElement(lt, { width: P, height: W, isEditorReady: z, loading: m, _ref: R, className: E, wrapperProps: I });
|
|
1534
|
+
}
|
|
1535
|
+
var sn = on;
|
|
1536
|
+
Te(sn);
|
|
1537
|
+
function cn(e) {
|
|
1538
|
+
let t = Y();
|
|
1539
|
+
return K(() => {
|
|
1540
|
+
t.current = e;
|
|
1541
|
+
}, [e]), t.current;
|
|
1542
|
+
}
|
|
1543
|
+
var ln = cn, fe = /* @__PURE__ */ new Map();
|
|
1544
|
+
function un({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: s, path: u, theme: y = "light", line: $, loading: M = "Loading...", options: j = {}, overrideServices: m = {}, saveViewState: S = !0, keepCurrentModel: W = !1, width: P = "100%", height: E = "100%", className: I, wrapperProps: H = {}, beforeMount: B = ce, onMount: z = ce, onChange: p, onValidate: T = ce }) {
|
|
1545
|
+
let [O, b] = A(!1), [w, R] = A(!0), L = Y(null), g = Y(null), C = Y(null), q = Y(z), G = Y(B), x = Y(), i = Y(n), o = ln(u), d = Y(!1), c = Y(!1);
|
|
1546
|
+
ut(() => {
|
|
1547
|
+
let f = ct.init();
|
|
1548
|
+
return f.then((N) => (L.current = N) && R(!1)).catch((N) => (N == null ? void 0 : N.type) !== "cancelation" && console.error("Monaco initialization: error:", N)), () => g.current ? k() : f.cancel();
|
|
1549
|
+
}), J(() => {
|
|
1550
|
+
var N, D, h, _;
|
|
1551
|
+
let f = ae(L.current, e || n || "", t || s || "", u || r || "");
|
|
1552
|
+
f !== ((N = g.current) == null ? void 0 : N.getModel()) && (S && fe.set(o, (D = g.current) == null ? void 0 : D.saveViewState()), (h = g.current) == null || h.setModel(f), S && ((_ = g.current) == null || _.restoreViewState(fe.get(u))));
|
|
1553
|
+
}, [u], O), J(() => {
|
|
1554
|
+
var f;
|
|
1555
|
+
(f = g.current) == null || f.updateOptions(j);
|
|
1556
|
+
}, [j], O), J(() => {
|
|
1557
|
+
!g.current || n === void 0 || (g.current.getOption(L.current.editor.EditorOption.readOnly) ? g.current.setValue(n) : n !== g.current.getValue() && (c.current = !0, g.current.executeEdits("", [{ range: g.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), g.current.pushUndoStop(), c.current = !1));
|
|
1558
|
+
}, [n], O), J(() => {
|
|
1559
|
+
var N, D;
|
|
1560
|
+
let f = (N = g.current) == null ? void 0 : N.getModel();
|
|
1561
|
+
f && s && ((D = L.current) == null || D.editor.setModelLanguage(f, s));
|
|
1562
|
+
}, [s], O), J(() => {
|
|
1563
|
+
var f;
|
|
1564
|
+
$ !== void 0 && ((f = g.current) == null || f.revealLine($));
|
|
1565
|
+
}, [$], O), J(() => {
|
|
1566
|
+
var f;
|
|
1567
|
+
(f = L.current) == null || f.editor.setTheme(y);
|
|
1568
|
+
}, [y], O);
|
|
1569
|
+
let v = je(() => {
|
|
1570
|
+
var f;
|
|
1571
|
+
if (!(!C.current || !L.current) && !d.current) {
|
|
1572
|
+
G.current(L.current);
|
|
1573
|
+
let N = u || r, D = ae(L.current, n || e || "", t || s || "", N || "");
|
|
1574
|
+
g.current = (f = L.current) == null ? void 0 : f.editor.create(C.current, { model: D, automaticLayout: !0, ...j }, m), S && g.current.restoreViewState(fe.get(N)), L.current.editor.setTheme(y), $ !== void 0 && g.current.revealLine($), b(!0), d.current = !0;
|
|
1575
|
+
}
|
|
1576
|
+
}, [e, t, r, n, s, u, j, m, S, y, $]);
|
|
1577
|
+
K(() => {
|
|
1578
|
+
O && q.current(g.current, L.current);
|
|
1579
|
+
}, [O]), K(() => {
|
|
1580
|
+
!w && !O && v();
|
|
1581
|
+
}, [w, O, v]), i.current = n, K(() => {
|
|
1582
|
+
var f, N;
|
|
1583
|
+
O && p && ((f = x.current) == null || f.dispose(), x.current = (N = g.current) == null ? void 0 : N.onDidChangeModelContent((D) => {
|
|
1584
|
+
c.current || p(g.current.getValue(), D);
|
|
1585
|
+
}));
|
|
1586
|
+
}, [O, p]), K(() => {
|
|
1587
|
+
if (O) {
|
|
1588
|
+
let f = L.current.editor.onDidChangeMarkers((N) => {
|
|
1589
|
+
var h;
|
|
1590
|
+
let D = (h = g.current.getModel()) == null ? void 0 : h.uri;
|
|
1591
|
+
if (D && N.find((_) => _.path === D.path)) {
|
|
1592
|
+
let _ = L.current.editor.getModelMarkers({ resource: D });
|
|
1593
|
+
T == null || T(_);
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
return () => {
|
|
1597
|
+
f == null || f.dispose();
|
|
1598
|
+
};
|
|
1599
|
+
}
|
|
1600
|
+
return () => {
|
|
1601
|
+
};
|
|
1602
|
+
}, [O, T]);
|
|
1603
|
+
function k() {
|
|
1604
|
+
var f, N;
|
|
1605
|
+
(f = x.current) == null || f.dispose(), W ? S && fe.set(u, g.current.saveViewState()) : (N = g.current.getModel()) == null || N.dispose(), g.current.dispose();
|
|
1606
|
+
}
|
|
1607
|
+
return ie.createElement(lt, { width: P, height: E, isEditorReady: O, loading: M, _ref: C, className: I, wrapperProps: H });
|
|
1608
|
+
}
|
|
1609
|
+
var dn = un, hn = Te(dn), fn = hn;
|
|
1610
|
+
function ye({ title: e, children: t, placement: r = "top" }) {
|
|
1611
|
+
const [n, s] = A(!1);
|
|
1612
|
+
return e ? /* @__PURE__ */ l(
|
|
1613
|
+
"div",
|
|
1614
|
+
{
|
|
1615
|
+
className: "relative inline-flex",
|
|
1616
|
+
onMouseEnter: () => s(!0),
|
|
1617
|
+
onMouseLeave: () => s(!1),
|
|
1618
|
+
children: [
|
|
1619
|
+
t,
|
|
1620
|
+
n && /* @__PURE__ */ a(
|
|
1621
|
+
"div",
|
|
1622
|
+
{
|
|
1623
|
+
className: `absolute left-1/2 -translate-x-1/2 z-50 px-2 py-1 bg-gray-800/90 text-white text-xs rounded-md whitespace-nowrap pointer-events-none ${r === "top" ? "bottom-full mb-1.5" : "top-full mt-1.5"}`,
|
|
1624
|
+
children: e
|
|
1625
|
+
}
|
|
1626
|
+
)
|
|
1627
|
+
]
|
|
1628
|
+
}
|
|
1629
|
+
) : /* @__PURE__ */ a(pe, { children: t });
|
|
1630
|
+
}
|
|
1631
|
+
const Me = [
|
|
1632
|
+
{ key: "desktop", icon: /* @__PURE__ */ a(et, { size: 13 }), label: "Desktop", width: null },
|
|
1633
|
+
{ key: "tablet", icon: /* @__PURE__ */ a(rt, { size: 13 }), label: "Tablet", width: 768 },
|
|
1634
|
+
{ key: "mobile", icon: /* @__PURE__ */ a(tt, { size: 13 }), label: "Mobile", width: 390 }
|
|
1635
|
+
], Nn = ({ id: e, record: t }) => {
|
|
1636
|
+
const { navigate: r, params: n, locationState: s } = Ee(), u = e ?? n.id, { basePath: y, service: $, previewBaseUrl: M, previewTailwind: j } = ze(), m = !!u, [S, W] = nt(), [P, E] = A(!1), [I, H] = A(t ?? (s == null ? void 0 : s.record) ?? null), [B, z] = A(""), [p, T] = A(""), [O, b] = A(""), [w, R] = A(""), [L, g] = A("code"), [C, q] = A(!1), [G, x] = A("desktop"), [i, o] = A(!1), [d, c] = A(null), v = (h, _) => {
|
|
1637
|
+
const Q = M ? `<base href="${M}">` : "", F = _ ? `<meta name="viewport" content="width=${_}, initial-scale=1">` : "", X = _ ? "<style>*,*::before,*::after{box-sizing:border-box}img,video,svg,canvas,audio{max-width:100%;height:auto}pre{white-space:pre-wrap;word-break:break-word;overflow-x:auto}table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}</style>" : "", ee = j && !h.includes("cdn.tailwindcss.com") ? '<script src="https://cdn.tailwindcss.com"><\/script>' : "", V = Q + F + X + ee;
|
|
1638
|
+
return V ? h.includes("</head>") ? h.replace("</head>", `${V}
|
|
1639
|
+
</head>`) : V + h : h;
|
|
1640
|
+
}, k = async () => {
|
|
1641
|
+
if (!w.trim()) {
|
|
1642
|
+
Z.warning("请先输入 HTML 代码");
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
o(!0), c(null);
|
|
1646
|
+
try {
|
|
1647
|
+
const h = await Ve(w);
|
|
1648
|
+
c(h), h.networkError ? Z.warning("W3C 校验服务不可用") : h.isValid && Z.success("W3C 校验通过");
|
|
1649
|
+
} finally {
|
|
1650
|
+
o(!1);
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
K(() => {
|
|
1654
|
+
m && (I ? (z(I.pathname || ""), T(I.host || ""), R(I.content || "")) : $.getById(u).then((h) => {
|
|
1655
|
+
H(h), z(h.pathname || ""), T(h.host || ""), R(h.content || "");
|
|
1656
|
+
}).catch((h) => {
|
|
1657
|
+
Z.error(h.message || "获取数据失败"), r(y);
|
|
1658
|
+
}));
|
|
1659
|
+
}, [u]);
|
|
1660
|
+
const f = () => r(y), N = !B.trim(), D = async () => {
|
|
1661
|
+
if (!B.trim()) {
|
|
1662
|
+
b("请输入 pathname");
|
|
1663
|
+
return;
|
|
1664
|
+
}
|
|
1665
|
+
if (!w.trim()) {
|
|
1666
|
+
q(!0), Z.error("请输入 HTML 代码");
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
E(!0);
|
|
1670
|
+
const h = await Ve(w);
|
|
1671
|
+
if (E(!1), h.networkError)
|
|
1672
|
+
Z.warning("W3C 校验服务不可用,已跳过校验");
|
|
1673
|
+
else if (!h.isValid && !await new Promise((Q) => {
|
|
1674
|
+
S.confirm({
|
|
1675
|
+
title: "W3C 校验发现问题",
|
|
1676
|
+
content: /* @__PURE__ */ l("div", { className: "mt-1", children: [
|
|
1677
|
+
/* @__PURE__ */ a("p", { className: "text-gray-600 mb-2", children: "检测到以下 W3C 标准问题,仍要保存吗?" }),
|
|
1678
|
+
/* @__PURE__ */ l("ul", { className: "space-y-1", children: [
|
|
1679
|
+
h.errors.slice(0, 5).map((F, X) => /* @__PURE__ */ l(
|
|
1680
|
+
"li",
|
|
1681
|
+
{
|
|
1682
|
+
className: "flex items-start gap-1.5 text-red-500 text-sm",
|
|
1683
|
+
children: [
|
|
1684
|
+
/* @__PURE__ */ a("span", { className: "shrink-0", children: "✕" }),
|
|
1685
|
+
/* @__PURE__ */ l("span", { children: [
|
|
1686
|
+
F.lastLine ? `第 ${F.lastLine} 行:` : "",
|
|
1687
|
+
F.message
|
|
1688
|
+
] })
|
|
1689
|
+
]
|
|
1690
|
+
},
|
|
1691
|
+
X
|
|
1692
|
+
)),
|
|
1693
|
+
h.errors.length > 5 && /* @__PURE__ */ l("li", { className: "text-gray-400 text-xs mt-1", children: [
|
|
1694
|
+
"还有 ",
|
|
1695
|
+
h.errors.length - 5,
|
|
1696
|
+
" 个问题…"
|
|
1697
|
+
] })
|
|
1698
|
+
] })
|
|
1699
|
+
] }),
|
|
1700
|
+
okText: "仍然保存",
|
|
1701
|
+
cancelText: "返回修改",
|
|
1702
|
+
onOk: () => Q(!0),
|
|
1703
|
+
onCancel: () => Q(!1)
|
|
1704
|
+
});
|
|
1705
|
+
}))
|
|
1706
|
+
return;
|
|
1707
|
+
E(!0);
|
|
1708
|
+
try {
|
|
1709
|
+
const _ = {
|
|
1710
|
+
pathname: B.trim(),
|
|
1711
|
+
content: w,
|
|
1712
|
+
host: (p == null ? void 0 : p.trim()) || void 0
|
|
1713
|
+
};
|
|
1714
|
+
m && I ? (await $.update(I.id, _), Z.success("编辑成功")) : (await $.create(_), Z.success("添加成功")), r(y);
|
|
1715
|
+
} catch (_) {
|
|
1716
|
+
Z.error(_.message || "保存失败");
|
|
1717
|
+
} finally {
|
|
1718
|
+
E(!1);
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
return /* @__PURE__ */ l(pe, { children: [
|
|
1722
|
+
W,
|
|
1723
|
+
/* @__PURE__ */ l(
|
|
1724
|
+
"div",
|
|
1725
|
+
{
|
|
1726
|
+
className: "w-full bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden flex flex-col",
|
|
1727
|
+
style: { height: "calc(100vh - 90px)" },
|
|
1728
|
+
children: [
|
|
1729
|
+
/* @__PURE__ */ l("div", { className: "shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-100 bg-gray-50/60", children: [
|
|
1730
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-3", children: [
|
|
1731
|
+
/* @__PURE__ */ a(
|
|
1732
|
+
"button",
|
|
1733
|
+
{
|
|
1734
|
+
className: "flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-200 transition -ml-1 cursor-pointer",
|
|
1735
|
+
onClick: f,
|
|
1736
|
+
children: /* @__PURE__ */ a(Qe, { size: 15 })
|
|
1737
|
+
}
|
|
1738
|
+
),
|
|
1739
|
+
/* @__PURE__ */ l("div", { children: [
|
|
1740
|
+
/* @__PURE__ */ a("div", { className: "text-base font-semibold text-gray-800 leading-tight", children: m ? "编辑 Article" : "新增 Article" }),
|
|
1741
|
+
m && I && /* @__PURE__ */ l("div", { className: "text-xs text-gray-400 mt-0.5 font-mono", children: [
|
|
1742
|
+
"/",
|
|
1743
|
+
I.pathname
|
|
1744
|
+
] })
|
|
1745
|
+
] })
|
|
1746
|
+
] }),
|
|
1747
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1748
|
+
/* @__PURE__ */ a(
|
|
1749
|
+
"button",
|
|
1750
|
+
{
|
|
1751
|
+
className: "px-4 py-1.5 border border-gray-200 rounded-lg text-sm text-gray-600 hover:bg-gray-50 transition cursor-pointer",
|
|
1752
|
+
onClick: f,
|
|
1753
|
+
children: "取消"
|
|
1754
|
+
}
|
|
1755
|
+
),
|
|
1756
|
+
/* @__PURE__ */ a(
|
|
1757
|
+
"button",
|
|
1758
|
+
{
|
|
1759
|
+
disabled: N || P,
|
|
1760
|
+
className: "px-4 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-sm rounded-lg transition disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",
|
|
1761
|
+
onClick: D,
|
|
1762
|
+
children: P ? "保存中…" : "保存"
|
|
1763
|
+
}
|
|
1764
|
+
)
|
|
1765
|
+
] })
|
|
1766
|
+
] }),
|
|
1767
|
+
/* @__PURE__ */ a("div", { className: "shrink-0 px-6 pt-5 pb-4 border-b border-gray-100", children: /* @__PURE__ */ l("div", { className: "flex gap-4", children: [
|
|
1768
|
+
/* @__PURE__ */ l("div", { className: "flex-1", children: [
|
|
1769
|
+
/* @__PURE__ */ l("label", { className: "block text-sm font-medium text-gray-700 mb-1.5", children: [
|
|
1770
|
+
"Pathname",
|
|
1771
|
+
/* @__PURE__ */ a("span", { className: "text-xs text-gray-400 font-normal ml-1.5", children: "前台网站路径" })
|
|
1772
|
+
] }),
|
|
1773
|
+
/* @__PURE__ */ l(
|
|
1774
|
+
"div",
|
|
1775
|
+
{
|
|
1776
|
+
className: `flex items-center border rounded-lg transition focus-within:ring-2 focus-within:ring-blue-500/30 focus-within:border-blue-400 ${O ? "border-red-400 ring-2 ring-red-500/20" : "border-gray-200"}`,
|
|
1777
|
+
children: [
|
|
1778
|
+
/* @__PURE__ */ a("span", { className: "pl-3 text-gray-400 select-none text-sm shrink-0", children: "/" }),
|
|
1779
|
+
/* @__PURE__ */ a(
|
|
1780
|
+
"input",
|
|
1781
|
+
{
|
|
1782
|
+
className: "flex-1 pr-3 py-1.5 text-sm bg-transparent focus:outline-none",
|
|
1783
|
+
placeholder: "例如 about-us",
|
|
1784
|
+
value: B,
|
|
1785
|
+
onChange: (h) => {
|
|
1786
|
+
z(h.target.value), O && b("");
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
)
|
|
1790
|
+
]
|
|
1791
|
+
}
|
|
1792
|
+
),
|
|
1793
|
+
O && /* @__PURE__ */ a("p", { className: "text-red-500 text-xs mt-1", children: O })
|
|
1794
|
+
] }),
|
|
1795
|
+
/* @__PURE__ */ l("div", { className: "flex-1", children: [
|
|
1796
|
+
/* @__PURE__ */ l("label", { className: "block text-sm font-medium text-gray-700 mb-1.5", children: [
|
|
1797
|
+
"Website URL",
|
|
1798
|
+
/* @__PURE__ */ a("span", { className: "text-xs text-gray-400 font-normal ml-1.5", children: "可跳转的网站地址" })
|
|
1799
|
+
] }),
|
|
1800
|
+
/* @__PURE__ */ a(
|
|
1801
|
+
"input",
|
|
1802
|
+
{
|
|
1803
|
+
className: "w-full px-3 py-1.5 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500/30 focus:border-blue-400 transition",
|
|
1804
|
+
placeholder: "例如 https://aisee.live",
|
|
1805
|
+
value: p,
|
|
1806
|
+
onChange: (h) => T(h.target.value)
|
|
1807
|
+
}
|
|
1808
|
+
)
|
|
1809
|
+
] })
|
|
1810
|
+
] }) }),
|
|
1811
|
+
/* @__PURE__ */ a("div", { className: "shrink-0 border-b border-gray-100 bg-gray-50/40", children: /* @__PURE__ */ l("div", { className: "flex items-center justify-between px-6 py-2", children: [
|
|
1812
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ l("div", { className: "flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60", children: [
|
|
1813
|
+
/* @__PURE__ */ l(
|
|
1814
|
+
"button",
|
|
1815
|
+
{
|
|
1816
|
+
className: `flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all duration-150 select-none cursor-pointer ${L === "code" ? "bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50" : "text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,
|
|
1817
|
+
onClick: () => g("code"),
|
|
1818
|
+
children: [
|
|
1819
|
+
/* @__PURE__ */ a(Xe, { size: 11 }),
|
|
1820
|
+
" Code"
|
|
1821
|
+
]
|
|
1822
|
+
}
|
|
1823
|
+
),
|
|
1824
|
+
/* @__PURE__ */ l(
|
|
1825
|
+
"button",
|
|
1826
|
+
{
|
|
1827
|
+
className: `flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all duration-150 select-none ${L === "preview" ? "bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50 cursor-pointer" : w ? "text-gray-400 hover:text-gray-600 hover:bg-white/50 cursor-pointer" : "text-gray-300 cursor-not-allowed"}`,
|
|
1828
|
+
onClick: () => g("preview"),
|
|
1829
|
+
disabled: !w,
|
|
1830
|
+
children: [
|
|
1831
|
+
/* @__PURE__ */ a(Pe, { size: 11 }),
|
|
1832
|
+
" 预览"
|
|
1833
|
+
]
|
|
1834
|
+
}
|
|
1835
|
+
)
|
|
1836
|
+
] }) }),
|
|
1837
|
+
L === "preview" && w && /* @__PURE__ */ a("div", { className: "flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60", children: Me.map((h) => /* @__PURE__ */ a(ye, { title: h.label, children: /* @__PURE__ */ a(
|
|
1838
|
+
"button",
|
|
1839
|
+
{
|
|
1840
|
+
className: `flex items-center justify-center w-7 h-6 rounded-md text-xs transition-all duration-150 select-none cursor-pointer ${G === h.key ? "bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50" : "text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,
|
|
1841
|
+
onClick: () => x(h.key),
|
|
1842
|
+
children: h.icon
|
|
1843
|
+
}
|
|
1844
|
+
) }, h.key)) }),
|
|
1845
|
+
L === "code" && /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1846
|
+
w && /* @__PURE__ */ l("span", { className: "text-xs text-gray-400", children: [
|
|
1847
|
+
w.split(`
|
|
1848
|
+
`).length,
|
|
1849
|
+
" 行 ·",
|
|
1850
|
+
" ",
|
|
1851
|
+
w.length,
|
|
1852
|
+
" 字符"
|
|
1853
|
+
] }),
|
|
1854
|
+
d && !d.networkError && (d.isValid ? /* @__PURE__ */ l("span", { className: "flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-50 border border-green-200 text-green-600 text-xs", children: [
|
|
1855
|
+
/* @__PURE__ */ a(We, { size: 11 }),
|
|
1856
|
+
" 校验通过"
|
|
1857
|
+
] }) : /* @__PURE__ */ a(
|
|
1858
|
+
ye,
|
|
1859
|
+
{
|
|
1860
|
+
title: /* @__PURE__ */ l("ul", { className: "m-0 pl-0 list-none space-y-1 max-w-xs", children: [
|
|
1861
|
+
d.errors.slice(0, 5).map(
|
|
1862
|
+
(h, _) => /* @__PURE__ */ l(
|
|
1863
|
+
"li",
|
|
1864
|
+
{
|
|
1865
|
+
className: "text-xs",
|
|
1866
|
+
children: [
|
|
1867
|
+
h.lastLine ? `第 ${h.lastLine} 行:` : "",
|
|
1868
|
+
h.message
|
|
1869
|
+
]
|
|
1870
|
+
},
|
|
1871
|
+
_
|
|
1872
|
+
)
|
|
1873
|
+
),
|
|
1874
|
+
d.errors.length > 5 && /* @__PURE__ */ l("li", { className: "text-gray-400 text-xs", children: [
|
|
1875
|
+
"还有",
|
|
1876
|
+
" ",
|
|
1877
|
+
d.errors.length - 5,
|
|
1878
|
+
" ",
|
|
1879
|
+
"个问题…"
|
|
1880
|
+
] })
|
|
1881
|
+
] }),
|
|
1882
|
+
children: /* @__PURE__ */ l("span", { className: "flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-50 border border-red-200 text-red-500 text-xs cursor-default", children: [
|
|
1883
|
+
"✕",
|
|
1884
|
+
" ",
|
|
1885
|
+
d.errors.length,
|
|
1886
|
+
" ",
|
|
1887
|
+
"个问题"
|
|
1888
|
+
] })
|
|
1889
|
+
}
|
|
1890
|
+
)),
|
|
1891
|
+
/* @__PURE__ */ l(
|
|
1892
|
+
"button",
|
|
1893
|
+
{
|
|
1894
|
+
disabled: !w || i,
|
|
1895
|
+
className: "flex items-center gap-1.5 px-2.5 py-1 text-xs border border-gray-200 rounded-lg hover:bg-gray-50 text-gray-600 transition disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",
|
|
1896
|
+
onClick: k,
|
|
1897
|
+
children: [
|
|
1898
|
+
/* @__PURE__ */ a(We, { size: 12 }),
|
|
1899
|
+
i ? "校验中…" : "W3C 校验"
|
|
1900
|
+
]
|
|
1901
|
+
}
|
|
1902
|
+
)
|
|
1903
|
+
] })
|
|
1904
|
+
] }) }),
|
|
1905
|
+
/* @__PURE__ */ l("div", { className: "flex-1 min-h-0 relative", children: [
|
|
1906
|
+
/* @__PURE__ */ a(
|
|
1907
|
+
"div",
|
|
1908
|
+
{
|
|
1909
|
+
className: "absolute inset-0",
|
|
1910
|
+
style: {
|
|
1911
|
+
display: L === "code" ? "block" : "none",
|
|
1912
|
+
outline: C ? "2px solid #ff4d4f" : "none"
|
|
1913
|
+
},
|
|
1914
|
+
children: /* @__PURE__ */ a(
|
|
1915
|
+
fn,
|
|
1916
|
+
{
|
|
1917
|
+
height: "100%",
|
|
1918
|
+
language: "html",
|
|
1919
|
+
theme: "vs-dark",
|
|
1920
|
+
value: w,
|
|
1921
|
+
onChange: (h) => {
|
|
1922
|
+
R(h ?? ""), C && q(!1), d && c(null);
|
|
1923
|
+
},
|
|
1924
|
+
options: {
|
|
1925
|
+
fontSize: 13,
|
|
1926
|
+
minimap: { enabled: !1 },
|
|
1927
|
+
wordWrap: "on",
|
|
1928
|
+
scrollBeyondLastLine: !1,
|
|
1929
|
+
automaticLayout: !0,
|
|
1930
|
+
tabSize: 2,
|
|
1931
|
+
formatOnPaste: !0,
|
|
1932
|
+
lineNumbers: "on",
|
|
1933
|
+
renderWhitespace: "none",
|
|
1934
|
+
smoothScrolling: !0,
|
|
1935
|
+
cursorBlinking: "smooth",
|
|
1936
|
+
padding: { top: 12, bottom: 12 }
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
)
|
|
1940
|
+
}
|
|
1941
|
+
),
|
|
1942
|
+
L === "preview" && (w ? /* @__PURE__ */ a("div", { className: "absolute inset-0 overflow-auto bg-gray-100/60 flex justify-center", children: G !== "desktop" ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center py-6 h-full", children: /* @__PURE__ */ a(
|
|
1943
|
+
"iframe",
|
|
1944
|
+
{
|
|
1945
|
+
srcDoc: v(
|
|
1946
|
+
w,
|
|
1947
|
+
Me.find(
|
|
1948
|
+
(h) => h.key === G
|
|
1949
|
+
).width
|
|
1950
|
+
),
|
|
1951
|
+
sandbox: "allow-same-origin allow-scripts",
|
|
1952
|
+
title: "HTML 预览",
|
|
1953
|
+
style: {
|
|
1954
|
+
width: `${Me.find(
|
|
1955
|
+
(h) => h.key === G
|
|
1956
|
+
).width}px`,
|
|
1957
|
+
height: "100%",
|
|
1958
|
+
minHeight: 0,
|
|
1959
|
+
border: "1px solid #e5e7eb",
|
|
1960
|
+
borderRadius: 10,
|
|
1961
|
+
background: "#fff",
|
|
1962
|
+
boxShadow: "0 4px 24px 0 rgba(0,0,0,0.10)",
|
|
1963
|
+
flexShrink: 0
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
) }) : /* @__PURE__ */ a(
|
|
1967
|
+
"iframe",
|
|
1968
|
+
{
|
|
1969
|
+
srcDoc: v(
|
|
1970
|
+
w
|
|
1971
|
+
),
|
|
1972
|
+
sandbox: "allow-same-origin allow-scripts",
|
|
1973
|
+
title: "HTML 预览",
|
|
1974
|
+
style: {
|
|
1975
|
+
width: "100%",
|
|
1976
|
+
height: "100%",
|
|
1977
|
+
border: "none",
|
|
1978
|
+
background: "#fff",
|
|
1979
|
+
display: "block"
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
) }) : /* @__PURE__ */ l("div", { className: "flex flex-col items-center justify-center h-full text-gray-300 gap-3 select-none", children: [
|
|
1983
|
+
/* @__PURE__ */ a(Pe, { size: 36 }),
|
|
1984
|
+
/* @__PURE__ */ a("span", { className: "text-sm", children: "请先输入 HTML 代码" })
|
|
1985
|
+
] }))
|
|
1986
|
+
] })
|
|
1987
|
+
]
|
|
1988
|
+
}
|
|
1989
|
+
)
|
|
1990
|
+
] });
|
|
1991
|
+
}, Ce = [
|
|
1992
|
+
{ key: "desktop", icon: /* @__PURE__ */ a(et, { size: 13 }), label: "Desktop", width: null },
|
|
1993
|
+
{ key: "tablet", icon: /* @__PURE__ */ a(rt, { size: 13 }), label: "Tablet", width: 768 },
|
|
1994
|
+
{ key: "mobile", icon: /* @__PURE__ */ a(tt, { size: 13 }), label: "Mobile", width: 390 }
|
|
1995
|
+
], kn = ({
|
|
1996
|
+
id: e,
|
|
1997
|
+
record: t
|
|
1998
|
+
}) => {
|
|
1999
|
+
const { navigate: r, params: n, locationState: s } = Ee(), u = e ?? n.id, { basePath: y, service: $, previewBaseUrl: M, previewTailwind: j } = ze(), [m, S] = A(
|
|
2000
|
+
t ?? (s == null ? void 0 : s.record) ?? null
|
|
2001
|
+
), [W, P] = A(!1), [E, I] = A("preview"), [H, B] = A("desktop");
|
|
2002
|
+
K(() => {
|
|
2003
|
+
!m && u && (P(!0), $.getById(u).then(S).catch((b) => {
|
|
2004
|
+
Z.error(b.message || "获取数据失败"), r(y);
|
|
2005
|
+
}).finally(() => P(!1)));
|
|
2006
|
+
}, [u]);
|
|
2007
|
+
const z = () => r(y), p = () => r(`${y}/${u}/edit`, { state: { record: m } }), T = () => {
|
|
2008
|
+
m != null && m.content && (navigator.clipboard.writeText(m.content), Z.success("已复制到剪贴板"));
|
|
2009
|
+
}, O = (b, w) => {
|
|
2010
|
+
const R = M ? `<base href="${M}">` : "", L = w ? `<meta name="viewport" content="width=${w}, initial-scale=1">` : "", g = w ? "<style>*,*::before,*::after{box-sizing:border-box}img,video,svg,canvas,audio{max-width:100%;height:auto}pre{white-space:pre-wrap;word-break:break-word;overflow-x:auto}table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}</style>" : "", C = j && !b.includes("cdn.tailwindcss.com") ? '<script src="https://cdn.tailwindcss.com"><\/script>' : "", q = R + L + g + C;
|
|
2011
|
+
return q ? b.includes("</head>") ? b.replace("</head>", `${q}
|
|
2012
|
+
</head>`) : q + b : b;
|
|
2013
|
+
};
|
|
2014
|
+
return W ? /* @__PURE__ */ a("div", { className: "flex items-center justify-center h-64 text-gray-400 text-sm", children: "加载中…" }) : /* @__PURE__ */ l(
|
|
2015
|
+
"div",
|
|
2016
|
+
{
|
|
2017
|
+
className: "w-full bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden flex flex-col",
|
|
2018
|
+
style: { height: "calc(100vh - 90px)" },
|
|
2019
|
+
children: [
|
|
2020
|
+
/* @__PURE__ */ l("div", { className: "flex items-center justify-between px-5 py-3.5 border-b border-gray-100 bg-white shrink-0", children: [
|
|
2021
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
2022
|
+
/* @__PURE__ */ a(
|
|
2023
|
+
"button",
|
|
2024
|
+
{
|
|
2025
|
+
className: "flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition -ml-1 shrink-0 cursor-pointer",
|
|
2026
|
+
onClick: z,
|
|
2027
|
+
children: /* @__PURE__ */ a(Qe, { size: 15 })
|
|
2028
|
+
}
|
|
2029
|
+
),
|
|
2030
|
+
/* @__PURE__ */ a(
|
|
2031
|
+
"div",
|
|
2032
|
+
{
|
|
2033
|
+
className: "flex items-center justify-center w-8 h-8 rounded-lg shrink-0",
|
|
2034
|
+
style: {
|
|
2035
|
+
background: "linear-gradient(135deg, #60a5fa, #818cf8)"
|
|
2036
|
+
},
|
|
2037
|
+
children: /* @__PURE__ */ a(Et, { size: 13, className: "text-white" })
|
|
2038
|
+
}
|
|
2039
|
+
),
|
|
2040
|
+
/* @__PURE__ */ l("div", { className: "min-w-0", children: [
|
|
2041
|
+
/* @__PURE__ */ a("div", { className: "font-semibold text-gray-800 text-sm leading-tight", children: "Article 详情" }),
|
|
2042
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-1 mt-0.5", children: /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1 px-1.5 py-0 rounded bg-blue-50 border border-blue-100 text-blue-600 font-mono text-xs leading-5 truncate max-w-[300px]", children: [
|
|
2043
|
+
/* @__PURE__ */ a(Wt, { size: 9 }),
|
|
2044
|
+
"/",
|
|
2045
|
+
m == null ? void 0 : m.pathname
|
|
2046
|
+
] }) })
|
|
2047
|
+
] })
|
|
2048
|
+
] }),
|
|
2049
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
2050
|
+
E === "preview" && /* @__PURE__ */ a("div", { className: "flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60", children: Ce.map((b) => /* @__PURE__ */ a(ye, { title: b.label, children: /* @__PURE__ */ a(
|
|
2051
|
+
"button",
|
|
2052
|
+
{
|
|
2053
|
+
className: `flex items-center justify-center w-7 h-6 rounded-md text-xs transition-all duration-150 select-none cursor-pointer ${H === b.key ? "bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50" : "text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,
|
|
2054
|
+
onClick: () => B(b.key),
|
|
2055
|
+
children: b.icon
|
|
2056
|
+
}
|
|
2057
|
+
) }, b.key)) }),
|
|
2058
|
+
/* @__PURE__ */ a("div", { className: "flex items-center bg-gray-100/80 rounded-lg p-0.5 gap-0.5 border border-gray-200/60", children: ["preview", "code"].map((b) => /* @__PURE__ */ a(
|
|
2059
|
+
"button",
|
|
2060
|
+
{
|
|
2061
|
+
className: `flex items-center gap-1.5 px-3 py-1 rounded-md text-xs font-medium transition-all duration-150 select-none cursor-pointer ${E === b ? "bg-white text-gray-800 shadow-sm ring-1 ring-gray-200/50" : "text-gray-400 hover:text-gray-600 hover:bg-white/50"}`,
|
|
2062
|
+
onClick: () => I(b),
|
|
2063
|
+
children: b === "preview" ? /* @__PURE__ */ l(pe, { children: [
|
|
2064
|
+
/* @__PURE__ */ a(Pe, { size: 11 }),
|
|
2065
|
+
" 预览"
|
|
2066
|
+
] }) : /* @__PURE__ */ l(pe, { children: [
|
|
2067
|
+
/* @__PURE__ */ a(Xe, { size: 11 }),
|
|
2068
|
+
" Code"
|
|
2069
|
+
] })
|
|
2070
|
+
},
|
|
2071
|
+
b
|
|
2072
|
+
)) }),
|
|
2073
|
+
E === "code" && /* @__PURE__ */ a(ye, { title: "复制代码", children: /* @__PURE__ */ a(
|
|
2074
|
+
"button",
|
|
2075
|
+
{
|
|
2076
|
+
className: "flex items-center justify-center w-7 h-7 rounded-lg text-gray-400 hover:text-blue-500 hover:bg-blue-50 transition cursor-pointer",
|
|
2077
|
+
onClick: T,
|
|
2078
|
+
children: /* @__PURE__ */ a(Dt, { size: 14 })
|
|
2079
|
+
}
|
|
2080
|
+
) })
|
|
2081
|
+
] })
|
|
2082
|
+
] }),
|
|
2083
|
+
/* @__PURE__ */ a(
|
|
2084
|
+
"div",
|
|
2085
|
+
{
|
|
2086
|
+
className: `flex-1 min-h-0 ${E === "preview" ? "bg-gray-100/70" : ""}`,
|
|
2087
|
+
children: E === "preview" ? /* @__PURE__ */ a("div", { className: "w-full h-full flex justify-center overflow-auto py-0", children: H !== "desktop" ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center py-6 h-full", children: /* @__PURE__ */ a(
|
|
2088
|
+
"iframe",
|
|
2089
|
+
{
|
|
2090
|
+
srcDoc: O(
|
|
2091
|
+
(m == null ? void 0 : m.content) || "",
|
|
2092
|
+
Ce.find(
|
|
2093
|
+
(b) => b.key === H
|
|
2094
|
+
).width
|
|
2095
|
+
),
|
|
2096
|
+
sandbox: "allow-same-origin allow-scripts",
|
|
2097
|
+
title: "HTML 预览",
|
|
2098
|
+
style: {
|
|
2099
|
+
width: `${Ce.find(
|
|
2100
|
+
(b) => b.key === H
|
|
2101
|
+
).width}px`,
|
|
2102
|
+
height: "100%",
|
|
2103
|
+
minHeight: 0,
|
|
2104
|
+
border: "1px solid #e5e7eb",
|
|
2105
|
+
borderRadius: 10,
|
|
2106
|
+
background: "#fff",
|
|
2107
|
+
boxShadow: "0 4px 24px 0 rgba(0,0,0,0.10)",
|
|
2108
|
+
flexShrink: 0
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
) }) : /* @__PURE__ */ a(
|
|
2112
|
+
"iframe",
|
|
2113
|
+
{
|
|
2114
|
+
srcDoc: O(
|
|
2115
|
+
(m == null ? void 0 : m.content) || ""
|
|
2116
|
+
),
|
|
2117
|
+
sandbox: "allow-same-origin allow-scripts",
|
|
2118
|
+
title: "HTML 预览",
|
|
2119
|
+
style: {
|
|
2120
|
+
width: "100%",
|
|
2121
|
+
height: "100%",
|
|
2122
|
+
border: "none",
|
|
2123
|
+
background: "#fff",
|
|
2124
|
+
display: "block"
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
) }) : /* @__PURE__ */ l(
|
|
2128
|
+
"div",
|
|
2129
|
+
{
|
|
2130
|
+
className: "h-full flex flex-col",
|
|
2131
|
+
style: { background: "#1e1e2e" },
|
|
2132
|
+
children: [
|
|
2133
|
+
/* @__PURE__ */ l(
|
|
2134
|
+
"div",
|
|
2135
|
+
{
|
|
2136
|
+
className: "shrink-0 flex items-center justify-between px-4 py-2 border-b",
|
|
2137
|
+
style: {
|
|
2138
|
+
borderColor: "#2d2d3e",
|
|
2139
|
+
background: "#252536"
|
|
2140
|
+
},
|
|
2141
|
+
children: [
|
|
2142
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
2143
|
+
/* @__PURE__ */ l("div", { className: "flex gap-1.5", children: [
|
|
2144
|
+
/* @__PURE__ */ a("span", { className: "w-3 h-3 rounded-full bg-red-400/80 inline-block" }),
|
|
2145
|
+
/* @__PURE__ */ a("span", { className: "w-3 h-3 rounded-full bg-yellow-400/80 inline-block" }),
|
|
2146
|
+
/* @__PURE__ */ a("span", { className: "w-3 h-3 rounded-full bg-green-400/80 inline-block" })
|
|
2147
|
+
] }),
|
|
2148
|
+
/* @__PURE__ */ a(
|
|
2149
|
+
"span",
|
|
2150
|
+
{
|
|
2151
|
+
className: "text-xs font-mono ml-2",
|
|
2152
|
+
style: { color: "#6c7086" },
|
|
2153
|
+
children: "index.html"
|
|
2154
|
+
}
|
|
2155
|
+
)
|
|
2156
|
+
] }),
|
|
2157
|
+
/* @__PURE__ */ a(
|
|
2158
|
+
"span",
|
|
2159
|
+
{
|
|
2160
|
+
className: "text-xs font-mono",
|
|
2161
|
+
style: { color: "#6c7086" },
|
|
2162
|
+
children: m != null && m.content ? `${m.content.split(`
|
|
2163
|
+
`).length} 行 · ${m.content.length} 字符` : "空"
|
|
2164
|
+
}
|
|
2165
|
+
)
|
|
2166
|
+
]
|
|
2167
|
+
}
|
|
2168
|
+
),
|
|
2169
|
+
/* @__PURE__ */ a("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ a(
|
|
2170
|
+
"pre",
|
|
2171
|
+
{
|
|
2172
|
+
className: "m-0 p-5 text-xs font-mono whitespace-pre-wrap break-all leading-relaxed",
|
|
2173
|
+
style: { color: "#cdd6f4" },
|
|
2174
|
+
children: (m == null ? void 0 : m.content) || /* @__PURE__ */ a("span", { style: { color: "#585b70" }, children: "// 暂无内容" })
|
|
2175
|
+
}
|
|
2176
|
+
) })
|
|
2177
|
+
]
|
|
2178
|
+
}
|
|
2179
|
+
)
|
|
2180
|
+
}
|
|
2181
|
+
),
|
|
2182
|
+
/* @__PURE__ */ l("div", { className: "shrink-0 flex items-center justify-between px-5 py-2.5 border-t border-gray-100 bg-gray-50/60", children: [
|
|
2183
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-4 text-xs text-gray-400", children: [
|
|
2184
|
+
(m == null ? void 0 : m.createdAt) && /* @__PURE__ */ l("span", { children: [
|
|
2185
|
+
"创建于",
|
|
2186
|
+
" ",
|
|
2187
|
+
De(m.createdAt).format("YYYY/MM/DD HH:mm")
|
|
2188
|
+
] }),
|
|
2189
|
+
(m == null ? void 0 : m.updatedAt) && /* @__PURE__ */ l("span", { children: [
|
|
2190
|
+
"更新于",
|
|
2191
|
+
" ",
|
|
2192
|
+
De(m.updatedAt).format("YYYY/MM/DD HH:mm")
|
|
2193
|
+
] })
|
|
2194
|
+
] }),
|
|
2195
|
+
/* @__PURE__ */ l(
|
|
2196
|
+
"button",
|
|
2197
|
+
{
|
|
2198
|
+
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs border border-gray-200 rounded-lg hover:bg-gray-50 text-gray-600 transition cursor-pointer",
|
|
2199
|
+
onClick: p,
|
|
2200
|
+
children: [
|
|
2201
|
+
/* @__PURE__ */ a(qt, { size: 12 }),
|
|
2202
|
+
"编辑"
|
|
2203
|
+
]
|
|
2204
|
+
}
|
|
2205
|
+
)
|
|
2206
|
+
] })
|
|
2207
|
+
]
|
|
2208
|
+
}
|
|
2209
|
+
);
|
|
2210
|
+
};
|
|
2211
|
+
export {
|
|
2212
|
+
kn as ArticleDetail,
|
|
2213
|
+
Nn as ArticleEdit,
|
|
2214
|
+
wn as ArticleList,
|
|
2215
|
+
xn as ArticlesProvider,
|
|
2216
|
+
vn as ReactRouterAdapter,
|
|
2217
|
+
Cn as createArticleService,
|
|
2218
|
+
ht as defaultArticleService,
|
|
2219
|
+
Sn as renderArticleByPathname
|
|
2220
|
+
};
|