const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./chunks/DashboardList.pro-DDdD_z4k.js","./chunks/TheAppHeader-DSsf6DXw.js","./chunks/_plugin-vue_export-helper-wUMoiQZ1.js","../css/main-monsterinsights-BlALUF99.css","./chunks/monsterinsights-style-D8E96NnX.js","./chunks/Icon-BCn03Hqj.js","../css/main-monsterinsights-DdCOUrGJ.css","./chunks/customViews-BPRPVvuh.js","./chunks/globals-0kLib7YG.js","../css/main-monsterinsights-2PRgBvvs.css","./chunks/DashboardCreate-CJRS4-t-.js","./chunks/useAuthGate-BPvb5liY.js","./chunks/html2pdf-Cv0rvcAH.js","../css/main-monsterinsights-DWkQp-s6.css","./chunks/ReAuthModal-dj5k8zSu.js","../css/main-monsterinsights-Du5DxmSn.css","../css/main-monsterinsights-CATPSyIj.css","../css/main-monsterinsights-CWJgQk98.css","./chunks/DashboardEdit-BO-4u2Py.js","./chunks/DashboardView-DQkBV83L.js","../css/main-monsterinsights-eUZh7hRe.css"])))=>i.map(i=>d[i]);
import { _ as _sfc_main$1, a as __vitePreload, c as createRouter, b as createWebHashHistory, s as setupPinia } from "./chunks/TheAppHeader-DSsf6DXw.js";
import { c as createElementBlock, a as createBaseVNode, b as createVNode, r as resolveComponent, o as openBlock, d as createApp, g as getMiGlobal } from "./chunks/_plugin-vue_export-helper-wUMoiQZ1.js";
const _hoisted_1 = { class: "mi-custom-dashboard-app" };
const _hoisted_2 = { id: "monsterinsights-app" };
const _hoisted_3 = { class: "monsterinsights-dashboard-content" };
const _hoisted_4 = { class: "monsterinsights-container" };
const _sfc_main = {
  __name: "App",
  setup(__props) {
    return (_ctx, _cache) => {
      const _component_RouterView = resolveComponent("RouterView");
      return openBlock(), createElementBlock("div", _hoisted_1, [
        createBaseVNode("div", _hoisted_2, [
          createBaseVNode("div", _hoisted_3, [
            createVNode(_sfc_main$1),
            createBaseVNode("div", _hoisted_4, [
              createVNode(_component_RouterView)
            ])
          ])
        ])
      ]);
    };
  }
};
const DashboardList = () => __vitePreload(() => import("./chunks/DashboardList.pro-DDdD_z4k.js"), true ? __vite__mapDeps([0,1,2,3,4,5,6,7,8,9]) : void 0, import.meta.url);
const DashboardCreate = () => __vitePreload(() => import("./chunks/DashboardCreate-CJRS4-t-.js"), true ? __vite__mapDeps([10,1,2,3,11,5,6,12,13,7,8,4,14,15,16,17]) : void 0, import.meta.url);
const DashboardEdit = () => __vitePreload(() => import("./chunks/DashboardEdit-BO-4u2Py.js"), true ? __vite__mapDeps([18,10,1,2,3,11,5,6,12,13,7,8,4,14,15,16,17]) : void 0, import.meta.url);
const DashboardView = () => __vitePreload(() => import("./chunks/DashboardView-DQkBV83L.js"), true ? __vite__mapDeps([19,1,2,3,11,5,6,12,13,7,8,4,14,15,16]) : void 0, import.meta.url);
const routes = [
  {
    path: "/",
    redirect: "/dashboards"
  },
  {
    path: "/dashboards",
    name: "dashboard-list",
    component: DashboardList,
    meta: {
      title: "Custom Views",
      requiresAuth: true
    }
  },
  {
    path: "/dashboards/add",
    name: "dashboard-add",
    component: DashboardList,
    meta: {
      title: "Add Custom View",
      requiresAuth: true,
      requiresEdit: true,
      showTemplateSelector: true
    }
  },
  {
    path: "/dashboards/new",
    name: "dashboard-create",
    component: DashboardCreate,
    meta: {
      title: "Create View",
      requiresAuth: true,
      requiresEdit: true
    }
  },
  {
    path: "/dashboards/:id/edit",
    name: "dashboard-edit",
    component: DashboardEdit,
    props: true,
    meta: {
      title: "Edit View",
      requiresAuth: true,
      requiresEdit: true
    }
  },
  {
    path: "/dashboards/:id/view",
    name: "dashboard-view",
    component: DashboardView,
    props: true,
    meta: {
      title: "View",
      requiresAuth: true
    }
  },
  {
    path: "/:pathMatch(.*)*",
    redirect: "/dashboards"
  }
];
function hasCustomViewsAccess() {
  {
    const license = getMiGlobal("license", {});
    const licenseType = (license.type || "").toLowerCase();
    return licenseType === "pro" || licenseType === "elite";
  }
}
const stylePromise = __vitePreload(() => Promise.resolve({}), true ? __vite__mapDeps([20]) : void 0, import.meta.url);
const router = createRouter({
  history: createWebHashHistory(),
  routes
});
router.beforeEach((to, _from, next) => {
  if (!hasCustomViewsAccess() && (to.name === "dashboard-list" || to.path === "/dashboards")) {
    next({ name: "dashboard-view", params: { id: "sample" } });
    return;
  }
  next();
});
const app = createApp(_sfc_main);
app.use(router);
setupPinia(app);
app.config.errorHandler = (err, _vm, info) => {
  console.error("Custom View Error:", err, info);
};
stylePromise.then(() => {
  app.mount("#monsterinsights-custom-dashboard-app");
});
