PageSourceSearch

https://zfgst1.zoomgov.com/fe-static/fe-frame-popups/chunks/app-personal-menu.pfbz1fVG.js

js zoomgov.com collected 2026-09-24 08:38:10 UTC 11,450 bytes, 291 lines download raw bytes

1var __defProp = Object.defineProperty;
2var __defProps = Object.defineProperties;
3var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5var __hasOwnProp = Object.prototype.hasOwnProperty;
6var __propIsEnum = Object.prototype.propertyIsEnumerable;
7var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8var __spreadValues = (a, b) => {
9  for (var prop in b || (b = {}))
10    if (__hasOwnProp.call(b, prop))
11      __defNormalProp(a, prop, b[prop]);
12  if (__getOwnPropSymbols)
13    for (var prop of __getOwnPropSymbols(b)) {
14      if (__propIsEnum.call(b, prop))
15        __defNormalProp(a, prop, b[prop]);
16    }
17  return a;
18};
19var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20var __async = (__this, __arguments, generator) => {
21  return new Promise((resolve, reject) => {
22    var fulfilled = (value) => {
23      try {
24        step(generator.next(value));
25      } catch (e) {
26        reject(e);
27      }
28    };
29    var rejected = (value) => {
30      try {
31        step(generator.throw(value));
32      } catch (e) {
33        reject(e);
34      }
35    };
36    var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37    step((generator = generator.apply(__this, __arguments)).next());
38  });
39};
40import { a as axios, g as ref, i as onMounted, aq as onUnmounted, J as computed, e as createBlock, j as withCtx, f as unref, o as openBlock, x as createVNode, A as createSlots, v as createBaseVNode, p as resolveDynamicComponent, q as toDisplayString, c as createApp, d as createI18n } from "./chunk-vendor.B1BY-hcD.js";
41import { e as ZmIcon, a as ZmContext } from "./zoom-ui-vue3.9uHRANFW.js";
42import { u as useMobileResponsive, i as iconMaps, _ as _sfc_main$1 } from "./app-admin-menu.BNjac_D_.js";
43import { h as findActiveMenu, j as getMenuItemByProps, N as NAME_SPACE, l as locale } from "./app-shared.DMIWbACC.js";
44import { u as useCoachMark } from "./app-coach-mark.FpARfaNs.js";
45import "./common-helpers.DkPT0x6i.js";
46import "./zoom-icons-vue.C38wAiOG.js";
47function useFetchMenu() {
48  const getMenus = () => __async(this, null, function* () {
49    var _a;
50    const response = yield axios.get("/admin/menu?sidemenuType=personal");
51    return (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.result;
52  });
53  return {
54    getMenus
55  };
56}
57const _hoisted_1 = ["href"];
58const _hoisted_2 = {
59  class: "fe-popups-icon side-menu-v3__item-icon",
60  "aria-hidden": "true"
61};
62const _hoisted_3 = { class: "side-menu__item-label" };
63const ADMIN_CENTER_MENU_ID = "profile-menu-item-admin-center";
64const NAV_MENU_CLASS = "nav-menu";
65const _sfc_main = /* @__PURE__ */ Object.assign({ name: "personal-side-menu" }, {
66  __name: "personal-menu",
67  props: {
68    list: {
69      type: Array,
70      required: true
71    },
72    isPersonalCenter: Boolean
73  },
74  emits: ["loaded"],
75  setup(__props, { expose: __expose, emit: __emit }) {
76    var _a;
77    const props = __props;
78    const emit = __emit;
79    const { getMenus } = useFetchMenu();
80    const { isMobile } = useMobileResponsive();
81    const { shouldShowCoachMark } = useCoachMark();
82    const baseSideMenuRef = ref(null);
83    const sideMenusData = ref([]);
84    const activeKey = ref((_a = window.microsDatas) == null ? void 0 : _a.sideMenuActiveKey);
85    const adminCenterMenuItem = ref(null);
86    const isLoading = ref(false);
87    const findMenuByIdOrKey = (idOrKey) => {
88      var _a2;
89      return (_a2 = getMenuItemByProps(sideMenusData.value, idOrKey, "id")) != null ? _a2 : getMenuItemByProps(sideMenusData.value, idOrKey, "key");
90    };
91    const setActiveMenu = (idOrKey) => {
92      var _a2;
93      if (!idOrKey) return;
94      const targetMenu = findMenuByIdOrKey(idOrKey);
95      if (!((_a2 = targetMenu == null ? void 0 : targetMenu.item) == null ? void 0 : _a2.key)) return;
96      const { item } = targetMenu;
97      activeKey.value = item.key;
98    };
99    const flattenMenuList = (list) => {
100      var _a2;
101      if (list.length === 1 && ((_a2 = list[0].items) == null ? void 0 : _a2.length) > 1) {
102        return list[0].items;
103      }
104      return list;
105    };
106    const enhanceMenuItem = (item) => {
107      const enhanced = __spreadProps(__spreadValues({}, item), {
108        icon: iconMaps[item.id],
109        key: item.key || item.id,
110        command: () => {
111          if (item.url && item.target && item.target !== "_blank") {
112            setActiveMenu(item.key || item.id);
113          }
114        }
115      });
116      if (item.items && Array.isArray(item.items)) {
117        enhanced.items = item.items.map(enhanceMenuItem);
118      }
119      return enhanced;
120    };
121    const buildMenu = (menus) => {
122      if (!(menus == null ? void 0 : menus.length)) return;
123      const flatList = flattenMenuList(menus);
124      sideMenusData.value = flatList.map(enhanceMenuItem);
125    };
126    const initializeMenus = () => __async(this, null, function* () {
127      if (!props.isPersonalCenter) return;
128      try {
129        isLoading.value = true;
130        const response = yield getMenus();
131        const menuList = response == null ? void 0 : response.menu;
132        if (!(menuList == null ? void 0 : menuList.length)) return;
133        const adminCenter = menuList.find((m) => m.id === ADMIN_CENTER_MENU_ID);
134        if (adminCenter) {
135          adminCenterMenuItem.value = adminCenter;
136        }
137        buildMenu(menuList.filter((m) => m.id !== ADMIN_CENTER_MENU_ID));
138      } catch (error) {
139        console.error("[PersonalMenu] Failed to load menus:", error);
140      } finally {
141        isLoading.value = false;
142      }
143    });
144    const syncActiveMenuByHash = () => {
145      var _a2, _b, _c;
146      const sideMenuActiveKey = (_a2 = window.microsDatas) == null ? void 0 : _a2.sideMenuActiveKey;
147      const activeMenu = findActiveMenu(sideMenusData.value, sideMenuActiveKey);
148      if ((_c = (_b = activeMenu == null ? void 0 : activeMenu.target) == null ? void 0 : _b.item) == null ? void 0 : _c.key) {
149        setActiveMenu(activeMenu.target.item.key);
150      } else if (sideMenuActiveKey) {
151        console.warn("Cannot find active menu", sideMenuActiveKey);
152      }
153    };
154    const handleItemClick = () => {
155      var _a2, _b;
156      (_b = (_a2 = window.mobileToggleApp) == null ? void 0 : _a2.rootInstance) == null ? void 0 : _b.toggleSideMenu();
157    };
158    const menuRef = baseSideMenuRef;
159    const setActiveByKeyOrId = (keyOrId, options) => __async(this, null, function* () {
160      var _a2, _b;
161      setActiveMenu == null ? void 0 : setActiveMenu(keyOrId);
162      return yield (_b = (_a2 = baseSideMenuRef.value) == null ? void 0 : _a2.setActive) == null ? void 0 : _b.call(_a2, keyOrId, options);
163    });
164    const reset = () => __async(this, null, function* () {
165      var _a2, _b;
166      if (activeKey.value) {
167        setActiveMenu == null ? void 0 : setActiveMenu(activeKey.value);
168      }
169      return yield (_b = (_a2 = baseSideMenuRef.value) == null ? void 0 : _a2.reset) == null ? void 0 : _b.call(_a2);
170    });
171    const handleHashChange = () => {
172      syncActiveMenuByHash();
173    };
174    buildMenu(props.list);
175    onMounted(() => {
176      var _a2, _b;
177      initializeMenus().finally(() => {
178        syncActiveMenuByHash();
179        emit("loaded");
180      });
181      const parent = (_a2 = document.getElementById("sidemenu")) == null ? void 0 : _a2.parentElement;
182      if ((_b = parent == null ? void 0 : parent.classList) == null ? void 0 : _b.contains(NAV_MENU_CLASS)) {
183        parent.removeAttribute("role");
184        parent.removeAttribute("aria-label");
185      }
186      window.addEventListener("hashchange", handleHashChange);
187    });
188    onUnmounted(() => {
189      window.removeEventListener("hashchange", handleHashChange);
190    });
191    __expose({
192      personalSideMenuRef: menuRef,
193      menusData: sideMenusData,
194      setActiveMenu,
195      isShow: computed(() => {
196        var _a2;
197        return (_a2 = baseSideMenuRef.value) == null ? void 0 : _a2.isShow;
198      }),
199      show: () => {
200        var _a2;
201        return (_a2 = baseSideMenuRef.value) == null ? void 0 : _a2.show();
202      },
203      hide: () => {
204        var _a2;
205        return (_a2 = baseSideMenuRef.value) == null ? void 0 : _a2.hide();
206      },
207      setActive: (keyOrId) => {
208        if (keyOrId) {
209          setActiveByKeyOrId(keyOrId);
210        } else {
211          syncActiveMenuByHash();
212        }
213      },
214      toggleExpand: (keyOrId, expanded, options) => __async(this, null, function* () {
215        var _a2, _b, _c, _d, _e, _f;
216        if (!keyOrId) {
217          return yield (_c = (_b = (_a2 = baseSideMenuRef.value) == null ? void 0 : _a2.menuRef) == null ? void 0 : _b.toggleExpand) == null ? void 0 : _c.call(_b, keyOrId, expanded, options);
218        }
219        return yield (_f = (_e = (_d = baseSideMenuRef.value) == null ? void 0 : _d.menuRef) == null ? void 0 : _e.toggleExpand) == null ? void 0 : _f.call(_e, keyOrId, expanded, options);
220      }),
221      reset
222    });
223    return (_ctx, _cache) => {
224      return openBlock(), createBlock(unref(ZmContext), {
225        "system-fonts": false,
226        namespace: unref(NAME_SPACE)
227      }, {
228        default: withCtx(() => [
229          createVNode(_sfc_main$1, {
230            id: "personal-side-menu",
231            ref_key: "baseSideMenuRef",
232            ref: baseSideMenuRef,
233            menus: sideMenusData.value,
234            "active-key": activeKey.value,
235            "is-mobile": unref(isMobile),
236            "is-loading": isLoading.value,
237            "show-initial-mask": unref(shouldShowCoachMark),
238            "aria-label": "Personal menu",
239            onItemClick: handleItemClick
240          }, createSlots({ _: 2 }, [
241            adminCenterMenuItem.value ? {
242              name: "footer",
243              fn: withCtx(() => [
244                createBaseVNode("a", {
245                  id: "admin-center-button",
246                  class: "side-menu-v3__item-content",
247                  target: "_self",
248                  href: adminCenterMenuItem.value.url
249                }, [
250                  createBaseVNode("i", _hoisted_2, [
251                    createVNode(unref(ZmIcon), null, {
252                      default: withCtx(() => [
253                        (openBlock(), createBlock(resolveDynamicComponent(unref(iconMaps)[ADMIN_CENTER_MENU_ID])))
254                      ]),
255                      _: 1
256                    })
257                  ]),
258                  createBaseVNode("span", _hoisted_3, toDisplayString(adminCenterMenuItem.value.label), 1)
259                ], 8, _hoisted_1)
260              ]),
261              key: "0"
262            } : void 0
263          ]), 1032, ["menus", "active-key", "is-mobile", "is-loading", "show-initial-mask"])
264        ]),
265        _: 1
266      }, 8, ["namespace"]);
267    };
268  }
269});
270const i18n = createI18n({
271  locale,
272  fallbackLocale: "en-US",
273  legacy: false
274});
275function simpleSideMenu() {
276  var _a, _b;
277  const sideMenuEl = document.getElementById("sidemenu") || document.querySelector('.nav-menu[role="navigation"]');
278  if (!sideMenuEl) {
279    console.error("Side menu element not found");
280    return;
281  }
282  const app = createApp(_sfc_main, {
283    list: ((_a = window.microsDatas) == null ? void 0 : _a.simpleSideMenus) || [],
284    isPersonalCenter: ((_b = window.microsDatas) == null ? void 0 : _b.isPersonalCenter) || false
285  });
286  app.use(i18n);
287  window.sideMenu = app.mount(sideMenuEl);
288}
289export {
290  simpleSideMenu as default
291};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.