'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-d685a739.js');
const eventTracking_service = require('./event-tracking.service-fcc820f1.js');
require('./api-client-00edc9b6.js');
require('./index-4f00f593.js');
require('./index-889ce6c6.js');
require('./datorama-akita-bb801820.js');
require('./scheduleArray-0ba3d6f8.js');
require('./delay-e91dba76.js');
require('./filter-c38164e6.js');

const benefitListItemCss = "ap-ben-benefit-list-item .btn.btn-success{background-color:#27a88a;border-color:#27a88a}ap-ben-benefit-list-item .btn.btn-success:hover{background-color:#23967b;border-color:#23967b}ap-ben-benefit-list-item .btn.btn-success:not(:disabled):not(.disabled):active{background-color:#23967b;border-color:#23967b}@media (max-width: 575.98px){ap-ben-benefit-list-item .btn.btn-success{display:block;width:100%}}ap-ben-benefit-list-item .benefit-image{-o-object-fit:cover;object-fit:cover;width:100%;max-width:4rem}";

const BenefitListItem = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.onBenefitButtonClick = async () => {
      if (this.benefit.url === null)
        return;
      window.open(this.benefit.url, '_blank');
      await eventTracking_service.benefitsEventTrackingService.trackBenefitLinkClickedAsync(this.benefitWithId);
    };
  }
  render() {
    return (index.h("div", { class: "uiid-view-benefit-item-exist row align-items-top py-3 mx-0" }, index.h("div", { class: "col-4 col-md-2 col-lg-1 px-0" }, index.h("div", { class: "ml-0 my-lg-3 my-sm-2 my-xs-2 mr-3" }, this.IconElement())), index.h("div", { class: "col-12 col-lg-8 text-left px-lg-2 px-0 pt-lg-0 pt-3" }, index.h("h4", { class: "card-title mb-1 text-break" }, this.benefit.title), index.h("span", { class: "benefit-value-description text-break" }, this.benefit.subtitle), this.benefit.subtitle && ' - ', index.h("span", { class: "text-muted" }, this.benefit.category), index.h("p", { class: "mb-0 pt-lg-3 pt-4 text-break" }, this.benefit.description)), index.h("div", { class: "col-12 col-lg-3 px-0 d-flex justify-content-end align-items-start" }, this.openAttachmentButton(), this.learnMoreButton())));
  }
  get benefit() {
    return this.benefitWithId.benefit;
  }
  learnMoreButton() {
    if (this.benefit.url === null || this.benefit.url === '') {
      return undefined;
    }
    return (index.h("button", { type: "button", class: "uiid-validate-benefit-url-exist d-block d-lg-inline-block btn btn-light px-4 py-2 ml-2", onClick: async () => this.onBenefitButtonClick() }, "Learn more"));
  }
  openAttachmentButton() {
    var _a;
    if (this.benefit.attachments === null || ((_a = this.benefit.attachments) === null || _a === void 0 ? void 0 : _a.length) === 0) {
      return undefined;
    }
    return (index.h("a", { class: "uiid-validate-benefit-doc-exist d-block d-lg-inline-block btn btn-light px-4 py-2", target: "_blank", href: this.benefit.attachments[0].downloadUrl, onClick: (_) => eventTracking_service.benefitsEventTrackingService.trackBenefitAttachmentClickedAsync(this.benefitWithId) }, index.h("span", null, "View")));
  }
  IconElement() {
    if (this.benefit.icon !== null) {
      return (index.h("img", { src: this.benefit.icon.downloadUrl, class: "img-responsive benefit-image", alt: "benefit-icon" }));
    }
    else {
      return index.h("ap-ben-icon", { class: "text-black-50 fa-3x", iconPrefix: "fad", iconId: "award" });
    }
  }
};
BenefitListItem.style = benefitListItemCss;

exports.ap_ben_benefit_list_item = BenefitListItem;
