@morningfast/platform 1.0.4 → 1.0.6

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.
@@ -0,0 +1,2441 @@
1
+ import { clearAuth as e, emitAuthExpired as t, getAccessToken as n, onAuthExpired as r } from "../auth.js";
2
+ import { createRequestClient as i } from "../request.js";
3
+ import { t as a } from "./auth-C3RvRgcW.js";
4
+ import { i as o, n as s, r as c, t as l } from "./system-DZaKDrG6.js";
5
+ import { _ as u, a as d, g as f, i as p, n as m, o as h, r as g, s as _, v } from "./register-dGBgzdRh.js";
6
+ import { t as y } from "./_plugin-vue_export-helper-DvRHjpsZ.js";
7
+ import { t as b } from "./route-items-CYTYHd0U.js";
8
+ import { createRouter as x, createWebHistory as S, useRoute as C, useRouter as ee } from "vue-router";
9
+ import w from "nprogress";
10
+ import T, { ElMessage as E } from "element-plus";
11
+ import { Fragment as D, Teleport as te, Transition as O, TransitionGroup as ne, computed as k, createApp as A, createBlock as j, createCommentVNode as M, createElementBlock as N, createElementVNode as P, createTextVNode as F, createVNode as I, defineComponent as L, nextTick as R, normalizeClass as z, normalizeStyle as B, onBeforeUnmount as re, onMounted as ie, onUnmounted as ae, openBlock as V, ref as H, renderList as U, resolveComponent as W, resolveDynamicComponent as G, toDisplayString as K, unref as q, watch as J, watchEffect as oe, withCtx as Y, withKeys as se, withModifiers as X } from "vue";
12
+ import { createPinia as ce, defineStore as le } from "pinia";
13
+ import { MpDrawer as ue, MpLoadingService as de, registerMpFormFieldComponents as fe } from "morningfast-plus/components";
14
+ import { ArrowDown as pe, ArrowRight as me, ArrowUp as he, Back as ge, Brush as _e, Close as ve, Connection as ye, DArrowLeft as be, DArrowRight as xe, Document as Se, Expand as Ce, Fold as we, FolderDelete as Te, Grid as Ee, House as De, Link as Oe, Monitor as ke, Moon as Ae, Operation as je, Refresh as Me, RefreshRight as Ne, Search as Pe, Setting as Fe, Sunny as Ie, SwitchButton as Le, TopRight as Re, Upload as ze, User as Be, WarningFilled as Ve } from "@element-plus/icons-vue";
15
+ import He from "sortablejs";
16
+ import Ue from "element-plus/es/locale/lang/zh-cn";
17
+ import "element-plus/dist/index.css";
18
+ import "element-plus/theme-chalk/dark/css-vars.css";
19
+ import "nprogress/nprogress.css";
20
+ //#region src/main/auth/expired.ts
21
+ function We(t) {
22
+ return r(() => {
23
+ if (e(), t.currentRoute.value.path === "/login") return;
24
+ let n = `${t.currentRoute.value.fullPath || "/"}`;
25
+ t.replace({
26
+ path: "/login",
27
+ query: { redirect: n }
28
+ });
29
+ });
30
+ }
31
+ //#endregion
32
+ //#region src/main/app/runtime-config.ts
33
+ var Ge = { apiBaseUrl: "/api" };
34
+ function Ke(e) {
35
+ Ge = e;
36
+ }
37
+ function qe() {
38
+ return Ge;
39
+ }
40
+ var { http: Je, createApi: Ye, requestManager: Xe } = i({
41
+ baseURL: qe().apiBaseUrl,
42
+ getToken: n,
43
+ onError(e) {
44
+ E.error(e);
45
+ },
46
+ onUnauthorized(e) {
47
+ t({
48
+ source: "main-app",
49
+ reason: "unauthorized",
50
+ code: e.code,
51
+ message: e.message
52
+ });
53
+ }
54
+ });
55
+ function Ze() {
56
+ Je.defaults.baseURL = qe().apiBaseUrl;
57
+ }
58
+ //#endregion
59
+ //#region src/main/router/guard.ts
60
+ var Qe = "/login", $e = "/403";
61
+ function et(e) {
62
+ e.beforeEach(async (e, t) => {
63
+ w.start(), e.path !== t.path && Xe.setCurrentPage(e.path);
64
+ let n = a(), r = !!e.meta.public;
65
+ if (n.initialized || await n.initAuth(), !n.isAuthenticated && !r) return {
66
+ path: Qe,
67
+ query: { redirect: e.fullPath }
68
+ };
69
+ if (n.isAuthenticated && e.path === Qe) return { path: "/" };
70
+ let i = e.meta.permission;
71
+ return tt(i, n.hasPermission) ? !0 : {
72
+ path: $e,
73
+ query: { redirect: e.fullPath }
74
+ };
75
+ }), e.afterEach((e) => {
76
+ l().setRouteTitle(String(e.meta.title ?? "Morningfast UI")), w.done();
77
+ }), e.onError(() => {
78
+ w.done();
79
+ });
80
+ }
81
+ function tt(e, t) {
82
+ return e ? Array.isArray(e) ? e.every((e) => t(e)) : t(e) : !0;
83
+ }
84
+ //#endregion
85
+ //#region src/main/stores/tabs.ts
86
+ var Z = "/dashboard", nt = "tabs-state";
87
+ function rt() {
88
+ return {
89
+ path: Z,
90
+ fullPath: Z,
91
+ title: "首页",
92
+ icon: "House"
93
+ };
94
+ }
95
+ function it() {
96
+ return {
97
+ tabs: [rt()],
98
+ activeTab: Z,
99
+ lastActiveTab: ""
100
+ };
101
+ }
102
+ function at(e) {
103
+ let t = it();
104
+ if (!e) return t;
105
+ let n = Array.isArray(e.tabs) ? e.tabs.filter(Boolean).map(ot) : [], r = st([rt(), ...n]).sort((e, t) => e.path === "/dashboard" ? -1 : +(t.path === "/dashboard"));
106
+ return {
107
+ tabs: r,
108
+ activeTab: r.some((t) => t.path === e.activeTab) ? String(e.activeTab || "/dashboard") : r[0]?.path || "/dashboard",
109
+ lastActiveTab: r.some((t) => t.path === e.lastActiveTab) ? String(e.lastActiveTab || "") : ""
110
+ };
111
+ }
112
+ function ot(e) {
113
+ return {
114
+ path: String(e.path || "/dashboard"),
115
+ fullPath: String(e.fullPath || e.path || "/dashboard"),
116
+ title: String(e.title || "未命名页面"),
117
+ icon: e.icon ? String(e.icon) : void 0
118
+ };
119
+ }
120
+ function st(e) {
121
+ let t = /* @__PURE__ */ new Set();
122
+ return e.filter((e) => t.has(e.path) ? !1 : (t.add(e.path), !0));
123
+ }
124
+ function ct(e) {
125
+ return {
126
+ tabs: e.tabs.map((e) => ({
127
+ path: e.path,
128
+ fullPath: e.fullPath,
129
+ title: e.title,
130
+ icon: e.icon
131
+ })),
132
+ activeTab: e.activeTab,
133
+ lastActiveTab: e.lastActiveTab
134
+ };
135
+ }
136
+ var lt = le("tabs", () => {
137
+ let e = H([rt()]), t = H(Z), n = H(""), r = H(!1), i = k(() => e.value.map((e) => e.path));
138
+ async function a() {
139
+ r.value && await o(nt, ct({
140
+ tabs: e.value,
141
+ activeTab: t.value,
142
+ lastActiveTab: n.value
143
+ }));
144
+ }
145
+ async function l() {
146
+ if (r.value) return;
147
+ let i = at(await s(nt, null));
148
+ e.value = i.tabs, t.value = i.activeTab, n.value = i.lastActiveTab, r.value = !0, await a();
149
+ }
150
+ async function u(r) {
151
+ t.value && t.value !== r.path && (n.value = t.value), t.value = r.path;
152
+ let i = e.value.find((e) => e.path === r.path);
153
+ if (i) {
154
+ i.fullPath = r.fullPath, i.title = r.title, i.icon = r.icon, await a();
155
+ return;
156
+ }
157
+ e.value.push(r), b(), await a();
158
+ }
159
+ async function d(t) {
160
+ if (t === "/dashboard") return;
161
+ let r = e.value.findIndex((e) => e.path === t);
162
+ r >= 0 && e.value.splice(r, 1), n.value === t && (n.value = ""), b(), await a();
163
+ }
164
+ async function f(t) {
165
+ e.value = x(t), await a();
166
+ }
167
+ async function p(t) {
168
+ e.value = x(e.value.filter((e) => e.path === t || e.path === "/dashboard")), y(), await a();
169
+ }
170
+ async function m(t) {
171
+ let n = e.value.findIndex((e) => e.path === t);
172
+ n > 0 && (e.value = x(e.value.slice(n)), y(), await a());
173
+ }
174
+ async function h(t) {
175
+ let n = e.value.findIndex((e) => e.path === t);
176
+ n >= 0 && (e.value = x(e.value.slice(0, n + 1)), y(), await a());
177
+ }
178
+ async function g() {
179
+ e.value = [rt()], t.value = Z, n.value = "", await a();
180
+ }
181
+ async function _() {
182
+ e.value = [], t.value = "", n.value = "", await c(nt);
183
+ }
184
+ async function v(e) {
185
+ t.value && t.value !== e && (n.value = t.value), t.value = e, await a();
186
+ }
187
+ function y() {
188
+ n.value && !e.value.some((e) => e.path === n.value) && (n.value = "");
189
+ }
190
+ function b() {
191
+ e.value = x(e.value);
192
+ }
193
+ function x(e) {
194
+ return st([rt(), ...e.filter((e) => e.path !== Z)]);
195
+ }
196
+ return {
197
+ activeTab: t,
198
+ closeAllTabs: g,
199
+ closeLeftTabs: m,
200
+ closeOtherTabs: p,
201
+ closeRightTabs: h,
202
+ initializeTabs: l,
203
+ lastActiveTab: n,
204
+ removeTab: d,
205
+ reorderTabs: f,
206
+ resetTabs: _,
207
+ setActiveTab: v,
208
+ syncTab: u,
209
+ tabPaths: i,
210
+ tabs: e
211
+ };
212
+ }), ut = "shortcut-config", dt = [
213
+ {
214
+ id: "search",
215
+ name: "全局搜索",
216
+ description: "快速搜索菜单和页面",
217
+ keys: "Ctrl K",
218
+ enabled: !0,
219
+ category: "global"
220
+ },
221
+ {
222
+ id: "toggleMenu",
223
+ name: "折叠菜单",
224
+ description: "展开或收起侧边导航",
225
+ keys: "Ctrl B",
226
+ enabled: !0,
227
+ category: "navigation"
228
+ },
229
+ {
230
+ id: "settings",
231
+ name: "主题设置",
232
+ description: "打开系统偏好设置面板",
233
+ keys: "Ctrl I",
234
+ enabled: !0,
235
+ category: "other"
236
+ }
237
+ ], ft = le("shortcut", () => {
238
+ let e = H(!0), t = H(pt()), n = k(() => new Map(t.value.map((e) => [e.id, e])));
239
+ function r() {
240
+ let t = mt();
241
+ if (t && (typeof t.shortcutEnabled == "boolean" && (e.value = t.shortcutEnabled), Array.isArray(t.shortcuts))) for (let e of t.shortcuts) {
242
+ let t = n.value.get(e.id);
243
+ t && typeof e.enabled == "boolean" && (t.enabled = e.enabled);
244
+ }
245
+ }
246
+ function i() {
247
+ e.value = !e.value, c();
248
+ }
249
+ function a(e) {
250
+ let t = n.value.get(e);
251
+ t && (t.enabled = !t.enabled, c());
252
+ }
253
+ function o(t) {
254
+ return !!(e.value && n.value.get(t)?.enabled);
255
+ }
256
+ function s(e) {
257
+ return n.value.get(e)?.keys ?? "";
258
+ }
259
+ function c() {
260
+ let n = {
261
+ shortcutEnabled: e.value,
262
+ shortcuts: t.value.map((e) => ({
263
+ id: e.id,
264
+ enabled: e.enabled
265
+ }))
266
+ };
267
+ localStorage.setItem(ut, JSON.stringify(n));
268
+ }
269
+ return {
270
+ getShortcutKeys: s,
271
+ initShortcuts: r,
272
+ isShortcutEnabled: o,
273
+ shortcutEnabled: e,
274
+ shortcuts: t,
275
+ toggleShortcut: a,
276
+ toggleShortcutEnabled: i
277
+ };
278
+ });
279
+ function pt() {
280
+ return dt.map((e) => ({ ...e }));
281
+ }
282
+ function mt() {
283
+ try {
284
+ let e = localStorage.getItem(ut);
285
+ return e ? JSON.parse(e) : null;
286
+ } catch {
287
+ return localStorage.removeItem(ut), null;
288
+ }
289
+ }
290
+ //#endregion
291
+ //#region src/main/utils/keyboard-shortcut.ts
292
+ var ht = {
293
+ Ctrl: {
294
+ mac: "Cmd",
295
+ windows: "Ctrl",
296
+ symbol: {
297
+ mac: "⌘",
298
+ windows: "Ctrl"
299
+ }
300
+ },
301
+ Alt: {
302
+ mac: "Option",
303
+ windows: "Alt",
304
+ symbol: {
305
+ mac: "⌥",
306
+ windows: "Alt"
307
+ }
308
+ },
309
+ Shift: {
310
+ mac: "Shift",
311
+ windows: "Shift",
312
+ symbol: {
313
+ mac: "⇧",
314
+ windows: "Shift"
315
+ }
316
+ }
317
+ };
318
+ function gt() {
319
+ return typeof navigator > "u" ? !1 : /Mac|iPhone|iPad|iPod/i.test(navigator.platform);
320
+ }
321
+ function _t(e) {
322
+ let t = gt();
323
+ return e.split(" ").filter(Boolean).map((e) => {
324
+ let n = bt(e);
325
+ if (!(n in ht)) return {
326
+ original: n,
327
+ display: n,
328
+ isModifier: !1
329
+ };
330
+ let r = ht[n];
331
+ return {
332
+ original: n,
333
+ display: t ? r.mac : r.windows,
334
+ symbol: t ? r.symbol.mac : r.symbol.windows,
335
+ isModifier: !0
336
+ };
337
+ });
338
+ }
339
+ function vt(e, t = {}) {
340
+ let { separator: n = " ", useSymbol: r = !1 } = t;
341
+ return _t(e).map((e) => r && e.symbol ? e.symbol : e.display).join(n);
342
+ }
343
+ function yt(e, t) {
344
+ let n = _t(t), r = n.find((e) => !e.isModifier);
345
+ if (!r) return !1;
346
+ let i = new Set(n.filter((e) => e.isModifier).map((e) => e.original)), a = gt() ? e.metaKey : e.ctrlKey, o = e.altKey, s = e.shiftKey;
347
+ return i.has("Ctrl") !== a || i.has("Alt") !== o || i.has("Shift") !== s ? !1 : e.code === `Key${r.original.toUpperCase()}`;
348
+ }
349
+ function bt(e) {
350
+ let t = e.toLowerCase();
351
+ return t === "ctrl" || t === "cmd" || t === "command" || t === "meta" ? "Ctrl" : t === "alt" || t === "option" ? "Alt" : t === "shift" ? "Shift" : e.length === 1 ? e.toUpperCase() : e.charAt(0).toUpperCase() + e.slice(1);
352
+ }
353
+ //#endregion
354
+ //#region src/main/assets/settings/theme-position-header.svg
355
+ var xt = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='56'%20height='7'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='7'%20y='6.5'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='11'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='19'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='27'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='4'%20y='13'%20width='56'%20height='31'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3crect%20x='8'%20y='18'%20width='17'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.16'/%3e%3crect%20x='8'%20y='26'%20width='30'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.12'/%3e%3c/svg%3e", St = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='56'%20height='40'%20rx='2'%20fill='%23c5cede'%20fill-opacity='0.05'/%3e%3crect%20x='7'%20y='7'%20width='50'%20height='5'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.14'/%3e%3crect%20x='7'%20y='16'%20width='22'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.18'/%3e%3crect%20x='7'%20y='23'%20width='35'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.12'/%3e%3crect%20x='7'%20y='30'%20width='16'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.1'/%3e%3crect%20x='45'%20y='18'%20width='12'%20height='16'%20rx='2'%20fill='%23c5cede'%20fill-opacity='0.08'/%3e%3c/svg%3e", Ct = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='11'%20height='40'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='6.5'%20y='7'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='6.5'%20y='11'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='14.5'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='18'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='17'%20y='4'%20width='43'%20height='40'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3crect%20x='21'%20y='10'%20width='14'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.16'/%3e%3crect%20x='21'%20y='18'%20width='24'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.12'/%3e%3crect%20x='21'%20y='26'%20width='18'%20height='4'%20rx='1'%20fill='%23c5cede'%20fill-opacity='0.1'/%3e%3c/svg%3e", wt = ["src", "alt"], Tt = /* @__PURE__ */ L({
356
+ __name: "ThemedSvgImage",
357
+ props: {
358
+ src: {},
359
+ primaryColor: {},
360
+ alt: { default: "" }
361
+ },
362
+ setup(e) {
363
+ let t = e, n = /* @__PURE__ */ new Map(), r = H(t.src);
364
+ async function i(e) {
365
+ let t = n.get(e);
366
+ if (t) return t;
367
+ let r = await fetch(e);
368
+ if (!r.ok) throw Error(`Failed to load SVG: ${e}`);
369
+ let i = await r.text();
370
+ return n.set(e, i), i;
371
+ }
372
+ function a(e, t) {
373
+ let n = e.replaceAll("#409EFF", t);
374
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;
375
+ }
376
+ return oe((e) => {
377
+ let n = !1, o = t.src, s = t.primaryColor;
378
+ r.value = o, i(o).then((e) => {
379
+ n || (r.value = a(e, s));
380
+ }).catch(() => {
381
+ n || (r.value = o);
382
+ }), e(() => {
383
+ n = !0;
384
+ });
385
+ }), (t, n) => (V(), N("img", {
386
+ src: r.value,
387
+ alt: e.alt
388
+ }, null, 8, wt));
389
+ }
390
+ }), Et = { class: "settings-section" }, Dt = { class: "settings-mode-grid" }, Ot = ["onClick"], kt = { class: "settings-section" }, At = {
391
+ key: 0,
392
+ class: "settings-section__header"
393
+ }, jt = {
394
+ key: 1,
395
+ class: "settings-position-grid"
396
+ }, Mt = ["onClick"], Nt = { class: "settings-position-card__label" }, Pt = { class: "settings-section" }, Ft = { class: "settings-color-grid" }, It = ["onClick"], Lt = { class: "settings-color-card__label" }, Rt = { class: "settings-color-card__swatch settings-color-card__swatch--custom" }, zt = /* @__PURE__ */ L({
397
+ __name: "AppearanceSettings",
398
+ setup(e) {
399
+ let t = f(), n = k(() => !v.some((e) => e.value.toLowerCase() === t.themeColor.toLowerCase())), r = [
400
+ {
401
+ label: "浅色",
402
+ value: "light",
403
+ icon: Ie
404
+ },
405
+ {
406
+ label: "深色",
407
+ value: "dark",
408
+ icon: Ae
409
+ },
410
+ {
411
+ label: "跟随系统",
412
+ value: "system",
413
+ icon: ke
414
+ }
415
+ ], i = [
416
+ {
417
+ label: "不应用",
418
+ value: "none",
419
+ previewSrc: St
420
+ },
421
+ {
422
+ label: "顶部",
423
+ value: "header",
424
+ previewSrc: xt
425
+ },
426
+ {
427
+ label: "侧边栏",
428
+ value: "sidebar",
429
+ previewSrc: Ct
430
+ }
431
+ ];
432
+ function a(e) {
433
+ e && t.setThemeColor(e);
434
+ }
435
+ return (e, o) => {
436
+ let s = W("el-icon"), c = W("el-color-picker");
437
+ return V(), N(D, null, [
438
+ P("div", Et, [o[0] ||= P("div", { class: "settings-section__header" }, [P("span", { class: "settings-section__title" }, "主题模式"), P("span", { class: "settings-section__desc" }, "选择浅色、深色或跟随系统")], -1), P("div", Dt, [(V(), N(D, null, U(r, (e) => P("button", {
439
+ key: e.value,
440
+ type: "button",
441
+ class: z(["settings-mode-card", { "is-active": q(t).themeMode === e.value }]),
442
+ onClick: (n) => q(t).setThemeMode(e.value)
443
+ }, [I(s, { size: 20 }, {
444
+ default: Y(() => [(V(), j(G(e.icon)))]),
445
+ _: 2
446
+ }, 1024), P("strong", null, K(e.label), 1)], 10, Ot)), 64))])]),
447
+ P("div", kt, [q(t).isDark ? M("", !0) : (V(), N("div", At, [...o[1] ||= [P("span", { class: "settings-section__title" }, "主题色应用", -1), P("span", { class: "settings-section__desc" }, "选择主题色应用位置", -1)]])), q(t).isDark ? M("", !0) : (V(), N("div", jt, [(V(), N(D, null, U(i, (e) => P("button", {
448
+ key: e.value,
449
+ type: "button",
450
+ class: z(["settings-position-card", { "is-active": q(t).themeColorPosition === e.value }]),
451
+ onClick: (n) => q(t).setThemeColorPosition(e.value)
452
+ }, [I(Tt, {
453
+ class: "settings-position-card__preview",
454
+ src: e.previewSrc,
455
+ "primary-color": q(t).themeColor
456
+ }, null, 8, ["src", "primary-color"]), P("span", Nt, K(e.label), 1)], 10, Mt)), 64))]))]),
457
+ P("div", Pt, [o[3] ||= P("div", { class: "settings-section__header" }, [P("span", { class: "settings-section__title" }, "主题色"), P("span", { class: "settings-section__desc" }, "选择系统主题颜色")], -1), P("div", Ft, [(V(!0), N(D, null, U(q(v), (e) => (V(), N("button", {
458
+ key: e.value,
459
+ type: "button",
460
+ class: z(["settings-color-card", { "is-active": q(t).themeColor === e.value }]),
461
+ onClick: (n) => q(t).setThemeColor(e.value)
462
+ }, [P("span", {
463
+ class: "settings-color-card__swatch",
464
+ style: B({ backgroundColor: e.value })
465
+ }, null, 4), P("span", Lt, K(e.label), 1)], 10, It))), 128)), P("div", { class: z(["settings-color-card settings-color-card--custom", { "is-active": n.value }]) }, [
466
+ I(c, {
467
+ class: "settings-color-card__picker",
468
+ "model-value": q(t).themeColor,
469
+ "onUpdate:modelValue": a
470
+ }, null, 8, ["model-value"]),
471
+ P("span", Rt, [I(s, { size: 18 }, {
472
+ default: Y(() => [I(q(_e))]),
473
+ _: 1
474
+ })]),
475
+ o[2] ||= P("span", { class: "settings-color-card__label" }, "自定义", -1)
476
+ ], 2)])])
477
+ ], 64);
478
+ };
479
+ }
480
+ }), Bt = { class: "settings-section" }, Vt = { class: "settings-inline-setting settings-inline-setting--compact" }, Ht = /* @__PURE__ */ L({
481
+ __name: "GeneralSettings",
482
+ setup(e) {
483
+ let t = H(Xr(!0));
484
+ function n(e) {
485
+ let n = !!e;
486
+ if (t.value = n, Zr(n), n) {
487
+ di();
488
+ return;
489
+ }
490
+ ui();
491
+ }
492
+ return (e, r) => {
493
+ let i = W("el-switch");
494
+ return V(), N("div", Bt, [P("div", Vt, [r[0] ||= P("div", null, [P("strong", null, "版本更新检查"), P("p", null, "定时检测新版本并提醒刷新")], -1), I(i, {
495
+ "model-value": t.value,
496
+ "onUpdate:modelValue": n
497
+ }, null, 8, ["model-value"])])]);
498
+ };
499
+ }
500
+ }), Ut = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='11'%20height='40'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='6.5'%20y='7'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='6.5'%20y='11'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='14.5'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='18'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='17'%20y='4'%20width='43'%20height='7'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='19.5'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='27.5'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='35.5'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='17'%20y='13'%20width='43'%20height='31'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3c/svg%3e", Wt = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='11'%20height='40'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='6.5'%20y='7'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='6.5'%20y='11'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='14.5'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='6.5'%20y='18'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='17'%20y='4'%20width='43'%20height='40'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3c/svg%3e", Gt = "data:image/svg+xml,%3csvg%20viewBox='0%200%2064%2048'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='64'%20height='48'%20rx='3'%20fill='%23c5cede'%20fill-opacity='0.04'/%3e%3crect%20x='4'%20y='4'%20width='56'%20height='7'%20rx='1.5'%20fill='%23409EFF'/%3e%3crect%20x='7'%20y='6.5'%20width='2'%20height='2'%20rx='1'%20fill='white'%20fill-opacity='0.95'/%3e%3crect%20x='11'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='19'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='27'%20y='7.25'%20width='6'%20height='1.5'%20rx='0.75'%20fill='white'%20fill-opacity='0.75'/%3e%3crect%20x='4'%20y='13'%20width='56'%20height='31'%20rx='1.5'%20fill='%23c5cede'%20fill-opacity='0.06'/%3e%3c/svg%3e", Kt = { class: "settings-section" }, qt = { class: "settings-layout-grid" }, Jt = ["onClick"], Yt = { class: "settings-layout-card__label" }, Xt = { class: "settings-section" }, Zt = { class: "settings-inline-setting" }, Qt = {
501
+ key: 0,
502
+ class: "settings-section"
503
+ }, $t = { class: "settings-menu-search-grid" }, en = ["onClick"], tn = /* @__PURE__ */ L({
504
+ __name: "LayoutSettings",
505
+ setup(e) {
506
+ let t = f(), n = [
507
+ {
508
+ label: "默认",
509
+ value: "default",
510
+ previewSrc: St
511
+ },
512
+ {
513
+ label: "侧边导航",
514
+ value: "side",
515
+ previewSrc: Wt
516
+ },
517
+ {
518
+ label: "顶部导航",
519
+ value: "top",
520
+ previewSrc: Gt
521
+ },
522
+ {
523
+ label: "混合导航",
524
+ value: "mix",
525
+ previewSrc: Ut
526
+ }
527
+ ], r = [{
528
+ label: "顶部搜索",
529
+ value: "header",
530
+ icon: Pe
531
+ }, {
532
+ label: "侧边搜索",
533
+ value: "sidebar",
534
+ icon: je
535
+ }];
536
+ return (e, i) => {
537
+ let a = W("el-switch"), o = W("el-icon");
538
+ return V(), N(D, null, [
539
+ P("div", Kt, [i[0] ||= P("div", { class: "settings-section__header" }, [P("span", { class: "settings-section__title" }, "布局模式"), P("span", { class: "settings-section__desc" }, "切换侧边、顶部或混合导航")], -1), P("div", qt, [(V(), N(D, null, U(n, (e) => P("button", {
540
+ key: e.value,
541
+ type: "button",
542
+ class: z(["settings-layout-card", { "is-active": q(t).layoutMode === e.value }]),
543
+ onClick: (n) => q(t).setLayoutMode(e.value)
544
+ }, [I(Tt, {
545
+ class: "settings-layout-card__preview",
546
+ src: e.previewSrc,
547
+ "primary-color": q(t).themeColor
548
+ }, null, 8, ["src", "primary-color"]), P("span", Yt, K(e.label), 1)], 10, Jt)), 64))])]),
549
+ P("div", Xt, [P("div", Zt, [i[1] ||= P("div", null, [P("strong", null, "默认折叠侧边栏"), P("p", null, "适合屏幕较窄或想保留更多内容区空间")], -1), I(a, {
550
+ "model-value": q(t).sidebarCollapsed,
551
+ "onUpdate:modelValue": q(t).setSidebarCollapsed
552
+ }, null, 8, ["model-value", "onUpdate:modelValue"])])]),
553
+ q(t).layoutMode === "top" ? M("", !0) : (V(), N("div", Qt, [i[2] ||= P("div", { class: "settings-section__header" }, [P("span", { class: "settings-section__title" }, "菜单搜索位置"), P("span", { class: "settings-section__desc" }, "顶部或侧边栏顶部搜索")], -1), P("div", $t, [(V(), N(D, null, U(r, (e) => P("button", {
554
+ key: e.value,
555
+ type: "button",
556
+ class: z(["settings-mode-card", { "is-active": q(t).menuSearchPlacement === e.value }]),
557
+ onClick: (n) => q(t).setMenuSearchPlacement(e.value)
558
+ }, [I(o, { size: 20 }, {
559
+ default: Y(() => [(V(), j(G(e.icon)))]),
560
+ _: 2
561
+ }, 1024), P("strong", null, K(e.label), 1)], 10, en)), 64))])]))
562
+ ], 64);
563
+ };
564
+ }
565
+ }), nn = { class: "shortcut-settings" }, rn = { class: "shortcut-master-switch" }, an = { class: "shortcut-group__title" }, on = { class: "shortcut-list" }, sn = { class: "shortcut-item__copy" }, cn = { class: "shortcut-item__control" }, ln = ["aria-label"], un = /* @__PURE__ */ y(/* @__PURE__ */ L({
566
+ __name: "ShortcutSettings",
567
+ setup(e) {
568
+ let t = ft(), n = {
569
+ global: "全局",
570
+ navigation: "导航",
571
+ other: "其他"
572
+ }, r = k(() => {
573
+ let e = /* @__PURE__ */ new Map();
574
+ for (let n of t.shortcuts) {
575
+ let t = e.get(n.category) ?? [];
576
+ t.push(n), e.set(n.category, t);
577
+ }
578
+ return Array.from(e.entries()).map(([e, t]) => ({
579
+ category: e,
580
+ label: n[e],
581
+ shortcuts: t
582
+ }));
583
+ });
584
+ return (e, n) => {
585
+ let i = W("el-switch");
586
+ return V(), N("div", nn, [P("div", rn, [n[1] ||= P("div", { class: "shortcut-master-switch__copy" }, [P("strong", null, "快捷键"), P("span", null, "启用或停用全部键盘快捷操作")], -1), I(i, {
587
+ "model-value": q(t).shortcutEnabled,
588
+ onChange: n[0] ||= (e) => q(t).toggleShortcutEnabled()
589
+ }, null, 8, ["model-value"])]), (V(!0), N(D, null, U(r.value, (e) => (V(), N("div", {
590
+ key: e.category,
591
+ class: z(["shortcut-group", { "is-disabled": !q(t).shortcutEnabled }])
592
+ }, [P("div", an, K(e.label), 1), P("div", on, [(V(!0), N(D, null, U(e.shortcuts, (e) => (V(), N("div", {
593
+ key: e.id,
594
+ class: "shortcut-item"
595
+ }, [P("div", sn, [P("strong", null, K(e.name), 1), P("span", null, K(e.description), 1)]), P("div", cn, [P("div", {
596
+ class: "shortcut-keys",
597
+ "aria-label": q(vt)(e.keys)
598
+ }, [(V(!0), N(D, null, U(q(_t)(e.keys), (t, n) => (V(), N("kbd", {
599
+ key: `${e.id}-${t.original}-${n}`,
600
+ class: "shortcut-key"
601
+ }, K(t.symbol || t.display), 1))), 128))], 8, ln), I(i, {
602
+ "model-value": e.enabled,
603
+ disabled: !q(t).shortcutEnabled,
604
+ onChange: (n) => q(t).toggleShortcut(e.id)
605
+ }, null, 8, [
606
+ "model-value",
607
+ "disabled",
608
+ "onChange"
609
+ ])])]))), 128))])], 2))), 128))]);
610
+ };
611
+ }
612
+ }), [["__scopeId", "data-v-2b492d65"]]), dn = /* @__PURE__ */ L({
613
+ __name: "SystemSettingsDrawer",
614
+ setup(e) {
615
+ let t = f();
616
+ function n(e) {
617
+ e || t.closeSettings();
618
+ }
619
+ return (e, r) => {
620
+ let i = W("el-tab-pane"), a = W("el-tabs");
621
+ return V(), j(q(ue), {
622
+ "model-value": q(t).settingsVisible,
623
+ title: "主题设置",
624
+ direction: "rtl",
625
+ size: "380px",
626
+ class: "settings-drawer",
627
+ "show-footer": !1,
628
+ "onUpdate:modelValue": n
629
+ }, {
630
+ default: Y(() => [I(a, {
631
+ modelValue: q(t).settingsActiveTab,
632
+ "onUpdate:modelValue": r[0] ||= (e) => q(t).settingsActiveTab = e,
633
+ class: "settings-tabs"
634
+ }, {
635
+ default: Y(() => [
636
+ I(i, {
637
+ label: "外观",
638
+ name: "theme"
639
+ }, {
640
+ default: Y(() => [I(zt)]),
641
+ _: 1
642
+ }),
643
+ I(i, {
644
+ label: "布局",
645
+ name: "layout"
646
+ }, {
647
+ default: Y(() => [I(tn)]),
648
+ _: 1
649
+ }),
650
+ I(i, {
651
+ label: "通用",
652
+ name: "general"
653
+ }, {
654
+ default: Y(() => [I(Ht)]),
655
+ _: 1
656
+ }),
657
+ I(i, {
658
+ label: "快捷键",
659
+ name: "shortcut"
660
+ }, {
661
+ default: Y(() => [I(un)]),
662
+ _: 1
663
+ })
664
+ ]),
665
+ _: 1
666
+ }, 8, ["modelValue"])]),
667
+ _: 1
668
+ }, 8, ["model-value"]);
669
+ };
670
+ }
671
+ }), fn = /* @__PURE__ */ L({
672
+ __name: "AppContentView",
673
+ props: { refreshKey: {} },
674
+ setup(e) {
675
+ let t = e;
676
+ function n(e, n) {
677
+ return n ? e : `${e}:${t.refreshKey}`;
678
+ }
679
+ return (e, t) => {
680
+ let r = W("router-view"), i = W("el-main");
681
+ return V(), j(i, { class: "app-layout__main" }, {
682
+ default: Y(() => [I(r, null, {
683
+ default: Y(({ Component: e, route: t }) => [(V(), j(G(e), { key: n(t.fullPath, !!t.meta.microApp) }))]),
684
+ _: 1
685
+ })]),
686
+ _: 1
687
+ });
688
+ };
689
+ }
690
+ }), pn = ["title"], mn = /* @__PURE__ */ y(/* @__PURE__ */ L({
691
+ __name: "ThemeToggleButton",
692
+ setup(e) {
693
+ let t = f();
694
+ async function n(e) {
695
+ await u(e, () => {
696
+ t.toggleDarkMode();
697
+ });
698
+ }
699
+ return (e, r) => {
700
+ let i = W("el-icon");
701
+ return V(), N("button", {
702
+ type: "button",
703
+ class: "app-layout__header-tool-btn theme-icon-btn",
704
+ title: q(t).isDark ? "切换浅色模式" : "切换深色模式",
705
+ onClick: n
706
+ }, [I(i, { size: 20 }, {
707
+ default: Y(() => [(V(), j(G(q(t).isDark ? q(Ie) : q(Ae))))]),
708
+ _: 1
709
+ })], 8, pn);
710
+ };
711
+ }
712
+ }), [["__scopeId", "data-v-73aaf569"]]);
713
+ //#endregion
714
+ //#region src/main/layouts/composables/useAppMenus.ts
715
+ function hn() {
716
+ let e = C(), t = ee(), n = f(), r = a(), i = k(() => gn(t.options.routes.find((e) => e.path === "/")?.children ?? [], "", r.hasPermission)), o = k(() => i.value), s = k(() => n.isMobileViewport || n.layoutMode !== "mix" ? i.value : i.value.find((e) => e.fullPath === n.selectedTopMenuPath)?.children ?? []), c = k(() => _n(i.value).filter((e) => !e.children?.length)), l = k(() => _n(s.value).filter((e) => !e.children?.length));
717
+ return {
718
+ activeMenu: k(() => e.path),
719
+ activeTopMenuPath: k(() => {
720
+ let t = e.path;
721
+ return o.value.find((e) => t === e.fullPath || t.startsWith(`${e.fullPath}/`))?.fullPath || n.selectedTopMenuPath;
722
+ }),
723
+ allMenus: i,
724
+ flatMenus: c,
725
+ flatSideMenus: l,
726
+ findFirstLeafNode: vn,
727
+ findFirstLeafPath: yn,
728
+ sideMenus: s,
729
+ topMenus: o
730
+ };
731
+ }
732
+ function gn(e, t, n) {
733
+ return e.filter((e) => !e.meta?.hidden && xn(e, n)).map((e) => {
734
+ let r = Cn(e.path, t), i = e.children?.length ? gn(e.children, r, n) : void 0;
735
+ return {
736
+ path: e.path,
737
+ fullPath: r,
738
+ title: String(e.meta?.title ?? e.name ?? "未命名菜单"),
739
+ icon: e.meta?.icon ? String(e.meta.icon) : void 0,
740
+ children: i
741
+ };
742
+ }).filter((t) => t.children?.length || !Sn(e, t.path));
743
+ }
744
+ function _n(e) {
745
+ return e.flatMap((e) => [e, ..._n(e.children ?? [])]);
746
+ }
747
+ function vn(e) {
748
+ if (!e.children?.length) return e;
749
+ for (let t of e.children) {
750
+ let e = vn(t);
751
+ if (e) return e;
752
+ }
753
+ return null;
754
+ }
755
+ function yn(e, t, n = "") {
756
+ for (let r of e) {
757
+ let e = Cn(r.path, n);
758
+ if (e === t) return bn(r, n);
759
+ if (r.children?.length) {
760
+ let n = yn(r.children, t, e);
761
+ if (n) return n;
762
+ }
763
+ }
764
+ return null;
765
+ }
766
+ function bn(e, t) {
767
+ let n = Cn(e.path, t);
768
+ if (e.component) return n;
769
+ let r = e.children ?? [];
770
+ for (let e of r) {
771
+ let t = Cn(e.path, n);
772
+ if (e.component) return t;
773
+ }
774
+ for (let e of r) {
775
+ let t = bn(e, n);
776
+ if (t) return t;
777
+ }
778
+ return null;
779
+ }
780
+ function xn(e, t) {
781
+ let n = e.meta?.permission;
782
+ return n ? Array.isArray(n) ? n.every((e) => t(String(e))) : t(String(n)) : !0;
783
+ }
784
+ function Sn(e, t) {
785
+ let n = e.find((e) => e.path === t);
786
+ return !!(n?.redirect && !n.component && !n.children?.length);
787
+ }
788
+ function Cn(e, t) {
789
+ return e.startsWith("/") ? e : `${t}/${e}`.replace(/\/+/g, "/");
790
+ }
791
+ //#endregion
792
+ //#region src/main/layouts/components/AppBrandLogo.vue?vue&type=script&setup=true&lang.ts
793
+ var wn = ["src", "alt"], Tn = ["src", "alt"], En = /* @__PURE__ */ y(/* @__PURE__ */ L({
794
+ __name: "AppBrandLogo",
795
+ props: {
796
+ src: {},
797
+ alt: {},
798
+ textInverted: {
799
+ type: Boolean,
800
+ default: !1
801
+ },
802
+ width: { default: "158px" },
803
+ height: { default: "40px" }
804
+ },
805
+ setup(e) {
806
+ let t = e, n = k(() => ({
807
+ "--app-brand-logo-width": t.width,
808
+ "--app-brand-logo-height": t.height
809
+ }));
810
+ return (t, r) => (V(), N("span", {
811
+ class: "app-brand-logo",
812
+ style: B(n.value)
813
+ }, [P("img", {
814
+ src: e.src,
815
+ alt: e.alt,
816
+ class: z(["app-brand-logo__image", { "is-text-base": e.textInverted }])
817
+ }, null, 10, wn), e.textInverted ? (V(), N("img", {
818
+ key: 0,
819
+ src: e.src,
820
+ alt: e.alt,
821
+ class: "app-brand-logo__image app-brand-logo__image--text-inverted",
822
+ "aria-hidden": "true"
823
+ }, null, 8, Tn)) : M("", !0)], 4));
824
+ }
825
+ }), [["__scopeId", "data-v-a42b8639"]]), Dn = {
826
+ Connection: ye,
827
+ Document: Se,
828
+ Grid: Ee,
829
+ House: De,
830
+ Setting: Fe,
831
+ Upload: ze,
832
+ User: Be
833
+ };
834
+ function Q(e) {
835
+ return e ? Dn[e] ?? De : De;
836
+ }
837
+ //#endregion
838
+ //#region src/main/layouts/components/AppHeaderMenuNode.vue
839
+ var On = /* @__PURE__ */ L({
840
+ name: "AppHeaderMenuNode",
841
+ __name: "AppHeaderMenuNode",
842
+ props: { node: {} },
843
+ setup(e) {
844
+ return (t, n) => {
845
+ let r = W("el-icon"), i = W("AppHeaderMenuNode", !0), a = W("el-sub-menu"), o = W("el-menu-item");
846
+ return e.node.children?.length ? (V(), j(a, {
847
+ key: 0,
848
+ index: e.node.fullPath
849
+ }, {
850
+ title: Y(() => [e.node.icon ? (V(), j(r, { key: 0 }, {
851
+ default: Y(() => [(V(), j(G(q(Q)(e.node.icon))))]),
852
+ _: 1
853
+ })) : M("", !0), P("span", null, K(e.node.title), 1)]),
854
+ default: Y(() => [(V(!0), N(D, null, U(e.node.children, (e) => (V(), j(i, {
855
+ key: e.fullPath,
856
+ node: e
857
+ }, null, 8, ["node"]))), 128))]),
858
+ _: 1
859
+ }, 8, ["index"])) : (V(), j(o, {
860
+ key: 1,
861
+ index: e.node.fullPath
862
+ }, {
863
+ default: Y(() => [e.node.icon ? (V(), j(r, { key: 0 }, {
864
+ default: Y(() => [(V(), j(G(q(Q)(e.node.icon))))]),
865
+ _: 1
866
+ })) : M("", !0), P("span", null, K(e.node.title), 1)]),
867
+ _: 1
868
+ }, 8, ["index"]));
869
+ };
870
+ }
871
+ }), kn = "data:image/svg+xml,%3csvg%20width='18'%20height='18'%20viewBox='0%200%2018%2018'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M13.5%204.5V8.25C13.5%209.49264%2012.4926%2010.5%2011.25%2010.5H4.5'%20stroke='%23fff'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3cpath%20d='M7.5%207.5L4.5%2010.5L7.5%2013.5'%20stroke='%23fff'%20stroke-width='1.8'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e", An = { class: "app-menu-search-item__icon" }, jn = { class: "app-menu-search-item__body" }, Mn = {
872
+ key: 0,
873
+ class: "app-menu-search-item__actions"
874
+ }, Nn = { class: "app-menu-search-item__enter" }, Pn = ["src"], Fn = /* @__PURE__ */ L({
875
+ __name: "AppMenuSearchItem",
876
+ props: {
877
+ active: { type: Boolean },
878
+ item: {},
879
+ removable: { type: Boolean }
880
+ },
881
+ emits: [
882
+ "enter",
883
+ "remove",
884
+ "select"
885
+ ],
886
+ setup(e, { emit: t }) {
887
+ let n = t;
888
+ return (t, r) => {
889
+ let i = W("el-icon");
890
+ return V(), N("div", {
891
+ class: z(["app-menu-search-item", { "is-active": e.active }]),
892
+ onMouseenter: r[4] ||= (t) => n("enter", e.item)
893
+ }, [P("div", {
894
+ class: "app-menu-search-item__main",
895
+ role: "button",
896
+ tabindex: "0",
897
+ onClick: r[1] ||= (t) => n("select", e.item),
898
+ onKeydown: [r[2] ||= se(X((t) => n("select", e.item), ["prevent"]), ["enter"]), r[3] ||= se(X((t) => n("select", e.item), ["prevent"]), ["space"])]
899
+ }, [
900
+ P("span", An, [I(i, null, {
901
+ default: Y(() => [(V(), j(G(q(Q)(e.item.icon))))]),
902
+ _: 1
903
+ })]),
904
+ P("span", jn, [P("strong", null, K(e.item.title), 1), P("span", null, K(e.item.fullPath), 1)]),
905
+ I(O, { name: "app-menu-search-actions" }, {
906
+ default: Y(() => [e.active ? (V(), N("span", Mn, [P("span", Nn, [P("img", {
907
+ src: q(kn),
908
+ alt: "",
909
+ "aria-hidden": "true"
910
+ }, null, 8, Pn)]), e.removable ? (V(), N("button", {
911
+ key: 0,
912
+ class: "app-menu-search-item__remove",
913
+ type: "button",
914
+ "aria-label": "删除搜索历史",
915
+ onClick: r[0] ||= X((t) => n("remove", e.item), ["stop"])
916
+ }, [I(i, null, {
917
+ default: Y(() => [I(q(ve))]),
918
+ _: 1
919
+ })])) : M("", !0)])) : M("", !0)]),
920
+ _: 1
921
+ })
922
+ ], 32)], 34);
923
+ };
924
+ }
925
+ }), In = { class: "app-menu-search__control" }, Ln = {
926
+ key: 0,
927
+ class: "app-menu-search__section"
928
+ }, Rn = {
929
+ key: 1,
930
+ class: "app-menu-search__section"
931
+ }, zn = {
932
+ key: 2,
933
+ class: "app-menu-search__empty"
934
+ }, Bn = { class: "app-menu-search__footer" }, Vn = "menu-search-history", Hn = 8, Un = 70, Wn = 28, Gn = 520, Kn = /* @__PURE__ */ L({
935
+ __name: "AppMenuSearch",
936
+ props: { modelValue: { type: Boolean } },
937
+ emits: ["update:modelValue"],
938
+ setup(e, { emit: t }) {
939
+ let n = e, r = t, i = ee(), { flatMenus: a } = hn(), o = H(), s = H(), c = H(""), l = H(0), u = H(null), d = H(E()), f = k(() => c.value.trim().toLowerCase()), p = k(() => f.value ? a.value.filter((e) => {
940
+ let t = e.title.toLowerCase(), n = e.fullPath.toLowerCase();
941
+ return t.includes(f.value) || n.includes(f.value);
942
+ }) : []), m = k(() => c.value ? p.value : d.value), h = k(() => c.value ? !p.value.length : !d.value.length);
943
+ J(() => n.modelValue, (e) => {
944
+ if (!e) {
945
+ B();
946
+ return;
947
+ }
948
+ d.value = E(), c.value = "", u.value = d.value[0] ?? null, l.value = 0, document.body.classList.add("app-menu-search-open"), z(), R(() => {
949
+ o.value?.focus?.(), s.value?.setScrollTop?.(0);
950
+ });
951
+ }), J(p, (e) => {
952
+ u.value = e[0] ?? null, s.value?.setScrollTop?.(0);
953
+ }), re(() => {
954
+ B();
955
+ });
956
+ function g() {
957
+ r("update:modelValue", !1), B();
958
+ }
959
+ function _(e) {
960
+ u.value = e;
961
+ }
962
+ function v(e) {
963
+ T(e), g(), i.push(e.fullPath);
964
+ }
965
+ function y(e) {
966
+ let t = d.value.filter((t) => t.fullPath !== e.fullPath);
967
+ A(t), u.value?.fullPath === e.fullPath && (u.value = t[0] ?? null);
968
+ }
969
+ function b() {
970
+ A([]), u.value = null;
971
+ }
972
+ function x(e) {
973
+ l.value = e.scrollTop;
974
+ }
975
+ function S(e) {
976
+ if (n.modelValue && !e.isComposing) {
977
+ if (e.code === "Escape") {
978
+ e.preventDefault(), g();
979
+ return;
980
+ }
981
+ if (e.code === "Enter" && u.value) {
982
+ e.preventDefault(), v(u.value);
983
+ return;
984
+ }
985
+ (e.code === "ArrowDown" || e.code === "ArrowUp") && (e.preventDefault(), C(e.code === "ArrowDown" ? 1 : -1));
986
+ }
987
+ }
988
+ function C(e) {
989
+ let t = m.value;
990
+ if (!t.length) return;
991
+ let n = L((u.value ? t.findIndex((e) => e.fullPath === u.value?.fullPath) : -1) + e, 0, t.length - 1), r = t[n];
992
+ r && (u.value = r, w(n));
993
+ }
994
+ function w(e) {
995
+ let t = Wn + e * Un, n = l.value, r = l.value + Gn - Un;
996
+ t < n ? s.value?.setScrollTop?.(t) : t > r && s.value?.setScrollTop?.(t - Gn + Un);
997
+ }
998
+ function T(e) {
999
+ A([e, ...d.value.filter((t) => t.fullPath !== e.fullPath)].slice(0, Hn));
1000
+ }
1001
+ function E() {
1002
+ try {
1003
+ let e = localStorage.getItem(Vn);
1004
+ if (!e) return [];
1005
+ let t = JSON.parse(e), n = new Set(a.value.map((e) => e.fullPath));
1006
+ return t.filter((e) => n.has(e.fullPath));
1007
+ } catch {
1008
+ return [];
1009
+ }
1010
+ }
1011
+ function A(e) {
1012
+ if (d.value = e, !e.length) {
1013
+ localStorage.removeItem(Vn);
1014
+ return;
1015
+ }
1016
+ localStorage.setItem(Vn, JSON.stringify(e));
1017
+ }
1018
+ function L(e, t, n) {
1019
+ return Math.min(Math.max(e, t), n);
1020
+ }
1021
+ function z() {
1022
+ window.removeEventListener("keydown", S, !0), window.addEventListener("keydown", S, !0);
1023
+ }
1024
+ function B() {
1025
+ document.body.classList.remove("app-menu-search-open"), window.removeEventListener("keydown", S, !0);
1026
+ }
1027
+ return (t, n) => {
1028
+ let r = W("el-icon"), i = W("el-input"), a = W("el-scrollbar");
1029
+ return V(), j(te, { to: "body" }, [I(O, { name: "app-menu-search-fade" }, {
1030
+ default: Y(() => [e.modelValue ? (V(), N("section", {
1031
+ key: 0,
1032
+ class: "app-menu-search",
1033
+ tabindex: "-1",
1034
+ onClick: X(g, ["self"])
1035
+ }, [P("div", {
1036
+ class: "app-menu-search__panel",
1037
+ onClick: n[1] ||= X(() => {}, ["stop"])
1038
+ }, [
1039
+ P("div", In, [I(i, {
1040
+ ref_key: "searchInputRef",
1041
+ ref: o,
1042
+ modelValue: c.value,
1043
+ "onUpdate:modelValue": n[0] ||= (e) => c.value = e,
1044
+ size: "large",
1045
+ placeholder: "搜索页面名称或路径",
1046
+ clearable: ""
1047
+ }, {
1048
+ prefix: Y(() => [I(r, null, {
1049
+ default: Y(() => [I(q(Pe))]),
1050
+ _: 1
1051
+ })]),
1052
+ _: 1
1053
+ }, 8, ["modelValue"])]),
1054
+ I(a, {
1055
+ ref_key: "scrollbarRef",
1056
+ ref: s,
1057
+ class: "app-menu-search__scroll",
1058
+ "max-height": "520px",
1059
+ onScroll: x
1060
+ }, {
1061
+ default: Y(() => [
1062
+ p.value.length ? (V(), N("div", Ln, [n[2] ||= P("div", { class: "app-menu-search__section-title" }, "页面", -1), I(ne, {
1063
+ name: "app-menu-search-list",
1064
+ tag: "div",
1065
+ class: "app-menu-search__list"
1066
+ }, {
1067
+ default: Y(() => [(V(!0), N(D, null, U(p.value, (e) => (V(), j(Fn, {
1068
+ key: e.fullPath,
1069
+ active: u.value?.fullPath === e.fullPath,
1070
+ item: e,
1071
+ onEnter: _,
1072
+ onSelect: v
1073
+ }, null, 8, ["active", "item"]))), 128))]),
1074
+ _: 1
1075
+ })])) : M("", !0),
1076
+ !c.value && d.value.length ? (V(), N("div", Rn, [P("div", { class: "app-menu-search__section-header" }, [n[3] ||= P("div", { class: "app-menu-search__section-title" }, "搜索历史", -1), P("button", {
1077
+ class: "app-menu-search__clear",
1078
+ type: "button",
1079
+ onClick: b
1080
+ }, " 清空 ")]), I(ne, {
1081
+ name: "app-menu-search-list",
1082
+ tag: "div",
1083
+ class: "app-menu-search__list"
1084
+ }, {
1085
+ default: Y(() => [(V(!0), N(D, null, U(d.value, (e) => (V(), j(Fn, {
1086
+ key: e.fullPath,
1087
+ active: u.value?.fullPath === e.fullPath,
1088
+ item: e,
1089
+ removable: "",
1090
+ onEnter: _,
1091
+ onRemove: y,
1092
+ onSelect: v
1093
+ }, null, 8, ["active", "item"]))), 128))]),
1094
+ _: 1
1095
+ })])) : M("", !0),
1096
+ h.value ? (V(), N("div", zn, K(c.value ? "没有匹配的页面" : "没有搜索历史"), 1)) : M("", !0)
1097
+ ]),
1098
+ _: 1
1099
+ }, 512),
1100
+ P("div", Bn, [
1101
+ n[5] ||= P("span", null, [P("kbd", null, "Enter"), F("选择")], -1),
1102
+ P("span", null, [
1103
+ I(r, null, {
1104
+ default: Y(() => [I(q(pe))]),
1105
+ _: 1
1106
+ }),
1107
+ I(r, null, {
1108
+ default: Y(() => [I(q(he))]),
1109
+ _: 1
1110
+ }),
1111
+ n[4] ||= F("切换", -1)
1112
+ ]),
1113
+ n[6] ||= P("span", null, [P("kbd", null, "Esc"), F("关闭")], -1)
1114
+ ])
1115
+ ])])) : M("", !0)]),
1116
+ _: 1
1117
+ })]);
1118
+ };
1119
+ }
1120
+ });
1121
+ //#endregion
1122
+ //#region src/main/layouts/composables/useShortcutLabel.ts
1123
+ function qn() {
1124
+ let e = ft();
1125
+ return {
1126
+ isMac: k(() => typeof navigator > "u" ? !1 : /Mac|iPhone|iPad|iPod/i.test(navigator.platform)),
1127
+ searchShortcutLabel: k(() => vt(e.getShortcutKeys("search"), { useSymbol: !0 }))
1128
+ };
1129
+ }
1130
+ //#endregion
1131
+ //#region src/main/layouts/components/AppMenuSearchTrigger.vue?vue&type=script&setup=true&lang.ts
1132
+ var Jn = { class: "app-menu-search-trigger__shortcut" }, Yn = /* @__PURE__ */ L({
1133
+ __name: "AppMenuSearchTrigger",
1134
+ props: { layoutMode: {} },
1135
+ emits: ["open"],
1136
+ setup(e, { emit: t }) {
1137
+ let n = t, { searchShortcutLabel: r } = qn();
1138
+ return (t, i) => {
1139
+ let a = W("el-icon");
1140
+ return V(), N("button", {
1141
+ class: z(["app-menu-search-trigger", `app-menu-search-trigger--${e.layoutMode}`]),
1142
+ type: "button",
1143
+ "aria-label": "搜索页面",
1144
+ onClick: i[0] ||= (e) => n("open")
1145
+ }, [
1146
+ I(a, null, {
1147
+ default: Y(() => [I(q(Pe))]),
1148
+ _: 1
1149
+ }),
1150
+ i[1] ||= P("span", { class: "app-menu-search-trigger__text" }, "搜索页面", -1),
1151
+ P("span", Jn, K(q(r)), 1)
1152
+ ], 2);
1153
+ };
1154
+ }
1155
+ }), Xn = { class: "app-layout__header-left" }, Zn = {
1156
+ key: 0,
1157
+ class: "app-layout__header-brand"
1158
+ }, Qn = ["title", "aria-label"], $n = { class: "app-layout__header-right" }, er = { class: "app-layout__user" }, tr = { class: "app-layout__user-copy" }, nr = /* @__PURE__ */ L({
1159
+ __name: "AppHeader",
1160
+ props: { breadcrumbItems: {} },
1161
+ setup(e) {
1162
+ let t = e, n = f(), r = a(), i = l(), o = lt(), s = ft(), c = ee(), u = C(), d = H(!1), { activeTopMenuPath: p, findFirstLeafNode: m, findFirstLeafPath: h, topMenus: g } = hn(), _ = k(() => n.themeColorPosition === "header" || n.isDark), v = k(() => _.value ? i.logoHeader : i.logoExpanded), y = k(() => _.value && v.value === i.logoExpanded);
1163
+ ie(() => {
1164
+ s.initShortcuts(), window.addEventListener("keydown", E, { capture: !0 });
1165
+ }), re(() => {
1166
+ window.removeEventListener("keydown", E, { capture: !0 });
1167
+ });
1168
+ function b(e, n) {
1169
+ if (n !== t.breadcrumbItems.length - 1) return h(c.options.routes, e.path) || e.path || "/";
1170
+ }
1171
+ async function x() {
1172
+ await o.resetTabs(), n.setSelectedTopMenuPath(""), await r.logout(), c.push("/login");
1173
+ }
1174
+ function S(e) {
1175
+ c.push(e);
1176
+ }
1177
+ function w(e) {
1178
+ let t = g.value.find((t) => t.fullPath === e);
1179
+ if (!t) return;
1180
+ n.setSelectedTopMenuPath(t.fullPath);
1181
+ let r = m(t)?.fullPath || t.fullPath;
1182
+ c.push(r);
1183
+ }
1184
+ function T() {
1185
+ d.value = !0;
1186
+ }
1187
+ function E(e) {
1188
+ e.defaultPrevented || e.repeat || d.value || s.isShortcutEnabled("search") && yt(e, s.getShortcutKeys("search")) && (e.preventDefault(), T());
1189
+ }
1190
+ return (t, a) => {
1191
+ let o = W("el-icon"), s = W("el-menu"), c = W("el-menu-item"), l = W("el-breadcrumb-item"), f = W("el-breadcrumb"), m = W("el-avatar"), h = W("el-dropdown-item"), _ = W("el-dropdown-menu"), C = W("el-dropdown"), ee = W("el-header");
1192
+ return V(), N(D, null, [I(ee, { class: "app-layout__header" }, {
1193
+ default: Y(() => [
1194
+ P("div", Xn, [
1195
+ q(n).layoutMode === "default" || q(n).layoutMode === "top" ? (V(), N("div", Zn, [I(En, {
1196
+ src: v.value,
1197
+ alt: q(i).systemName,
1198
+ "text-inverted": y.value
1199
+ }, null, 8, [
1200
+ "src",
1201
+ "alt",
1202
+ "text-inverted"
1203
+ ])])) : M("", !0),
1204
+ q(n).layoutMode !== "top" || q(n).isMobileViewport ? (V(), N("button", {
1205
+ key: 1,
1206
+ type: "button",
1207
+ class: "app-layout__header-tool-btn app-layout__header-tool-btn--collapse",
1208
+ title: q(n).isMobileViewport ? "打开菜单" : q(n).sidebarCollapsed ? "展开侧边栏" : "折叠侧边栏",
1209
+ "aria-label": q(n).isMobileViewport ? "打开菜单" : q(n).sidebarCollapsed ? "展开侧边栏" : "折叠侧边栏",
1210
+ onClick: a[0] ||= (e) => q(n).toggleSidebar()
1211
+ }, [I(o, null, {
1212
+ default: Y(() => [(V(), j(G(q(n).sidebarCollapsed && !q(n).isMobileViewport ? q(Ce) : q(we))))]),
1213
+ _: 1
1214
+ })], 8, Qn)) : M("", !0),
1215
+ q(n).layoutMode === "top" && !q(n).isMobileViewport ? (V(), j(s, {
1216
+ key: 2,
1217
+ mode: "horizontal",
1218
+ ellipsis: !1,
1219
+ "default-active": q(u).path,
1220
+ class: "app-layout__header-menu",
1221
+ onSelect: S
1222
+ }, {
1223
+ default: Y(() => [(V(!0), N(D, null, U(q(g), (e) => (V(), j(On, {
1224
+ key: e.fullPath,
1225
+ node: e
1226
+ }, null, 8, ["node"]))), 128))]),
1227
+ _: 1
1228
+ }, 8, ["default-active"])) : q(n).layoutMode === "mix" && !q(n).isMobileViewport ? (V(), j(s, {
1229
+ key: 3,
1230
+ mode: "horizontal",
1231
+ ellipsis: !1,
1232
+ "default-active": q(p),
1233
+ class: "app-layout__header-menu app-layout__header-menu--mix",
1234
+ onSelect: w
1235
+ }, {
1236
+ default: Y(() => [(V(!0), N(D, null, U(q(g), (e) => (V(), j(c, {
1237
+ key: e.fullPath,
1238
+ index: e.fullPath
1239
+ }, {
1240
+ default: Y(() => [F(K(e.title), 1)]),
1241
+ _: 2
1242
+ }, 1032, ["index"]))), 128))]),
1243
+ _: 1
1244
+ }, 8, ["default-active"])) : M("", !0),
1245
+ q(n).layoutMode === "default" || q(n).layoutMode === "side" ? (V(), j(f, {
1246
+ key: 4,
1247
+ "separator-icon": q(me)
1248
+ }, {
1249
+ default: Y(() => [(V(!0), N(D, null, U(e.breadcrumbItems, (e, t) => (V(), j(l, {
1250
+ key: e.path || String(e.name),
1251
+ to: b(e, t)
1252
+ }, {
1253
+ default: Y(() => [F(K(e.meta.title), 1)]),
1254
+ _: 2
1255
+ }, 1032, ["to"]))), 128))]),
1256
+ _: 1
1257
+ }, 8, ["separator-icon"])) : M("", !0)
1258
+ ]),
1259
+ q(n).layoutMode !== "mix" && !q(n).isSidebarMenuSearch ? (V(), N("div", {
1260
+ key: 0,
1261
+ class: z(["app-layout__header-search", `app-layout__header-search--${q(n).layoutMode}`])
1262
+ }, [I(Yn, {
1263
+ "layout-mode": q(n).layoutMode,
1264
+ onOpen: T
1265
+ }, null, 8, ["layout-mode"])], 2)) : M("", !0),
1266
+ P("div", $n, [
1267
+ q(n).layoutMode === "mix" && !q(n).isSidebarMenuSearch ? (V(), j(Yn, {
1268
+ key: 0,
1269
+ "layout-mode": q(n).layoutMode,
1270
+ onOpen: T
1271
+ }, null, 8, ["layout-mode"])) : M("", !0),
1272
+ P("button", {
1273
+ type: "button",
1274
+ class: "app-layout__header-tool-btn",
1275
+ title: "主题设置",
1276
+ onClick: a[1] ||= (e) => q(n).openSettings("theme")
1277
+ }, [I(o, {
1278
+ size: 18,
1279
+ class: "app-layout__header-tool-icon"
1280
+ }, {
1281
+ default: Y(() => [I(q(_e))]),
1282
+ _: 1
1283
+ })]),
1284
+ I(mn),
1285
+ I(C, { onCommand: x }, {
1286
+ dropdown: Y(() => [I(_, null, {
1287
+ default: Y(() => [I(h, { disabled: "" }, {
1288
+ default: Y(() => [I(o, null, {
1289
+ default: Y(() => [I(q(Fe))]),
1290
+ _: 1
1291
+ }), a[3] ||= F(" 个人设置 ", -1)]),
1292
+ _: 1
1293
+ }), I(h, { command: "logout" }, {
1294
+ default: Y(() => [I(o, null, {
1295
+ default: Y(() => [I(q(Le))]),
1296
+ _: 1
1297
+ }), a[4] ||= F(" 退出登录 ", -1)]),
1298
+ _: 1
1299
+ })]),
1300
+ _: 1
1301
+ })]),
1302
+ default: Y(() => [P("div", er, [
1303
+ I(m, { size: 32 }, {
1304
+ default: Y(() => [F(K(q(r).userName.slice(0, 1)), 1)]),
1305
+ _: 1
1306
+ }),
1307
+ P("div", tr, [P("strong", null, K(q(r).userName), 1), P("span", null, K(q(r).userRoleLabel), 1)]),
1308
+ I(o, null, {
1309
+ default: Y(() => [I(q(pe))]),
1310
+ _: 1
1311
+ })
1312
+ ])]),
1313
+ _: 1
1314
+ })
1315
+ ])
1316
+ ]),
1317
+ _: 1
1318
+ }), I(Kn, {
1319
+ modelValue: d.value,
1320
+ "onUpdate:modelValue": a[2] ||= (e) => d.value = e
1321
+ }, null, 8, ["modelValue"])], 64);
1322
+ };
1323
+ }
1324
+ });
1325
+ //#endregion
1326
+ //#region src/main/layouts/utils/menuSearch.ts
1327
+ function rr(e, t) {
1328
+ let n = t.trim().toLowerCase();
1329
+ if (!n) return [...e];
1330
+ let r = [];
1331
+ for (let t of e) {
1332
+ let e = rr(t.children ?? [], n);
1333
+ !(or(t) && ar(t, n)) && !e.length || r.push({
1334
+ ...t,
1335
+ children: e.length ? e : void 0
1336
+ });
1337
+ }
1338
+ return r;
1339
+ }
1340
+ function ir(e, t) {
1341
+ let n = sr(e), r = t.trim();
1342
+ if (!r) return n;
1343
+ let i = Array.from(e), a = e.toLowerCase(), o = r.toLowerCase(), s = a.indexOf(o);
1344
+ return s < 0 ? n : `${sr(i.slice(0, s).join(""))}<mark class="app-menu-search-highlight">${sr(i.slice(s, s + r.length).join(""))}</mark>${sr(i.slice(s + r.length).join(""))}`;
1345
+ }
1346
+ function ar(e, t) {
1347
+ return e.title.toLowerCase().includes(t);
1348
+ }
1349
+ function or(e) {
1350
+ return !e.children?.length;
1351
+ }
1352
+ function sr(e) {
1353
+ return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
1354
+ }
1355
+ //#endregion
1356
+ //#region src/main/layouts/components/AppSidebarSearch.vue?vue&type=script&setup=true&lang.ts
1357
+ var cr = {
1358
+ key: 0,
1359
+ class: "app-sidebar-search"
1360
+ }, lr = /* @__PURE__ */ L({
1361
+ __name: "AppSidebarSearch",
1362
+ props: {
1363
+ collapsed: { type: Boolean },
1364
+ keyword: {}
1365
+ },
1366
+ emits: ["update:keyword"],
1367
+ setup(e, { emit: t }) {
1368
+ let n = t;
1369
+ return (t, r) => {
1370
+ let i = W("el-icon"), a = W("el-input");
1371
+ return e.collapsed ? M("", !0) : (V(), N("div", cr, [I(a, {
1372
+ "model-value": e.keyword,
1373
+ placeholder: "搜索菜单",
1374
+ clearable: "",
1375
+ "onUpdate:modelValue": r[0] ||= (e) => n("update:keyword", e)
1376
+ }, {
1377
+ prefix: Y(() => [I(i, null, {
1378
+ default: Y(() => [I(q(Pe))]),
1379
+ _: 1
1380
+ })]),
1381
+ _: 1
1382
+ }, 8, ["model-value"])]));
1383
+ };
1384
+ }
1385
+ }), ur = ["innerHTML"], dr = ["innerHTML"], fr = /* @__PURE__ */ L({
1386
+ name: "AppSidebarNode",
1387
+ __name: "AppSidebarNode",
1388
+ props: {
1389
+ node: {},
1390
+ keyword: {}
1391
+ },
1392
+ setup(e) {
1393
+ let t = e, n = k(() => ir(t.node.title, t.keyword ?? ""));
1394
+ return (t, r) => {
1395
+ let i = W("el-icon"), a = W("AppSidebarNode", !0), o = W("el-sub-menu"), s = W("el-menu-item");
1396
+ return e.node.children?.length ? (V(), j(o, {
1397
+ key: 0,
1398
+ index: e.node.fullPath
1399
+ }, {
1400
+ title: Y(() => [I(i, null, {
1401
+ default: Y(() => [(V(), j(G(q(Q)(e.node.icon))))]),
1402
+ _: 1
1403
+ }), P("span", { innerHTML: n.value }, null, 8, ur)]),
1404
+ default: Y(() => [(V(!0), N(D, null, U(e.node.children, (t) => (V(), j(a, {
1405
+ key: t.fullPath,
1406
+ node: t,
1407
+ keyword: e.keyword
1408
+ }, null, 8, ["node", "keyword"]))), 128))]),
1409
+ _: 1
1410
+ }, 8, ["index"])) : (V(), j(s, {
1411
+ key: 1,
1412
+ index: e.node.fullPath
1413
+ }, {
1414
+ default: Y(() => [e.node.icon ? (V(), j(i, { key: 0 }, {
1415
+ default: Y(() => [(V(), j(G(q(Q)(e.node.icon))))]),
1416
+ _: 1
1417
+ })) : M("", !0), P("span", { innerHTML: n.value }, null, 8, dr)]),
1418
+ _: 1
1419
+ }, 8, ["index"]));
1420
+ };
1421
+ }
1422
+ }), pr = {
1423
+ key: 0,
1424
+ class: "app-layout__brand"
1425
+ }, mr = /* @__PURE__ */ L({
1426
+ name: "AppSidebar",
1427
+ __name: "AppSidebar",
1428
+ setup(e) {
1429
+ let t = f(), n = l(), { activeMenu: r, sideMenus: i } = hn(), a = H(""), o = k(() => t.themeColorPosition === "sidebar" || t.isDark), s = k(() => o.value ? n.logoHeader : n.logoExpanded), c = k(() => o.value && s.value === n.logoExpanded), u = k(() => t.isMobileViewport ? !1 : t.sidebarCollapsed), d = k(() => t.layoutMode !== "top" || t.isMobileViewport), p = k(() => t.isSidebarMenuSearch ? rr(i.value, a.value) : i.value), m = k(() => !t.isSidebarMenuSearch || !a.value.trim() ? [] : h(p.value));
1430
+ J(() => t.isSidebarMenuSearch, (e) => {
1431
+ e || (a.value = "");
1432
+ });
1433
+ function h(e) {
1434
+ let t = [];
1435
+ for (let n of e) n.children?.length && (t.push(n.fullPath), t.push(...h(n.children)));
1436
+ return t;
1437
+ }
1438
+ return (e, i) => {
1439
+ let o = W("el-menu"), l = W("el-scrollbar"), f = W("el-aside");
1440
+ return d.value ? (V(), j(f, {
1441
+ key: 0,
1442
+ width: u.value ? "72px" : "220px",
1443
+ class: z(["app-layout__aside", {
1444
+ "is-mix-mode": q(t).layoutMode === "mix",
1445
+ "has-brand": q(t).layoutMode !== "default",
1446
+ "has-sidebar-search": q(t).isSidebarMenuSearch,
1447
+ "is-mobile-open": q(t).mobileSidebarVisible
1448
+ }])
1449
+ }, {
1450
+ default: Y(() => [
1451
+ q(t).layoutMode === "default" ? M("", !0) : (V(), N("div", pr, [I(O, {
1452
+ name: "brand-fade",
1453
+ mode: "out-in"
1454
+ }, {
1455
+ default: Y(() => [u.value ? (V(), j(En, {
1456
+ key: "collapsed",
1457
+ src: q(n).logoCollapsed,
1458
+ alt: q(n).systemName,
1459
+ width: "40px",
1460
+ height: "40px"
1461
+ }, null, 8, ["src", "alt"])) : (V(), j(En, {
1462
+ key: "expanded",
1463
+ src: s.value,
1464
+ alt: q(n).systemName,
1465
+ "text-inverted": c.value
1466
+ }, null, 8, [
1467
+ "src",
1468
+ "alt",
1469
+ "text-inverted"
1470
+ ]))]),
1471
+ _: 1
1472
+ })])),
1473
+ q(t).isSidebarMenuSearch ? (V(), j(lr, {
1474
+ key: 1,
1475
+ collapsed: u.value,
1476
+ keyword: a.value,
1477
+ "onUpdate:keyword": i[0] ||= (e) => a.value = e
1478
+ }, null, 8, ["collapsed", "keyword"])) : M("", !0),
1479
+ I(l, { class: "app-layout__menu-scroll" }, {
1480
+ default: Y(() => [I(o, {
1481
+ collapse: u.value,
1482
+ "default-active": q(r),
1483
+ "default-openeds": m.value,
1484
+ class: "app-layout__menu",
1485
+ router: "",
1486
+ "unique-opened": "",
1487
+ onSelect: q(t).closeMobileSidebar
1488
+ }, {
1489
+ default: Y(() => [(V(!0), N(D, null, U(p.value, (e) => (V(), j(fr, {
1490
+ key: e.fullPath,
1491
+ node: e,
1492
+ keyword: q(t).isSidebarMenuSearch ? a.value : ""
1493
+ }, null, 8, ["node", "keyword"]))), 128))]),
1494
+ _: 1
1495
+ }, 8, [
1496
+ "collapse",
1497
+ "default-active",
1498
+ "default-openeds",
1499
+ "onSelect"
1500
+ ])]),
1501
+ _: 1
1502
+ })
1503
+ ]),
1504
+ _: 1
1505
+ }, 8, ["width", "class"])) : M("", !0);
1506
+ };
1507
+ }
1508
+ });
1509
+ //#endregion
1510
+ //#region src/main/composables/useSortable.ts
1511
+ function hr(e = {}) {
1512
+ let t = H(null);
1513
+ function n() {
1514
+ t.value?.destroy(), t.value = null;
1515
+ }
1516
+ function r(r) {
1517
+ r && (n(), t.value = He.create(r, {
1518
+ animation: e.animation ?? 150,
1519
+ chosenClass: e.chosenClass,
1520
+ direction: e.direction,
1521
+ disabled: e.disabled ?? !1,
1522
+ dragClass: e.dragClass,
1523
+ draggable: e.draggable,
1524
+ easing: e.easing,
1525
+ filter: e.filter,
1526
+ ghostClass: e.ghostClass,
1527
+ handle: e.handle,
1528
+ invertSwap: e.invertSwap,
1529
+ onEnd: (t) => {
1530
+ if (e.onEnd) {
1531
+ if (e.onEnd.length >= 2 && t.oldIndex != null && t.newIndex != null) {
1532
+ e.onEnd(t.oldIndex, t.newIndex);
1533
+ return;
1534
+ }
1535
+ e.onEnd();
1536
+ }
1537
+ },
1538
+ onStart: e.onStart,
1539
+ preventOnFilter: e.preventOnFilter,
1540
+ swapThreshold: e.swapThreshold
1541
+ }));
1542
+ }
1543
+ return re(() => {
1544
+ n();
1545
+ }), {
1546
+ destroy: n,
1547
+ init: r,
1548
+ sortableInstance: t
1549
+ };
1550
+ }
1551
+ //#endregion
1552
+ //#region src/main/layouts/components/AppTabsContextMenu.vue?vue&type=script&setup=true&lang.ts
1553
+ var gr = ["disabled"], _r = ["disabled"], vr = ["disabled"], yr = ["disabled"], br = ["disabled"], xr = /* @__PURE__ */ L({
1554
+ __name: "AppTabsContextMenu",
1555
+ props: {
1556
+ hasLeftTabs: { type: Boolean },
1557
+ hasMultipleTabs: { type: Boolean },
1558
+ hasRightTabs: { type: Boolean },
1559
+ hasLastActive: { type: Boolean },
1560
+ isTargetActive: { type: Boolean },
1561
+ isTargetHome: { type: Boolean },
1562
+ visible: { type: Boolean },
1563
+ position: {},
1564
+ targetTab: {}
1565
+ },
1566
+ emits: [
1567
+ "close",
1568
+ "closeAll",
1569
+ "closeLeft",
1570
+ "closeOthers",
1571
+ "closeRight",
1572
+ "closeTab",
1573
+ "openInNewTab",
1574
+ "refresh",
1575
+ "switchPrev"
1576
+ ],
1577
+ setup(e, { emit: t }) {
1578
+ let n = e, r = t;
1579
+ function i(e, t = !1) {
1580
+ t || (e(), r("close"));
1581
+ }
1582
+ function a() {
1583
+ n.targetTab && r("refresh", n.targetTab.path);
1584
+ }
1585
+ function o() {
1586
+ r("switchPrev");
1587
+ }
1588
+ function s() {
1589
+ n.targetTab && r("openInNewTab", n.targetTab.fullPath);
1590
+ }
1591
+ function c() {
1592
+ n.targetTab && r("closeTab", n.targetTab.path);
1593
+ }
1594
+ function l() {
1595
+ n.targetTab && r("closeOthers", n.targetTab.path);
1596
+ }
1597
+ function u() {
1598
+ n.targetTab && r("closeLeft", n.targetTab.path);
1599
+ }
1600
+ function d() {
1601
+ n.targetTab && r("closeRight", n.targetTab.path);
1602
+ }
1603
+ return (t, n) => {
1604
+ let f = W("el-icon");
1605
+ return e.visible && e.targetTab ? (V(), N("div", {
1606
+ key: 0,
1607
+ class: "app-tabs-menu",
1608
+ style: B({
1609
+ left: `${e.position.x}px`,
1610
+ top: `${e.position.y}px`
1611
+ }),
1612
+ onMousedown: n[8] ||= X(() => {}, ["stop"]),
1613
+ onContextmenu: n[9] ||= X(() => {}, ["prevent"])
1614
+ }, [
1615
+ P("button", {
1616
+ class: "app-tabs-menu__item",
1617
+ type: "button",
1618
+ onClick: n[0] ||= (e) => i(a)
1619
+ }, [I(f, null, {
1620
+ default: Y(() => [I(q(Ne))]),
1621
+ _: 1
1622
+ }), n[10] ||= P("span", null, "重新加载", -1)]),
1623
+ P("button", {
1624
+ class: "app-tabs-menu__item",
1625
+ type: "button",
1626
+ disabled: !e.hasLastActive,
1627
+ onClick: n[1] ||= (t) => i(o, !e.hasLastActive)
1628
+ }, [I(f, null, {
1629
+ default: Y(() => [I(q(ge))]),
1630
+ _: 1
1631
+ }), n[11] ||= P("span", null, "切换上一个页签", -1)], 8, gr),
1632
+ P("button", {
1633
+ class: "app-tabs-menu__item",
1634
+ type: "button",
1635
+ onClick: n[2] ||= (e) => i(s)
1636
+ }, [I(f, null, {
1637
+ default: Y(() => [I(q(Re))]),
1638
+ _: 1
1639
+ }), n[12] ||= P("span", null, "在新窗口打开", -1)]),
1640
+ n[18] ||= P("div", { class: "app-tabs-menu__divider" }, null, -1),
1641
+ P("button", {
1642
+ class: "app-tabs-menu__item",
1643
+ type: "button",
1644
+ disabled: e.isTargetHome,
1645
+ onClick: n[3] ||= (t) => i(c, e.isTargetHome)
1646
+ }, [I(f, null, {
1647
+ default: Y(() => [I(q(ve))]),
1648
+ _: 1
1649
+ }), n[13] ||= P("span", null, "关闭当前页签", -1)], 8, _r),
1650
+ P("button", {
1651
+ class: "app-tabs-menu__item",
1652
+ type: "button",
1653
+ disabled: !e.hasMultipleTabs,
1654
+ onClick: n[4] ||= (t) => i(l, !e.hasMultipleTabs)
1655
+ }, [I(f, null, {
1656
+ default: Y(() => [I(q(je))]),
1657
+ _: 1
1658
+ }), n[14] ||= P("span", null, "关闭其他页签", -1)], 8, vr),
1659
+ P("button", {
1660
+ class: "app-tabs-menu__item",
1661
+ type: "button",
1662
+ disabled: !e.hasLeftTabs,
1663
+ onClick: n[5] ||= (t) => i(u, !e.hasLeftTabs)
1664
+ }, [I(f, null, {
1665
+ default: Y(() => [I(q(be))]),
1666
+ _: 1
1667
+ }), n[15] ||= P("span", null, "关闭左侧页签", -1)], 8, yr),
1668
+ P("button", {
1669
+ class: "app-tabs-menu__item",
1670
+ type: "button",
1671
+ disabled: !e.hasRightTabs,
1672
+ onClick: n[6] ||= (t) => i(d, !e.hasRightTabs)
1673
+ }, [I(f, null, {
1674
+ default: Y(() => [I(q(xe))]),
1675
+ _: 1
1676
+ }), n[16] ||= P("span", null, "关闭右侧页签", -1)], 8, br),
1677
+ n[19] ||= P("div", { class: "app-tabs-menu__divider" }, null, -1),
1678
+ P("button", {
1679
+ class: "app-tabs-menu__item",
1680
+ type: "button",
1681
+ onClick: n[7] ||= (e) => i(() => r("closeAll"))
1682
+ }, [I(f, null, {
1683
+ default: Y(() => [I(q(Te))]),
1684
+ _: 1
1685
+ }), n[17] ||= P("span", null, "关闭全部页签", -1)])
1686
+ ], 36)) : M("", !0);
1687
+ };
1688
+ }
1689
+ }), Sr = {
1690
+ key: 0,
1691
+ class: "app-layout__tabs"
1692
+ }, Cr = { class: "app-layout__tabs-bar" }, wr = [
1693
+ "data-path",
1694
+ "onClick",
1695
+ "onContextmenu"
1696
+ ], Tr = { class: "app-layout__tab-label" }, Er = ["onClick"], Dr = /* @__PURE__ */ L({
1697
+ __name: "AppTabs",
1698
+ emits: ["refresh"],
1699
+ setup(e, { emit: t }) {
1700
+ let n = t, r = ee(), i = lt(), a = H(!1), o = H(!1), s = H(!1), c = H({
1701
+ x: 0,
1702
+ y: 0
1703
+ }), l = H(null), u = H(null), d = k(() => l.value ? i.tabs.findIndex((e) => e.path === l.value?.path) : -1), f = k(() => l.value?.path === i.activeTab), p = k(() => d.value > 0), m = k(() => d.value >= 0 && d.value < i.tabs.length - 1), h = k(() => i.tabs.length > 1), g = k(() => !!(i.lastActiveTab && i.tabPaths.includes(i.lastActiveTab))), { init: _ } = hr({
1704
+ animation: 150,
1705
+ chosenClass: "sortable-chosen",
1706
+ direction: "horizontal",
1707
+ dragClass: "sortable-drag",
1708
+ draggable: ".app-layout__tab",
1709
+ filter: ".app-layout__tab-close",
1710
+ ghostClass: "sortable-ghost",
1711
+ invertSwap: !1,
1712
+ onEnd: () => {
1713
+ let e = Array.from(u.value?.children ?? []), t = [];
1714
+ e.forEach((e) => {
1715
+ let n = e.dataset.path, r = i.tabs.find((e) => e.path === n);
1716
+ r && t.push(r);
1717
+ }), t.length === i.tabs.length && i.reorderTabs(t), window.setTimeout(() => {
1718
+ a.value = !1, u.value?.classList.remove("dragging");
1719
+ }, 100);
1720
+ },
1721
+ onStart: () => {
1722
+ a.value = !0, u.value?.classList.add("dragging");
1723
+ },
1724
+ preventOnFilter: !0,
1725
+ swapThreshold: .65
1726
+ });
1727
+ async function v(e) {
1728
+ e && (i.setActiveTab(e), await r.push(e), await T());
1729
+ }
1730
+ async function y(e) {
1731
+ if (e === "/dashboard") return;
1732
+ let t = i.tabs.findIndex((t) => t.path === e), n = i.activeTab === e;
1733
+ if (await i.removeTab(e), !n) return;
1734
+ let a = i.tabs[t] ?? i.tabs[t - 1];
1735
+ a ? await v(a.path) : (i.setActiveTab(""), r.push(Z));
1736
+ }
1737
+ async function b(e) {
1738
+ i.activeTab !== e && await v(e), o.value = !1, await R(), await T(), o.value = !0, n("refresh"), window.setTimeout(() => {
1739
+ o.value = !1;
1740
+ }, 600);
1741
+ }
1742
+ function x(e, t) {
1743
+ e.preventDefault(), S(e.clientX, e.clientY, t);
1744
+ }
1745
+ function S(e, t, n) {
1746
+ l.value = n, s.value = !0, c.value = {
1747
+ x: Math.min(e, window.innerWidth - 188),
1748
+ y: Math.min(t, window.innerHeight - 260)
1749
+ };
1750
+ }
1751
+ function C(e) {
1752
+ let t = i.tabs.find((e) => e.path === i.activeTab) ?? i.tabs.at(-1);
1753
+ if (!t) return;
1754
+ let n = e.currentTarget.getBoundingClientRect();
1755
+ S(n.left, n.bottom + 4, t);
1756
+ }
1757
+ function w(e) {
1758
+ !u.value || Math.abs(e.deltaY) <= Math.abs(e.deltaX) || (e.preventDefault(), u.value.scrollLeft += e.deltaY);
1759
+ }
1760
+ async function T() {
1761
+ await R(), await new Promise((e) => window.requestAnimationFrame(() => e(null))), await new Promise((e) => window.requestAnimationFrame(() => e(null)));
1762
+ let e = u.value, t = e?.querySelector(".app-layout__tab.is-active");
1763
+ if (!e || !t) return;
1764
+ t.scrollIntoView({
1765
+ behavior: "smooth",
1766
+ block: "nearest",
1767
+ inline: "center"
1768
+ });
1769
+ let n = Math.max(0, e.scrollWidth - e.clientWidth), r = t.offsetLeft - e.clientWidth / 2 + t.offsetWidth / 2;
1770
+ e.scrollTo({
1771
+ left: Math.min(n, Math.max(0, r)),
1772
+ behavior: "smooth"
1773
+ });
1774
+ }
1775
+ function E() {
1776
+ s.value = !1, l.value = null;
1777
+ }
1778
+ async function te(e) {
1779
+ await i.closeOtherTabs(e), await v(e);
1780
+ }
1781
+ async function O(e) {
1782
+ await i.closeLeftTabs(e), i.tabPaths.includes(i.activeTab) || await v(e);
1783
+ }
1784
+ async function ne(e) {
1785
+ await i.closeRightTabs(e), i.tabPaths.includes(i.activeTab) || await v(e);
1786
+ }
1787
+ async function A() {
1788
+ await i.closeAllTabs(), r.push(Z);
1789
+ }
1790
+ function F() {
1791
+ let e = i.lastActiveTab;
1792
+ !e || !i.tabPaths.includes(e) || v(e);
1793
+ }
1794
+ function L(e) {
1795
+ window.open(e, "_blank", "noopener,noreferrer");
1796
+ }
1797
+ function B(e) {
1798
+ e.button !== 2 && E();
1799
+ }
1800
+ return ie(() => {
1801
+ document.addEventListener("mousedown", B), _(u.value), T();
1802
+ }), ae(() => {
1803
+ document.removeEventListener("mousedown", B);
1804
+ }), J(() => i.tabs.map((e) => e.path).join("|"), () => {
1805
+ a.value || R(() => {
1806
+ _(u.value), T();
1807
+ });
1808
+ }), J(() => i.activeTab, () => {
1809
+ T();
1810
+ }), (e, t) => {
1811
+ let n = W("el-icon");
1812
+ return q(i).tabs.length ? (V(), N("div", Sr, [P("div", Cr, [
1813
+ P("div", {
1814
+ ref_key: "tabsScrollRef",
1815
+ ref: u,
1816
+ class: "app-layout__tabs-scroll",
1817
+ onWheel: w
1818
+ }, [(V(!0), N(D, null, U(q(i).tabs, (e) => (V(), N("div", {
1819
+ key: e.path,
1820
+ class: z(["app-layout__tab", { "is-active": q(i).activeTab === e.path }]),
1821
+ "data-path": e.path,
1822
+ onClick: (t) => v(e.fullPath),
1823
+ onContextmenu: (t) => x(t, e)
1824
+ }, [
1825
+ e.icon ? (V(), j(n, {
1826
+ key: 0,
1827
+ class: "app-layout__tab-icon"
1828
+ }, {
1829
+ default: Y(() => [(V(), j(G(q(Q)(e.icon))))]),
1830
+ _: 2
1831
+ }, 1024)) : M("", !0),
1832
+ P("span", Tr, K(e.title), 1),
1833
+ e.path === q("/dashboard") ? M("", !0) : (V(), N("button", {
1834
+ key: 1,
1835
+ class: "app-layout__tab-close",
1836
+ type: "button",
1837
+ onClick: X((t) => y(e.path), ["stop"])
1838
+ }, " × ", 8, Er))
1839
+ ], 42, wr))), 128))], 544),
1840
+ P("button", {
1841
+ class: "app-layout__tabs-action",
1842
+ type: "button",
1843
+ title: "页签操作",
1844
+ onClick: C
1845
+ }, [I(n, null, {
1846
+ default: Y(() => [I(q(pe))]),
1847
+ _: 1
1848
+ })]),
1849
+ P("button", {
1850
+ class: "app-layout__tabs-action",
1851
+ type: "button",
1852
+ title: "刷新当前页签",
1853
+ onClick: t[0] ||= (e) => b(q(i).activeTab)
1854
+ }, [I(n, { class: z({ "is-rotating": o.value }) }, {
1855
+ default: Y(() => [I(q(Ne))]),
1856
+ _: 1
1857
+ }, 8, ["class"])])
1858
+ ]), I(xr, {
1859
+ visible: s.value,
1860
+ "has-left-tabs": p.value,
1861
+ "has-multiple-tabs": h.value,
1862
+ "has-right-tabs": m.value,
1863
+ "has-last-active": g.value,
1864
+ "is-target-home": l.value?.path === q(Z),
1865
+ "is-target-active": f.value,
1866
+ position: c.value,
1867
+ "target-tab": l.value,
1868
+ onClose: E,
1869
+ onCloseAll: A,
1870
+ onCloseLeft: O,
1871
+ onCloseOthers: te,
1872
+ onCloseRight: ne,
1873
+ onCloseTab: y,
1874
+ onOpenInNewTab: L,
1875
+ onSwitchPrev: F,
1876
+ onRefresh: b
1877
+ }, null, 8, [
1878
+ "visible",
1879
+ "has-left-tabs",
1880
+ "has-multiple-tabs",
1881
+ "has-right-tabs",
1882
+ "has-last-active",
1883
+ "is-target-home",
1884
+ "is-target-active",
1885
+ "position",
1886
+ "target-tab"
1887
+ ])])) : M("", !0);
1888
+ };
1889
+ }
1890
+ }), Or = /* @__PURE__ */ L({
1891
+ __name: "AppLayout",
1892
+ setup(e) {
1893
+ let t = C(), n = lt(), r = f(), i = ft(), a = H(0), o = k(() => t.matched.filter((e) => e.meta?.title));
1894
+ ie(() => {
1895
+ i.initShortcuts(), window.addEventListener("keydown", l, { capture: !0 });
1896
+ }), re(() => {
1897
+ window.removeEventListener("keydown", l, { capture: !0 });
1898
+ });
1899
+ function s() {
1900
+ if (t.meta.microApp) {
1901
+ m(t.path);
1902
+ return;
1903
+ }
1904
+ a.value += 1;
1905
+ }
1906
+ J(() => t.fullPath, () => {
1907
+ let e = String(t.meta.title ?? "未命名页面"), r = t.meta.icon ? String(t.meta.icon) : void 0;
1908
+ c(), t.meta.public || n.syncTab({
1909
+ path: t.path,
1910
+ fullPath: t.fullPath,
1911
+ title: e,
1912
+ icon: r
1913
+ });
1914
+ }, { immediate: !0 });
1915
+ function c() {
1916
+ let e = t.matched.find((e) => e.path !== "/" && !e.meta?.hidden);
1917
+ if (!e) return;
1918
+ let n = e.path.startsWith("/") ? e.path : `/${e.path}`;
1919
+ r.setSelectedTopMenuPath(n);
1920
+ }
1921
+ function l(e) {
1922
+ if (!(e.defaultPrevented || e.repeat || e.isComposing)) {
1923
+ if (i.isShortcutEnabled("toggleMenu") && yt(e, i.getShortcutKeys("toggleMenu"))) {
1924
+ e.preventDefault(), r.toggleSidebar();
1925
+ return;
1926
+ }
1927
+ i.isShortcutEnabled("settings") && yt(e, i.getShortcutKeys("settings")) && (e.preventDefault(), r.setSettingsVisible(!r.settingsVisible));
1928
+ }
1929
+ }
1930
+ return (e, t) => {
1931
+ let n = W("el-container");
1932
+ return V(), N(D, null, [I(n, { class: "app-layout" }, {
1933
+ default: Y(() => [
1934
+ I(mr),
1935
+ I(n, { direction: "vertical" }, {
1936
+ default: Y(() => [
1937
+ I(nr, { "breadcrumb-items": o.value }, null, 8, ["breadcrumb-items"]),
1938
+ I(Dr, { onRefresh: s }),
1939
+ I(fn, { "refresh-key": a.value }, null, 8, ["refresh-key"])
1940
+ ]),
1941
+ _: 1
1942
+ }),
1943
+ I(O, { name: "app-mobile-mask" }, {
1944
+ default: Y(() => [q(r).mobileSidebarVisible ? (V(), N("button", {
1945
+ key: 0,
1946
+ type: "button",
1947
+ class: "app-layout__mobile-mask",
1948
+ "aria-label": "关闭侧边栏",
1949
+ onClick: t[0] ||= (e) => q(r).closeMobileSidebar()
1950
+ })) : M("", !0)]),
1951
+ _: 1
1952
+ })
1953
+ ]),
1954
+ _: 1
1955
+ }), I(dn)], 64);
1956
+ };
1957
+ }
1958
+ });
1959
+ //#endregion
1960
+ //#region src/main/router/base-routes.ts
1961
+ function kr(e = []) {
1962
+ return [{
1963
+ path: "/login",
1964
+ name: "login",
1965
+ component: () => import("./Login-7n7MU-kG.js"),
1966
+ meta: {
1967
+ title: "登录",
1968
+ public: !0
1969
+ }
1970
+ }, {
1971
+ path: "/",
1972
+ component: Or,
1973
+ redirect: "/dashboard",
1974
+ children: [
1975
+ {
1976
+ path: "403",
1977
+ name: "forbidden",
1978
+ component: () => import("./Forbidden-Cu2QQ-FY.js"),
1979
+ meta: {
1980
+ title: "暂无权限",
1981
+ public: !0,
1982
+ hidden: !0
1983
+ }
1984
+ },
1985
+ ...e,
1986
+ {
1987
+ path: "config",
1988
+ name: "config-center",
1989
+ redirect: "/config/apps",
1990
+ meta: {
1991
+ title: "配置中心",
1992
+ icon: "Setting"
1993
+ },
1994
+ children: [{
1995
+ path: "apps",
1996
+ name: "config-apps",
1997
+ component: () => import("./application-config-DePctoXE.js"),
1998
+ meta: {
1999
+ title: "应用配置",
2000
+ icon: "Connection"
2001
+ }
2002
+ }, {
2003
+ path: "system",
2004
+ name: "config-system",
2005
+ component: () => import("./SystemConfig-DGZUwXWB.js"),
2006
+ meta: {
2007
+ title: "系统配置",
2008
+ icon: "Setting"
2009
+ }
2010
+ }]
2011
+ },
2012
+ {
2013
+ path: ":pathMatch(.*)*",
2014
+ name: "not-found",
2015
+ component: () => import("./NotFound-VRL7_aMx.js"),
2016
+ meta: {
2017
+ title: "页面不存在",
2018
+ public: !0,
2019
+ hidden: !0
2020
+ }
2021
+ }
2022
+ ]
2023
+ }];
2024
+ }
2025
+ //#endregion
2026
+ //#region src/main/router/index.ts
2027
+ function Ar(e = []) {
2028
+ let t = Array.isArray(e) ? { businessRoutes: e } : e, n = x({
2029
+ history: t.history ?? S("/"),
2030
+ routes: kr(t.businessRoutes ?? []),
2031
+ scrollBehavior: t.scrollBehavior ?? (() => ({ top: 0 }))
2032
+ });
2033
+ return et(n), t.setupRouter?.(n), n;
2034
+ }
2035
+ //#endregion
2036
+ //#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
2037
+ var jr = { class: "micro-app-page" }, Mr = {
2038
+ key: 0,
2039
+ class: "micro-app-page__state micro-app-page__state--error"
2040
+ }, Nr = { class: "micro-app-page__body" }, Pr = { class: "micro-app-page__meta" }, Fr = { key: 0 }, Ir = { key: 1 }, Lr = { class: "micro-app-page__actions" }, Rr = ["id"], zr = /* @__PURE__ */ y(/* @__PURE__ */ L({
2041
+ name: "MicroAppView",
2042
+ __name: "MicroAppView",
2043
+ setup(e) {
2044
+ let t = C(), n = h(), r = H(""), i = null, a = k(() => p(t.path)), o = k(() => {
2045
+ let e = a.value;
2046
+ return e ? n[e.name] : void 0;
2047
+ }), s = k(() => d(t.path)), c = k(() => o.value?.title || a.value?.title || s.value?.title || "未知子应用"), l = k(() => o.value?.entry || a.value?.entry || s.value?.entry || "-"), u = k(() => "子应用暂时无法访问,请稍后重试。"), f = k(() => o.value?.status === "error" || !!s.value || !!r.value || !a.value);
2048
+ J(() => t.path, () => {
2049
+ R(() => {
2050
+ g(), v();
2051
+ });
2052
+ }, { immediate: !0 }), ie(() => {
2053
+ R(() => {
2054
+ g(), v();
2055
+ });
2056
+ }), J(() => o.value?.status, (e) => {
2057
+ if (e === "mounted") {
2058
+ y(), r.value = "";
2059
+ return;
2060
+ }
2061
+ e === "loading" && v();
2062
+ }), re(() => {
2063
+ y();
2064
+ });
2065
+ function v() {
2066
+ y(), r.value = "", a.value && (i = window.setTimeout(() => {
2067
+ o.value?.status !== "mounted" && (r.value = "子应用暂时无法访问,请稍后重试。");
2068
+ }, 15e3));
2069
+ }
2070
+ function y() {
2071
+ i !== null && (window.clearTimeout(i), i = null);
2072
+ }
2073
+ function b() {
2074
+ m(t.path);
2075
+ }
2076
+ function x() {
2077
+ let e = l.value;
2078
+ e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
2079
+ }
2080
+ return (e, t) => {
2081
+ let n = W("el-icon"), r = W("el-button");
2082
+ return V(), N("div", jr, [f.value ? (V(), N("div", Mr, [I(n, { class: "micro-app-page__icon" }, {
2083
+ default: Y(() => [I(q(Ve))]),
2084
+ _: 1
2085
+ }), P("div", Nr, [
2086
+ t[5] ||= P("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
2087
+ P("dl", Pr, [
2088
+ P("div", null, [t[0] ||= P("dt", null, "应用", -1), P("dd", null, K(c.value), 1)]),
2089
+ q(!1) ? (V(), N("div", Fr, [t[1] ||= P("dt", null, "入口", -1), P("dd", null, K(l.value), 1)])) : M("", !0),
2090
+ u.value ? (V(), N("div", Ir, [t[2] ||= P("dt", null, "原因", -1), P("dd", null, K(u.value), 1)])) : M("", !0)
2091
+ ]),
2092
+ P("div", Lr, [I(r, {
2093
+ type: "primary",
2094
+ icon: q(Ne),
2095
+ onClick: b
2096
+ }, {
2097
+ default: Y(() => [...t[3] ||= [F("重新加载", -1)]]),
2098
+ _: 1
2099
+ }, 8, ["icon"]), q(!1) && (o.value?.entry || a.value?.entry) ? (V(), j(r, {
2100
+ key: 0,
2101
+ icon: q(Oe),
2102
+ onClick: x
2103
+ }, {
2104
+ default: Y(() => [...t[4] ||= [F(" 打开入口 ", -1)]]),
2105
+ _: 1
2106
+ }, 8, ["icon"])) : M("", !0)])
2107
+ ])])) : M("", !0), P("section", {
2108
+ id: q(_),
2109
+ class: "micro-app-page__container"
2110
+ }, null, 8, Rr)]);
2111
+ };
2112
+ }
2113
+ }), [["__scopeId", "data-v-6badc729"]]);
2114
+ //#endregion
2115
+ //#region src/main/router/route-items.ts
2116
+ function Br(e, t) {
2117
+ return b(e, t, (e) => e.microApp ? zr : void 0);
2118
+ }
2119
+ //#endregion
2120
+ //#region src/main/app/AppUpdateDialog.vue?vue&type=script&setup=true&lang.ts
2121
+ var Vr = {
2122
+ key: 0,
2123
+ class: "app-update-dialog",
2124
+ role: "presentation"
2125
+ }, Hr = {
2126
+ class: "app-update-dialog__panel",
2127
+ role: "dialog",
2128
+ "aria-modal": "true",
2129
+ "aria-labelledby": "app-update-dialog-title"
2130
+ }, Ur = { class: "app-update-dialog__icon" }, Wr = { class: "app-update-dialog__content" }, Gr = {
2131
+ key: 0,
2132
+ class: "app-update-dialog__version"
2133
+ }, Kr = {
2134
+ key: 1,
2135
+ class: "app-update-dialog__changelog"
2136
+ }, qr = { class: "app-update-dialog__actions" }, Jr = /* @__PURE__ */ y(/* @__PURE__ */ L({
2137
+ __name: "AppUpdateDialog",
2138
+ props: {
2139
+ changelog: {},
2140
+ modelValue: { type: Boolean },
2141
+ versionLabel: {}
2142
+ },
2143
+ emits: ["refresh", "remindLater"],
2144
+ setup(e, { emit: t }) {
2145
+ let n = t;
2146
+ function r(e) {
2147
+ if (e === "today") {
2148
+ n("remindLater", i());
2149
+ return;
2150
+ }
2151
+ let t = Number(e);
2152
+ Number.isFinite(t) && t > 0 && n("remindLater", t * 60 * 60 * 1e3);
2153
+ }
2154
+ function i() {
2155
+ let e = /* @__PURE__ */ new Date(), t = new Date(e);
2156
+ return t.setHours(23, 59, 59, 999), Math.max(t.getTime() - e.getTime(), 60 * 1e3);
2157
+ }
2158
+ return (t, i) => {
2159
+ let a = W("el-icon"), o = W("el-button"), s = W("el-dropdown-item"), c = W("el-dropdown-menu"), l = W("el-dropdown");
2160
+ return V(), j(te, { to: "body" }, [I(O, { name: "app-update-dialog-fade" }, {
2161
+ default: Y(() => [e.modelValue ? (V(), N("section", Vr, [P("div", Hr, [
2162
+ P("div", Ur, [I(a, null, {
2163
+ default: Y(() => [I(q(Me))]),
2164
+ _: 1
2165
+ })]),
2166
+ P("div", Wr, [
2167
+ i[2] ||= P("h2", { id: "app-update-dialog-title" }, "发现新版本", -1),
2168
+ i[3] ||= P("p", null, "系统已发布更新,刷新后即可使用最新功能和修复。", -1),
2169
+ e.versionLabel ? (V(), N("span", Gr, K(e.versionLabel), 1)) : M("", !0),
2170
+ e.changelog?.length ? (V(), N("div", Kr, [i[1] ||= P("span", null, "更新要点", -1), P("ul", null, [(V(!0), N(D, null, U(e.changelog, (e) => (V(), N("li", { key: e }, K(e), 1))), 128))])])) : M("", !0)
2171
+ ]),
2172
+ P("div", qr, [I(o, {
2173
+ type: "primary",
2174
+ onClick: i[0] ||= (e) => n("refresh")
2175
+ }, {
2176
+ default: Y(() => [...i[4] ||= [F("立即更新", -1)]]),
2177
+ _: 1
2178
+ }), I(l, {
2179
+ trigger: "click",
2180
+ teleported: !1,
2181
+ onCommand: r
2182
+ }, {
2183
+ dropdown: Y(() => [I(c, null, {
2184
+ default: Y(() => [
2185
+ I(s, { command: 1 }, {
2186
+ default: Y(() => [...i[6] ||= [F("1 小时后提醒", -1)]]),
2187
+ _: 1
2188
+ }),
2189
+ I(s, { command: 2 }, {
2190
+ default: Y(() => [...i[7] ||= [F("2 小时后提醒", -1)]]),
2191
+ _: 1
2192
+ }),
2193
+ I(s, { command: 4 }, {
2194
+ default: Y(() => [...i[8] ||= [F("4 小时后提醒", -1)]]),
2195
+ _: 1
2196
+ }),
2197
+ I(s, {
2198
+ divided: "",
2199
+ command: "today"
2200
+ }, {
2201
+ default: Y(() => [...i[9] ||= [F("今日不再提醒", -1)]]),
2202
+ _: 1
2203
+ })
2204
+ ]),
2205
+ _: 1
2206
+ })]),
2207
+ default: Y(() => [I(o, null, {
2208
+ default: Y(() => [i[5] ||= F(" 稍后提醒 ", -1), I(a, { class: "el-icon--right" }, {
2209
+ default: Y(() => [I(q(pe))]),
2210
+ _: 1
2211
+ })]),
2212
+ _: 1
2213
+ })]),
2214
+ _: 1
2215
+ })])
2216
+ ])])) : M("", !0)]),
2217
+ _: 1
2218
+ })]);
2219
+ };
2220
+ }
2221
+ }), [["__scopeId", "data-v-118283a1"]]), Yr = "app-update:check-enabled";
2222
+ function Xr(e = !0) {
2223
+ let t = localStorage.getItem(Yr);
2224
+ return t === "true" ? !0 : t === "false" ? !1 : e;
2225
+ }
2226
+ function Zr(e) {
2227
+ localStorage.setItem(Yr, String(e));
2228
+ }
2229
+ //#endregion
2230
+ //#region src/main/app/update-checker.ts
2231
+ var Qr = "/app-manifest.json", $r = 300 * 1e3, ei = "app-update:snooze", ti, ni, ri, ii = "", ai = !1, $ = {}, oi, si;
2232
+ function ci(e = {}) {
2233
+ $ = {
2234
+ ...$,
2235
+ ...e
2236
+ }, !(ai || $.enabled === !1 || typeof window > "u" || !Xr(!0)) && (ai = !0, !xi() && li());
2237
+ }
2238
+ function li() {
2239
+ hi(), fi(), ti = window.setInterval(() => {
2240
+ fi();
2241
+ }, vi());
2242
+ }
2243
+ function ui() {
2244
+ hi(), gi(), mi(), ai = !1, ii = "";
2245
+ }
2246
+ function di(e = {}) {
2247
+ ui(), ci({
2248
+ ...$,
2249
+ ...e
2250
+ });
2251
+ }
2252
+ async function fi() {
2253
+ if (!Xr(!0)) {
2254
+ ui();
2255
+ return;
2256
+ }
2257
+ if (xi()) return;
2258
+ let e = await _i($.manifestUrl || Qr);
2259
+ if (!e?.label) return;
2260
+ if (!ri) {
2261
+ ri = e;
2262
+ return;
2263
+ }
2264
+ let t = Ei(ri, e);
2265
+ !t || t.label === ii || yi(t.label) || (ii = t.label, pi(t));
2266
+ }
2267
+ function pi(e) {
2268
+ mi(), si = document.createElement("div"), document.body.appendChild(si), oi = A(Jr, {
2269
+ changelog: e.changelog,
2270
+ modelValue: !0,
2271
+ versionLabel: Oi(e.displayVersion),
2272
+ onRefresh: () => {
2273
+ window.location.reload();
2274
+ },
2275
+ onRemindLater: (t) => {
2276
+ bi(e.label, t), ii = "", mi(), hi(), xi();
2277
+ }
2278
+ }), oi.use(T, { locale: Ue }), oi.mount(si);
2279
+ }
2280
+ function mi() {
2281
+ oi?.unmount(), si?.remove(), oi = void 0, si = void 0;
2282
+ }
2283
+ function hi() {
2284
+ ti !== void 0 && (window.clearInterval(ti), ti = void 0);
2285
+ }
2286
+ function gi() {
2287
+ ni !== void 0 && (window.clearTimeout(ni), ni = void 0);
2288
+ }
2289
+ async function _i(e) {
2290
+ try {
2291
+ let t = new URL(e, window.location.origin);
2292
+ t.searchParams.set("_t", String(Date.now()));
2293
+ let n = await fetch(t, {
2294
+ cache: "no-store",
2295
+ headers: {
2296
+ "Cache-Control": "no-cache",
2297
+ Pragma: "no-cache"
2298
+ }
2299
+ });
2300
+ if (!n.ok) return null;
2301
+ let r = n.headers.get("content-type");
2302
+ return r && !r.includes("application/json") ? null : wi(await n.json());
2303
+ } catch {
2304
+ return null;
2305
+ }
2306
+ }
2307
+ function vi() {
2308
+ return Math.max($.interval ?? $r, 30 * 1e3);
2309
+ }
2310
+ function yi(e) {
2311
+ let t = Si();
2312
+ return !!(t && t.version === e);
2313
+ }
2314
+ function bi(e, t) {
2315
+ let n = Date.now() + Math.max(t, 60 * 1e3);
2316
+ localStorage.setItem(ei, JSON.stringify({
2317
+ version: e,
2318
+ until: n
2319
+ }));
2320
+ }
2321
+ function xi() {
2322
+ let e = Si();
2323
+ return e?.until ? (hi(), gi(), ni = window.setTimeout(() => {
2324
+ ni = void 0, ai && Xr(!0) && li();
2325
+ }, Math.max(e.until - Date.now(), 1e3)), !0) : (gi(), !1);
2326
+ }
2327
+ function Si() {
2328
+ let e = Ci();
2329
+ return !e?.until || e.until <= Date.now() ? null : e;
2330
+ }
2331
+ function Ci() {
2332
+ try {
2333
+ let e = localStorage.getItem(ei);
2334
+ return e ? JSON.parse(e) : null;
2335
+ } catch {
2336
+ return localStorage.removeItem(ei), null;
2337
+ }
2338
+ }
2339
+ function wi(e) {
2340
+ let t = {}, n = {}, r = [], i = Ti(e.main);
2341
+ i && (t.main = e.main ?? {}, n.main = i), e.main?.changelog && r.push(...Di(e.main.changelog));
2342
+ for (let [i, a] of Object.entries(e.apps ?? {})) {
2343
+ let e = Ti(a);
2344
+ e && (t[i] = a, n[i] = e), a.changelog && r.push(...Di(a.changelog));
2345
+ }
2346
+ return {
2347
+ changelog: r,
2348
+ displayVersion: i,
2349
+ entries: t,
2350
+ label: Object.keys(n).sort().map((e) => `${e}:${n[e]}`).join("|"),
2351
+ versions: n
2352
+ };
2353
+ }
2354
+ function Ti(e) {
2355
+ return [e?.version, e?.buildTime].filter(Boolean).join("@");
2356
+ }
2357
+ function Ei(e, t) {
2358
+ let n = Object.entries(t.versions).filter(([t, n]) => e.versions[t] !== n).map(([e]) => [e, t.entries[e]]).filter((e) => !!e[1]), r = Object.keys(e.versions).filter((e) => !t.versions[e]);
2359
+ if (!n.length && !r.length) return null;
2360
+ let i = {};
2361
+ for (let [e] of n) {
2362
+ let n = t.versions[e];
2363
+ n && (i[e] = n);
2364
+ }
2365
+ return {
2366
+ changelog: n.flatMap(([, e]) => Di(e.changelog)),
2367
+ displayVersion: i.main || Object.values(i)[0] || "",
2368
+ entries: Object.fromEntries(n),
2369
+ label: [...n.map(([e]) => `${e}:${t.versions[e]}`), ...r.map((e) => `${e}:removed`)].join("|"),
2370
+ versions: i
2371
+ };
2372
+ }
2373
+ function Di(e) {
2374
+ return Array.isArray(e) ? e.map((e) => String(e).trim()).filter(Boolean) : [];
2375
+ }
2376
+ function Oi(e) {
2377
+ let [t, n] = e.split("@");
2378
+ return t && n ? `版本 ${t} · ${n}` : t || n || "";
2379
+ }
2380
+ //#endregion
2381
+ //#region src/main/directives/index.ts
2382
+ var ki = {
2383
+ mounted(e, t) {
2384
+ Ai(e, t.value);
2385
+ },
2386
+ updated(e, t) {
2387
+ Ai(e, t.value);
2388
+ }
2389
+ };
2390
+ function Ai(e, t) {
2391
+ let n = a(), r = ji(t), i = typeof t == "object" && !Array.isArray(t) && t.mode || "all", o = typeof t == "object" && !Array.isArray(t) ? !!t.disabled : !1, s = i === "any" ? r.some((e) => n.hasPermission(e)) : r.every((e) => n.hasPermission(e));
2392
+ if (!r.length || s) {
2393
+ e.style.display = "", e.hidden = !1, o && (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
2394
+ return;
2395
+ }
2396
+ if (o) {
2397
+ e.setAttribute("disabled", "disabled"), e.classList.add("is-disabled");
2398
+ return;
2399
+ }
2400
+ e.style.display = "none", e.hidden = !0;
2401
+ }
2402
+ function ji(e) {
2403
+ return typeof e == "string" ? e ? [e] : [] : Array.isArray(e) ? e : e.permissions ?? [];
2404
+ }
2405
+ function Mi(e) {
2406
+ e.directive("permission", ki);
2407
+ }
2408
+ //#endregion
2409
+ //#region src/main/app/create-app.ts
2410
+ async function Ni(e) {
2411
+ Ke(e.appConfig), Ze();
2412
+ let t = Ar({
2413
+ businessRoutes: e.businessRoutes,
2414
+ history: e.routerHistory,
2415
+ scrollBehavior: e.routerScrollBehavior,
2416
+ setupRouter: e.setupRouter
2417
+ }), n = A(e.rootComponent), r = ce(), i = {
2418
+ app: n,
2419
+ router: t,
2420
+ pinia: r,
2421
+ http: Je,
2422
+ requestManager: Xe
2423
+ };
2424
+ fe(), n.use(T, { locale: Ue }), n.use(r), n.use(t), Mi(n), We(t), await e.setupApp?.(i), await e.beforePlatformInit?.(i);
2425
+ let a = f(r), o = l(r), s = lt(r);
2426
+ a.initializePreferences(), ci(e.appConfig.updateChecker);
2427
+ let c = de({ fullscreen: !0 });
2428
+ try {
2429
+ await Promise.all([o.initializeSystemConfig(), s.initializeTabs()]);
2430
+ } finally {
2431
+ c.close();
2432
+ }
2433
+ await e.afterPlatformInit?.(i), await e.beforeMount?.(i);
2434
+ let u = n.mount("#app"), d = {
2435
+ ...i,
2436
+ vm: u
2437
+ };
2438
+ return await e.afterMount?.(d), n;
2439
+ }
2440
+ //#endregion
2441
+ export { Je as _, Xr as a, zr as c, hr as d, ft as f, Ye as g, Ze as h, ui as i, Ar as l, lt as m, di as n, Zr as o, Z as p, ci as r, Br as s, Ni as t, kr as u, Xe as v, We as y };