import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { g as getTranslation } from './getTranslation.js';
import { d as defineCustomElement$3 } from './klevu-button2.js';
import { d as defineCustomElement$2 } from './klevu-icon2.js';
import { d as defineCustomElement$1 } from './klevu-typography2.js';

const klevuChatBubbleCss = ":host{position:relative;--background:var(--klevu-chat-bubble-background, var(--klevu-color-neutral-2));--background-remote:var(--klevu-chat-bubble-background-remote, var(--klevu-color-primary));--text-color:var(--klevu-chat-bubble-text-color, inherit);--text-color-remote:var(--klevu-chat-bubble-text-color-remote, var(--klevu-color-neutral-1))}:host(::after){content:\"\";clear:both}klevu-typography{float:right;padding:var(--klevu-spacing-04);background-color:var(--background);border-radius:var(--klevu-border-radius-m);border-bottom-right-radius:0;color:var(--text-color);--klevu-typography-color:var(--text-color)}:host(.remote) klevu-typography{float:left;background-color:var(--background-remote);border-radius:var(--klevu-border-radius-m);border-bottom-left-radius:0;color:var(--text-color-remote);--klevu-typography-color:var(--text-color-remote)}.positive_feedback,.negative_feedback{position:absolute;top:-12px;right:12px;height:24px;width:24px;color:white;border-radius:100%;display:flex;align-items:center;justify-content:center}.negative_feedback{background-color:var(--klevu-color-negative)}.positive_feedback{background-color:var(--klevu-color-positive)}.feedback_reasons{font-size:12px;clear:both;display:flex;gap:var(--klevu-spacing-03);flex-wrap:wrap;padding:var(--klevu-spacing-04)}";

const KlevuChatBubble = /*@__PURE__*/ proxyCustomElement(class KlevuChatBubble extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.klevuMessageFeedbackReason = createEvent(this, "klevuMessageFeedbackReason", 7);
    this.remote = undefined;
    this.feedback = undefined;
    this.feedbackReasons = undefined;
    this.tRatingReason = getTranslation("chatBubble.tRatingReason");
  }
  render() {
    var _a, _b, _c;
    return (h(Host, { class: {
        remote: Boolean(this.remote),
      } }, h("klevu-typography", { variant: "body-s" }, h("slot", null)), ((_a = this.feedback) === null || _a === void 0 ? void 0 : _a.thumbs) === "up" && (h("div", null, h("klevu-icon", { part: "chat-bubble-positive-feedback", class: "positive_feedback", name: "thumb_up" }))), ((_b = this.feedback) === null || _b === void 0 ? void 0 : _b.thumbs) === "down" && (h("klevu-icon", { part: "chat-bubble-negative-feedback", class: "negative_feedback", name: "thumb_down" })), !Boolean((_c = this.feedback) === null || _c === void 0 ? void 0 : _c.reason) && this.feedbackReasons && (h("div", { class: "feedback_reasons", part: "chat-bubble-feedback-reasons" }, h("span", null, this.tRatingReason), this.feedbackReasons.map((reason) => (h("klevu-button", { size: "tiny", isSecondary: true, onClick: () => {
        this.klevuMessageFeedbackReason.emit({ reason, feedback: this.feedback });
      } }, reason)))))));
  }
  static get style() { return klevuChatBubbleCss; }
}, [1, "klevu-chat-bubble", {
    "remote": [4],
    "feedback": [16],
    "feedbackReasons": [16],
    "tRatingReason": [1, "t-rating-reason"]
  }]);
function defineCustomElement() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["klevu-chat-bubble", "klevu-button", "klevu-icon", "klevu-typography"];
  components.forEach(tagName => { switch (tagName) {
    case "klevu-chat-bubble":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, KlevuChatBubble);
      }
      break;
    case "klevu-button":
      if (!customElements.get(tagName)) {
        defineCustomElement$3();
      }
      break;
    case "klevu-icon":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
    case "klevu-typography":
      if (!customElements.get(tagName)) {
        defineCustomElement$1();
      }
      break;
  } });
}
defineCustomElement();

export { KlevuChatBubble as K, defineCustomElement as d };

//# sourceMappingURL=klevu-chat-bubble2.js.map