import { r as registerInstance, h } from './index-67f7ec52.js';
import { b as benefitsEventTrackingService } from './event-tracking.service-8d44e7ac.js';
import './api-client-a68152b8.js';
import './index-6869168f.js';
import './index-8f0ba0c8.js';
import './datorama-akita-d2413fd0.js';
import './scheduleArray-b9669898.js';
import './delay-d08c267f.js';
import './filter-aeb65cac.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) {
    registerInstance(this, hostRef);
    this.onBenefitButtonClick = async () => {
      if (this.benefit.url === null)
        return;
      window.open(this.benefit.url, '_blank');
      await benefitsEventTrackingService.trackBenefitLinkClickedAsync(this.benefitWithId);
    };
  }
  render() {
    return (h("div", { class: "uiid-view-benefit-item-exist row align-items-top py-3 mx-0" }, h("div", { class: "col-4 col-md-2 col-lg-1 px-0" }, h("div", { class: "ml-0 my-lg-3 my-sm-2 my-xs-2 mr-3" }, this.IconElement())), h("div", { class: "col-12 col-lg-8 text-left px-lg-2 px-0 pt-lg-0 pt-3" }, h("h4", { class: "card-title mb-1 text-break" }, this.benefit.title), h("span", { class: "benefit-value-description text-break" }, this.benefit.subtitle), this.benefit.subtitle && ' - ', h("span", { class: "text-muted" }, this.benefit.category), h("p", { class: "mb-0 pt-lg-3 pt-4 text-break" }, this.benefit.description)), 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 (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 (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: (_) => benefitsEventTrackingService.trackBenefitAttachmentClickedAsync(this.benefitWithId) }, h("span", null, "View")));
  }
  IconElement() {
    if (this.benefit.icon !== null) {
      return (h("img", { src: this.benefit.icon.downloadUrl, class: "img-responsive benefit-image", alt: "benefit-icon" }));
    }
    else {
      return h("ap-ben-icon", { class: "text-black-50 fa-3x", iconPrefix: "fad", iconId: "award" });
    }
  }
};
BenefitListItem.style = benefitListItemCss;

export { BenefitListItem as ap_ben_benefit_list_item };
