import { provide as h, inject as k, ref as r, onMounted as w, createElementBlock as i, openBlock as u, Fragment as B, createCommentVNode as W, createElementVNode as p, unref as S, normalizeClass as T, createVNode as M } from "vue";
import V from "../WABATemplateSelector/WABATemplateSelector.vue.js";
import { useMessageDraft as A } from "../../../hooks/useMessageDraft.js";
import "../../../hooks/useSearchModel.js";
import "../../../hooks/useTheme.js";
/* empty css                              */
import q from "../../../_virtual/_plugin-vue_export-helper.js";
/* empty css                                              */
import "../../../node_modules/linkifyjs/dist/linkify.js";
import "../../../node_modules/linkify-string/dist/linkify-string.js";
import "../../../functions/parseMarkdown.js";
/* empty css                                */
const C = {
  __name: "ButtonWabaTemplateSelector",
  props: {
    wabaTemplates: {
      type: Array,
      required: !1,
      default: () => []
    },
    groupTemplates: {
      type: Array,
      required: !1,
      default: () => []
    },
    mode: {
      type: String,
      required: !1,
      default: "click"
    },
    state: {
      type: String,
      default: "active"
    },
    filebumpUrl: {
      type: String,
      default: "https://filebump2.services.mobilon.ru"
    },
    elevatedWindow: {
      type: Boolean,
      required: !1
    },
    chatBackground: {
      type: String,
      default: void 0
    }
  },
  emits: ["sendWabaValues"],
  setup(a, { emit: d }) {
    const t = a;
    h("filebumpUrl", t.filebumpUrl);
    const m = k("chatAppId"), { getMessage: c } = A(m), f = r(null), e = r(null), y = d, v = () => {
      t.mode == "click" && t.state == "active" && (e.value.style.display == "none" ? e.value.style.display = "inherit" : e.value.style.display == "inherit" && (e.value.style.display = "none"));
    }, o = () => {
      t.mode == "hover" && t.state == "active" && (e.value.style.display = "inherit");
    }, l = () => {
      t.mode == "hover" && t.state == "active" && (e.value.style.display = "none");
    }, b = () => {
      e.value.style.display = "none";
    };
    w(() => {
      e.value.style.display = "none";
    });
    const g = (n) => {
      y("sendWabaValues", n);
    };
    return (n, s) => (u(), i(B, null, [
      S(c)().isRecording ? W("", !0) : (u(), i("button", {
        key: 0,
        ref_key: "templateButton",
        ref: f,
        class: T(["button-template", { "button-template-disabled": a.state == "disabled" }]),
        onClick: v,
        onMouseover: o,
        onMouseout: l
      }, [...s[0] || (s[0] = [
        p("span", { class: "pi pi-code" }, null, -1)
      ])], 34)),
      p("div", {
        ref_key: "template",
        ref: e,
        onMouseover: o,
        onMouseout: l
      }, [
        M(V, {
          "waba-templates": a.wabaTemplates,
          "group-templates": a.groupTemplates,
          "elevated-window": a.elevatedWindow,
          "chat-background": a.chatBackground,
          onCloseTemplateWindow: b,
          onSendWabaValues: g
        }, null, 8, ["waba-templates", "group-templates", "elevated-window", "chat-background"])
      ], 544)
    ], 64));
  }
}, J = /* @__PURE__ */ q(C, [["__scopeId", "data-v-e300d7b9"]]);
export {
  J as default
};
