import './stringify-2b084bee.js';
import { _ as _slicedToArray } from './slicedToArray-6ebcbfea.js';
import React__default, { useState, useEffect } from 'react';
import { m as main_43 } from './main-f97773b2.js';
import DFPAdSlot from './AdSlot.js';
import './_commonjsHelpers-0c4b6f40.js';
import './core.get-iterator-method-ea258bb1.js';
import './web.dom.iterable-ab4dea5c.js';
import './extends-1559c147.js';
import 'prop-types';
import './index-f0fc23eb.js';
import './events-6c3a7a63.js';
import './debounce-533d9748.js';
import './isSymbol-a7e9aafe.js';
import './toNumber-5aeba6e7.js';
import './Beam.js';
import './asyncToGenerator-64822ccc.js';
import './_library-528f1934.js';
import './_set-species-2cd9340f.js';
import './_iter-detect-98db3b07.js';
import './Segment.js';

// removed static slotID ,because defining static slotID is restricting AD to render only once.
var AD300x250x600 = function AD300x250x600(_ref) {
  var networkID = _ref.networkID,
      adUnit = _ref.adUnit,
      _ref$slotId = _ref.slotId,
      slotId = _ref$slotId === undefined ? '' : _ref$slotId,
      _ref$targeting = _ref.targeting,
      targeting = _ref$targeting === undefined ? {} : _ref$targeting,
      _ref$pos = _ref.pos,
      pos = _ref$pos === undefined ? 'rec2' : _ref$pos,
      _ref$sizeMapFlag = _ref.sizeMapFlag,
      sizeMapFlag = _ref$sizeMapFlag === undefined ? true : _ref$sizeMapFlag;

  if (main_43) {
    pos = 'rec2-mobile';
  }

  var _useState = useState(true),
      _useState2 = _slicedToArray(_useState, 2);
      _useState2[0];
      var setPreviewAd = _useState2[1];

  useEffect(function () {
    var path = window && window.location && window.location.search;
    // Setting flag for Ad-preview URLs
    setPreviewAd(path.split('&').some(function (param) {
      return param.includes('creativeId');
    }));
  }, []);

  var adTargeting = {
    content_placement: targeting.content_placement,
    tags: targeting.tags,
    document_group: targeting.document_group,
    document_url: targeting.document_url,
    rootDocumentGroup: targeting.rootDocumentGroup,
    pos: pos,
    campaign_id: targeting.campaign_id,
    issue_url: targeting.issue_url,
    publication_url: targeting.publication_url

    // sizeMapping is made reponsive to handle long ads [300,600] when the sizeMapFlag is 'true'.Otherwise old sizeMapping will be taken.
  };var sizeMapping = sizeMapFlag ? [{
    viewport: [1200, 900],
    sizes: [[300, 100], [300, 250], [300, 600]]
  }, {
    viewport: [1200, 1],
    sizes: [[300, 100], [300, 250]]
  }, {
    viewport: [1, 1],
    sizes: [[300, 100], [300, 250]]
  }] : [{
    viewport: [768, 0],
    sizes: [[300, 100], [300, 250], [300, 600]]
  }, {
    viewport: [1, 1],
    sizes: [[300, 100], [300, 250]]
  }];

  return React__default.createElement(
    'div',
    null,
    React__default.createElement(DFPAdSlot, {
      networkID: networkID,
      adUnit: adUnit,
      className: 'AD300x250',
      slotId: slotId,
      targeting: adTargeting
      //  passing all possible sizes.
      , sizes: [[300, 50], [300, 100], [320, 50], [300, 250], [300, 600]]
      //  setting responsive sizemapping to make the ads responsive.
      , sizeMapping: sizeMapping
      /* Passing function to check for ad creative only if it is not in preview. */
      // checkIsAdFound={previewAd ? null : checkIsAdFound}
      // style={{ display: 'none' }}
    }),
    React__default.createElement(
      'style',
      { jsx: 'true' },
      '\n        .AD300x250 .div[id*=\'google_ads_iframe\']:empty {\n          height: 0px !important;\n        }\n      '
    )
  );
};

export { AD300x250x600 as default };
