import { ref as h, reactive as C, watch as _, computed as P, onMounted as x, resolveComponent as w, openBlock as y, createElementBlock as L, createElementVNode as v, createVNode as T, normalizeStyle as U, createBlock as k } from "vue"; import { useRouter as A } from "vue-router"; import { n as B, ad as $, cL as D } from "./index2.js"; const V = { class: "s-menu-slide-common" }, I = { class: "menu-wrap" }, N = { __name: "SSideMenu", emits: ["collapsed"], setup(j, { emit: g }) { const p = A(), M = g, m = h([]), i = h(""), e = C({ collapsed: !1, selectedKeys: [], openKeys: [], preOpenKeys: [] }); _( () => e.openKeys, (t, s) => { e.preOpenKeys = s; } ); const O = (t, s) => s ? s.startsWith("/") ? s : t ? `${t.replace(/\/+$/, "")}/${s}` : `/${s}` : t || "", K = (t, s, d = 0, a = "") => t.map((n) => { var c; const o = window.$l(((c = n.meta) == null ? void 0 : c.title) || n.name || ""), u = d === 0 && !n.children, r = O(a, n.path), l = { key: r, // icon: item.icon ? () => h(item.icon) : null, icon: null, label: s && u ? o.slice(0, 1) : o, title: o, path: r }; return n.children && (l.children = K(n.children, s, d + 1, r)), l; }), b = P(() => K(m.value, e.collapsed)), S = () => { e.collapsed = !e.collapsed, e.openKeys = e.collapsed ? [] : e.preOpenKeys, M("collapsed", e.collapsed); }, E = (t) => { p.push(t.key), e.selectedKeys = [t.key], window.$utils.ls.set("selectedKeys", e.selectedKeys); }, R = (t) => { e.openKeys = t, $().setMenuOpenKeys(e.openKeys); }; return x(() => { var u, r; i.value = window.$utils.env.VITE_APP_MENU_THEME || "dark"; const t = $(), s = ((u = t.dynamics[0]) == null ? void 0 : u.children) || [], d = (window.$staticRoutes || []).filter( (l) => { var c, f; return l && l.path && ((c = l.meta) == null ? void 0 : c.title) && !((f = l.meta) != null && f.hidden); } ); m.value = [...s, ...d].filter((l) => { var c; return !((c = l.meta) != null && c.hidden); }); const a = (window.$utils.env.VITE_APP_BASE_URL || "/").replace(/\/+$/, ""); let n = ((r = p.currentRoute.value) == null ? void 0 : r.path) || ""; n || (n = location.pathname, a && n.indexOf(a) === 0 && (n = n.slice(a.length) || "/")), window.$utils.ls.set("selectedKeys", [n]), e.selectedKeys = window.$utils.ls.get("selectedKeys") || []; const o = t.openKeys || []; e.openKeys = o; }), _( () => { var t; return (t = p.currentRoute.value) == null ? void 0 : t.path; }, (t) => { t && (e.selectedKeys = [t], window.$utils.ls.set("selectedKeys", e.selectedKeys)); } ), (t, s) => { const d = D, a = w("DoubleRightOutlined"), n = w("DoubleLeftOutlined"); return y(), L("div", V, [ v("div", I, [ T(d, { openKeys: e.openKeys, "onUpdate:openKeys": s[0] || (s[0] = (o) => e.openKeys = o), selectedKeys: e.selectedKeys, "onUpdate:selectedKeys": s[1] || (s[1] = (o) => e.selectedKeys = o), mode: "inline", items: b.value, theme: i.value, onSelect: E, onOpenChange: R }, null, 8, ["openKeys", "selectedKeys", "items", "theme"]) ]), v("div", { class: "right-border-btn", style: U({ backgroundColor: i.value === "dark" ? "#001529" : "#fff", color: i.value === "dark" ? "#fff" : "#000000A6", border: `1px solid ${i.value === "dark" ? "#001529" : "#ececec"}` }), onClick: S }, [ e.collapsed ? (y(), k(a, { key: 0 })) : (y(), k(n, { key: 1 })) ], 4) ]); }; } }, q = /* @__PURE__ */ B(N, [["__scopeId", "data-v-eb6de445"]]); export { q as default };