var Ne = Object.defineProperty;
var ze = (a, e, t) => e in a ? Ne(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
var M = (a, e, t) => ze(a, typeof e != "symbol" ? e + "" : e, t);
import { d as B, i as D, u as N, w as _e, o as k, c as $, a as s, b as i, D as le, e as w, S as Ue, f as Y, g as _, t as T, A as j, r as b, h as E, _ as H, j as ie, k as pe, W as ge, l as Fe, m as He, n as se, p as $e, q as Ve, s as Me, v as We, I as ue, x as W, y as Ie, z as re, B as V, C as G, E as X, F as J, G as Ge, H as Ze, J as je, K as Be, L as Ke, M as Je, N as Qe, O as Xe, P as Ye, Q as qe, R as q, T as et, U as ae, V as ne, X as fe, Y as be, Z as Le, $ as tt, a0 as ve, a1 as at, a2 as nt, a3 as K, a4 as ot, a5 as rt, a6 as lt, a7 as it, a8 as st, a9 as ut, aa as dt, ab as ct, ac as mt, ad as pt, ae as gt, af as ht, ag as ft, ah as bt, ai as vt, aj as wt, ak as St, al as yt, am as Pt, an as Ct, ao as kt, ap as Et, aq as Rt, ar as _t, as as Ft, at as $t, au as It, av as Bt, aw as Lt, ax as At, ay as Ot, az as Tt, aA as Dt, aB as xt, aC as Nt, aD as zt, aE as Ut, aF as Ht, aG as Vt, aH as Mt, aI as Wt, aJ as Gt, aK as Zt, aL as we, aM as jt, aN as Kt, aO as Jt, aP as Qt, aQ as Xt, aR as Yt, aS as qt, aT as ea, aU as ee } from "./ApiBase.js";
import { a as ta, O as Se, d as ye } from "./UI.runtime.js";
import { _ as Ae } from "./DropdownPopoverList.js";
const y = {
  Init: "init",
  // 文档初始化时
  SelectionChange: "selectionChange",
  // selection改变时
  UndoRedoChange: "UndoRedoChange",
  // undo redo 操作列表发生改变时
  ExportReady: "ExportReady",
  // 文档准备好导出时
  PagePositionChange: "pagePositionChange",
  // 页面位置改变
  LoadPageEnd: "loadPageEnd",
  // 页面load结束
  ZoomChange: "zoomChange"
  // 页面zoom改变
}, o = {
  //styles
  Bold: "bold",
  Underline: "underline",
  Strikeout: "strikeout",
  Italic: "italic",
  FontSize: "fontSize",
  FontColor: "fontColor",
  FontName: "fontName",
  Color: "color",
  ParaAlignHorizontal: "paraAlignHorizontal",
  ParaListType: "paraListType",
  LineSpace: "lineSpace",
  ParaSymbol: "paraSymbol",
  // editor
  Undo: "undo",
  Redo: "redo",
  Zoom: "zoom",
  Export: "export",
  ExportPDF: "exportPDF",
  Open: "open",
  Copy: "copy",
  Paste: "paste",
  GoToPage: "goToPage",
  PagePositionChange: "pagePositionChange",
  PageViewSwitch: "pageViewSwitch",
  InsertTable: "insertTable",
  InsertSeparator: "insertSeparator",
  SearchReplaceWord: "searchReplaceWord",
  TableOperations: "tableOperations",
  TableCellOperations: "tableCellOperations",
  PaperOrientation: "paperOrientation",
  PaperSize: "paperSize"
}, me = /* @__PURE__ */ new Set([
  o.Open,
  o.Export,
  o.ExportPDF,
  o.Copy,
  o.GoToPage,
  o.PagePositionChange,
  o.PageViewSwitch,
  o.Zoom,
  o.ParaSymbol,
  o.SearchReplaceWord
]);
function aa(a, e, t = window) {
  const n = (h) => {
    a.dispatch("file/onError", h);
  };
  t.addEventListener("FileError", n);
  const r = (h) => {
    a.dispatch("file/onReady", h);
  };
  t.addEventListener("DocumentReady", r);
  const l = () => {
    e.enableEditor();
  };
  t.addEventListener("EditorEnable", l);
  const u = () => {
    e.disableEditor();
  };
  t.addEventListener("EditorDisable", u);
  const d = (h) => {
    a.commit("command/setLoadEnd", !0), e.refresh(y.Init), e.refresh(y.LoadPageEnd), a.dispatch("file/onLoadPageEnd", h);
  };
  t.addEventListener("LoadAllPageEnd", d);
  const c = (h) => {
    a.dispatch("file/onExportReady", h), e.refresh(y.ExportReady);
  };
  t.addEventListener("ExportReady", c);
  const m = (h) => {
    na(a, h.detail), e.refresh(y.SelectionChange);
  };
  t.addEventListener("SelectionChange", m);
  const p = (h) => {
    e.refresh(y.UndoRedoChange);
  };
  t.addEventListener("UndoRedoChange", p);
  const f = (h) => {
    e.refresh(y.PagePositionChange);
  };
  t.addEventListener("PagePositionChange", f);
  const v = (h) => {
    e.refresh(y.ZoomChange);
  };
  t.addEventListener("ZoomChange", v);
  const g = (h) => {
    a.commit("file/setShowFindDialog", !0);
  };
  t.addEventListener("OpenFindDialog", g);
  const C = (h) => {
    var I, R;
    let A = ((I = h.detail) == null ? void 0 : I.formatRatio) || 0;
    A = A == 100 ? 99 : A;
    const S = ((R = h.detail) == null ? void 0 : R.pageIndex) || 0;
    a.commit("file/setLoadingRatio", A), a.commit("file/setPageCount", S);
  };
  t.addEventListener("DocumentLoading", C);
  const O = (h) => {
    var A;
    e.notifySecurityError(((A = h.detail) == null ? void 0 : A.action) || "");
  };
  return t.addEventListener("SecurityError", O), () => {
    t.removeEventListener("FileError", n), t.removeEventListener("DocumentReady", r), t.removeEventListener("EditorEnable", l), t.removeEventListener("EditorDisable", u), t.removeEventListener("LoadAllPageEnd", d), t.removeEventListener("ExportReady", c), t.removeEventListener("SelectionChange", m), t.removeEventListener("UndoRedoChange", p), t.removeEventListener("PagePositionChange", f), t.removeEventListener("ZoomChange", v), t.removeEventListener("OpenFindDialog", g), t.removeEventListener("DocumentLoading", C), t.removeEventListener("SecurityError", O);
  };
}
function na(a, e) {
  if (!e) return;
  a.commit("command/setEnabled", {
    cmd: o.Copy,
    enabled: e.canCopy === !0
  }), [
    { cmd: o.Bold, key: "bold" },
    { 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" },
    { cmd: o.Strikeout, key: "strikeout" },
    { cmd: o.ParaAlignHorizontal, key: "paraAlignHorizontal" }
  ].forEach(({ cmd: n, key: r, getVal: l }) => {
    let u;
    l ? u = l(e[r]) : u = e[r], a.commit("command/setState", {
      cmd: n,
      ui: {
        value: u
      }
    });
  });
}
const z = Symbol("CommandService");
class oa {
  constructor(e) {
    M(this, "store");
    M(this, "api");
    M(this, "docReady");
    M(this, "eventTarget");
    M(this, "removeListeners");
    M(this, "handlers");
    M(this, "refreshers");
    M(this, "securityErrorHandler");
    M(this, "modeController");
    M(this, "removeModeListener");
    this.store = e.store, this.api = e.api, this.docReady = !1, this.eventTarget = e.eventTarget ?? window, this.removeListeners = () => {
    }, this.handlers = {}, this.refreshers = {}, this.securityErrorHandler = () => {
    }, this.modeController = null, this.removeModeListener = () => {
    };
  }
  initApi(e) {
    var t, n;
    this.docReady = !1, this.store.commit("command/resetCommandState"), (t = this.removeListeners) == null || t.call(this), (n = this.removeModeListener) == null || n.call(this), this.api.initApi(e), this.bindDocumentMode(e), this.syncReadOnlyState(), this.removeListeners = aa(this.store, this, this.eventTarget);
  }
  initApp(e) {
    this.initApi(e);
  }
  destroy() {
    var e, t;
    (e = this.removeListeners) == null || e.call(this), (t = this.removeModeListener) == null || t.call(this), this.modeController = null, this.removeListeners = () => {
    }, this.removeModeListener = () => {
    };
  }
  dispose() {
    this.destroy();
  }
  setSecurityErrorHandler(e) {
    this.securityErrorHandler = e || (() => {
    });
  }
  notifySecurityError(e) {
    this.securityErrorHandler(e);
  }
  enableEditor() {
    this.docReady = !0, this.refresh(y.Init);
  }
  disableEditor() {
    this.docReady = !1, this.refresh(y.Init);
  }
  canRefreshCommand(e) {
    return this.docReady ? !0 : this.isReadOnly() && this.store.getters["command/loadEnd"] === !0 && me.has(e);
  }
  //refresheres
  registerHandler(e, t) {
    this.handlers[e], this.handlers[e] = t;
  }
  registerRefresher(e, t) {
    this.refreshers[e] = t;
  }
  refreshAll() {
    this.syncReadOnlyState(), this.refreshSome(Object.values(o));
  }
  refresh(e) {
    var n, r, l;
    this.syncReadOnlyState();
    const t = Object.values(o);
    for (const u of t) {
      const d = this.handlers[u];
      d && ((n = d.refresh) != null && n.has(e)) && ((l = (r = this.refreshers)[u]) == null || l.call(r, this));
    }
  }
  refreshSome(e) {
    var t, n;
    this.syncReadOnlyState();
    for (const r of e)
      (n = (t = this.refreshers)[r]) == null || n.call(t, this);
  }
  bindDocumentMode(e) {
    var t;
    this.modeController = ta(e), this.removeModeListener = ((t = this.modeController) == null ? void 0 : t.onChange((n) => {
      this.store.commit("command/setReadOnly", n), n && this.disableEditor();
    })) ?? (() => {
    });
  }
  isReadOnly() {
    var e;
    return ((e = this.modeController) == null ? void 0 : e.isReadOnly()) ?? !1;
  }
  syncReadOnlyState() {
    this.store.commit("command/setReadOnly", this.isReadOnly());
  }
  canRunInReadOnly(e, t) {
    var r;
    if (!me.has(e))
      return !1;
    if (e !== o.SearchReplaceWord || !t)
      return !0;
    const n = (r = t == null ? void 0 : t.value) == null ? void 0 : r.action;
    return n === "search" || n === "next" || n === "prev" || n === "focusEditor";
  }
  /** 执行命令：统一入口 */
  async run(e, t) {
    this.syncReadOnlyState();
    const n = this.handlers[e];
    if (!n) {
      console.error(`[CommandService] no handler registered for "${e}"`);
      return;
    }
    this.isReadOnly() && !this.canRunInReadOnly(e, t) || await this.store.dispatch("command/run", {
      cmd: e,
      param: t,
      fn: async (r) => {
        await n.run(this.api, r);
      }
    });
  }
}
const ra = { class: "global-basic-display-text count" }, la = /* @__PURE__ */ B({
  __name: "SearchContentDialog",
  emits: ["update:show"],
  setup(a, { emit: e }) {
    const t = D(z), n = N(), r = b(""), l = b(0), u = b(0), d = b(null), c = E(() => n == null ? void 0 : n.getters["file/showFindDialog"]);
    _e(c, (S) => {
      S && C();
    });
    function m(S) {
      const I = { value: S };
      t.run(o.SearchReplaceWord, I);
    }
    function p() {
      if (!r.value) {
        u.value = 0, l.value = 0;
        return;
      }
      m({
        action: "search",
        val: r.value
      }), g();
    }
    function f() {
      m({
        action: "next"
      }), g();
    }
    function v() {
      m({
        action: "prev"
      }), g();
    }
    function g() {
      var S, I;
      l.value = ((S = n == null ? void 0 : n.getters["command/getVal"](o.SearchReplaceWord)) == null ? void 0 : S.countNum) || 0, u.value = ((I = n == null ? void 0 : n.getters["command/getVal"](o.SearchReplaceWord)) == null ? void 0 : I.totalCount) || 0;
    }
    function C() {
      r.value = t.api.getSearchSelectedWord() || "", setTimeout(h, 100), p();
    }
    function O() {
      m({
        action: "focusEditor"
      }), r.value = "", u.value = 0, l.value = 0, n.commit("file/setShowFindDialog", !1);
    }
    function h() {
      var S;
      (S = d == null ? void 0 : d.value) == null || S.focus();
    }
    function A(S) {
      S || O();
    }
    return (S, I) => (k(), $("div", null, [
      s(i(le), {
        show: c.value,
        "onUpdate:show": A,
        title: S.$t("toolbar.start.search"),
        width: 300,
        "show-mask": !1,
        draggable: !0
      }, {
        action: w(() => [
          s(i(j), {
            label: S.$t("toolbar.start.prev"),
            onClickButton: I[2] || (I[2] = (R) => v()),
            type: "standard"
          }, null, 8, ["label"]),
          s(i(j), {
            label: S.$t("toolbar.start.next"),
            onClickButton: I[3] || (I[3] = (R) => f())
          }, null, 8, ["label"])
        ]),
        default: w(() => [
          s(i(Ue), {
            value: r.value,
            "onUpdate:value": I[0] || (I[0] = (R) => r.value = R),
            placeholder: S.$t("toolbar.start.findPlaceHolder"),
            onInput: I[1] || (I[1] = (R) => p()),
            onKeydown: Y(f, ["enter"]),
            ref_key: "inputInstRef",
            ref: d
          }, {
            suffix: w(() => [
              _("span", ra, T(l.value) + "/" + T(u.value), 1)
            ]),
            _: 1
          }, 8, ["value", "placeholder"])
        ]),
        _: 1
      }, 8, ["show", "title"])
    ]));
  }
}), ia = /* @__PURE__ */ H(la, [["__scopeId", "data-v-b01076ea"]]), Pe = ".doc,.docx", sa = /* @__PURE__ */ B({
  __name: "edit",
  setup(a) {
    const e = N(), { t } = ie(), n = pe(), r = D(z), l = D(ge, null), u = b(null), d = b(!1), c = b(0), m = b(0), p = E(() => {
      var P;
      return ((P = e.state.command) == null ? void 0 : P.readOnly) === !0;
    }), f = E(() => {
      var P;
      return ((P = e.state.command) == null ? void 0 : P.loadEnd) === !0;
    }), v = [
      { label: t("dropDown.table.mergeCell"), key: "mergeCell" },
      { label: t("dropDown.table.unmergeCell"), key: "unmergeCell" },
      { type: "divider", key: "d1" },
      { label: t("dropDown.table.insertRow"), key: "insRow" },
      { label: t("dropDown.table.insertCol"), key: "insCol" },
      { type: "divider", key: "d2" },
      { label: t("dropDown.table.deleteRow"), key: "delRow" },
      { label: t("dropDown.table.deleteCol"), key: "delCol" },
      { type: "divider", key: "d3" },
      { label: t("dropDown.table.deleteTable"), key: "delTable" }
    ];
    let g = [];
    function C() {
      var P, L;
      try {
        (L = (P = r.api.docApp) == null ? void 0 : P.destroy) == null || L.call(P);
      } catch {
      }
    }
    function O(P, L) {
      return P.map((U) => U.type === "divider" ? U : {
        ...U,
        disabled: L
      });
    }
    function h(P) {
      d.value = !1;
      const L = {
        value: {
          action: P
        }
      };
      switch (P) {
        case "insRow":
        case "insCol":
        case "delRow":
        case "delCol":
        case "delTable":
          r.run(o.TableOperations, L);
          break;
        case "mergeCell":
        case "unmergeCell":
          r.run(o.TableCellOperations, L);
          break;
      }
    }
    function A(P) {
      f.value === !0 && (P.preventDefault(), d.value = !1, r.api.isTable() && (g = O(v, p.value), Ve(() => {
        d.value = !0, c.value = P.clientX, m.value = P.clientY;
      })));
    }
    function S() {
      d.value = !1;
    }
    function I(P) {
      const L = {
        copy: "C",
        paste: "V",
        cut: "X"
      };
      return `${/Mac|iPhone|iPad|iPod/i.test(navigator.platform) ? "Command" : "Ctrl"}+${L[P] || "C/V/X"}`;
    }
    function R(P) {
      if (P === "https") {
        n.warning(t("common.httpsOnly"));
        return;
      }
      (P === "copy" || P === "paste" || P === "cut") && n.warning(
        t("common.clipboardShortcutTip", {
          shortcut: I(P)
        })
      );
    }
    function x() {
      return new Promise((P) => {
        const L = document.createElement("input");
        L.type = "file", L.accept = Pe, L.style.display = "none", L.addEventListener(
          "change",
          () => {
            var he;
            const U = ((he = L.files) == null ? void 0 : he[0]) || null;
            if (L.remove(), U && !Me(U, Pe)) {
              n.warning("不支持打开该文件类型"), P(null);
              return;
            }
            if (U && U.size <= 0) {
              n.warning(t("common.emptyFileUnsupported")), P(null);
              return;
            }
            P(U);
          },
          { once: !0 }
        ), L.addEventListener(
          "cancel",
          () => {
            L.remove(), P(null);
          },
          { once: !0 }
        ), document.body.appendChild(L), L.click();
      });
    }
    async function Z() {
      var L;
      const P = await x();
      if (!(!P || !u.value))
        try {
          e.dispatch("file/onOpening"), C(), (L = r.destroy) == null || L.call(r), u.value.innerHTML = "";
          const U = await Se({
            docId: `local-${Date.now()}`,
            mode: l == null ? void 0 : l.mode,
            file: P,
            fileName: P.name,
            user: l == null ? void 0 : l.user,
            widgetMode: l == null ? void 0 : l.widgetMode,
            mainDom: u.value,
            eventTarget: l == null ? void 0 : l.eventTarget
          });
          r.initApi(U.app), e.dispatch("file/onConnected", {
            title: document.title,
            docId: U.docId
          });
        } catch (U) {
          console.error("OpenDocument failed:", U), e.commit("file/setReady"), ye(
            "OpenDocumentFailed",
            void 0,
            l == null ? void 0 : l.eventTarget
          );
        }
    }
    return Fe(() => {
      r.setSecurityErrorHandler(R), r.api.setOpenFileHandler(Z), l != null && l.mainDom && (l.mainDom.value = u.value), Se({
        docId: l == null ? void 0 : l.docId,
        mode: l == null ? void 0 : l.mode,
        file: l == null ? void 0 : l.file,
        fileUrl: l == null ? void 0 : l.fileUrl,
        fileName: l == null ? void 0 : l.fileName,
        user: l == null ? void 0 : l.user,
        widgetMode: l == null ? void 0 : l.widgetMode,
        mainDom: u.value,
        eventTarget: l == null ? void 0 : l.eventTarget
      }).then(({ docId: P, app: L }) => {
        r.initApi(L), e.dispatch("file/onConnected", {
          title: document.title,
          docId: P
        });
      }).catch((P) => {
        console.error("OpenDocument failed:", P), e.dispatch("file/onError", P), ye(
          "OpenDocumentFailed",
          void 0,
          l == null ? void 0 : l.eventTarget
        );
      });
    }), He(() => {
      r.setSecurityErrorHandler(null);
    }), (P, L) => (k(), $("div", {
      class: "main-container",
      onContextmenu: se(A, ["prevent"])
    }, [
      s(i($e), {
        trigger: "manual",
        show: d.value,
        x: c.value,
        y: m.value,
        options: i(g),
        onSelect: h,
        onClickoutside: S
      }, null, 8, ["show", "x", "y", "options"]),
      s(ia),
      _("div", {
        ref_key: "mainRef",
        ref: u,
        class: "main"
      }, null, 512)
    ], 32));
  }
}), Oe = Symbol("LayoutRefs");
function ua() {
  const a = D(Oe);
  if (!a) throw new Error("LayoutRefs not provided");
  return a;
}
const da = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAAAnlJREFUeAHFV79rFEEUfrOuGDEXFkFU7oojGoidlabTQsVStBEtPP8BxSaVcHuijVVIZedZpFRSClqk1M7KBE7lCg+iiByXhPzeyXxLBia782N382M/WO52l5nve9+8eW+WkcBo6+dTFkWh+BvQkYB1OeftXy/GWmw07DQZp5BKAI+2n3nEWYNKAvOONT1GvE7lIfCoZPjJB3cvV6gWHDcO+Npdja+8uFo/GV/Tc//tAnr9LXp956xxosFaRNemurQkfl2oBT7dGB+mm+OnYvL5xXW3ABkhBugwMuTR44kgNZEkvCLGXTp3QpAOx/cqPi2spMb4OhJMPtOopp4j6rdf+vElAaH3xLIhUogzodff1IrWCoAD778NxMQje55Nzv6Jl6giiJ5cP00N4YSNVCV/0O5p3/mmQa8+/qNbIiqQQblUD1KQZyEG4BbGmnLGKGCwazcihhsQ8ub+eWNuJIGEeymCcO0Y3/ZSRl0VyTTTqKWSyobvQgCSEW5hCSZn/+YXUJQcUPNnes7sgnMhi5CrMGV/JgGwbz/kgCn7nQJgPQTsB4gcSVxIwEGQ26yX0PqL6NUkygtsv7ZSLXMLyLrXk8CeR9R5uqVWABpJUeLKUL4jhlbARAYHfovk+iAqpOyean+AmMJLgOpligJEaKmfF5ZjAYCuMeEe5TvLmSElILnv1RasToiTExJVly+2M4NTAByQUFtwEvOLG9ZkhSNwIXcdqO6eB6H+oahipgnQ7WzrDBee3z5DLqQcwPrK5HIBIl3nAtQUmwvsQrPDqUSU/l0AAdk27KGAd8WnGbWoJLCIvWP4czHshBHnjxixOh0N+gj8R2tsagchpS3M0pXVDQAAAABJRU5ErkJggg==", F = {
  width: 737,
  image: We
}, Q = /* @__PURE__ */ B({
  __name: "CommandBigIconTextButton",
  props: {
    cmd: {},
    label: {},
    showArrow: { type: Boolean },
    x: {},
    y: {}
  },
  setup(a) {
    const e = N(), t = a, n = E(() => e == null ? void 0 : e.getters["command/can"](t.cmd)), r = D(z);
    function l() {
      r.run(t.cmd, void 0);
    }
    return (u, d) => (k(), $("div", {
      onClick: se(l, ["stop"])
    }, [
      s(i(ue), {
        label: a.label,
        "resource-image": i(F).image,
        disabled: !n.value,
        showArrow: a.showArrow,
        x: a.x,
        y: a.y,
        "image-width": i(F).width
      }, null, 8, ["label", "resource-image", "disabled", "showArrow", "x", "y", "image-width"])
    ]));
  }
}), ca = { style: { display: "flex", gap: "8px" } }, ma = /* @__PURE__ */ B({
  __name: "ClipboardGroup",
  setup(a) {
    const e = pe(), { t } = ie();
    function n(r) {
      location.protocol === "https:" || location.hostname === "localhost" || location.hostname === "127.0.0.1" || (r.preventDefault(), r.stopPropagation(), r.stopImmediatePropagation(), e.warning(t("common.httpsOnly")));
    }
    return (r, l) => (k(), $("div", ca, [
      s(Q, {
        cmd: i(o).Copy,
        label: r.$t("toolbar.start.copy"),
        x: -96,
        y: -30
      }, null, 8, ["cmd", "label"]),
      s(Q, {
        cmd: i(o).Paste,
        label: r.$t("toolbar.start.paste"),
        x: -72,
        y: -30,
        onClickCapture: n
      }, null, 8, ["cmd", "label"])
    ]));
  }
}), pa = { style: { display: "flex", gap: "8px" } }, ga = /* @__PURE__ */ B({
  __name: "FileButtonGroup",
  setup(a) {
    const e = pe(), { t } = ie();
    function n(r) {
      location.protocol === "https:" || location.hostname === "localhost" || location.hostname === "127.0.0.1" || (r.preventDefault(), r.stopPropagation(), r.stopImmediatePropagation(), e.warning(t("common.httpsOnly")));
    }
    return (r, l) => (k(), $("div", pa, [
      s(Q, {
        cmd: i(o).Open,
        label: r.$t("toolbar.file.open"),
        x: 0,
        y: -30
      }, null, 8, ["cmd", "label"]),
      s(i(W), {
        vertical: !0,
        height: 65,
        margin: "0px"
      }),
      s(Q, {
        cmd: i(o).Export,
        label: r.$t("toolbar.file.exportDocument"),
        x: -24,
        y: -30
      }, null, 8, ["cmd", "label"]),
      s(Q, {
        cmd: i(o).ExportPDF,
        label: r.$t("toolbar.file.exportPDF"),
        x: -48,
        y: -30,
        onClickCapture: n
      }, null, 8, ["cmd", "label"])
    ]));
  }
}), Ce = /* @__PURE__ */ B({
  __name: "CommandDropdownPopoverSmallButton",
  props: {
    show: { type: Boolean },
    cmd: {},
    tooltip: {},
    x: {},
    y: {},
    dropdownOptions: {},
    showChecked: { type: Boolean }
  },
  emits: ["update:show"],
  setup(a, { emit: e }) {
    const t = N(), n = a, r = e, l = E(() => t == null ? void 0 : t.getters["command/can"](n.cmd)), u = D(z), d = b(!1);
    function c(f) {
      m(f);
    }
    function m(f) {
      const v = { value: f };
      u.run(n.cmd, v);
    }
    function p(f) {
      r("update:show", f);
    }
    return (f, v) => (k(), $("div", null, [
      s(i(Ae), {
        show: a.show,
        options: a.dropdownOptions,
        disabled: !l.value,
        onSelect: c,
        "onUpdate:show": p,
        "show-checked": a.showChecked
      }, {
        option: w(({ item: g }) => [
          re(f.$slots, "option", { item: g })
        ]),
        default: w(() => [
          _("span", null, [
            s(i(Ie), {
              "resource-image": i(F).image,
              disabled: !l.value,
              x: a.x,
              y: a.y,
              "image-width": i(F).width,
              tooltip: a.tooltip,
              "sub-showing": d.value
            }, null, 8, ["resource-image", "disabled", "x", "y", "image-width", "tooltip", "sub-showing"])
          ])
        ]),
        _: 3
      }, 8, ["show", "options", "disabled", "show-checked"])
    ]));
  }
}), ha = /* @__PURE__ */ B({
  __name: "CommandAlignParaGroup",
  props: {
    cmd: {}
  },
  setup(a) {
    const e = N(), t = a, n = E(() => e == null ? void 0 : e.getters["command/can"](t.cmd)), r = E(() => e == null ? void 0 : e.getters["command/getVal"](t.cmd)), l = D(z);
    function u(v) {
      const g = { value: v };
      l.run(t.cmd, g);
    }
    const { t: d } = ie(), c = b(!1), m = b(!1), p = E(
      () => e == null ? void 0 : e.getters["command/getVal"](o.ParaSymbol)
    ), f = E(() => {
      var v, g, C;
      return [
        {
          value: "ParagraphMarks",
          label: d("toolbar.start.paraSymbolParagraphMarks"),
          checked: ((v = p == null ? void 0 : p.value) == null ? void 0 : v.ParagraphMarks) || !1,
          multiCheck: !0
        },
        {
          value: "PageBreak",
          label: d("toolbar.start.paraSymbolPageBreak"),
          checked: ((g = p == null ? void 0 : p.value) == null ? void 0 : g.PageBreak) || !1,
          multiCheck: !0
        },
        {
          value: "SectionBreak",
          label: d("toolbar.start.paraSymbolSectionBreak"),
          checked: ((C = p == null ? void 0 : p.value) == null ? void 0 : C.SectionBreak) || !1,
          multiCheck: !0
        }
      ];
    });
    return (v, g) => {
      const C = V("n-space"), O = V("n-ellipsis");
      return k(), $("div", null, [
        s(C, { vertical: "" }, {
          default: w(() => [
            s(C, null, {
              default: w(() => [
                s(i(G), {
                  active: r.value === "left",
                  disabled: !n.value,
                  onClick: g[0] || (g[0] = (h) => u("left")),
                  "resource-image": i(F).image,
                  x: -224,
                  y: -56,
                  tooltip: v.$t("toolbar.start.horizontalAlignLeft"),
                  "image-width": i(F).width,
                  class: "global-small-icon-button"
                }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
                s(i(G), {
                  active: r.value === "center",
                  disabled: !n.value,
                  onClick: g[1] || (g[1] = (h) => u("center")),
                  "resource-image": i(F).image,
                  x: -240,
                  y: -56,
                  tooltip: v.$t("toolbar.start.horizontalAlignCenter"),
                  "image-width": i(F).width,
                  class: "global-small-icon-button"
                }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
                s(i(G), {
                  active: r.value === "right",
                  disabled: !n.value,
                  onClick: g[2] || (g[2] = (h) => u("right")),
                  "resource-image": i(F).image,
                  x: -256,
                  y: -56,
                  tooltip: v.$t("toolbar.start.horizontalAlignRight"),
                  "image-width": i(F).width,
                  class: "global-small-icon-button"
                }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
                s(i(G), {
                  active: r.value === "justify",
                  disabled: !n.value,
                  onClick: g[3] || (g[3] = (h) => u("justify")),
                  "resource-image": i(F).image,
                  x: -272,
                  y: -56,
                  tooltip: v.$t("toolbar.start.horizontalAlignJustify"),
                  "image-width": i(F).width,
                  class: "global-small-icon-button"
                }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"])
              ]),
              _: 1
            }),
            s(C, null, {
              default: w(() => [
                s(i(G), {
                  active: r.value === "distribute",
                  disabled: !n.value,
                  onClick: g[4] || (g[4] = (h) => u("distribute")),
                  "resource-image": i(F).image,
                  x: -288,
                  y: -56,
                  tooltip: v.$t("toolbar.start.horizontalAlignDistribute"),
                  "image-width": i(F).width,
                  class: "global-small-icon-button"
                }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
                s(Ce, {
                  show: c.value,
                  "onUpdate:show": g[5] || (g[5] = (h) => c.value = h),
                  cmd: i(o).LineSpace,
                  x: -304,
                  y: -56,
                  tooltip: v.$t("toolbar.start.lineSpace"),
                  class: "global-small-icon-dropdown-button",
                  dropdownOptions: [
                    {
                      value: "1.0",
                      label: "1.0"
                    },
                    {
                      value: "1.15",
                      label: "1.15"
                    },
                    {
                      value: "1.5",
                      label: "1.5"
                    },
                    {
                      value: "2.0",
                      label: "2.0"
                    },
                    {
                      value: "2.5",
                      label: "2.5"
                    },
                    {
                      value: "3.0",
                      label: "3.0"
                    }
                  ]
                }, {
                  option: w(({ item: h }) => [
                    s(O, { style: { "max-width": "200px" } }, {
                      default: w(() => [
                        X(T(h.label), 1)
                      ]),
                      _: 2
                    }, 1024)
                  ]),
                  _: 1
                }, 8, ["show", "cmd", "tooltip"]),
                s(Ce, {
                  show: m.value,
                  "onUpdate:show": g[6] || (g[6] = (h) => m.value = h),
                  cmd: i(o).ParaSymbol,
                  x: -352,
                  y: -56,
                  tooltip: v.$t("toolbar.start.paraSymbol"),
                  dropdownOptions: f.value,
                  "show-checked": !0,
                  class: "global-small-icon-dropdown-button"
                }, {
                  option: w(({ item: h }) => [
                    s(O, { style: { "max-width": "200px" } }, {
                      default: w(() => [
                        X(T(h.label), 1)
                      ]),
                      _: 2
                    }, 1024)
                  ]),
                  _: 1
                }, 8, ["show", "cmd", "tooltip", "dropdownOptions"])
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]);
    };
  }
}), fa = { class: "toolbar-group" }, ba = /* @__PURE__ */ B({
  __name: "ParaStyleGroup",
  setup(a) {
    return (e, t) => (k(), $("div", fa, [
      s(ha, {
        cmd: i(o).ParaAlignHorizontal
      }, null, 8, ["cmd"])
    ]));
  }
}), va = /* @__PURE__ */ H(ba, [["__scopeId", "data-v-cc60306f"]]), oe = /* @__PURE__ */ B({
  __name: "CommandSmallButton",
  props: {
    cmd: {},
    x: {},
    y: {},
    tooltip: {}
  },
  setup(a) {
    const e = N(), t = a, n = E(() => e == null ? void 0 : e.getters["command/can"](t.cmd)), r = E(() => e == null ? void 0 : e.getters["command/active"](t.cmd)), l = D(z);
    function u() {
      const c = { value: !r.value };
      l.run(t.cmd, c);
    }
    return (d, c) => (k(), J(i(G), {
      onClick: u,
      "resource-image": i(F).image,
      disabled: !n.value,
      x: a.x,
      y: a.y,
      "image-width": i(F).width,
      tooltip: a.tooltip,
      active: r.value
    }, null, 8, ["resource-image", "disabled", "x", "y", "image-width", "tooltip", "active"]));
  }
}), ke = /* @__PURE__ */ B({
  __name: "CommandEditableSelect",
  props: {
    cmd: {},
    options: {},
    width: {},
    type: {},
    validateInput: { type: Function }
  },
  setup(a) {
    const e = N(), t = a, n = E(() => e == null ? void 0 : e.getters["command/can"](t.cmd)), r = E(() => e == null ? void 0 : e.getters["command/getVal"](t.cmd)), l = D(z);
    function u(d) {
      const c = { value: d };
      l.run(t.cmd, c), e.commit("command/setState", {
        cmd: t.cmd,
        ui: { value: d }
      });
    }
    return (d, c) => (k(), J(i(Ge), {
      "model-value": r.value,
      "onUpdate:modelValue": u,
      options: a.options,
      disabled: !n.value,
      width: a.width,
      "validate-input": a.validateInput,
      type: a.type
    }, null, 8, ["model-value", "options", "disabled", "width", "validate-input", "type"]));
  }
}), wa = /* @__PURE__ */ B({
  __name: "CommandColorPaletteSmallButton",
  props: {
    cmd: {},
    tooltip: {},
    x: {},
    y: {},
    showFill: { type: Boolean }
  },
  setup(a) {
    const e = N(), t = D(z);
    let n = b([]), r = b([]);
    const l = b(!1), u = a, d = E(() => e == null ? void 0 : e.getters["command/can"](u.cmd)), c = E(() => e == null ? void 0 : e.getters["command/getVal"](u.cmd)), m = E(() => e == null ? void 0 : e.getters["file/recentColors"]);
    function p(v) {
      const g = { value: v };
      t.run(u.cmd, g), e.commit("file/addRecentColors", v);
    }
    function f(v) {
      var g;
      if (l.value = v, v) {
        let C = e == null ? void 0 : e.getters["file/colorPalette"];
        if (!C) {
          const O = (g = t.api) == null ? void 0 : g.getPalette();
          O && (C = je(O), e.commit("file/setColorPalette", C));
        }
        n.value = C == null ? void 0 : C.standardColors, r.value = C == null ? void 0 : C.themeColors;
      }
    }
    return (v, g) => (k(), J(i(Ze), {
      val: c.value,
      "standard-colors": i(n),
      "theme-colors": i(r),
      "recent-colors": m.value,
      showFill: a.showFill,
      onSelect: p,
      onShow: f
    }, {
      default: w(() => [
        s(i(Ie), {
          "resource-image": i(F).image,
          disabled: !d.value,
          x: a.x,
          y: a.y,
          "image-width": i(F).width,
          tooltip: a.tooltip,
          "sub-showing": l.value,
          "show-color-cube": !0,
          color: a.showFill ? c.value || "" : c.value || "rgb(0, 0, 0)",
          onClick: g[0] || (g[0] = se(() => {
          }, ["stop"]))
        }, null, 8, ["resource-image", "disabled", "x", "y", "image-width", "tooltip", "sub-showing", "color"])
      ]),
      _: 1
    }, 8, ["val", "standard-colors", "theme-colors", "recent-colors", "showFill"]));
  }
}), Sa = {
  common: {
    confirm: "Confirm",
    cancel: "Cancel",
    unit: {
      CM: "CM"
    },
    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",
      paste: "Paste",
      bold: "Bold",
      italic: "Italic",
      underline: "Underline",
      strikeout: "Strikeout",
      fontClolor: "Font Clolor",
      horizontalAlignLeft: "Align Left",
      horizontalAlignCenter: "Align Center",
      horizontalAlignRight: "Align Right",
      horizontalAlignJustify: "Align Justify",
      horizontalAlignDistribute: "Align Distribute",
      listTypeBullet: "Item",
      listTypeNum: "Number",
      lineSpace: "Line Space",
      paraSymbol: "Show/Hide Edit Symbol",
      paraSymbolParagraphMarks: "Show/Hide Paragraph marks",
      paraSymbolPageBreak: "Show/Hide Page break",
      paraSymbolSectionBreak: "Show/Hide Section break",
      search: "Search",
      findPlaceHolder: "Please input search content",
      next: "Next",
      prev: "Prev"
    },
    insert: {
      title: "INSERT",
      separator: "Separator",
      insertPageSeparator: "Insert Page Separator",
      insertSectionSeparator: "Insert Section Separator",
      nextPage: "Next Page",
      continuousPage: "Continuous Page",
      evenPage: "Even Page",
      oddPage: "Odd Page",
      table: "Table",
      row: "Row",
      column: "Column",
      moreRowColumn: "More Row and Column",
      insertTable: "Insert Table"
    },
    layout: {
      title: "LAYOUT",
      paperOrientation: "Paper Orientation",
      paperHorizontal: "Horizontal",
      paperVertical: "Vertical",
      paperSize: "Paper Size",
      paperSizeLabel: {
        a4: "A4",
        a3: "A3",
        kai8: "8 Kai",
        kai16: "16 Kai",
        kai16Large: "Large 16 Kai",
        kai32: "32 Kai",
        kai32Large: "Large 32 Kai",
        letter3: "Size 3 envelope",
        letter5: "Size 5 envelope",
        letter6: "Size 6 envelope",
        letter7: "Size 7 envelope",
        letter9: "Size 7 envelope"
      },
      paperSetting: "Paper Setting"
    }
  },
  statusBar: {
    fullscreen: "Full Screen",
    pageNum: "Page Num",
    pages: "Pages",
    pageViewSingle: "Single",
    pageViewMulti: "Multi",
    pageViewWide: "Wide"
  },
  dropDown: {
    table: {
      mergeCell: "Merge Cell",
      unmergeCell: "Unmerge Cell",
      insertRow: "Insert Row",
      insertCol: "Insert Col",
      deleteRow: "Delete Row",
      deleteCol: "Delete Col",
      deleteTable: "Delete Table"
    }
  },
  dialogs: {
    paperSizeSet: {
      title: "Paper Setting",
      width: "Width",
      height: "Height",
      errorMessage: "The measurement must be between 0.26 cm and 55.87 cm"
    },
    insertTable: {
      title: "Insert Table",
      row: "Row",
      column: "Column",
      rowErrorMessage: "The number must be between 1 and 32767",
      columnErrorMessage: "The number must be between 1 and 63"
    },
    pageSelector: {
      title: "Jump To",
      jumpTo: "Jump to the specified page",
      pageCountError: "Page number is incorrect, please re-enter it."
    }
  }
}, ya = Be(Ke, Sa), Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: ya
}, Symbol.toStringTag, { value: "Module" })), Pa = {
  common: {
    confirm: "确定",
    cancel: "取消",
    unit: {
      CM: "厘米"
    },
    httpsOnly: "请在https环境下使用该功能",
    clipboardShortcutTip: "受浏览器安全限制，无法通过按钮完成该操作，请使用快捷键 {shortcut}。",
    emptyFileUnsupported: "不支持打开 0KB 的空文件"
  },
  toolbar: {
    file: {
      title: "文件",
      export: "导出",
      exportDocument: "导出",
      exportPDF: "导出PDF",
      open: "打开"
    },
    start: {
      title: "开始",
      undo: "撤销",
      redo: "重做",
      copy: "复制",
      paste: "粘贴",
      bold: "粗体",
      italic: "斜体",
      underline: "下划线",
      strikeout: "删除线",
      fontClolor: "字体颜色",
      horizontalAlignLeft: "左对齐",
      horizontalAlignCenter: "居中对齐",
      horizontalAlignRight: "右对齐",
      horizontalAlignJustify: "两端对齐",
      horizontalAlignDistribute: "分散对齐",
      listTypeBullet: "项目符号",
      listTypeNum: "编号",
      lineSpace: "行间距",
      paraSymbol: "显示/隐藏编辑标记",
      paraSymbolParagraphMarks: "显示/隐藏段落标记",
      paraSymbolPageBreak: "显示/隐藏分页符",
      paraSymbolSectionBreak: "显示/隐藏分节符",
      search: "搜索",
      findPlaceHolder: "请输入查找内容",
      next: "下一个",
      prev: "上一个"
    },
    insert: {
      title: "插入",
      separator: "分页符",
      insertPageSeparator: "插入分页符",
      insertSectionSeparator: "插入分节符",
      nextPage: "下一页",
      continuousPage: "连续页",
      evenPage: "偶数页",
      oddPage: "奇数页",
      table: "表格",
      row: "行",
      column: "列",
      moreRowColumn: "更多行列",
      insertTable: "插入表格"
    },
    layout: {
      title: "布局",
      paperOrientation: "纸张方向",
      paperHorizontal: "横向",
      paperVertical: "纵向",
      paperSize: "纸张大小",
      paperSizeLabel: {
        a4: "A4",
        a3: "A3",
        kai8: "8开",
        kai16: "16开",
        kai16Large: "大16开",
        kai32: "32开",
        kai32Large: "大32开",
        letter3: "3号信封",
        letter5: "5号信封",
        letter6: "6号信封",
        letter7: "7号信封",
        letter9: "9号信封"
      },
      paperSetting: "页面设置"
    }
  },
  statusBar: {
    fullscreen: "全屏",
    pageNum: "页码",
    pages: "页面",
    pageViewSingle: "单页",
    pageViewMulti: "多页",
    pageViewWide: "宽页"
  },
  dropDown: {
    table: {
      mergeCell: "合并单元格",
      unmergeCell: "取消合并单元格",
      insertRow: "插入行",
      insertCol: "插入列",
      deleteRow: "删除行",
      deleteCol: "删除列",
      deleteTable: "删除表格"
    }
  },
  dialogs: {
    paperSizeSet: {
      title: "页面设置",
      width: "宽度",
      height: "高度",
      errorMessage: "度量值必须介于0.26厘米和55.87厘米之间"
    },
    insertTable: {
      title: "插入表格",
      row: "行",
      column: "列",
      rowErrorMessage: "数字必须介于1和32767之间",
      columnErrorMessage: "数字必须介于1和63之间"
    },
    pageSelector: {
      title: "跳转",
      jumpTo: "跳转到指定页码",
      pageCountError: "当前页码有误，请重新输入"
    }
  }
}, Ca = Be(Je, Pa), De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: Ca
}, Symbol.toStringTag, { value: "Module" })), ka = /* @__PURE__ */ Object.assign({ "./en-US.ts": Te, "./zh-CN.ts": De }), Ea = /* @__PURE__ */ Object.assign({ "./en-US.ts": Te, "./zh-CN.ts": De });
function Ra() {
  let a = {};
  return Ee(ka, a), Ee(Ea, a), a;
}
function Ee(a, e) {
  for (let t in a)
    if (a[t].default) {
      let n = t.substr(t.lastIndexOf("/") + 1, 5);
      e[n] ? e[n] = {
        ...a[n],
        ...a[t].default
      } : e[n] = a[t].default;
    }
}
let te = "zh-CN";
function _a(a) {
  return te = a || te, Qe({
    legacy: !1,
    locale: te,
    messages: Ra(),
    globalInjection: !0
  });
}
const Fa = { class: "toolbar-group" }, $a = /* @__PURE__ */ B({
  __name: "TextStyleGroup",
  setup(a) {
    const e = b([]), t = Ye("docx", te);
    async function n() {
      (q == null || q.length == 0) && await qe(), q && q.length !== e.value.length && (e.value = q.map(({ fullName: r }) => ({
        label: r,
        value: r
      })));
    }
    return (r, l) => {
      const u = V("n-space");
      return k(), $("div", Fa, [
        s(u, { vertical: "" }, {
          default: w(() => [
            s(u, null, {
              default: w(() => [
                _("span", { onClick: n }, [
                  s(ke, {
                    cmd: i(o).FontName,
                    options: e.value,
                    width: 140,
                    type: "font"
                  }, null, 8, ["cmd", "options"])
                ]),
                s(ke, {
                  cmd: i(o).FontSize,
                  options: i(t),
                  width: 70,
                  "validate-input": i(Xe)
                }, null, 8, ["cmd", "options", "validate-input"])
              ]),
              _: 1
            }),
            s(u, null, {
              default: w(() => [
                s(oe, {
                  cmd: i(o).Bold,
                  x: -112,
                  y: -56,
                  tooltip: r.$t("toolbar.start.bold"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                s(oe, {
                  cmd: i(o).Italic,
                  x: -128,
                  y: -56,
                  tooltip: r.$t("toolbar.start.italic"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                s(oe, {
                  cmd: i(o).Underline,
                  x: -144,
                  y: -56,
                  tooltip: r.$t("toolbar.start.underline"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                s(oe, {
                  cmd: i(o).Strikeout,
                  x: -160,
                  y: -56,
                  tooltip: r.$t("toolbar.start.strikeout"),
                  class: "global-small-icon-button"
                }, null, 8, ["cmd", "tooltip"]),
                s(wa, {
                  cmd: i(o).FontColor,
                  x: -176,
                  y: -56,
                  tooltip: r.$t("toolbar.start.fontClolor"),
                  class: "global-small-icon-dropdown-button"
                }, null, 8, ["cmd", "tooltip"])
              ]),
              _: 1
            })
          ]),
          _: 1
        })
      ]);
    };
  }
}), Ia = /* @__PURE__ */ H($a, [["__scopeId", "data-v-1145ac39"]]), Ba = { style: { display: "flex", gap: "8px" } }, de = /* @__PURE__ */ B({
  __name: "UndoRedoGroup",
  setup(a) {
    return (e, t) => (k(), $("div", Ba, [
      s(Q, {
        cmd: i(o).Undo,
        label: e.$t("toolbar.start.undo"),
        x: -168,
        y: -30
      }, null, 8, ["cmd", "label"]),
      s(Q, {
        cmd: i(o).Redo,
        label: e.$t("toolbar.start.redo"),
        x: -144,
        y: -30
      }, null, 8, ["cmd", "label"])
    ]));
  }
}), La = /* @__PURE__ */ B({
  __name: "CommandBigIconDropDownButton",
  props: {
    cmd: {},
    label: {},
    x: {},
    y: {},
    dropdownOptions: {}
  },
  setup(a) {
    const e = N(), t = a, n = E(() => e == null ? void 0 : e.getters["command/can"](t.cmd)), r = E(() => e == null ? void 0 : e.getters["command/active"](t.cmd)), l = D(z);
    function u(c) {
      d(c);
    }
    function d(c) {
      const m = { value: c };
      l.run(t.cmd, m);
    }
    return (c, m) => (k(), $("div", null, [
      s(i($e), {
        trigger: "click",
        placement: "bottom-start",
        options: a.dropdownOptions,
        onSelect: u
      }, {
        default: w(() => [
          _("span", null, [
            s(i(ue), {
              label: a.label,
              "resource-image": i(F).image,
              disabled: !n.value,
              active: r.value,
              showArrow: !0,
              x: a.x,
              y: a.y,
              "image-width": i(F).width
            }, null, 8, ["label", "resource-image", "disabled", "active", "x", "y", "image-width"])
          ])
        ]),
        _: 1
      }, 8, ["options"])
    ]));
  }
}), Aa = { style: { display: "flex", gap: "8px" } }, Oa = /* @__PURE__ */ B({
  __name: "InsertSeparatorGroup",
  setup(a) {
    return (e, t) => (k(), $("div", Aa, [
      s(La, {
        cmd: i(o).InsertSeparator,
        label: e.$t("toolbar.insert.separator"),
        x: -192,
        y: -30,
        "dropdown-options": [
          { key: "pageSeparator", label: e.$t("toolbar.insert.insertPageSeparator") },
          {
            key: "sectionSeparator",
            label: e.$t("toolbar.insert.insertSectionSeparator"),
            children: [
              {
                label: e.$t("toolbar.insert.nextPage"),
                key: "nextPage"
              },
              {
                label: e.$t("toolbar.insert.continuousPage"),
                key: "continuousPage"
              },
              {
                label: e.$t("toolbar.insert.evenPage"),
                key: "evenPage"
              },
              {
                label: e.$t("toolbar.insert.oddPage"),
                key: "oddPage"
              }
            ]
          }
        ]
      }, null, 8, ["cmd", "label", "dropdown-options"])
    ]));
  }
}), Ta = { class: "trigger-wrapper" }, Da = /* @__PURE__ */ B({
  __name: "CommandBigIconPopoverButton",
  props: {
    show: { type: Boolean },
    cmd: {},
    label: {},
    x: {},
    y: {},
    placement: { default: "bottom" }
  },
  emits: ["update:show"],
  setup(a, { emit: e }) {
    const t = N(), n = a, r = E(() => t == null ? void 0 : t.getters["command/can"](n.cmd)), l = E(() => t == null ? void 0 : t.getters["command/active"](n.cmd)), u = D(z), d = e;
    function c(p) {
      const f = { value: p };
      u.run(n.cmd, f);
    }
    function m(p) {
      d("update:show", p);
    }
    return (p, f) => (k(), $("div", null, [
      s(i(et), {
        show: a.show,
        trigger: "click",
        placement: a.placement,
        "onUpdate:show": m
      }, {
        trigger: w(() => [
          _("div", Ta, [
            s(i(ue), {
              label: a.label,
              "resource-image": i(F).image,
              disabled: !r.value,
              active: l.value,
              showArrow: !0,
              x: a.x,
              y: a.y,
              "image-width": i(F).width
            }, null, 8, ["label", "resource-image", "disabled", "active", "x", "y", "image-width"])
          ])
        ]),
        default: w(() => [
          re(p.$slots, "popover", { runCommand: c }, void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "placement"])
    ]));
  }
}), xa = /* @__PURE__ */ H(Da, [["__scopeId", "data-v-a9f88d4f"]]), Na = { class: "custom-panel" }, za = { class: "custom-row" }, Ua = { class: "global-basic-display-text text" }, Ha = { class: "custom-row" }, Va = { class: "global-basic-display-text text" }, Ma = /* @__PURE__ */ B({
  __name: "InsertTableDialog",
  setup(a, { expose: e }) {
    const t = b(!1), n = b(!1), r = b(""), l = b(1), u = b(32767), d = b(!1), c = b(""), m = b(1), p = b(63), f = b(0), v = b(0);
    let g = null;
    function C(R) {
      h(R, l.value, u.value) ? (n.value = !1, r.value = "") : (n.value = !0, r.value = "error");
    }
    function O(R) {
      h(R, m.value, p.value) ? (d.value = !1, c.value = "") : (d.value = !0, c.value = "error");
    }
    function h(R, x, Z) {
      const P = Number(R);
      return R === "" || !isNaN(P) && P >= x && P <= Z;
    }
    function A(R, x) {
      R && (f.value = R.row, v.value = R.column), n.value = !1, r.value = "", d.value = !1, c.value = "", g = x, t.value = !0;
    }
    function S() {
      f.value < l.value || f.value > u.value || v.value < m.value || v.value > p.value || (g && g({
        rows: f.value,
        cols: v.value
      }), t.value = !1);
    }
    function I() {
      t.value = !1;
    }
    return e({
      openPopover: A
    }), (R, x) => (k(), $("div", null, [
      s(i(le), {
        show: t.value,
        "onUpdate:show": x[2] || (x[2] = (Z) => t.value = Z),
        title: R.$t("dialogs.insertTable.title"),
        width: 240
      }, {
        action: w(() => [
          s(i(j), {
            label: R.$t("common.cancel"),
            onClickButton: I,
            type: "standard"
          }, null, 8, ["label"]),
          s(i(j), {
            label: R.$t("common.confirm"),
            onClickButton: S
          }, null, 8, ["label"])
        ]),
        default: w(() => [
          _("div", Na, [
            _("div", za, [
              _("span", Ua, T(R.$t("dialogs.insertTable.row")), 1),
              s(i(ae), {
                "validation-status": r.value,
                feedback: n.value ? R.$t("dialogs.insertTable.rowErrorMessage") : ""
              }, {
                default: w(() => [
                  s(i(ne), {
                    value: f.value,
                    "onUpdate:value": x[0] || (x[0] = (Z) => f.value = Z),
                    class: "custom-input-num",
                    "show-step-button": !0,
                    precision: 0,
                    min: l.value,
                    max: u.value,
                    onKeydown: Y(S, ["enter"]),
                    onInput: C
                  }, null, 8, ["value", "min", "max"])
                ]),
                _: 1
              }, 8, ["validation-status", "feedback"])
            ]),
            _("div", Ha, [
              _("span", Va, T(R.$t("dialogs.insertTable.column")), 1),
              s(i(ae), {
                "validation-status": c.value,
                feedback: d.value ? R.$t("dialogs.insertTable.columnErrorMessage") : ""
              }, {
                default: w(() => [
                  s(i(ne), {
                    value: v.value,
                    "onUpdate:value": x[1] || (x[1] = (Z) => v.value = Z),
                    class: "custom-input-num",
                    "show-step-button": !0,
                    precision: 0,
                    min: m.value,
                    max: p.value,
                    onKeydown: Y(S, ["enter"]),
                    onInput: O
                  }, null, 8, ["value", "min", "max"])
                ]),
                _: 1
              }, 8, ["validation-status", "feedback"])
            ])
          ])
        ]),
        _: 1
      }, 8, ["show", "title"])
    ]));
  }
}), Wa = /* @__PURE__ */ H(Ma, [["__scopeId", "data-v-68abbb71"]]), Ga = { style: { display: "flex", gap: "8px" } }, Za = { class: "insert-table-popover" }, ja = { class: "global-basic-display-text grid-label" }, Ka = { key: 0 }, Ja = { key: 1 }, Qa = ["onMouseenter", "onClick"], Xa = 10, Ya = 10, qa = /* @__PURE__ */ B({
  __name: "InsertTableButton",
  setup(a) {
    const e = b(!1), t = b(null), n = b(0), r = b(0);
    function l(d) {
      var c;
      e.value = !1, (c = t == null ? void 0 : t.value) == null || c.openPopover(
        {
          row: 3,
          column: 4
        },
        (m) => {
          d(m);
        }
      );
    }
    function u() {
      n.value = 0, r.value = 0;
    }
    return (d, c) => {
      const m = V("n-icon"), p = V("n-button");
      return k(), $("div", Ga, [
        s(xa, {
          cmd: i(o).InsertTable,
          label: d.$t("toolbar.insert.table"),
          x: -216,
          y: -30,
          show: e.value,
          "onUpdate:show": c[0] || (c[0] = (f) => e.value = f)
        }, {
          popover: w(({ runCommand: f }) => [
            _("div", Za, [
              _("div", ja, [
                n.value + r.value != 0 ? (k(), $("span", Ka, T(n.value + d.$t("toolbar.insert.row")) + " * " + T(r.value + d.$t("toolbar.insert.column")), 1)) : (k(), $("span", Ja, T(d.$t("toolbar.insert.insertTable")), 1))
              ]),
              _("div", {
                class: "table-grid",
                onMouseleave: u
              }, [
                (k(), $(fe, null, be(Xa, (v) => _("div", {
                  key: "row-" + v,
                  class: "grid-row"
                }, [
                  (k(), $(fe, null, be(Ya, (g) => _("div", {
                    key: "col-" + g,
                    class: tt(["grid-cell", { selected: v <= n.value && g <= r.value }]),
                    onMouseenter: (C) => {
                      n.value = v, r.value = g;
                    },
                    onClick: () => {
                      f({ rows: v, cols: g }), e.value = !1;
                    }
                  }, null, 42, Qa)), 64))
                ])), 64))
              ], 32),
              s(p, {
                text: "",
                onClick: (v) => l(f),
                class: "global-basic-display-text action-text more-button",
                "icon-placement": "right",
                color: "#131313"
              }, {
                icon: w(() => [
                  s(m, { size: "12" }, {
                    default: w(() => [
                      s(i(Le))
                    ]),
                    _: 1
                  })
                ]),
                default: w(() => [
                  X(" " + T(d.$t("toolbar.insert.moreRowColumn")), 1)
                ]),
                _: 1
              }, 8, ["onClick"])
            ])
          ]),
          _: 1
        }, 8, ["cmd", "label", "show"]),
        s(Wa, {
          ref_key: "InsertTableDialogRef",
          ref: t
        }, null, 512)
      ]);
    };
  }
}), en = /* @__PURE__ */ H(qa, [["__scopeId", "data-v-1ab07a94"]]), tn = { style: { display: "flex", gap: "8px" } }, an = /* @__PURE__ */ B({
  __name: "SearchWordButton",
  setup(a) {
    return (e, t) => (k(), $("div", tn, [
      s(Q, {
        cmd: i(o).SearchReplaceWord,
        label: e.$t("toolbar.start.search"),
        x: -120,
        y: -30
      }, null, 8, ["cmd", "label"])
    ]));
  }
}), nn = { class: "custom-panel" }, on = { class: "custom-row" }, rn = { class: "global-basic-display-text text" }, ln = { class: "custom-row" }, sn = { class: "global-basic-display-text text" }, un = /* @__PURE__ */ B({
  __name: "PaperSizeSettingDialog",
  setup(a, { expose: e }) {
    const t = b(!1), n = b(!1), r = b(""), l = b(!1), u = b(""), d = b(0.26), c = b(55.87), m = b(0), p = b(0);
    let f = null;
    function v(S) {
      C(S, d.value, c.value) ? (n.value = !1, r.value = "") : (n.value = !0, r.value = "error");
    }
    function g(S) {
      C(S, d.value, c.value) ? (l.value = !1, u.value = "") : (l.value = !0, u.value = "error");
    }
    function C(S, I, R) {
      const x = Number(S);
      return S === "" || !isNaN(x) && x >= I && x <= R;
    }
    function O(S, I) {
      S && (m.value = S.width, p.value = S.height), n.value = !1, r.value = "", l.value = !1, u.value = "", f = I, t.value = !0;
    }
    function h() {
      m.value < d.value || m.value > c.value || p.value < d.value || p.value > c.value || (f && f({
        width: m.value,
        height: p.value
      }), t.value = !1);
    }
    function A() {
      t.value = !1;
    }
    return e({
      openPopover: O
    }), (S, I) => (k(), $("div", null, [
      s(i(le), {
        show: t.value,
        "onUpdate:show": I[2] || (I[2] = (R) => t.value = R),
        title: S.$t("dialogs.paperSizeSet.title"),
        width: 260
      }, {
        action: w(() => [
          s(i(j), {
            label: S.$t("common.cancel"),
            onClickButton: A,
            type: "standard"
          }, null, 8, ["label"]),
          s(i(j), {
            label: S.$t("common.confirm"),
            onClickButton: h
          }, null, 8, ["label"])
        ]),
        default: w(() => [
          _("div", nn, [
            _("div", on, [
              _("span", rn, T(S.$t("dialogs.paperSizeSet.width")), 1),
              s(i(ae), {
                "validation-status": r.value,
                feedback: n.value ? S.$t("dialogs.paperSizeSet.errorMessage") : "",
                class: "custom-input-num"
              }, {
                default: w(() => [
                  s(i(ne), {
                    value: m.value,
                    "onUpdate:value": I[0] || (I[0] = (R) => m.value = R),
                    min: d.value,
                    max: c.value,
                    onKeydown: Y(h, ["enter"]),
                    onInput: v
                  }, {
                    suffix: w(() => [
                      X(T(S.$t("common.unit.CM")), 1)
                    ]),
                    _: 1
                  }, 8, ["value", "min", "max"])
                ]),
                _: 1
              }, 8, ["validation-status", "feedback"])
            ]),
            _("div", ln, [
              _("span", sn, T(S.$t("dialogs.paperSizeSet.height")), 1),
              s(i(ae), {
                "validation-status": u.value,
                feedback: l.value ? S.$t("dialogs.paperSizeSet.errorMessage") : "",
                class: "custom-input-num"
              }, {
                default: w(() => [
                  s(i(ne), {
                    value: p.value,
                    "onUpdate:value": I[1] || (I[1] = (R) => p.value = R),
                    min: d.value,
                    max: c.value,
                    onKeydown: Y(h, ["enter"]),
                    onInput: g
                  }, {
                    suffix: w(() => [
                      X(T(S.$t("common.unit.CM")), 1)
                    ]),
                    _: 1
                  }, 8, ["value", "min", "max"])
                ]),
                _: 1
              }, 8, ["validation-status", "feedback"])
            ])
          ])
        ]),
        _: 1
      }, 8, ["show", "title"])
    ]));
  }
}), dn = /* @__PURE__ */ H(un, [["__scopeId", "data-v-23bd6975"]]), Re = /* @__PURE__ */ B({
  __name: "CommandDropdownPopoverBigButton",
  props: {
    show: { type: Boolean },
    cmd: {},
    label: {},
    x: {},
    y: {},
    dropdownOptions: {}
  },
  emits: ["update:show"],
  setup(a, { emit: e }) {
    const t = N(), n = a, r = e, l = E(() => t == null ? void 0 : t.getters["command/can"](n.cmd)), u = E(() => t == null ? void 0 : t.getters["command/active"](n.cmd)), d = D(z);
    function c(f) {
      m(f);
    }
    function m(f) {
      const v = { value: f };
      d.run(n.cmd, v);
    }
    function p(f) {
      r("update:show", f);
    }
    return (f, v) => (k(), $("div", null, [
      s(i(Ae), {
        show: a.show,
        options: a.dropdownOptions,
        disabled: !l.value,
        onSelect: c,
        "onUpdate:show": p
      }, {
        option: w(({ item: g, checked: C }) => [
          re(f.$slots, "option", {
            item: g,
            checked: C
          })
        ]),
        footer: w(() => [
          re(f.$slots, "footer", { runCommand: m })
        ]),
        default: w(() => [
          _("span", null, [
            s(i(ue), {
              label: a.label,
              "resource-image": i(F).image,
              disabled: !l.value,
              active: u.value,
              showArrow: !0,
              x: a.x,
              y: a.y,
              "image-width": i(F).width
            }, null, 8, ["label", "resource-image", "disabled", "active", "x", "y", "image-width"])
          ])
        ]),
        _: 3
      }, 8, ["show", "options", "disabled"])
    ]));
  }
}), xe = [
  {
    value: "a4",
    width: 21,
    height: 29.7
  },
  {
    value: "a3",
    width: 29.7,
    height: 42
  },
  {
    value: "kai8",
    width: 25.9,
    height: 36.7
  },
  {
    value: "kai16",
    width: 18.3,
    height: 25.9
  },
  {
    value: "kai16Large",
    width: 20.9,
    height: 28.4
  },
  {
    value: "kai32",
    width: 12.9,
    height: 18.3
  },
  {
    value: "kai32Large",
    width: 13.9,
    height: 20.2
  },
  {
    value: "letter3",
    width: 12.4,
    height: 17.5
  },
  {
    value: "letter5",
    width: 10.9,
    height: 21.9
  },
  {
    value: "letter6",
    width: 11.9,
    height: 22.9
  },
  {
    value: "letter7",
    width: 16.1,
    height: 22.8
  },
  {
    value: "letter9",
    width: 22.8,
    height: 32.3
  }
];
function cn(a) {
  const e = xe.find((t) => t.value === a);
  return e ? {
    width: e.width,
    height: e.height
  } : null;
}
const mn = { style: { display: "flex", gap: "8px" } }, pn = { class: "paper-size-option" }, gn = { style: { padding: "0px 5px" } }, hn = /* @__PURE__ */ B({
  __name: "PageSettingGroup",
  setup(a) {
    const e = b(null), t = b(!1), n = b(!1);
    function r(l) {
      var u;
      n.value = !1, (u = e == null ? void 0 : e.value) == null || u.openPopover(
        {
          width: 21,
          height: 29.7
        },
        (d) => {
          l(d);
        }
      );
    }
    return (l, u) => {
      const d = V("n-ellipsis"), c = V("n-icon"), m = V("n-button");
      return k(), $("div", mn, [
        s(Re, {
          show: t.value,
          "onUpdate:show": u[0] || (u[0] = (p) => t.value = p),
          cmd: i(o).PaperOrientation,
          label: l.$t("toolbar.layout.paperOrientation"),
          x: -240,
          y: -30,
          "dropdown-options": [
            {
              value: "paperHorizontal",
              label: l.$t("toolbar.layout.paperHorizontal")
            },
            { value: "paperVertical", label: l.$t("toolbar.layout.paperVertical") }
          ]
        }, {
          option: w(({ item: p }) => [
            s(d, { style: { "max-width": "200px" } }, {
              default: w(() => [
                X(T(p.label), 1)
              ]),
              _: 2
            }, 1024)
          ]),
          _: 1
        }, 8, ["show", "cmd", "label", "dropdown-options"]),
        s(i(W), {
          vertical: !0,
          height: 65,
          margin: "0px"
        }),
        s(Re, {
          cmd: i(o).PaperSize,
          label: l.$t("toolbar.layout.paperSize"),
          x: -264,
          y: -30,
          "dropdown-options": i(xe),
          show: n.value,
          "onUpdate:show": u[1] || (u[1] = (p) => n.value = p)
        }, {
          option: w(({ item: p, checked: f }) => [
            _("div", pn, [
              _("div", {
                class: "global-basic-display-text paper-label",
                style: ve(f ? { color: "white" } : {})
              }, T(l.$t("toolbar.layout.paperSizeLabel." + p.value)), 5),
              _("div", {
                class: "global-basic-display-text paper-desp",
                style: ve(f ? { color: "white" } : {})
              }, T(p.width + l.$t("common.unit.CM")) + " x " + T(p.height + l.$t("common.unit.CM")), 5)
            ])
          ]),
          footer: w(({ runCommand: p }) => [
            s(i(W), { margin: 5 }),
            _("div", gn, [
              s(m, {
                text: "",
                class: "global-basic-display-text action-text paper-setting-button",
                "icon-placement": "right",
                onClick: (f) => r(p),
                color: "#131313"
              }, {
                icon: w(() => [
                  s(c, { size: "12" }, {
                    default: w(() => [
                      s(i(Le))
                    ]),
                    _: 1
                  })
                ]),
                default: w(() => [
                  X(" " + T(l.$t("toolbar.layout.paperSetting")), 1)
                ]),
                _: 1
              }, 8, ["onClick"])
            ])
          ]),
          _: 1
        }, 8, ["cmd", "label", "dropdown-options", "show"]),
        s(dn, {
          ref_key: "PaperSizeSettingDialogRef",
          ref: e
        }, null, 512)
      ]);
    };
  }
}), fn = /* @__PURE__ */ H(hn, [["__scopeId", "data-v-f303758b"]]), bn = /* @__PURE__ */ B({
  __name: "CommandListParaTypeGroup",
  props: {
    cmd: {}
  },
  setup(a) {
    const e = N(), t = a, n = E(() => e == null ? void 0 : e.getters["command/can"](t.cmd)), r = E(() => e == null ? void 0 : e.getters["command/getVal"](t.cmd)), l = D(z);
    function u(d) {
      const c = { value: d };
      l.run(t.cmd, c);
    }
    return (d, c) => {
      const m = V("n-space");
      return k(), J(m, { vertical: "" }, {
        default: w(() => [
          s(i(G), {
            active: r.value === "bullet",
            disabled: !n.value,
            onClick: c[0] || (c[0] = (p) => u("bullet")),
            "resource-image": i(F).image,
            x: -192,
            y: -56,
            tooltip: d.$t("toolbar.start.listTypeBullet"),
            "image-width": i(F).width,
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"]),
          s(i(G), {
            active: r.value === "num",
            disabled: !n.value,
            onClick: c[1] || (c[1] = (p) => u("num")),
            "resource-image": i(F).image,
            x: -208,
            y: -56,
            tooltip: d.$t("toolbar.start.listTypeNum"),
            "image-width": i(F).width,
            class: "global-small-icon-button"
          }, null, 8, ["active", "disabled", "resource-image", "tooltip", "image-width"])
        ]),
        _: 1
      });
    };
  }
}), vn = { class: "toolbar-group" }, wn = /* @__PURE__ */ B({
  __name: "ListStyleGroup",
  setup(a) {
    return (e, t) => (k(), $("div", vn, [
      s(bn, {
        cmd: i(o).ParaListType
      }, null, 8, ["cmd"])
    ]));
  }
}), Sn = /* @__PURE__ */ H(wn, [["__scopeId", "data-v-053bc12a"]]), yn = { class: "toolbar-container" }, Pn = {
  key: 0,
  class: "ribbon-content"
}, Cn = {
  key: 1,
  class: "ribbon-content"
}, kn = {
  key: 2,
  class: "ribbon-content"
}, En = {
  key: 3,
  class: "ribbon-content"
}, Rn = /* @__PURE__ */ B({
  __name: "WordRibbon",
  setup(a) {
    const e = N(), t = E(() => e == null ? void 0 : e.getters["file/title"]), n = b("start");
    return (r, l) => (k(), $("div", null, [
      _("div", yn, [
        s(i(at), {
          documentTitle: t.value,
          logoSrc: i(da),
          class: "toolbar-prefix"
        }, null, 8, ["documentTitle", "logoSrc"]),
        s(i(nt), {
          modelValue: n.value,
          "onUpdate:modelValue": l[0] || (l[0] = (u) => n.value = u),
          tabs: [
            { name: "file", label: r.$t("toolbar.file.title") },
            { name: "start", label: r.$t("toolbar.start.title") },
            { name: "insert", label: r.$t("toolbar.insert.title") },
            { name: "layout", label: r.$t("toolbar.layout.title") }
          ]
        }, null, 8, ["modelValue", "tabs"]),
        l[1] || (l[1] = _("div", { class: "toolbar-suffix" }, null, -1))
      ]),
      _("div", null, [
        n.value == "file" ? (k(), $("div", Pn, [
          s(i(ga))
        ])) : K("", !0),
        n.value == "start" ? (k(), $("div", Cn, [
          s(i(de)),
          s(i(W), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          s(i(ma)),
          s(i(W), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          s(i(Ia)),
          s(i(W), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          s(i(Sn)),
          s(i(W), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          s(i(va)),
          s(i(W), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          s(i(an))
        ])) : K("", !0),
        n.value == "insert" ? (k(), $("div", kn, [
          s(i(de)),
          s(i(W), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          s(i(Oa)),
          s(i(W), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          s(i(en))
        ])) : K("", !0),
        n.value == "layout" ? (k(), $("div", En, [
          s(i(de)),
          s(i(W), {
            vertical: !0,
            height: 65,
            margin: "0px 8px"
          }),
          s(i(fn))
        ])) : K("", !0)
      ])
    ]));
  }
}), _n = /* @__PURE__ */ H(Rn, [["__scopeId", "data-v-35aac107"]]), Fn = { class: "zoom-wrapper" }, $n = /* @__PURE__ */ B({
  __name: "CommandZoom",
  props: {
    cmd: {},
    modelValue: {},
    min: { default: 10 },
    max: { default: 500 },
    step: {},
    disabled: { type: Boolean },
    width: { default: 200 }
  },
  setup(a) {
    const e = N(), t = a, n = E(() => e == null ? void 0 : e.getters["command/can"](t.cmd)), r = E(() => e == null ? void 0 : e.getters["command/getVal"](t.cmd)), l = D(z);
    function u(d) {
      const c = { value: d };
      l.run(t.cmd, c), e.commit("command/setState", {
        cmd: o.Zoom,
        ui: {
          value: d
        }
      });
    }
    return (d, c) => (k(), $("div", Fn, [
      s(i(ot), {
        modelValue: r.value,
        "onUpdate:modelValue": c[0] || (c[0] = (m) => r.value = m),
        onChange: u,
        min: a.min,
        max: a.max,
        width: a.width,
        disabled: !n.value
      }, null, 8, ["modelValue", "min", "max", "width", "disabled"]),
      s(i(rt), {
        modelValue: r.value,
        "onUpdate:modelValue": [
          c[1] || (c[1] = (m) => r.value = m),
          u
        ],
        disabled: !n.value,
        min: a.min,
        max: a.max
      }, null, 8, ["modelValue", "disabled", "min", "max"])
    ]));
  }
}), In = /* @__PURE__ */ H($n, [["__scopeId", "data-v-2904d1c6"]]), Bn = /* @__PURE__ */ B({
  __name: "CommandPageSelectorButton",
  props: {
    disabled: { type: Boolean },
    cmd: {}
  },
  emits: ["open"],
  setup(a, { emit: e }) {
    const t = N(), n = a, r = E(() => t == null ? void 0 : t.getters["file/currentPageCnt"]), l = E(() => t == null ? void 0 : t.getters["file/pageCount"]), u = E(() => t == null ? void 0 : t.getters["command/can"](n.cmd)), d = D(z), c = e;
    function m(f) {
      const v = { value: f };
      d.run(n.cmd, v);
    }
    function p() {
      c("open", {
        callback: m,
        info: { currentPage: r.value, maxPage: l.value }
      });
    }
    return (f, v) => (k(), $("div", null, [
      s(i(j), {
        type: "quaternary",
        disabled: !u.value,
        onClickButton: p,
        class: "page-info-label",
        label: f.$t("statusBar.pages") + " : " + r.value + "/" + l.value
      }, null, 8, ["disabled", "label"])
    ]));
  }
}), Ln = /* @__PURE__ */ H(Bn, [["__scopeId", "data-v-af5d1627"]]), An = { class: "switchGroup" }, On = /* @__PURE__ */ B({
  __name: "CommandPageViewSwitchGroup",
  props: {
    cmd: {}
  },
  setup(a) {
    const e = N(), t = a, n = E(() => e == null ? void 0 : e.getters["command/can"](t.cmd)), r = E(() => e == null ? void 0 : e.getters["command/getVal"](t.cmd)), l = D(z);
    function u(d) {
      const c = { value: d };
      l.run(t.cmd, c);
    }
    return (d, c) => (k(), $("div", An, [
      s(i(G), {
        active: r.value === "single",
        disabled: !n.value,
        onClick: c[0] || (c[0] = (m) => u("single")),
        "resource-image": i(F).image,
        x: -48,
        y: -56,
        "button-size": 24,
        "image-width": i(F).width,
        tooltip: d.$t("statusBar.pageViewSingle"),
        class: "global-medium-icon-button"
      }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"]),
      s(i(G), {
        active: r.value === "multi",
        disabled: !n.value,
        onClick: c[1] || (c[1] = (m) => u("multi")),
        "resource-image": i(F).image,
        x: -64,
        y: -56,
        "button-size": 24,
        "image-width": i(F).width,
        tooltip: d.$t("statusBar.pageViewMulti"),
        class: "global-medium-icon-button"
      }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"]),
      s(i(G), {
        active: r.value === "wide",
        disabled: !n.value,
        onClick: c[2] || (c[2] = (m) => u("wide")),
        "resource-image": i(F).image,
        x: -80,
        y: -56,
        "button-size": 24,
        "image-width": i(F).width,
        tooltip: d.$t("statusBar.pageViewWide"),
        class: "global-medium-icon-button"
      }, null, 8, ["active", "disabled", "resource-image", "image-width", "tooltip"])
    ]));
  }
}), Tn = /* @__PURE__ */ H(On, [["__scopeId", "data-v-bf2c40bd"]]), Dn = { class: "custom-panel" }, xn = { class: "global-basic-display-text text" }, Nn = /* @__PURE__ */ B({
  __name: "PageSelectorDialog",
  setup(a, { expose: e }) {
    const t = b(!1), n = b(!1), r = b(""), l = b(0), u = b(0), d = b(0);
    let c = null;
    function m(g) {
      const C = Number(g);
      if (g === "") {
        n.value = !1, r.value = "";
        return;
      }
      !isNaN(C) && C > 0 && C <= u.value ? (n.value = !1, r.value = "") : (n.value = !0, r.value = "error");
    }
    function p(g, C) {
      g && (l.value = g.currentPage, u.value = g.maxPage, d.value = g.currentPage), n.value = !1, r.value = "", c = C, t.value = !0;
    }
    function f() {
      d.value && (c && c({
        jumpePage: d.value
      }), t.value = !1);
    }
    function v() {
      t.value = !1;
    }
    return e({
      openPopover: p
    }), (g, C) => (k(), $("div", null, [
      s(i(le), {
        show: t.value,
        "onUpdate:show": C[1] || (C[1] = (O) => t.value = O),
        title: g.$t("dialogs.pageSelector.title"),
        width: 240
      }, {
        action: w(() => [
          s(i(j), {
            label: g.$t("common.cancel"),
            onClickButton: v,
            type: "standard"
          }, null, 8, ["label"]),
          s(i(j), {
            label: g.$t("common.confirm"),
            onClickButton: f
          }, null, 8, ["label"])
        ]),
        default: w(() => [
          _("div", Dn, [
            _("div", xn, T(g.$t("dialogs.pageSelector.jumpTo")), 1),
            s(i(ae), {
              "validation-status": r.value,
              feedback: n.value ? g.$t("dialogs.pageSelector.pageCountError") : ""
            }, {
              default: w(() => [
                s(i(ne), {
                  value: d.value,
                  "onUpdate:value": C[0] || (C[0] = (O) => d.value = O),
                  class: "custom-input-num",
                  precision: 0,
                  max: u.value,
                  onInput: m,
                  onKeydown: Y(se(f, ["prevent"]), ["enter"])
                }, null, 8, ["value", "max", "onKeydown"])
              ]),
              _: 1
            }, 8, ["validation-status", "feedback"])
          ])
        ]),
        _: 1
      }, 8, ["show", "title"])
    ]));
  }
}), zn = /* @__PURE__ */ H(Nn, [["__scopeId", "data-v-f0b1eba6"]]), Un = { class: "status-bar" }, Hn = { class: "left" }, Vn = { class: "global-basic-display-text page-info-label" }, Mn = { class: "spacer" }, Wn = { class: "right" }, Gn = /* @__PURE__ */ B({
  __name: "StatusBar",
  setup(a) {
    const e = N(), t = E(() => e == null ? void 0 : e.getters["file/currentPageNum"]), n = E(() => e == null ? void 0 : e.getters["file/loadingRatio"]), r = E(
      () => e == null ? void 0 : e.getters["file/showLoadingProgressBar"]
    ), l = b(null), u = E(() => e == null ? void 0 : e.getters["command/loadEnd"]);
    function d(m) {
      var p;
      (p = l == null ? void 0 : l.value) == null || p.openPopover(
        {
          currentPage: m.info.currentPage,
          maxPage: m.info.maxPage
        },
        (f) => {
          m.callback(f.jumpePage);
        }
      );
    }
    function c() {
      it(document.getElementById("main"), !0);
    }
    return (m, p) => (k(), $("div", Un, [
      _("div", Hn, [
        _("div", Vn, T(m.$t("statusBar.pageNum")) + " : " + T(t.value), 1),
        s(i(W), {
          vertical: !0,
          height: 12,
          margin: "0px"
        }),
        s(Ln, {
          cmd: i(o).GoToPage,
          onOpen: d
        }, null, 8, ["cmd"])
      ]),
      _("div", Mn, [
        r.value ? (k(), J(i(lt), {
          key: 0,
          percentage: n.value,
          class: "progress-bar"
        }, null, 8, ["percentage"])) : K("", !0)
      ]),
      _("div", Wn, [
        s(Tn, {
          cmd: i(o).PageViewSwitch
        }, null, 8, ["cmd"]),
        s(In, {
          cmd: i(o).Zoom,
          step: 1
        }, null, 8, ["cmd"]),
        s(i(G), {
          onClick: c,
          "resource-image": i(F).image,
          x: -32,
          y: -56,
          "button-size": 24,
          "image-width": i(F).width,
          tooltip: m.$t("statusBar.fullscreen"),
          class: "global-medium-icon-button",
          disabled: !u.value
        }, null, 8, ["resource-image", "image-width", "tooltip", "disabled"])
      ]),
      s(zn, {
        ref_key: "PageSelectorDialogRef",
        ref: l
      }, null, 512)
    ]));
  }
}), Zn = /* @__PURE__ */ H(Gn, [["__scopeId", "data-v-e2c1c03e"]]), jn = st({
  components: [
    ut,
    dt,
    ct,
    mt,
    pt,
    gt,
    ht,
    ft,
    bt,
    vt,
    wt,
    St,
    yt,
    Pt,
    Ct,
    kt,
    Et,
    Rt,
    _t,
    Ft,
    $t,
    It,
    Bt,
    Lt,
    At,
    Ot,
    Tt,
    Dt,
    xt,
    Nt,
    zt,
    Ut,
    Ht,
    Vt,
    Mt,
    Wt,
    Gt
  ]
});
function Kn(a) {
  a.use(jn);
}
function Jn() {
  switch (te) {
    case "zh-CN":
      return we;
    case "en-US":
      return Zt;
  }
  return we;
}
function Qn() {
  return {
    common: {
      primaryColor: "#0061CE",
      // 主色
      primaryColorHover: "#0061CE",
      // hover 主色
      primaryColorPressed: "#0061CE",
      // 按下色
      primaryColorSuppl: "#0061CE"
      // 补充主色
    }
  };
}
function Xn(a) {
  a.registerHandler(o.Bold, {
    run: (e, t) => e.setBold(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init, y.SelectionChange])
  }), a.registerRefresher(o.Bold, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.Bold,
      enabled: !0
    });
  });
}
function Yn(a) {
  a.registerHandler(o.Italic, {
    run: (e, t) => e.setItalic(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init, y.SelectionChange])
  }), a.registerRefresher(o.Italic, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.Italic,
      enabled: !0
    });
  });
}
function qn(a) {
  a.registerHandler(o.Underline, {
    run: (e, t) => e.setUnderline(),
    refresh: /* @__PURE__ */ new Set([y.Init, y.SelectionChange])
  }), a.registerRefresher(o.Underline, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.Underline,
      enabled: !0
    });
  });
}
function eo(a) {
  a.registerHandler(o.Undo, {
    run: (e) => e.undo(),
    refresh: /* @__PURE__ */ new Set([y.Init, y.UndoRedoChange])
  }), a.registerRefresher(o.Undo, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.Undo,
      enabled: e.api.canUndo()
    });
  });
}
function to(a) {
  a.registerHandler(o.Redo, {
    run: (e) => e.redo(),
    refresh: /* @__PURE__ */ new Set([y.UndoRedoChange])
  }), a.registerRefresher(o.Redo, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.Redo,
      enabled: e.api.canRedo()
    });
  });
}
function ao(a) {
  a.registerHandler(o.PagePositionChange, {
    run: (e, t) => {
    },
    refresh: /* @__PURE__ */ new Set([y.LoadPageEnd, y.PagePositionChange])
  }), a.registerRefresher(o.PagePositionChange, (e) => {
    if (!e.canRefreshCommand(o.PagePositionChange)) return;
    e.store.commit("command/setEnabled", {
      cmd: o.PagePositionChange,
      enabled: !0
    });
    const { pageNum: t, pageCnt: n, total: r } = e.api.getCurrentPagePosition();
    e.store.commit("file/setCurrentPageNum", t || 0), e.store.commit("file/setCurrentPageCnt", n || 0), e.store.commit("file/setPageCount", r || 0);
  });
}
function no(a) {
  a.registerHandler(o.GoToPage, {
    run: (e, t) => e.goToPage(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.GoToPage, (e) => {
    e.canRefreshCommand(o.GoToPage) && e.store.commit("command/setEnabled", {
      cmd: o.GoToPage,
      enabled: !0
    });
  });
}
function oo(a) {
  a.registerHandler(o.PageViewSwitch, {
    run: (e, t) => {
      e.switchPageView(t.value), a.store.commit("command/setState", {
        cmd: o.PageViewSwitch,
        ui: {
          value: t.value
        }
      });
    },
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.PageViewSwitch, (e) => {
    e.canRefreshCommand(o.PageViewSwitch) && (e.store.commit("command/setState", {
      cmd: o.PageViewSwitch,
      ui: {
        value: "single"
      }
    }), e.store.commit("command/setEnabled", {
      cmd: o.PageViewSwitch,
      enabled: !0
    }));
  });
}
function ro(a) {
  a.registerHandler(o.Zoom, {
    run: (e, t) => e.setZoom(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init, y.ZoomChange])
  }), a.registerRefresher(o.Zoom, (e) => {
    e.canRefreshCommand(o.Zoom) && (e.store.commit("command/setState", {
      cmd: o.Zoom,
      ui: {
        value: e.api.getZoom()
      }
    }), e.store.commit("command/setEnabled", {
      cmd: o.Zoom,
      enabled: !0
    }));
  });
}
function lo(a) {
  a.registerHandler(o.Export, {
    run: async (e, t) => {
      await e.doExport("exportDocument");
    },
    refresh: /* @__PURE__ */ new Set([y.ExportReady])
  }), a.registerHandler(o.ExportPDF, {
    run: async (e, t) => {
      await e.doExport("exportPDF");
    },
    refresh: /* @__PURE__ */ new Set([y.ExportReady])
  }), a.registerRefresher(o.Export, (e) => {
    e.canRefreshCommand(o.Export) && e.store.commit("command/setEnabled", {
      cmd: o.Export,
      enabled: !0
    });
  }), a.registerRefresher(o.ExportPDF, (e) => {
    e.canRefreshCommand(o.ExportPDF) && e.store.commit("command/setEnabled", {
      cmd: o.ExportPDF,
      enabled: !0
    });
  });
}
function io(a) {
  a.registerHandler(o.Open, {
    run: (e, t) => e.openFile(),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.Open, (e) => {
    e.canRefreshCommand(o.Open) && e.store.commit("command/setEnabled", {
      cmd: o.Open,
      enabled: !0
    });
  });
}
function so(a) {
  a.registerHandler(o.Copy, {
    run: (e) => e.copy()
  });
}
function uo(a) {
  a.registerHandler(o.Paste, {
    run: (e) => e.paste(),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.Paste, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.Paste,
      enabled: !0
    });
  });
}
function co(a) {
  a.registerHandler(o.Strikeout, {
    run: (e, t) => e.setStrikeout(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init, y.SelectionChange])
  }), a.registerRefresher(o.Strikeout, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.Strikeout,
      enabled: !0
    });
  });
}
function mo(a) {
  a.registerHandler(o.FontColor, {
    run: (e, t) => e.setFontColor(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init, y.SelectionChange])
  }), a.registerRefresher(o.FontColor, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.FontColor,
      enabled: !0
    });
  });
}
function po(a) {
  a.registerHandler(o.FontName, {
    run: (e, t) => e.setFontName(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init, y.SelectionChange])
  }), a.registerRefresher(o.FontName, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.FontName,
      enabled: !0
    });
  });
}
function go(a) {
  a.registerHandler(o.FontSize, {
    run: (e, t) => e.setFontSize(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init, y.SelectionChange])
  }), a.registerRefresher(o.FontSize, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.FontSize,
      enabled: !0
    });
  });
}
function ho(a) {
  a.registerHandler(o.ParaAlignHorizontal, {
    run: (e, t) => e.setParaAlignHorizontal(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init, y.SelectionChange])
  }), a.registerRefresher(o.ParaAlignHorizontal, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.ParaAlignHorizontal,
      enabled: !0
    });
  });
}
function fo(a) {
  a.registerHandler(o.ParaListType, {
    run: (e, t) => e.setParaListType(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init, y.SelectionChange])
  }), a.registerRefresher(o.ParaListType, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.ParaListType,
      enabled: !0
    });
  });
}
function bo(a) {
  a.registerHandler(o.InsertTable, {
    run: (e, t) => e.insertTable(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.InsertTable, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.InsertTable,
      enabled: !0
    });
  });
}
function vo(a) {
  a.registerHandler(o.InsertSeparator, {
    run: (e, t) => e.insertSeparator(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.InsertSeparator, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.InsertSeparator,
      enabled: !0
    });
  });
}
function wo(a) {
  a.registerHandler(o.SearchReplaceWord, {
    run: (e, t) => {
      if (!t) {
        a.store.commit("file/setShowFindDialog", !0);
        return;
      }
      const n = t.value;
      if (!n) return;
      switch (n.action) {
        case "search":
          e.searchWord(n.val), e.searchNext();
          break;
        case "next":
          e.searchNext();
          break;
        case "prev":
          e.searchPrevious();
          break;
        case "focusEditor":
          e.focusEditor();
          break;
      }
      const r = e.searchStatusInfo();
      a.store.commit("command/setState", {
        cmd: o.SearchReplaceWord,
        ui: {
          value: {
            countNum: r.countNum,
            totalCount: r.totalCount
          }
        }
      });
    },
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.SearchReplaceWord, (e) => {
    e.canRefreshCommand(o.SearchReplaceWord) && e.store.commit("command/setEnabled", {
      cmd: o.SearchReplaceWord,
      enabled: !0
    });
  });
}
function So(a) {
  a.registerHandler(o.TableCellOperations, {
    run: (e, t) => e.doTableCellOperation(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.TableCellOperations, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.TableCellOperations,
      enabled: !0
    });
  });
}
function yo(a) {
  a.registerHandler(o.TableOperations, {
    run: (e, t) => e.doTableOperation(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.TableOperations, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.TableOperations,
      enabled: !0
    });
  });
}
function Po(a) {
  a.registerHandler(o.PaperOrientation, {
    run: (e, t) => e.doPaperOrientationAction(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.PaperOrientation, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.PaperOrientation,
      enabled: !0
    });
  });
}
function Co(a) {
  a.registerHandler(o.PaperSize, {
    run: (e, t) => e.doPaperSizeAction(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.PaperSize, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.PaperSize,
      enabled: !0
    });
  });
}
function ko(a) {
  a.registerHandler(o.LineSpace, {
    run: (e, t) => e.setLineSpace(t.value),
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.LineSpace, (e) => {
    e.docReady && e.store.commit("command/setEnabled", {
      cmd: o.LineSpace,
      enabled: !0
    });
  });
}
function Eo(a) {
  a.registerHandler(o.ParaSymbol, {
    run: (e, t) => {
      const n = a.store.getters["command/getVal"](o.ParaSymbol);
      switch (t.value) {
        case "ParagraphMarks":
          e.setParaSymbolParagraphMarks(!(n != null && n.ParagraphMarks)), n.ParagraphMarks = !(n != null && n.ParagraphMarks);
          break;
        case "PageBreak":
          e.setParaSymbolPageBreak(!(n != null && n.PageBreak)), n.PageBreak = !(n != null && n.PageBreak);
          break;
        case "SectionBreak":
          e.setParaSymbolSectionBreak(!(n != null && n.SectionBreak)), n.SectionBreak = !(n != null && n.SectionBreak);
          break;
      }
      a.store.commit("command/setState", {
        cmd: o.ParaSymbol,
        ui: {
          value: n
        }
      });
    },
    refresh: /* @__PURE__ */ new Set([y.Init])
  }), a.registerRefresher(o.ParaSymbol, (e) => {
    e.canRefreshCommand(o.ParaSymbol) && (e.store.commit("command/setState", {
      cmd: o.ParaSymbol,
      ui: {
        value: {
          ParagraphMarks: e.api.getParaSymbolParagraphMarks(),
          PageBreak: e.api.getParaSymbolPageBreak(),
          SectionBreak: e.api.getParaSymbolSectionBreak()
        }
      }
    }), e.store.commit("command/setEnabled", {
      cmd: o.ParaSymbol,
      enabled: !0
    }));
  });
}
function Ro() {
  const a = D(z);
  Xn(a), Yn(a), qn(a), eo(a), to(a), ao(a), no(a), oo(a), ro(a), lo(a), io(a), so(a), uo(a), co(a), mo(a), po(a), go(a), ho(a), fo(a), bo(a), vo(a), wo(a), yo(a), So(a), Po(a), Co(a), ko(a), Eo(a);
}
const _o = { class: "app-shell" }, Fo = { class: "app-stage" }, $o = { id: "appContainer" }, Io = /* @__PURE__ */ B({
  __name: "App",
  setup(a) {
    const e = N(), t = b(null), n = b(null), r = b(!0), l = b(null), u = b(null), d = D(ge, null), c = E(() => {
      var h;
      return ((h = d == null ? void 0 : d.uiOptions) == null ? void 0 : h.showTopBar) !== !1;
    }), m = E(() => {
      var h;
      return ((h = d == null ? void 0 : d.uiOptions) == null ? void 0 : h.showBottomBar) !== !1;
    }), p = E(() => e.state.file.isReady);
    _e(p, (h) => {
      r.value = !h;
    });
    const f = E(() => e == null ? void 0 : e.state.file.hasError), v = E(
      () => (e == null ? void 0 : e.getters["command/isRunning"](o.Export)) || (e == null ? void 0 : e.getters["command/isRunning"](o.ExportPDF))
    ), g = (h) => {
      var S;
      const { callback: A } = (h == null ? void 0 : h.detail) || {};
      A && ((S = l == null ? void 0 : l.value) != null && S.openPopover) && l.value.openPopover(A);
    }, C = (h) => {
      var A;
      (A = l == null ? void 0 : l.value) == null || A.closePopover();
    }, O = () => {
      var h;
      (h = u == null ? void 0 : u.value) == null || h.openPopover();
    };
    return jt(() => {
      const h = (d == null ? void 0 : d.eventTarget) ?? window;
      Ro(), h.addEventListener("FilePassWordError", g), h.addEventListener("FilePassWordOK", C), h.addEventListener("OpenDocumentFailed", O);
    }), Kt(() => {
      const h = (d == null ? void 0 : d.eventTarget) ?? window;
      e.commit("file/clearError"), h.removeEventListener(
        "FilePassWordError",
        g
      ), h.removeEventListener("FilePassWordOK", C), h.removeEventListener(
        "OpenDocumentFailed",
        O
      );
    }), Fe(() => {
      const { toolBarElm: h, editorElm: A } = ua();
      h.value = t.value, A.value = n.value;
    }), (h, A) => {
      const S = V("n-spin"), I = V("n-message-provider"), R = V("n-modal-provider"), x = V("n-config-provider");
      return k(), $("div", _o, [
        s(x, {
          class: "app-provider",
          locale: i(Jn)(),
          "theme-overrides": i(Qn)()
        }, {
          default: w(() => [
            s(R, null, {
              default: w(() => [
                s(I, null, {
                  default: w(() => [
                    s(i(Jt), {
                      ref_key: "dialogOpenFailedRef",
                      ref: u
                    }, null, 512),
                    s(i(Qt), {
                      ref_key: "dialogCypherRef",
                      ref: l
                    }, null, 512),
                    _("div", Fo, [
                      s(S, {
                        class: "app-spin",
                        show: r.value || v.value,
                        fullscreen: "",
                        style: {
                          backgroundColor: "rgba(255, 255, 255, 0.5)"
                        }
                      }, {
                        default: w(() => [
                          _("div", $o, [
                            c.value ? (k(), J(_n, {
                              key: 0,
                              ref_key: "toolbarRef",
                              ref: t
                            }, null, 512)) : K("", !0),
                            f.value ? K("", !0) : (k(), J(sa, {
                              key: 1,
                              ref_key: "editorRef",
                              ref: n,
                              class: "editor"
                            }, null, 512)),
                            m.value ? (k(), J(i(Zn), {
                              key: 2,
                              class: "status-bar"
                            })) : K("", !0)
                          ])
                        ]),
                        _: 1
                      }, 8, ["show"])
                    ])
                  ]),
                  _: 1
                })
              ]),
              _: 1
            })
          ]),
          _: 1
        }, 8, ["locale", "theme-overrides"])
      ]);
    };
  }
});
function Bo(a) {
  let e = _a(a);
  const t = Xt(Io);
  return t.use(e), { app: t };
}
const Lo = {
  namespaced: !0,
  state: () => ({
    hasError: !1,
    isReady: !1,
    connected: !1,
    message: null,
    rawEvent: null,
    fileInfo: { title: "", docId: "" },
    currentPageNum: 0,
    currentPageCnt: 0,
    pageCount: 0,
    colorPalette: null,
    recentColors: [],
    showFindDialog: !1,
    loadingRatio: 0,
    showLoadingProgressBar: !0
  }),
  getters: {
    title: (a) => a.fileInfo.title,
    currentPageNum: (a) => a.currentPageNum,
    currentPageCnt: (a) => a.currentPageCnt,
    pageCount: (a) => a.pageCount,
    colorPalette: (a) => a.colorPalette,
    recentColors: (a) => a.recentColors,
    showFindDialog: (a) => a.showFindDialog,
    loadingRatio: (a) => a.loadingRatio,
    showLoadingProgressBar: (a) => a.showLoadingProgressBar
  },
  mutations: {
    setError(a, e) {
      a.hasError = !0, a.message = e.message, a.rawEvent = e.event ?? null;
    },
    clearError(a) {
      a.hasError = !1, a.message = null, a.rawEvent = null;
    },
    setReady(a, e = !0) {
      a.isReady = e;
    },
    setConnected(a, e) {
      a.connected = e;
    },
    setFileInfo(a, e) {
      a.fileInfo.title = e.title, a.fileInfo.docId = e.docId;
    },
    setCurrentPageNum(a, e) {
      a.currentPageNum = e;
    },
    setCurrentPageCnt(a, e) {
      a.currentPageCnt = e;
    },
    setPageCount(a, e) {
      a.pageCount = e;
    },
    setColorPalette(a, e) {
      a.colorPalette = e;
    },
    addRecentColors(a, e) {
      function t(l) {
        return typeof l == "string" ? l : l == null ? void 0 : l.hex;
      }
      const n = t(e), r = a.recentColors.findIndex(
        (l) => t(l) === n
      );
      r !== -1 && a.recentColors.splice(r, 1), a.recentColors.unshift(e), a.recentColors.length > 10 && (a.recentColors.length = 10);
    },
    setShowFindDialog(a, e) {
      a.showFindDialog = e;
    },
    setLoadingRatio(a, e) {
      a.loadingRatio = e;
    },
    setShowLoadingProgressBar(a, e) {
      a.showLoadingProgressBar = e;
    }
  },
  actions: {
    onError({ commit: a }, e) {
      a("setError", {
        message: "文件处理失败",
        event: e
      });
    },
    onOpening({ commit: a }) {
      a("clearError"), a("setReady", !1), a("setConnected", !1), a("setLoadingRatio", 0), a("setShowLoadingProgressBar", !0);
    },
    onReady({ commit: a }, e) {
      a("setReady");
    },
    onConnected({ commit: a }, e) {
      a("setConnected", !0), a("setFileInfo", e);
    },
    onLoadPageEnd({ commit: a }, e) {
      a("setLoadingRatio", 100), setTimeout(() => {
        a("setShowLoadingProgressBar", !1);
      }, 1e3);
    },
    onExportReady({ commit: a }, e) {
    },
    onFilePassWord({ commit: a }, e) {
    }
  }
};
function ce() {
  return {
    [o.Copy]: { enabled: !1, running: !1 },
    [o.Paste]: { enabled: !1, running: !1 },
    [o.Undo]: { enabled: !1, running: !1 },
    [o.Redo]: { enabled: !1, running: !1 },
    [o.Bold]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.Italic]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.Underline]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.Strikeout]: {
      enabled: !1,
      running: !1,
      ui: {
        value: !1
      }
    },
    [o.FontSize]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.FontColor]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.FontName]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.ParaAlignHorizontal]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.ParaListType]: {
      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.GoToPage]: {
      enabled: !1,
      running: !1
    },
    [o.PagePositionChange]: {
      enabled: !1,
      running: !1
    },
    [o.PageViewSwitch]: {
      enabled: !1,
      running: !1,
      ui: {
        value: ""
      }
    },
    [o.InsertTable]: {
      enabled: !1,
      running: !1
    },
    [o.InsertSeparator]: {
      enabled: !1,
      running: !1
    },
    [o.SearchReplaceWord]: {
      enabled: !1,
      running: !1,
      ui: {
        value: null
      }
    },
    [o.TableOperations]: {
      enabled: !1,
      running: !1
    },
    [o.TableCellOperations]: {
      enabled: !1,
      running: !1
    },
    [o.PaperOrientation]: {
      enabled: !1,
      running: !1
    },
    [o.PaperSize]: {
      enabled: !1,
      running: !1
    },
    [o.LineSpace]: {
      enabled: !1,
      running: !1
    },
    [o.ParaSymbol]: {
      enabled: !1,
      running: !1,
      ui: {
        value: null
      }
    }
  };
}
const Ao = {
  namespaced: !0,
  state: () => ({
    map: ce(),
    readOnly: !1,
    loadEnd: !1
  }),
  getters: {
    can: (a) => (e) => {
      var t;
      return ((t = a.map[e]) == null ? void 0 : t.enabled) !== !0 ? !1 : a.readOnly ? a.loadEnd && me.has(e) : !0;
    },
    isRunning: (a) => (e) => {
      var t;
      return ((t = a.map[e]) == null ? void 0 : t.running) === !0;
    },
    active: (a) => (e) => {
      var n;
      const t = (n = a.map[e]) == null ? void 0 : n.ui;
      return !!t && t.value === !0;
    },
    getVal: (a) => (e) => {
      var n;
      const t = (n = a.map[e]) == null ? void 0 : n.ui;
      return !!t && t.value;
    },
    loadEnd: (a) => a.loadEnd
  },
  mutations: {
    resetCommandState(a) {
      a.map = ce(), a.readOnly = !1, a.loadEnd = !1;
    },
    setLoadEnd(a, e) {
      a.loadEnd = e;
    },
    setReadOnly(a, e) {
      a.readOnly = e;
    },
    setEnabled(a, e) {
      a.loadEnd == !1 && (e.enabled = !1), a.map[e.cmd].enabled = e.enabled;
    },
    setRunning(a, e) {
      a.map[e.cmd].running = e.running;
    },
    setState(a, e) {
      const t = a.map[e.cmd];
      if (!t) return;
      const n = e.ui;
      if (n === void 0) {
        t.ui = void 0;
        return;
      }
      t.ui = { ...t.ui ?? {}, ...n };
    },
    clearState(a, e) {
      const t = ce()[e.cmd];
      t && (a.map[e.cmd] = JSON.parse(JSON.stringify(t)));
    }
  },
  actions: {
    async run({ commit: a, getters: e }, t) {
      const { cmd: n, fn: r, param: l } = t;
      if (e.can(n)) {
        a("setRunning", { cmd: n, running: !0 });
        try {
          await r(l);
        } finally {
          a("setRunning", { cmd: n, running: !1 });
        }
      }
    }
  }
};
class Oo extends Yt {
  get Document() {
    return this.getAPIComponent("Document");
  }
  get Paragraph() {
    return this.getAPIComponent("Paragraph");
  }
  get Table() {
    return this.getAPIComponent("Table");
  }
  get UndoRedo() {
    return this.getAPIComponent("UndoRedo");
  }
  get Selection() {
    return this.getAPIComponent("Selection");
  }
  get Finder() {
    return this.getAPIComponent("Finder");
  }
}
class To extends Oo {
}
class Do extends To {
  constructor() {
    super();
    M(this, "openFileHandler");
  }
  setOpenFileHandler(t) {
    this.openFileHandler = t;
  }
  openFile() {
    var t;
    return (t = this.openFileHandler) == null ? void 0 : t.call(this);
  }
  async doExport(t) {
    switch (t) {
      case "exportDocument":
        await this.Document.callFun("exportDocument");
        break;
      case "exportPDF":
        await this.Document.callFun("exportPdf");
        break;
    }
  }
  copy() {
    return this.Document.callFun("copy");
  }
  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");
  }
  setBold(t = !0) {
    this.Paragraph.callFun("setBold", t);
  }
  setItalic(t = !0) {
    this.Paragraph.callFun("setItalic", t);
  }
  setUnderline() {
    this.Paragraph.callFun("setUnderline");
  }
  setStrikeout(t = !0) {
    this.Paragraph.callFun("setStrikeThrough", t);
  }
  setFontSize(t) {
    this.Paragraph.callFun("setFontSize", t), this.focusEditor();
  }
  setFontColor(t) {
    const n = qt(t);
    this.Paragraph.callFun("setFontColor", n);
  }
  setFontName(t) {
    this.Paragraph.callFun("setFontName", t), this.focusEditor();
  }
  getPalette() {
    return this.Paragraph.callFun("getColorPalette");
  }
  toParagraphAlignment(t) {
    switch (t) {
      case "left":
        return "Left";
      case "center":
        return "Centered";
      case "right":
        return "Right";
      case "justify":
        return "Justified";
      case "distribute":
        return "Distributed";
      default:
        return t;
    }
  }
  setParaAlignHorizontal(t) {
    this.Paragraph.callFun("setAlignment", this.toParagraphAlignment(t));
  }
  setParaListType(t) {
    switch (t) {
      case "bullet":
        this.Paragraph.callFun("setBulletList");
        break;
      case "num":
        this.Paragraph.callFun("setNumberedList");
        break;
    }
  }
  insertTable(t) {
    const { rows: n, cols: r } = t;
    this.Table.callFun("insertTable", n, r);
  }
  toBreakType(t) {
    switch (t) {
      case "pageSeparator":
        return "Page";
      case "nextPage":
        return "SectionNext";
      case "continuousPage":
        return "SectionContinuous";
      case "evenPage":
        return "SectionEven";
      case "oddPage":
        return "SectionOdd";
      case "columnSeparator":
        return "Column";
      default:
        return t;
    }
  }
  insertSeparator(t) {
    return this.Selection.callFun("insertBreak", this.toBreakType(t));
  }
  getCurrentPagePosition() {
    return this.Document.callFun("getCurrentPagePosition");
  }
  goToPage(t) {
    return this.Document.callFun("goToPage", t || 1);
  }
  switchPageView(t) {
    return this.Document.callFun("setPageView", t || "single");
  }
  setZoom(t) {
    this.Document.callFun("setZoom", t);
  }
  getZoom() {
    return this.Document.callFun("getZoom");
  }
  setParaSymbolParagraphMarks(t) {
    this.Document.callFun("setShowParagraphMarks", t);
  }
  getParaSymbolParagraphMarks() {
    return this.Document.callFun("getShowParagraphMarks");
  }
  setParaSymbolPageBreak(t) {
    this.Document.callFun("setShowPageBreak", t);
  }
  getParaSymbolPageBreak() {
    return this.Document.callFun("getShowPageBreak");
  }
  setParaSymbolSectionBreak(t) {
    this.Document.callFun("setShowSectionBreak", t);
  }
  getParaSymbolSectionBreak() {
    return this.Document.callFun("getShowSectionBreak");
  }
  getSearchSelectedWord() {
    return this.Finder.callFun("getSelectText");
  }
  searchWord(t) {
    this.Finder.callFun("search", t);
  }
  searchNext() {
    this.Finder.callFun("selectNext");
  }
  searchPrevious() {
    this.Finder.callFun("selectPrevious");
  }
  searchStatusInfo() {
    return this.Finder.callFun("getSearchStatus");
  }
  focusEditor() {
    return this.Document.callFun("focusEditor");
  }
  isTable() {
    return this.Table.callFun("isInTable");
  }
  doTableOperation(t) {
    const { action: n } = t;
    switch (n) {
      case "delTable":
        this.Table.callFun("delete");
        break;
      case "insRow":
        this.Table.callFun("addRows");
        break;
      case "insCol":
        this.Table.callFun("addColumns");
        break;
      case "delRow":
        this.Table.callFun("deleteRows");
        break;
      case "delCol":
        this.Table.callFun("deleteColumns");
        break;
    }
  }
  doTableCellOperation(t) {
    const { action: n } = t;
    switch (n) {
      case "mergeCell":
        this.Table.callFun("mergeCells");
        break;
      case "unmergeCell":
        this.Table.callFun("unmergeCells");
        break;
    }
  }
  doPaperOrientationAction(t) {
    this.Document.callFun("setPageOrientation", t === "paperHorizontal" ? "Landscape" : "Portrait");
  }
  doPaperSizeAction(t) {
    typeof t == "string" && (t = cn(t)), t && this.Document.callFun("setPageSize", t.width, t.height);
  }
  setLineSpace(t) {
    let n = 1;
    switch (t) {
      case "1.0":
        n = 1;
        break;
      case "1.15":
        n = 1.15;
        break;
      case "1.5":
        n = 1.5;
        break;
      case "2.0":
        n = 2;
        break;
      case "2.5":
        n = 2.5;
        break;
      case "3.0":
        n = 3;
        break;
    }
    this.Paragraph.callFun("setLineSpacing", n);
  }
}
function xo(a) {
  return a ?? window.lang ?? window.navigator.language;
}
function No(a) {
  return new Promise((e, t) => {
    var l;
    const n = (l = a.state) == null ? void 0 : l.file;
    if (n != null && n.isReady) {
      e();
      return;
    }
    if (n != null && n.hasError) {
      t(new Error(n.message ?? "document load failed"));
      return;
    }
    const r = a.watch(
      (u) => {
        var d, c, m;
        return {
          isReady: !!((d = u.file) != null && d.isReady),
          hasError: !!((c = u.file) != null && c.hasError),
          message: ((m = u.file) == null ? void 0 : m.message) ?? null
        };
      },
      (u) => {
        if (u.isReady) {
          r(), e();
          return;
        }
        u.hasError && (r(), t(new Error(u.message ?? "document load failed")));
      }
    );
  });
}
function zo(a, e, t) {
  const n = ea({
    modules: {
      file: Lo,
      command: Ao
    }
  }), { app: r } = Bo(xo(e));
  Kn(r), r.use(n);
  const l = new Do(), u = new oa({
    store: n,
    api: l,
    eventTarget: t == null ? void 0 : t.eventTarget
  }), d = No(n);
  r.provide(z, u), r.provide(Oe, {
    toolBarElm: ee(null),
    navigateBarElm: ee(null),
    editorElm: ee(null),
    bottomBarElm: ee(null)
  }), r.provide(ge, {
    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: ee(null),
    eventTarget: (t == null ? void 0 : t.eventTarget) ?? window
  }), r.mount(a);
  async function c() {
    var m, p;
    await ((p = (m = l.docApp) == null ? void 0 : m.destroy) == null ? void 0 : p.call(m)), u.destroy(), r.unmount();
  }
  return {
    app: r,
    api: l,
    commandService: u,
    store: n,
    ready: d,
    destroy: c,
    close: c,
    unmount: c
  };
}
const Wo = zo;
export {
  zo as default,
  Wo as mount,
  zo as mountDocxApp
};
