'use strict';

var slicedToArray = require('./slicedToArray-067dd3bc.js');
var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
var core_getIteratorMethod = require('./core.get-iterator-method-5643aa10.js');
var web_dom_iterable = require('./web.dom.iterable-d98303e0.js');
var _setSpecies = require('./_set-species-0c7864a2.js');
var _isArray = require('./_is-array-54228b29.js');
var toConsumableArray = require('./toConsumableArray-d7797c2b.js');
var React = require('react');
var Row = require('react-bootstrap/Row');
var Col = require('react-bootstrap/Col');
var Dropdown = require('react-bootstrap/Dropdown');
var Card = require('react-bootstrap/Card');
var Router = require('next/router');
var index = require('./index-65621b6c.js');
var urlForFile = require('./urlForFile-5084fc48.js');
require('./_iter-detect-b1df62f0.js');
require('react-dom');
require('prop-types');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var Row__default = /*#__PURE__*/_interopDefaultLegacy(Row);
var Col__default = /*#__PURE__*/_interopDefaultLegacy(Col);
var Dropdown__default = /*#__PURE__*/_interopDefaultLegacy(Dropdown);
var Card__default = /*#__PURE__*/_interopDefaultLegacy(Card);

var _validateCollection = function (it, TYPE) {
  if (!core_getIteratorMethod._isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  return it;
};

var dP$1 = core_getIteratorMethod._objectDp.f;









var fastKey = _isArray._meta.fastKey;

var SIZE = core_getIteratorMethod._descriptors ? '_s' : 'size';

var getEntry = function (that, key) {
  // fast case
  var index = fastKey(key);
  var entry;
  if (index !== 'F') return that._i[index];
  // frozen object case
  for (entry = that._f; entry; entry = entry.n) {
    if (entry.k == key) return entry;
  }
};

var _collectionStrong = {
  getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
    var C = wrapper(function (that, iterable) {
      _setSpecies._anInstance(that, C, NAME, '_i');
      that._t = NAME;         // collection type
      that._i = core_getIteratorMethod._objectCreate(null); // index
      that._f = undefined;    // first entry
      that._l = undefined;    // last entry
      that[SIZE] = 0;         // size
      if (iterable != undefined) _setSpecies._forOf(iterable, IS_MAP, that[ADDER], that);
    });
    _setSpecies._redefineAll(C.prototype, {
      // 23.1.3.1 Map.prototype.clear()
      // 23.2.3.2 Set.prototype.clear()
      clear: function clear() {
        for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
          entry.r = true;
          if (entry.p) entry.p = entry.p.n = undefined;
          delete data[entry.i];
        }
        that._f = that._l = undefined;
        that[SIZE] = 0;
      },
      // 23.1.3.3 Map.prototype.delete(key)
      // 23.2.3.4 Set.prototype.delete(value)
      'delete': function (key) {
        var that = _validateCollection(this, NAME);
        var entry = getEntry(that, key);
        if (entry) {
          var next = entry.n;
          var prev = entry.p;
          delete that._i[entry.i];
          entry.r = true;
          if (prev) prev.n = next;
          if (next) next.p = prev;
          if (that._f == entry) that._f = next;
          if (that._l == entry) that._l = prev;
          that[SIZE]--;
        } return !!entry;
      },
      // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
      // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
      forEach: function forEach(callbackfn /* , that = undefined */) {
        _validateCollection(this, NAME);
        var f = core_getIteratorMethod._ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
        var entry;
        while (entry = entry ? entry.n : this._f) {
          f(entry.v, entry.k, this);
          // revert to the last existing entry
          while (entry && entry.r) entry = entry.p;
        }
      },
      // 23.1.3.7 Map.prototype.has(key)
      // 23.2.3.7 Set.prototype.has(value)
      has: function has(key) {
        return !!getEntry(_validateCollection(this, NAME), key);
      }
    });
    if (core_getIteratorMethod._descriptors) dP$1(C.prototype, 'size', {
      get: function () {
        return _validateCollection(this, NAME)[SIZE];
      }
    });
    return C;
  },
  def: function (that, key, value) {
    var entry = getEntry(that, key);
    var prev, index;
    // change existing entry
    if (entry) {
      entry.v = value;
    // create new entry
    } else {
      that._l = entry = {
        i: index = fastKey(key, true), // <- index
        k: key,                        // <- key
        v: value,                      // <- value
        p: prev = that._l,             // <- previous entry
        n: undefined,                  // <- next entry
        r: false                       // <- removed
      };
      if (!that._f) that._f = entry;
      if (prev) prev.n = entry;
      that[SIZE]++;
      // add to index
      if (index !== 'F') that._i[index] = entry;
    } return that;
  },
  getEntry: getEntry,
  setStrong: function (C, NAME, IS_MAP) {
    // add .keys, .values, .entries, [@@iterator]
    // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
    core_getIteratorMethod._iterDefine(C, NAME, function (iterated, kind) {
      this._t = _validateCollection(iterated, NAME); // target
      this._k = kind;                     // kind
      this._l = undefined;                // previous
    }, function () {
      var that = this;
      var kind = that._k;
      var entry = that._l;
      // revert to the last existing entry
      while (entry && entry.r) entry = entry.p;
      // get next entry
      if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
        // or finish the iteration
        that._t = undefined;
        return web_dom_iterable._iterStep(1);
      }
      // return step by kind
      if (kind == 'keys') return web_dom_iterable._iterStep(0, entry.k);
      if (kind == 'values') return web_dom_iterable._iterStep(0, entry.v);
      return web_dom_iterable._iterStep(0, [entry.k, entry.v]);
    }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);

    // add [@@species], 23.1.2.2, 23.2.2.2
    _setSpecies._setSpecies(NAME);
  }
};
_collectionStrong.getConstructor;
_collectionStrong.def;
_collectionStrong.getEntry;
_collectionStrong.setStrong;

var SPECIES = core_getIteratorMethod._wks('species');

var _arraySpeciesConstructor = function (original) {
  var C;
  if (_isArray._isArray(original)) {
    C = original.constructor;
    // cross-realm fallback
    if (typeof C == 'function' && (C === Array || _isArray._isArray(C.prototype))) C = undefined;
    if (core_getIteratorMethod._isObject(C)) {
      C = C[SPECIES];
      if (C === null) C = undefined;
    }
  } return C === undefined ? Array : C;
};

// 9.4.2.3 ArraySpeciesCreate(originalArray, length)


var _arraySpeciesCreate = function (original, length) {
  return new (_arraySpeciesConstructor(original))(length);
};

// 0 -> Array#forEach
// 1 -> Array#map
// 2 -> Array#filter
// 3 -> Array#some
// 4 -> Array#every
// 5 -> Array#find
// 6 -> Array#findIndex





var _arrayMethods = function (TYPE, $create) {
  var IS_MAP = TYPE == 1;
  var IS_FILTER = TYPE == 2;
  var IS_SOME = TYPE == 3;
  var IS_EVERY = TYPE == 4;
  var IS_FIND_INDEX = TYPE == 6;
  var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  var create = $create || _arraySpeciesCreate;
  return function ($this, callbackfn, that) {
    var O = core_getIteratorMethod._toObject($this);
    var self = core_getIteratorMethod._iobject(O);
    var f = core_getIteratorMethod._ctx(callbackfn, that, 3);
    var length = core_getIteratorMethod._toLength(self.length);
    var index = 0;
    var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
    var val, res;
    for (;length > index; index++) if (NO_HOLES || index in self) {
      val = self[index];
      res = f(val, index, O);
      if (TYPE) {
        if (IS_MAP) result[index] = res;   // map
        else if (res) switch (TYPE) {
          case 3: return true;             // some
          case 5: return val;              // find
          case 6: return index;            // findIndex
          case 2: result.push(val);        // filter
        } else if (IS_EVERY) return false; // every
      }
    }
    return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  };
};

var dP = core_getIteratorMethod._objectDp.f;
var each = _arrayMethods(0);


var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  var Base = core_getIteratorMethod._global[NAME];
  var C = Base;
  var ADDER = IS_MAP ? 'set' : 'add';
  var proto = C && C.prototype;
  var O = {};
  if (!core_getIteratorMethod._descriptors || typeof C != 'function' || !(IS_WEAK || proto.forEach && !core_getIteratorMethod._fails(function () {
    new C().entries().next();
  }))) {
    // create collection constructor
    C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
    _setSpecies._redefineAll(C.prototype, methods);
    _isArray._meta.NEED = true;
  } else {
    C = wrapper(function (target, iterable) {
      _setSpecies._anInstance(target, C, NAME, '_c');
      target._c = new Base();
      if (iterable != undefined) _setSpecies._forOf(iterable, IS_MAP, target[ADDER], target);
    });
    each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
      var IS_ADDER = KEY == 'add' || KEY == 'set';
      if (KEY in proto && !(IS_WEAK && KEY == 'clear')) core_getIteratorMethod._hide(C.prototype, KEY, function (a, b) {
        _setSpecies._anInstance(this, C, KEY);
        if (!IS_ADDER && IS_WEAK && !core_getIteratorMethod._isObject(a)) return KEY == 'get' ? undefined : false;
        var result = this._c[KEY](a === 0 ? 0 : a, b);
        return IS_ADDER ? this : result;
      });
    });
    IS_WEAK || dP(C.prototype, 'size', {
      get: function () {
        return this._c.size;
      }
    });
  }

  core_getIteratorMethod._setToStringTag(C, NAME);

  O[NAME] = C;
  core_getIteratorMethod._export(core_getIteratorMethod._export.G + core_getIteratorMethod._export.W + core_getIteratorMethod._export.F, O);

  if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);

  return C;
};

var SET = 'Set';

// 23.2 Set Objects
_collection(SET, function (get) {
  return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
}, {
  // 23.2.3.1 Set.prototype.add(value)
  add: function add(value) {
    return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value);
  }
}, _collectionStrong);

var _arrayFromIterable = function (iter, ITERATOR) {
  var result = [];
  _setSpecies._forOf(iter, false, result.push, result, ITERATOR);
  return result;
};

// https://github.com/DavidBruant/Map-Set.prototype.toJSON


var _collectionToJson = function (NAME) {
  return function toJSON() {
    if (core_getIteratorMethod._classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
    return _arrayFromIterable(this);
  };
};

// https://github.com/DavidBruant/Map-Set.prototype.toJSON


core_getIteratorMethod._export(core_getIteratorMethod._export.P + core_getIteratorMethod._export.R, 'Set', { toJSON: _collectionToJson('Set') });

// https://tc39.github.io/proposal-setmap-offrom/


var _setCollectionOf = function (COLLECTION) {
  core_getIteratorMethod._export(core_getIteratorMethod._export.S, COLLECTION, { of: function of() {
    var length = arguments.length;
    var A = new Array(length);
    while (length--) A[length] = arguments[length];
    return new this(A);
  } });
};

// https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
_setCollectionOf('Set');

// https://tc39.github.io/proposal-setmap-offrom/





var _setCollectionFrom = function (COLLECTION) {
  core_getIteratorMethod._export(core_getIteratorMethod._export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
    var mapFn = arguments[1];
    var mapping, A, n, cb;
    core_getIteratorMethod._aFunction(this);
    mapping = mapFn !== undefined;
    if (mapping) core_getIteratorMethod._aFunction(mapFn);
    if (source == undefined) return new this();
    A = [];
    if (mapping) {
      n = 0;
      cb = core_getIteratorMethod._ctx(mapFn, arguments[2], 2);
      _setSpecies._forOf(source, false, function (nextItem) {
        A.push(cb(nextItem, n++));
      });
    } else {
      _setSpecies._forOf(source, false, A.push, A);
    }
    return new this(A);
  } });
};

// https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
_setCollectionFrom('Set');

var set$1 = core_getIteratorMethod._core.Set;

var set = _commonjsHelpers.createCommonjsModule(function (module) {
module.exports = { "default": set$1, __esModule: true };
});

var _Set = _commonjsHelpers.unwrapExports(set);

/* usage & query
const Publication = (props) => {
  const { cache, pub, year } = props
  const targeting = {
    content_placement: [`/journals/${pub.identifier.current}`],
    document_url: [`/journals/${pub.identifier.current}`],
  }
  return (
    <Shell title={pub.name} cache={cache} settings={Settings} targeting={targeting} ads={Ads} layout='3'>
      <PublicationLanding publication={pub} year={year} href={'journals'} />
    </Shell>
  )
}
Publication.getInitialProps = async (ctx) => {
  const { query } = ctx
  const {
    query: { year },
  } = ctx
  const pub = await client.fetch(getQuery('publication'), query)
 **import urlFor from framework**
  pub.issues.map((issue) => {
    issue.thumbnail = urlFor({client, source: issue.thumbnail})
  })
  return { pub, year }
}
export default Publication
*/

var generateContentPlacements = function generateContentPlacements(issues) {
  var contentPlacements = [];
  issues && issues.length > 0 && issues.forEach(function (issue) {
    if (issue.taxonomyMapping && issue.taxonomyMapping.length > 0) {
      issue.taxonomyMapping && issue.taxonomyMapping.forEach(function (tm) {
        if (!contentPlacements.find(function (cp) {
          return cp.identifier === tm.identifier;
        }) && tm) {
          contentPlacements.push({ _id: tm._id, name: tm.name, identifier: tm.identifier });
        }
      });
    }
  });
  return contentPlacements;
};

var PublicationLanding = function PublicationLanding(props) {
  var publication = props.publication,
      _props$year = props.year,
      year = _props$year === undefined ? '' : _props$year,
      href = props.href;
      props.pdf;
      var _props$contentPlaceme = props.contentPlacement,
      contentPlacement = _props$contentPlaceme === undefined ? '' : _props$contentPlaceme,
      client = props.client;

  var router = Router.useRouter();
  var years = [].concat(toConsumableArray._toConsumableArray(new _Set(publication.issues.map(function (issue) {
    return issue.year;
  })))).sort().reverse();
  var contentPlacements = generateContentPlacements(publication.issues);

  var _useState = React.useState(publication.issues),
      _useState2 = slicedToArray._slicedToArray(_useState, 2),
      issueData = _useState2[0],
      setIssueData = _useState2[1];

  var _useState3 = React.useState(year),
      _useState4 = slicedToArray._slicedToArray(_useState3, 2),
      activeYear = _useState4[0],
      setActiveYear = _useState4[1];

  var _useState5 = React.useState(contentPlacement),
      _useState6 = slicedToArray._slicedToArray(_useState5, 2),
      activeContentPlacement = _useState6[0],
      setActiveContentPlacement = _useState6[1];

  var _useState7 = React.useState(),
      _useState8 = slicedToArray._slicedToArray(_useState7, 2),
      sortedIssues = _useState8[0],
      setSortedIssues = _useState8[1];

  var baseUrl = client ? client.config().baseUrl : '';

  // useEffect(() => {
  //   ;(async function() {
  //     if (issueData && issueData.length > 0 && client) {
  //       try {
  //         const promises = issueData.map(async (issue) => {
  //           const articlesQuery = `*[
  //               _type == 'article'
  //               && !(_id in path("drafts.**"))
  //               && defined(title)
  //               && is_visible
  //               && defined(url)
  //               && defined(published)
  //               && dateTime(published) <= dateTime(now())
  //               && passwordLock != true
  //               && references('${issue._id}')
  //             ][0...1]{_id}`
  //           return { ...issue, articles: await client.fetch(articlesQuery) }
  //         })
  //         const articles = await Promise.all(promises)
  //         setIssueData(articles)
  //         setHasMapped(true)
  //       } catch (error) {
  //         console.error(error)
  //       }
  //     }
  //   })()
  // }, [])
  // function for filtering by year
  var filterByYear = function filterByYear(year) {
    return issueData.filter(function (issue) {
      return issue.year === year;
    });
  };

  //function for filtering by Content-Placement
  var filterByCP = function filterByCP(contentPlacement) {
    var issuesWithTM = issueData.filter(function (issue) {
      return issue.taxonomyMapping;
    });
    return issuesWithTM.filter(function (issue) {
      return issue.taxonomyMapping.find(function (tm) {
        return tm.name == contentPlacement.name;
      });
    });
  };

  //function takes yearsArray and then assigns the object with year key with corresponding year data values
  var assignDatabyYear = function assignDatabyYear() {
    var data_by_year = {};
    for (var i = 0; i < years.length; i++) {
      data_by_year[years[i]] = sortedData[i];
    }
    return data_by_year;
  };
  var assignDatabyCP = function assignDatabyCP() {
    var data_by_CP = {};
    for (var i = 0; i < contentPlacements.length; i++) {
      data_by_CP[contentPlacements[i].name] = sorted_Content_Placement[i];
    }
    return data_by_CP;
  };

  var sortedYearly = function sortedYearly() {
    var dataArray = [];
    for (var i = 0; i < years.length; i++) {
      dataArray[i] = filterByYear(years[i]);
    }
    return dataArray;
  };

  var sortedCP = function sortedCP() {
    var dataArray = [];
    for (var i = 0; i < contentPlacements.length; i++) {
      dataArray[i] = filterByCP(contentPlacements[i]);
    }
    return dataArray;
  };

  var sortByBoth = function sortByBoth() {
    var sortedObj = {};
    for (var i = 0; i < years.length; i++) {
      var dataYear = filterByYear(years[i]);
      sortedObj[years[i]] = dataYear;

      var _loop = function _loop(j) {
        sortedObj[years[i]][contentPlacements[j].name] = dataYear.filter(function (issue) {
          return issue.taxonomyMapping && issue.taxonomyMapping.find(function (tm) {
            return tm.name == contentPlacements[j].name;
          });
        });
      };

      for (var j = 0; j < contentPlacements.length; j++) {
        _loop(j);
      }
    }
    return sortedObj;
  };

  var dataByBoth = sortByBoth();

  var sortedData = sortedYearly();

  var sorted_Content_Placement = sortedCP();

  var dataByYear = assignDatabyYear();

  var dataByCP = assignDatabyCP();

  React.useEffect(function () {
    if (activeYear && activeContentPlacement && activeContentPlacement.id) {
      router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?year=' + activeYear + '&cp=' + activeContentPlacement.id, { shallow: true });
      var filteredResult = dataByBoth[activeYear][activeContentPlacement.name];
      setSortedIssues(filteredResult);
    } else if (activeYear) {
      router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?year=' + activeYear, { shallow: true });

      var filteredData = dataByYear[activeYear];
      setSortedIssues(filteredData);
    } else if (activeContentPlacement && activeContentPlacement.id) {
      router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?cp=' + activeContentPlacement.id, { shallow: true });
      var filteredPlacement = dataByCP[activeContentPlacement.name];
      setSortedIssues(filteredPlacement);
    } else {
      router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current, { shallow: true });
      setSortedIssues(null);
      setIssueData(issueData);
    }
  }, [activeYear, activeContentPlacement, issueData]);

  return React__default["default"].createElement(
    'div',
    { id: 'publicationLanding' },
    React__default["default"].createElement(
      'style',
      { jsx: true },
      '\n          #pubYearFilter .dropdown-menu.show,\n          #contentPlacementFilter .dropdown-menu.show {\n            max-height: 25vh;\n            overflow: auto;\n          }\n          #publicationLanding {\n            margin-bottom: 6rem;\n          }\n        '
    ),
    React__default["default"].createElement(
      Row__default["default"],
      null,
      issueData && issueData.length > 0 && years.length > 0 && React__default["default"].createElement(
        Col__default["default"],
        { className: 'flex-grow-0 mb-3' },
        React__default["default"].createElement(
          Dropdown__default["default"],
          { id: 'pubYearFilter' },
          React__default["default"].createElement(
            Dropdown__default["default"].Toggle,
            null,
            activeYear && !isNaN(activeYear) ? activeYear : 'Select Year'
          ),
          React__default["default"].createElement(
            Dropdown__default["default"].Menu,
            null,
            React__default["default"].createElement(Dropdown__default["default"].Item, { style: { height: '2rem' }, onClick: function onClick() {
                return setActiveYear('');
              } }),
            years.map(function (yr, key) {
              return React__default["default"].createElement(
                Dropdown__default["default"].Item,
                { key: key, onClick: function onClick() {
                    return setActiveYear(yr);
                  } },
                yr
              );
            })
          )
        )
      ),
      contentPlacements && contentPlacements.length > 0 && React__default["default"].createElement(
        Col__default["default"],
        { className: 'flex-grow-0 mb-3' },
        React__default["default"].createElement(
          Dropdown__default["default"],
          { id: 'contentPlacementFilter' },
          React__default["default"].createElement(
            Dropdown__default["default"].Toggle,
            null,
            activeContentPlacement && activeContentPlacement.name ? activeContentPlacement.name : 'Select Topic'
          ),
          React__default["default"].createElement(
            Dropdown__default["default"].Menu,
            null,
            React__default["default"].createElement(Dropdown__default["default"].Item, { style: { height: '2rem' }, onClick: function onClick() {
                return setActiveContentPlacement('');
              } }),
            contentPlacements.map(function (cp) {
              return React__default["default"].createElement(
                Dropdown__default["default"].Item,
                {
                  key: cp._id,
                  onClick: function onClick() {
                    return setActiveContentPlacement({ id: cp.identifier, name: cp.name });
                  },
                  active: activeContentPlacement.id == cp.identifier ? true : false },
                cp.name
              );
            })
          )
        )
      )
    ),
    sortedIssues && sortedIssues.length > 0 ? sortedIssues.map(function (issue, key) {
      return React__default["default"].createElement(
        Card__default["default"],
        { key: key, className: 'issueCard' },
        React__default["default"].createElement(
          Row__default["default"],
          null,
          issue.thumbnail && React__default["default"].createElement(
            Col__default["default"],
            { md: 3, id: 'issueThumbnail' },
            React__default["default"].createElement(
              index.LazyLoad,
              { once: true },
              React__default["default"].createElement(Card__default["default"].Img, { src: issue.thumbnail })
            )
          ),
          React__default["default"].createElement(
            Col__default["default"],
            { md: issue.thumbnail ? 9 : 12, id: 'issueDetail' },
            React__default["default"].createElement(
              Card__default["default"].Body,
              null,
              React__default["default"].createElement(
                Card__default["default"].Title,
                null,
                issue.name
              ),
              issue.source && React__default["default"].createElement(
                'div',
                { className: 'content-category-label' },
                React__default["default"].createElement(
                  'div',
                  { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                  issue.source
                )
              ),
              issue.volume && issue.number && React__default["default"].createElement(
                'p',
                null,
                'Volume: ',
                issue.volume,
                React__default["default"].createElement('br', null),
                'Issue: ',
                issue.number
              )
            ),
            React__default["default"].createElement(
              Card__default["default"].Footer,
              null,
              issue && issue.articles && issue.articles.length > 0 ? React__default["default"].createElement(
                'a',
                { href: publication.identifier.current + '/' + issue.identifier.current, className: 'btn btn-primary' },
                'View Issue'
              ) : null,
              issue.pdf && issue.pdf.asset && issue.pdf.asset.url && React__default["default"].createElement(
                'a',
                { rel: 'noopener', href: urlForFile.urlForFile(issue.pdf, baseUrl), target: '_blank', className: 'btn btn-primary' },
                'Download Issue'
              )
            )
          )
        )
      );
    }) : !activeContentPlacement && !activeYear && issueData && issueData.length > 0 ? issueData.map(function (issue, key) {
      return React__default["default"].createElement(
        Card__default["default"],
        { key: key, className: 'issueCard' },
        React__default["default"].createElement(
          Row__default["default"],
          null,
          issue.thumbnail && React__default["default"].createElement(
            Col__default["default"],
            { md: 3, id: 'issueThumbnail' },
            React__default["default"].createElement(
              index.LazyLoad,
              { once: true },
              React__default["default"].createElement(Card__default["default"].Img, { src: issue.thumbnail })
            )
          ),
          React__default["default"].createElement(
            Col__default["default"],
            { md: issue.thumbnail ? 9 : 12, id: 'issueDetail' },
            React__default["default"].createElement(
              Card__default["default"].Body,
              null,
              React__default["default"].createElement(
                Card__default["default"].Title,
                null,
                issue.name
              ),
              issue.source && React__default["default"].createElement(
                'div',
                { className: 'content-category-label' },
                React__default["default"].createElement(
                  'div',
                  { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
                  issue.source
                )
              ),
              issue.volume && issue.number && React__default["default"].createElement(
                'p',
                null,
                'Volume: ',
                issue.volume,
                React__default["default"].createElement('br', null),
                'Issue: ',
                issue.number
              )
            ),
            React__default["default"].createElement(
              Card__default["default"].Footer,
              null,
              issue && issue.articles && issue.articles.length > 0 ? React__default["default"].createElement(
                'a',
                { href: publication.identifier.current + '/' + issue.identifier.current, className: 'btn btn-primary' },
                'View Issue'
              ) : null,
              issue.pdf && issue.pdf.asset && issue.pdf.asset.url && React__default["default"].createElement(
                'a',
                { rel: 'noopener', href: urlForFile.urlForFile(issue.pdf, baseUrl), target: '_blank', className: 'btn btn-primary' },
                'Download Issue'
              )
            )
          )
        )
      );
    }) : React__default["default"].createElement(
      'em',
      null,
      'New content coming soon, please check back later.'
    ),
    React__default["default"].createElement(
      'style',
      { jsx: 'true' },
      '\n        .issueCard.card:hover {\n          cursor: default;\n        }\n        .content-category-label {\n          margin: 0.5rem 0;\n          display: block;\n        }\n        .sanityDisplayLabel {\n          margin: 0.5rem 0;\n          border: 1px solid black;\n          display: inline;\n          width: 100%;\n          padding: 5px;\n          color: #484848;\n          border-radius: 2px;\n        }\n        .dropdown-toggle {\n          min-width: 5rem;\n        }\n        .dropdown-toggle:empty:after {\n          margin-left: 4rem;\n        }\n        .card-footer {\n          background-color: transparent;\n          border-top: 0;\n        }\n        .card-footer a:not(:first-child) {\n          margin-left: 1rem;\n        }\n      '
    )
  );
};

module.exports = PublicationLanding;
