import { ref as u, reactive as v, watch as k, onMounted as b, resolveComponent as i, openBlock as d, createElementBlock as M, createElementVNode as m, createVNode as S, normalizeStyle as O, createBlock as y } from "vue";
import { c as g } from "./routeConvert.js";
import { r as w, aM as E, aN as x } from "./index2.js";
const C = { class: "s-menu-common" }, D = { class: "menu-wrap" }, N = {
  __name: "SSideMenu",
  emits: ["collapsed"],
  setup(U, { emit: _ }) {
    const f = _, r = u([]), l = u(""), e = v({
      collapsed: !1,
      selectedKeys: ["1"],
      openKeys: ["sub1"],
      preOpenKeys: ["sub1"]
    });
    k(
      () => e.openKeys,
      (t, s) => {
        e.preOpenKeys = s;
      }
    );
    const p = (t) => t.map((o) => {
      const n = {
        key: o.path,
        // icon: item.icon ? () => h(item.icon) : null,
        icon: null,
        label: o.name || o.meta.title,
        title: o.name || o,
        path: o.path
      };
      return o.children && (n.children = p(o.children)), n;
    }), h = () => {
      e.collapsed = !e.collapsed, e.openKeys = e.collapsed ? [] : e.preOpenKeys, f("collapsed", e.collapsed);
    }, K = (t) => {
      window.$push(t.key);
    };
    return b(() => {
      l.value = window.$utils.env.VITE_APP_MENU_THEME || "dark";
      const s = E().dynamics, o = g(s.find((c) => c.path === "/")), n = o && o.children || [];
      r.value = p(n.filter((c) => !c.meta.hidden));
    }), (t, s) => {
      const o = x, n = i("DoubleRightOutlined"), c = i("DoubleLeftOutlined");
      return d(), M("div", C, [
        m("div", D, [
          S(o, {
            openKeys: e.openKeys,
            "onUpdate:openKeys": s[0] || (s[0] = (a) => e.openKeys = a),
            selectedKeys: e.selectedKeys,
            "onUpdate:selectedKeys": s[1] || (s[1] = (a) => e.selectedKeys = a),
            mode: "inline",
            theme: l.value,
            items: r.value,
            onSelect: K
          }, null, 8, ["openKeys", "selectedKeys", "theme", "items"])
        ]),
        m("div", {
          class: "right-border-btn",
          style: O({
            backgroundColor: l.value === "dark" ? "#001529" : "#fff",
            color: l.value === "dark" ? "#fff" : "#000000A6",
            border: `1px solid ${l.value === "dark" ? "#001529" : "#ececec"}`
          }),
          onClick: h
        }, [
          e.collapsed ? (d(), y(n, { key: 0 })) : (d(), y(c, { key: 1 }))
        ], 4)
      ]);
    };
  }
}, T = /* @__PURE__ */ w(N, [["__scopeId", "data-v-c7d52ebe"]]);
export {
  T as default
};
