import { EDITOR_SUPPORTED_LINK_PROTOCOLS as m, EDITOR_DEFAULT_LINK_PREFIX as E } from "./editor-constants.js";
import { DtIconQuickReply as u, DtIconBold as a, DtIconItalic as c, DtIconUnderline as d, DtIconStrikethrough as h, DtIconListBullet as p, DtIconListOrdered as f, DtIconAlignLeft as B, DtIconAlignCenter as k, DtIconAlignRight as g, DtIconAlignJustify as T, DtIconQuote as I, DtIconCodeBlock as _, DtIconLink2 as L, DtIconImage as A } from "@dialpad/dialtone-icons/vue2";
import { DialtoneLocalization as y } from "../../localization/index.js";
import { n as O } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
import w from "../rich-text-editor/rich-text-editor.js";
import x from "../button/button.js";
import b from "../popover/popover.js";
import R from "../stack/stack.js";
import D from "../input/input.js";
import C from "../tooltip/tooltip.js";
import { RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as N, RICH_TEXT_EDITOR_OUTPUT_FORMATS as $ } from "../rich-text-editor/rich-text-editor-constants.js";
const S = {
  name: "DtRecipeEditor",
  components: {
    DtRichTextEditor: w,
    DtButton: x,
    DtPopover: b,
    DtStack: R,
    DtInput: D,
    DtTooltip: C,
    DtIconQuickReply: u,
    DtIconBold: a,
    DtIconItalic: c,
    DtIconUnderline: d,
    DtIconStrikethrough: h,
    DtIconListBullet: p,
    DtIconListOrdered: f,
    DtIconAlignLeft: B,
    DtIconAlignCenter: k,
    DtIconAlignRight: g,
    DtIconAlignJustify: T,
    DtIconQuote: I,
    DtIconCodeBlock: _,
    DtIconLink2: L,
    DtIconImage: A
  },
  inheritAttrs: !1,
  props: {
    /**
     * Value of the input. The object format should match TipTap's JSON
     * document structure: https://tiptap.dev/guide/output#option-1-json
     */
    value: {
      type: [Object, String],
      default: ""
    },
    /**
     * Whether the input is editable
     */
    editable: {
      type: Boolean,
      default: !0
    },
    /**
     * Descriptive label for the input element
     */
    inputAriaLabel: {
      type: String,
      required: !0,
      default: ""
    },
    /**
     * Additional class name for the input element. Only accepts a String value
     * because this is passed to the editor via options. For multiple classes,
     * join them into one string, e.g. "d-p8 d-hmx96"
     */
    inputClass: {
      type: String,
      default: ""
    },
    /**
     * Whether the input should receive focus after the component has been
     * mounted. Either one of `start`, `end`, `all` or a Boolean or a Number.
     * - `start`  Sets the focus to the beginning of the input
     * - `end`    Sets the focus to the end of the input
     * - `all`    Selects the whole contents of the input
     * - `Number` Sets the focus to a specific position in the input
     * - `true`   Defaults to `start`
     * - `false`  Disables autofocus
     * @values true, false, start, end, all, number
     */
    autoFocus: {
      type: [Boolean, String, Number],
      default: !1,
      validator(e) {
        return typeof e == "string" ? N.includes(e) : !0;
      }
    },
    /**
     * Placeholder text
     */
    placeholder: {
      type: String,
      default: ""
    },
    /**
     * Content area needs to dynamically adjust height based on the conversation area height.
     * can be vh|px|rem|em|%
     */
    maxHeight: {
      type: String,
      default: "unset"
    },
    /**
     * Placeholder text for the set link input field
     */
    setLinkPlaceholder: {
      type: String,
      default: ""
    },
    /**
     * Show button to render text as bold
     */
    showBoldButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to render text in italics
     */
    showItalicsButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to underline text
     */
    showUnderlineButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to strike text
     */
    showStrikeButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to render list items
     */
    showListItemsButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to render ordered list items
     */
    showOrderedListButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to align text to the left
     */
    showAlignLeftButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to align text to the center
     */
    showAlignCenterButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to align text to the right
     */
    showAlignRightButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to justify text
     */
    showAlignJustifyButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to add quote format to text
     */
    showQuoteButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to add code block
     */
    showCodeBlockButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to handle quick replies
     */
    showQuickRepliesButton: {
      type: Boolean,
      default: !0
    },
    /**
     * Show button to add an inline image
     */
    showInlineImageButton: {
      type: Boolean,
      default: !1
    },
    /**
     * Show add link default config.
     */
    showAddLink: {
      type: Object,
      default: () => ({
        showAddLinkButton: !0
      })
    },
    /**
     * Use div tags instead of paragraph tags to show text
     */
    useDivTags: {
      type: Boolean,
      default: !1
    }
  },
  emits: [
    /**
     * Native focus event
     * @event input
     * @type {String|JSON}
     */
    "focus",
    /**
     * Native blur event
     * @event input
     * @type {String|JSON}
     */
    "blur",
    /**
     * Native input event
     * @event input
     * @type {String|JSON}
     */
    "input",
    /**
     * Quick replies button
     * pressed event
     * @event quick-replies-click
     */
    "quick-replies-click",
    /**
     * Emit when inline image button is clicked
     * @event inline-image-click
     */
    "inline-image-click",
    /**
     * Emit when text content changes (not raw html)
     */
    "text-input"
  ],
  data() {
    return {
      internalInputValue: this.value,
      // internal input content
      hasFocus: !1,
      linkOptions: {
        class: "d-recipe-editor__link"
      },
      showLinkInput: !1,
      linkInput: "",
      currentButtonRefIndex: 0,
      i18n: new y()
    };
  },
  computed: {
    inputLength() {
      return this.internalInputValue.length;
    },
    htmlOutputFormat() {
      return $[2];
    },
    showingTextFormatButtons() {
      return this.showBoldButton || this.showItalicsButton || this.showStrikeButton || this.showUnderlineButton;
    },
    showingAlignmentButtons() {
      return this.showAlignLeftButton || this.showAlignCenterButton || this.showAlignRightButton || this.showAlignJustifyButton;
    },
    showingListButtons() {
      return this.showListItemsButton || this.showOrderedListButton;
    },
    orderedRefs() {
      const e = this.buttonGroups.reduce((function(t, n) {
        return n.buttonGroup.forEach((i) => {
          t.push(this.getButtonRef(n.key, i.selector));
        }, this), t;
      }).bind(this), []);
      return e.push(this.getButtonRef("custom", "link")), e;
    },
    buttonGroups() {
      const e = this.individualButtons.map((t) => ({
        key: t.selector,
        buttonGroup: [t]
      }));
      return [
        { key: "new", buttonGroup: this.newButtons },
        { key: "format", buttonGroup: this.textFormatButtons },
        { key: "alignment", buttonGroup: this.alignmentButtons },
        { key: "list", buttonGroup: this.listButtons },
        ...e
      ].filter((t) => t.buttonGroup.length > 0);
    },
    newButtons() {
      return [
        {
          showBtn: this.showQuickRepliesButton,
          label: this.i18n.$t("DIALTONE_EDITOR_QUICK_REPLY_BUTTON_LABEL"),
          selector: "quickReplies",
          icon: u,
          dataQA: "dt-recipe-editor-quick-replies-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_QUICK_REPLY_BUTTON_LABEL"),
          onClick: this.onQuickRepliesClick
        }
      ].filter((e) => e.showBtn);
    },
    textFormatButtons() {
      return [
        {
          showBtn: this.showBoldButton,
          selector: "bold",
          icon: a,
          dataQA: "dt-recipe-editor-bold-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_BOLD_BUTTON_LABEL"),
          onClick: this.onBoldTextToggle
        },
        {
          showBtn: this.showItalicsButton,
          selector: "italic",
          icon: c,
          dataQA: "dt-recipe-editor-italics-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_ITALICS_BUTTON_LABEL"),
          onClick: this.onItalicTextToggle
        },
        {
          showBtn: this.showUnderlineButton,
          selector: "underline",
          icon: d,
          dataQA: "dt-recipe-editor-underline-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_UNDERLINE_BUTTON_LABEL"),
          onClick: this.onUnderlineTextToggle
        },
        {
          showBtn: this.showStrikeButton,
          selector: "strike",
          icon: h,
          dataQA: "dt-recipe-editor-strike-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_STRIKE_BUTTON_LABEL"),
          onClick: this.onStrikethroughTextToggle
        }
      ].filter((e) => e.showBtn);
    },
    alignmentButtons() {
      return [
        {
          showBtn: this.showAlignLeftButton,
          selector: { textAlign: "left" },
          icon: B,
          dataQA: "dt-recipe-editor-align-left-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_ALIGN_LEFT_BUTTON_LABEL"),
          onClick: () => this.onTextAlign("left")
        },
        {
          showBtn: this.showAlignCenterButton,
          selector: { textAlign: "center" },
          icon: k,
          dataQA: "dt-recipe-editor-align-center-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_ALIGN_CENTER_BUTTON_LABEL"),
          onClick: () => this.onTextAlign("center")
        },
        {
          showBtn: this.showAlignRightButton,
          selector: { textAlign: "right" },
          icon: g,
          dataQA: "dt-recipe-editor-align-right-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_ALIGN_RIGHT_BUTTON_LABEL"),
          onClick: () => this.onTextAlign("right")
        },
        {
          showBtn: this.showAlignJustifyButton,
          selector: { textAlign: "justify" },
          icon: T,
          dataQA: "dt-recipe-editor-align-justify-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_ALIGN_JUSTIFY_BUTTON_LABEL"),
          onClick: () => this.onTextAlign("justify")
        }
      ].filter((e) => e.showBtn);
    },
    listButtons() {
      return [
        {
          showBtn: this.showListItemsButton,
          selector: "bulletList",
          icon: p,
          dataQA: "dt-recipe-editor-list-items-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_BULLET_LIST_BUTTON_LABEL"),
          onClick: this.onBulletListToggle
        },
        {
          showBtn: this.showOrderedListButton,
          selector: "orderedList",
          icon: f,
          dataQA: "dt-recipe-editor-ordered-list-items-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_ORDERED_LIST_BUTTON_LABEL"),
          onClick: this.onOrderedListToggle
        }
      ].filter((e) => e.showBtn);
    },
    individualButtons() {
      return [
        {
          showBtn: this.showQuoteButton,
          selector: "blockquote",
          icon: I,
          dataQA: "dt-recipe-editor-blockquote-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_QUOTE_BUTTON_LABEL"),
          onClick: this.onBlockquoteToggle
        },
        {
          showBtn: this.showCodeBlockButton,
          selector: "codeBlock",
          icon: _,
          dataQA: "dt-recipe-editor-code-block-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_CODE_BUTTON_LABEL"),
          onClick: this.onCodeBlockToggle
        },
        {
          showBtn: this.showInlineImageButton,
          selector: "image",
          icon: A,
          dataQA: "dt-recipe-editor-inline-image-btn",
          tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_IMAGE_BUTTON_LABEL"),
          onClick: this.onInsertInlineImageClick
        }
      ].filter((e) => e.showBtn);
    },
    linkButton() {
      return {
        showBtn: this.showAddLink.showAddLinkButton,
        selector: "link",
        icon: L,
        dataQA: "dt-recipe-editor-add-link-btn",
        tooltipMessage: this.i18n.$t("DIALTONE_EDITOR_LINK_BUTTON_LABEL"),
        onClick: this.openLinkInput
      };
    },
    confirmSetLinkButtonLabels() {
      return this.i18n.$ta("DIALTONE_EDITOR_CONFIRM_SET_LINK_BUTTON");
    },
    cancelSetLinkButtonLabels() {
      return this.i18n.$ta("DIALTONE_EDITOR_CANCEL_SET_LINK_BUTTON");
    },
    removeLinkButtonLabels() {
      return this.i18n.$ta("DIALTONE_EDITOR_REMOVE_LINK_BUTTON");
    },
    showAddLinkButtonLabels() {
      return this.i18n.$ta("DIALTONE_EDITOR_ADD_LINK_BUTTON");
    }
  },
  watch: {
    value(e) {
      this.internalInputValue = e;
    }
  },
  methods: {
    onInputFocus(e) {
      e == null || e.stopPropagation();
    },
    removeLink() {
      var e, t, n, i, o;
      (o = (i = (n = (t = (e = this.$refs.richTextEditor) == null ? void 0 : e.editor) == null ? void 0 : t.chain()) == null ? void 0 : n.focus()) == null ? void 0 : i.unsetLink()) == null || o.run(), this.closeLinkInput();
    },
    setLink(e) {
      var o, r, l;
      const t = (o = this.$refs.richTextEditor) == null ? void 0 : o.editor;
      if (e == null || e.preventDefault(), e == null || e.stopPropagation(), !this.linkInput) {
        this.removeLink();
        return;
      }
      m.find((s) => s.test(this.linkInput)) || (this.linkInput = `${E}${this.linkInput}`);
      const i = (l = (r = t == null ? void 0 : t.view) == null ? void 0 : r.state) == null ? void 0 : l.selection;
      i.anchor === i.head ? t.chain().focus().insertContentAt(
        i.anchor,
        `<a class="${this.linkOptions.class}" href=${this.linkInput}>${this.linkInput}</a>`
      ).run() : t.chain().focus().extendMarkRange("link").setLink({ href: this.linkInput, class: this.linkOptions.class }).run(), this.closeLinkInput();
    },
    openLinkInput() {
      this.showLinkInput = !0;
    },
    updateInput(e) {
      var t, n, i;
      if (!e)
        return this.closeLinkInput();
      this.linkInput = (i = (n = (t = this.$refs.richTextEditor) == null ? void 0 : t.editor) == null ? void 0 : n.getAttributes("link")) == null ? void 0 : i.href;
    },
    closeLinkInput() {
      var e;
      this.showLinkInput = !1, this.linkInput = "", (e = this.$refs.richTextEditor.editor) == null || e.chain().focus();
    },
    onBoldTextToggle() {
      var e, t;
      (t = (e = this.$refs.richTextEditor) == null ? void 0 : e.editor) == null || t.chain().focus().toggleBold().run();
    },
    onItalicTextToggle() {
      var e;
      (e = this.$refs.richTextEditor) == null || e.editor.chain().focus().toggleItalic().run();
    },
    onUnderlineTextToggle() {
      var e;
      (e = this.$refs.richTextEditor) == null || e.editor.chain().focus().toggleUnderline().run();
    },
    onStrikethroughTextToggle() {
      var e;
      (e = this.$refs.richTextEditor) == null || e.editor.chain().focus().toggleStrike().run();
    },
    onTextAlign(e) {
      var t, n, i, o;
      if ((n = (t = this.$refs.richTextEditor) == null ? void 0 : t.editor) != null && n.isActive({ textAlign: e }))
        return (i = this.$refs.richTextEditor) == null ? void 0 : i.editor.chain().focus().unsetTextAlign().run();
      (o = this.$refs.richTextEditor) == null || o.editor.chain().focus().setTextAlign(e).run();
    },
    onBulletListToggle() {
      var e;
      (e = this.$refs.richTextEditor) == null || e.editor.chain().focus().toggleBulletList().run();
    },
    onOrderedListToggle() {
      var e;
      (e = this.$refs.richTextEditor) == null || e.editor.chain().focus().toggleOrderedList().run();
    },
    onCodeBlockToggle() {
      var e;
      (e = this.$refs.richTextEditor) == null || e.editor.chain().focus().toggleCodeBlock().run();
    },
    onQuickRepliesClick() {
      this.$emit("quick-replies-click");
    },
    onInsertInlineImageClick() {
      this.$emit("inline-image-click");
    },
    insertInlineImage(e) {
      var t;
      (t = this.$refs.richTextEditor) == null || t.editor.chain().focus().setImage({ src: e }).run();
    },
    onBlockquoteToggle() {
      var e;
      (e = this.$refs.richTextEditor) == null || e.editor.chain().focus().toggleBlockquote().run();
    },
    insertInMessageBody(e) {
      var t;
      (t = this.$refs.richTextEditor) == null || t.editor.chain().focus().insertContent(e).run();
    },
    setCursorPosition(e = null) {
      var t;
      (t = this.$refs.richTextEditor) == null || t.editor.chain().focus(e).run();
    },
    onTextInput(e) {
      this.$emit("text-input", e);
    },
    onFocus(e) {
      this.hasFocus = !0, this.$emit("focus", e);
    },
    onBlur(e) {
      this.hasFocus = !1, this.$emit("blur", e);
    },
    onInput(e) {
      this.$emit("input", e);
    },
    getButtonKey(e, t) {
      return `${e}-${JSON.stringify(t)}`;
    },
    // Unique Button Ref Key to identify ref
    getButtonRef(e, t) {
      return `${this.getButtonKey(e, t)}-ref`;
    },
    /**
     * Determines if an element in the action bar button list is focusable with tab key
     * @param {string} refKey - unique identifier for the ref element in DOM
     */
    canFocus(e) {
      return e === this.orderedRefs[this.currentButtonRefIndex];
    },
    shiftActionBarFocusRight() {
      this.shiftButtonRefIndex(1);
    },
    shiftActionBarFocusLeft() {
      this.shiftButtonRefIndex(-1);
    },
    shiftButtonRefIndex(e) {
      const t = this.$refs[this.orderedRefs[this.currentButtonRefIndex]], n = Array.isArray(t) ? t[0] : t, i = (this.currentButtonRefIndex + e) % this.orderedRefs.length;
      this.currentButtonRefIndex = i >= 0 ? i : this.orderedRefs.length + i;
      const o = this.$refs[this.orderedRefs[this.currentButtonRefIndex]], r = Array.isArray(o) ? o[0] : o;
      n.$el.blur(), r.$el.focus();
    }
  }
};
var U = function() {
  var t = this, n = t._self._c;
  return n("div", { staticClass: "d-recipe-editor", attrs: { "data-qa": "dt-recipe-editor", role: "presentation" }, on: { click: function(i) {
    return t.$refs.richTextEditor.focusEditor();
  } } }, [n("dt-stack", { staticClass: "d-recipe-editor__top-bar", attrs: { direction: "row", gap: "450" } }, [t._l(t.buttonGroups, function(i) {
    return n("dt-stack", { key: i.key, attrs: { direction: "row", gap: "300" } }, [t._l(i.buttonGroup, function(o) {
      return n("dt-tooltip", { key: t.getButtonKey(i.key, o.selector), attrs: { message: o.tooltipMessage, placement: "top" }, scopedSlots: t._u([{ key: "anchor", fn: function() {
        var r, l;
        return [n("dt-button", { ref: t.getButtonRef(i.key, o.selector), refInFor: !0, attrs: { active: (l = (r = t.$refs.richTextEditor) == null ? void 0 : r.editor) == null ? void 0 : l.isActive(o.selector), "aria-label": o.tooltipMessage, "data-qa": o.dataQA, tabindex: t.canFocus(t.getButtonRef(i.key, o.selector)) ? 0 : -1, importance: "clear", kind: "muted", size: "xs" }, on: { click: function(s) {
          return o.onClick();
        }, keydown: [function(s) {
          return !s.type.indexOf("key") && t._k(s.keyCode, "right", 39, s.key, ["Right", "ArrowRight"]) || "button" in s && s.button !== 2 ? null : (s.stopPropagation(), t.shiftActionBarFocusRight.apply(null, arguments));
        }, function(s) {
          return !s.type.indexOf("key") && t._k(s.keyCode, "left", 37, s.key, ["Left", "ArrowLeft"]) || "button" in s && s.button !== 0 ? null : (s.stopPropagation(), t.shiftActionBarFocusLeft.apply(null, arguments));
        }] }, scopedSlots: t._u([{ key: "icon", fn: function() {
          return [n(o.icon, { tag: "component", attrs: { size: "200" } })];
        }, proxy: !0 }], null, !0) }, [o.label ? n("span", [t._v(t._s(o.label))]) : t._e()])];
      }, proxy: !0 }], null, !0) });
    }), n("div", { staticClass: "d-recipe-editor__button-group-divider" })], 2);
  }), t.linkButton.showBtn ? n("dt-stack", { attrs: { direction: "row", gap: "300" } }, [n("dt-popover", { attrs: { open: t.showLinkInput, "show-close-button": !1, "data-qa": "dt-recipe-editor-link-input-popover", padding: "none", placement: "bottom-start" }, on: { "update:open": function(i) {
    t.showLinkInput = i;
  }, click: t.onInputFocus, opened: t.updateInput }, nativeOn: { click: function(i) {
    return i.stopPropagation(), t.onInputFocus.apply(null, arguments);
  } }, scopedSlots: t._u([{ key: "anchor", fn: function() {
    return [n("dt-tooltip", { key: t.linkButton.key, attrs: { message: t.linkButton.tooltipMessage, placement: "top" }, scopedSlots: t._u([{ key: "anchor", fn: function() {
      var i, o;
      return [n("dt-button", { ref: t.getButtonRef("custom", "link"), attrs: { active: (o = (i = t.$refs.richTextEditor) == null ? void 0 : i.editor) == null ? void 0 : o.isActive(t.linkButton.selector), "aria-label": t.linkButton.tooltipMessage, "data-qa": t.linkButton.dataQA, tabindex: t.canFocus(t.getButtonRef("custom", "link")) ? 0 : -1, importance: "clear", kind: "muted", size: "xs" }, on: { click: function(r) {
        return t.linkButton.onClick();
      }, keydown: [function(r) {
        return !r.type.indexOf("key") && t._k(r.keyCode, "right", 39, r.key, ["Right", "ArrowRight"]) || "button" in r && r.button !== 2 ? null : (r.stopPropagation(), t.shiftActionBarFocusRight.apply(null, arguments));
      }, function(r) {
        return !r.type.indexOf("key") && t._k(r.keyCode, "left", 37, r.key, ["Left", "ArrowLeft"]) || "button" in r && r.button !== 0 ? null : (r.stopPropagation(), t.shiftActionBarFocusLeft.apply(null, arguments));
      }] }, scopedSlots: t._u([{ key: "icon", fn: function() {
        return [n(t.linkButton.icon, { tag: "component", attrs: { size: "200" } })];
      }, proxy: !0 }], null, !1, 3601441856) })];
    }, proxy: !0 }], null, !1, 1067010212) })];
  }, proxy: !0 }, { key: "content", fn: function() {
    return [n("div", { staticClass: "d-recipe-editor__popover-content" }, [n("span", [t._v(" " + t._s(t.showAddLinkButtonLabels.title) + " ")]), n("dt-input", { attrs: { "input-aria-label": t.showAddLinkButtonLabels["aria-label"], placeholder: t.setLinkPlaceholder, "data-qa": "dt-recipe-editor-link-input", "input-wrapper-class": "d-recipe-editor-link__input-wrapper" }, on: { click: t.onInputFocus, focus: t.onInputFocus, keydown: function(i) {
      return !i.type.indexOf("key") && t._k(i.keyCode, "enter", 13, i.key, "Enter") ? null : t.setLink.apply(null, arguments);
    } }, nativeOn: { click: function(i) {
      return i.stopPropagation(), t.onInputFocus.apply(null, arguments);
    } }, model: { value: t.linkInput, callback: function(i) {
      t.linkInput = i;
    }, expression: "linkInput" } })], 1)];
  }, proxy: !0 }, { key: "footerContent", fn: function() {
    return [n("dt-stack", { staticClass: "d-recipe-editor__popover-footer", attrs: { direction: "row", gap: "300" } }, [n("dt-button", t._b({ attrs: { "data-qa": "dt-recipe-editor-remove-link-btn", importance: "clear", kind: "muted", size: "sm" }, on: { click: t.removeLink } }, "dt-button", t.removeLinkButtonLabels, !1), [t._v(" " + t._s(t.removeLinkButtonLabels.title) + " ")]), n("dt-button", t._b({ attrs: { "data-qa": "dt-recipe-editor-set-link-cancel-btn", importance: "clear", kind: "muted", size: "sm" }, on: { click: t.closeLinkInput } }, "dt-button", t.cancelSetLinkButtonLabels, !1), [t._v(" " + t._s(t.cancelSetLinkButtonLabels.title) + " ")]), n("dt-button", t._b({ attrs: { "data-qa": "dt-recipe-editor-set-link-confirm-btn", size: "sm" }, on: { click: t.setLink } }, "dt-button", t.confirmSetLinkButtonLabels, !1), [t._v(" " + t._s(t.confirmSetLinkButtonLabels.title) + " ")])], 1)];
  }, proxy: !0 }], null, !1, 2563529431) })], 1) : t._e()], 2), n("div", { staticClass: "d-recipe-editor__content", style: { "max-height": t.maxHeight } }, [n("dt-rich-text-editor", t._b({ ref: "richTextEditor", attrs: { "allow-font-color": !0, "allow-font-family": !0, "allow-inline-images": !0, "allow-line-breaks": !0, "hide-link-bubble-menu": !0, "auto-focus": t.autoFocus, editable: t.editable, "input-aria-label": t.inputAriaLabel, "input-class": `d-recipe-editor__content-input ${t.inputClass}`, link: !0, "output-format": t.htmlOutputFormat, placeholder: t.placeholder, "use-div-tags": t.useDivTags, "data-qa": "dt-rich-text-editor" }, on: { "text-input": t.onTextInput, blur: t.onBlur, focus: t.onFocus, input: function(i) {
    return t.onInput(i);
  } }, model: { value: t.internalInputValue, callback: function(i) {
    t.internalInputValue = i;
  }, expression: "internalInputValue" } }, "dt-rich-text-editor", t.$attrs, !1))], 1)], 1);
}, F = [], Q = /* @__PURE__ */ O(
  S,
  U,
  F
);
const Y = Q.exports;
export {
  Y as default
};
//# sourceMappingURL=editor.js.map
