import { reactive as Nt, shallowRef as zt, computed as U, watch as H, watchEffect as Gt, nextTick as It, onMounted as Vt, onUnmounted as $t, onDeactivated as jt, toRefs as Ut, defineComponent as Pt, ref as Dt, resolveComponent as f, openBlock as g, createElementBlock as E, normalizeClass as T, unref as s, withDirectives as Ot, createElementVNode as M, createVNode as c, withCtx as r, createBlock as C, isRef as A, toDisplayString as K, createCommentVNode as P, Fragment as nt, renderList as ot, createTextVNode as N, vShow as Mt } from "vue";
import { u as Zt, i as qt, f as Bt, g as Jt, b as Wt } from "./layer-select-Ba4IEiWY.js";
import "@mapgis/webclient-common";
import { d as Ht, f as Lt, _ as Kt } from "./utils-B4smQbM-.js";
import "ant-design-vue";
import { f as Qt, j as Xt, F as Et } from "./vendor-D4icwOYu.js";
import * as Yt from "echarts";
const te = {
  /**
   * @description 图层ID
   * @type String
   */
  layerId: {
    type: String
  },
  /**
   * @description 子图层ID
   * @type String
   */
  sublayerId: {
    type: String
  },
  /**
   * @description 图层对象，可以是webclient-common库的图层对象或者子图层对象
   * @type zondy.layer.Layer | zondy.layer.Sublayer
   */
  layer: {
    type: Object
  },
  /**
   * @description 分组字段
   * @type String
   */
  groupField: {
    type: String
  },
  /**
   * @description 分组模式，unique：一值一类；range：分段分类
   * @type String
   */
  groupMode: {
    type: String,
    validator(n) {
      return ["unique", "range"].includes(n);
    }
  },
  /**
   * @description 分组模式为分段分类时的分段数量
   * @type Number
   */
  rangeNum: {
    type: Number,
    default: 5
  },
  /**
   * @description 统计字段
   * @type Array
   */
  statisticsFields: {
    type: Array,
    default: () => []
  },
  /**
   * @description 统计方式，同zondy.enum.StatisticType
   * @type String
   */
  statisticsType: {
    type: String
  },
  /**
   * @description 统计字段在图表上的颜色区间
   * @type Object
   */
  statisticsFieldColorRange: {
    type: Array,
    default: () => ["#ff0000", "#0000ff"]
  }
}, ee = {
  layerChange: () => !0
}, se = (n, x) => ({
  backgroundColor: "transparent",
  tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow",
      shadowStyle: {
        opacity: 0.2,
        color: "#1890ff"
      }
    },
    textStyle: {
      fontSize: 10
    },
    confine: !0,
    // 是否将 tooltip 框限制在图表的区域内。
    backgroundColor: "rgba(255, 255, 255, 0.8)"
  },
  grid: {
    top: 30,
    left: 50,
    bottom: 80,
    right: 10
  },
  legend: {
    left: 0,
    textStyle: {
      color: n
    }
  },
  xAxis: {
    type: "category",
    axisLabel: {
      rotate: 30,
      interval: 0,
      // 0控制x轴标签全部显示，1控制x轴标签间隔显示
      fontSize: 10,
      fontFamily: "微软雅黑",
      color: n
    },
    axisLine: {
      lineStyle: {
        color: x
      }
    }
  },
  dataZoom: [],
  yAxis: {
    axisLabel: {
      formatter(b) {
        const v = [];
        if (b > 1e16) {
          const _ = `${parseInt(b / 1e16)}京`;
          v.push(_);
        } else if (b > 999999999999) {
          const _ = `${parseInt(b / 1e12)}兆`;
          v.push(_);
        } else if (b > 99999999) {
          const _ = `${parseInt(b / 1e8)}亿`;
          v.push(_);
        } else if (b > 9999) {
          const _ = `${parseInt(b / 1e4)}万`;
          v.push(_);
        } else
          v.push(b);
        return v;
      },
      fontFamily: "微软雅黑",
      color: n
    },
    axisTick: {
      show: !0,
      lineStyle: {
        color: x
      }
    },
    axisLine: {
      show: !0,
      lineStyle: {
        color: x
      }
    },
    splitLine: {
      lineStyle: {
        type: "dotted",
        color: x
      }
    }
  },
  toolbox: {
    show: !0,
    orient: "horizontal",
    showTitle: !0,
    feature: {
      magicType: {
        type: ["line", "bar"],
        title: {
          line: "切换为折线图",
          bar: "切换为柱状图"
        }
      },
      saveAsImage: {
        type: "png",
        show: !0,
        title: "保存为图片"
      },
      restore: { show: !0, title: "还原" }
    },
    iconStyle: {
      borderColor: n
    }
  },
  series: []
}), ae = (n, x, b, v) => {
  const { zondy: _, map: m } = Zt(), { toggle: Q, isFullscreen: k } = Qt(v), { LayerType: D, SubLayerType: X, OutStatisticType: S } = _.enum, t = Nt({
    // 选择的图层ID
    selectedLayerId: "",
    // 图层ID
    layerId: n.layerId,
    // 子图层ID
    sublayerId: n.sublayerId,
    // 当前进行属性统计的图层
    attributeStatisticsLayerLayer: null,
    // 字段列表
    fields: [],
    // 图层类型列表
    layerTypes: [D.ArcGISMapImage, D.IGSMapImage, D.IGSFeature],
    // 子图层类型列表
    sublayerTypes: [X.ArcGISMapImageSub, X.IGSMapImageSub],
    // 分组字段
    groupField: n.groupField,
    // 统计字段表格数据
    statisticsFieldTableData: [],
    // 分组模式
    groupMode: n.groupMode,
    // 分组模式为分类分段时的分组数量
    rangeNum: n.rangeNum,
    // 统计字段
    statisticsFields: n.statisticsFields,
    // 统计方式
    statisticsType: n.statisticsType,
    // 统计字段颜色显示区间
    statisticsFieldColorRange: n.statisticsFieldColorRange,
    // 是否显示统计结果
    showStatisticsResult: !1,
    // 统计结果显示类型 chart | dataView
    statisticsResultShowType: "chart",
    // 统计结果表格表头
    statisticsResultTableColumns: [],
    // 统计结果表格数据
    statisticsResultTableData: [],
    // 分组字段选项
    groupFieldOptions: [],
    // 统计字段选项
    statisticsFieldOptions: [],
    // 分组模式
    groupModeOptions: [
      {
        label: "一值一类",
        value: "unique",
        disabled: !1
      },
      {
        label: "分段分类",
        value: "range",
        disabled: !1
      }
    ],
    // 统计方式
    statisticsTypeOptions: [
      {
        label: "求和",
        value: S.functionSum,
        disabled: !1
      },
      {
        label: "平均值",
        value: S.functionAvg,
        disabled: !1
      },
      {
        label: "最大值",
        value: S.functionMax,
        disabled: !1
      },
      {
        label: "最小值",
        value: S.functionMin,
        disabled: !1
      },
      {
        label: "计数",
        value: S.functionCount,
        disabled: !1
      },
      {
        label: "方差",
        value: S.functionVariance,
        disabled: !1
      },
      {
        label: "标准差",
        value: S.functionStandardDeviation,
        disabled: !1
      }
    ]
  }), y = zt(n.layer);
  let R, d = null;
  const Y = 10;
  let L;
  const Z = [
    {
      title: "字段",
      align: "center",
      dataIndex: "field",
      ellipsis: !0,
      key: "field"
    },
    {
      title: "颜色",
      align: "center",
      dataIndex: "color",
      ellipsis: !0,
      key: "color",
      scopedSlots: { customRender: "color" }
    }
  ], rt = U(() => y.value ? qt(y.value, _) ? {
    title: y.value.title,
    tip: `${y.value.layer.title}/${y.value.title}`
  } : {
    title: y.value.title,
    tip: y.value.title
  } : null), z = U(() => !(n.layer || n.layerId && n.layerId !== "")), ut = U(() => {
    const { groupField: e, groupMode: a, statisticsFields: i, statisticsType: o } = t;
    return y.value && e && a && i.length && o;
  }), ct = U(() => t.groupMode === "range"), tt = U(() => t.statisticsResultShowType === "chart"), q = U(() => t.statisticsResultShowType === "dataView");
  H([() => n.layerId, () => n.sublayerId], () => {
    G();
  }), H(
    () => n.layer,
    () => {
      y.value = n.layer, G();
    }
  ), Gt(async () => {
    Ft(), y.value && (R = Bt(y.value), t.fields = await R.getFields(), t.groupFieldOptions = t.fields.map((e) => ({
      ...e,
      disabled: !1
    })), t.statisticsFieldOptions = t.fields.map((e) => ({
      ...e,
      disabled: !1
    })), at(), x("layerChange"));
  }), H(
    () => [
      n.groupField,
      n.groupMode,
      n.rangeNum,
      n.statisticsFields,
      n.statisticsType,
      n.statisticsFieldColorRange
    ],
    () => {
      t.groupField = n.groupField, t.groupMode = n.groupMode, t.rangeNum = n.rangeNum, t.statisticsFields = [...n.statisticsFields], t.statisticsType = n.statisticsType, t.statisticsFieldColorRange = [...n.statisticsFieldColorRange], at(), J();
    }
  ), H(
    () => [t.statisticsFields, t.fields],
    () => {
      const e = Ht(
        t.statisticsFieldColorRange.join(","),
        1,
        t.statisticsFields.length
      );
      t.statisticsFieldTableData = t.statisticsFields.map((a, i) => ({
        field: w(a),
        color: e[i]
      }));
    },
    {
      immediate: !0
    }
  ), H(
    () => k.value,
    () => {
      It(() => {
        setTimeout(() => {
          if (d) {
            if (bt()) {
              const e = ht();
              d.setOption(e);
            }
            d.resize();
          }
        }, 100);
      });
    }
  ), Vt(() => {
    G();
  }), $t(() => {
  }), jt(() => {
  });
  async function I() {
    t.showStatisticsResult = !0, await It();
    const a = {
      outStatistics: t.statisticsFields.map((p) => ({
        statisticType: t.statisticsType,
        onStatisticField: p,
        outStatisticFieldName: `${w(p)}统计结果`
      })),
      groupFields: St()
    }, i = await R.queryStatistics(a), o = vt(i);
    o && (V(o.data), $(o.dataset));
  }
  function dt() {
  }
  function pt() {
    t.groupField = void 0, t.groupMode = void 0, t.statisticsType = void 0, t.statisticsFields = [], t.statisticsFieldTableData = [], y.value = b.value.getSelectLayers()[0], G();
  }
  function ft() {
    t.groupModeOptions.forEach((e) => {
      e.disabled = !1;
    }), Tt();
  }
  function B() {
    t.groupFieldOptions.forEach((e) => {
      e.disabled = !1;
    }), u();
  }
  function gt() {
    t.statisticsTypeOptions.forEach((e) => {
      e.disabled = !1;
    }), it();
  }
  function yt() {
    t.statisticsFieldOptions.forEach((e) => {
      e.disabled = !1;
    }), F();
  }
  function J() {
    Ct(), t.statisticsResultShowType = "chart", t.showStatisticsResult = !1, L = null;
  }
  function et(e) {
    e.target.value === "chart" && It(() => {
      setTimeout(() => {
        d && d.resize();
      }, 100);
    });
  }
  function st({ key: e }) {
    switch (e) {
      case "json":
        wt();
        break;
      case "csv":
        xt();
        break;
    }
  }
  function mt() {
    !k.value && d && (L = d.getOption()), Q();
  }
  function bt() {
    if (d)
      return d.getOption().dataZoom.length;
  }
  function ht() {
    if (k.value) {
      const e = d.getOption();
      return _t(e), e;
    } else
      return L;
  }
  function _t(e) {
    const { dataZoom: a, xAxis: i } = e, p = 100 / i[0].data.length, h = 100, W = Math.max(0, 100 - p * Y);
    a[0].start = W, a[0].end = h;
  }
  function G() {
    y.value || Jt({
      layerId: n.layerId,
      sublayerId: n.sublayerId,
      map: m,
      callback: (e) => {
        y.value = e;
      }
    });
  }
  function St() {
    const { groupMode: e, groupField: a, rangeNum: i } = t;
    let o;
    return e === "unique" ? o = a : o = [{ segmentCount: i, groupFieldName: a, groupType: "SEGMENT" }], o;
  }
  function vt(e) {
    if (!e)
      return null;
    const { groupField: a, statisticsFields: i } = t, o = [], p = [];
    i.forEach((O) => {
      const j = {};
      e.forEach((lt) => {
        j[lt.attributes[a]] = lt.attributes[`${w(O)}统计结果`];
      }), o.push(j);
    });
    const h = o;
    p.push([
      `${w(a)}(分组)`,
      ...i.map((O) => w(O))
    ]);
    const kt = Object.keys(h[0]).map((O) => [
      O,
      ...h.map((j) => j[O])
    ]);
    return p.push(...kt), { data: h, dataset: p };
  }
  function Ft() {
    t.fields = [], R = null, t.groupFieldOptions = [], t.statisticsFieldOptions = [], J();
  }
  function w(e) {
    const a = t.fields.find((i) => i.name === e);
    return a ? a.alias || a.name : e;
  }
  function at() {
    t.groupModeOptions.forEach((e) => {
      e.disabled = !1;
    }), t.statisticsTypeOptions.forEach((e) => {
      e.disabled = !1;
    }), t.groupFieldOptions.forEach((e) => {
      e.disabled = !1;
    }), t.statisticsFieldOptions.forEach((e) => {
      e.disabled = !1;
    }), t.fields.length && (t.groupField ? Tt() : t.groupMode && u(), t.statisticsFields.length ? it() : t.statisticsType && F());
  }
  function Tt() {
    const e = ["string"], a = t.fields.find((i) => i.name === t.groupField);
    a ? e.includes(a.type) && (t.groupModeOptions.forEach((i) => {
      i.disabled = i.value !== "unique";
    }), t.groupMode !== "unique" && (t.groupMode = void 0)) : t.groupField = void 0;
  }
  function u() {
    const e = ["string"];
    if (t.groupMode === "range") {
      t.groupFieldOptions.forEach((i) => {
        e.includes(i.type) ? i.disabled = !0 : i.disabled = !1;
      });
      const a = t.fields.find((i) => i.name === t.groupField);
      a ? e.includes(a.type) && (t.groupField = void 0) : t.groupField = void 0;
    }
  }
  function it() {
    const e = ["string"];
    t.statisticsFields.length && (t.statisticsFields = t.statisticsFields.filter((i) => t.fields.find((o) => o.name === i)), t.statisticsFields.some((i) => {
      const o = t.fields.find((p) => p.name === i);
      return e.includes(o.type);
    }) && (t.statisticsTypeOptions.forEach((i) => {
      i.value === S.functionCount ? i.disabled = !1 : i.disabled = !0;
    }), t.statisticsType && t.statisticsType !== S.functionCount && (t.statisticsType = void 0)));
  }
  function F() {
    const e = ["string"];
    t.statisticsType && t.statisticsType !== S.functionCount && (t.statisticsFieldOptions.forEach((a) => {
      e.includes(a.type) ? a.disabled = !0 : a.disabled = !1;
    }), t.statisticsFields.length && (t.statisticsFields = t.statisticsFields.filter((a) => {
      const i = t.fields.find((o) => o.name === a);
      return i && !e.includes(i.type);
    })));
  }
  function V(e) {
    d && (d.dispose(), d = null), d = Yt.init(document.getElementById("attributeStatisticsChart"));
    const a = se(Lt("--mapgis-color-text"), Lt("--mapgis-color-border"));
    a.color = t.statisticsFieldTableData.map((o) => o.color), a.xAxis.data = Object.keys(e[0]), a.xAxis.title = t.groupField;
    const i = Object.keys(e[0]);
    for (let o = 0; o < t.statisticsFields.length; o++) {
      const p = {
        type: "bar",
        barMaxWidth: 30,
        data: i.map((h) => e[o][h]),
        name: w(t.statisticsFields[o])
      };
      a.series[o] = p, a.legend.data = t.statisticsFields.map(
        (h) => w(h)
      ), i.length > Y ? a.dataZoom = [
        {
          type: "slider",
          show: !0,
          xAxisIndex: [0],
          left: "15%",
          right: "5%",
          start: 60,
          end: 70,
          // 初始化滚动条
          bottom: 80,
          height: 8,
          realtime: !0,
          showDetail: !1,
          zoomLock: !0
        }
      ] : a.dataZoom = [];
    }
    d.setOption(a, !0), d.resize();
  }
  function $(e) {
    e[0].forEach((a) => {
      const i = {
        title: a,
        dataIndex: a,
        align: "center",
        key: a,
        ellipsis: !0,
        width: 100
      };
      t.statisticsResultTableColumns.push(i);
    });
    for (let a = 1; a < e.length; a += 1) {
      const i = e[a], o = {};
      for (let p = 0; p < t.statisticsResultTableColumns.length; p += 1) {
        const h = t.statisticsResultTableColumns[p];
        o[h.dataIndex] = i[p];
      }
      t.statisticsResultTableData.push(o);
    }
  }
  function Ct() {
    d && (d.dispose(), d = null), t.statisticsResultTableColumns = [], t.statisticsResultTableData = [];
  }
  async function wt() {
    const e = Date.now(), a = t.statisticsResultTableData.map((o) => o), i = new Blob([JSON.stringify({ data: a })]);
    await Et.saveAs(i, `staticResult_${e}.json`);
  }
  async function xt() {
    const e = Date.now(), a = t.statisticsResultTableData.map((p) => p), i = Xt.parse(a), o = new Blob([`\uFEFF${i}`], {
      type: "text/plain;charset=utf-8;"
    });
    await Et.saveAs(o, `staticResult_${e}.csv`);
  }
  return {
    ...Ut(t),
    isFullscreen: k,
    // 下面是普通数据
    statisticsFieldTableColumn: Z,
    // 下面是计算属性
    showLayerSelect: z,
    attributeStatisticsLayerTitlePair: rt,
    canStatistics: ut,
    showRangeNum: ct,
    showStatisticsChart: tt,
    showStatisticsDataView: q,
    // 下面是方法
    statistics: I,
    clearState: dt,
    handleLayerSelectChange: pt,
    handleGroupFieldChange: ft,
    handleGroupModeChange: B,
    handleStatisticsFieldsChange: gt,
    handleStatisticsTypeChange: yt,
    handleReturnStatisticsSetting: J,
    handleStatisticsResultShowTypeChange: et,
    handleExportMenuClick: st,
    handleToggleScreen: mt
  };
}, ie = ["title"], le = ["title"], ne = ["title"], oe = { key: 0 }, re = /* @__PURE__ */ Pt({
  name: "MapgisAttributeStatistics",
  __name: "attribute-statistics",
  props: te,
  emits: ee,
  setup(n, { expose: x, emit: b }) {
    const v = n, _ = b, m = Wt("attribute-statistics"), Q = Dt(), k = Dt(), {
      selectedLayerId: D,
      layerTypes: X,
      sublayerTypes: S,
      groupFieldOptions: t,
      statisticsFieldOptions: y,
      groupField: R,
      groupMode: d,
      groupModeOptions: Y,
      rangeNum: L,
      statisticsType: Z,
      statisticsTypeOptions: rt,
      statisticsFields: z,
      statisticsFieldTableColumn: ut,
      statisticsFieldTableData: ct,
      showStatisticsResult: tt,
      statisticsResultShowType: q,
      isFullscreen: I,
      statisticsResultTableColumns: dt,
      statisticsResultTableData: pt,
      // 下面是计算属性
      showLayerSelect: ft,
      attributeStatisticsLayerTitlePair: B,
      canStatistics: gt,
      showRangeNum: yt,
      showStatisticsChart: J,
      showStatisticsDataView: et,
      // 下面是方法
      statistics: st,
      clearState: mt,
      handleLayerSelectChange: bt,
      handleGroupFieldChange: ht,
      handleGroupModeChange: _t,
      handleStatisticsFieldsChange: G,
      handleStatisticsTypeChange: St,
      handleReturnStatisticsSetting: vt,
      handleStatisticsResultShowTypeChange: Ft,
      handleExportMenuClick: w,
      handleToggleScreen: at
    } = ae(v, _, Q, k);
    return x({
      statistics: st,
      clearState: mt
    }), (Tt, u) => {
      const it = f("mapgis-layer-select"), F = f("a-form-item"), V = f("a-select-option"), $ = f("a-select"), Ct = f("a-input-number"), wt = f("mapgis-ui-setting-form"), xt = f("mapgis-ui-color-picker"), e = f("a-table"), a = f("a-button"), i = f("mapgis-ui-iconfont"), o = f("mapgis-ui-group-tab"), p = f("a-radio-button"), h = f("a-radio-group"), W = f("a-menu-item"), kt = f("a-menu"), O = f("a-dropdown"), j = f("mapgis-ui-toolbar-command"), lt = f("a-flex");
      return g(), E("div", {
        class: T([s(m).b()])
      }, [
        Ot(M("div", null, [
          c(wt, {
            layout: "horizontal",
            itemLayout: "grid",
            size: "default",
            class: T(s(m).e("form"))
          }, {
            default: r(() => [
              s(ft) ? (g(), C(F, {
                key: 0,
                label: "统计图层"
              }, {
                default: r(() => [
                  c(it, {
                    ref_key: "layerSelectRef",
                    ref: Q,
                    value: s(D),
                    "onUpdate:value": u[0] || (u[0] = (l) => A(D) ? D.value = l : null),
                    layerTypes: s(X),
                    sublayerTypes: s(S),
                    multiple: !1,
                    treeDefaultExpandAll: "",
                    onChange: s(bt)
                  }, null, 8, ["value", "layerTypes", "sublayerTypes", "onChange"])
                ]),
                _: 1
              })) : (g(), C(F, {
                key: 1,
                label: "过滤图层"
              }, {
                default: r(() => [
                  s(B) ? (g(), E("div", {
                    key: 0,
                    title: s(B).tip,
                    class: T(s(m).e("layer-name"))
                  }, K(s(B).title), 11, ie)) : P("", !0)
                ]),
                _: 1
              })),
              c(F, { label: "分组字段" }, {
                default: r(() => [
                  c($, {
                    placeholder: "请选择分组字段",
                    value: s(R),
                    "onUpdate:value": u[1] || (u[1] = (l) => A(R) ? R.value = l : null),
                    onChange: s(ht)
                  }, {
                    default: r(() => [
                      (g(!0), E(nt, null, ot(s(t), (l) => (g(), C(V, {
                        key: l.name,
                        disabled: l.disabled
                      }, {
                        default: r(() => [
                          M("span", {
                            title: l.alias || l.name
                          }, K(l.alias || l.name), 9, le)
                        ]),
                        _: 2
                      }, 1032, ["disabled"]))), 128))
                    ]),
                    _: 1
                  }, 8, ["value", "onChange"])
                ]),
                _: 1
              }),
              c(F, { label: "分组模式" }, {
                default: r(() => [
                  c($, {
                    placeholder: "请选择分组模式",
                    value: s(d),
                    "onUpdate:value": u[2] || (u[2] = (l) => A(d) ? d.value = l : null),
                    onChange: s(_t)
                  }, {
                    default: r(() => [
                      (g(!0), E(nt, null, ot(s(Y), (l) => (g(), C(V, {
                        key: l.value,
                        value: l.value,
                        title: l.label,
                        disabled: l.disabled
                      }, {
                        default: r(() => [
                          N(K(l.label), 1)
                        ]),
                        _: 2
                      }, 1032, ["value", "title", "disabled"]))), 128))
                    ]),
                    _: 1
                  }, 8, ["value", "onChange"])
                ]),
                _: 1
              }),
              s(yt) ? (g(), C(F, {
                key: 2,
                label: "分段数"
              }, {
                default: r(() => [
                  c(Ct, {
                    placeholder: "请输入分段数",
                    value: s(L),
                    "onUpdate:value": u[3] || (u[3] = (l) => A(L) ? L.value = l : null),
                    min: 1
                  }, null, 8, ["value"])
                ]),
                _: 1
              })) : P("", !0),
              c(F, { label: "统计字段" }, {
                default: r(() => [
                  c($, {
                    value: s(z),
                    "onUpdate:value": u[4] || (u[4] = (l) => A(z) ? z.value = l : null),
                    mode: "multiple",
                    placeholder: "请选择统计字段",
                    "max-tag-count": 2,
                    allowClear: "",
                    onChange: s(G)
                  }, {
                    default: r(() => [
                      (g(!0), E(nt, null, ot(s(y), (l) => (g(), C(V, {
                        key: l.name,
                        disabled: l.disabled
                      }, {
                        default: r(() => [
                          M("span", {
                            title: l.alias || l.name
                          }, K(l.alias || l.name), 9, ne)
                        ]),
                        _: 2
                      }, 1032, ["disabled"]))), 128))
                    ]),
                    _: 1
                  }, 8, ["value", "onChange"])
                ]),
                _: 1
              }),
              c(F, { label: "统计方式" }, {
                default: r(() => [
                  c($, {
                    placeholder: "请选择",
                    value: s(Z),
                    "onUpdate:value": u[5] || (u[5] = (l) => A(Z) ? Z.value = l : null),
                    onChange: s(St)
                  }, {
                    default: r(() => [
                      (g(!0), E(nt, null, ot(s(rt), (l, Rt) => (g(), C(V, {
                        key: Rt,
                        value: l.value,
                        disabled: l.disabled
                      }, {
                        default: r(() => [
                          N(K(l.label), 1)
                        ]),
                        _: 2
                      }, 1032, ["value", "disabled"]))), 128))
                    ]),
                    _: 1
                  }, 8, ["value", "onChange"])
                ]),
                _: 1
              })
            ]),
            _: 1
          }, 8, ["class"]),
          s(z).length ? (g(), C(e, {
            key: 0,
            bordered: "",
            size: "small",
            pagination: !1,
            columns: s(ut),
            "data-source": s(ct),
            scroll: { y: 150 }
          }, {
            bodyCell: r(({ record: l, column: Rt }) => [
              Rt.dataIndex === "color" ? (g(), C(xt, {
                key: 0,
                color: l.color,
                "onUpdate:color": (At) => l.color = At,
                disableAlpha: !1,
                showColorText: !1
              }, null, 8, ["color", "onUpdate:color"])) : P("", !0)
            ]),
            _: 1
          }, 8, ["columns", "data-source"])) : P("", !0),
          c(a, {
            class: T(s(m).m("submit")),
            block: "",
            type: "primary",
            disabled: !s(gt),
            onClick: s(st)
          }, {
            default: r(() => [...u[7] || (u[7] = [
              N(" 统计 ", -1)
            ])]),
            _: 1
          }, 8, ["class", "disabled", "onClick"])
        ], 512), [
          [Mt, !s(tt)]
        ]),
        s(tt) ? (g(), E("div", oe, [
          c(o, {
            title: "返回",
            hasLeftMargin: !1,
            class: T(s(m).m("home")),
            onClick: s(vt)
          }, {
            front: r(() => [
              c(i, { type: "mapgis-left" })
            ]),
            _: 1
          }, 8, ["class", "onClick"]),
          M("div", {
            class: T([
              s(m).e("attributeStatisticsContainer"),
              s(I) && s(m).em("attributeStatisticsContainer", "fullscreen")
            ]),
            ref_key: "attributeStatisticsContainerRef",
            ref: k
          }, [
            M("div", {
              class: T(s(m).e("result-type"))
            }, [
              c(h, {
                value: s(q),
                "onUpdate:value": u[6] || (u[6] = (l) => A(q) ? q.value = l : null),
                size: "small",
                onChange: s(Ft)
              }, {
                default: r(() => [
                  c(p, { value: "chart" }, {
                    default: r(() => [...u[8] || (u[8] = [
                      N(" 统计图 ", -1)
                    ])]),
                    _: 1
                  }),
                  c(p, { value: "dataView" }, {
                    default: r(() => [...u[9] || (u[9] = [
                      N(" 数据视图 ", -1)
                    ])]),
                    _: 1
                  })
                ]),
                _: 1
              }, 8, ["value", "onChange"]),
              c(lt, {
                gap: "small",
                align: "center"
              }, {
                default: r(() => [
                  c(O, {
                    getPopupContainer: () => k.value,
                    overlayStyle: s(I) ? {} : { whiteSpace: "nowrap", minWidth: "auto", maxWidth: "none" }
                  }, {
                    overlay: r(() => [
                      c(kt, { onClick: s(w) }, {
                        default: r(() => [
                          c(W, { key: "json" }, {
                            default: r(() => [...u[10] || (u[10] = [
                              N(" 导出为JSON ", -1)
                            ])]),
                            _: 1
                          }),
                          c(W, { key: "csv" }, {
                            default: r(() => [...u[11] || (u[11] = [
                              N(" 导出为CSV ", -1)
                            ])]),
                            _: 1
                          })
                        ]),
                        _: 1
                      }, 8, ["onClick"])
                    ]),
                    default: r(() => [
                      s(et) ? (g(), C(a, {
                        key: 0,
                        shape: "circle",
                        size: "small"
                      }, {
                        default: r(() => [
                          c(i, { type: "mapgis-download" })
                        ]),
                        _: 1
                      })) : P("", !0)
                    ]),
                    _: 1
                  }, 8, ["getPopupContainer", "overlayStyle"]),
                  c(j, {
                    title: s(I) ? "取消全屏" : "全屏",
                    icon: s(I) ? "mapgis-collapse" : "mapgis-expand",
                    size: "small",
                    onClick: s(at)
                  }, null, 8, ["title", "icon", "onClick"])
                ]),
                _: 1
              })
            ], 2),
            M("div", {
              class: T(s(m).e("result-content"))
            }, [
              Ot(M("div", {
                id: "attributeStatisticsChart",
                class: T([
                  s(m).e("result-content"),
                  s(I) ? s(m).em("result-content", "chart-container-fullscreen") : s(m).em("result-content", "chart-container")
                ])
              }, null, 2), [
                [Mt, s(J)]
              ]),
              Ot(M("div", {
                class: T(s(m).em("result-content", "table-container"))
              }, [
                c(e, {
                  bordered: "",
                  size: "small",
                  pagination: { size: "small", showSizeChanger: !1, showLessItems: !0 },
                  columns: s(dt),
                  "data-source": s(pt),
                  scroll: { y: s(I) ? "100vh" : 150 }
                }, null, 8, ["columns", "data-source", "scroll"])
              ], 2), [
                [Mt, s(et)]
              ])
            ], 2)
          ], 2)
        ])) : P("", !0)
      ], 2);
    };
  }
}), ye = /* @__PURE__ */ Kt(re, [["__scopeId", "data-v-37575f19"]]);
export {
  ye as A,
  ee as a,
  te as b,
  ae as u
};
