@otwb/ui 2.0.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/dist/index.js ADDED
@@ -0,0 +1,1224 @@
1
+ import { n as useI18n, t as UI_I18N_INJECTION } from "./use-i18n-Dx7V4KrY.js";
2
+ import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDirectiveProvider } from "./directives-CRvPGywW.js";
3
+ import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-DcT-1dj4.js";
4
+ import { Fragment, computed, createVNode, defineComponent, inject, isVNode, mergeProps, provide, reactive, ref, renderSlot, shallowRef, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
5
+ import { computedAsync, promiseTimeout, useElementHover, useElementSize, useEventListener, useFullscreen, watchDebounced } from "@vueuse/core";
6
+ import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NText, NThing, useThemeVars } from "ithinkdt-ui";
7
+ import { useAtomicBroadcast } from "@otwb/common/composables";
8
+ import { RouterLink, useRouter } from "vue-router";
9
+ import { walkTree } from "@otwb/common/tree";
10
+ import { getOpaqueColor } from "@otwb/common/color";
11
+ import { format } from "date-fns";
12
+ function _isSlot$4(d) {
13
+ return typeof d == "function" || Object.prototype.toString.call(d) === "[object Object]" && !isVNode(d);
14
+ }
15
+ const AppAccount = /* @__PURE__ */ defineComponent({
16
+ name: "AppAccount",
17
+ props: {
18
+ username: String,
19
+ nickname: String,
20
+ head: String,
21
+ showLogoutButton: {
22
+ type: Boolean,
23
+ default: !0
24
+ },
25
+ showChangePwd: {
26
+ type: Boolean,
27
+ default: !0
28
+ }
29
+ },
30
+ emit: ["logout", "change-pwd"],
31
+ setup(z, { emit: V, slots: H }) {
32
+ let U = computed(() => /^[\u4E00-\u9FA5]+$/.test(z.nickname) ? z.nickname?.slice(z.nickname?.length > 3 ? 2 : 1) : z.nickname?.split(" ")[0]), { t: W } = useI18n(), G = createVNode(NIcon, { size: "28" }, { default: () => [createVNode("svg", {
33
+ xmlns: "http://www.w3.org/2000/svg",
34
+ width: "1em",
35
+ height: "1em",
36
+ viewBox: "-4 -4 32 32"
37
+ }, [createVNode("path", {
38
+ fill: "currentColor",
39
+ d: "M12 12q-1.65 0-2.825-1.175T8 8t1.175-2.825T12 4t2.825 1.175T16 8t-1.175 2.825T12 12m-8 6v-.8q0-.85.438-1.562T5.6 14.55q1.55-.775 3.15-1.162T12 13t3.25.388t3.15 1.162q.725.375 1.163 1.088T20 17.2v.8q0 .825-.587 1.413T18 20H6q-.825 0-1.412-.587T4 18"
40
+ }, null)])] }), K = createVNode("svg", {
41
+ xmlns: "http://www.w3.org/2000/svg",
42
+ width: "1em",
43
+ height: "1em",
44
+ viewBox: "0 0 24 24"
45
+ }, [createVNode("path", {
46
+ fill: "currentColor",
47
+ d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2a9.99 9.99 0 0 1 8 4h-2.71a8 8 0 1 0 .001 12h2.71A9.99 9.99 0 0 1 12 22m7-6v-3h-8v-2h8V8l5 4z"
48
+ }, null)]);
49
+ return () => createVNode("div", { style: "display: flex; align-items: center" }, [
50
+ createVNode(NPopover, { style: "padding: 4px" }, {
51
+ trigger: () => createVNode(NButton, {
52
+ quaternary: !0,
53
+ style: "--n-padding: 0 12px"
54
+ }, { default: () => [createVNode("div", { style: "display: flex; align-items: center; gap: 8px" }, [createVNode(NAvatar, {
55
+ key: z.head ? "head" : "no-head",
56
+ src: z.head,
57
+ round: !0,
58
+ size: "small",
59
+ radix: .78,
60
+ color: "var(--color-primary-hover)"
61
+ }, {
62
+ fallback: () => G,
63
+ placeholder: () => G,
64
+ default: z.head ? void 0 : () => U.value
65
+ }), createVNode("span", { style: "font-size: 14px" }, [z.username ?? ""])])] }),
66
+ default: () => {
67
+ let d = () => z.showChangePwd ? createVNode(NButton, {
68
+ quaternary: !0,
69
+ style: "justify-content: left",
70
+ onClick: () => V("change-pwd")
71
+ }, {
72
+ icon: () => createVNode(NIcon, null, { default: () => [createVNode("svg", {
73
+ xmlns: "http://www.w3.org/2000/svg",
74
+ width: "1em",
75
+ height: "1em",
76
+ viewBox: "0 0 32 32"
77
+ }, [createVNode("path", {
78
+ fill: "currentColor",
79
+ d: "M21 2a8.998 8.998 0 0 0-8.612 11.612L2 24v6h6l10.388-10.388A9 9 0 1 0 21 2m0 16a7 7 0 0 1-2.032-.302l-1.147-.348l-.847.847l-3.181 3.181L12.414 20L11 21.414l1.379 1.379l-1.586 1.586L9.414 23L8 24.414l1.379 1.379L7.172 28H4v-3.172l9.802-9.802l.848-.847l-.348-1.147A7 7 0 1 1 21 18"
80
+ }, null), createVNode("circle", {
81
+ cx: "22",
82
+ cy: "10",
83
+ r: "2",
84
+ fill: "currentColor"
85
+ }, null)])] }),
86
+ default: () => W("common.account.changePwd")
87
+ }) : void 0, B = () => z.showLogoutButton ? void 0 : createVNode(NButton, {
88
+ quaternary: !0,
89
+ style: "justify-content: left",
90
+ onClick: () => V("logout")
91
+ }, {
92
+ icon: () => createVNode(NIcon, null, _isSlot$4(K) ? K : { default: () => [K] }),
93
+ default: () => W("common.account.logout")
94
+ });
95
+ return H.dropdown ? H.dropdown({
96
+ pwd: d,
97
+ logout: B
98
+ }) : createVNode("div", { style: "display: flex; flex-direction: column" }, [
99
+ d(),
100
+ H.dropdownExtra?.(),
101
+ B()
102
+ ]);
103
+ }
104
+ }),
105
+ H.extra?.(),
106
+ z.showLogoutButton ? withDirectives(createVNode(NButton, {
107
+ quaternary: !0,
108
+ style: "--n-padding: 0 12px",
109
+ onClick: () => z.username && V("logout")
110
+ }, { default: () => [H.logoutButton?.() ?? createVNode(NIcon, { size: "16" }, _isSlot$4(K) ? K : { default: () => [K] })] }), [[
111
+ vTooltip,
112
+ W("common.account.logout"),
113
+ void 0,
114
+ { "bottom-end": !0 }
115
+ ]]) : void 0
116
+ ]);
117
+ }
118
+ }), AppAppearance = /* @__PURE__ */ defineComponent({
119
+ name: "AppAppearance",
120
+ props: { mode: String },
121
+ emit: ["update:mode"],
122
+ setup(z, { emit: V }) {
123
+ let { t: H } = useI18n();
124
+ return () => withDirectives(createVNode(NButton, {
125
+ quaternary: !0,
126
+ style: "--n-padding: 0 12px",
127
+ onClick: () => {
128
+ V("update:mode", z.mode === "light" ? "dark" : z.mode === "dark" ? "auto" : "light");
129
+ }
130
+ }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [z.mode === "light" ? createVNode("svg", {
131
+ xmlns: "http://www.w3.org/2000/svg",
132
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
133
+ role: "img",
134
+ width: "1em",
135
+ height: "1em",
136
+ viewBox: "0 0 24 24"
137
+ }, [createVNode("path", {
138
+ fill: "currentColor",
139
+ d: "M12 15q1.25 0 2.125-.875T15 12q0-1.25-.875-2.125T12 9q-1.25 0-2.125.875T9 12q0 1.25.875 2.125T12 15Zm0 2q-2.075 0-3.537-1.463Q7 14.075 7 12t1.463-3.538Q9.925 7 12 7t3.538 1.462Q17 9.925 17 12q0 2.075-1.462 3.537Q14.075 17 12 17ZM1 13v-2h4v2Zm18 0v-2h4v2Zm-8-8V1h2v4Zm0 18v-4h2v4ZM6.35 7.75L3.875 5.275l1.4-1.4L7.75 6.35Zm12.375 12.375L16.25 17.65l1.4-1.4l2.475 2.475ZM17.65 7.75l-1.4-1.4l2.475-2.475l1.4 1.4ZM5.275 20.125l-1.4-1.4L6.35 16.25l1.4 1.4ZM12 12Z"
140
+ }, null)]) : z.mode === "dark" ? createVNode("svg", {
141
+ xmlns: "http://www.w3.org/2000/svg",
142
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
143
+ role: "img",
144
+ width: "1em",
145
+ height: "1em",
146
+ viewBox: "0 0 24 24"
147
+ }, [createVNode("path", {
148
+ fill: "currentColor",
149
+ d: "M12 21q-3.75 0-6.375-2.625T3 12q0-3.75 2.625-6.375T12 3q.35 0 .688.025q.337.025.662.075q-1.025.725-1.637 1.887Q11.1 6.15 11.1 7.5q0 2.25 1.575 3.825Q14.25 12.9 16.5 12.9q1.375 0 2.525-.613q1.15-.612 1.875-1.637q.05.325.075.662Q21 11.65 21 12q0 3.75-2.625 6.375T12 21Zm0-2q2.2 0 3.95-1.212q1.75-1.213 2.55-3.163q-.5.125-1 .2q-.5.075-1 .075q-3.075 0-5.238-2.162Q9.1 10.575 9.1 7.5q0-.5.075-1t.2-1q-1.95.8-3.162 2.55Q5 9.8 5 12q0 2.9 2.05 4.95Q9.1 19 12 19Zm-.25-6.75Z"
150
+ }, null)]) : createVNode("svg", {
151
+ xmlns: "http://www.w3.org/2000/svg",
152
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
153
+ role: "img",
154
+ width: "1em",
155
+ height: "1em",
156
+ viewBox: "0 0 24 24"
157
+ }, [createVNode("path", {
158
+ fill: "currentColor",
159
+ d: "M11 19q1.35 0 2.513-.538q1.162-.537 1.987-1.487q-3.15-.2-5.325-2.488Q8 12.2 8 9q0-.325.025-.638q.025-.312.075-.612q-1.4.775-2.25 2.162Q5 11.3 5 13q0 2.5 1.75 4.25T11 19Zm0 2q-3.35 0-5.675-2.325Q3 16.35 3 13q0-3.35 2.325-5.675Q7.65 5 11 5q.125 0 .25.012q.125.013.25.013q-.725.8-1.113 1.812Q10 7.85 10 9q0 2.5 1.75 4.25T16 15q.8 0 1.525-.2q.725-.2 1.375-.55q-.45 2.875-2.662 4.812Q14.025 21 11 21Zm2.8-10L17 2h2l3.2 9h-1.9l-.7-2h-3.2l-.7 2Zm3.05-3.35h2.3L18 4Z"
160
+ }, null)])] })] }), [[
161
+ vTooltip,
162
+ z.mode === "light" ? H("common.layout.mode.light") : z.mode === "dark" ? H("common.layout.mode.dark") : H("common.layout.mode.auto"),
163
+ void 0,
164
+ { bottom: !0 }
165
+ ]]);
166
+ }
167
+ }), COLLAPSED_INJECTION_KEY = "APP_SIDER_COLLAPSED", IBookmark = () => createVNode("svg", {
168
+ xmlns: "http://www.w3.org/2000/svg",
169
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
170
+ role: "img",
171
+ width: "1em",
172
+ height: "1em",
173
+ viewBox: "0 0 24 24"
174
+ }, [createVNode("path", {
175
+ fill: "currentColor",
176
+ d: "m17 18l-5-2.18L7 18V5h10m0-2H7a2 2 0 0 0-2 2v16l7-3l7 3V5a2 2 0 0 0-2-2Z"
177
+ }, null)]), CTX_INJECTION_KEY = "__APP_CTX__", getCtx = () => inject(CTX_INJECTION_KEY);
178
+ function _isSlot$3(d) {
179
+ return typeof d == "function" || Object.prototype.toString.call(d) === "[object Object]" && !isVNode(d);
180
+ }
181
+ const AppBreadcrumb = /* @__PURE__ */ defineComponent({
182
+ name: "AppBreadcrumb",
183
+ props: {
184
+ items: {
185
+ type: Array,
186
+ default: () => []
187
+ },
188
+ getIcon: {
189
+ type: Function,
190
+ default: void 0
191
+ }
192
+ },
193
+ setup(d) {
194
+ let z = useRouter(), B = Symbol(), V = Symbol();
195
+ return watch(() => d.items, (z) => {
196
+ walkTree(z, (z) => {
197
+ z.icon && (typeof z.icon == "string" ? (z[B] = d.getIcon?.(z.icon), z[V] = () => z[B]?.() || IBookmark()) : z[V] = z.icon);
198
+ });
199
+ }, { immediate: !0 }), () => {
200
+ let B;
201
+ return createVNode(NBreadcrumb, null, _isSlot$3(B = d.items.map((d) => createVNode(NBreadcrumbItem, {
202
+ clickable: d.href?.length > 0,
203
+ separator: d.separator,
204
+ onClick: d.href && ((B) => {
205
+ B.stopPropagation(), z.push(d.href);
206
+ })
207
+ }, { default: () => [d.icon ? createVNode(Fragment, null, [createVNode(NIcon, { component: d[V] }, null), " "]) : void 0, toValue(d.title)] }))) ? B : { default: () => [B] });
208
+ };
209
+ }
210
+ }), AppFullscreen = /* @__PURE__ */ defineComponent({
211
+ name: "AppFullscreen",
212
+ props: {},
213
+ emit: ["change"],
214
+ setup(z, { emit: V }) {
215
+ let { t: H } = useI18n(), { isFullscreen: U, toggle: W } = useFullscreen();
216
+ return () => withDirectives(createVNode(NButton, {
217
+ quaternary: !0,
218
+ style: "--n-padding: 0 12px",
219
+ onClick: () => {
220
+ W(), V("change", U.value);
221
+ }
222
+ }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [U.value ? createVNode("svg", {
223
+ xmlns: "http://www.w3.org/2000/svg",
224
+ width: "1em",
225
+ height: "1em",
226
+ viewBox: "0 0 24 24"
227
+ }, [createVNode("path", {
228
+ fill: "none",
229
+ stroke: "currentColor",
230
+ "stroke-linecap": "round",
231
+ "stroke-linejoin": "round",
232
+ "stroke-width": "1.5",
233
+ d: "M8.345 3.75v2.095a2.5 2.5 0 0 1-2.5 2.5H3.75M8.345 20.25v-2.095a2.5 2.5 0 0 0-2.5-2.5H3.75M15.655 3.75v2.095a2.5 2.5 0 0 0 2.5 2.5h2.095M15.655 20.25v-2.095a2.5 2.5 0 0 1 2.5-2.5h2.095"
234
+ }, null)]) : createVNode("svg", {
235
+ xmlns: "http://www.w3.org/2000/svg",
236
+ width: "1em",
237
+ height: "1em",
238
+ viewBox: "0 0 24 24"
239
+ }, [createVNode("path", {
240
+ fill: "none",
241
+ stroke: "currentColor",
242
+ "stroke-linecap": "round",
243
+ "stroke-linejoin": "round",
244
+ "stroke-width": "1.5",
245
+ d: "M3.75 8.345V6.25a2.5 2.5 0 0 1 2.5-2.5h2.095M3.75 15.655v2.095a2.5 2.5 0 0 0 2.5 2.5h2.095M20.25 8.345V6.25a2.5 2.5 0 0 0-2.5-2.5h-2.095m4.595 11.905v2.095a2.5 2.5 0 0 1-2.5 2.5h-2.095"
246
+ }, null)])] })] }), [[
247
+ vTooltip,
248
+ U.value ? H("common.layout.screen.exitfull") : H("common.layout.screen.full"),
249
+ void 0,
250
+ { bottom: !0 }
251
+ ]]);
252
+ }
253
+ }), AppLanguage = /* @__PURE__ */ defineComponent({
254
+ name: "AppLanguage",
255
+ props: {
256
+ lang: String,
257
+ supports: Array
258
+ },
259
+ emit: ["update:lang"],
260
+ setup(d, { emit: z }) {
261
+ return () => createVNode(NDropdown, {
262
+ options: d.supports,
263
+ keyField: "value",
264
+ showArrow: !0,
265
+ onSelect: (d) => z("update:lang", d)
266
+ }, { default: () => [createVNode(NButton, {
267
+ quaternary: !0,
268
+ style: "--n-padding: 0 12px"
269
+ }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [createVNode("svg", {
270
+ xmlns: "http://www.w3.org/2000/svg",
271
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
272
+ role: "img",
273
+ width: "1em",
274
+ height: "1em",
275
+ viewBox: "0 0 24 24"
276
+ }, [createVNode("g", {
277
+ fill: "none",
278
+ stroke: "currentColor",
279
+ "stroke-linecap": "round",
280
+ "stroke-linejoin": "round",
281
+ "stroke-width": "1.5"
282
+ }, [createVNode("path", { d: "M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2S2 6.477 2 12Z" }, null), createVNode("path", { d: "M13 2.05S16 6 16 12c0 6-3 9.95-3 9.95m-2 0S8 18 8 12c0-6 3-9.95 3-9.95M2.63 15.5h18.74m-18.74-7h18.74" }, null)])])] })] })] });
283
+ }
284
+ });
285
+ var style = /* @__PURE__ */ c([
286
+ cB("layout", {
287
+ display: "grid",
288
+ gridTemplateAreas: "\n 'sider header'\n 'sider content'\n 'sider footer'\n ",
289
+ gridTemplateRows: "auto 1fr auto",
290
+ gridTemplateColumns: "auto 1fr",
291
+ position: "relative",
292
+ top: "0",
293
+ left: "0",
294
+ transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
295
+ "--app-content-height": "calc(100vh - var(--app-header-height) - var(--app-footer-height))"
296
+ }, [cM("full-header", { gridTemplateAreas: "\n 'header header'\n 'sider content'\n 'sider footer'\n " }), cM("full-content", {
297
+ width: "calc(100% + var(--app-sider-width))",
298
+ height: "calc(100% + var(--app-header-height))",
299
+ left: "calc(-1 * var(--app-sider-width))",
300
+ top: "calc(-1 * var(--app-header-height))"
301
+ })]),
302
+ cB("header", {
303
+ gridArea: "header",
304
+ overflow: "hidden",
305
+ zIndex: 2,
306
+ height: "var(--app-header-height, 44px)",
307
+ zIndex: "2"
308
+ }),
309
+ cB("sider", {
310
+ gridArea: "sider",
311
+ width: "var(--app-sider-width, 220px)",
312
+ display: "flex",
313
+ flexDirection: "column",
314
+ overflow: "auto",
315
+ position: "relative",
316
+ transition: "width 0.2s ease-in-out",
317
+ zIndex: "2"
318
+ }, [cE("collapse-btn", {
319
+ "--n-padding": "0 12px",
320
+ position: "absolute",
321
+ zIndex: "2",
322
+ bottom: "8px",
323
+ right: "8px"
324
+ })]),
325
+ cB("content", {
326
+ gridArea: "content",
327
+ position: "relative",
328
+ overflow: "hidden",
329
+ zIndex: "1"
330
+ }),
331
+ cB("footer", {
332
+ gridArea: "footer",
333
+ lineHeight: "32px",
334
+ textAlign: "center",
335
+ color: "gray"
336
+ })
337
+ ]), IFold = () => createVNode("svg", {
338
+ xmlns: "http://www.w3.org/2000/svg",
339
+ width: "1em",
340
+ height: "1em",
341
+ viewBox: "0 0 24 24"
342
+ }, [createVNode("path", {
343
+ fill: "none",
344
+ stroke: "currentColor",
345
+ "stroke-linecap": "round",
346
+ "stroke-linejoin": "round",
347
+ "stroke-width": "1.5",
348
+ d: "M11.5 18s-6-4.419-6-6s6-6 6-6m7 12s-6-4.419-6-6s6-6 6-6",
349
+ color: "currentColor"
350
+ }, null)]), IUnfold = () => createVNode("svg", {
351
+ xmlns: "http://www.w3.org/2000/svg",
352
+ width: "1em",
353
+ height: "1em",
354
+ viewBox: "0 0 24 24"
355
+ }, [createVNode("path", {
356
+ fill: "none",
357
+ stroke: "currentColor",
358
+ "stroke-linecap": "round",
359
+ "stroke-linejoin": "round",
360
+ "stroke-width": "1.5",
361
+ d: "M12.5 18s6-4.419 6-6s-6-6-6-6m-7 12s6-4.419 6-6s-6-6-6-6",
362
+ color: "currentColor"
363
+ }, null)]);
364
+ const AppLayout = /* @__PURE__ */ defineComponent({
365
+ name: "AppLayout",
366
+ props: {
367
+ layout: {
368
+ type: String,
369
+ default: "left2right"
370
+ },
371
+ fullContent: Boolean
372
+ },
373
+ setup(d, { slots: z }) {
374
+ useStyle("-layout", style, ref("app"), !1);
375
+ let B = reactive({
376
+ siderWidth: "0px",
377
+ headerHeight: "0px",
378
+ footerHeight: "0px",
379
+ hasMultiTab: !1
380
+ });
381
+ return provide(CTX_INJECTION_KEY, B), () => {
382
+ let { layout: V } = d;
383
+ return createVNode("div", {
384
+ class: {
385
+ "app-layout": !0,
386
+ "app-layout--full-header": V === "top2bottom",
387
+ "app-layout--full-content": d.fullContent
388
+ },
389
+ style: {
390
+ "--app-sider-width": B.siderWidth,
391
+ "--app-header-height": B.headerHeight,
392
+ "--app-footer-height": B.footerHeight
393
+ }
394
+ }, [renderSlot(z, "default")]);
395
+ };
396
+ }
397
+ }), AppHeader = /* @__PURE__ */ defineComponent({
398
+ name: "AppHeader",
399
+ props: { height: {
400
+ type: Number,
401
+ default: 44
402
+ } },
403
+ setup(d, { slots: z }) {
404
+ let B = getCtx();
405
+ return () => (B.headerHeight = d.height + "px", createVNode("div", { class: "app-header" }, [renderSlot(z, "default")]));
406
+ }
407
+ }), AppSider = /* @__PURE__ */ defineComponent({
408
+ name: "AppSider",
409
+ props: {
410
+ showCollapseBtn: {
411
+ type: Boolean,
412
+ default: !0
413
+ },
414
+ collapsed: Boolean,
415
+ width: {
416
+ type: Number,
417
+ default: 220
418
+ },
419
+ collapsedWidth: {
420
+ type: Number,
421
+ default: 60
422
+ }
423
+ },
424
+ emits: { "update:collapsed": () => !0 },
425
+ setup(z, { emit: V, slots: H }) {
426
+ provide(COLLAPSED_INJECTION_KEY, toRef(z, "collapsed"));
427
+ let { t: U } = useI18n(), W = getCtx();
428
+ return () => (W.siderWidth = (z.collapsed ? z.collapsedWidth : z.width) + "px", createVNode("div", { class: "app-sider" }, [renderSlot(H, "default"), z.showCollapseBtn ? withDirectives(createVNode(NButton, {
429
+ class: "app-sider__collapse-btn",
430
+ quaternary: !0,
431
+ onClick: () => {
432
+ V("update:collapsed", !z.collapsed);
433
+ }
434
+ }, { default: () => [createVNode(NIcon, { size: "20" }, { default: () => [z.collapsed ? createVNode(IUnfold, null, null) : createVNode(IFold, null, null)] })] }), [[vTooltip, z.collapsed ? U("common.layout.sider.expand") : U("common.layout.sider.collapse")]]) : void 0]));
435
+ }
436
+ }), AppContent = /* @__PURE__ */ defineComponent({
437
+ name: "AppContent",
438
+ setup(d, { slots: z }) {
439
+ return () => createVNode("div", { class: "app-content" }, [renderSlot(z, "default")]);
440
+ }
441
+ }), AppFooter = /* @__PURE__ */ defineComponent({
442
+ name: "AppFooter",
443
+ props: { height: {
444
+ type: Number,
445
+ default: 30
446
+ } },
447
+ setup(d, { slots: z }) {
448
+ let B = getCtx();
449
+ return () => (B.footerHeight = d.height + "px", createVNode("div", { class: "app-footer" }, [renderSlot(z, "default")]));
450
+ }
451
+ });
452
+ function _isSlot$2(d) {
453
+ return typeof d == "function" || Object.prototype.toString.call(d) === "[object Object]" && !isVNode(d);
454
+ }
455
+ const AppLogo = /* @__PURE__ */ defineComponent({
456
+ name: "AppLogo",
457
+ props: {
458
+ src: [String, Function],
459
+ name: String,
460
+ collapsed: {
461
+ type: Boolean,
462
+ default: void 0
463
+ },
464
+ center: {
465
+ type: Boolean,
466
+ default: !1
467
+ },
468
+ link: {
469
+ type: Boolean,
470
+ default: !0
471
+ }
472
+ },
473
+ setup(d, { slots: z }) {
474
+ let B = computedAsync(() => typeof d.src == "function" ? d.src() : d.src), V = inject(COLLAPSED_INJECTION_KEY, !1);
475
+ return () => {
476
+ let { name: H, collapsed: U, center: W, link: G } = d;
477
+ U ??= unref(V);
478
+ let K = U ? 1 : 1 / 1.1;
479
+ return createVNode("div", {
480
+ class: "app-logo",
481
+ style: {
482
+ "--app-logo-img-size": "32px",
483
+ "--app-logo-name-size": "22px",
484
+ width: W ? "100%" : "auto",
485
+ overflow: "hidden",
486
+ display: "flex",
487
+ alignItems: "center",
488
+ justifyContent: W ? "center" : "flex-start",
489
+ cursor: G ? "pointer" : void 0
490
+ }
491
+ }, [z.default ? z.default() : createVNode("div", {
492
+ class: "app-logo__img",
493
+ style: `
494
+ width: ${U ? "var(--app-sider-width, 60px)" : "56px"};
495
+ font-size: ${U ? "calc(var(--app-sider-width, 60px) - 24px)" : "32px"};
496
+ transition: width 0.2s ease-in-out 0.1s;
497
+ flex: 0 0 auto;
498
+ display: flex;
499
+ justify-content: center
500
+ `
501
+ }, [z.icon ? z.icon() : createVNode("img", {
502
+ src: B.value,
503
+ alt: "App Logo",
504
+ style: `transition: height 0.2s ease-in-out; height: calc(var(--app-logo-img-size) * ${K})`
505
+ }, null)]), H ? createVNode(NText, {
506
+ class: "app-logo__name",
507
+ style: "font-size: var(--app-logo-name-size); font-weight: bold; white-space: nowrap; flex: 0 1 auto; overflow: hidden"
508
+ }, _isSlot$2(H) ? H : { default: () => [H] }) : ""]);
509
+ };
510
+ }
511
+ });
512
+ function _isSlot$1(d) {
513
+ return typeof d == "function" || Object.prototype.toString.call(d) === "[object Object]" && !isVNode(d);
514
+ }
515
+ const AppMenu = /* @__PURE__ */ defineComponent({
516
+ name: "AppMenu",
517
+ props: {
518
+ menus: Array,
519
+ getIcon: Function,
520
+ current: String,
521
+ horizontal: Boolean,
522
+ single: Boolean,
523
+ accordion: Boolean,
524
+ collapsed: {
525
+ type: Boolean,
526
+ default: void 0
527
+ },
528
+ renderLabel: Function,
529
+ width: {
530
+ type: Number,
531
+ default: 220
532
+ },
533
+ collapsedWidth: {
534
+ type: Number,
535
+ default: 60
536
+ }
537
+ },
538
+ setup(d) {
539
+ let z = shallowRef([]);
540
+ watch([() => d.menus, () => d.single], ([B, V]) => {
541
+ if (z.value = [], !B?.length) return;
542
+ let H = (z, B = 0) => {
543
+ let U = [];
544
+ for (let W of z) {
545
+ if (W.type === "action") continue;
546
+ let z = W.type === "view" ? void 0 : H(W.children ?? [], B + 1), G = {
547
+ _: W,
548
+ key: W.key,
549
+ label: () => d.renderLabel?.(W) ?? W.name,
550
+ icon: B === 0 || W.icon ? d.getIcon?.(W.icon) ?? IBookmark : void 0,
551
+ children: V ? void 0 : z,
552
+ path: W.path || (V ? z?.[0]?.path : void 0),
553
+ depth: B
554
+ };
555
+ delete G.type, U.push(G);
556
+ }
557
+ return U;
558
+ };
559
+ z.value = H(B);
560
+ }, { immediate: !0 }), watch([useTemplateRef("menu"), () => d.current], ([d, z]) => {
561
+ d?.showOption(z);
562
+ }, { immediate: !0 });
563
+ let V = inject(COLLAPSED_INJECTION_KEY, !1), H = (z) => {
564
+ let H = d.collapsed ?? unref(V), U;
565
+ if (z._.type === "view") if (z.isExternal && z.externalEmbed) U = createVNode("a", {
566
+ href: z.externalLink,
567
+ target: "_blank",
568
+ onClick: (d) => d.stopPropagation()
569
+ }, [z.label()]);
570
+ else {
571
+ let d;
572
+ U = createVNode(RouterLink, { to: z.path }, _isSlot$1(d = z.label()) ? d : { default: () => [d] });
573
+ }
574
+ else U = createVNode("span", null, [z.label()]);
575
+ return U.key = `${z.key}:${H ? 1 : 0}`, z.depth === 0 && !H && (U = withDirectives(U, [[
576
+ vTooltip,
577
+ z.label(),
578
+ void 0,
579
+ {
580
+ auto: !0,
581
+ right: !0
582
+ }
583
+ ]])), z.isNew && (U = createVNode("div", { style: "display: flex; width: 100%" }, [createVNode("span", { style: "flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis" }, [U]), createVNode("svg", {
584
+ xmlns: "http://www.w3.org/2000/svg",
585
+ width: "24",
586
+ height: "24",
587
+ viewBox: "0 0 1024 1024",
588
+ style: "margin-left: 8px; flex: 0 0 auto;"
589
+ }, [createVNode("path", {
590
+ d: "M245.76 286.72h552.96c124.928 0 225.28 100.352 225.28 225.28s-100.352 225.28-225.28 225.28H0V532.48c0-135.168 110.592-245.76 245.76-245.76z m133.12 348.16V401.408H348.16v178.176l-112.64-178.176H204.8V634.88h30.72v-178.176L348.16 634.88h30.72z m182.272-108.544v-24.576h-96.256v-75.776h110.592v-24.576h-141.312V634.88h143.36v-24.576h-112.64v-83.968h96.256z m100.352 28.672l-34.816-151.552h-34.816l55.296 233.472H675.84l47.104-161.792 4.096-20.48 4.096 20.48 47.104 161.792h28.672l57.344-233.472h-34.816l-32.768 151.552-4.096 30.72-6.144-30.72-40.96-151.552h-30.72l-40.96 151.552-6.144 30.72-6.144-30.72z",
591
+ fill: "var(--color-danger)"
592
+ }, null)])])), U;
593
+ };
594
+ return () => {
595
+ let B = createVNode(NMenu, {
596
+ ref: "menu",
597
+ options: z.value,
598
+ rootIndent: 16,
599
+ accordion: d.accordion,
600
+ collapsed: d.collapsed ?? unref(V),
601
+ dropdownProps: { showArrow: !0 },
602
+ mode: d.horizontal ? "horizontal" : "vertical",
603
+ value: d.current ?? null,
604
+ renderLabel: H,
605
+ responsive: !0,
606
+ collapsedWidth: d.collapsedWidth,
607
+ width: d.width
608
+ }, null);
609
+ return d.horizontal ? B : createVNode(NScrollbar, null, _isSlot$1(B) ? B : { default: () => [B] });
610
+ };
611
+ }
612
+ });
613
+ function useCtxMenu(z, B, V) {
614
+ let { t: H } = useI18n(), U = reactive({
615
+ visible: !1,
616
+ x: 0,
617
+ y: 0
618
+ }), W = async (d, z) => {
619
+ d.preventDefault(), d.stopPropagation(), !(U.visible && U.tab === z) && (U.tab = z, U.visible && (U.visible = !1, await promiseTimeout(130)), U.visible = !0, U.x = d.clientX, U.y = d.clientY);
620
+ }, G = async () => {
621
+ requestIdleCallback(() => {
622
+ U.visible = !1;
623
+ }, { timeout: 30 });
624
+ }, K = useRouter();
625
+ return {
626
+ ctx: U,
627
+ onCtx: W,
628
+ onClickoutside: G,
629
+ options: computed(() => [
630
+ {
631
+ key: "reload",
632
+ label: H("common.layout.tabs.reloadTab"),
633
+ disabled: U.tab && U.tab.key !== B.value,
634
+ icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
635
+ xmlns: "http://www.w3.org/2000/svg",
636
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
637
+ role: "img",
638
+ width: "1em",
639
+ height: "1em",
640
+ viewBox: "0 0 24 24"
641
+ }, [createVNode("path", {
642
+ fill: "currentColor",
643
+ d: "M17.65 6.35A7.958 7.958 0 0 0 12 4a8 8 0 0 0-8 8a8 8 0 0 0 8 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18a6 6 0 0 1-6-6a6 6 0 0 1 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35Z"
644
+ }, null)])] })
645
+ },
646
+ {
647
+ key: "fullTab",
648
+ label: H("common.layout.tabs.fullTab"),
649
+ icon: () => createVNode(NIcon, { size: 16 }, { default: () => [createVNode("svg", {
650
+ xmlns: "http://www.w3.org/2000/svg",
651
+ width: "1em",
652
+ height: "1em",
653
+ viewBox: "0 0 24 24"
654
+ }, [createVNode("path", {
655
+ fill: "currentColor",
656
+ "fill-rule": "evenodd",
657
+ d: "M18.29 2.89c-1.028-.138-2.383-.14-4.29-.14a.75.75 0 0 1 0-1.5h.056c1.838 0 3.294 0 4.433.153c1.172.158 2.121.49 2.87 1.238c.748.749 1.08 1.698 1.238 2.87c.153 1.14.153 2.595.153 4.433V10a.75.75 0 0 1-1.5 0c0-1.907-.002-3.261-.14-4.29c-.135-1.005-.389-1.585-.812-2.008s-1.003-.677-2.009-.812M2 13.25a.75.75 0 0 1 .75.75c0 1.907.002 3.262.14 4.29c.135 1.005.389 1.585.812 2.008s1.003.677 2.009.812c1.028.138 2.382.14 4.289.14a.75.75 0 0 1 0 1.5h-.056c-1.838 0-3.294 0-4.433-.153c-1.172-.158-2.121-.49-2.87-1.238c-.748-.749-1.08-1.698-1.238-2.87c-.153-1.14-.153-2.595-.153-4.433V14a.75.75 0 0 1 .75-.75",
658
+ "clip-rule": "evenodd"
659
+ }, null), createVNode("path", {
660
+ fill: "currentColor",
661
+ d: "M9.944 1.25H10a.75.75 0 0 1 0 1.5c-1.907 0-3.261.002-4.29.14c-1.005.135-1.585.389-2.008.812S3.025 4.705 2.89 5.71c-.138 1.029-.14 2.383-.14 4.29a.75.75 0 0 1-1.5 0v-.056c0-1.838 0-3.294.153-4.433c.158-1.172.49-2.121 1.238-2.87c.749-.748 1.698-1.08 2.87-1.238c1.14-.153 2.595-.153 4.433-.153M22 13.25a.75.75 0 0 1 .75.75v.056c0 1.838 0 3.294-.153 4.433c-.158 1.172-.49 2.121-1.238 2.87c-.749.748-1.698 1.08-2.87 1.238c-1.14.153-2.595.153-4.433.153H14a.75.75 0 0 1 0-1.5c1.907 0 3.262-.002 4.29-.14c1.005-.135 1.585-.389 2.008-.812s.677-1.003.812-2.009c.138-1.027.14-2.382.14-4.289a.75.75 0 0 1 .75-.75",
662
+ opacity: ".5"
663
+ }, null)])] })
664
+ },
665
+ {
666
+ key: "open",
667
+ label: H("common.layout.tabs.openTabBlank"),
668
+ disabled: U.tab?.key !== B.value,
669
+ icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
670
+ xmlns: "http://www.w3.org/2000/svg",
671
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
672
+ role: "img",
673
+ width: "1em",
674
+ height: "1em",
675
+ viewBox: "0 0 15 15"
676
+ }, [createVNode("path", {
677
+ fill: "currentColor",
678
+ "clip-rule": "evenodd",
679
+ "fill-rule": "evenodd",
680
+ d: "M12 13a1 1 0 0 0 1-1V3a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v3.5a.5.5 0 0 0 1 0V3h9v9H8.5a.5.5 0 0 0 0 1H12ZM9 6.5v3a.5.5 0 0 1-1 0V7.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 7H5.5a.5.5 0 0 1 0-1h3a.498.498 0 0 1 .5.497"
681
+ }, null)])] })
682
+ },
683
+ {
684
+ key: "closeAll",
685
+ label: H("common.layout.tabs.closeAllTabs"),
686
+ icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
687
+ xmlns: "http://www.w3.org/2000/svg",
688
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
689
+ role: "img",
690
+ width: "1em",
691
+ height: "1em",
692
+ viewBox: "0 0 24 24"
693
+ }, [createVNode("path", {
694
+ fill: "currentColor",
695
+ d: "M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6L6.4 19Z"
696
+ }, null)])] })
697
+ },
698
+ {
699
+ key: "closeLeft",
700
+ label: H("common.layout.tabs.closeLeftTabs"),
701
+ disabled: !U.tab,
702
+ icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
703
+ xmlns: "http://www.w3.org/2000/svg",
704
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
705
+ role: "img",
706
+ width: "1em",
707
+ height: "1em",
708
+ viewBox: "0 0 24 24"
709
+ }, [createVNode("path", {
710
+ fill: "currentColor",
711
+ d: "M11 16v-3h10v-2H11V8l-4 4l4 4m-8 4h2V4H3v16Z"
712
+ }, null)])] })
713
+ },
714
+ {
715
+ key: "closeRight",
716
+ label: H("common.layout.tabs.closeRightTabs"),
717
+ disabled: !U.tab,
718
+ icon: () => createVNode(NIcon, { size: 20 }, { default: () => [createVNode("svg", {
719
+ xmlns: "http://www.w3.org/2000/svg",
720
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
721
+ role: "img",
722
+ width: "1em",
723
+ height: "1em",
724
+ viewBox: "0 0 24 24"
725
+ }, [createVNode("path", {
726
+ fill: "currentColor",
727
+ d: "M13 8v3H3v2h10v3l4-4l-4-4m6 12h2V4h-2v16Z"
728
+ }, null)])] })
729
+ },
730
+ {
731
+ key: "closeOther",
732
+ label: H("common.layout.tabs.closeOtherTabs"),
733
+ disabled: !U.tab,
734
+ icon: () => createVNode(NIcon, { size: 20 }, { default: () => [" ", createVNode("svg", {
735
+ xmlns: "http://www.w3.org/2000/svg",
736
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
737
+ role: "img",
738
+ width: "1em",
739
+ height: "1em",
740
+ viewBox: "0 0 1024 1024"
741
+ }, [createVNode("path", {
742
+ fill: "currentColor",
743
+ d: "M180 176h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zm724 0h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zM785.3 504.3L657.7 403.6a7.23 7.23 0 0 0-11.7 5.7V476H378v-62.8c0-6-7-9.4-11.7-5.7L238.7 508.3a7.14 7.14 0 0 0 0 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h268v62.8c0 6 7 9.4 11.7 5.7l127.5-100.8c3.8-2.9 3.8-8.5.2-11.4z"
744
+ }, null)])] })
745
+ }
746
+ ]),
747
+ onSelect: async (d) => {
748
+ U.visible = !1;
749
+ let H = [...z.value];
750
+ if (d === "closeAll") {
751
+ await K.push("/");
752
+ for (let d of H) d.key !== B.value && d.close(!1);
753
+ return;
754
+ }
755
+ if (d === "fullTab") {
756
+ V();
757
+ return;
758
+ }
759
+ if (!U.tab) {
760
+ let z = H.find((d) => d.key === B.value);
761
+ switch (d) {
762
+ case "open":
763
+ window.open(z.href, "_blank");
764
+ break;
765
+ case "reload":
766
+ z.reloading ||= (z.reloading = !0, await promiseTimeout(220), !1);
767
+ break;
768
+ }
769
+ return;
770
+ }
771
+ switch (d) {
772
+ case "open":
773
+ window.open(U.tab.href, "_blank");
774
+ break;
775
+ case "reload":
776
+ U.tab.reloading || (U.tab.reloading = !0, await promiseTimeout(220), U.tab.reloading = !1);
777
+ break;
778
+ case "close":
779
+ U.tab?.close();
780
+ break;
781
+ case "closeOther":
782
+ B.value !== U.tab.key && await K.push(U.tab.fullPath);
783
+ for (let d of H) d.key !== U.tab.key && d.close(!1);
784
+ break;
785
+ case "closeLeft":
786
+ B.value !== U.tab.key && await K.push(U.tab.fullPath);
787
+ for (let d of z.value.slice(0, H.indexOf(U.tab))) d.close(!1);
788
+ break;
789
+ case "closeRight":
790
+ B.value !== U.tab.key && await K.push(U.tab.fullPath);
791
+ for (let d of z.value.slice(H.indexOf(U.tab) + 1)) d.close(!1);
792
+ break;
793
+ }
794
+ }
795
+ };
796
+ }
797
+ function useContentScroll(d, z, B) {
798
+ function V(B) {
799
+ if (B === -1 || !z.value?.children.length) return;
800
+ let V = z.value.children[B];
801
+ d.value.scrollTo({
802
+ behavior: "smooth",
803
+ left: Math.max(0, z.value.offsetLeft + V.offsetLeft - d.value.clientWidth / 2 + V.clientWidth / 2 + 10)
804
+ });
805
+ }
806
+ return watchDebounced(useElementHover(d), (d) => {
807
+ d || V(B.value);
808
+ }, { debounce: 333 }), watch(B, V, { flush: "post" }), useEventListener(d, "wheel", (z) => {
809
+ z.deltaMode === WheelEvent.DOM_DELTA_PIXEL && (z.preventDefault(), d.value.scrollBy({ left: z.deltaY }));
810
+ }, { passive: !1 }), {
811
+ el: d,
812
+ content: z
813
+ };
814
+ }
815
+ var IBg = (d) => createVNode("svg", d, [
816
+ createVNode("defs", null, [
817
+ createVNode("symbol", {
818
+ id: "geometry-left",
819
+ viewBox: "0 0 214 36"
820
+ }, [createVNode("path", { d: "M17 0h197v36H0v-2c4.5 0 9-3.5 9-8V8c0-4.5 3.5-8 8-8z" }, null)]),
821
+ createVNode("symbol", {
822
+ id: "geometry-right",
823
+ viewBox: "0 0 214 36"
824
+ }, [createVNode("use", { "xlink:href": "#geometry-left" }, null)]),
825
+ createVNode("clipPath", null, [createVNode("rect", {
826
+ width: "100%",
827
+ height: "100%",
828
+ x: "0"
829
+ }, null)])
830
+ ]),
831
+ createVNode("svg", {
832
+ width: "50%",
833
+ height: "100%"
834
+ }, [createVNode("use", {
835
+ "xlink:href": "#geometry-left",
836
+ width: "214",
837
+ height: "36",
838
+ fill: "currentColor"
839
+ }, null)]),
840
+ createVNode("g", { transform: "scale(-1, 1)" }, [createVNode("svg", {
841
+ width: "50%",
842
+ height: "100%",
843
+ x: "-100%",
844
+ y: "0"
845
+ }, [createVNode("use", {
846
+ "xlink:href": "#geometry-right",
847
+ width: "214",
848
+ height: "36",
849
+ fill: "currentColor"
850
+ }, null)])])
851
+ ]), AppTab = /* @__PURE__ */ defineComponent({
852
+ name: "AppTab",
853
+ props: {
854
+ path: String,
855
+ isCurrent: Boolean,
856
+ isLast: Boolean,
857
+ closable: Boolean,
858
+ dark: Boolean
859
+ },
860
+ emits: ["close"],
861
+ setup(d, { emit: z, slots: B }) {
862
+ let V = ref(), H = useElementHover(V), U = ref(), W = ref(), { width: G } = useElementSize(W);
863
+ watch(G, async () => {
864
+ await promiseTimeout(1), U.value.style.width = W.value.scrollWidth + "px";
865
+ });
866
+ let K = useThemeVars(), q = computed(() => ({
867
+ fontSize: "14px",
868
+ color: d.isCurrent ? K.value.primaryColor : K.value.textColor3,
869
+ maxWidth: "355px",
870
+ overflow: "hidden"
871
+ })), J = computed(() => ({
872
+ width: "calc(100% + 27px)",
873
+ height: "100%",
874
+ position: "absolute",
875
+ top: "0",
876
+ left: "-14px",
877
+ zIndex: d.isCurrent ? -1 : -2,
878
+ color: d.isCurrent ? getOpaqueColor(K.value.primaryColor, d.dark ? .3 : .12, d.dark ? "#000" : "#fff") : H.value ? K.value.borderColor : "transparent"
879
+ }));
880
+ return () => createVNode("div", {
881
+ ref: V,
882
+ style: "position: relative; padding: 2px 10px 5px; cursor: pointer"
883
+ }, [
884
+ createVNode("div", {
885
+ ref: U,
886
+ style: "transition: width 300ms; overflow: hidden"
887
+ }, [createVNode("div", {
888
+ ref: W,
889
+ style: "display: flex; align-items: center; gap: 4px; width: fit-content"
890
+ }, [createVNode("span", { style: q.value }, [B.default?.()]), d.closable !== !1 && (d.isCurrent || H.value) ? createVNode("span", { style: "line-height: 0; display: inline-block; text-align: right; padding-top: 2px" }, [createVNode(NButton, {
891
+ text: !0,
892
+ onClick: (d) => {
893
+ d.stopPropagation(), z("close");
894
+ }
895
+ }, { default: () => [createVNode(NIcon, { size: 18 }, { default: () => [createVNode("svg", {
896
+ xmlns: "http://www.w3.org/2000/svg",
897
+ width: "1em",
898
+ height: "1em",
899
+ viewBox: "0 0 24 24"
900
+ }, [createVNode("path", {
901
+ fill: "currentColor",
902
+ d: "m6.4 18.308l-.708-.708l5.6-5.6l-5.6-5.6l.708-.708l5.6 5.6l5.6-5.6l.708.708l-5.6 5.6l5.6 5.6l-.708.708l-5.6-5.6z"
903
+ }, null)])] })] })]) : void 0])]),
904
+ createVNode("span", { style: "height: 50%; width: 1px; background: #aaa; display: inline-block; position: absolute; top: 20%; right: -4px; z-index: -3" }, null),
905
+ createVNode(IBg, { style: J.value }, null)
906
+ ]);
907
+ }
908
+ });
909
+ const AppMultiTabs = /* @__PURE__ */ defineComponent({
910
+ name: "AppMultiTabs",
911
+ props: {
912
+ fullTab: Boolean,
913
+ showBreadcrumb: Boolean,
914
+ tabs: Array,
915
+ current: Object,
916
+ dark: Boolean
917
+ },
918
+ emits: ["update:fullTab"],
919
+ setup(d, { emit: z, slots: B }) {
920
+ let V = getCtx();
921
+ V.hasMultiTab = !0;
922
+ let H = useRouter(), { ctx: U, onCtx: W, onClickoutside: G, options: K, onSelect: q } = useCtxMenu(toRef(d, "tabs"), computed(() => d.current?.key), () => z("update:fullTab", !d.fullTab)), J = computed(() => d.current ? d.tabs.findIndex((z) => z.key === d.current?.key) : -1), Y = ref(), Z = ref();
923
+ return useContentScroll(Y, Z, J), () => createVNode("div", { style: "width: 100%; height: 100%; overflow: hidden; display: flex; justify-content: space-between" }, [createVNode("div", {
924
+ ref: Y,
925
+ style: "flex: 1 1 100%; height: 100%; display: flex; overflow: hidden; align-items: center; position: relative"
926
+ }, [
927
+ createVNode("div", { style: "height: 100%; flex: 0 0 16px; z-index: 1; position: sticky; left: 0; backdrop-filter: opacity(0.9) blur(5px)" }, null),
928
+ createVNode("div", {
929
+ ref: Z,
930
+ style: "padding-inline: 12px; flex: 1 1 auto; display: flex; align-items: end; gap: 8px; height: 100%",
931
+ onContextmenu: (d) => W(d)
932
+ }, [d.tabs.map((z, V, U) => {
933
+ let G = d.current?.key === z.key, K = z.title ?? z.path;
934
+ return createVNode(AppTab, {
935
+ key: z.key,
936
+ isCurrent: G,
937
+ isLast: V === U.length - 1,
938
+ onClose: z.close,
939
+ closable: z.closable,
940
+ dark: d.dark,
941
+ onClick: () => {
942
+ G || H.push(z.fullPath);
943
+ },
944
+ onContextmenu: (d) => W(d, z)
945
+ }, { default: () => [B.name ? B.name({
946
+ isCurrent: G,
947
+ name: K,
948
+ tab: z
949
+ }) : K] });
950
+ })]),
951
+ createVNode("div", { style: "height: 100%; flex: 0 0 16px; z-index: 1; position: sticky; right: 0; backdrop-filter: opacity(0.9) blur(5px)" }, null)
952
+ ]), createVNode(NDropdown, {
953
+ placement: "bottom-start",
954
+ trigger: "manual",
955
+ show: U.visible,
956
+ x: U.x,
957
+ y: U.y,
958
+ options: K.value,
959
+ onClickoutside: G,
960
+ onSelect: q
961
+ }, null)]);
962
+ }
963
+ });
964
+ function _isSlot(d) {
965
+ return typeof d == "function" || Object.prototype.toString.call(d) === "[object Object]" && !isVNode(d);
966
+ }
967
+ const AppNotification = /* @__PURE__ */ defineComponent({
968
+ name: "AppNotification",
969
+ inheritAttrs: !1,
970
+ props: {
971
+ getUnreadCount: Function,
972
+ getPage: Function,
973
+ markRead: Function,
974
+ markDelete: Function,
975
+ interval: {
976
+ type: Number,
977
+ default: 3e4
978
+ }
979
+ },
980
+ setup(z, { slots: H, attrs: U }) {
981
+ let { t: W } = useI18n(), G = ref(!1), K = ref("unread"), q = reactive({
982
+ page: 1,
983
+ size: 10,
984
+ loading: !1,
985
+ records: [],
986
+ total: 0,
987
+ unread: 0
988
+ }), { sync: J, post: X } = useAtomicBroadcast({
989
+ channel: "__ithinkdt_mc_shared_channel",
990
+ onMsg: (d) => {
991
+ q.unread = d;
992
+ },
993
+ getMsg: () => (G.value && (q.loading = !0, Promise.resolve(z.getPage?.(K.value, q.page, q.size) ?? []).then(({ records: d, total: z }) => {
994
+ q.records = d, K.value === "unread" ? (q.unread = z, X(z)) : q.total = z;
995
+ }).finally(() => {
996
+ q.loading = !1;
997
+ })), z.getUnreadCount?.() ?? 0),
998
+ timeout: () => z.interval,
999
+ immediate: !0
1000
+ });
1001
+ return () => {
1002
+ let d = withDirectives(createVNode(NButton, mergeProps(U, {
1003
+ quaternary: !0,
1004
+ style: "--n-padding: 0 12px",
1005
+ onClick: () => {
1006
+ G.value = !0, K.value = q.unread > 0 ? "unread" : "all", setTimeout(J, 300);
1007
+ }
1008
+ }), { default: () => [H.icon ? H.icon() : createVNode(NBadge, {
1009
+ show: q.unread > 0,
1010
+ dot: !0,
1011
+ offset: [-2, 5],
1012
+ processing: !0
1013
+ }, { default: () => [createVNode(NIcon, { size: "18" }, { default: () => [createVNode("svg", {
1014
+ xmlns: "http://www.w3.org/2000/svg",
1015
+ width: "1em",
1016
+ height: "1em",
1017
+ viewBox: "0 0 24 24"
1018
+ }, [createVNode("g", {
1019
+ fill: "none",
1020
+ stroke: "currentColor",
1021
+ "stroke-linecap": "round",
1022
+ "stroke-linejoin": "round",
1023
+ "stroke-width": "1.5",
1024
+ color: "currentColor"
1025
+ }, [createVNode("path", { d: "M2.53 14.77c-.213 1.394.738 2.361 1.902 2.843c4.463 1.85 10.673 1.85 15.136 0c1.164-.482 2.115-1.45 1.902-2.843c-.13-.857-.777-1.57-1.256-2.267c-.627-.924-.689-1.931-.69-3.003C19.525 5.358 16.157 2 12 2S4.475 5.358 4.475 9.5c0 1.072-.062 2.08-.69 3.003c-.478.697-1.124 1.41-1.255 2.267" }, null), createVNode("path", { d: "M8 19c.458 1.725 2.076 3 4 3c1.925 0 3.541-1.275 4-3" }, null)])])] })] })] }), [[
1026
+ vTooltip,
1027
+ W("common.notification.tip", { count: q.unread }),
1028
+ void 0,
1029
+ { bottom: !0 }
1030
+ ]]), X = () => {
1031
+ let d, z;
1032
+ return createVNode("div", { style: "display: flex; align-items: baseline; gap: 20px" }, [
1033
+ createVNode("div", { style: "padding-right: 12px" }, [W("common.notification.title")]),
1034
+ createVNode(NButton, {
1035
+ text: !0,
1036
+ type: K.value === "all" ? "primary" : "default",
1037
+ onClick: () => {
1038
+ K.value = "all", J();
1039
+ }
1040
+ }, _isSlot(d = W("common.notification.all")) ? d : { default: () => [d] }),
1041
+ createVNode(NButton, {
1042
+ text: !0,
1043
+ type: K.value === "unread" ? "primary" : "default",
1044
+ onClick: () => {
1045
+ K.value = "unread", J();
1046
+ }
1047
+ }, _isSlot(z = W("common.notification.unread", { count: q.unread > 99 ? "99+" : q.unread.toString() })) ? z : { default: () => [z] })
1048
+ ]);
1049
+ }, Z = (d) => createVNode(NListItem, {
1050
+ key: d.key,
1051
+ onClick: () => {
1052
+ d.status === "unread" && (z.markRead?.([d.key]).then(() => {
1053
+ d.status = "read";
1054
+ }), q.unread--), d.link && window.open(d.link, "_target");
1055
+ }
1056
+ }, { default: () => [createVNode(NThing, {
1057
+ bordered: !1,
1058
+ closable: !0,
1059
+ contentIndented: !0,
1060
+ size: "small",
1061
+ onMouseenter: () => d.hover = !0,
1062
+ onMouseleave: () => d.hover = !1,
1063
+ style: "padding: 0 4px"
1064
+ }, {
1065
+ avatar: () => createVNode(NIcon, {
1066
+ size: 22,
1067
+ color: d.status === "unread" ? "var(--color-primary)" : void 0
1068
+ }, { default: () => [createVNode("svg", {
1069
+ xmlns: "http://www.w3.org/2000/svg",
1070
+ width: "1em",
1071
+ height: "1em",
1072
+ viewBox: "0 0 24 24"
1073
+ }, [createVNode("path", {
1074
+ fill: "currentColor",
1075
+ d: "M12.3 7.29c.2-.18.44-.29.7-.29c.27 0 .5.11.71.29c.19.21.29.45.29.71c0 .27-.1.5-.29.71c-.21.19-.44.29-.71.29c-.26 0-.5-.1-.7-.29c-.19-.21-.3-.44-.3-.71c0-.26.11-.5.3-.71m-2.5 4.68s2.17-1.72 2.96-1.79c.74-.06.59.79.52 1.23l-.01.06c-.14.53-.31 1.17-.48 1.78c-.38 1.39-.75 2.75-.66 3c.1.34.72-.09 1.17-.39c.06-.04.11-.08.16-.11c0 0 .08-.08.16.03c.02.03.04.06.06.08c.09.14.14.19.02.27l-.04.02c-.22.15-1.16.81-1.54 1.05c-.41.27-1.98 1.17-1.74-.58c.21-1.23.49-2.29.71-3.12c.41-1.5.59-2.18-.33-1.59c-.37.22-.59.36-.72.45c-.11.08-.12.08-.19-.05l-.03-.06l-.05-.08c-.07-.1-.07-.11.03-.2M22 12c0 5.5-4.5 10-10 10S2 17.5 2 12S6.5 2 12 2s10 4.5 10 10m-2 0c0-4.42-3.58-8-8-8s-8 3.58-8 8s3.58 8 8 8s8-3.58 8-8"
1076
+ }, null)])] }),
1077
+ header: () => d.title,
1078
+ "header-extra": () => {
1079
+ let B, V;
1080
+ return d.hover ? createVNode("div", {
1081
+ style: "display: flex; justify-content: end; gap: 12px",
1082
+ onClick: (d) => {
1083
+ d.preventDefault(), d.stopPropagation();
1084
+ }
1085
+ }, [d.status === "unread" ? createVNode(NButton, {
1086
+ text: !0,
1087
+ type: "primary",
1088
+ onClick: () => {
1089
+ z.markRead?.([d.key]).then(() => {
1090
+ d.status = "read", q.unread--;
1091
+ });
1092
+ }
1093
+ }, _isSlot(B = W("common.notification.markRead")) ? B : { default: () => [B] }) : void 0, createVNode(NButton, {
1094
+ text: !0,
1095
+ type: "error",
1096
+ onClick: () => {
1097
+ q.records === 1 ? (q.records = [], J()) : q.records.splice(q.records.findIndex((z) => z.key == d.key), 1), z.markDelete?.([d.key]);
1098
+ }
1099
+ }, _isSlot(V = W("common.notification.markDelete")) ? V : { default: () => [V] })]) : void 0;
1100
+ },
1101
+ default: d.content,
1102
+ footer: () => createVNode("span", { style: "color: gray" }, [d.hover ? format(d.date, W("common.notification.time")) : W("common.timeago", { time: d.date })])
1103
+ })] }), Q = () => {
1104
+ let d;
1105
+ return withDirectives(q.records.length > 0 ? createVNode(NList, {
1106
+ clickable: !0,
1107
+ hoverable: !0,
1108
+ style: "min-height: 50vh"
1109
+ }, _isSlot(d = q.records.map((d) => Z(d))) ? d : { default: () => [d] }) : createVNode(NEmpty, { style: "margin-top: 30vh" }, null), [[vSpin, q.loading]]);
1110
+ }, $ = () => createVNode("div", { style: "display: flex; justify-content: space-between; width: 100%" }, [K.value === "unread" ? createVNode(NButton, {
1111
+ text: !0,
1112
+ type: "primary",
1113
+ disabled: q.records.length === 0,
1114
+ onClick: () => {
1115
+ let d = q.records.filter((d) => d.status === "unread").map((d) => d.key);
1116
+ z.markRead(d).then(() => {
1117
+ for (; q.unread - d.length <= q.size * (q.page - 1);) q.page--;
1118
+ J();
1119
+ });
1120
+ }
1121
+ }, {
1122
+ icon: () => createVNode(NIcon, { size: "20" }, { default: () => [createVNode("svg", {
1123
+ xmlns: "http://www.w3.org/2000/svg",
1124
+ width: "1em",
1125
+ height: "1em",
1126
+ viewBox: "0 0 24 24"
1127
+ }, [createVNode("path", {
1128
+ fill: "currentColor",
1129
+ d: "M.41 13.41L6 19l1.41-1.42L1.83 12m20.41-6.42L11.66 16.17L7.5 12l-1.43 1.41L11.66 19l12-12M18 7l-1.41-1.42l-6.35 6.35l1.42 1.41z"
1130
+ }, null)])] }),
1131
+ default: () => W("common.notification.markPageRead")
1132
+ }) : createVNode("span", null, null), createVNode(NPagination, {
1133
+ simple: !0,
1134
+ pageSize: q.size,
1135
+ page: q.page,
1136
+ itemCount: K.value === "unread" ? q.unread : q.total,
1137
+ onUpdatePage: (d) => {
1138
+ q.page = d, J();
1139
+ }
1140
+ }, null)]);
1141
+ return createVNode(Fragment, null, [d, createVNode(NDrawer, {
1142
+ show: G.value,
1143
+ "onUpdate:show": (d) => G.value = d,
1144
+ showMask: !1,
1145
+ width: 400
1146
+ }, { default: () => [createVNode(NDrawerContent, {
1147
+ title: W("common.notification.title"),
1148
+ closable: !0,
1149
+ nativeScrollbar: !1,
1150
+ bodyContentStyle: { padding: "0" }
1151
+ }, {
1152
+ header: X,
1153
+ default: Q,
1154
+ footer: $
1155
+ })] })]);
1156
+ };
1157
+ }
1158
+ });
1159
+ var ICheck = (d) => createVNode("svg", mergeProps({
1160
+ xmlns: "http://www.w3.org/2000/svg",
1161
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
1162
+ role: "img",
1163
+ width: "1em",
1164
+ height: "1em",
1165
+ viewBox: "0 0 24 24"
1166
+ }, d), [createVNode("path", {
1167
+ fill: "currentColor",
1168
+ d: "m9.55 18l-5.7-5.7l1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"
1169
+ }, null)]);
1170
+ const AppTenant = /* @__PURE__ */ defineComponent({
1171
+ name: "AppTenant",
1172
+ props: {
1173
+ options: Array,
1174
+ current: String
1175
+ },
1176
+ emit: ["update:current"],
1177
+ setup(z, { emit: B }) {
1178
+ let { t: V } = useI18n(), H = (d) => d.disabled ? createVNode("div", null, [d.name]) : createVNode("div", { style: "display: flex; align-items: center; justify-content: space-between; gap: 20px" }, [createVNode("div", { style: "display: flex; align-items: center; gap: 8px" }, [createVNode(NAvatar, {
1179
+ round: !0,
1180
+ size: 22,
1181
+ color: "var(--color-primary-hover)"
1182
+ }, { default: () => [d.icon?.() || d.name[0]] }), createVNode("span", { style: d.id === z.current ? "color: var(--color-primary)" : "" }, [d.name])]), d.id === z.current ? createVNode(ICheck, { style: "color: var(--color-primary); font-size: 20px" }, null) : createVNode("div", null, null)]), U = computed(() => [{
1183
+ id: "___",
1184
+ name: V("common.account.changeTenant"),
1185
+ disabled: !0
1186
+ }, ...z.options ?? []]);
1187
+ return () => {
1188
+ if (!z.options?.length) return;
1189
+ let d = z.options.find((d) => d.id === z.current);
1190
+ return createVNode(NDropdown, {
1191
+ options: U.value,
1192
+ placement: "bottom-end",
1193
+ keyField: "id",
1194
+ labelField: "name",
1195
+ showArrow: !0,
1196
+ renderLabel: H,
1197
+ onSelect: (d) => d !== z.current && B("update:current", d)
1198
+ }, { default: () => [createVNode(NButton, {
1199
+ quaternary: !0,
1200
+ style: "--n-padding: 0 6px"
1201
+ }, {
1202
+ icon: () => createVNode(NIcon, { size: "18" }, { default: () => [createVNode("svg", {
1203
+ xmlns: "http://www.w3.org/2000/svg",
1204
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
1205
+ viewBox: "0 0 1024 1024",
1206
+ width: "1em",
1207
+ height: "1em",
1208
+ role: "img"
1209
+ }, [createVNode("path", {
1210
+ d: "M728 600.2c8.1-13.2 4-30.4-9.1-38.5-30.7-19-63.6-33.8-97.8-44.4 69.4-43 115.6-119.8 115.6-207.4C736.7 175.2 627.5 66 492.8 66S249 175.2 249 309.9c0 88.2 46.8 165.5 117 208.3-12.9 4.1-25.6 8.8-38.1 14.1-51.1 21.8-97 53-136.4 92.7-39.4 39.7-70.3 85.9-91.9 137.4-22.4 53.3-33.7 109.9-33.7 168.2 0 15.5 12.5 28 28 28s28-12.5 28-28c0-207.5 167.4-376.3 373.2-376.3 68.8 0 136.1 19 194.4 55 13.1 8.2 30.4 4.1 38.5-9.1zM305 309.9c0-50.2 19.5-97.4 55-132.8 35.5-35.5 82.7-55 132.8-55 50.2 0 97.4 19.5 132.8 55 35.5 35.5 55 82.7 55 132.8s-19.5 97.4-55 132.8c-35.5 35.5-82.7 55-132.8 55-50.2 0-97.4-19.5-132.8-55-35.5-35.5-55-82.6-55-132.8zM606.2 746.4h325.1c11.3 0 21.5-6.8 25.9-17.3s1.9-22.5-6.1-30.5L844.5 592.1c-10.9-10.9-28.7-10.9-39.6 0-10.9 10.9-10.9 28.7 0 39.6l58.7 58.6H606.2c-15.5 0-28 12.5-28 28s12.6 28.1 28 28.1zM931.4 794.6H606.3c-11.3 0-21.5 6.8-25.9 17.3s-1.9 22.5 6.1 30.5l106.6 106.4c5.5 5.5 12.6 8.2 19.8 8.2 7.2 0 14.4-2.7 19.8-8.2 10.9-10.9 10.9-28.7 0-39.6L674 850.6h257.4c15.5 0 28-12.5 28-28s-12.5-28-28-28z",
1211
+ fill: "currentColor"
1212
+ }, null)])] }),
1213
+ default: () => d?.shotName || d?.name
1214
+ })] });
1215
+ };
1216
+ }
1217
+ }), UIProvider = /* @__PURE__ */ defineComponent({
1218
+ name: "UIProvider",
1219
+ props: { i18n: Function },
1220
+ setup(d, { slots: B }) {
1221
+ return provide(UI_I18N_INJECTION, toRef(d, "i18n")), () => B.default();
1222
+ }
1223
+ });
1224
+ export { AppAccount, AppAppearance, AppBreadcrumb, AppContent, AppFooter, AppFullscreen, AppHeader, AppLanguage, AppLayout, AppLogo, AppMenu, AppMultiTabs, AppNotification, AppSider, AppTenant, SpinDirectiveProvider, TooltipDirectiveProvider, UIProvider, vSpin, vTooltip };