@morningfast/platform 1.0.5 → 1.0.7

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,2443 @@
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, r) {
677
+ if (!r) return `${e}:${t.refreshKey}`;
678
+ let i = p(n);
679
+ return i ? `micro-app:${i.name}` : "micro-app";
680
+ }
681
+ return (e, t) => {
682
+ let r = W("router-view"), i = W("el-main");
683
+ return V(), j(i, { class: "app-layout__main" }, {
684
+ default: Y(() => [I(r, null, {
685
+ default: Y(({ Component: e, route: t }) => [(V(), j(G(e), { key: n(t.fullPath, t.path, !!t.meta.microApp) }))]),
686
+ _: 1
687
+ })]),
688
+ _: 1
689
+ });
690
+ };
691
+ }
692
+ }), pn = ["title"], mn = /* @__PURE__ */ y(/* @__PURE__ */ L({
693
+ __name: "ThemeToggleButton",
694
+ setup(e) {
695
+ let t = f();
696
+ async function n(e) {
697
+ await u(e, () => {
698
+ t.toggleDarkMode();
699
+ });
700
+ }
701
+ return (e, r) => {
702
+ let i = W("el-icon");
703
+ return V(), N("button", {
704
+ type: "button",
705
+ class: "app-layout__header-tool-btn theme-icon-btn",
706
+ title: q(t).isDark ? "切换浅色模式" : "切换深色模式",
707
+ onClick: n
708
+ }, [I(i, { size: 20 }, {
709
+ default: Y(() => [(V(), j(G(q(t).isDark ? q(Ie) : q(Ae))))]),
710
+ _: 1
711
+ })], 8, pn);
712
+ };
713
+ }
714
+ }), [["__scopeId", "data-v-73aaf569"]]);
715
+ //#endregion
716
+ //#region src/main/layouts/composables/useAppMenus.ts
717
+ function hn() {
718
+ 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));
719
+ return {
720
+ activeMenu: k(() => e.path),
721
+ activeTopMenuPath: k(() => {
722
+ let t = e.path;
723
+ return o.value.find((e) => t === e.fullPath || t.startsWith(`${e.fullPath}/`))?.fullPath || n.selectedTopMenuPath;
724
+ }),
725
+ allMenus: i,
726
+ flatMenus: c,
727
+ flatSideMenus: l,
728
+ findFirstLeafNode: vn,
729
+ findFirstLeafPath: yn,
730
+ sideMenus: s,
731
+ topMenus: o
732
+ };
733
+ }
734
+ function gn(e, t, n) {
735
+ return e.filter((e) => !e.meta?.hidden && xn(e, n)).map((e) => {
736
+ let r = Cn(e.path, t), i = e.children?.length ? gn(e.children, r, n) : void 0;
737
+ return {
738
+ path: e.path,
739
+ fullPath: r,
740
+ title: String(e.meta?.title ?? e.name ?? "未命名菜单"),
741
+ icon: e.meta?.icon ? String(e.meta.icon) : void 0,
742
+ children: i
743
+ };
744
+ }).filter((t) => t.children?.length || !Sn(e, t.path));
745
+ }
746
+ function _n(e) {
747
+ return e.flatMap((e) => [e, ..._n(e.children ?? [])]);
748
+ }
749
+ function vn(e) {
750
+ if (!e.children?.length) return e;
751
+ for (let t of e.children) {
752
+ let e = vn(t);
753
+ if (e) return e;
754
+ }
755
+ return null;
756
+ }
757
+ function yn(e, t, n = "") {
758
+ for (let r of e) {
759
+ let e = Cn(r.path, n);
760
+ if (e === t) return bn(r, n);
761
+ if (r.children?.length) {
762
+ let n = yn(r.children, t, e);
763
+ if (n) return n;
764
+ }
765
+ }
766
+ return null;
767
+ }
768
+ function bn(e, t) {
769
+ let n = Cn(e.path, t);
770
+ if (e.component) return n;
771
+ let r = e.children ?? [];
772
+ for (let e of r) {
773
+ let t = Cn(e.path, n);
774
+ if (e.component) return t;
775
+ }
776
+ for (let e of r) {
777
+ let t = bn(e, n);
778
+ if (t) return t;
779
+ }
780
+ return null;
781
+ }
782
+ function xn(e, t) {
783
+ let n = e.meta?.permission;
784
+ return n ? Array.isArray(n) ? n.every((e) => t(String(e))) : t(String(n)) : !0;
785
+ }
786
+ function Sn(e, t) {
787
+ let n = e.find((e) => e.path === t);
788
+ return !!(n?.redirect && !n.component && !n.children?.length);
789
+ }
790
+ function Cn(e, t) {
791
+ return e.startsWith("/") ? e : `${t}/${e}`.replace(/\/+/g, "/");
792
+ }
793
+ //#endregion
794
+ //#region src/main/layouts/components/AppBrandLogo.vue?vue&type=script&setup=true&lang.ts
795
+ var wn = ["src", "alt"], Tn = ["src", "alt"], En = /* @__PURE__ */ y(/* @__PURE__ */ L({
796
+ __name: "AppBrandLogo",
797
+ props: {
798
+ src: {},
799
+ alt: {},
800
+ textInverted: {
801
+ type: Boolean,
802
+ default: !1
803
+ },
804
+ width: { default: "158px" },
805
+ height: { default: "40px" }
806
+ },
807
+ setup(e) {
808
+ let t = e, n = k(() => ({
809
+ "--app-brand-logo-width": t.width,
810
+ "--app-brand-logo-height": t.height
811
+ }));
812
+ return (t, r) => (V(), N("span", {
813
+ class: "app-brand-logo",
814
+ style: B(n.value)
815
+ }, [P("img", {
816
+ src: e.src,
817
+ alt: e.alt,
818
+ class: z(["app-brand-logo__image", { "is-text-base": e.textInverted }])
819
+ }, null, 10, wn), e.textInverted ? (V(), N("img", {
820
+ key: 0,
821
+ src: e.src,
822
+ alt: e.alt,
823
+ class: "app-brand-logo__image app-brand-logo__image--text-inverted",
824
+ "aria-hidden": "true"
825
+ }, null, 8, Tn)) : M("", !0)], 4));
826
+ }
827
+ }), [["__scopeId", "data-v-a42b8639"]]), Dn = {
828
+ Connection: ye,
829
+ Document: Se,
830
+ Grid: Ee,
831
+ House: De,
832
+ Setting: Fe,
833
+ Upload: ze,
834
+ User: Be
835
+ };
836
+ function Q(e) {
837
+ return e ? Dn[e] ?? De : De;
838
+ }
839
+ //#endregion
840
+ //#region src/main/layouts/components/AppHeaderMenuNode.vue
841
+ var On = /* @__PURE__ */ L({
842
+ name: "AppHeaderMenuNode",
843
+ __name: "AppHeaderMenuNode",
844
+ props: { node: {} },
845
+ setup(e) {
846
+ return (t, n) => {
847
+ let r = W("el-icon"), i = W("AppHeaderMenuNode", !0), a = W("el-sub-menu"), o = W("el-menu-item");
848
+ return e.node.children?.length ? (V(), j(a, {
849
+ key: 0,
850
+ index: e.node.fullPath
851
+ }, {
852
+ title: Y(() => [e.node.icon ? (V(), j(r, { key: 0 }, {
853
+ default: Y(() => [(V(), j(G(q(Q)(e.node.icon))))]),
854
+ _: 1
855
+ })) : M("", !0), P("span", null, K(e.node.title), 1)]),
856
+ default: Y(() => [(V(!0), N(D, null, U(e.node.children, (e) => (V(), j(i, {
857
+ key: e.fullPath,
858
+ node: e
859
+ }, null, 8, ["node"]))), 128))]),
860
+ _: 1
861
+ }, 8, ["index"])) : (V(), j(o, {
862
+ key: 1,
863
+ index: e.node.fullPath
864
+ }, {
865
+ default: Y(() => [e.node.icon ? (V(), j(r, { key: 0 }, {
866
+ default: Y(() => [(V(), j(G(q(Q)(e.node.icon))))]),
867
+ _: 1
868
+ })) : M("", !0), P("span", null, K(e.node.title), 1)]),
869
+ _: 1
870
+ }, 8, ["index"]));
871
+ };
872
+ }
873
+ }), 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 = {
874
+ key: 0,
875
+ class: "app-menu-search-item__actions"
876
+ }, Nn = { class: "app-menu-search-item__enter" }, Pn = ["src"], Fn = /* @__PURE__ */ L({
877
+ __name: "AppMenuSearchItem",
878
+ props: {
879
+ active: { type: Boolean },
880
+ item: {},
881
+ removable: { type: Boolean }
882
+ },
883
+ emits: [
884
+ "enter",
885
+ "remove",
886
+ "select"
887
+ ],
888
+ setup(e, { emit: t }) {
889
+ let n = t;
890
+ return (t, r) => {
891
+ let i = W("el-icon");
892
+ return V(), N("div", {
893
+ class: z(["app-menu-search-item", { "is-active": e.active }]),
894
+ onMouseenter: r[4] ||= (t) => n("enter", e.item)
895
+ }, [P("div", {
896
+ class: "app-menu-search-item__main",
897
+ role: "button",
898
+ tabindex: "0",
899
+ onClick: r[1] ||= (t) => n("select", e.item),
900
+ onKeydown: [r[2] ||= se(X((t) => n("select", e.item), ["prevent"]), ["enter"]), r[3] ||= se(X((t) => n("select", e.item), ["prevent"]), ["space"])]
901
+ }, [
902
+ P("span", An, [I(i, null, {
903
+ default: Y(() => [(V(), j(G(q(Q)(e.item.icon))))]),
904
+ _: 1
905
+ })]),
906
+ P("span", jn, [P("strong", null, K(e.item.title), 1), P("span", null, K(e.item.fullPath), 1)]),
907
+ I(O, { name: "app-menu-search-actions" }, {
908
+ default: Y(() => [e.active ? (V(), N("span", Mn, [P("span", Nn, [P("img", {
909
+ src: q(kn),
910
+ alt: "",
911
+ "aria-hidden": "true"
912
+ }, null, 8, Pn)]), e.removable ? (V(), N("button", {
913
+ key: 0,
914
+ class: "app-menu-search-item__remove",
915
+ type: "button",
916
+ "aria-label": "删除搜索历史",
917
+ onClick: r[0] ||= X((t) => n("remove", e.item), ["stop"])
918
+ }, [I(i, null, {
919
+ default: Y(() => [I(q(ve))]),
920
+ _: 1
921
+ })])) : M("", !0)])) : M("", !0)]),
922
+ _: 1
923
+ })
924
+ ], 32)], 34);
925
+ };
926
+ }
927
+ }), In = { class: "app-menu-search__control" }, Ln = {
928
+ key: 0,
929
+ class: "app-menu-search__section"
930
+ }, Rn = {
931
+ key: 1,
932
+ class: "app-menu-search__section"
933
+ }, zn = {
934
+ key: 2,
935
+ class: "app-menu-search__empty"
936
+ }, Bn = { class: "app-menu-search__footer" }, Vn = "menu-search-history", Hn = 8, Un = 70, Wn = 28, Gn = 520, Kn = /* @__PURE__ */ L({
937
+ __name: "AppMenuSearch",
938
+ props: { modelValue: { type: Boolean } },
939
+ emits: ["update:modelValue"],
940
+ setup(e, { emit: t }) {
941
+ 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) => {
942
+ let t = e.title.toLowerCase(), n = e.fullPath.toLowerCase();
943
+ return t.includes(f.value) || n.includes(f.value);
944
+ }) : []), m = k(() => c.value ? p.value : d.value), h = k(() => c.value ? !p.value.length : !d.value.length);
945
+ J(() => n.modelValue, (e) => {
946
+ if (!e) {
947
+ B();
948
+ return;
949
+ }
950
+ d.value = E(), c.value = "", u.value = d.value[0] ?? null, l.value = 0, document.body.classList.add("app-menu-search-open"), z(), R(() => {
951
+ o.value?.focus?.(), s.value?.setScrollTop?.(0);
952
+ });
953
+ }), J(p, (e) => {
954
+ u.value = e[0] ?? null, s.value?.setScrollTop?.(0);
955
+ }), re(() => {
956
+ B();
957
+ });
958
+ function g() {
959
+ r("update:modelValue", !1), B();
960
+ }
961
+ function _(e) {
962
+ u.value = e;
963
+ }
964
+ function v(e) {
965
+ T(e), g(), i.push(e.fullPath);
966
+ }
967
+ function y(e) {
968
+ let t = d.value.filter((t) => t.fullPath !== e.fullPath);
969
+ A(t), u.value?.fullPath === e.fullPath && (u.value = t[0] ?? null);
970
+ }
971
+ function b() {
972
+ A([]), u.value = null;
973
+ }
974
+ function x(e) {
975
+ l.value = e.scrollTop;
976
+ }
977
+ function S(e) {
978
+ if (n.modelValue && !e.isComposing) {
979
+ if (e.code === "Escape") {
980
+ e.preventDefault(), g();
981
+ return;
982
+ }
983
+ if (e.code === "Enter" && u.value) {
984
+ e.preventDefault(), v(u.value);
985
+ return;
986
+ }
987
+ (e.code === "ArrowDown" || e.code === "ArrowUp") && (e.preventDefault(), C(e.code === "ArrowDown" ? 1 : -1));
988
+ }
989
+ }
990
+ function C(e) {
991
+ let t = m.value;
992
+ if (!t.length) return;
993
+ let n = L((u.value ? t.findIndex((e) => e.fullPath === u.value?.fullPath) : -1) + e, 0, t.length - 1), r = t[n];
994
+ r && (u.value = r, w(n));
995
+ }
996
+ function w(e) {
997
+ let t = Wn + e * Un, n = l.value, r = l.value + Gn - Un;
998
+ t < n ? s.value?.setScrollTop?.(t) : t > r && s.value?.setScrollTop?.(t - Gn + Un);
999
+ }
1000
+ function T(e) {
1001
+ A([e, ...d.value.filter((t) => t.fullPath !== e.fullPath)].slice(0, Hn));
1002
+ }
1003
+ function E() {
1004
+ try {
1005
+ let e = localStorage.getItem(Vn);
1006
+ if (!e) return [];
1007
+ let t = JSON.parse(e), n = new Set(a.value.map((e) => e.fullPath));
1008
+ return t.filter((e) => n.has(e.fullPath));
1009
+ } catch {
1010
+ return [];
1011
+ }
1012
+ }
1013
+ function A(e) {
1014
+ if (d.value = e, !e.length) {
1015
+ localStorage.removeItem(Vn);
1016
+ return;
1017
+ }
1018
+ localStorage.setItem(Vn, JSON.stringify(e));
1019
+ }
1020
+ function L(e, t, n) {
1021
+ return Math.min(Math.max(e, t), n);
1022
+ }
1023
+ function z() {
1024
+ window.removeEventListener("keydown", S, !0), window.addEventListener("keydown", S, !0);
1025
+ }
1026
+ function B() {
1027
+ document.body.classList.remove("app-menu-search-open"), window.removeEventListener("keydown", S, !0);
1028
+ }
1029
+ return (t, n) => {
1030
+ let r = W("el-icon"), i = W("el-input"), a = W("el-scrollbar");
1031
+ return V(), j(te, { to: "body" }, [I(O, { name: "app-menu-search-fade" }, {
1032
+ default: Y(() => [e.modelValue ? (V(), N("section", {
1033
+ key: 0,
1034
+ class: "app-menu-search",
1035
+ tabindex: "-1",
1036
+ onClick: X(g, ["self"])
1037
+ }, [P("div", {
1038
+ class: "app-menu-search__panel",
1039
+ onClick: n[1] ||= X(() => {}, ["stop"])
1040
+ }, [
1041
+ P("div", In, [I(i, {
1042
+ ref_key: "searchInputRef",
1043
+ ref: o,
1044
+ modelValue: c.value,
1045
+ "onUpdate:modelValue": n[0] ||= (e) => c.value = e,
1046
+ size: "large",
1047
+ placeholder: "搜索页面名称或路径",
1048
+ clearable: ""
1049
+ }, {
1050
+ prefix: Y(() => [I(r, null, {
1051
+ default: Y(() => [I(q(Pe))]),
1052
+ _: 1
1053
+ })]),
1054
+ _: 1
1055
+ }, 8, ["modelValue"])]),
1056
+ I(a, {
1057
+ ref_key: "scrollbarRef",
1058
+ ref: s,
1059
+ class: "app-menu-search__scroll",
1060
+ "max-height": "520px",
1061
+ onScroll: x
1062
+ }, {
1063
+ default: Y(() => [
1064
+ p.value.length ? (V(), N("div", Ln, [n[2] ||= P("div", { class: "app-menu-search__section-title" }, "页面", -1), I(ne, {
1065
+ name: "app-menu-search-list",
1066
+ tag: "div",
1067
+ class: "app-menu-search__list"
1068
+ }, {
1069
+ default: Y(() => [(V(!0), N(D, null, U(p.value, (e) => (V(), j(Fn, {
1070
+ key: e.fullPath,
1071
+ active: u.value?.fullPath === e.fullPath,
1072
+ item: e,
1073
+ onEnter: _,
1074
+ onSelect: v
1075
+ }, null, 8, ["active", "item"]))), 128))]),
1076
+ _: 1
1077
+ })])) : M("", !0),
1078
+ !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", {
1079
+ class: "app-menu-search__clear",
1080
+ type: "button",
1081
+ onClick: b
1082
+ }, " 清空 ")]), I(ne, {
1083
+ name: "app-menu-search-list",
1084
+ tag: "div",
1085
+ class: "app-menu-search__list"
1086
+ }, {
1087
+ default: Y(() => [(V(!0), N(D, null, U(d.value, (e) => (V(), j(Fn, {
1088
+ key: e.fullPath,
1089
+ active: u.value?.fullPath === e.fullPath,
1090
+ item: e,
1091
+ removable: "",
1092
+ onEnter: _,
1093
+ onRemove: y,
1094
+ onSelect: v
1095
+ }, null, 8, ["active", "item"]))), 128))]),
1096
+ _: 1
1097
+ })])) : M("", !0),
1098
+ h.value ? (V(), N("div", zn, K(c.value ? "没有匹配的页面" : "没有搜索历史"), 1)) : M("", !0)
1099
+ ]),
1100
+ _: 1
1101
+ }, 512),
1102
+ P("div", Bn, [
1103
+ n[5] ||= P("span", null, [P("kbd", null, "Enter"), F("选择")], -1),
1104
+ P("span", null, [
1105
+ I(r, null, {
1106
+ default: Y(() => [I(q(pe))]),
1107
+ _: 1
1108
+ }),
1109
+ I(r, null, {
1110
+ default: Y(() => [I(q(he))]),
1111
+ _: 1
1112
+ }),
1113
+ n[4] ||= F("切换", -1)
1114
+ ]),
1115
+ n[6] ||= P("span", null, [P("kbd", null, "Esc"), F("关闭")], -1)
1116
+ ])
1117
+ ])])) : M("", !0)]),
1118
+ _: 1
1119
+ })]);
1120
+ };
1121
+ }
1122
+ });
1123
+ //#endregion
1124
+ //#region src/main/layouts/composables/useShortcutLabel.ts
1125
+ function qn() {
1126
+ let e = ft();
1127
+ return {
1128
+ isMac: k(() => typeof navigator > "u" ? !1 : /Mac|iPhone|iPad|iPod/i.test(navigator.platform)),
1129
+ searchShortcutLabel: k(() => vt(e.getShortcutKeys("search"), { useSymbol: !0 }))
1130
+ };
1131
+ }
1132
+ //#endregion
1133
+ //#region src/main/layouts/components/AppMenuSearchTrigger.vue?vue&type=script&setup=true&lang.ts
1134
+ var Jn = { class: "app-menu-search-trigger__shortcut" }, Yn = /* @__PURE__ */ L({
1135
+ __name: "AppMenuSearchTrigger",
1136
+ props: { layoutMode: {} },
1137
+ emits: ["open"],
1138
+ setup(e, { emit: t }) {
1139
+ let n = t, { searchShortcutLabel: r } = qn();
1140
+ return (t, i) => {
1141
+ let a = W("el-icon");
1142
+ return V(), N("button", {
1143
+ class: z(["app-menu-search-trigger", `app-menu-search-trigger--${e.layoutMode}`]),
1144
+ type: "button",
1145
+ "aria-label": "搜索页面",
1146
+ onClick: i[0] ||= (e) => n("open")
1147
+ }, [
1148
+ I(a, null, {
1149
+ default: Y(() => [I(q(Pe))]),
1150
+ _: 1
1151
+ }),
1152
+ i[1] ||= P("span", { class: "app-menu-search-trigger__text" }, "搜索页面", -1),
1153
+ P("span", Jn, K(q(r)), 1)
1154
+ ], 2);
1155
+ };
1156
+ }
1157
+ }), Xn = { class: "app-layout__header-left" }, Zn = {
1158
+ key: 0,
1159
+ class: "app-layout__header-brand"
1160
+ }, Qn = ["title", "aria-label"], $n = { class: "app-layout__header-right" }, er = { class: "app-layout__user" }, tr = { class: "app-layout__user-copy" }, nr = /* @__PURE__ */ L({
1161
+ __name: "AppHeader",
1162
+ props: { breadcrumbItems: {} },
1163
+ setup(e) {
1164
+ 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);
1165
+ ie(() => {
1166
+ s.initShortcuts(), window.addEventListener("keydown", E, { capture: !0 });
1167
+ }), re(() => {
1168
+ window.removeEventListener("keydown", E, { capture: !0 });
1169
+ });
1170
+ function b(e, n) {
1171
+ if (n !== t.breadcrumbItems.length - 1) return h(c.options.routes, e.path) || e.path || "/";
1172
+ }
1173
+ async function x() {
1174
+ await o.resetTabs(), n.setSelectedTopMenuPath(""), await r.logout(), c.push("/login");
1175
+ }
1176
+ function S(e) {
1177
+ c.push(e);
1178
+ }
1179
+ function w(e) {
1180
+ let t = g.value.find((t) => t.fullPath === e);
1181
+ if (!t) return;
1182
+ n.setSelectedTopMenuPath(t.fullPath);
1183
+ let r = m(t)?.fullPath || t.fullPath;
1184
+ c.push(r);
1185
+ }
1186
+ function T() {
1187
+ d.value = !0;
1188
+ }
1189
+ function E(e) {
1190
+ e.defaultPrevented || e.repeat || d.value || s.isShortcutEnabled("search") && yt(e, s.getShortcutKeys("search")) && (e.preventDefault(), T());
1191
+ }
1192
+ return (t, a) => {
1193
+ 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");
1194
+ return V(), N(D, null, [I(ee, { class: "app-layout__header" }, {
1195
+ default: Y(() => [
1196
+ P("div", Xn, [
1197
+ q(n).layoutMode === "default" || q(n).layoutMode === "top" ? (V(), N("div", Zn, [I(En, {
1198
+ src: v.value,
1199
+ alt: q(i).systemName,
1200
+ "text-inverted": y.value
1201
+ }, null, 8, [
1202
+ "src",
1203
+ "alt",
1204
+ "text-inverted"
1205
+ ])])) : M("", !0),
1206
+ q(n).layoutMode !== "top" || q(n).isMobileViewport ? (V(), N("button", {
1207
+ key: 1,
1208
+ type: "button",
1209
+ class: "app-layout__header-tool-btn app-layout__header-tool-btn--collapse",
1210
+ title: q(n).isMobileViewport ? "打开菜单" : q(n).sidebarCollapsed ? "展开侧边栏" : "折叠侧边栏",
1211
+ "aria-label": q(n).isMobileViewport ? "打开菜单" : q(n).sidebarCollapsed ? "展开侧边栏" : "折叠侧边栏",
1212
+ onClick: a[0] ||= (e) => q(n).toggleSidebar()
1213
+ }, [I(o, null, {
1214
+ default: Y(() => [(V(), j(G(q(n).sidebarCollapsed && !q(n).isMobileViewport ? q(Ce) : q(we))))]),
1215
+ _: 1
1216
+ })], 8, Qn)) : M("", !0),
1217
+ q(n).layoutMode === "top" && !q(n).isMobileViewport ? (V(), j(s, {
1218
+ key: 2,
1219
+ mode: "horizontal",
1220
+ ellipsis: !1,
1221
+ "default-active": q(u).path,
1222
+ class: "app-layout__header-menu",
1223
+ onSelect: S
1224
+ }, {
1225
+ default: Y(() => [(V(!0), N(D, null, U(q(g), (e) => (V(), j(On, {
1226
+ key: e.fullPath,
1227
+ node: e
1228
+ }, null, 8, ["node"]))), 128))]),
1229
+ _: 1
1230
+ }, 8, ["default-active"])) : q(n).layoutMode === "mix" && !q(n).isMobileViewport ? (V(), j(s, {
1231
+ key: 3,
1232
+ mode: "horizontal",
1233
+ ellipsis: !1,
1234
+ "default-active": q(p),
1235
+ class: "app-layout__header-menu app-layout__header-menu--mix",
1236
+ onSelect: w
1237
+ }, {
1238
+ default: Y(() => [(V(!0), N(D, null, U(q(g), (e) => (V(), j(c, {
1239
+ key: e.fullPath,
1240
+ index: e.fullPath
1241
+ }, {
1242
+ default: Y(() => [F(K(e.title), 1)]),
1243
+ _: 2
1244
+ }, 1032, ["index"]))), 128))]),
1245
+ _: 1
1246
+ }, 8, ["default-active"])) : M("", !0),
1247
+ q(n).layoutMode === "default" || q(n).layoutMode === "side" ? (V(), j(f, {
1248
+ key: 4,
1249
+ "separator-icon": q(me)
1250
+ }, {
1251
+ default: Y(() => [(V(!0), N(D, null, U(e.breadcrumbItems, (e, t) => (V(), j(l, {
1252
+ key: e.path || String(e.name),
1253
+ to: b(e, t)
1254
+ }, {
1255
+ default: Y(() => [F(K(e.meta.title), 1)]),
1256
+ _: 2
1257
+ }, 1032, ["to"]))), 128))]),
1258
+ _: 1
1259
+ }, 8, ["separator-icon"])) : M("", !0)
1260
+ ]),
1261
+ q(n).layoutMode !== "mix" && !q(n).isSidebarMenuSearch ? (V(), N("div", {
1262
+ key: 0,
1263
+ class: z(["app-layout__header-search", `app-layout__header-search--${q(n).layoutMode}`])
1264
+ }, [I(Yn, {
1265
+ "layout-mode": q(n).layoutMode,
1266
+ onOpen: T
1267
+ }, null, 8, ["layout-mode"])], 2)) : M("", !0),
1268
+ P("div", $n, [
1269
+ q(n).layoutMode === "mix" && !q(n).isSidebarMenuSearch ? (V(), j(Yn, {
1270
+ key: 0,
1271
+ "layout-mode": q(n).layoutMode,
1272
+ onOpen: T
1273
+ }, null, 8, ["layout-mode"])) : M("", !0),
1274
+ P("button", {
1275
+ type: "button",
1276
+ class: "app-layout__header-tool-btn",
1277
+ title: "主题设置",
1278
+ onClick: a[1] ||= (e) => q(n).openSettings("theme")
1279
+ }, [I(o, {
1280
+ size: 18,
1281
+ class: "app-layout__header-tool-icon"
1282
+ }, {
1283
+ default: Y(() => [I(q(_e))]),
1284
+ _: 1
1285
+ })]),
1286
+ I(mn),
1287
+ I(C, { onCommand: x }, {
1288
+ dropdown: Y(() => [I(_, null, {
1289
+ default: Y(() => [I(h, { disabled: "" }, {
1290
+ default: Y(() => [I(o, null, {
1291
+ default: Y(() => [I(q(Fe))]),
1292
+ _: 1
1293
+ }), a[3] ||= F(" 个人设置 ", -1)]),
1294
+ _: 1
1295
+ }), I(h, { command: "logout" }, {
1296
+ default: Y(() => [I(o, null, {
1297
+ default: Y(() => [I(q(Le))]),
1298
+ _: 1
1299
+ }), a[4] ||= F(" 退出登录 ", -1)]),
1300
+ _: 1
1301
+ })]),
1302
+ _: 1
1303
+ })]),
1304
+ default: Y(() => [P("div", er, [
1305
+ I(m, { size: 32 }, {
1306
+ default: Y(() => [F(K(q(r).userName.slice(0, 1)), 1)]),
1307
+ _: 1
1308
+ }),
1309
+ P("div", tr, [P("strong", null, K(q(r).userName), 1), P("span", null, K(q(r).userRoleLabel), 1)]),
1310
+ I(o, null, {
1311
+ default: Y(() => [I(q(pe))]),
1312
+ _: 1
1313
+ })
1314
+ ])]),
1315
+ _: 1
1316
+ })
1317
+ ])
1318
+ ]),
1319
+ _: 1
1320
+ }), I(Kn, {
1321
+ modelValue: d.value,
1322
+ "onUpdate:modelValue": a[2] ||= (e) => d.value = e
1323
+ }, null, 8, ["modelValue"])], 64);
1324
+ };
1325
+ }
1326
+ });
1327
+ //#endregion
1328
+ //#region src/main/layouts/utils/menuSearch.ts
1329
+ function rr(e, t) {
1330
+ let n = t.trim().toLowerCase();
1331
+ if (!n) return [...e];
1332
+ let r = [];
1333
+ for (let t of e) {
1334
+ let e = rr(t.children ?? [], n);
1335
+ !(or(t) && ar(t, n)) && !e.length || r.push({
1336
+ ...t,
1337
+ children: e.length ? e : void 0
1338
+ });
1339
+ }
1340
+ return r;
1341
+ }
1342
+ function ir(e, t) {
1343
+ let n = sr(e), r = t.trim();
1344
+ if (!r) return n;
1345
+ let i = Array.from(e), a = e.toLowerCase(), o = r.toLowerCase(), s = a.indexOf(o);
1346
+ 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(""))}`;
1347
+ }
1348
+ function ar(e, t) {
1349
+ return e.title.toLowerCase().includes(t);
1350
+ }
1351
+ function or(e) {
1352
+ return !e.children?.length;
1353
+ }
1354
+ function sr(e) {
1355
+ return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
1356
+ }
1357
+ //#endregion
1358
+ //#region src/main/layouts/components/AppSidebarSearch.vue?vue&type=script&setup=true&lang.ts
1359
+ var cr = {
1360
+ key: 0,
1361
+ class: "app-sidebar-search"
1362
+ }, lr = /* @__PURE__ */ L({
1363
+ __name: "AppSidebarSearch",
1364
+ props: {
1365
+ collapsed: { type: Boolean },
1366
+ keyword: {}
1367
+ },
1368
+ emits: ["update:keyword"],
1369
+ setup(e, { emit: t }) {
1370
+ let n = t;
1371
+ return (t, r) => {
1372
+ let i = W("el-icon"), a = W("el-input");
1373
+ return e.collapsed ? M("", !0) : (V(), N("div", cr, [I(a, {
1374
+ "model-value": e.keyword,
1375
+ placeholder: "搜索菜单",
1376
+ clearable: "",
1377
+ "onUpdate:modelValue": r[0] ||= (e) => n("update:keyword", e)
1378
+ }, {
1379
+ prefix: Y(() => [I(i, null, {
1380
+ default: Y(() => [I(q(Pe))]),
1381
+ _: 1
1382
+ })]),
1383
+ _: 1
1384
+ }, 8, ["model-value"])]));
1385
+ };
1386
+ }
1387
+ }), ur = ["innerHTML"], dr = ["innerHTML"], fr = /* @__PURE__ */ L({
1388
+ name: "AppSidebarNode",
1389
+ __name: "AppSidebarNode",
1390
+ props: {
1391
+ node: {},
1392
+ keyword: {}
1393
+ },
1394
+ setup(e) {
1395
+ let t = e, n = k(() => ir(t.node.title, t.keyword ?? ""));
1396
+ return (t, r) => {
1397
+ let i = W("el-icon"), a = W("AppSidebarNode", !0), o = W("el-sub-menu"), s = W("el-menu-item");
1398
+ return e.node.children?.length ? (V(), j(o, {
1399
+ key: 0,
1400
+ index: e.node.fullPath
1401
+ }, {
1402
+ title: Y(() => [I(i, null, {
1403
+ default: Y(() => [(V(), j(G(q(Q)(e.node.icon))))]),
1404
+ _: 1
1405
+ }), P("span", { innerHTML: n.value }, null, 8, ur)]),
1406
+ default: Y(() => [(V(!0), N(D, null, U(e.node.children, (t) => (V(), j(a, {
1407
+ key: t.fullPath,
1408
+ node: t,
1409
+ keyword: e.keyword
1410
+ }, null, 8, ["node", "keyword"]))), 128))]),
1411
+ _: 1
1412
+ }, 8, ["index"])) : (V(), j(s, {
1413
+ key: 1,
1414
+ index: e.node.fullPath
1415
+ }, {
1416
+ default: Y(() => [e.node.icon ? (V(), j(i, { key: 0 }, {
1417
+ default: Y(() => [(V(), j(G(q(Q)(e.node.icon))))]),
1418
+ _: 1
1419
+ })) : M("", !0), P("span", { innerHTML: n.value }, null, 8, dr)]),
1420
+ _: 1
1421
+ }, 8, ["index"]));
1422
+ };
1423
+ }
1424
+ }), pr = {
1425
+ key: 0,
1426
+ class: "app-layout__brand"
1427
+ }, mr = /* @__PURE__ */ L({
1428
+ name: "AppSidebar",
1429
+ __name: "AppSidebar",
1430
+ setup(e) {
1431
+ 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));
1432
+ J(() => t.isSidebarMenuSearch, (e) => {
1433
+ e || (a.value = "");
1434
+ });
1435
+ function h(e) {
1436
+ let t = [];
1437
+ for (let n of e) n.children?.length && (t.push(n.fullPath), t.push(...h(n.children)));
1438
+ return t;
1439
+ }
1440
+ return (e, i) => {
1441
+ let o = W("el-menu"), l = W("el-scrollbar"), f = W("el-aside");
1442
+ return d.value ? (V(), j(f, {
1443
+ key: 0,
1444
+ width: u.value ? "72px" : "220px",
1445
+ class: z(["app-layout__aside", {
1446
+ "is-mix-mode": q(t).layoutMode === "mix",
1447
+ "has-brand": q(t).layoutMode !== "default",
1448
+ "has-sidebar-search": q(t).isSidebarMenuSearch,
1449
+ "is-mobile-open": q(t).mobileSidebarVisible
1450
+ }])
1451
+ }, {
1452
+ default: Y(() => [
1453
+ q(t).layoutMode === "default" ? M("", !0) : (V(), N("div", pr, [I(O, {
1454
+ name: "brand-fade",
1455
+ mode: "out-in"
1456
+ }, {
1457
+ default: Y(() => [u.value ? (V(), j(En, {
1458
+ key: "collapsed",
1459
+ src: q(n).logoCollapsed,
1460
+ alt: q(n).systemName,
1461
+ width: "40px",
1462
+ height: "40px"
1463
+ }, null, 8, ["src", "alt"])) : (V(), j(En, {
1464
+ key: "expanded",
1465
+ src: s.value,
1466
+ alt: q(n).systemName,
1467
+ "text-inverted": c.value
1468
+ }, null, 8, [
1469
+ "src",
1470
+ "alt",
1471
+ "text-inverted"
1472
+ ]))]),
1473
+ _: 1
1474
+ })])),
1475
+ q(t).isSidebarMenuSearch ? (V(), j(lr, {
1476
+ key: 1,
1477
+ collapsed: u.value,
1478
+ keyword: a.value,
1479
+ "onUpdate:keyword": i[0] ||= (e) => a.value = e
1480
+ }, null, 8, ["collapsed", "keyword"])) : M("", !0),
1481
+ I(l, { class: "app-layout__menu-scroll" }, {
1482
+ default: Y(() => [I(o, {
1483
+ collapse: u.value,
1484
+ "default-active": q(r),
1485
+ "default-openeds": m.value,
1486
+ class: "app-layout__menu",
1487
+ router: "",
1488
+ "unique-opened": "",
1489
+ onSelect: q(t).closeMobileSidebar
1490
+ }, {
1491
+ default: Y(() => [(V(!0), N(D, null, U(p.value, (e) => (V(), j(fr, {
1492
+ key: e.fullPath,
1493
+ node: e,
1494
+ keyword: q(t).isSidebarMenuSearch ? a.value : ""
1495
+ }, null, 8, ["node", "keyword"]))), 128))]),
1496
+ _: 1
1497
+ }, 8, [
1498
+ "collapse",
1499
+ "default-active",
1500
+ "default-openeds",
1501
+ "onSelect"
1502
+ ])]),
1503
+ _: 1
1504
+ })
1505
+ ]),
1506
+ _: 1
1507
+ }, 8, ["width", "class"])) : M("", !0);
1508
+ };
1509
+ }
1510
+ });
1511
+ //#endregion
1512
+ //#region src/main/composables/useSortable.ts
1513
+ function hr(e = {}) {
1514
+ let t = H(null);
1515
+ function n() {
1516
+ t.value?.destroy(), t.value = null;
1517
+ }
1518
+ function r(r) {
1519
+ r && (n(), t.value = He.create(r, {
1520
+ animation: e.animation ?? 150,
1521
+ chosenClass: e.chosenClass,
1522
+ direction: e.direction,
1523
+ disabled: e.disabled ?? !1,
1524
+ dragClass: e.dragClass,
1525
+ draggable: e.draggable,
1526
+ easing: e.easing,
1527
+ filter: e.filter,
1528
+ ghostClass: e.ghostClass,
1529
+ handle: e.handle,
1530
+ invertSwap: e.invertSwap,
1531
+ onEnd: (t) => {
1532
+ if (e.onEnd) {
1533
+ if (e.onEnd.length >= 2 && t.oldIndex != null && t.newIndex != null) {
1534
+ e.onEnd(t.oldIndex, t.newIndex);
1535
+ return;
1536
+ }
1537
+ e.onEnd();
1538
+ }
1539
+ },
1540
+ onStart: e.onStart,
1541
+ preventOnFilter: e.preventOnFilter,
1542
+ swapThreshold: e.swapThreshold
1543
+ }));
1544
+ }
1545
+ return re(() => {
1546
+ n();
1547
+ }), {
1548
+ destroy: n,
1549
+ init: r,
1550
+ sortableInstance: t
1551
+ };
1552
+ }
1553
+ //#endregion
1554
+ //#region src/main/layouts/components/AppTabsContextMenu.vue?vue&type=script&setup=true&lang.ts
1555
+ var gr = ["disabled"], _r = ["disabled"], vr = ["disabled"], yr = ["disabled"], br = ["disabled"], xr = /* @__PURE__ */ L({
1556
+ __name: "AppTabsContextMenu",
1557
+ props: {
1558
+ hasLeftTabs: { type: Boolean },
1559
+ hasMultipleTabs: { type: Boolean },
1560
+ hasRightTabs: { type: Boolean },
1561
+ hasLastActive: { type: Boolean },
1562
+ isTargetActive: { type: Boolean },
1563
+ isTargetHome: { type: Boolean },
1564
+ visible: { type: Boolean },
1565
+ position: {},
1566
+ targetTab: {}
1567
+ },
1568
+ emits: [
1569
+ "close",
1570
+ "closeAll",
1571
+ "closeLeft",
1572
+ "closeOthers",
1573
+ "closeRight",
1574
+ "closeTab",
1575
+ "openInNewTab",
1576
+ "refresh",
1577
+ "switchPrev"
1578
+ ],
1579
+ setup(e, { emit: t }) {
1580
+ let n = e, r = t;
1581
+ function i(e, t = !1) {
1582
+ t || (e(), r("close"));
1583
+ }
1584
+ function a() {
1585
+ n.targetTab && r("refresh", n.targetTab.path);
1586
+ }
1587
+ function o() {
1588
+ r("switchPrev");
1589
+ }
1590
+ function s() {
1591
+ n.targetTab && r("openInNewTab", n.targetTab.fullPath);
1592
+ }
1593
+ function c() {
1594
+ n.targetTab && r("closeTab", n.targetTab.path);
1595
+ }
1596
+ function l() {
1597
+ n.targetTab && r("closeOthers", n.targetTab.path);
1598
+ }
1599
+ function u() {
1600
+ n.targetTab && r("closeLeft", n.targetTab.path);
1601
+ }
1602
+ function d() {
1603
+ n.targetTab && r("closeRight", n.targetTab.path);
1604
+ }
1605
+ return (t, n) => {
1606
+ let f = W("el-icon");
1607
+ return e.visible && e.targetTab ? (V(), N("div", {
1608
+ key: 0,
1609
+ class: "app-tabs-menu",
1610
+ style: B({
1611
+ left: `${e.position.x}px`,
1612
+ top: `${e.position.y}px`
1613
+ }),
1614
+ onMousedown: n[8] ||= X(() => {}, ["stop"]),
1615
+ onContextmenu: n[9] ||= X(() => {}, ["prevent"])
1616
+ }, [
1617
+ P("button", {
1618
+ class: "app-tabs-menu__item",
1619
+ type: "button",
1620
+ onClick: n[0] ||= (e) => i(a)
1621
+ }, [I(f, null, {
1622
+ default: Y(() => [I(q(Ne))]),
1623
+ _: 1
1624
+ }), n[10] ||= P("span", null, "重新加载", -1)]),
1625
+ P("button", {
1626
+ class: "app-tabs-menu__item",
1627
+ type: "button",
1628
+ disabled: !e.hasLastActive,
1629
+ onClick: n[1] ||= (t) => i(o, !e.hasLastActive)
1630
+ }, [I(f, null, {
1631
+ default: Y(() => [I(q(ge))]),
1632
+ _: 1
1633
+ }), n[11] ||= P("span", null, "切换上一个页签", -1)], 8, gr),
1634
+ P("button", {
1635
+ class: "app-tabs-menu__item",
1636
+ type: "button",
1637
+ onClick: n[2] ||= (e) => i(s)
1638
+ }, [I(f, null, {
1639
+ default: Y(() => [I(q(Re))]),
1640
+ _: 1
1641
+ }), n[12] ||= P("span", null, "在新窗口打开", -1)]),
1642
+ n[18] ||= P("div", { class: "app-tabs-menu__divider" }, null, -1),
1643
+ P("button", {
1644
+ class: "app-tabs-menu__item",
1645
+ type: "button",
1646
+ disabled: e.isTargetHome,
1647
+ onClick: n[3] ||= (t) => i(c, e.isTargetHome)
1648
+ }, [I(f, null, {
1649
+ default: Y(() => [I(q(ve))]),
1650
+ _: 1
1651
+ }), n[13] ||= P("span", null, "关闭当前页签", -1)], 8, _r),
1652
+ P("button", {
1653
+ class: "app-tabs-menu__item",
1654
+ type: "button",
1655
+ disabled: !e.hasMultipleTabs,
1656
+ onClick: n[4] ||= (t) => i(l, !e.hasMultipleTabs)
1657
+ }, [I(f, null, {
1658
+ default: Y(() => [I(q(je))]),
1659
+ _: 1
1660
+ }), n[14] ||= P("span", null, "关闭其他页签", -1)], 8, vr),
1661
+ P("button", {
1662
+ class: "app-tabs-menu__item",
1663
+ type: "button",
1664
+ disabled: !e.hasLeftTabs,
1665
+ onClick: n[5] ||= (t) => i(u, !e.hasLeftTabs)
1666
+ }, [I(f, null, {
1667
+ default: Y(() => [I(q(be))]),
1668
+ _: 1
1669
+ }), n[15] ||= P("span", null, "关闭左侧页签", -1)], 8, yr),
1670
+ P("button", {
1671
+ class: "app-tabs-menu__item",
1672
+ type: "button",
1673
+ disabled: !e.hasRightTabs,
1674
+ onClick: n[6] ||= (t) => i(d, !e.hasRightTabs)
1675
+ }, [I(f, null, {
1676
+ default: Y(() => [I(q(xe))]),
1677
+ _: 1
1678
+ }), n[16] ||= P("span", null, "关闭右侧页签", -1)], 8, br),
1679
+ n[19] ||= P("div", { class: "app-tabs-menu__divider" }, null, -1),
1680
+ P("button", {
1681
+ class: "app-tabs-menu__item",
1682
+ type: "button",
1683
+ onClick: n[7] ||= (e) => i(() => r("closeAll"))
1684
+ }, [I(f, null, {
1685
+ default: Y(() => [I(q(Te))]),
1686
+ _: 1
1687
+ }), n[17] ||= P("span", null, "关闭全部页签", -1)])
1688
+ ], 36)) : M("", !0);
1689
+ };
1690
+ }
1691
+ }), Sr = {
1692
+ key: 0,
1693
+ class: "app-layout__tabs"
1694
+ }, Cr = { class: "app-layout__tabs-bar" }, wr = [
1695
+ "data-path",
1696
+ "onClick",
1697
+ "onContextmenu"
1698
+ ], Tr = { class: "app-layout__tab-label" }, Er = ["onClick"], Dr = /* @__PURE__ */ L({
1699
+ __name: "AppTabs",
1700
+ emits: ["refresh"],
1701
+ setup(e, { emit: t }) {
1702
+ let n = t, r = ee(), i = lt(), a = H(!1), o = H(!1), s = H(!1), c = H({
1703
+ x: 0,
1704
+ y: 0
1705
+ }), 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({
1706
+ animation: 150,
1707
+ chosenClass: "sortable-chosen",
1708
+ direction: "horizontal",
1709
+ dragClass: "sortable-drag",
1710
+ draggable: ".app-layout__tab",
1711
+ filter: ".app-layout__tab-close",
1712
+ ghostClass: "sortable-ghost",
1713
+ invertSwap: !1,
1714
+ onEnd: () => {
1715
+ let e = Array.from(u.value?.children ?? []), t = [];
1716
+ e.forEach((e) => {
1717
+ let n = e.dataset.path, r = i.tabs.find((e) => e.path === n);
1718
+ r && t.push(r);
1719
+ }), t.length === i.tabs.length && i.reorderTabs(t), window.setTimeout(() => {
1720
+ a.value = !1, u.value?.classList.remove("dragging");
1721
+ }, 100);
1722
+ },
1723
+ onStart: () => {
1724
+ a.value = !0, u.value?.classList.add("dragging");
1725
+ },
1726
+ preventOnFilter: !0,
1727
+ swapThreshold: .65
1728
+ });
1729
+ async function v(e) {
1730
+ e && (i.setActiveTab(e), await r.push(e), await T());
1731
+ }
1732
+ async function y(e) {
1733
+ if (e === "/dashboard") return;
1734
+ let t = i.tabs.findIndex((t) => t.path === e), n = i.activeTab === e;
1735
+ if (await i.removeTab(e), !n) return;
1736
+ let a = i.tabs[t] ?? i.tabs[t - 1];
1737
+ a ? await v(a.path) : (i.setActiveTab(""), r.push(Z));
1738
+ }
1739
+ async function b(e) {
1740
+ i.activeTab !== e && await v(e), o.value = !1, await R(), await T(), o.value = !0, n("refresh"), window.setTimeout(() => {
1741
+ o.value = !1;
1742
+ }, 600);
1743
+ }
1744
+ function x(e, t) {
1745
+ e.preventDefault(), S(e.clientX, e.clientY, t);
1746
+ }
1747
+ function S(e, t, n) {
1748
+ l.value = n, s.value = !0, c.value = {
1749
+ x: Math.min(e, window.innerWidth - 188),
1750
+ y: Math.min(t, window.innerHeight - 260)
1751
+ };
1752
+ }
1753
+ function C(e) {
1754
+ let t = i.tabs.find((e) => e.path === i.activeTab) ?? i.tabs.at(-1);
1755
+ if (!t) return;
1756
+ let n = e.currentTarget.getBoundingClientRect();
1757
+ S(n.left, n.bottom + 4, t);
1758
+ }
1759
+ function w(e) {
1760
+ !u.value || Math.abs(e.deltaY) <= Math.abs(e.deltaX) || (e.preventDefault(), u.value.scrollLeft += e.deltaY);
1761
+ }
1762
+ async function T() {
1763
+ await R(), await new Promise((e) => window.requestAnimationFrame(() => e(null))), await new Promise((e) => window.requestAnimationFrame(() => e(null)));
1764
+ let e = u.value, t = e?.querySelector(".app-layout__tab.is-active");
1765
+ if (!e || !t) return;
1766
+ t.scrollIntoView({
1767
+ behavior: "smooth",
1768
+ block: "nearest",
1769
+ inline: "center"
1770
+ });
1771
+ let n = Math.max(0, e.scrollWidth - e.clientWidth), r = t.offsetLeft - e.clientWidth / 2 + t.offsetWidth / 2;
1772
+ e.scrollTo({
1773
+ left: Math.min(n, Math.max(0, r)),
1774
+ behavior: "smooth"
1775
+ });
1776
+ }
1777
+ function E() {
1778
+ s.value = !1, l.value = null;
1779
+ }
1780
+ async function te(e) {
1781
+ await i.closeOtherTabs(e), await v(e);
1782
+ }
1783
+ async function O(e) {
1784
+ await i.closeLeftTabs(e), i.tabPaths.includes(i.activeTab) || await v(e);
1785
+ }
1786
+ async function ne(e) {
1787
+ await i.closeRightTabs(e), i.tabPaths.includes(i.activeTab) || await v(e);
1788
+ }
1789
+ async function A() {
1790
+ await i.closeAllTabs(), r.push(Z);
1791
+ }
1792
+ function F() {
1793
+ let e = i.lastActiveTab;
1794
+ !e || !i.tabPaths.includes(e) || v(e);
1795
+ }
1796
+ function L(e) {
1797
+ window.open(e, "_blank", "noopener,noreferrer");
1798
+ }
1799
+ function B(e) {
1800
+ e.button !== 2 && E();
1801
+ }
1802
+ return ie(() => {
1803
+ document.addEventListener("mousedown", B), _(u.value), T();
1804
+ }), ae(() => {
1805
+ document.removeEventListener("mousedown", B);
1806
+ }), J(() => i.tabs.map((e) => e.path).join("|"), () => {
1807
+ a.value || R(() => {
1808
+ _(u.value), T();
1809
+ });
1810
+ }), J(() => i.activeTab, () => {
1811
+ T();
1812
+ }), (e, t) => {
1813
+ let n = W("el-icon");
1814
+ return q(i).tabs.length ? (V(), N("div", Sr, [P("div", Cr, [
1815
+ P("div", {
1816
+ ref_key: "tabsScrollRef",
1817
+ ref: u,
1818
+ class: "app-layout__tabs-scroll",
1819
+ onWheel: w
1820
+ }, [(V(!0), N(D, null, U(q(i).tabs, (e) => (V(), N("div", {
1821
+ key: e.path,
1822
+ class: z(["app-layout__tab", { "is-active": q(i).activeTab === e.path }]),
1823
+ "data-path": e.path,
1824
+ onClick: (t) => v(e.fullPath),
1825
+ onContextmenu: (t) => x(t, e)
1826
+ }, [
1827
+ e.icon ? (V(), j(n, {
1828
+ key: 0,
1829
+ class: "app-layout__tab-icon"
1830
+ }, {
1831
+ default: Y(() => [(V(), j(G(q(Q)(e.icon))))]),
1832
+ _: 2
1833
+ }, 1024)) : M("", !0),
1834
+ P("span", Tr, K(e.title), 1),
1835
+ e.path === q("/dashboard") ? M("", !0) : (V(), N("button", {
1836
+ key: 1,
1837
+ class: "app-layout__tab-close",
1838
+ type: "button",
1839
+ onClick: X((t) => y(e.path), ["stop"])
1840
+ }, " × ", 8, Er))
1841
+ ], 42, wr))), 128))], 544),
1842
+ P("button", {
1843
+ class: "app-layout__tabs-action",
1844
+ type: "button",
1845
+ title: "页签操作",
1846
+ onClick: C
1847
+ }, [I(n, null, {
1848
+ default: Y(() => [I(q(pe))]),
1849
+ _: 1
1850
+ })]),
1851
+ P("button", {
1852
+ class: "app-layout__tabs-action",
1853
+ type: "button",
1854
+ title: "刷新当前页签",
1855
+ onClick: t[0] ||= (e) => b(q(i).activeTab)
1856
+ }, [I(n, { class: z({ "is-rotating": o.value }) }, {
1857
+ default: Y(() => [I(q(Ne))]),
1858
+ _: 1
1859
+ }, 8, ["class"])])
1860
+ ]), I(xr, {
1861
+ visible: s.value,
1862
+ "has-left-tabs": p.value,
1863
+ "has-multiple-tabs": h.value,
1864
+ "has-right-tabs": m.value,
1865
+ "has-last-active": g.value,
1866
+ "is-target-home": l.value?.path === q(Z),
1867
+ "is-target-active": f.value,
1868
+ position: c.value,
1869
+ "target-tab": l.value,
1870
+ onClose: E,
1871
+ onCloseAll: A,
1872
+ onCloseLeft: O,
1873
+ onCloseOthers: te,
1874
+ onCloseRight: ne,
1875
+ onCloseTab: y,
1876
+ onOpenInNewTab: L,
1877
+ onSwitchPrev: F,
1878
+ onRefresh: b
1879
+ }, null, 8, [
1880
+ "visible",
1881
+ "has-left-tabs",
1882
+ "has-multiple-tabs",
1883
+ "has-right-tabs",
1884
+ "has-last-active",
1885
+ "is-target-home",
1886
+ "is-target-active",
1887
+ "position",
1888
+ "target-tab"
1889
+ ])])) : M("", !0);
1890
+ };
1891
+ }
1892
+ }), Or = /* @__PURE__ */ L({
1893
+ __name: "AppLayout",
1894
+ setup(e) {
1895
+ let t = C(), n = lt(), r = f(), i = ft(), a = H(0), o = k(() => t.matched.filter((e) => e.meta?.title));
1896
+ ie(() => {
1897
+ i.initShortcuts(), window.addEventListener("keydown", l, { capture: !0 });
1898
+ }), re(() => {
1899
+ window.removeEventListener("keydown", l, { capture: !0 });
1900
+ });
1901
+ function s() {
1902
+ if (t.meta.microApp) {
1903
+ m(t.path);
1904
+ return;
1905
+ }
1906
+ a.value += 1;
1907
+ }
1908
+ J(() => t.fullPath, () => {
1909
+ let e = String(t.meta.title ?? "未命名页面"), r = t.meta.icon ? String(t.meta.icon) : void 0;
1910
+ c(), t.meta.public || n.syncTab({
1911
+ path: t.path,
1912
+ fullPath: t.fullPath,
1913
+ title: e,
1914
+ icon: r
1915
+ });
1916
+ }, { immediate: !0 });
1917
+ function c() {
1918
+ let e = t.matched.find((e) => e.path !== "/" && !e.meta?.hidden);
1919
+ if (!e) return;
1920
+ let n = e.path.startsWith("/") ? e.path : `/${e.path}`;
1921
+ r.setSelectedTopMenuPath(n);
1922
+ }
1923
+ function l(e) {
1924
+ if (!(e.defaultPrevented || e.repeat || e.isComposing)) {
1925
+ if (i.isShortcutEnabled("toggleMenu") && yt(e, i.getShortcutKeys("toggleMenu"))) {
1926
+ e.preventDefault(), r.toggleSidebar();
1927
+ return;
1928
+ }
1929
+ i.isShortcutEnabled("settings") && yt(e, i.getShortcutKeys("settings")) && (e.preventDefault(), r.setSettingsVisible(!r.settingsVisible));
1930
+ }
1931
+ }
1932
+ return (e, t) => {
1933
+ let n = W("el-container");
1934
+ return V(), N(D, null, [I(n, { class: "app-layout" }, {
1935
+ default: Y(() => [
1936
+ I(mr),
1937
+ I(n, { direction: "vertical" }, {
1938
+ default: Y(() => [
1939
+ I(nr, { "breadcrumb-items": o.value }, null, 8, ["breadcrumb-items"]),
1940
+ I(Dr, { onRefresh: s }),
1941
+ I(fn, { "refresh-key": a.value }, null, 8, ["refresh-key"])
1942
+ ]),
1943
+ _: 1
1944
+ }),
1945
+ I(O, { name: "app-mobile-mask" }, {
1946
+ default: Y(() => [q(r).mobileSidebarVisible ? (V(), N("button", {
1947
+ key: 0,
1948
+ type: "button",
1949
+ class: "app-layout__mobile-mask",
1950
+ "aria-label": "关闭侧边栏",
1951
+ onClick: t[0] ||= (e) => q(r).closeMobileSidebar()
1952
+ })) : M("", !0)]),
1953
+ _: 1
1954
+ })
1955
+ ]),
1956
+ _: 1
1957
+ }), I(dn)], 64);
1958
+ };
1959
+ }
1960
+ });
1961
+ //#endregion
1962
+ //#region src/main/router/base-routes.ts
1963
+ function kr(e = []) {
1964
+ return [{
1965
+ path: "/login",
1966
+ name: "login",
1967
+ component: () => import("./Login-7n7MU-kG.js"),
1968
+ meta: {
1969
+ title: "登录",
1970
+ public: !0
1971
+ }
1972
+ }, {
1973
+ path: "/",
1974
+ component: Or,
1975
+ redirect: "/dashboard",
1976
+ children: [
1977
+ {
1978
+ path: "403",
1979
+ name: "forbidden",
1980
+ component: () => import("./Forbidden-Cu2QQ-FY.js"),
1981
+ meta: {
1982
+ title: "暂无权限",
1983
+ public: !0,
1984
+ hidden: !0
1985
+ }
1986
+ },
1987
+ ...e,
1988
+ {
1989
+ path: "config",
1990
+ name: "config-center",
1991
+ redirect: "/config/apps",
1992
+ meta: {
1993
+ title: "配置中心",
1994
+ icon: "Setting"
1995
+ },
1996
+ children: [{
1997
+ path: "apps",
1998
+ name: "config-apps",
1999
+ component: () => import("./application-config-DePctoXE.js"),
2000
+ meta: {
2001
+ title: "应用配置",
2002
+ icon: "Connection"
2003
+ }
2004
+ }, {
2005
+ path: "system",
2006
+ name: "config-system",
2007
+ component: () => import("./SystemConfig-DGZUwXWB.js"),
2008
+ meta: {
2009
+ title: "系统配置",
2010
+ icon: "Setting"
2011
+ }
2012
+ }]
2013
+ },
2014
+ {
2015
+ path: ":pathMatch(.*)*",
2016
+ name: "not-found",
2017
+ component: () => import("./NotFound-VRL7_aMx.js"),
2018
+ meta: {
2019
+ title: "页面不存在",
2020
+ public: !0,
2021
+ hidden: !0
2022
+ }
2023
+ }
2024
+ ]
2025
+ }];
2026
+ }
2027
+ //#endregion
2028
+ //#region src/main/router/index.ts
2029
+ function Ar(e = []) {
2030
+ let t = Array.isArray(e) ? { businessRoutes: e } : e, n = x({
2031
+ history: t.history ?? S("/"),
2032
+ routes: kr(t.businessRoutes ?? []),
2033
+ scrollBehavior: t.scrollBehavior ?? (() => ({ top: 0 }))
2034
+ });
2035
+ return et(n), t.setupRouter?.(n), n;
2036
+ }
2037
+ //#endregion
2038
+ //#region src/main/pages/micro/MicroAppView.vue?vue&type=script&setup=true&lang.ts
2039
+ var jr = { class: "micro-app-page" }, Mr = {
2040
+ key: 0,
2041
+ class: "micro-app-page__state micro-app-page__state--error"
2042
+ }, 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({
2043
+ name: "MicroAppView",
2044
+ __name: "MicroAppView",
2045
+ setup(e) {
2046
+ let t = C(), n = h(), r = H(""), i = null, a = k(() => p(t.path)), o = k(() => {
2047
+ let e = a.value;
2048
+ return e ? n[e.name] : void 0;
2049
+ }), 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);
2050
+ J(() => t.path, () => {
2051
+ R(() => {
2052
+ g(), v();
2053
+ });
2054
+ }, { immediate: !0 }), ie(() => {
2055
+ R(() => {
2056
+ g(), v();
2057
+ });
2058
+ }), J(() => o.value?.status, (e) => {
2059
+ if (e === "mounted") {
2060
+ y(), r.value = "";
2061
+ return;
2062
+ }
2063
+ e === "loading" && v();
2064
+ }), re(() => {
2065
+ y();
2066
+ });
2067
+ function v() {
2068
+ y(), r.value = "", a.value && (i = window.setTimeout(() => {
2069
+ o.value?.status !== "mounted" && (r.value = "子应用暂时无法访问,请稍后重试。");
2070
+ }, 15e3));
2071
+ }
2072
+ function y() {
2073
+ i !== null && (window.clearTimeout(i), i = null);
2074
+ }
2075
+ function b() {
2076
+ m(t.path);
2077
+ }
2078
+ function x() {
2079
+ let e = l.value;
2080
+ e && e !== "-" && window.open(e, "_blank", "noopener,noreferrer");
2081
+ }
2082
+ return (e, t) => {
2083
+ let n = W("el-icon"), r = W("el-button");
2084
+ return V(), N("div", jr, [f.value ? (V(), N("div", Mr, [I(n, { class: "micro-app-page__icon" }, {
2085
+ default: Y(() => [I(q(Ve))]),
2086
+ _: 1
2087
+ }), P("div", Nr, [
2088
+ t[5] ||= P("p", { class: "micro-app-page__title" }, "子应用加载失败", -1),
2089
+ P("dl", Pr, [
2090
+ P("div", null, [t[0] ||= P("dt", null, "应用", -1), P("dd", null, K(c.value), 1)]),
2091
+ q(!1) ? (V(), N("div", Fr, [t[1] ||= P("dt", null, "入口", -1), P("dd", null, K(l.value), 1)])) : M("", !0),
2092
+ u.value ? (V(), N("div", Ir, [t[2] ||= P("dt", null, "原因", -1), P("dd", null, K(u.value), 1)])) : M("", !0)
2093
+ ]),
2094
+ P("div", Lr, [I(r, {
2095
+ type: "primary",
2096
+ icon: q(Ne),
2097
+ onClick: b
2098
+ }, {
2099
+ default: Y(() => [...t[3] ||= [F("重新加载", -1)]]),
2100
+ _: 1
2101
+ }, 8, ["icon"]), q(!1) && (o.value?.entry || a.value?.entry) ? (V(), j(r, {
2102
+ key: 0,
2103
+ icon: q(Oe),
2104
+ onClick: x
2105
+ }, {
2106
+ default: Y(() => [...t[4] ||= [F(" 打开入口 ", -1)]]),
2107
+ _: 1
2108
+ }, 8, ["icon"])) : M("", !0)])
2109
+ ])])) : M("", !0), P("section", {
2110
+ id: q(_),
2111
+ class: "micro-app-page__container"
2112
+ }, null, 8, Rr)]);
2113
+ };
2114
+ }
2115
+ }), [["__scopeId", "data-v-6badc729"]]);
2116
+ //#endregion
2117
+ //#region src/main/router/route-items.ts
2118
+ function Br(e, t) {
2119
+ return b(e, t, (e) => e.microApp ? zr : void 0);
2120
+ }
2121
+ //#endregion
2122
+ //#region src/main/app/AppUpdateDialog.vue?vue&type=script&setup=true&lang.ts
2123
+ var Vr = {
2124
+ key: 0,
2125
+ class: "app-update-dialog",
2126
+ role: "presentation"
2127
+ }, Hr = {
2128
+ class: "app-update-dialog__panel",
2129
+ role: "dialog",
2130
+ "aria-modal": "true",
2131
+ "aria-labelledby": "app-update-dialog-title"
2132
+ }, Ur = { class: "app-update-dialog__icon" }, Wr = { class: "app-update-dialog__content" }, Gr = {
2133
+ key: 0,
2134
+ class: "app-update-dialog__version"
2135
+ }, Kr = {
2136
+ key: 1,
2137
+ class: "app-update-dialog__changelog"
2138
+ }, qr = { class: "app-update-dialog__actions" }, Jr = /* @__PURE__ */ y(/* @__PURE__ */ L({
2139
+ __name: "AppUpdateDialog",
2140
+ props: {
2141
+ changelog: {},
2142
+ modelValue: { type: Boolean },
2143
+ versionLabel: {}
2144
+ },
2145
+ emits: ["refresh", "remindLater"],
2146
+ setup(e, { emit: t }) {
2147
+ let n = t;
2148
+ function r(e) {
2149
+ if (e === "today") {
2150
+ n("remindLater", i());
2151
+ return;
2152
+ }
2153
+ let t = Number(e);
2154
+ Number.isFinite(t) && t > 0 && n("remindLater", t * 60 * 60 * 1e3);
2155
+ }
2156
+ function i() {
2157
+ let e = /* @__PURE__ */ new Date(), t = new Date(e);
2158
+ return t.setHours(23, 59, 59, 999), Math.max(t.getTime() - e.getTime(), 60 * 1e3);
2159
+ }
2160
+ return (t, i) => {
2161
+ let a = W("el-icon"), o = W("el-button"), s = W("el-dropdown-item"), c = W("el-dropdown-menu"), l = W("el-dropdown");
2162
+ return V(), j(te, { to: "body" }, [I(O, { name: "app-update-dialog-fade" }, {
2163
+ default: Y(() => [e.modelValue ? (V(), N("section", Vr, [P("div", Hr, [
2164
+ P("div", Ur, [I(a, null, {
2165
+ default: Y(() => [I(q(Me))]),
2166
+ _: 1
2167
+ })]),
2168
+ P("div", Wr, [
2169
+ i[2] ||= P("h2", { id: "app-update-dialog-title" }, "发现新版本", -1),
2170
+ i[3] ||= P("p", null, "系统已发布更新,刷新后即可使用最新功能和修复。", -1),
2171
+ e.versionLabel ? (V(), N("span", Gr, K(e.versionLabel), 1)) : M("", !0),
2172
+ 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)
2173
+ ]),
2174
+ P("div", qr, [I(o, {
2175
+ type: "primary",
2176
+ onClick: i[0] ||= (e) => n("refresh")
2177
+ }, {
2178
+ default: Y(() => [...i[4] ||= [F("立即更新", -1)]]),
2179
+ _: 1
2180
+ }), I(l, {
2181
+ trigger: "click",
2182
+ teleported: !1,
2183
+ onCommand: r
2184
+ }, {
2185
+ dropdown: Y(() => [I(c, null, {
2186
+ default: Y(() => [
2187
+ I(s, { command: 1 }, {
2188
+ default: Y(() => [...i[6] ||= [F("1 小时后提醒", -1)]]),
2189
+ _: 1
2190
+ }),
2191
+ I(s, { command: 2 }, {
2192
+ default: Y(() => [...i[7] ||= [F("2 小时后提醒", -1)]]),
2193
+ _: 1
2194
+ }),
2195
+ I(s, { command: 4 }, {
2196
+ default: Y(() => [...i[8] ||= [F("4 小时后提醒", -1)]]),
2197
+ _: 1
2198
+ }),
2199
+ I(s, {
2200
+ divided: "",
2201
+ command: "today"
2202
+ }, {
2203
+ default: Y(() => [...i[9] ||= [F("今日不再提醒", -1)]]),
2204
+ _: 1
2205
+ })
2206
+ ]),
2207
+ _: 1
2208
+ })]),
2209
+ default: Y(() => [I(o, null, {
2210
+ default: Y(() => [i[5] ||= F(" 稍后提醒 ", -1), I(a, { class: "el-icon--right" }, {
2211
+ default: Y(() => [I(q(pe))]),
2212
+ _: 1
2213
+ })]),
2214
+ _: 1
2215
+ })]),
2216
+ _: 1
2217
+ })])
2218
+ ])])) : M("", !0)]),
2219
+ _: 1
2220
+ })]);
2221
+ };
2222
+ }
2223
+ }), [["__scopeId", "data-v-118283a1"]]), Yr = "app-update:check-enabled";
2224
+ function Xr(e = !0) {
2225
+ let t = localStorage.getItem(Yr);
2226
+ return t === "true" ? !0 : t === "false" ? !1 : e;
2227
+ }
2228
+ function Zr(e) {
2229
+ localStorage.setItem(Yr, String(e));
2230
+ }
2231
+ //#endregion
2232
+ //#region src/main/app/update-checker.ts
2233
+ var Qr = "/app-manifest.json", $r = 300 * 1e3, ei = "app-update:snooze", ti, ni, ri, ii = "", ai = !1, $ = {}, oi, si;
2234
+ function ci(e = {}) {
2235
+ $ = {
2236
+ ...$,
2237
+ ...e
2238
+ }, !(ai || $.enabled === !1 || typeof window > "u" || !Xr(!0)) && (ai = !0, !xi() && li());
2239
+ }
2240
+ function li() {
2241
+ hi(), fi(), ti = window.setInterval(() => {
2242
+ fi();
2243
+ }, vi());
2244
+ }
2245
+ function ui() {
2246
+ hi(), gi(), mi(), ai = !1, ii = "";
2247
+ }
2248
+ function di(e = {}) {
2249
+ ui(), ci({
2250
+ ...$,
2251
+ ...e
2252
+ });
2253
+ }
2254
+ async function fi() {
2255
+ if (!Xr(!0)) {
2256
+ ui();
2257
+ return;
2258
+ }
2259
+ if (xi()) return;
2260
+ let e = await _i($.manifestUrl || Qr);
2261
+ if (!e?.label) return;
2262
+ if (!ri) {
2263
+ ri = e;
2264
+ return;
2265
+ }
2266
+ let t = Ei(ri, e);
2267
+ !t || t.label === ii || yi(t.label) || (ii = t.label, pi(t));
2268
+ }
2269
+ function pi(e) {
2270
+ mi(), si = document.createElement("div"), document.body.appendChild(si), oi = A(Jr, {
2271
+ changelog: e.changelog,
2272
+ modelValue: !0,
2273
+ versionLabel: Oi(e.displayVersion),
2274
+ onRefresh: () => {
2275
+ window.location.reload();
2276
+ },
2277
+ onRemindLater: (t) => {
2278
+ bi(e.label, t), ii = "", mi(), hi(), xi();
2279
+ }
2280
+ }), oi.use(T, { locale: Ue }), oi.mount(si);
2281
+ }
2282
+ function mi() {
2283
+ oi?.unmount(), si?.remove(), oi = void 0, si = void 0;
2284
+ }
2285
+ function hi() {
2286
+ ti !== void 0 && (window.clearInterval(ti), ti = void 0);
2287
+ }
2288
+ function gi() {
2289
+ ni !== void 0 && (window.clearTimeout(ni), ni = void 0);
2290
+ }
2291
+ async function _i(e) {
2292
+ try {
2293
+ let t = new URL(e, window.location.origin);
2294
+ t.searchParams.set("_t", String(Date.now()));
2295
+ let n = await fetch(t, {
2296
+ cache: "no-store",
2297
+ headers: {
2298
+ "Cache-Control": "no-cache",
2299
+ Pragma: "no-cache"
2300
+ }
2301
+ });
2302
+ if (!n.ok) return null;
2303
+ let r = n.headers.get("content-type");
2304
+ return r && !r.includes("application/json") ? null : wi(await n.json());
2305
+ } catch {
2306
+ return null;
2307
+ }
2308
+ }
2309
+ function vi() {
2310
+ return Math.max($.interval ?? $r, 30 * 1e3);
2311
+ }
2312
+ function yi(e) {
2313
+ let t = Si();
2314
+ return !!(t && t.version === e);
2315
+ }
2316
+ function bi(e, t) {
2317
+ let n = Date.now() + Math.max(t, 60 * 1e3);
2318
+ localStorage.setItem(ei, JSON.stringify({
2319
+ version: e,
2320
+ until: n
2321
+ }));
2322
+ }
2323
+ function xi() {
2324
+ let e = Si();
2325
+ return e?.until ? (hi(), gi(), ni = window.setTimeout(() => {
2326
+ ni = void 0, ai && Xr(!0) && li();
2327
+ }, Math.max(e.until - Date.now(), 1e3)), !0) : (gi(), !1);
2328
+ }
2329
+ function Si() {
2330
+ let e = Ci();
2331
+ return !e?.until || e.until <= Date.now() ? null : e;
2332
+ }
2333
+ function Ci() {
2334
+ try {
2335
+ let e = localStorage.getItem(ei);
2336
+ return e ? JSON.parse(e) : null;
2337
+ } catch {
2338
+ return localStorage.removeItem(ei), null;
2339
+ }
2340
+ }
2341
+ function wi(e) {
2342
+ let t = {}, n = {}, r = [], i = Ti(e.main);
2343
+ i && (t.main = e.main ?? {}, n.main = i), e.main?.changelog && r.push(...Di(e.main.changelog));
2344
+ for (let [i, a] of Object.entries(e.apps ?? {})) {
2345
+ let e = Ti(a);
2346
+ e && (t[i] = a, n[i] = e), a.changelog && r.push(...Di(a.changelog));
2347
+ }
2348
+ return {
2349
+ changelog: r,
2350
+ displayVersion: i,
2351
+ entries: t,
2352
+ label: Object.keys(n).sort().map((e) => `${e}:${n[e]}`).join("|"),
2353
+ versions: n
2354
+ };
2355
+ }
2356
+ function Ti(e) {
2357
+ return [e?.version, e?.buildTime].filter(Boolean).join("@");
2358
+ }
2359
+ function Ei(e, t) {
2360
+ 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]);
2361
+ if (!n.length && !r.length) return null;
2362
+ let i = {};
2363
+ for (let [e] of n) {
2364
+ let n = t.versions[e];
2365
+ n && (i[e] = n);
2366
+ }
2367
+ return {
2368
+ changelog: n.flatMap(([, e]) => Di(e.changelog)),
2369
+ displayVersion: i.main || Object.values(i)[0] || "",
2370
+ entries: Object.fromEntries(n),
2371
+ label: [...n.map(([e]) => `${e}:${t.versions[e]}`), ...r.map((e) => `${e}:removed`)].join("|"),
2372
+ versions: i
2373
+ };
2374
+ }
2375
+ function Di(e) {
2376
+ return Array.isArray(e) ? e.map((e) => String(e).trim()).filter(Boolean) : [];
2377
+ }
2378
+ function Oi(e) {
2379
+ let [t, n] = e.split("@");
2380
+ return t && n ? `版本 ${t} · ${n}` : t || n || "";
2381
+ }
2382
+ //#endregion
2383
+ //#region src/main/directives/index.ts
2384
+ var ki = {
2385
+ mounted(e, t) {
2386
+ Ai(e, t.value);
2387
+ },
2388
+ updated(e, t) {
2389
+ Ai(e, t.value);
2390
+ }
2391
+ };
2392
+ function Ai(e, t) {
2393
+ 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));
2394
+ if (!r.length || s) {
2395
+ e.style.display = "", e.hidden = !1, o && (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
2396
+ return;
2397
+ }
2398
+ if (o) {
2399
+ e.setAttribute("disabled", "disabled"), e.classList.add("is-disabled");
2400
+ return;
2401
+ }
2402
+ e.style.display = "none", e.hidden = !0;
2403
+ }
2404
+ function ji(e) {
2405
+ return typeof e == "string" ? e ? [e] : [] : Array.isArray(e) ? e : e.permissions ?? [];
2406
+ }
2407
+ function Mi(e) {
2408
+ e.directive("permission", ki);
2409
+ }
2410
+ //#endregion
2411
+ //#region src/main/app/create-app.ts
2412
+ async function Ni(e) {
2413
+ Ke(e.appConfig), Ze();
2414
+ let t = Ar({
2415
+ businessRoutes: e.businessRoutes,
2416
+ history: e.routerHistory,
2417
+ scrollBehavior: e.routerScrollBehavior,
2418
+ setupRouter: e.setupRouter
2419
+ }), n = A(e.rootComponent), r = ce(), i = {
2420
+ app: n,
2421
+ router: t,
2422
+ pinia: r,
2423
+ http: Je,
2424
+ requestManager: Xe
2425
+ };
2426
+ fe(), n.use(T, { locale: Ue }), n.use(r), n.use(t), Mi(n), We(t), await e.setupApp?.(i), await e.beforePlatformInit?.(i);
2427
+ let a = f(r), o = l(r), s = lt(r);
2428
+ a.initializePreferences(), ci(e.appConfig.updateChecker);
2429
+ let c = de({ fullscreen: !0 });
2430
+ try {
2431
+ await Promise.all([o.initializeSystemConfig(), s.initializeTabs()]);
2432
+ } finally {
2433
+ c.close();
2434
+ }
2435
+ await e.afterPlatformInit?.(i), await e.beforeMount?.(i);
2436
+ let u = n.mount("#app"), d = {
2437
+ ...i,
2438
+ vm: u
2439
+ };
2440
+ return await e.afterMount?.(d), n;
2441
+ }
2442
+ //#endregion
2443
+ 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 };