import "../../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.mjs";
import { renderIcon } from "../../../../utils/utils.mjs";
import "../../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.mjs";
import "../../../../enums/pageEnum.mjs";
import "../../../../router/index.mjs";
import "../../../../store/modules/designStore/designStore.mjs";
import "../../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.mjs";
import "../../../../components/GoSkeleton/index.vue.mjs";
import "../../../../components/GoLoading/index.mjs";
import { icon } from "../../../../plugins/icon.mjs";
import "../../../../settings/designSetting.mjs";
import "../../hooks/useKeyboard.hook.mjs";
import { useChartEditStore } from "../../../../store/modules/chartEditStore/chartEditStore.mjs";
import { useChartHistoryStore } from "../../../../store/modules/chartHistoryStore/chartHistoryStore.mjs";
import { HistoryStackEnum } from "../../../../store/modules/chartHistoryStore/chartHistoryStore.d.mjs";
import { useChartLayoutStore } from "../../../../store/modules/chartLayoutStore/chartLayoutStore.mjs";
import { ChartLayoutStoreEnum } from "../../../../store/modules/chartLayoutStore/chartLayoutStore.d.mjs";
import { defineComponent, computed, resolveComponent, openBlock, createBlock, withCtx, createVNode, createElementBlock, Fragment, renderList, resolveDynamicComponent, createElementVNode as createBaseVNode } from "../../../../../node_modules/.pnpm/@vue_runtime-core@3.3.4/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.mjs";
import { toRefs, reactive } from "../../../../../node_modules/.pnpm/@vue_reactivity@3.3.4/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.mjs";
import { toDisplayString } from "../../../../../node_modules/.pnpm/@vue_shared@3.3.4/node_modules/@vue/shared/dist/shared.esm-bundler.mjs";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "index",
  setup(__props) {
    const { LayersIcon, BarChartIcon, PrismIcon, HomeIcon, ArrowBackIcon, ArrowForwardIcon } = icon.ionicons5;
    const { setItem } = useChartLayoutStore();
    const { getLayers, getCharts, getDetails } = toRefs(useChartLayoutStore());
    useChartEditStore();
    const chartHistoryStore = useChartHistoryStore();
    const btnList = reactive([
      {
        key: ChartLayoutStoreEnum.CHARTS,
        select: getCharts,
        title: "图表组件",
        icon: renderIcon(BarChartIcon)
      },
      {
        key: ChartLayoutStoreEnum.LAYERS,
        select: getLayers,
        title: "图层控制",
        icon: renderIcon(LayersIcon)
      },
      {
        key: ChartLayoutStoreEnum.DETAILS,
        select: getDetails,
        title: "详情设置",
        icon: renderIcon(PrismIcon)
      }
    ]);
    const isBackStack = computed(() => chartHistoryStore.getBackStack.length > 1);
    const isForwardStack = computed(() => chartHistoryStore.getForwardStack.length > 0);
    reactive([
      {
        key: HistoryStackEnum.BACK_STACK,
        // 一定会有初始化画布
        select: isBackStack,
        title: "后退",
        icon: renderIcon(ArrowBackIcon)
      },
      {
        key: HistoryStackEnum.FORWARD_STACK,
        select: isForwardStack,
        title: "前进",
        icon: renderIcon(ArrowForwardIcon)
      }
    ]);
    const styleHandle = (item) => {
      if (item.key === ChartLayoutStoreEnum.DETAILS) {
        return item.select ? "" : "primary";
      }
      return item.select ? "primary" : "";
    };
    const clickHandle = (item) => {
      setItem(item.key, !item.select);
    };
    return (_ctx, _cache) => {
      const _component_n_button = resolveComponent("n-button");
      const _component_n_tooltip = resolveComponent("n-tooltip");
      const _component_n_space = resolveComponent("n-space");
      return openBlock(), createBlock(_component_n_space, {
        class: "header-left-btn",
        size: 25
      }, {
        default: withCtx(() => [
          createVNode(_component_n_space, null, {
            default: withCtx(() => [
              (openBlock(true), createElementBlock(Fragment, null, renderList(btnList, (item) => {
                return openBlock(), createBlock(_component_n_tooltip, {
                  key: item.key,
                  placement: "bottom",
                  trigger: "hover"
                }, {
                  trigger: withCtx(() => [
                    createVNode(_component_n_button, {
                      size: "small",
                      ghost: "",
                      type: styleHandle(item),
                      focusable: false,
                      onClick: ($event) => clickHandle(item)
                    }, {
                      default: withCtx(() => [
                        (openBlock(), createBlock(resolveDynamicComponent(item.icon)))
                      ]),
                      _: 2
                    }, 1032, ["type", "onClick"])
                  ]),
                  default: withCtx(() => [
                    createBaseVNode("span", null, toDisplayString(item.title), 1)
                  ]),
                  _: 2
                }, 1024);
              }), 128))
            ]),
            _: 1
          })
        ]),
        _: 1
      });
    };
  }
});
export {
  _sfc_main as default
};
