import './_commonjsHelpers-0c4b6f40.js';
import './_to-object-ded78eb9.js';
import './es6.string.iterator-9b2af4a5.js';
import './core.get-iterator-method-54d2e411.js';
import './web.dom.iterable-8956f9a5.js';
import React__default from 'react';
import 'prop-types';
import { m as moment } from './moment-e2f9b20c.js';
import 'react-dom';
import { i as imageUrlBuilder } from './index-73819142.js';
import { L as LazyLoad } from './index-5f9f807a.js';
import { c as clean_html_1 } from './entities-7cc3bf45.js';
import './slicedToArray-7021e5df.js';
import { A as AuthorComponent } from './AuthorComponent-00f13201.js';

var YahooHero = function YahooHero(props) {
  var removeTimeStamp = props.removeTimeStamp;

  var topArticle = props.dataRecord[0];
  var subArticles = props.dataRecord.slice(1, props.dataRecord.length);
  var client = props.client;

  var builder = imageUrlBuilder(client);
  function urlFor(source) {
    return builder.image(source).auto('format');
  }

  var topArticleThumbnail = '';
  var topArticleAltText = topArticle.title;
  if (topArticle.thumbnail && topArticle.thumbnail.asset) {
    topArticleThumbnail = urlFor(topArticle.thumbnail.asset).width(600).url();
    topArticleAltText = topArticle.thumbnail.asset.originalFileName;
  } else if (props.thumbnail) {
    topArticleThumbnail = props.thumbnail;
  }

  return React__default.createElement(
    'div',
    { className: 'article-hero' },
    React__default.createElement(
      'a',
      { href: '/view/' + topArticle.url.current },
      React__default.createElement(
        'div',
        { className: 'yh-top-article' },
        React__default.createElement(
          'div',
          { className: 'yh-top-article--img' },
          React__default.createElement('img', { src: topArticleThumbnail, alt: topArticleAltText })
        ),
        React__default.createElement('div', { className: 'yh-top-article--blur' }),
        React__default.createElement(
          'div',
          { className: 'yh-top-article--body' },
          React__default.createElement(
            'h1',
            null,
            topArticle.title
          ),
          React__default.createElement(
            'p',
            null,
            moment(topArticle.published).format(removeTimeStamp ? 'MMMM DD, YYYY' : 'MMMM DD, YYYY hh:mma')
          ),
          React__default.createElement(
            'p',
            null,
            clean_html_1(topArticle.summary)
          )
        )
      )
    ),
    React__default.createElement(
      'div',
      { className: 'yh-sub-article-container' },
      subArticles.map(function (article, index) {
        var articleThumbnail = '';
        var articleAltText = article.title;
        if (article.thumbnail && article.thumbnail.asset) {
          articleThumbnail = urlFor(article.thumbnail.asset).width(250).url();
          articleAltText = article.thumbnail.asset.originalFileName;
        } else if (props.thumbnail) {
          articleThumbnail = props.thumbnail;
        }

        return React__default.createElement(
          'div',
          { key: index, className: 'yh-sub-article' },
          React__default.createElement(
            'a',
            { href: '/view/' + article.url.current },
            React__default.createElement('img', { src: articleThumbnail })
          ),
          React__default.createElement(
            'a',
            { href: '/view/' + article.url.current },
            React__default.createElement(
              'h6',
              { className: 'yh-sub-article--title' },
              article.title
            )
          ),
          React__default.createElement(
            'p',
            { className: 'yh-sub-article--info' },
            moment(article.published).format(removeTimeStamp ? 'MMMM DD, YYYY' : 'MMMM DD, YYYY hh:mma')
          ),
          article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
            LazyLoad,
            { height: 50 },
            React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
          )
        );
      })
    ),
    React__default.createElement(
      'style',
      { jsx: 'true' },
      '\n        .article-hero{\n          padding-bottom:15px\n        }\n        .yh-top-article {\n          display: flex;\n          flex-direction: row;\n          position: relative;\n          font-family: Roboto, sans-serif;\n          margin-bottom: 1rem;\n          border-radius: 15px;\n          overflow: hidden;\n          min-height: 315px;\n        }\n        .yh-top-article--img {\n          width: 100%;\n          min-height: 240px;\n          overflow: hidden;\n        }\n        .yh-top-article--img img {\n          width: 100%;\n          height: auto;\n          min-height: 100%;\n          max-height: 315px;\n          object-fit: cover;\n        }\n        .yh-top-article--body {\n          height: 100%;\n          width: 40%;\n          min-width: 320px;\n          right: 0;\n          position: absolute;\n          color: white;\n          padding: 1.75rem;\n          height: 315px;\n          display: flex;\n          align-items: flex-start;\n          justify-content: center;\n          flex-direction: column;\n        }\n        .yh-top-article--body h1 {\n          color: white!important;\n          font-size: 1.4rem;\n          font-weight: 500;\n          margin-bottom: 0.5rem;\n        }\n        .yh-top-article--body p {\n          font-size: 0.9rem;\n          margin-bottom: 0.5rem;\n        }\n        .yh-top-article--blur {\n          height: 100%;\n          width: 40%;\n          right: 0;\n          position: absolute;\n          filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));\n          background: rgba(0,0,0,.65);\n          min-width: 320px;\n        }\n        .yh-sub-article-container {\n          display: flex;\n          justify-content: space-between;\n        }\n        .yh-sub-article {\n          width: 23.25%;\n        }\n        .yh-sub-article p.yh-sub-article--title {\n          font-weight: bold;\n        }\n        .yh-sub-article img {\n          width: 100%;\n          height: 150px;\n          object-fit: cover;\n          border-radius: 15px;\n        }\n        .yh-sub-article img[src=\'' + props.thumbnail + '\']{\n          object-fit: contain;\n        }\n        .yh-sub-article--title {\n          font-weight: bold;\n          margin-top: .25rem;\n          font-size: 1rem;\n          margin-bottom: .25rem;\n        }\n        .yh-sub-article--info {\n          font-size: .8rem;\n          margin-bottom: 0;\n\n        }\n        @media screen and (max-width: 968px) {\n          .yh-sub-article-container {\n            flex-wrap: wrap;\n          }\n          .yh-sub-article {\n            width: 48%;\n            margin-bottom: 1rem;\n          }\n        }\n      '
    )
  );
};

export default YahooHero;
