import { h, Component, Prop } from '@stencil/core';
import { ThemeProvider, ResponsiveContainer, Grid, Heading, Col } from '../../../core';
import { PrismicRichText, PrismicResponsiveImage } from '../../../web/components/exports';
import { trackView } from '../../../utils';
export class ResourceWhitepaper {
  checkForAds(prismicData) {
    var _a;
    const slices = ((_a = prismicData === null || prismicData === void 0 ? void 0 : prismicData.doc.data) === null || _a === void 0 ? void 0 : _a.body) || [];
    slices.forEach((slice) => {
      if (slice.slice_type === 'ad') {
        trackView(`${location.host}${location.pathname}`, 'Resource Center');
      }
    });
  }
  componentWillLoad() {
    this.checkForAds(this.prismicData);
  }
  render() {
    if (!this.prismicData)
      return;
    const resource = this.prismicData;
    return [
      h(ThemeProvider, { type: "editorial" },
        h("div", { class: "resource-whitepaper" },
          h("div", { class: "resource-whitepaper__cta" },
            h(ResponsiveContainer, null,
              h("hgroup", { class: "resource-whitepaper__hgroup" },
                h(Heading, { level: 6 }, "Whitepaper"),
                h(Heading, { level: 1 }, resource.title),
                h("p", { class: "resource-whitepaper__tagline" }, resource.doc.data.tagline)))),
          h(ResponsiveContainer, null,
            h(Grid, { class: "resource-whitepaper__content" },
              h(Col, { cols: 12, xs: 12, sm: 6, md: 6 },
                h(PrismicResponsiveImage, { image: resource.doc.data.cover_image, class: "resource-whitepaper__illustration" }),
                h(PrismicRichText, { richText: resource.doc.data.description, class: "resource-whitepaper__description" })),
              h(Col, { cols: 12, xs: 12, sm: 6, md: 6 },
                h("hubspot-form", { formId: resource.doc.data.hubspot_form_id }))))))
    ];
  }
  static get is() { return "resource-whitepaper"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["resource-whitepaper.scss"]
  }; }
  static get styleUrls() { return {
    "$": ["resource-whitepaper.css"]
  }; }
  static get properties() { return {
    "prismicData": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "PrismicResource",
        "resolved": "PrismicResource",
        "references": {
          "PrismicResource": {
            "location": "import",
            "path": "../../../web/models"
          }
        }
      },
      "required": true,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
}
;
