var _A = Object.defineProperty;
var $A = (e, A, t) => A in e ? _A(e, A, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[A] = t;
var U = (e, A, t) => $A(e, typeof A != "symbol" ? A + "" : A, t);
import { d as H, o as S, F as j, e as y, a as i, b as l, S as mA, f as aA, A as Z, D as rA, r as b, U as HA, V as NA, E as eA, t as Y, i as k, u as T, w as lA, c as R, g as N, h as C, _ as V, j as sA, k as fA, W as hA, l as LA, m as Ae, n as pA, p as zA, q as ee, s as te, I as ne, x as G, v as oe, B, C as Q, y as vA, H as RA, J as kA, G as ae, T as re, z as TA, aV as gA, Z as IA, aW as wA, a0 as oA, aX as le, X as se, Y as ie, K as WA, L as de, M as ue, N as ce, P as me, O as fe, R as _, Q as he, aY as yA, aZ as PA, a_ as pe, a$ as ve, $ as ge, a3 as q, a1 as be, a2 as we, a4 as ye, a5 as Pe, a6 as Ce, a7 as De, a8 as xe, a9 as Se, aa as Fe, ab as Ee, ac as Xe, ad as Oe, ae as He, af as Ne, ag as Le, ah as ze, ai as Re, aj as ke, ak as Te, al as Ie, am as We, an as je, ao as Be, ap as Ue, aq as Ve, ar as Qe, as as Ye, at as Me, au as Ze, av as Ge, aw as qe, ax as Ke, ay as Je, az as _e, aA as $e, aB as At, aC as et, aD as tt, aE as nt, aF as ot, aG as at, aH as rt, aI as lt, aJ as st, aK as it, aL as CA, aM as dt, aN as ut, aO as ct, aP as mt, aQ as ft, aR as ht, aS as iA, aT as pt, aU as $ } from "./ApiBase.js";
import { a as vt, O as DA, d as xA } from "./UI.runtime.js";
import { _ as jA } from "./DropdownPopoverList.js";
const F = {
  Init: "init",
  // 文档初始化时
  SelectionChange: "selectionChange",
  // selection改变时
  UndoRedoChange: "UndoRedoChange",
  // undo redo 操作列表发生改变时
  ExportReady: "ExportReady",
  // 文档准备好导出时
  ZoomChange: "zoomChange"
  // 页面zoom改变
}, o = {
  //styles
  Accounting: "accounting",
  Bold: "bold",
  DecCellDigits: "decCellDigits",
  Underline: "underline",
  Border: "border",
  Strikeout: "strikeout",
  IncCellDigits: "incCellDigits",
  Italic: "italic",
  FontSize: "fontSize",
  FontColor: "fontColor",
  FillColor: "fillColor",
  FontName: "fontName",
  Color: "color",
  AlignHorizontal: "alignHorizontal",
  AlignVertical: "alignVertical",
  Percent: "percent",
  // editor
  Copy: "copy",
  Cut: "cut",
  Paste: "paste",
  Undo: "undo",
  Redo: "redo",
  Zoom: "zoom",
  Export: "export",
  ExportPDF: "exportPDF",
  Open: "open",
  NumFormat: "numFormat",
  Search: "search",
  // dropdown
  PaneOperations: "paneOperations",
  ColumnOperations: "columnOperations",
  RowOperations: "rowOperations",
  SheetOperations: "sheetOperations"
}, cA = /* @__PURE__ */ new Set([
  o.Open,
  o.Export,
  o.ExportPDF,
  o.Copy,
  o.Zoom,
  o.Search
]), gt = /* @__PURE__ */ new Set([
  o.Open,
  o.Export,
  o.ExportPDF,
  o.Copy,
  o.Undo,
  o.Redo,
  o.Zoom,
  o.Search,
  o.SheetOperations
]);
function bt(e, A, t = window) {
  const n = (f) => {
    e.dispatch("file/onError", f);
  };
  t.addEventListener("FileError", n);
  const a = (f) => {
    e.dispatch("file/onReady", f);
  };
  t.addEventListener("DocumentReady", a);
  const r = () => {
    A.enableEditor();
    const f = A.api.isWorksheetProtected() || !1;
    e.commit("command/refreshProtectedSheetMode", f), e.commit("file/setSheetProtected", f);
  };
  t.addEventListener("EditorEnable", r);
  const s = () => {
    A.disableEditor();
  };
  t.addEventListener("EditorDisable", s);
  const u = (f) => {
  };
  t.addEventListener("WorksheetLoaded", u);
  const d = (f) => {
    e.dispatch("file/onLoadPageEnd", f), e.commit("command/setLoadEnd", !0), A.refresh(F.Init);
    const X = A.api.isWorksheetProtected() || !1;
    SA(e, X);
  };
  t.addEventListener("EndLoading", d);
  const m = (f) => {
    e.dispatch("file/onExportReady", f), A.refresh(F.ExportReady);
  };
  t.addEventListener("ExportReady", m);
  const h = (f) => {
    yt(e, f.detail), A.refresh(F.SelectionChange);
  };
  t.addEventListener("SelectionChange", h);
  const w = (f) => {
    A.refresh(F.UndoRedoChange);
  };
  t.addEventListener("UndoRedoChange", w);
  const O = (f) => {
    wt(e, f.detail.status);
  };
  t.addEventListener("EditingStatusChange", O);
  const c = (f) => {
    A.refresh(F.ZoomChange);
  };
  t.addEventListener("ZoomChange", c);
  const p = (f) => {
    e.commit("file/setShowFindDialog", !0);
  };
  t.addEventListener("OpenFindDialog", p);
  const g = (f) => {
    var z;
    let X = ((z = f.detail) == null ? void 0 : z.formatRatio) || 0;
    X = X == 100 ? 99 : X, e.commit("file/setLoadingRatio", X);
  };
  t.addEventListener("DocumentLoading", g);
  const P = (f) => {
    var z;
    const X = ((z = f.detail) == null ? void 0 : z.sheetProtected) || !1;
    SA(e, X);
  };
  t.addEventListener("SheetChange", P);
  const E = (f) => {
    var X;
    A.notifySecurityError(((X = f.detail) == null ? void 0 : X.action) || "");
  };
  return t.addEventListener("SecurityError", E), () => {
    t.removeEventListener("FileError", n), t.removeEventListener("DocumentReady", a), t.removeEventListener("EditorEnable", r), t.removeEventListener("EditorDisable", s), t.removeEventListener("WorksheetLoaded", u), t.removeEventListener("EndLoading", d), t.removeEventListener("ExportReady", m), t.removeEventListener("SelectionChange", h), t.removeEventListener("UndoRedoChange", w), t.removeEventListener("EditingStatusChange", O), t.removeEventListener("ZoomChange", c), t.removeEventListener("OpenFindDialog", p), t.removeEventListener("DocumentLoading", g), t.removeEventListener("SheetChange", P), t.removeEventListener("SecurityError", E);
  };
}
function SA(e, A) {
  const t = e.getters["file/sheetProtected"];
  A != t && (e.commit("command/refreshProtectedSheetMode", A), e.commit("file/setSheetProtected", A));
}
function wt(e, A) {
  e.commit("command/setEnabled", {
    cmd: o.Zoom,
    enabled: !A
  }), A && e.commit("command/setEnabled", {
    cmd: o.Copy,
    enabled: !1
  });
}
function yt(e, A) {
  if (!A) return;
  e.commit("command/setEnabled", {
    cmd: o.Copy,
    enabled: A.canCopy === !0
  }), e.commit("command/setSelectAll", A.bSelectAll === !0), [
    { cmd: o.Bold, key: "bold" },
    {
      cmd: o.FillColor,
      key: "fillColor",
      getEnabled: (n) => n.isText !== !0
    },
    { cmd: o.FontColor, key: "fontColor" },
    { cmd: o.FontName, key: "fontName" },
    { cmd: o.FontSize, key: "fontSize", getVal: (n) => n ? String(n) : "" },
    { cmd: o.Italic, key: "italic" },
    { cmd: o.Underline, key: "underline", getVal: (n) => n === "single" },
    { cmd: o.Strikeout, key: "strikeout" },
    {
      cmd: o.AlignHorizontal,
      key: "alignHorizontal",
      getEnabled: (n) => n.isText !== !0
    },
    {
      cmd: o.AlignVertical,
      key: "alignVertical",
      getEnabled: (n) => n.isText !== !0
    },
    {
      cmd: o.NumFormat,
      key: "numFormatType",
      getVal: (n) => {
        const a = e == null ? void 0 : e.getters["file/numFormatListValues"], r = Number(n) || 0;
        return a == null ? void 0 : a[r];
      },
      getEnabled: (n) => n.isText !== !0
    },
    {
      cmd: o.Percent,
      key: "",
      getEnabled: (n) => n.isText !== !0
    },
    {
      cmd: o.Accounting,
      key: "",
      getEnabled: (n) => n.isText !== !0
    },
    {
      cmd: o.IncCellDigits,
      key: "",
      getEnabled: (n) => n.isText !== !0
    },
    {
      cmd: o.DecCellDigits,
      key: "",
      getEnabled: (n) => n.isText !== !0
    },
    {
      cmd: o.Border,
      key: "",
      getEnabled: (n) => n.isText !== !0
    }
  ].forEach(({ cmd: n, key: a, getVal: r, getEnabled: s }) => {
    if (s && !s(A)) {
      e.commit("command/setEnabled", {
        cmd: n,
        enabled: !1
      }), e.commit("command/clearState", {
        cmd: n
      });
      return;
    }
    if (a != "") {
      let d;
      r ? d = r(A[a]) : d = A[a], e.commit("command/setState", {
        cmd: n,
        ui: {
          value: d
        }
      });
    }
    e.getters["file/sheetProtected"] || e.commit("command/setEnabled", {
      cmd: n,
      enabled: !0
    });
  });
}
const I = Symbol("CommandService");
class Pt {
  constructor(A) {
    U(this, "store");
    U(this, "api");
    U(this, "xlsReady");
    U(this, "eventTarget");
    U(this, "removeListeners");
    U(this, "handlers");
    U(this, "refreshers");
    U(this, "securityErrorHandler");
    U(this, "modeController");
    U(this, "removeModeListener");
    this.store = A.store, this.api = A.api, this.xlsReady = !1, this.eventTarget = A.eventTarget ?? window, this.removeListeners = () => {
    }, this.handlers = {}, this.refreshers = {}, this.securityErrorHandler = () => {
    }, this.modeController = null, this.removeModeListener = () => {
    };
  }
  initApi(A) {
    var t, n;
    this.xlsReady = !1, this.store.commit("command/resetCommandState"), (t = this.removeListeners) == null || t.call(this), (n = this.removeModeListener) == null || n.call(this), this.api.initApi(A), this.bindDocumentMode(A), this.syncReadOnlyState(), this.removeListeners = bt(this.store, this, this.eventTarget);
  }
  initApp(A) {
    this.initApi(A);
  }
  destroy() {
    var A, t;
    (A = this.removeListeners) == null || A.call(this), (t = this.removeModeListener) == null || t.call(this), this.modeController = null, this.removeListeners = () => {
    }, this.removeModeListener = () => {
    };
  }
  dispose() {
    this.destroy();
  }
  setSecurityErrorHandler(A) {
    this.securityErrorHandler = A || (() => {
    });
  }
  notifySecurityError(A) {
    this.securityErrorHandler(A);
  }
  enableEditor() {
    this.xlsReady = !0, this.refresh(F.Init);
  }
  disableEditor() {
    this.xlsReady = !1, this.refresh(F.Init);
  }
  canRefreshCommand(A) {
    return this.xlsReady ? !0 : this.isReadOnly() && this.store.getters["command/loadEnd"] === !0 && cA.has(A);
  }
  //refresheres
  registerHandler(A, t) {
    this.handlers[A], this.handlers[A] = t;
  }
  registerRefresher(A, t) {
    this.refreshers[A] = t;
  }
  refreshAll() {
    this.syncReadOnlyState(), this.refreshSome(Object.values(o));
  }
  refresh(A) {
    var n, a, r;
    this.syncReadOnlyState();
    const t = Object.values(o);
    for (const s of t) {
      const u = this.handlers[s];
      u && ((n = u.refresh) != null && n.has(A)) && ((r = (a = this.refreshers)[s]) == null || r.call(a, this));
    }
  }
  refreshSome(A) {
    var t, n;
    this.syncReadOnlyState();
    for (const a of A)
      (n = (t = this.refreshers)[a]) == null || n.call(t, this);
  }
  bindDocumentMode(A) {
    var t;
    this.modeController = vt(A), this.removeModeListener = ((t = this.modeController) == null ? void 0 : t.onChange((n) => {
      this.store.commit("command/setReadOnly", n), n && this.disableEditor();
    })) ?? (() => {
    });
  }
  isReadOnly() {
    var A;
    return ((A = this.modeController) == null ? void 0 : A.isReadOnly()) ?? !1;
  }
  syncReadOnlyState() {
    this.store.commit("command/setReadOnly", this.isReadOnly());
  }
  canRunInReadOnly(A) {
    return !!cA.has(A);
  }
  /** 执行命令：统一入口 */
  async run(A, t) {
    this.syncReadOnlyState();
    const n = this.handlers[A];
    if (!n) {
      console.error(`[CommandService] no handler registered for "${A}"`);
      return;
    }
    this.isReadOnly() && !this.canRunInReadOnly(A) || await this.store.dispatch("command/run", {
      cmd: A,
      param: t,
      fn: async (a) => {
        await n.run(this.api, a);
      }
    });
  }
}
const Ct = /* @__PURE__ */ H({
  __name: "RenameSheetDialog",
  setup(e, { expose: A }) {
    const t = b(!1), n = b("");
    let a = null;
    function r(d, m) {
      n.value = d, a = m, t.value = !0;
    }
    function s() {
      n.value && (a && a(n.value), t.value = !1);
    }
    function u() {
      t.value = !1;
    }
    return A({
      openPopover: r
    }), (d, m) => (S(), j(l(rA), {
      show: t.value,
      "onUpdate:show": m[1] || (m[1] = (h) => t.value = h),
      title: d.$t("dialog.sheetRename.title"),
      width: 250
    }, {
      action: y(() => [
        i(l(Z), {
          label: d.$t("common.cancel"),
          onClickButton: u,
          type: "standard"
        }, null, 8, ["label"]),
        i(l(Z), {
          label: d.$t("common.confirm"),
          onClickButton: s
        }, null, 8, ["label"])
      ]),
      default: y(() => [
        i(l(mA), {
          value: n.value,
          "onUpdate:value": m[0] || (m[0] = (h) => n.value = h),
          onKeydown: aA(s, ["enter"])
        }, null, 8, ["value"])
      ]),
      _: 1
    }, 8, ["show", "title"]));
  }
}), Dt = /* @__PURE__ */ H({
  __name: "SetColumnWidthDialog",
  setup(e, { expose: A }) {
    const t = b(!1), n = b(!1), a = b(""), r = b(0), s = b(255), u = b(0);
    let d = null;
    function m(c) {
      const p = Number(c);
      if (c === "") {
        n.value = !1, a.value = "";
        return;
      }
      !isNaN(p) && p >= u.value && p <= s.value ? (n.value = !1, a.value = "") : (n.value = !0, a.value = "error");
    }
    function h(c, p) {
      r.value = c, n.value = !1, a.value = "", d = p, t.value = !0;
    }
    function w() {
      r.value < u.value || r.value > s.value || (d && d(r.value), t.value = !1);
    }
    function O() {
      t.value = !1;
    }
    return A({
      openPopover: h
    }), (c, p) => (S(), j(l(rA), {
      show: t.value,
      "onUpdate:show": p[1] || (p[1] = (g) => t.value = g),
      title: c.$t("dialog.columnWidthSet.title"),
      width: 250
    }, {
      action: y(() => [
        i(l(Z), {
          label: c.$t("common.cancel"),
          onClickButton: O,
          type: "standard"
        }, null, 8, ["label"]),
        i(l(Z), {
          label: c.$t("common.confirm"),
          onClickButton: w
        }, null, 8, ["label"])
      ]),
      default: y(() => [
        i(l(HA), {
          "validation-status": a.value,
          feedback: n.value ? c.$t("dialog.columnWidthSet.errorMessageNum") : ""
        }, {
          default: y(() => [
            i(l(NA), {
              value: r.value,
              "onUpdate:value": p[0] || (p[0] = (g) => r.value = g),
              onKeydown: aA(w, ["enter"]),
              min: u.value,
              max: s.value,
              "show-step-button": !0,
              "step-fixed": 2,
              onInput: m,
              style: { width: "220px" }
            }, {
              suffix: y(() => [
                eA(Y(c.$t("dialog.columnWidthSet.unit")), 1)
              ]),
              _: 1
            }, 8, ["value", "min", "max"])
          ]),
          _: 1
        }, 8, ["validation-status", "feedback"])
      ]),
      _: 1
    }, 8, ["show", "title"]));
  }
}), xt = /* @__PURE__ */ H({
  __name: "SetRowHeightDialog",
  setup(e, { expose: A }) {
    const t = b(!1), n = b(!1), a = b(""), r = b(0), s = b(409), u = b(0);
    let d = null;
    function m(c) {
      const p = Number(c);
      if (c === "") {
        n.value = !1, a.value = "";
        return;
      }
      !isNaN(p) && p >= u.value && p <= s.value ? (n.value = !1, a.value = "") : (n.value = !0, a.value = "error");
    }
    function h(c, p) {
      r.value = c, n.value = !1, a.value = "", d = p, t.value = !0;
    }
    function w() {
      r.value < u.value || r.value > s.value || (d && d(r.value), t.value = !1);
    }
    function O() {
      t.value = !1;
    }
    return A({
      openPopover: h
    }), (c, p) => (S(), j(l(rA), {
      show: t.value,
      "onUpdate:show": p[1] || (p[1] = (g) => t.value = g),
      title: c.$t("dialog.rowHeightSet.title"),
      width: 250
    }, {
      action: y(() => [
        i(l(Z), {
          label: c.$t("common.cancel"),
          onClickButton: O,
          type: "standard"
        }, null, 8, ["label"]),
        i(l(Z), {
          label: c.$t("common.confirm"),
          onClickButton: w
        }, null, 8, ["label"])
      ]),
      default: y(() => [
        i(l(HA), {
          "validation-status": a.value,
          feedback: n.value ? c.$t("dialog.rowHeightSet.errorMessageNum") : ""
        }, {
          default: y(() => [
            i(l(NA), {
              value: r.value,
              "onUpdate:value": p[0] || (p[0] = (g) => r.value = g),
              onKeydown: aA(w, ["enter"]),
              min: u.value,
              max: s.value,
              "show-step-button": !0,
              "step-fixed": 1,
              onInput: m,
              style: { width: "220px" }
            }, {
              suffix: y(() => [
                eA(Y(c.$t("dialog.rowHeightSet.unit")), 1)
              ]),
              _: 1
            }, 8, ["value", "min", "max"])
          ]),
          _: 1
        }, 8, ["validation-status", "feedback"])
      ]),
      _: 1
    }, 8, ["show", "title"]));
  }
}), St = { class: "global-basic-display-text count" }, Ft = /* @__PURE__ */ H({
  __name: "SearchContentDialog",
  emits: ["update:show"],
  setup(e, { emit: A }) {
    const t = k(I), n = T(), a = b(""), r = C(
      () => {
        var f;
        return ((f = n == null ? void 0 : n.getters["command/getVal"](o.Search)) == null ? void 0 : f.countNum) || 0;
      }
    ), s = C(
      () => {
        var f;
        return ((f = n == null ? void 0 : n.getters["command/getVal"](o.Search)) == null ? void 0 : f.totalCount) || 0;
      }
    ), u = b(null), d = C(() => n == null ? void 0 : n.getters["file/showFindDialog"]);
    lA(d, (f) => {
      f && c();
    });
    function m(f) {
      const X = { value: f };
      t.run(o.Search, X);
    }
    function h() {
      if (!a.value) {
        E();
        return;
      }
      m({
        action: "search",
        val: a.value
      });
    }
    function w() {
      m({
        action: "next"
      });
    }
    function O() {
      m({
        action: "prev"
      });
    }
    function c() {
      setTimeout(g, 100);
    }
    function p() {
      a.value = "", E(), n.commit("file/setShowFindDialog", !1);
    }
    function g() {
      var f;
      (f = u == null ? void 0 : u.value) == null || f.focus();
    }
    function P(f) {
      f || p();
    }
    function E() {
      n.commit("command/setState", {
        cmd: o.Search,
        ui: {
          value: {
            countNum: 0,
            totalCount: 0
          }
        }
      });
    }
    return (f, X) => (S(), R("div", null, [
      i(l(rA), {
        show: d.value,
        "onUpdate:show": P,
        title: f.$t("toolbar.start.search"),
        width: 300,
        "show-mask": !1,
        draggable: !0
      }, {
        action: y(() => [
          i(l(Z), {
            label: f.$t("toolbar.start.prev"),
            onClickButton: X[2] || (X[2] = (z) => O()),
            type: "standard"
          }, null, 8, ["label"]),
          i(l(Z), {
            label: f.$t("toolbar.start.next"),
            onClickButton: X[3] || (X[3] = (z) => w())
          }, null, 8, ["label"])
        ]),
        default: y(() => [
          i(l(mA), {
            value: a.value,
            "onUpdate:value": X[0] || (X[0] = (z) => a.value = z),
            placeholder: f.$t("toolbar.start.findPlaceHolder"),
            onInput: X[1] || (X[1] = (z) => h()),
            onKeydown: aA(w, ["enter"]),
            ref_key: "inputInstRef",
            ref: u
          }, {
            suffix: y(() => [
              N("span", St, Y(r.value) + "/" + Y(s.value), 1)
            ]),
            _: 1
          }, 8, ["value", "placeholder"])
        ]),
        _: 1
      }, 8, ["show", "title"])
    ]));
  }
}), Et = /* @__PURE__ */ V(Ft, [["__scopeId", "data-v-1374a4c3"]]), FA = ".xls,.xlsx", Xt = /* @__PURE__ */ H({
  __name: "edit",
  setup(e) {
    const { t: A } = sA(), t = fA(), n = T(), a = k(I), r = k(hA, null), s = b(null), u = b(!1), d = b(0), m = b(0), h = C(() => {
      var v;
      return ((v = n.state.command) == null ? void 0 : v.readOnly) === !0;
    }), w = C(() => {
      var v;
      return ((v = n.state.command) == null ? void 0 : v.loadEnd) === !0;
    }), O = C(
      () => {
        var v;
        return ((v = n.state.file) == null ? void 0 : v.sheetProtected) === !0;
      }
    ), c = C(() => {
      var v;
      return ((v = n.state.command) == null ? void 0 : v.selectAll) === !0;
    });
    function p() {
      var v, x;
      try {
        (x = (v = a.api.docApp) == null ? void 0 : v.destroy) == null || x.call(v);
      } catch {
      }
    }
    const g = [
      { label: A("dropDown.row.insert"), key: "insertRow" },
      { label: A("dropDown.row.setHeight"), key: "setRowHeight" },
      { type: "divider", key: "d1" },
      { label: A("dropDown.row.hide"), key: "hideRow" },
      { label: A("dropDown.row.unhide"), key: "unhideRow" },
      { type: "divider", key: "d2" },
      { label: A("dropDown.row.clearContent"), key: "clearRowContent" },
      { type: "divider", key: "d3" },
      { label: A("dropDown.row.del"), key: "delRow" }
    ], P = [
      { label: A("dropDown.column.insert"), key: "insertColumn" },
      { label: A("dropDown.column.setWidth"), key: "setColumnWidth" },
      { type: "divider", key: "d1" },
      { label: A("dropDown.column.hide"), key: "hideColumn" },
      { label: A("dropDown.column.unhide"), key: "unhideColumn" },
      { type: "divider", key: "d2" },
      { label: A("dropDown.column.clearContent"), key: "clearColContent" },
      { type: "divider", key: "d3" },
      { label: A("dropDown.column.del"), key: "delColumn" }
    ], E = [
      { label: A("dropDown.sheet.insert"), key: "insertSheet" },
      { label: A("dropDown.sheet.rename"), key: "renameSheet" },
      { type: "divider", key: "d1" },
      { label: A("dropDown.sheet.delCurrent"), key: "delCurrentSheet" }
    ], f = b(null), X = b(null), z = b(null);
    let W = [];
    function QA(v) {
      return c.value !== !0 ? !1 : v === "insertRow" || v === "insertColumn";
    }
    function tA(v, x) {
      return v.map((L) => L.type === "divider" ? L : {
        ...L,
        disabled: x || QA(L.key) || L.disabled === !0
      });
    }
    function YA(v) {
      var L, K, bA;
      u.value = !1;
      const x = {
        value: {
          action: v
        }
      };
      switch (v) {
        case "freezePane":
        case "unfreezePane":
        case "cleanText":
          a.run(o.PaneOperations, x);
          break;
        case "insertRow":
        case "hideRow":
        case "unhideRow":
        case "delRow":
        case "clearRowContent":
          a.run(o.RowOperations, x);
          break;
        case "setRowHeight":
          (L = z == null ? void 0 : z.value) == null || L.openPopover(
            a.api.getRowHeight(),
            (J) => {
              x.value.val = J, a.run(o.RowOperations, x);
            }
          );
          break;
        case "insertColumn":
        case "hideColumn":
        case "unhideColumn":
        case "delColumn":
        case "clearColContent":
          a.run(o.ColumnOperations, x);
          break;
        case "setColumnWidth":
          (K = X == null ? void 0 : X.value) == null || K.openPopover(
            a.api.getColumnWidth(),
            (J) => {
              x.value.val = J, a.run(o.ColumnOperations, x);
            }
          );
          break;
        case "insertSheet":
        case "delCurrentSheet":
          a.run(o.SheetOperations, x);
          break;
        case "renameSheet":
          (bA = f == null ? void 0 : f.value) == null || bA.openPopover(
            a.api.getSheetName(),
            (J) => {
              x.value.val = J, a.run(o.SheetOperations, x);
            }
          );
          break;
      }
    }
    function MA(v) {
      if (w.value === !0) {
        switch (v.preventDefault(), u.value = !1, a.api.getCursorTargetType()) {
          case "columnHeader":
            W = tA(
              P,
              h.value || O.value
            );
            break;
          case "rowHeader":
            W = tA(
              g,
              h.value || O.value
            );
            break;
          case "cells":
            let x = [
              { label: A("dropDown.pane.clearContent"), key: "cleanText" },
              { type: "divider", key: "d1" }
            ], L;
            a.api.isFrozenPane() ? L = {
              label: A("dropDown.pane.unfreeze"),
              key: "unfreezePane"
            } : L = { label: A("dropDown.pane.freeze"), key: "freezePane" }, x.push(L), W = tA(
              x,
              h.value || O.value
            );
            break;
          case "navBar":
            W = tA(E, h.value);
            break;
          default:
            W = [];
            break;
        }
        W && W.length > 0 && ee(() => {
          u.value = !0, d.value = v.clientX, m.value = v.clientY;
        });
      }
    }
    function ZA() {
      u.value = !1;
    }
    function GA(v) {
      const x = {
        copy: "C",
        paste: "V",
        cut: "X"
      };
      return `${/Mac|iPhone|iPad|iPod/i.test(navigator.platform) ? "Command" : "Ctrl"}+${x[v] || "C/V/X"}`;
    }
    function qA(v) {
      if (v === "https") {
        t.warning(A("common.httpsOnly"));
        return;
      }
      (v === "copy" || v === "paste" || v === "cut") && t.warning(
        A("common.clipboardShortcutTip", {
          shortcut: GA(v)
        })
      );
    }
    function KA() {
      return new Promise((v) => {
        const x = document.createElement("input");
        x.type = "file", x.accept = FA, x.style.display = "none", x.addEventListener(
          "change",
          () => {
            var K;
            const L = ((K = x.files) == null ? void 0 : K[0]) || null;
            if (x.remove(), L && !te(L, FA)) {
              t.warning("不支持打开该文件类型"), v(null);
              return;
            }
            if (L && L.size <= 0) {
              t.warning(A("common.emptyFileUnsupported")), v(null);
              return;
            }
            v(L);
          },
          { once: !0 }
        ), x.addEventListener(
          "cancel",
          () => {
            x.remove(), v(null);
          },
          { once: !0 }
        ), document.body.appendChild(x), x.click();
      });
    }
    async function JA() {
      var x;
      const v = await KA();
      if (!(!v || !s.value))
        try {
          n.dispatch("file/onOpening"), p(), (x = a.destroy) == null || x.call(a), s.value.innerHTML = "";
          const L = await DA({
            docId: `local-${Date.now()}`,
            mode: r == null ? void 0 : r.mode,
            file: v,
            fileName: v.name,
            user: r == null ? void 0 : r.user,
            widgetMode: r == null ? void 0 : r.widgetMode,
            mainDom: s.value,
            eventTarget: r == null ? void 0 : r.eventTarget
          });
          a.initApi(L.app), n.dispatch("file/onConnected", {
            title: document.title,
            docId: L.docId
          });
        } catch (L) {
          console.error("OpenDocument failed:", L), n.commit("file/setReady"), xA(
            "OpenDocumentFailed",
            void 0,
            r == null ? void 0 : r.eventTarget
          );
        }
    }
    return LA(() => {
      a.setSecurityErrorHandler(qA), a.api.setOpenFileHandler(JA), r != null && r.mainDom && (r.mainDom.value = s.value), DA({
        docId: r == null ? void 0 : r.docId,
        mode: r == null ? void 0 : r.mode,
        file: r == null ? void 0 : r.file,
        fileUrl: r == null ? void 0 : r.fileUrl,
        fileName: r == null ? void 0 : r.fileName,
        user: r == null ? void 0 : r.user,
        widgetMode: r == null ? void 0 : r.widgetMode,
        mainDom: s.value,
        eventTarget: r == null ? void 0 : r.eventTarget
      }).then(({ docId: v, app: x }) => {
        a.initApi(x), n.dispatch("file/onConnected", {
          title: document.title,
          docId: v
        });
      }).catch((v) => {
        console.error("OpenDocument failed:", v), n.dispatch("file/onError", v), xA(
          "OpenDocumentFailed",
          void 0,
          r == null ? void 0 : r.eventTarget
        );
      });
    }), Ae(() => {
      a.setSecurityErrorHandler(null);
    }), (v, x) => (S(), R("div", {
      class: "main-container",
      onContextmenu: pA(MA, ["prevent"])
    }, [
      i(l(zA), {
        trigger: "manual",
        show: u.value,
        x: d.value,
        y: m.value,
        options: l(W),
        onSelect: YA,
        onClickoutside: ZA
      }, null, 8, ["show", "x", "y", "options"]),
      i(Ct, {
        ref_key: "RenameSheetDialogRef",
        ref: f
      }, null, 512),
      i(Dt, {
        ref_key: "SetColumnWidthDialogRef",
        ref: X
      }, null, 512),
      i(xt, {
        ref_key: "SetRowHeightDialogRef",
        ref: z
      }, null, 512),
      i(Et),
      N("div", {
        ref_key: "mainRef",
        ref: s,
        class: "main"
      }, null, 512)
    ], 32));
  }
}), BA = Symbol("LayoutRefs");
function Ot() {
  const e = k(BA);
  if (!e) throw new Error("LayoutRefs not provided");
  return e;
}
const Ht = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAAspJREFUeAHFVz9oE1EY/90ZVCykHUynJhRUiEQcEhcTHRQ02kXikoJYXFo3g9IMFmotggrJ5Ga6WCVgOpixjQ4K1dTBVpDEOlTQnFPSwQQsdvF838mF8+7dnyS094NA8nLv/X7ve9/v++4JYPBlx1KAfFcABrAbkPENgvCkPvl0VhjMjs0QOVyAIOOmCFm+BpcgC5gRIWAY7mFAhMvw6AeSodPwew+aTij/WEdZ+oJOER0KIuY/isxK0VqA1Grg0YVx04Wa23GcmLuF1vYW7EAbuXg4wj5hRBl5tf7dXgDt7h37xPxB7qL9+w7gejhuWEglJKJjgwGFWB/JxY01wxwPjyS78oIJmDKMt37/wuOPL5FbK7XHKLR0bCNHIvAycWaQmg2uaK4AisLz6jJG2cLasRtLOXZEmwpR+mQCE5G4JamWPLHwgPufx2zSndd5jBwKw7u/D9lysa1+Inwe6ehlR8QEilaGzTfLGVMBTTaBwk3qC9W3CuH8pZRyxk5QYQk3/SZv6xhWiq/KsAElUzE5ZWlPPQrsCCv1muKAWnMTqdIc9zmP3ULdkBMoMZOhf9/LUtH0OdtK2A25FmbZ70jAZDTREznBLPttBRAxWa0XkHvItl0JSEd7J7cKvQpuEtLuk5oi1CnIfrnVkqNnuQKcel0P8nyGlfFOuiVXAHm3W2KnFdJSQGwoCDtQclG/KEvrbWK1P1Dp1TasjgSEfAGl/vNARIsbH5S2qmY3rzGRfUmck3cGg4BAv++/3+0WzJJKuyAl6WjoFDdfrN4Z9DDYkCKggnZ89tm0Yin9bujtxipZx1lEnBQxgwB1EpEmFu6bFpJKo2Z5zhSFe2euwA6GI1j6uorC52VHViKR3r3WWU8bsqqGjtrxTsL1e4HItv8TboFdUkVZxixcgzy/Z+vVp/d9546zm7kwzO6Ju3I9p6iL8p/b9XT+4V/kpCewChFx3wAAAABJRU5ErkJggg==", Nt = "data:image/png;base64, ", D = {
  width: 4215,
  image: Nt
}, M = /* @__PURE__ */ H({
  __name: "CommandBigIconTextButton",
  props: {
    cmd: {},
    label: {},
    showArrow: { type: Boolean },
    x: {},
    y: {},
    resourceImage: {},
    imageWidth: {}
  },
  setup(e) {
    const A = T(), t = e, n = C(() => A == null ? void 0 : A.getters["command/can"](t.cmd)), a = k(I);
    function r() {
      a.run(t.cmd, void 0);
    }
    return (s, u) => (S(), R("div", {
      onClick: pA(r, ["stop"])
    }, [
      i(l(ne), {
        label: e.label,
        "resource-image": e.resourceImage ?? l(D).image,
        disabled: !n.value,
        showArrow: e.showArrow,
        x: e.x,
        y: e.y,
        "image-width": e.imageWidth ?? l(D).width
      }, null, 8, ["label", "resource-image", "disabled", "showArrow", "x", "y", "image-width"])
    ]));
  }
}), Lt = { style: { display: "flex", gap: "8px" } }, zt = /* @__PURE__ */ H({
  __name: "FileButtonGroup",
  setup(e) {
    const A = fA(), { t } = sA();
    function n(a) {
      location.protocol === "https:" || location.hostname === "localhost" || location.hostname === "127.0.0.1" || (a.preventDefault(), a.stopPropagation(), a.stopImmediatePropagation(), A.warning(t("common.httpsOnly")));
    }
    return (a, r) => (S(), R("div", Lt, [
      i(M, {
        cmd: l(o).Open,
        label: a.$t("toolbar.file.open"),
        x: 0,
        y: -30
      }, null, 8, ["cmd", "label"]),
      i(l(G), {
        vertical: !0,
        height: 65,
        margin: "0px"
      }),
      i(M, {
        cmd: l(o).Export,
        label: a.$t("toolbar.file.exportDocument"),
        x: -24,
        y: -30
      }, null, 8, ["cmd", "label"]),
      i(M, {
        cmd: l(o).ExportPDF,
        label: a.$t("toolbar.file.exportPDF"),
        x: -48,
        y: -30,
        onClickCapture: n
      }, null, 8, ["cmd", "label"])
    ]));
  }
}), Rt = { style: { display: "flex", gap: "8px" } }, kt = /* @__PURE__ */ H({
  __name: "ClipboardGroup",
  setup(e) {
    const A = fA(), { t } = sA(), n = {
      width: 737,
      image: oe
    };
    function a(r) {
      location.protocol === "https:" || location.hostname === "localhost" || location.hostname === "127.0.0.1" || (r.preventDefault(), r.stopPropagation(), r.stopImmediatePropagation(), A.warning(t("common.httpsOnly")));
    }
    return (r, s) => (S(), R("div", Rt, [
      i(M, {
        cmd: l(o).Copy,
        label: r.$t("toolbar.start.copy"),
        "resource-image": n.image,
        "image-width": n.width,
        x: -96,
        y: -30
      }, null, 8, ["cmd", "label", "resource-image", "image-width"]),
      i(M, {
        cmd: l(o).Paste,
        label: r.$t("toolbar.start.paste"),
        "resource-image": n.image,
        "image-width": n.width,
        x: -72,
        y: -30,
        onClickCapture: a
      }, null, 8, ["cmd", "label", "resource-image", "image-width"])
    ]));
  }
}), Tt = /* @__PURE__ */ H({
  __name: "CommandAlignHorizontalGroup",
  props: {
    cmd: {}
  },
  setup(e) {
    const A = T(), t = e, n = C(() => A == null ? void 0 : A.getters["command/can"](t.cmd)), a = C(() => A == null ? void 0 : A.getters["command/getVal"](t.cmd)), r = k(I);
    function s(u) {
      const d = { value: u };
      r.run(t.cmd, d);
    }
    return (u, d) => {
      const m = B("n-space");
      return S(), j(m, null, {
        default: y(() => [
          i(l(Q), {
            active: a.value === "left",
            disabled: !n.value,
            onClick: d[0] || (d[0] = (h) => s("left")),
            "resource-image": l(D).image,
            x: -368,
            y: -56,
            tooltip: u.$t("toolbar.start.horizontalAlignLeft"),
            "image-width": l(D).width,
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
          i(l(Q), {
            active: a.value === "center",
            disabled: !n.value,
            onClick: d[1] || (d[1] = (h) => s("center")),
            "resource-image": l(D).image,
            x: -384,
            y: -56,
            tooltip: u.$t("toolbar.start.horizontalAlignCenter"),
            "image-width": l(D).width,
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
          i(l(Q), {
            active: a.value === "right",
            disabled: !n.value,
            onClick: d[2] || (d[2] = (h) => s("right")),
            "resource-image": l(D).image,
            x: -400,
            y: -56,
            tooltip: u.$t("toolbar.start.horizontalAlignRight"),
            "image-width": l(D).width,
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
          i(l(Q), {
            active: a.value === "justify",
            disabled: !n.value,
            onClick: d[3] || (d[3] = (h) => s("justify")),
            "resource-image": l(D).image,
            x: -416,
            y: -56,
            tooltip: u.$t("toolbar.start.horizontalAlignJustify"),
            "image-width": l(D).width,
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
          i(l(Q), {
            active: a.value === "distributed",
            disabled: !n.value,
            onClick: d[4] || (d[4] = (h) => s("distributed")),
            "resource-image": l(D).image,
            x: -860,
            y: -56,
            "image-width": l(D).width,
            tooltip: u.$t("toolbar.start.horizontalAlignDistribute"),
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"])
        ]),
        _: 1
      });
    };
  }
}), It = /* @__PURE__ */ H({
  __name: "CommandAlignVerticalGroup",
  props: {
    cmd: {}
  },
  setup(e) {
    const A = T(), t = e, n = C(() => A == null ? void 0 : A.getters["command/can"](t.cmd)), a = C(() => A == null ? void 0 : A.getters["command/getVal"](t.cmd)), r = k(I);
    function s(u) {
      const d = { value: u };
      r.run(t.cmd, d);
    }
    return (u, d) => {
      const m = B("n-space");
      return S(), j(m, null, {
        default: y(() => [
          i(l(Q), {
            active: a.value === "top",
            disabled: !n.value,
            onClick: d[0] || (d[0] = (h) => s("top")),
            "resource-image": l(D).image,
            x: -208,
            y: -56,
            tooltip: u.$t("toolbar.start.verticalAlignTop"),
            "image-width": l(D).width,
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
          i(l(Q), {
            active: a.value === "center",
            disabled: !n.value,
            onClick: d[1] || (d[1] = (h) => s("center")),
            "resource-image": l(D).image,
            x: -224,
            y: -56,
            tooltip: u.$t("toolbar.start.verticalAlignCenter"),
            "image-width": l(D).width,
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
          i(l(Q), {
            active: a.value === "bottom",
            disabled: !n.value,
            onClick: d[2] || (d[2] = (h) => s("bottom")),
            "resource-image": l(D).image,
            x: -240,
            y: -56,
            tooltip: u.$t("toolbar.start.verticalAlignBottom"),
            "image-width": l(D).width,
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"])
        ]),
        _: 1
      });
    };
  }
}), Wt = { class: "toolbar-group" }, jt = /* @__PURE__ */ H({
  __name: "ParaStyleGroup",
  setup(e) {
    return (A, t) => {
      const n = B("n-space");
      return S(), R("div", Wt, [
        i(n, { vertical: "" }, {
          default: y(() => [
            i(It, {
              cmd: l(o).AlignVertical
            }, null, 8, ["cmd"]),
            i(Tt, {
              cmd: l(o).AlignHorizontal
            }, null, 8, ["cmd"])
          ]),
          _: 1
        })
      ]);
    };
  }
}), Bt = /* @__PURE__ */ V(jt, [["__scopeId", "data-v-d0892252"]]), nA = /* @__PURE__ */ H({
  __name: "CommandSmallButton",
  props: {
    cmd: {},
    x: {},
    y: {},
    tooltip: {}
  },
  setup(e) {
    const A = T(), t = e, n = C(() => A == null ? void 0 : A.getters["command/can"](t.cmd)), a = C(() => A == null ? void 0 : A.getters["command/active"](t.cmd)), r = k(I);
    function s() {
      const d = { value: !a.value };
      r.run(t.cmd, d);
    }
    return (u, d) => (S(), j(l(Q), {
      onClick: s,
      "resource-image": l(D).image,
      disabled: !n.value,
      x: e.x,
      y: e.y,
      "image-width": l(D).width,
      tooltip: e.tooltip,
      active: a.value
    }, null, 8, ["resource-image", "disabled", "x", "y", "image-width", "tooltip", "active"]));
  }
}), EA = /* @__PURE__ */ H({
  __name: "CommandColorPaletteSmallButton",
  props: {
    cmd: {},
    tooltip: {},
    x: {},
    y: {},
    showFill: { type: Boolean }
  },
  setup(e) {
    const A = T(), t = k(I);
    let n = b([]), a = b([]);
    const r = b(!1), s = e, u = C(() => A == null ? void 0 : A.getters["command/can"](s.cmd)), d = C(() => A == null ? void 0 : A.getters["command/getVal"](s.cmd)), m = C(() => A == null ? void 0 : A.getters["file/recentColors"]);
    function h(c) {
      const p = { value: c };
      t.run(s.cmd, p), A.commit("file/addRecentColors", c);
    }
    function w(c) {
      var p;
      if (r.value = c, c) {
        let g = A == null ? void 0 : A.getters["file/colorPalette"];
        if (!g) {
          const P = (p = t.api) == null ? void 0 : p.getPalette();
          P && (g = kA(P), A.commit("file/setColorPalette", g));
        }
        n.value = g == null ? void 0 : g.standardColors, a.value = g == null ? void 0 : g.themeColors;
      }
    }
    function O() {
      if (!s.showFill) return;
      const c = { value: null };
      t.run(s.cmd, c);
    }
    return (c, p) => (S(), j(l(RA), {
      val: d.value,
      "standard-colors": l(n),
      "theme-colors": l(a),
      "recent-colors": m.value,
      showFill: e.showFill,
      onSelect: h,
      onShow: w,
      onClearFill: O
    }, {
      default: y(() => [
        i(l(vA), {
          "resource-image": l(D).image,
          disabled: !u.value,
          x: e.x,
          y: e.y,
          "image-width": l(D).width,
          tooltip: e.tooltip,
          "sub-showing": r.value,
          "show-color-cube": !0,
          color: e.showFill ? d.value || "" : d.value || "rgb(0, 0, 0)",
          onClick: p[0] || (p[0] = pA(() => {
          }, ["stop"]))
        }, null, 8, ["resource-image", "disabled", "x", "y", "image-width", "tooltip", "sub-showing", "color"])
      ]),
      _: 1
    }, 8, ["val", "standard-colors", "theme-colors", "recent-colors", "showFill"]));
  }
}), XA = /* @__PURE__ */ H({
  __name: "CommandEditableSelect",
  props: {
    cmd: {},
    options: {},
    width: {},
    type: {},
    validateInput: { type: Function }
  },
  setup(e) {
    const A = T(), t = e, n = C(() => A == null ? void 0 : A.getters["command/can"](t.cmd)), a = C(() => A == null ? void 0 : A.getters["command/getVal"](t.cmd)), r = k(I);
    function s(u) {
      const d = { value: u };
      r.run(t.cmd, d), A.commit("command/setState", {
        cmd: t.cmd,
        ui: { value: u }
      });
    }
    return (u, d) => (S(), j(l(ae), {
      "model-value": a.value,
      "onUpdate:modelValue": s,
      options: e.options,
      disabled: !n.value,
      width: e.width,
      "validate-input": e.validateInput,
      type: e.type
    }, null, 8, ["model-value", "options", "disabled", "width", "validate-input", "type"]));
  }
}), Ut = { class: "trigger-wrapper" }, Vt = /* @__PURE__ */ H({
  __name: "CommandSmallIconPopoverButton",
  props: {
    cmd: {},
    tooltip: {},
    x: {},
    y: {}
  },
  emits: ["close", "open", "clickoutside"],
  setup(e, { emit: A }) {
    const t = T(), n = e, a = C(() => t == null ? void 0 : t.getters["command/can"](n.cmd)), r = k(I), s = b(!1), u = b(!1), d = A;
    lA(s, (O) => {
      u.value = O, d(O ? "open" : "close", h);
    });
    function m() {
      d("clickoutside", w);
    }
    function h(O) {
      const c = { value: O };
      r.run(n.cmd, c);
    }
    function w() {
      s.value = !1;
    }
    return (O, c) => (S(), R("div", null, [
      i(l(re), {
        trigger: "manual",
        show: s.value,
        "onUpdate:show": c[1] || (c[1] = (p) => s.value = p),
        onClickoutside: m
      }, {
        trigger: y(() => [
          N("div", Ut, [
            i(l(vA), {
              "resource-image": l(D).image,
              disabled: !a.value,
              x: e.x,
              y: e.y,
              "image-width": l(D).width,
              tooltip: e.tooltip,
              "sub-showing": u.value,
              onClick: c[0] || (c[0] = (p) => s.value = !s.value)
            }, null, 8, ["resource-image", "disabled", "x", "y", "image-width", "tooltip", "sub-showing"])
          ])
        ]),
        default: y(() => [
          TA(O.$slots, "popover", {
            runCommand: h,
            close: w
          }, void 0, !0)
        ]),
        _: 3
      }, 8, ["show"])
    ]));
  }
}), Qt = /* @__PURE__ */ V(Vt, [["__scopeId", "data-v-7bdfd6ed"]]), Yt = { class: "menu-item" }, Mt = { class: "menu-item-label" }, Zt = /* @__PURE__ */ H({
  __name: "CommandColorPaletteMenuText",
  props: {
    text: {},
    val: {},
    space: {},
    x: {},
    y: {}
  },
  emits: ["select", "show"],
  setup(e, { emit: A }) {
    const t = T(), n = C(() => t == null ? void 0 : t.getters["file/recentColors"]), a = k(I);
    let r = b([]), s = b([]);
    const d = b(e.val), m = C(() => d.value ? d.value.hex ? wA(d.value.hex) : d.value : "rgb(0, 0, 0)"), h = A;
    function w(c) {
      typeof c != "string" && c.hex ? d.value = wA(c.hex) : d.value = c, h("select", c), t.commit("file/addRecentColors", c);
    }
    function O(c) {
      var p;
      if (h("show", c), c) {
        let g = t == null ? void 0 : t.getters["file/colorPalette"];
        if (!g) {
          const P = (p = a.api) == null ? void 0 : p.getPalette();
          P && (g = kA(P), t.commit("file/setColorPalette", g));
        }
        r.value = g == null ? void 0 : g.standardColors, s.value = g == null ? void 0 : g.themeColors;
      }
    }
    return (c, p) => {
      const g = B("n-icon");
      return S(), j(l(RA), {
        val: m.value,
        "standard-colors": l(r),
        "theme-colors": l(s),
        "recent-colors": n.value,
        placement: "right",
        onSelect: w,
        onShow: O,
        space: e.space
      }, {
        default: y(() => [
          N("div", Yt, [
            N("span", Mt, [
              i(l(gA), {
                x: e.x,
                y: e.y,
                size: 16,
                source: l(D).image,
                "image-width": l(D).width,
                "show-color-cube": !0,
                color: m.value,
                style: { "margin-right": "10px" }
              }, null, 8, ["x", "y", "source", "image-width", "color"]),
              eA(" " + Y(e.text), 1)
            ]),
            i(g, { size: "12" }, {
              default: y(() => [
                i(l(IA))
              ]),
              _: 1
            })
          ])
        ]),
        _: 1
      }, 8, ["val", "standard-colors", "theme-colors", "recent-colors", "space"]);
    };
  }
}), Gt = /* @__PURE__ */ V(Zt, [["__scopeId", "data-v-f2fbc462"]]), qt = { class: "menu-item" }, Kt = { class: "menu-item-label" }, Jt = { class: "border-style-sample" }, _t = /* @__PURE__ */ H({
  __name: "BorderStylesMenuText",
  props: {
    text: {},
    val: {},
    space: {}
  },
  emits: ["show", "select"],
  setup(e, { emit: A }) {
    const t = b(!1), n = A;
    lA(t, (u) => {
      n("show", u);
    });
    const a = [
      {
        value: "hair",
        sampleX: 0,
        sampleY: -185
      },
      {
        value: "dashDotDot",
        sampleX: -160,
        sampleY: -185
      },
      {
        value: "dashDot",
        sampleX: -323,
        sampleY: -185
      },
      {
        value: "dotted",
        sampleX: -486,
        sampleY: -185
      },
      {
        value: "dashed",
        sampleX: -649,
        sampleY: -185
      },
      {
        value: "thin",
        sampleX: -812,
        sampleY: -185
      },
      {
        value: "mediumDashDotDot",
        sampleX: -972.5,
        sampleY: -185
      },
      {
        value: "slantDashDot",
        sampleX: -1135,
        sampleY: -185
      },
      {
        value: "mediumDashDot",
        sampleX: -1298,
        sampleY: -185
      },
      {
        value: "mediumDashed",
        sampleX: -1461,
        sampleY: -185
      },
      {
        value: "medium",
        sampleX: -1624,
        sampleY: -185
      },
      {
        value: "thick",
        sampleX: -1784.5,
        sampleY: -185
      },
      {
        value: "double",
        sampleX: -1945,
        sampleY: -185
      }
    ];
    function r(u, d) {
      return {
        backgroundRepeat: "no-repeat",
        display: "inline-block",
        backgroundImage: `url("${D.image}")`,
        backgroundPosition: `${u * 2}px ${d * 2}px`,
        backgroundSize: `${D.width}px auto`,
        transform: "scale(0.5)",
        transformOrigin: "top left",
        width: "320px",
        height: "6px"
      };
    }
    function s(u) {
      n("select", u), t.value = !1;
    }
    return (u, d) => {
      const m = B("n-icon");
      return S(), R("div", null, [
        i(l(jA), {
          show: t.value,
          "onUpdate:show": d[0] || (d[0] = (h) => t.value = h),
          options: a,
          onSelect: s,
          placement: "right-start",
          "max-height": 400,
          space: e.space
        }, {
          option: y(({ item: h }) => [
            N("div", Jt, [
              N("span", {
                style: oA(r(h.sampleX, h.sampleY))
              }, null, 4)
            ])
          ]),
          default: y(() => [
            N("div", qt, [
              N("span", Kt, [
                i(l(gA), {
                  x: -788,
                  y: -56,
                  "image-width": l(D).width,
                  source: l(D).image,
                  size: 16,
                  style: { "margin-right": "10px" }
                }, null, 8, ["image-width", "source"]),
                eA(" " + Y(e.text), 1)
              ]),
              i(m, { size: "12" }, {
                default: y(() => [
                  i(l(IA))
                ]),
                _: 1
              })
            ])
          ]),
          _: 1
        }, 8, ["show", "space"])
      ]);
    };
  }
}), $t = /* @__PURE__ */ V(_t, [["__scopeId", "data-v-6563d389"]]), An = { class: "global-basic-display-text border-panel-label" }, en = ["onClick"], tn = { class: "content" }, nn = { class: "global-basic-display-text border-panel-label" }, on = /* @__PURE__ */ H({
  __name: "BorderDropdownMenu",
  setup(e) {
    const A = b(!1);
    function t(w) {
      A.value != !0 && w && w();
    }
    const n = b(""), a = b(""), r = [
      {
        // 所有框线
        key: "all",
        x: -548,
        y: -56
      },
      {
        // 无框线
        key: "none",
        x: -628,
        y: -56
      },
      {
        // 内框线
        key: "inner",
        x: -528,
        y: -56
      },
      {
        // 外侧框线
        key: "outer",
        x: -568,
        y: -56
      },
      {
        // 对角线上边框
        key: "diagonalUp",
        x: -588,
        y: -56
      },
      {
        // 对角线下边框
        key: "diagonalDown",
        x: -608,
        y: -56
      },
      {
        // 左边框
        key: "left",
        x: -728,
        y: -56
      },
      {
        // 垂直内线
        key: "verticalInner",
        x: -748,
        y: -56
      },
      {
        // 右边框
        key: "right",
        x: -708,
        y: -56
      },
      {
        // 上边框
        key: "top",
        x: -668,
        y: -56
      },
      {
        // 水平内线
        key: "horizontalInner",
        x: -648,
        y: -56
      },
      {
        // 下边框
        key: "bottom",
        x: -688,
        y: -56
      }
    ];
    function s() {
      n.value || (n.value = "rgb(0, 0, 0)"), a.value = "thin";
    }
    function u(w, O, c) {
      w.key === "none" && (a.value = "none", n.value = ""), O({
        position: w.key,
        color: n.value,
        style: a.value
      }), c();
    }
    function d(w) {
      n.value = w;
    }
    function m(w) {
      a.value = w;
    }
    function h(w) {
      setTimeout(() => {
        A.value = w;
      }, 200);
    }
    return (w, O) => (S(), j(Qt, {
      cmd: l(o).Border,
      x: -548,
      y: -56,
      tooltip: w.$t("toolbar.start.border.title"),
      onOpen: s,
      onClickoutside: t
    }, {
      popover: y(({ runCommand: c, close: p }) => [
        i(l(le), { "max-height": 600 }, {
          default: y(() => [
            N("div", An, Y(w.$t("toolbar.start.border.title")), 1),
            (S(), R(se, null, ie(r, (g) => N("div", {
              key: g.key,
              class: "global-menu-list-item menu-text",
              onClick: (P) => u(g, c, p)
            }, [
              N("span", tn, [
                i(l(gA), {
                  x: g.x,
                  y: g.y,
                  source: l(D).image,
                  size: 16,
                  "image-width": l(D).width,
                  style: { "margin-right": "10px" }
                }, null, 8, ["x", "y", "source", "image-width"]),
                N("span", null, Y(w.$t("toolbar.start.border.type." + g.key)), 1)
              ])
            ], 8, en)), 64)),
            i(l(G), { margin: "8px 0" }),
            N("div", nn, Y(w.$t("toolbar.start.border.style")), 1),
            i(Gt, {
              text: w.$t("toolbar.start.border.borderColor"),
              onSelect: d,
              x: -768.5,
              y: -56,
              onShow: h,
              val: n.value,
              class: "global-menu-list-item menu-text",
              space: 23
            }, null, 8, ["text", "val"]),
            i($t, {
              text: w.$t("toolbar.start.border.borderStyle"),
              onSelect: m,
              onShow: h,
              class: "global-menu-list-item menu-text",
              space: 23
            }, null, 8, ["text"])
          ]),
          _: 2
        }, 1024)
      ]),
      _: 1
    }, 8, ["cmd", "tooltip"]));
  }
}), an = /* @__PURE__ */ V(on, [["__scopeId", "data-v-d513b943"]]), rn = {
  common: {
    confirm: "Confirm",
    cancel: "Cancel",
    httpsOnly: "Please use this feature in an HTTPS environment",
    clipboardShortcutTip: "Browser security restrictions blocked this button action. Please use the {shortcut} keyboard shortcut.",
    emptyFileUnsupported: "Opening 0KB empty files is not supported."
  },
  toolbar: {
    file: {
      title: "FILE",
      export: "Export",
      exportDocument: "Export",
      exportPDF: "Export PDF",
      open: "Open"
    },
    start: {
      title: "START",
      undo: "Undo",
      redo: "Redo",
      copy: "Copy",
      cut: "Cut",
      paste: "Paste",
      bold: "Bold",
      italic: "Italic",
      underline: "Underline",
      strikeout: "Strikeout",
      fontClolor: "Font Clolor",
      fillClolor: "Fill Clolor",
      verticalAlignTop: "Align Top",
      verticalAlignCenter: "Align Center",
      verticalAlignBottom: "Align Bottom",
      horizontalAlignLeft: "Align Left",
      horizontalAlignCenter: "Align Center",
      horizontalAlignRight: "Align Right",
      horizontalAlignJustify: "Align Justify",
      horizontalAlignDistribute: "Align Distribute",
      numFormat: {
        general: "General",
        num: "Num",
        scientificNotation: "Scientific Notation",
        accounting: "Accounting",
        currency: "Currency",
        date: "Date",
        time: "Time",
        percentage: "Percentage",
        fraction: "Fraction",
        text: "Text",
        decimalIncrease: "Increase Decimal",
        decimalDecrease: "Decrease Decimal",
        currencyList: {
          RMB: "RMB",
          Dollar: "Dollar",
          EUR: "EUR",
          GBP: "GBP",
          JPY: "JPY",
          none: "None"
        }
      },
      border: {
        title: "BORDER",
        type: {
          all: "All",
          none: "None",
          inner: "Inner",
          outer: "Outer",
          diagonalUp: "Diagonal Up",
          diagonalDown: "Diagonal Down",
          left: "Left",
          verticalInner: "Vertical Inner",
          right: "Right",
          top: "Top",
          horizontalInner: "Horizontal Inner",
          bottom: "Bottom"
        },
        style: "STYLE",
        borderColor: "Border Color",
        borderStyle: "Border Style"
      },
      search: "Search",
      findPlaceHolder: "Please input search content",
      next: "Next",
      prev: "Prev"
    }
  },
  statusBar: {
    fullscreen: "Full Screen"
  },
  dropDown: {
    pane: {
      freeze: "Freeze Panes",
      unfreeze: "Unfreeze Panes",
      clearContent: "Clear Content"
    },
    row: {
      insert: "Insert Row",
      del: "Delete Row",
      hide: "Hide Row",
      unhide: "Unhide Row",
      setHeight: "Set Row Height",
      clearContent: "Clear Content"
    },
    column: {
      insert: "Insert Column",
      del: "Delete Column",
      hide: "Hide Column",
      unhide: "Unhide Column",
      setWidth: "Set Column Width",
      clearContent: "Clear Content"
    },
    sheet: {
      insert: "Insert Worksheet",
      rename: "Rename Worksheet",
      delCurrent: "Delete Current Worksheet"
    }
  },
  dialog: {
    sheetRename: {
      title: "Rename Sheet"
    },
    columnWidthSet: {
      title: "Set Column Width",
      unit: "CHAR",
      errorMessageNum: "Column width must be between 0 and 255 characters"
    },
    rowHeightSet: {
      title: "Set Row Height",
      unit: "PT",
      errorMessageNum: "Row height must be between 0 and 409"
    }
  }
}, ln = WA(de, rn), UA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: ln
}, Symbol.toStringTag, { value: "Module" })), sn = {
  common: {
    confirm: "确定",
    cancel: "取消",
    httpsOnly: "请在https环境下使用该功能",
    clipboardShortcutTip: "受浏览器安全限制，无法通过按钮完成该操作，请使用快捷键 {shortcut}。",
    emptyFileUnsupported: "不支持打开 0KB 的空文件"
  },
  toolbar: {
    file: {
      title: "文件",
      export: "导出",
      exportDocument: "导出",
      exportPDF: "导出PDF",
      open: "打开"
    },
    start: {
      title: "开始",
      undo: "撤销",
      redo: "重做",
      copy: "复制",
      cut: "剪切",
      paste: "粘贴",
      bold: "粗体",
      italic: "斜体",
      underline: "下划线",
      strikeout: "删除线",
      fontClolor: "字体颜色",
      fillClolor: "填充颜色",
      verticalAlignTop: "顶端对齐",
      verticalAlignCenter: "垂直居中",
      verticalAlignBottom: "底部对齐",
      horizontalAlignLeft: "左对齐",
      horizontalAlignCenter: "居中对齐",
      horizontalAlignRight: "右对齐",
      horizontalAlignJustify: "两端对齐",
      horizontalAlignDistribute: "分散对齐",
      numFormat: {
        general: "常规",
        num: "数值",
        scientificNotation: "科学计数法",
        accounting: "会计",
        currency: "货币",
        date: "日期",
        time: "时间",
        percentage: "百分比",
        fraction: "分数",
        text: "文本",
        decimalIncrease: "增加小数位",
        decimalDecrease: "减少小数位",
        currencyList: {
          RMB: "人民币",
          Dollar: "美元",
          EUR: "欧元",
          GBP: "英镑",
          JPY: "日元",
          none: "无"
        }
      },
      border: {
        title: "边框",
        type: {
          all: "所有框线",
          none: "无框线",
          inner: "内框线",
          outer: "外侧框线",
          diagonalUp: "对角线上边框",
          diagonalDown: "对角线下边框",
          left: "左边框",
          verticalInner: "垂直内线",
          right: "右边框",
          top: "上边框",
          horizontalInner: "水平内线",
          bottom: "下边框"
        },
        style: "样式",
        borderColor: "边框颜色",
        borderStyle: "边框样式"
      },
      search: "搜索",
      findPlaceHolder: "请输入查找内容",
      next: "下一个",
      prev: "上一个"
    }
  },
  statusBar: {
    fullscreen: "全屏"
  },
  dropDown: {
    pane: {
      freeze: "冻结窗格",
      unfreeze: "取消冻结窗格",
      clearContent: "清除内容"
    },
    row: {
      insert: "插入行",
      del: "删除行",
      hide: "隐藏行",
      unhide: "取消隐藏行",
      setHeight: "设置行高",
      clearContent: "清除内容"
    },
    column: {
      insert: "插入列",
      del: "删除列",
      hide: "隐藏列",
      unhide: "取消隐藏列",
      setWidth: "设置列宽",
      clearContent: "清除内容"
    },
    sheet: {
      insert: "插入工作簿",
      rename: "重命名工作簿",
      delCurrent: "删除当前工作簿"
    }
  },
  dialog: {
    sheetRename: {
      title: "重命名工作簿"
    },
    columnWidthSet: {
      title: "设置列宽",
      unit: "字符",
      errorMessageNum: "列宽必须在0至255字符之间"
    },
    rowHeightSet: {
      title: "设置行高",
      unit: "磅",
      errorMessageNum: "行高必须在0至409之间"
    }
  }
}, dn = WA(ue, sn), VA = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: dn
}, Symbol.toStringTag, { value: "Module" })), un = /* @__PURE__ */ Object.assign({ "./en-US.ts": UA, "./zh-CN.ts": VA }), cn = /* @__PURE__ */ Object.assign({ "./en-US.ts": UA, "./zh-CN.ts": VA });
function mn() {
  let e = {};
  return OA(un, e), OA(cn, e), e;
}
function OA(e, A) {
  for (let t in e)
    if (e[t].default) {
      let n = t.substr(t.lastIndexOf("/") + 1, 5);
      A[n] ? A[n] = {
        ...e[n],
        ...e[t].default
      } : A[n] = e[t].default;
    }
}
let AA = "zh-CN";
function fn(e) {
  return AA = e || AA, ce({
    legacy: !1,
    locale: AA,
    messages: mn(),
    globalInjection: !0
  });
}
const hn = { class: "toolbar-group" }, pn = /* @__PURE__ */ H({
  __name: "TextStyleGroup",
  setup(e) {
    const A = b([]), t = me("xlsx", AA);
    async function n() {
      (_ == null || _.length == 0) && await he(), _ && _.length !== A.value.length && (A.value = _.map(({ fullName: a }) => ({
        label: a,
        value: a
      })));
    }
    return (a, r) => {
      const s = B("n-space");
      return S(), R("div", hn, [
        i(s, { vertical: "" }, {
          default: y(() => [
            i(s, null, {
              default: y(() => [
                N("span", { onClick: n }, [
                  i(XA, {
                    cmd: l(o).FontName,
                    options: A.value,
                    width: 140,
                    type: "font"
                  }, null, 8, ["cmd", "options"])
                ]),
                i(XA, {
                  cmd: l(o).FontSize,
                  options: l(t),
                  width: 70,
                  "validate-input": l(fe)
                }, null, 8, ["cmd", "options", "validate-input"])
              ]),
              _: 1
            }),
            i(s, null, {
              default: y(() => [
                i(nA, {
                  cmd: l(o).Bold,
                  x: -432,
                  y: -56,
                  tooltip: a.$t("toolbar.start.bold"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                i(nA, {
                  cmd: l(o).Italic,
                  x: -448,
                  y: -56,
                  tooltip: a.$t("toolbar.start.italic"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                i(nA, {
                  cmd: l(o).Underline,
                  x: -464,
                  y: -56,
                  tooltip: a.$t("toolbar.start.underline"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                i(nA, {
                  cmd: l(o).Strikeout,
                  x: -480,
                  y: -56,
                  tooltip: a.$t("toolbar.start.strikeout"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                i(an),
                i(EA, {
                  cmd: l(o).FontColor,
                  x: -496,
                  y: -56,
                  tooltip: a.$t("toolbar.start.fontClolor"),
                  class: "global-small-icon-dropdown-button"
                }, null, 8, ["cmd", "tooltip"]),
                i(EA, {
                  cmd: l(o).FillColor,
                  x: -320,
                  y: -56,
                  tooltip: a.$t("toolbar.start.fillClolor"),
                  "show-fill": !0,
                  class: "global-small-icon-dropdown-button"
                }, null, 8, ["cmd", "tooltip"])
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]);
    };
  }
}), vn = /* @__PURE__ */ V(pn, [["__scopeId", "data-v-255f5311"]]), gn = { style: { display: "flex", gap: "8px" } }, bn = /* @__PURE__ */ H({
  __name: "UndoRedoGroup",
  setup(e) {
    return (A, t) => (S(), R("div", gn, [
      i(M, {
        cmd: l(o).Undo,
        label: A.$t("toolbar.start.undo"),
        x: -96,
        y: -30
      }, null, 8, ["cmd", "label"]),
      i(M, {
        cmd: l(o).Redo,
        label: A.$t("toolbar.start.redo"),
        x: -72,
        y: -30
      }, null, 8, ["cmd", "label"])
    ]));
  }
}), dA = /* @__PURE__ */ H({
  __name: "CommandSmallButtonNonActive",
  props: {
    cmd: {},
    tooltip: {},
    x: {},
    y: {},
    val: {}
  },
  setup(e) {
    const A = T(), t = e, n = C(() => A == null ? void 0 : A.getters["command/can"](t.cmd)), a = k(I);
    function r() {
      const s = { value: t.val };
      a.run(t.cmd, s);
    }
    return (s, u) => (S(), j(l(Q), {
      onClick: r,
      "resource-image": l(D).image,
      disabled: !n.value,
      x: e.x,
      y: e.y,
      tooltip: e.tooltip,
      "image-width": l(D).width
    }, null, 8, ["resource-image", "disabled", "x", "y", "tooltip", "image-width"]));
  }
}), wn = /* @__PURE__ */ H({
  __name: "CommandSmallDropDownButton",
  props: {
    cmd: {},
    tooltip: {},
    x: {},
    y: {},
    imageWidth: {},
    dropdownOptions: {}
  },
  setup(e) {
    const A = T(), t = e, n = C(() => A == null ? void 0 : A.getters["command/can"](t.cmd)), a = k(I), r = b(!1);
    function s(d) {
      u(d);
    }
    function u(d) {
      const m = { value: d };
      a.run(t.cmd, m);
    }
    return (d, m) => (S(), R("div", null, [
      i(l(zA), {
        trigger: "click",
        placement: "bottom-start",
        options: e.dropdownOptions,
        onSelect: s,
        "onUpdate:show": m[0] || (m[0] = (h) => r.value = h)
      }, {
        default: y(() => [
          N("span", null, [
            i(l(vA), {
              "resource-image": l(D).image,
              disabled: !n.value,
              x: e.x,
              y: e.y,
              "image-width": l(D).width,
              tooltip: e.tooltip,
              "sub-showing": r.value
            }, null, 8, ["resource-image", "disabled", "x", "y", "image-width", "tooltip", "sub-showing"])
          ])
        ]),
        _: 1
      }, 8, ["options"])
    ]));
  }
}), yn = /* @__PURE__ */ H({
  __name: "CommandSelectNumFormat",
  props: {
    show: { type: Boolean },
    cmd: {}
  },
  emits: ["update:show"],
  setup(e, { emit: A }) {
    const { t } = sA(), n = T(), a = e, r = A, s = k(I), u = C(() => a.show == !0 ? {
      backgroundColor: "var(--disable-button-border)"
    } : {
      backgroundColor: "transparent"
    }), d = C(() => n == null ? void 0 : n.getters["command/can"](a.cmd)), m = C(
      () => (n == null ? void 0 : n.getters["file/numFormatListValues"]) || []
    ), h = C(() => {
      let E = n == null ? void 0 : n.getters["command/getVal"](a.cmd);
      return E || (E = m.value[0]), E && !m.value.includes(E) && (E = m.value[0]), E;
    }), w = C(() => {
      const E = c.value.find((f) => f.value == h.value);
      return E ? E.label : "";
    }), O = b(!1);
    let c = p();
    function p() {
      const E = O.value ? s.api.getNumformatExamples(m.value) : [];
      return C(
        () => [
          "general",
          "num",
          "scientificNotation",
          "accounting",
          "currency",
          "date",
          "time",
          "percentage",
          "fraction",
          "text"
        ].map((f, X) => {
          var z, W;
          return {
            label: t("toolbar.start.numFormat." + f),
            value: ((z = m.value) == null ? void 0 : z[X]) || "",
            example: O.value ? E[X] || "" : void 0,
            checked: h.value == ((W = m.value) == null ? void 0 : W[X])
          };
        })
      );
    }
    function g(E) {
      r("update:show", E), E && (O.value = !0, c = p());
    }
    function P(E) {
      const f = { value: E };
      s.run(a.cmd, f);
    }
    return (E, f) => {
      const X = B("n-icon");
      return S(), R("div", null, [
        i(l(jA), {
          show: e.show,
          options: l(c),
          disabled: !d.value,
          currentVal: h.value,
          onSelect: P,
          "onUpdate:show": g,
          showChecked: !0
        }, {
          option: y(({ item: z, checked: W }) => [
            TA(E.$slots, "option", {
              item: z,
              checked: W
            }, void 0, !0)
          ]),
          default: y(() => [
            N("span", null, [
              i(l(mA), {
                readonly: !0,
                placeholder: "",
                value: w.value,
                disabled: !d.value
              }, {
                suffix: y(() => [
                  i(X, {
                    class: "arrow",
                    size: "12",
                    style: oA(u.value)
                  }, {
                    default: y(() => [
                      yA(i(l(pe), null, null, 512), [
                        [PA, e.show]
                      ]),
                      yA(i(l(ve), null, null, 512), [
                        [PA, !e.show]
                      ])
                    ]),
                    _: 1
                  }, 8, ["style"])
                ]),
                _: 1
              }, 8, ["value", "disabled"])
            ])
          ]),
          _: 3
        }, 8, ["show", "options", "disabled", "currentVal"])
      ]);
    };
  }
}), Pn = /* @__PURE__ */ V(yn, [["__scopeId", "data-v-7e8714c8"]]), Cn = { class: "toolbar-group" }, Dn = { class: "num-size-option" }, xn = /* @__PURE__ */ H({
  __name: "NumFormatGroup",
  setup(e) {
    const A = b(!1);
    return (t, n) => {
      const a = B("n-ellipsis"), r = B("n-space");
      return S(), R("div", Cn, [
        i(r, { vertical: "" }, {
          default: y(() => [
            i(r, null, {
              default: y(() => [
                i(Pn, {
                  cmd: l(o).NumFormat,
                  class: "num-format-select",
                  show: A.value,
                  "onUpdate:show": n[0] || (n[0] = (s) => A.value = s)
                }, {
                  option: y(({ item: s, checked: u }) => [
                    N("div", Dn, [
                      N("div", {
                        class: ge(["global-basic-display-text num-label", s.example != "" ? "bolder-label" : ""]),
                        style: oA(u ? { color: "white" } : {})
                      }, Y(s.label), 7),
                      s.example ? (S(), R("div", {
                        key: 0,
                        class: "global-basic-display-text num-desp",
                        style: oA(u ? { color: "white" } : {})
                      }, [
                        i(a, { style: { "max-width": "200px" } }, {
                          default: y(() => [
                            eA(Y(s.example), 1)
                          ]),
                          _: 2
                        }, 1024)
                      ], 4)) : q("", !0)
                    ])
                  ]),
                  _: 1
                }, 8, ["cmd", "show"])
              ]),
              _: 1
            }),
            i(r, null, {
              default: y(() => [
                i(dA, {
                  cmd: l(o).Percent,
                  x: -272,
                  y: -56,
                  tooltip: t.$t("toolbar.start.numFormat.percentage"),
                  val: "percentage",
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                i(wn, {
                  class: "global-small-icon-dropdown-button",
                  cmd: l(o).Accounting,
                  x: -256,
                  y: -56,
                  tooltip: t.$t("toolbar.start.numFormat.currency"),
                  dropdownOptions: [
                    {
                      key: "RMB",
                      label: t.$t("toolbar.start.numFormat.currencyList.RMB")
                    },
                    {
                      key: "Dollar",
                      label: t.$t("toolbar.start.numFormat.currencyList.Dollar")
                    },
                    {
                      key: "EUR",
                      label: t.$t("toolbar.start.numFormat.currencyList.EUR")
                    },
                    {
                      key: "GBP",
                      label: t.$t("toolbar.start.numFormat.currencyList.GBP")
                    },
                    {
                      key: "JPY",
                      label: t.$t("toolbar.start.numFormat.currencyList.JPY")
                    },
                    {
                      key: "none",
                      label: t.$t("toolbar.start.numFormat.currencyList.none")
                    }
                  ]
                }, null, 8, ["cmd", "tooltip", "dropdownOptions"]),
                i(dA, {
                  cmd: l(o).IncCellDigits,
                  x: -288,
                  y: -56,
                  tooltip: t.$t("toolbar.start.numFormat.decimalIncrease"),
                  val: "decimalIncrease",
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                i(dA, {
                  cmd: l(o).DecCellDigits,
                  x: -304,
                  y: -56,
                  tooltip: t.$t("toolbar.start.numFormat.decimalDecrease"),
                  val: "decimalDecrease",
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"])
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]);
    };
  }
}), Sn = /* @__PURE__ */ V(xn, [["__scopeId", "data-v-394938dd"]]), Fn = { style: { display: "flex", gap: "8px" } }, En = /* @__PURE__ */ H({
  __name: "SearchWordButton",
  setup(e) {
    return (A, t) => (S(), R("div", Fn, [
      i(M, {
        cmd: l(o).Search,
        label: A.$t("toolbar.start.search"),
        x: -120,
        y: -30
      }, null, 8, ["cmd", "label"])
    ]));
  }
}), Xn = { class: "toolbar-container" }, On = {
  key: 0,
  class: "ribbon-content"
}, Hn = {
  key: 1,
  class: "ribbon-content"
}, Nn = /* @__PURE__ */ H({
  __name: "ExcelRibbon",
  setup(e) {
    const A = T(), t = C(() => A == null ? void 0 : A.getters["file/title"]), n = b("start");
    return (a, r) => (S(), R("div", null, [
      N("div", Xn, [
        i(l(be), {
          documentTitle: t.value,
          logoSrc: l(Ht),
          class: "toolbar-prefix"
        }, null, 8, ["documentTitle", "logoSrc"]),
        i(l(we), {
          modelValue: n.value,
          "onUpdate:modelValue": r[0] || (r[0] = (s) => n.value = s),
          tabs: [
            { name: "file", label: a.$t("toolbar.file.title") },
            { name: "start", label: a.$t("toolbar.start.title") }
          ]
        }, null, 8, ["modelValue", "tabs"]),
        r[1] || (r[1] = N("div", { class: "toolbar-suffix" }, null, -1))
      ]),
      N("div", null, [
        n.value == "file" ? (S(), R("div", On, [
          i(l(zt))
        ])) : q("", !0),
        n.value == "start" ? (S(), R("div", Hn, [
          i(l(bn)),
          i(l(G), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          i(l(kt)),
          i(l(G), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          i(l(vn)),
          i(l(G), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          i(l(Bt)),
          i(l(G), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          i(l(Sn)),
          i(l(G), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          i(l(En))
        ])) : q("", !0)
      ])
    ]));
  }
}), Ln = /* @__PURE__ */ V(Nn, [["__scopeId", "data-v-9c925099"]]), zn = { class: "zoom-wrapper" }, Rn = /* @__PURE__ */ H({
  __name: "CommandZoom",
  props: {
    cmd: {},
    modelValue: {},
    min: { default: 10 },
    max: { default: 400 },
    step: {},
    disabled: { type: Boolean },
    width: { default: 200 }
  },
  setup(e) {
    const A = T(), t = e, n = C(() => A == null ? void 0 : A.getters["command/can"](t.cmd)), a = C(() => A == null ? void 0 : A.getters["command/getVal"](t.cmd)), r = k(I);
    function s(u) {
      const d = { value: u };
      r.run(t.cmd, d), A.commit("command/setState", {
        cmd: o.Zoom,
        ui: {
          value: u
        }
      });
    }
    return (u, d) => (S(), R("div", zn, [
      i(l(ye), {
        modelValue: a.value,
        "onUpdate:modelValue": d[0] || (d[0] = (m) => a.value = m),
        onChange: s,
        min: e.min,
        max: e.max,
        width: e.width,
        disabled: !n.value
      }, null, 8, ["modelValue", "min", "max", "width", "disabled"]),
      i(l(Pe), {
        modelValue: a.value,
        "onUpdate:modelValue": [
          d[1] || (d[1] = (m) => a.value = m),
          s
        ],
        disabled: !n.value,
        min: e.min,
        max: e.max
      }, null, 8, ["modelValue", "disabled", "min", "max"])
    ]));
  }
}), kn = /* @__PURE__ */ V(Rn, [["__scopeId", "data-v-337aa14f"]]), Tn = { class: "status-bar" }, In = { class: "left" }, Wn = { class: "right" }, jn = /* @__PURE__ */ H({
  __name: "StatusBar",
  setup(e) {
    const A = T(), t = C(() => A == null ? void 0 : A.getters["file/loadingRatio"]), n = C(
      () => A == null ? void 0 : A.getters["file/showLoadingProgressBar"]
    ), a = C(() => A == null ? void 0 : A.getters["command/loadEnd"]);
    function r() {
      De(document.getElementById("main"), !0);
    }
    return (s, u) => (S(), R("div", Tn, [
      N("div", In, [
        n.value ? (S(), j(l(Ce), {
          key: 0,
          percentage: t.value,
          class: "progress-bar"
        }, null, 8, ["percentage"])) : q("", !0)
      ]),
      u[0] || (u[0] = N("div", { class: "spacer" }, null, -1)),
      N("div", Wn, [
        i(kn, {
          cmd: l(o).Zoom,
          step: 1
        }, null, 8, ["cmd"]),
        i(l(Q), {
          onClick: r,
          "resource-image": l(D).image,
          x: -32,
          y: -56,
          "button-size": 24,
          "image-width": l(D).width,
          tooltip: s.$t("statusBar.fullscreen"),
          class: "global-medium-icon-button",
          disabled: !a.value
        }, null, 8, ["resource-image", "image-width", "tooltip", "disabled"])
      ])
    ]));
  }
}), Bn = /* @__PURE__ */ V(jn, [["__scopeId", "data-v-4c4853bc"]]), Un = xe({
  components: [
    Se,
    Fe,
    Ee,
    Xe,
    Oe,
    He,
    Ne,
    Le,
    ze,
    Re,
    ke,
    Te,
    Ie,
    We,
    je,
    Be,
    Ue,
    Ve,
    Qe,
    Ye,
    Me,
    Ze,
    Ge,
    qe,
    Ke,
    Je,
    _e,
    $e,
    At,
    et,
    tt,
    nt,
    ot,
    at,
    rt,
    lt,
    st
  ]
});
function Vn(e) {
  e.use(Un);
}
function Qn() {
  switch (AA) {
    case "zh-CN":
      return CA;
    case "en-US":
      return it;
  }
  return CA;
}
function Yn() {
  return {
    common: {
      primaryColor: "#007F50",
      // 主色
      primaryColorHo55r: "#007F50",
      // hover 主色
      primaryColorPressed: "#007F50",
      // 按下色
      primaryColorSuppl: "#007F50"
      // 补充主色
    }
  };
}
function Mn(e) {
  e.registerHandler(o.Bold, {
    run: (A, t) => A.setBold(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.Bold, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.Bold,
      enabled: !0
    });
  });
}
function Zn(e) {
  e.registerHandler(o.Underline, {
    run: (A, t) => A.setUnderline(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.Underline, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.Underline,
      enabled: !0
    });
  });
}
function Gn(e) {
  e.registerHandler(o.Border, {
    run: (A, t) => A.setBorder(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.Border, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.Border,
      enabled: !0
    });
  });
}
function qn(e) {
  e.registerHandler(o.Strikeout, {
    run: (A, t) => A.setStrikeout(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.Strikeout, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.Strikeout,
      enabled: !0
    });
  });
}
function Kn(e) {
  e.registerHandler(o.Italic, {
    run: (A, t) => A.setItalic(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.Italic, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.Italic,
      enabled: !0
    });
  });
}
function Jn(e) {
  e.registerHandler(o.FontSize, {
    run: (A, t) => A.setFontSize(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.FontSize, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.FontSize,
      enabled: !0
    });
  });
}
function _n(e) {
  e.registerHandler(o.FontColor, {
    run: (A, t) => A.setFontColor(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.FontColor, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.FontColor,
      enabled: !0
    });
  });
}
function $n(e) {
  e.registerHandler(o.FillColor, {
    run: (A, t) => A.setFillColor(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.FillColor, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.FillColor,
      enabled: !0
    });
  });
}
function Ao(e) {
  e.registerHandler(o.AlignHorizontal, {
    run: (A, t) => A.setAlignHorizontalUI(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.AlignHorizontal, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.AlignHorizontal,
      enabled: !0
    });
  });
}
function eo(e) {
  e.registerHandler(o.AlignVertical, {
    run: (A, t) => A.setAlignVerticalUI(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.AlignVertical, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.AlignVertical,
      enabled: !0
    });
  });
}
function to(e) {
  e.registerHandler(o.FontName, {
    run: (A, t) => A.setFontName(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.FontName, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.FontName,
      enabled: !0
    });
  });
}
function no(e) {
  e.registerHandler(o.Undo, {
    run: (A) => A.undo(),
    refresh: /* @__PURE__ */ new Set([F.UndoRedoChange])
  }), e.registerRefresher(o.Undo, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.Undo,
      enabled: A.api.canUndo()
    });
  });
}
function oo(e) {
  e.registerHandler(o.Redo, {
    run: (A) => A.redo(),
    refresh: /* @__PURE__ */ new Set([F.UndoRedoChange])
  }), e.registerRefresher(o.Redo, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.Redo,
      enabled: A.api.canRedo()
    });
  });
}
function ao(e) {
  const A = /* @__PURE__ */ new Set([F.Init]);
  e.registerHandler(o.Copy, {
    run: (t) => t.copy()
  }), e.registerHandler(o.Cut, {
    run: (t) => t.cut(),
    refresh: A
  }), e.registerHandler(o.Paste, {
    run: (t) => t.paste(),
    refresh: A
  }), [o.Cut, o.Paste].forEach((t) => {
    e.registerRefresher(t, (n) => {
      n.canRefreshCommand(t) && n.store.commit("command/setEnabled", {
        cmd: t,
        enabled: !0
      });
    });
  });
}
function ro(e) {
  e.registerHandler(o.Zoom, {
    run: (A, t) => A.setZoom(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init, F.ZoomChange])
  }), e.registerRefresher(o.Zoom, (A) => {
    A.canRefreshCommand(o.Zoom) && (A.store.commit("command/setState", {
      cmd: o.Zoom,
      ui: {
        value: A.api.getZoom()
      }
    }), A.store.commit("command/setEnabled", {
      cmd: o.Zoom,
      enabled: !0
    }));
  });
}
function lo(e) {
  e.registerHandler(o.Export, {
    run: async (A, t) => {
      await A.doExport("exportDocument");
    },
    refresh: /* @__PURE__ */ new Set([F.ExportReady])
  }), e.registerHandler(o.ExportPDF, {
    run: async (A, t) => {
      await A.doExport("exportPDF");
    },
    refresh: /* @__PURE__ */ new Set([F.ExportReady])
  }), e.registerRefresher(o.Export, (A) => {
    A.canRefreshCommand(o.Export) && A.store.commit("command/setEnabled", {
      cmd: o.Export,
      enabled: !0
    });
  }), e.registerRefresher(o.ExportPDF, (A) => {
    A.canRefreshCommand(o.ExportPDF) && A.store.commit("command/setEnabled", {
      cmd: o.ExportPDF,
      enabled: !0
    });
  });
}
function so(e) {
  e.registerHandler(o.Open, {
    run: (A, t) => A.openFile(),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.Open, (A) => {
    A.canRefreshCommand(o.Open) && A.store.commit("command/setEnabled", {
      cmd: o.Open,
      enabled: !0
    });
  });
}
function io(e) {
  e.registerHandler(o.NumFormat, {
    run: (A, t) => A.setNumFormat(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.NumFormat, (A) => {
    var n;
    if (!A.xlsReady) return;
    let t = (n = A.store) == null ? void 0 : n.getters["file/numFormatListValues"];
    (!t || t.length == 0) && (t = A.api.getCellAllFormats(), A.store.commit("file/setNumFormatListValues", t)), A.store.commit("command/setEnabled", {
      cmd: o.NumFormat,
      enabled: !0
    });
  });
}
function uo(e) {
  e.registerHandler(o.Accounting, {
    run: (A, t) => A.setAccounting(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.Accounting, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.Accounting,
      enabled: !0
    });
  });
}
function co(e) {
  e.registerHandler(o.Percent, {
    run: (A, t) => A.setPercent(),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.Percent, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.Percent,
      enabled: !0
    });
  });
}
function mo(e) {
  e.registerHandler(o.IncCellDigits, {
    run: (A, t) => A.incCellDigits(),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.IncCellDigits, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.IncCellDigits,
      enabled: !0
    });
  }), e.registerHandler(o.DecCellDigits, {
    run: (A, t) => A.decCellDigits(),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.DecCellDigits, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.DecCellDigits,
      enabled: !0
    });
  });
}
function fo(e) {
  e.registerHandler(o.PaneOperations, {
    run: (A, t) => A.doPaneOperations(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.PaneOperations, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.PaneOperations,
      enabled: !0
    });
  });
}
function ho(e) {
  e.registerHandler(o.RowOperations, {
    run: (A, t) => A.doRowOperations(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.RowOperations, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.RowOperations,
      enabled: !0
    });
  });
}
function po(e) {
  e.registerHandler(o.ColumnOperations, {
    run: (A, t) => A.doColumnOperations(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.ColumnOperations, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.ColumnOperations,
      enabled: !0
    });
  });
}
function vo(e) {
  e.registerHandler(o.SheetOperations, {
    run: (A, t) => A.doSheetOperations(t.value),
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.SheetOperations, (A) => {
    A.xlsReady && A.store.commit("command/setEnabled", {
      cmd: o.SheetOperations,
      enabled: !0
    });
  });
}
function go(e) {
  e.registerHandler(o.Search, {
    run: (A, t) => {
      if (!t) {
        e.store.commit("file/setShowFindDialog", !0);
        return;
      }
      const n = t.value;
      if (!n) return;
      switch (n.action) {
        case "search":
          A.searchWord(n.val, () => {
            a();
          });
          break;
        case "next":
          A.searchNext(), a();
          break;
        case "prev":
          A.searchPrevious(), a();
          break;
      }
      function a() {
        const r = A.searchStatusInfo();
        e.store.commit("command/setState", {
          cmd: o.Search,
          ui: {
            value: {
              countNum: r.countNum,
              totalCount: r.totalCount
            }
          }
        });
      }
    },
    refresh: /* @__PURE__ */ new Set([F.Init])
  }), e.registerRefresher(o.Search, (A) => {
    A.canRefreshCommand(o.Search) && A.store.commit("command/setEnabled", {
      cmd: o.Search,
      enabled: !0
    });
  });
}
function bo() {
  const e = k(I);
  uo(e), Mn(e), Zn(e), Gn(e), qn(e), Kn(e), ao(e), no(e), oo(e), Jn(e), _n(e), $n(e), to(e), Ao(e), eo(e), ro(e), lo(e), so(e), io(e), co(e), mo(e), fo(e), ho(e), po(e), vo(e), go(e);
}
const wo = { class: "app-shell" }, yo = { class: "app-stage" }, Po = { id: "appContainer" }, Co = /* @__PURE__ */ H({
  __name: "App",
  setup(e) {
    const A = T(), t = b(null), n = b(null), a = b(!0), r = b(null), s = b(null), u = k(hA, null), d = C(
      () => {
        var P;
        return ((P = u == null ? void 0 : u.uiOptions) == null ? void 0 : P.showTopBar) !== !1;
      }
    ), m = C(
      () => {
        var P;
        return ((P = u == null ? void 0 : u.uiOptions) == null ? void 0 : P.showBottomBar) !== !1;
      }
    ), h = C(() => A.state.file.isReady);
    lA(h, (P) => {
      a.value = !P;
    });
    const w = C(() => A == null ? void 0 : A.state.file.hasError), O = C(
      () => (A == null ? void 0 : A.getters["command/isRunning"](o.Export)) || (A == null ? void 0 : A.getters["command/isRunning"](o.ExportPDF))
    ), c = (P) => {
      var f;
      const { callback: E } = (P == null ? void 0 : P.detail) || {};
      E && ((f = r == null ? void 0 : r.value) != null && f.openPopover) && r.value.openPopover(E);
    }, p = (P) => {
      var E;
      (E = r == null ? void 0 : r.value) == null || E.closePopover();
    }, g = () => {
      var P;
      (P = s == null ? void 0 : s.value) == null || P.openPopover();
    };
    return dt(() => {
      const P = (u == null ? void 0 : u.eventTarget) ?? window;
      bo(), P.addEventListener("FilePassWordError", c), P.addEventListener("FilePassWordOK", p), P.addEventListener("OpenDocumentFailed", g);
    }), ut(() => {
      const P = (u == null ? void 0 : u.eventTarget) ?? window;
      A.commit("file/clearError"), P.removeEventListener(
        "FilePassWordError",
        c
      ), P.removeEventListener("FilePassWordOK", p), P.removeEventListener(
        "OpenDocumentFailed",
        g
      );
    }), LA(() => {
      const { toolBarElm: P, editorElm: E } = Ot();
      P.value = t.value, E.value = n.value;
    }), (P, E) => {
      const f = B("n-spin"), X = B("n-message-provider"), z = B("n-modal-provider"), W = B("n-config-provider");
      return S(), R("div", wo, [
        i(W, {
          class: "app-provider",
          locale: l(Qn)(),
          "theme-overrides": l(Yn)()
        }, {
          default: y(() => [
            i(z, null, {
              default: y(() => [
                i(X, null, {
                  default: y(() => [
                    i(l(ct), {
                      ref_key: "dialogOpenFailedRef",
                      ref: s
                    }, null, 512),
                    i(l(mt), {
                      ref_key: "dialogCypherRef",
                      ref: r
                    }, null, 512),
                    N("div", yo, [
                      i(f, {
                        class: "app-spin",
                        show: a.value || O.value,
                        fullscreen: "",
                        style: {
                          backgroundColor: "rgba(255, 255, 255, 0.5)"
                        }
                      }, {
                        default: y(() => [
                          N("div", Po, [
                            d.value ? (S(), j(Ln, {
                              key: 0,
                              ref_key: "toolbarRef",
                              ref: t
                            }, null, 512)) : q("", !0),
                            w.value ? q("", !0) : (S(), j(Xt, {
                              key: 1,
                              ref_key: "editorRef",
                              ref: n,
                              class: "editor"
                            }, null, 512)),
                            m.value ? (S(), j(l(Bn), {
                              key: 2,
                              class: "status-bar"
                            })) : q("", !0)
                          ])
                        ]),
                        _: 1
                      }, 8, ["show"])
                    ])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }, 8, ["locale", "theme-overrides"])
      ]);
    };
  }
});
function Do(e) {
  let A = fn(e);
  const t = ft(Co);
  return t.use(A), { app: t };
}
const xo = {
  namespaced: !0,
  state: () => ({
    hasError: !1,
    isReady: !1,
    connected: !1,
    message: null,
    rawEvent: null,
    fileInfo: { title: "", docId: "" },
    numFormatListValues: [],
    colorPalette: null,
    recentColors: [],
    showFindDialog: !1,
    loadingRatio: 0,
    showLoadingProgressBar: !0,
    sheetProtected: !1
  }),
  getters: {
    title: (e) => e.fileInfo.title,
    numFormatListValues: (e) => e.numFormatListValues,
    colorPalette: (e) => e.colorPalette,
    recentColors: (e) => e.recentColors,
    showFindDialog: (e) => e.showFindDialog,
    loadingRatio: (e) => e.loadingRatio,
    showLoadingProgressBar: (e) => e.showLoadingProgressBar,
    sheetProtected: (e) => e.sheetProtected
  },
  mutations: {
    setError(e, A) {
      e.hasError = !0, e.message = A.message, e.rawEvent = A.event ?? null;
    },
    clearError(e) {
      e.hasError = !1, e.message = null, e.rawEvent = null;
    },
    setReady(e, A = !0) {
      e.isReady = A;
    },
    setConnected(e, A) {
      e.connected = A;
    },
    setFileInfo(e, A) {
      e.fileInfo.title = A.title, e.fileInfo.docId = A.docId;
    },
    setNumFormatListValues(e, A) {
      e.numFormatListValues = A;
    },
    setColorPalette(e, A) {
      e.colorPalette = A;
    },
    addRecentColors(e, A) {
      function t(r) {
        return typeof r == "string" ? r : r == null ? void 0 : r.hex;
      }
      const n = t(A), a = e.recentColors.findIndex(
        (r) => t(r) === n
      );
      a !== -1 && e.recentColors.splice(a, 1), e.recentColors.unshift(A), e.recentColors.length > 10 && (e.recentColors.length = 10);
    },
    setShowFindDialog(e, A) {
      e.showFindDialog = A;
    },
    setLoadingRatio(e, A) {
      e.loadingRatio = A;
    },
    setShowLoadingProgressBar(e, A) {
      e.showLoadingProgressBar = A;
    },
    setSheetProtected(e, A) {
      e.sheetProtected = A;
    }
  },
  actions: {
    onError({ commit: e }, A) {
      e("setError", {
        message: "文件处理失败",
        event: A
      });
    },
    onOpening({ commit: e }) {
      e("clearError"), e("setReady", !1), e("setConnected", !1), e("setLoadingRatio", 0), e("setShowLoadingProgressBar", !0);
    },
    onReady({ commit: e }, A) {
      e("setReady");
    },
    onConnected({ commit: e }, A) {
      e("setConnected", !0), e("setFileInfo", A);
    },
    onLoadPageEnd({ commit: e }, A) {
      e("setLoadingRatio", 100), setTimeout(() => {
        e("setShowLoadingProgressBar", !1);
      }, 1e3);
    },
    onExportReady({ commit: e }, A) {
    },
    onFilePassWord({ commit: e }, A) {
    }
  }
};
function uA() {
  return {
    [o.Copy]: { enabled: !1, running: !1 },
    [o.Cut]: { enabled: !1, running: !1 },
    [o.Paste]: { enabled: !1, running: !1 },
    [o.Undo]: { enabled: !1, running: !1 },
    [o.Redo]: { enabled: !1, running: !1 },
    [o.Accounting]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.Bold]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.Underline]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.Border]: { enabled: !1, running: !1 },
    [o.Strikeout]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.Italic]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.FontSize]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.FontColor]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.FillColor]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.FontName]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.Percent]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.IncCellDigits]: {
      enabled: !1,
      running: !1
    },
    [o.DecCellDigits]: {
      enabled: !1,
      running: !1
    },
    [o.AlignHorizontal]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.AlignVertical]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.Color]: {
      enabled: !1,
      running: !1,
      ui: {
        value: "0xFFFFFF"
      }
    },
    [o.Zoom]: {
      enabled: !1,
      running: !1,
      ui: {
        value: 100
      }
    },
    [o.Export]: {
      enabled: !1,
      running: !1
    },
    [o.ExportPDF]: {
      enabled: !1,
      running: !1
    },
    [o.Open]: {
      enabled: !1,
      running: !1
    },
    [o.NumFormat]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.PaneOperations]: {
      enabled: !1,
      running: !1
    },
    [o.ColumnOperations]: {
      enabled: !1,
      running: !1
    },
    [o.RowOperations]: {
      enabled: !1,
      running: !1
    },
    [o.SheetOperations]: {
      enabled: !1,
      running: !1
    },
    [o.Search]: {
      enabled: !1,
      running: !1,
      ui: {
        value: null
      }
    }
  };
}
const So = {
  namespaced: !0,
  state: () => ({
    map: uA(),
    readOnly: !1,
    loadEnd: !1,
    selectAll: !1
  }),
  getters: {
    can: (e) => (A) => {
      var t;
      return ((t = e.map[A]) == null ? void 0 : t.enabled) !== !0 ? !1 : e.readOnly ? e.loadEnd && cA.has(A) : !0;
    },
    isRunning: (e) => (A) => {
      var t;
      return ((t = e.map[A]) == null ? void 0 : t.running) === !0;
    },
    active: (e) => (A) => {
      var n;
      const t = (n = e.map[A]) == null ? void 0 : n.ui;
      return !!t && t.value === !0;
    },
    getVal: (e) => (A) => {
      var n;
      const t = (n = e.map[A]) == null ? void 0 : n.ui;
      return !!t && t.value;
    },
    loadEnd: (e) => e.loadEnd
  },
  mutations: {
    resetCommandState(e) {
      e.map = uA(), e.readOnly = !1, e.loadEnd = !1, e.selectAll = !1;
    },
    setLoadEnd(e, A) {
      e.loadEnd = A;
    },
    setReadOnly(e, A) {
      e.readOnly = A;
    },
    setSelectAll(e, A) {
      e.selectAll = A;
    },
    setEnabled(e, A) {
      e.loadEnd == !1 && (A.enabled = !1), e.map[A.cmd].enabled = A.enabled;
    },
    refreshProtectedSheetMode(e, A) {
      e.readOnly || (A ? Object.values(o).forEach((t) => {
        gt.has(t) || (e.map[t].enabled = !1);
      }) : Object.values(o).forEach((t) => {
        t != o.Undo && t != o.Redo && (e.map[t].enabled = !0);
      }));
    },
    setRunning(e, A) {
      e.map[A.cmd].running = A.running;
    },
    setState(e, A) {
      const t = e.map[A.cmd];
      if (!t) return;
      const n = A.ui;
      if (n === void 0) {
        t.ui = void 0;
        return;
      }
      t.ui = { ...t.ui ?? {}, ...n };
    },
    clearState(e, A) {
      const t = uA()[A.cmd];
      t && (e.map[A.cmd] = JSON.parse(JSON.stringify(t)));
    }
  },
  actions: {
    async run({ commit: e, getters: A }, t) {
      const { cmd: n, fn: a, param: r } = t;
      if (A.can(n)) {
        e("setRunning", { cmd: n, running: !0 });
        try {
          await a(r);
        } finally {
          e("setRunning", { cmd: n, running: !1 });
        }
      }
    }
  }
};
class Fo extends ht {
  get Document() {
    return this.getAPIComponent("Document");
  }
  get UndoRedo() {
    return this.getAPIComponent("UndoRedo");
  }
  get Workbook() {
    return this.getAPIComponent("Workbook");
  }
  get Worksheet() {
    return this.getAPIComponent("Worksheet");
  }
  get Selection() {
    return this.getAPIComponent("Selection");
  }
  get Cursor() {
    return this.getAPIComponent("Cursor");
  }
  get Finder() {
    return this.getAPIComponent("Finder");
  }
}
class Eo extends Fo {
}
class Xo extends Eo {
  constructor() {
    super();
    U(this, "openFileHandler");
  }
  setOpenFileHandler(t) {
    this.openFileHandler = t;
  }
  openFile() {
    var t;
    return (t = this.openFileHandler) == null ? void 0 : t.call(this);
  }
  copy() {
    return this.Document.callFun("copy");
  }
  cut() {
    return this.Document.callFun("cut");
  }
  paste() {
    return this.Document.callFun("paste");
  }
  undo() {
    this.UndoRedo.callFun("undo");
  }
  redo() {
    this.UndoRedo.callFun("redo");
  }
  canUndo() {
    return this.UndoRedo.callFun("canUndo");
  }
  canRedo() {
    return this.UndoRedo.callFun("canRedo");
  }
  setAccounting(t) {
    this.Selection.callFun("setAccountingFormat", t);
  }
  setUnderline(t = !0) {
    const n = t ? "single" : "none";
    this.Selection.callFun("setUnderline", n);
  }
  setBorder(t) {
    this.Selection.callFun("setBorder", {
      color: iA(t.color),
      position: t.position,
      style: t.style
    });
  }
  setStrikeout(t = !0) {
    this.Selection.callFun("setStrikeThrough", t);
  }
  setBold(t = !0) {
    this.Selection.callFun("setBold", t);
  }
  setItalic(t = !0) {
    this.Selection.callFun("setItalic", t);
  }
  setFontSize(t) {
    this.Selection.callFun("setFontSize", t);
  }
  setAlignHorizontalUI(t) {
    this.Selection.callFun("setHorizontalAlignment", t);
  }
  setAlignVerticalUI(t) {
    this.Selection.callFun("setVerticalAlignment", t);
  }
  setFontColor(t) {
    const n = iA(t);
    this.Selection.callFun("setFontColor", n);
  }
  setFillColor(t) {
    const n = iA(t);
    this.Selection.callFun("setFillColor", n);
  }
  setFontName(t) {
    this.Selection.callFun("setFontName", t);
  }
  setCellStyle(t) {
    this.Selection.callFun("setCellStyle", t);
  }
  setPercent() {
    this.Selection.callFun("setPercentFormat");
  }
  setNumFormat(t) {
    this.Selection.callFun("setNumberFormat", t);
  }
  incCellDigits() {
    this.Selection.callFun("increaseDecimalPlaces");
  }
  decCellDigits() {
    this.Selection.callFun("decreaseDecimalPlaces");
  }
  isEditing() {
    return this.Document.callFun("isEditing");
  }
  setZoom(t) {
    this.Document.callFun("setZoom", t);
  }
  getZoom() {
    return Math.round(this.Document.callFun("getZoom") || 100);
  }
  async doExport(t) {
    switch (t) {
      case "exportDocument":
        await this.Document.callFun("exportDocument");
        break;
      case "exportPDF":
        await this.Document.callFun("exportPdf");
        break;
    }
  }
  /**获取调色盘 
   * @returns {"theme":[],"standard":[]}
   * 
  */
  getPalette() {
    return this.Workbook.callFun("getColorPalette");
  }
  /**
   * 获取所有单元格内容的所有数字格式
   * @returns {string[]} ["常规","数字","货币","会计",..."文本"]
   */
  getCellAllFormats() {
    return this.Workbook.callFun("getCellNumberFormats");
  }
  /**
   * 配合getCellAllFormats 使用，获取当前单元格内容所以的数字格式结果
   * @param formats 
   * @param lcid 
   * @returns 
   */
  getNumformatExamples(t, n = null) {
    return this.Workbook.callFun("getNumberFormatExamples", t, null, n);
  }
  /**
   * 
   * @param format
   * @param value 
   * @param lcid
   * @returns 
   */
  getNumformatExample(t, n = null, a = null) {
    return this.Workbook.callFun("getNumberFormatExample", t, n, a);
  }
  getCursorTargetType() {
    return this.Cursor.callFun("getTargetType");
  }
  isFrozenPane() {
    return this.Worksheet.callFun("isFrozenPane");
  }
  doPaneOperations(t) {
    const { action: n } = t;
    switch (n) {
      case "freezePane":
      case "unfreezePane":
        this.Worksheet.callFun("toggleFreezePanes");
        break;
      case "cleanText":
        this.Selection.callFun("clearContents");
        break;
    }
  }
  doRowOperations(t) {
    const { action: n } = t;
    switch (n) {
      case "setRowHeight":
        const { val: a } = t;
        this.Worksheet.callFun("setRowHeight", Number(a));
        break;
      case "insertRow":
        this.Worksheet.callFun("insertRows");
        break;
      case "hideRow":
        this.Worksheet.callFun("hideRows");
        break;
      case "unhideRow":
        this.Worksheet.callFun("unhideRows");
        break;
      case "delRow":
        this.Worksheet.callFun("deleteRows");
        break;
      case "clearRowContent":
        this.Selection.callFun("clearContents");
        break;
    }
  }
  doColumnOperations(t) {
    const { action: n } = t;
    switch (n) {
      case "insertColumn":
        this.Worksheet.callFun("insertColumns");
        break;
      case "setColumnWidth":
        const { val: a } = t;
        this.Worksheet.callFun("setColumnWidth", Number(a));
        break;
      case "hideColumn":
        this.Worksheet.callFun("hideColumns");
        break;
      case "unhideColumn":
        this.Worksheet.callFun("unhideColumns");
        break;
      case "delColumn":
        this.Worksheet.callFun("deleteColumns");
        break;
      case "clearColContent":
        this.Selection.callFun("clearContents");
        break;
    }
  }
  doSheetOperations(t) {
    const { action: n } = t;
    switch (n) {
      case "insertSheet":
        this.Workbook.callFun("addWorksheet");
        break;
      case "renameSheet":
        const { val: a } = t;
        this.Workbook.callFun("setWorksheetName", a);
        break;
      case "delCurrentSheet":
        this.Workbook.callFun("deleteWorksheet");
        break;
    }
  }
  getRowHeight() {
    const t = Number(this.Worksheet.callFun("getRowHeight")) || 0;
    return Number(t.toFixed(1));
  }
  getColumnWidth() {
    const t = Number(this.Worksheet.callFun("getColumnWidth")) || 0;
    return Number(t.toFixed(2));
  }
  getSheetName() {
    return this.Workbook.callFun("getWorksheetName");
  }
  searchWord(t, n) {
    this.Finder.callFun("search", t, n);
  }
  searchFirst() {
    this.Finder.callFun("selectFirst");
  }
  searchNext() {
    this.Finder.callFun("selectNext");
  }
  searchPrevious() {
    this.Finder.callFun("selectPrevious");
  }
  searchStatusInfo() {
    return this.Finder.callFun("getSearchStatus");
  }
  isWorksheetProtected() {
    return this.Workbook.callFun("isWorksheetProtected");
  }
}
function Oo(e) {
  return e ?? window.lang ?? window.navigator.language;
}
function Ho(e) {
  return new Promise((A, t) => {
    var r;
    const n = (r = e.state) == null ? void 0 : r.file;
    if (n != null && n.isReady) {
      A();
      return;
    }
    if (n != null && n.hasError) {
      t(new Error(n.message ?? "document load failed"));
      return;
    }
    const a = e.watch(
      (s) => {
        var u, d, m;
        return {
          isReady: !!((u = s.file) != null && u.isReady),
          hasError: !!((d = s.file) != null && d.hasError),
          message: ((m = s.file) == null ? void 0 : m.message) ?? null
        };
      },
      (s) => {
        if (s.isReady) {
          a(), A();
          return;
        }
        s.hasError && (a(), t(new Error(s.message ?? "document load failed")));
      }
    );
  });
}
function No(e, A, t) {
  const n = pt({
    modules: {
      file: xo,
      command: So
    }
  }), { app: a } = Do(Oo(A));
  Vn(a), a.use(n);
  const r = new Xo(), s = new Pt({
    store: n,
    api: r,
    eventTarget: t == null ? void 0 : t.eventTarget
  }), u = Ho(n);
  a.provide(I, s), a.provide(BA, {
    toolBarElm: $(null),
    navigateBarElm: $(null),
    editorElm: $(null),
    bottomBarElm: $(null)
  }), a.provide(hA, {
    docId: (t == null ? void 0 : t.docId) ?? "",
    mode: t == null ? void 0 : t.mode,
    file: t == null ? void 0 : t.file,
    fileUrl: t == null ? void 0 : t.fileUrl,
    fileName: t == null ? void 0 : t.fileName,
    user: t == null ? void 0 : t.user,
    uiOptions: t == null ? void 0 : t.uiOptions,
    widgetMode: t == null ? void 0 : t.widgetMode,
    mainDom: $(null),
    eventTarget: (t == null ? void 0 : t.eventTarget) ?? window
  }), a.mount(e);
  async function d() {
    var m, h;
    await ((h = (m = r.docApp) == null ? void 0 : m.destroy) == null ? void 0 : h.call(m)), s.destroy(), a.unmount();
  }
  return {
    app: a,
    api: r,
    commandService: s,
    store: n,
    ready: u,
    destroy: d,
    close: d,
    unmount: d
  };
}
const To = No;
export {
  No as default,
  To as mount,
  No as mountXlsxApp
};
