"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const pinia = require("pinia");
const chartLayoutStore_d = require("./chartLayoutStore.d.js");
require("../../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.js");
require("../../../../node_modules/.pnpm/screenfull@6.0.2/node_modules/screenfull/index.js");
require("../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js");
require("../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js");
require("../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.js");
require("../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseClone.js");
require("../../../../node_modules/.pnpm/crypto-js@4.1.1/node_modules/crypto-js/index.js");
require("../../../enums/pageEnum.js");
const storageEnum = require("../../../enums/storageEnum.js");
const storage = require("../../../utils/storage.js");
require("../../../router/index.js");
require("../designStore/designStore.js");
require("../../../../node_modules/.pnpm/vue3-lazyload@0.2.5-beta_a6dezdz3je235ci4e3tu4rayna/node_modules/vue3-lazyload/dist/vue3-lazyload.esm.js");
require("../../../components/GoSkeleton/index.vue.js");
require("../../../components/GoLoading/index.js");
require("../../../settings/designSetting.js");
const chartEditStore$1 = require("../chartEditStore/chartEditStore.js");
const chartEditStore = chartEditStore$1.useChartEditStore();
const { GO_CHART_LAYOUT_STORE } = storageEnum.StorageEnum;
const storageChartLayout = storage.getLocalStorage(GO_CHART_LAYOUT_STORE);
const useChartLayoutStore = pinia.defineStore({
  id: "useChartLayoutStore",
  state: () => ({
    // 图层控制
    layers: true,
    // 图表组件
    charts: true,
    // 详情设置（收缩为true）
    details: false,
    // 组件列表展示类型（默认单列）
    chartType: chartLayoutStore_d.ChartModeEnum.SINGLE,
    // 图层类型（默认图片）
    layerType: chartLayoutStore_d.LayerModeEnum.THUMBNAIL,
    // 当前加载数量
    percentage: 0,
    // 是否重置当前画布位置
    rePositionCanvas: false,
    // 防止值不存在
    ...storageChartLayout
  }),
  getters: {
    getLayers() {
      return this.layers;
    },
    getCharts() {
      return this.charts;
    },
    getDetails() {
      return this.details;
    },
    getChartType() {
      return this.chartType;
    },
    getLayerType() {
      return this.layerType;
    },
    getPercentage() {
      return this.percentage;
    },
    getRePositionCanvas() {
      return this.rePositionCanvas;
    }
  },
  actions: {
    setItem(key, value, computedScale = true) {
      this.$patch((state) => {
        state[key] = value;
      });
      storage.setLocalStorage(GO_CHART_LAYOUT_STORE, this.$state);
      this.rePositionCanvas = true;
      if (computedScale) {
        setTimeout(() => {
          chartEditStore.computedScale();
        }, 500);
      }
    },
    setItemUnHandle(key, value) {
      this.$patch((state) => {
        state[key] = value;
      });
    }
  }
});
exports.useChartLayoutStore = useChartLayoutStore;
