import { defineComponent as f, computed as y, ref as k, createBlock as i, openBlock as d, unref as a, withCtx as s, createElementVNode as t, toDisplayString as b, createCommentVNode as g, createVNode as m } from "vue";
import { G as x, u as v, Q as w, M as E, A as M } from "./index.vue_vue_type_script_setup_true_lang-BMVa5UfU.js";
import { useI18n as T } from "@feedmepos/mf-common";
import { useSnackbar as V } from "@feedmepos/ui-library";
import { _ as h } from "./ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js";
import { _ as C } from "./PageLayout.vue_vue_type_script_setup_true_lang-2f0QfweQ.js";
import { _ as N } from "./Takeaway.vue_vue_type_script_setup_true_lang-5slQtnTi.js";
import { T as S, l as L } from "./index-4cR8a2UZ.js";
import { a as O } from "./menu-DNLXOwiM.js";
const U = { class: "flex-1 flex justify-between gap-8 pl-8" }, B = { class: "flex items-center" }, F = { class: "bg-fm-color-neutral-gray-100 rounded-md px-8 py-4" }, A = { class: "fm-typo-en-body-md-600 font-semibold" }, z = /* @__PURE__ */ f({
  __name: "Takeaway",
  setup(D) {
    const u = V(), l = x(u), p = v(), c = w(l), _ = y(() => p.rules.item.bindToVariant), n = k(0), { t: r } = T();
    return O().resetOnMount(), (I, o) => (d(), i(C, {
      heading: a(r)("menu.takeaway.title")
    }, {
      default: s(() => [
        m(N, {
          "onUpdate:count": o[0] || (o[0] = (e) => n.value = e)
        })
      ]),
      "append-heading": s(() => [
        t("div", U, [
          t("div", B, [
            t("div", F, [
              t("p", A, b(n.value), 1)
            ])
          ]),
          t("div", null, [
            n.value > 0 ? (d(), i(a(S), {
              key: 0,
              "bind-to-variant": _.value,
              action: "add",
              "apply-product": "",
              "onUpdate:takeaway": o[1] || (o[1] = (e) => a(c).updateMenu(
                {
                  module: a(M.F_MENU_MODULE_V4_KEY).enum.takeaway,
                  operation: a(E.F_OPERATION_TYPE).create,
                  data: e,
                  link: a(L)(e.usedBy || [])
                },
                e.name
              ))
            }, {
              default: s(({ trigger: e }) => [
                m(h, {
                  label: a(r)("menu.takeaway.actions.add"),
                  "prepend-icon": "add",
                  type: "button",
                  onClick: e
                }, null, 8, ["label", "onClick"])
              ]),
              _: 1
            }, 8, ["bind-to-variant"])) : g("", !0)
          ])
        ])
      ]),
      _: 1
    }, 8, ["heading"]));
  }
});
export {
  z as default
};
