import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';

const klevuBannerCss = ":host{display:block}a{text-decoration:none}img{width:100%}";

var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
  if (kind === "a" && !f)
    throw new TypeError("Private accessor was defined without a getter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
    throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _KlevuBanner_instances, _KlevuBanner_click;
const KlevuBanner = /*@__PURE__*/ proxyCustomElement(class KlevuBanner extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.klevuBannerClick = createEvent(this, "klevuBannerClick", 7);
    _KlevuBanner_instances.add(this);
    this.imageUrl = undefined;
    this.linkUrl = undefined;
    this.altText = undefined;
    this.target = "_blank";
  }
  render() {
    return (h(Host, null, h("slot", null, h("a", { href: this.linkUrl, target: this.target, onClick: __classPrivateFieldGet(this, _KlevuBanner_instances, "m", _KlevuBanner_click) }, h("img", { part: "banner-image", src: this.imageUrl, alt: this.altText })))));
  }
  static get style() { return klevuBannerCss; }
}, [1, "klevu-banner", {
    "imageUrl": [1, "image-url"],
    "linkUrl": [1, "link-url"],
    "altText": [1, "alt-text"],
    "target": [1]
  }]);
_KlevuBanner_instances = new WeakSet(), _KlevuBanner_click = function _KlevuBanner_click(event) {
  const sent = this.klevuBannerClick.emit(this.linkUrl);
  if (sent.defaultPrevented) {
    event.preventDefault();
    return false;
  }
};
function defineCustomElement() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["klevu-banner"];
  components.forEach(tagName => { switch (tagName) {
    case "klevu-banner":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, KlevuBanner);
      }
      break;
  } });
}
defineCustomElement();

export { KlevuBanner as K, defineCustomElement as d };

//# sourceMappingURL=klevu-banner2.js.map