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