import { defineComponent as b, inject as C, computed as w, resolveComponent as r, openBlock as c, createBlock as d, withCtx as n, createVNode as a, createTextVNode as i, toDisplayString as l, unref as k, createCommentVNode as y } from "vue";
import { p as I, n as p } from "./index-e250a75e.mjs";
const N = /* @__PURE__ */ b({
  __name: "buttonSys",
  setup(h) {
    const e = C("context");
    function m() {
      u(!1), e.mitt.emit("action", { type: "return" });
    }
    function s() {
      u(!0);
    }
    I(() => {
      u(!1);
    }, 120 * 1e3);
    function u(t) {
      (t || e.codeManager.dirty.value) && (e.mitt.emit("action", { type: "save", code: e.codeManager.getCode() }), e.codeManager.dirty.value = !1);
    }
    const f = w(() => e.mode.value == "edit" ? p("_.builtIn.plugin.top.preview") : p("_.builtIn.plugin.top.edit"));
    function v() {
      e.mode.value == "edit" ? e.mode.value = "view" : e.mode.value = "edit";
    }
    function _() {
      e.mode.value = "view", e.mitt.emit("previewFullSCreen");
    }
    return (t, S) => {
      const o = r("el-button"), g = r("el-button-group");
      return c(), d(g, null, {
        default: n(() => [
          a(o, { onClick: m }, {
            default: n(() => [
              i(l(t.$t("_.builtIn.plugin.top.return")), 1)
            ]),
            _: 1
          }),
          a(o, { onClick: s }, {
            default: n(() => [
              i(l(t.$t("_.builtIn.plugin.top.save")), 1)
            ]),
            _: 1
          }),
          a(o, { onClick: v }, {
            default: n(() => [
              i(l(f.value), 1)
            ]),
            _: 1
          }),
          k(e).mode.value == "edit" ? (c(), d(o, {
            key: 0,
            onClick: _
          }, {
            default: n(() => [
              i(l(t.$t("_.builtIn.plugin.top.previewFull")), 1)
            ]),
            _: 1
          })) : y("", !0)
        ]),
        _: 1
      });
    };
  }
});
export {
  N as default
};
