prebid-universal-creative 1.17.1 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3172 @@
1
+ /******/ (function() { // webpackBootstrap
2
+ /******/ var __webpack_modules__ = ([
3
+ /* 0 */,
4
+ /* 1 */
5
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
6
+
7
+ "use strict";
8
+
9
+
10
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
+ Object.defineProperty(exports, "__esModule", ({
12
+ value: true
13
+ }));
14
+ exports.createTrackPixelHtml = createTrackPixelHtml;
15
+ exports.getCreativeComment = getCreativeComment;
16
+ exports.getCreativeCommentMarkup = getCreativeCommentMarkup;
17
+ exports.getUUID = getUUID;
18
+ exports.loadScript = loadScript;
19
+ exports.parseUrl = parseUrl;
20
+ exports.sendRequest = sendRequest;
21
+ exports.transformAuctionTargetingData = transformAuctionTargetingData;
22
+ exports.triggerPixel = triggerPixel;
23
+ exports.writeAdUrl = writeAdUrl;
24
+ var domHelper = _interopRequireWildcard(__webpack_require__(2));
25
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) { "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); } return f; })(e, t); }
26
+ /**
27
+ * Inserts an image pixel with the specified `url` for cookie sync
28
+ * @param {string} url URL string of the image pixel to load
29
+ * @param {function} [done] an optional exit callback, used when this usersync pixel is added during an async process
30
+ */
31
+ function triggerPixel(url, done) {
32
+ var img = new Image();
33
+ if (done && typeof done === 'function') {
34
+ img.addEventListener('load', done);
35
+ img.addEventListener('error', done);
36
+ }
37
+ img.src = url;
38
+ }
39
+ function createTrackPixelHtml(url) {
40
+ if (!url) {
41
+ return '';
42
+ }
43
+ var escapedUrl = encodeURI(url);
44
+ var img = "<div style=\"position:absolute;left:0px;top:0px;visibility:hidden;\"><img src=\"".concat(escapedUrl, "\"></div>");
45
+ return img;
46
+ }
47
+ function writeAdUrl(adUrl, width, height) {
48
+ var iframe = domHelper.getEmptyIframe(height, width);
49
+ iframe.src = adUrl;
50
+ document.body.appendChild(iframe);
51
+ }
52
+ function sendRequest(url, callback) {
53
+ function reqListener() {
54
+ callback(oReq.responseText);
55
+ }
56
+ var oReq = new XMLHttpRequest();
57
+ oReq.addEventListener('load', reqListener);
58
+ oReq.open('GET', url);
59
+ oReq.send();
60
+ }
61
+ function getUUID() {
62
+ var d = new Date().getTime();
63
+ var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
64
+ var r = (d + Math.random() * 16) % 16 | 0;
65
+ d = Math.floor(d / 16);
66
+ return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
67
+ });
68
+ return uuid;
69
+ }
70
+ ;
71
+ function loadScript(currentWindow, tagSrc, successCallback, errorCallback) {
72
+ var doc = currentWindow.document;
73
+ var scriptTag = doc.createElement('script');
74
+ scriptTag.type = 'text/javascript';
75
+
76
+ // Execute success callback if necessary
77
+ if (successCallback && typeof successCallback === 'function') {
78
+ if (scriptTag.readyState) {
79
+ scriptTag.onreadystatechange = function () {
80
+ if (scriptTag.readyState === 'loaded' || scriptTag.readyState === 'complete') {
81
+ scriptTag.onreadystatechange = null;
82
+ successCallback();
83
+ }
84
+ };
85
+ } else {
86
+ scriptTag.onload = function () {
87
+ successCallback();
88
+ };
89
+ }
90
+ }
91
+
92
+ // Execute error callback if necessary
93
+ if (errorCallback && typeof errorCallback === 'function') {
94
+ scriptTag.onerror = function () {
95
+ errorCallback();
96
+ };
97
+ }
98
+ scriptTag.src = tagSrc;
99
+
100
+ //add the new script tag to the page
101
+ var elToAppend = doc.getElementsByTagName('head');
102
+ elToAppend = elToAppend.length ? elToAppend : doc.getElementsByTagName('body');
103
+ if (elToAppend.length) {
104
+ elToAppend = elToAppend[0];
105
+ elToAppend.insertBefore(scriptTag, elToAppend.firstChild);
106
+ }
107
+ return scriptTag;
108
+ }
109
+ ;
110
+
111
+ /**
112
+ * Return comment element
113
+ * @param {*} bid
114
+ */
115
+ function getCreativeComment(bid) {
116
+ return document.createComment("Creative ".concat(bid.crid, " served by Prebid.js Header Bidding"));
117
+ }
118
+
119
+ /**
120
+ * Returns comment element markup
121
+ * @param {*} bid
122
+ */
123
+ function getCreativeCommentMarkup(bid) {
124
+ var creativeComment = getCreativeComment(bid);
125
+ var wrapper = document.createElement('div');
126
+ wrapper.appendChild(creativeComment);
127
+ return wrapper.innerHTML;
128
+ }
129
+ function transformAuctionTargetingData(tagData) {
130
+ // this map object translates the Prebid.js auction keys to their equivalent Prebid Universal Creative keys
131
+ // when the publisher uses their adserver's generic macro that provides all targeting keys (ie tagData.targetingMap), we need to convert the keys
132
+ var auctionKeyMap = {
133
+ hb_adid: 'adId',
134
+ hb_cache_host: 'cacheHost',
135
+ hb_cache_path: 'cachePath',
136
+ hb_cache_id: 'uuid',
137
+ hb_format: 'mediaType',
138
+ hb_env: 'env',
139
+ hb_size: 'size',
140
+ hb_pb: 'hbPb'
141
+ };
142
+
143
+ /**
144
+ * Determine if the supplied property of the tagData object exists and is populated with its own values/properties according to its type
145
+ * @param {string} paramName name of the property to check (eg tagData.targetingMap)
146
+ * @returns true/false
147
+ */
148
+ function isMacroPresent(paramName) {
149
+ return !!(tagData[paramName] && (isPlainObject(tagData[paramName]) && Object.keys(tagData[paramName]).length > 0 || isStr(tagData[paramName]) && tagData[paramName] !== ''));
150
+ }
151
+
152
+ /**
153
+ * Converts the specifically formatted object of keypairs to a more generalized structure
154
+ * It specifically extracts the keyvalue from an array and stores it as a normal string
155
+ * @param {object} tarMap object of keys with the keyvalue stored in an array; eg {"hb_adid":["26566ee8c7f251"], ...}
156
+ * @returns {object} result is an object map like the following: {"hb_cache_id":"123456", "other_key":"other_value", ...}
157
+ */
158
+ function convertTargetingMapToNormalMap(tarMap) {
159
+ var newTarMap = {};
160
+ Object.keys(tarMap).forEach(function (key) {
161
+ if (Array.isArray(tarMap[key]) && tarMap[key].length > 0) {
162
+ newTarMap[key] = tarMap[key][0];
163
+ }
164
+ });
165
+ return newTarMap;
166
+ }
167
+
168
+ /**
169
+ * Converts a specifically formatted string of keypairs to a specifically formatted object map
170
+ * @param {String} keywordsStr string of keypairs; eg "hb_cache_id:123456,other_key:other_value"
171
+ * @returns {object} result is an object map like the following: {"hb_cache_id":"123456", "other_key":"other_value", ...}
172
+ */
173
+ function convertKeyPairStringToMap(keywordsStr) {
174
+ var keywordsMap = {};
175
+ var keywordsArr = keywordsStr.split(',');
176
+ if (keywordsArr.length > 0) {
177
+ keywordsArr.forEach(function (keyPairStr) {
178
+ var keyPairArr = keyPairStr.split(':');
179
+ if (keyPairArr.length === 2) {
180
+ var k = keyPairArr[0];
181
+ var v = keyPairArr[1];
182
+ keywordsMap[k] = v;
183
+ }
184
+ });
185
+ }
186
+ return keywordsMap;
187
+ }
188
+
189
+ /**
190
+ * Rename key if it's part of the auctionKeyMap object; if not, leave key as is
191
+ * Store the resultant keypair in the auctionData object for later use in renderingManager.renderAd()
192
+ * @param {object} adServerKeyMap incoming object map of the auction keys from the UC tag; eg {'key1':'value1', 'key2':'value2', ...}
193
+ */
194
+ function renameKnownAuctionKeys(adServerKeyMap) {
195
+ Object.keys(adServerKeyMap).forEach(function (key) {
196
+ var internalKey = auctionKeyMap[key] || key;
197
+ auctionData[internalKey] = adServerKeyMap[key];
198
+ });
199
+ }
200
+ var auctionData = {};
201
+ var formattedKeyMap = {};
202
+ if (isMacroPresent('targetingMap')) {
203
+ formattedKeyMap = convertTargetingMapToNormalMap(tagData.targetingMap);
204
+ } else if (isMacroPresent('targetingKeywords')) {
205
+ formattedKeyMap = convertKeyPairStringToMap(tagData.targetingKeywords);
206
+ }
207
+ renameKnownAuctionKeys(formattedKeyMap);
208
+
209
+ // set keys not in defined map macros (eg targetingMap) and/or the keys setup within a non-DFP adserver
210
+ Object.keys(tagData).forEach(function (key) {
211
+ if (key !== 'targetingMap' && key !== 'targetingKeywords' && isStr(tagData[key]) && tagData[key] !== '') {
212
+ auctionData[key] = tagData[key];
213
+ }
214
+ });
215
+ return auctionData;
216
+ }
217
+ function parseUrl(url) {
218
+ var parsed = document.createElement('a');
219
+ parsed.href = decodeURIComponent(url);
220
+ return {
221
+ href: parsed.href,
222
+ protocol: (parsed.protocol || '').replace(/:$/, ''),
223
+ hostname: parsed.hostname,
224
+ port: +parsed.port,
225
+ pathname: parsed.pathname.replace(/^(?!\/)/, '/'),
226
+ hash: (parsed.hash || '').replace(/^#/, ''),
227
+ host: (parsed.host || window.location.host).replace(/:(443|80)$/, '')
228
+ };
229
+ }
230
+ function isA(object, _t) {
231
+ return Object.prototype.toString.call(object) === '[object ' + _t + ']';
232
+ }
233
+ ;
234
+ function isPlainObject(object) {
235
+ return isA(object, 'Object');
236
+ }
237
+ function isStr(object) {
238
+ return isA(object, 'String');
239
+ }
240
+ ;
241
+
242
+ /***/ }),
243
+ /* 2 */
244
+ /***/ (function(__unused_webpack_module, exports) {
245
+
246
+ "use strict";
247
+
248
+
249
+ Object.defineProperty(exports, "__esModule", ({
250
+ value: true
251
+ }));
252
+ exports.getEmptyIframe = getEmptyIframe;
253
+ exports.insertElement = insertElement;
254
+ exports.makeIframe = makeIframe;
255
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
256
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
257
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
258
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
259
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
260
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
261
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
262
+ /**
263
+ * domHelper: a collection of helpful dom things
264
+ */
265
+
266
+ /**
267
+ * returns a empty iframe element with specified attributes.
268
+ */
269
+ function makeIframe(doc) {
270
+ var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
271
+ var frame = doc.createElement('iframe');
272
+ Object.entries(_extends({
273
+ frameborder: 0,
274
+ scrolling: 'no',
275
+ marginheight: 0,
276
+ marginwidth: 0,
277
+ TOPMARGIN: 0,
278
+ LEFTMARGIN: 0,
279
+ allowtransparency: 'true'
280
+ }, attrs)).forEach(function (_ref) {
281
+ var _ref2 = _slicedToArray(_ref, 2),
282
+ attr = _ref2[0],
283
+ value = _ref2[1];
284
+ frame.setAttribute(attr, value);
285
+ });
286
+ return frame;
287
+ }
288
+
289
+ /**
290
+ * returns a empty iframe element with specified height/width
291
+ * @param {Number} height height iframe set to
292
+ * @param {Number} width width iframe set to
293
+ * @returns {Element} iframe DOM element
294
+ */
295
+ function getEmptyIframe(height, width) {
296
+ return makeIframe(document, {
297
+ height: height,
298
+ width: width
299
+ });
300
+ }
301
+
302
+ /**
303
+ * Insert element to passed target
304
+ * @param {object} elm
305
+ * @param {object} doc
306
+ * @param {string} target
307
+ */
308
+ function insertElement(elm, doc, target) {
309
+ doc = doc || document;
310
+ var elToAppend;
311
+ if (target) {
312
+ elToAppend = doc.getElementsByTagName(target);
313
+ } else {
314
+ elToAppend = doc.getElementsByTagName('head');
315
+ }
316
+ try {
317
+ elToAppend = elToAppend.length ? elToAppend : doc.getElementsByTagName('body');
318
+ if (elToAppend.length) {
319
+ elToAppend = elToAppend[0];
320
+ elToAppend.insertBefore(elm, elToAppend.firstChild);
321
+ }
322
+ } catch (e) {}
323
+ }
324
+
325
+ /***/ }),
326
+ /* 3 */
327
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
328
+
329
+ "use strict";
330
+
331
+
332
+ Object.defineProperty(exports, "__esModule", ({
333
+ value: true
334
+ }));
335
+ exports.renderBannerOrDisplayAd = renderBannerOrDisplayAd;
336
+ exports.renderCrossDomain = renderCrossDomain;
337
+ exports.renderLegacy = renderLegacy;
338
+ var _utils = __webpack_require__(1);
339
+ var _environment = __webpack_require__(4);
340
+ var _domHelper = __webpack_require__(2);
341
+ var _messaging = __webpack_require__(5);
342
+ var _dynamicRenderer = __webpack_require__(6);
343
+ function renderBannerOrDisplayAd(doc, dataObject) {
344
+ var targetingData = (0, _utils.transformAuctionTargetingData)(dataObject);
345
+ if (!(0, _environment.canLocatePrebid)(window)) {
346
+ renderCrossDomain(window, targetingData.adId, targetingData.adServerDomain, targetingData.pubUrl);
347
+ } else {
348
+ renderLegacy(doc, targetingData.adId);
349
+ }
350
+ }
351
+
352
+ /**
353
+ * Calls prebid.js renderAd function to render ad
354
+ * @param {Object} doc Document
355
+ * @param {string} adId Id of creative to render
356
+ */
357
+ function renderLegacy(doc, adId) {
358
+ var found = false;
359
+ var w = window;
360
+ for (var i = 0; i < 10; i++) {
361
+ w = w.parent;
362
+ if (w.pbjs) {
363
+ try {
364
+ w.pbjs.renderAd(doc, adId);
365
+ found = true;
366
+ break;
367
+ } catch (e) {
368
+ continue;
369
+ }
370
+ }
371
+ }
372
+ if (!found) {
373
+ console.error("Unable to locate pbjs.renderAd function!");
374
+ }
375
+ }
376
+
377
+ /**
378
+ * Render ad in safeframe using postmessage
379
+ * @param {string} adId Id of creative to render
380
+ * @param {string} pubAdServerDomain publisher adserver domain name
381
+ * @param {string} pubUrl Url of publisher page
382
+ */
383
+ function renderCrossDomain(win, adId) {
384
+ var pubAdServerDomain = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
385
+ var pubUrl = arguments.length > 3 ? arguments[3] : undefined;
386
+ var windowLocation = win.location;
387
+ var adServerDomain = pubAdServerDomain || win.location.hostname;
388
+ var fullAdServerDomain = windowLocation.protocol + '//' + adServerDomain;
389
+ var sendMessage = (0, _messaging.prebidMessenger)(pubUrl, win);
390
+ var signalRenderResult = function signalRenderResult(errorInfo) {
391
+ return sendMessage((0, _messaging.renderEventMessage)(adId, errorInfo));
392
+ };
393
+ function renderAd(ev) {
394
+ var key = ev.message ? "message" : "data";
395
+ var adObject = {};
396
+ try {
397
+ adObject = JSON.parse(ev[key]);
398
+ } catch (e) {
399
+ return;
400
+ }
401
+ if (adObject.message && adObject.message === "Prebid Response" && adObject.adId === adId) {
402
+ if ((0, _dynamicRenderer.hasDynamicRenderer)(adObject)) {
403
+ (0, _dynamicRenderer.runDynamicRenderer)(adId, adObject, sendMessage, win);
404
+ return;
405
+ }
406
+ try {
407
+ var body = win.document.body;
408
+ var ad = adObject.ad;
409
+ var url = adObject.adUrl;
410
+ var width = adObject.width;
411
+ var height = adObject.height;
412
+ if (adObject.mediaType === "video") {
413
+ signalRenderResult({
414
+ reason: "preventWritingOnMainDocument",
415
+ message: "Cannot render video ad ".concat(adId)
416
+ });
417
+ console.log("Error trying to write ad.");
418
+ } else if (ad) {
419
+ var iframe = (0, _domHelper.getEmptyIframe)(adObject.height, adObject.width);
420
+ body.appendChild(iframe);
421
+ iframe.contentDocument.open();
422
+ iframe.contentDocument.write(ad);
423
+ iframe.contentDocument.close();
424
+ signalRenderResult();
425
+ } else if (url) {
426
+ var _iframe = (0, _domHelper.getEmptyIframe)(height, width);
427
+ _iframe.style.display = "inline";
428
+ _iframe.style.overflow = "hidden";
429
+ _iframe.src = url;
430
+ (0, _domHelper.insertElement)(_iframe, document, "body");
431
+ signalRenderResult();
432
+ } else {
433
+ signalRenderResult({
434
+ reason: "noAd",
435
+ message: "No ad for ".concat(adId)
436
+ });
437
+ console.log("Error trying to write ad. No ad markup or adUrl for ".concat(adId));
438
+ }
439
+ } catch (e) {
440
+ signalRenderResult({
441
+ reason: "exception",
442
+ message: e.message
443
+ });
444
+ console.log("Error in rendering ad", e);
445
+ }
446
+ }
447
+ }
448
+ function requestAdFromPrebid() {
449
+ var message = {
450
+ message: 'Prebid Request',
451
+ adId: adId,
452
+ adServerDomain: fullAdServerDomain
453
+ };
454
+ sendMessage(message, renderAd);
455
+ }
456
+ requestAdFromPrebid();
457
+ }
458
+
459
+ /***/ }),
460
+ /* 4 */
461
+ /***/ (function(__unused_webpack_module, exports) {
462
+
463
+ "use strict";
464
+
465
+
466
+ Object.defineProperty(exports, "__esModule", ({
467
+ value: true
468
+ }));
469
+ exports.canInspectWindow = canInspectWindow;
470
+ exports.canLocatePrebid = canLocatePrebid;
471
+ exports.isAmp = isAmp;
472
+ exports.isCrossDomain = isCrossDomain;
473
+ exports.isMobileApp = isMobileApp;
474
+ exports.isSafeFrame = isSafeFrame;
475
+ /***************************************
476
+ * Detect Environment Helper Functions
477
+ ***************************************/
478
+
479
+ /**
480
+ * Functions to detect below environments:
481
+ * Amp: google Accelerate Mobile Pages ampproject.org
482
+ * SafeFrame: SafeFrame
483
+ * CrossDomain: An iframe that can't get to the top window
484
+ * Mobile App: function to detect mobile app environment
485
+ */
486
+
487
+ /**
488
+ * @param {String} uuid key value from auction, contains the cache id of the winning bid stored in prebid cache
489
+ * @returns true if there is an AMP context object
490
+ */
491
+ function isAmp(uuid, win) {
492
+ // TODO Use amp context once it is available in cross domain
493
+ // https://github.com/ampproject/amphtml/issues/6829
494
+ return typeof uuid === 'string' && uuid !== "" && isCrossDomain(win);
495
+ }
496
+
497
+ /**
498
+ * @returns true if the environment is a SafeFrame.
499
+ */
500
+ function isSafeFrame(win) {
501
+ return !!(win.$sf && win.$sf.ext);
502
+ }
503
+
504
+ /**
505
+ * Return true if we are in an iframe and can't access the top window.
506
+ * @returns true if the environment is a Cross Domain
507
+ */
508
+ function isCrossDomain(win) {
509
+ return win.top !== win && !canInspectWindow(win);
510
+ }
511
+
512
+ /**
513
+ * Returns true if win's properties can be accessed and win is defined.
514
+ * This functioned is used to determine if a window is cross-domained
515
+ * from the perspective of the current window.
516
+ * @param {!Window} win
517
+ * @return {boolean}
518
+ */
519
+ function canInspectWindow(win) {
520
+ try {
521
+ // force an exception in x-domain environments. #1509
522
+ win.top.location.toString();
523
+ return true;
524
+ } catch (e) {
525
+ return false;
526
+ }
527
+ }
528
+
529
+ /**
530
+ * Returns true if we can find the prebid global object (eg pbjs) as we
531
+ * climb the accessible windows. Return false if it's not found.
532
+ * @returns {boolean}
533
+ */
534
+ function canLocatePrebid(win) {
535
+ var result = false;
536
+ var currentWindow = win;
537
+ while (!result) {
538
+ try {
539
+ if (currentWindow.pbjs) {
540
+ result = true;
541
+ break;
542
+ }
543
+ } catch (e) {}
544
+ if (currentWindow === window.top) break;
545
+ currentWindow = currentWindow.parent;
546
+ }
547
+ return result;
548
+ }
549
+
550
+ /**
551
+ * @param {String} env key value from auction, indicates the environment where tag is served
552
+ * @returns true if env exists and is equal to the string 'mobile-app'
553
+ */
554
+ function isMobileApp(env) {
555
+ return env && env === 'mobile-app';
556
+ }
557
+
558
+ /***/ }),
559
+ /* 5 */
560
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
561
+
562
+ "use strict";
563
+
564
+
565
+ Object.defineProperty(exports, "__esModule", ({
566
+ value: true
567
+ }));
568
+ exports.PREBID_EVENT = exports.AD_RENDER_SUCCEEDED = exports.AD_RENDER_FAILED = void 0;
569
+ exports.prebidMessenger = prebidMessenger;
570
+ exports.renderEventMessage = renderEventMessage;
571
+ var _utils = __webpack_require__(1);
572
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
573
+ var PREBID_EVENT = exports.PREBID_EVENT = 'Prebid Event';
574
+ var AD_RENDER_SUCCEEDED = exports.AD_RENDER_SUCCEEDED = 'adRenderSucceeded';
575
+ var AD_RENDER_FAILED = exports.AD_RENDER_FAILED = 'adRenderFailed';
576
+ function prebidMessenger(publisherURL) {
577
+ var win = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
578
+ var prebidDomain = function () {
579
+ if (publisherURL == null) {
580
+ return null;
581
+ }
582
+ var parsedUrl = (0, _utils.parseUrl)(publisherURL);
583
+ return parsedUrl.protocol + '://' + parsedUrl.host;
584
+ }();
585
+ function isPrebidWindow(win) {
586
+ return win && win.frames && win.frames.__pb_locator__;
587
+ }
588
+ var target = win.parent;
589
+ try {
590
+ while (target != null && target !== win.top && !isPrebidWindow(target)) {
591
+ target = target.parent;
592
+ }
593
+ if (!isPrebidWindow(target)) target = win.parent;
594
+ } catch (e) {}
595
+ return function sendMessage(message, onResponse) {
596
+ if (prebidDomain == null) {
597
+ throw new Error('Missing pubUrl');
598
+ }
599
+ message = JSON.stringify(message);
600
+ var messagePort;
601
+ if (onResponse == null) {
602
+ target.postMessage(message, prebidDomain);
603
+ } else {
604
+ var channel = new MessageChannel();
605
+ messagePort = channel.port1;
606
+ messagePort.onmessage = onResponse;
607
+ win.addEventListener('message', windowListener);
608
+ target.postMessage(message, prebidDomain, [channel.port2]);
609
+ }
610
+ return function stopListening() {
611
+ if (messagePort != null) {
612
+ win.removeEventListener('message', windowListener);
613
+ messagePort.onmessage = null;
614
+ messagePort = null;
615
+ }
616
+ };
617
+ function windowListener(ev) {
618
+ if ((ev.origin || ev.originalEvent && ev.originalEvent.origin) === prebidDomain) {
619
+ onResponse(ev);
620
+ }
621
+ }
622
+ };
623
+ }
624
+ function renderEventMessage(adId, errorInfo) {
625
+ return _extends({
626
+ adId: adId,
627
+ message: PREBID_EVENT,
628
+ event: errorInfo ? AD_RENDER_FAILED : AD_RENDER_SUCCEEDED
629
+ }, errorInfo ? {
630
+ info: errorInfo
631
+ } : null);
632
+ }
633
+
634
+ /***/ }),
635
+ /* 6 */
636
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
637
+
638
+ "use strict";
639
+
640
+
641
+ Object.defineProperty(exports, "__esModule", ({
642
+ value: true
643
+ }));
644
+ exports.MIN_RENDERER_VERSION = void 0;
645
+ exports.hasDynamicRenderer = hasDynamicRenderer;
646
+ exports.runDynamicRenderer = runDynamicRenderer;
647
+ var _domHelper = __webpack_require__(2);
648
+ var _messaging = __webpack_require__(5);
649
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
650
+ var MIN_RENDERER_VERSION = exports.MIN_RENDERER_VERSION = 3;
651
+ function hasDynamicRenderer(message) {
652
+ return typeof message.renderer === 'string' && parseInt(message.rendererVersion, 10) >= MIN_RENDERER_VERSION;
653
+ }
654
+ function runDynamicRenderer(adId, data, _sendMessage) {
655
+ var win = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : window;
656
+ var mkFrame = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _domHelper.makeIframe;
657
+ var renderer = mkFrame(win.document, {
658
+ width: 0,
659
+ height: 0,
660
+ style: 'display: none',
661
+ srcdoc: "<script>".concat(data.renderer, "</script>"),
662
+ name: '__pb_renderer__'
663
+ });
664
+ return new Promise(function (resolve, reject) {
665
+ function onError() {
666
+ var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
667
+ _sendMessage((0, _messaging.renderEventMessage)(adId, {
668
+ reason: e.reason || 'exception',
669
+ message: e.message
670
+ }));
671
+ e.stack && console.error(e);
672
+ reject(e);
673
+ }
674
+ function guard(fn) {
675
+ return function () {
676
+ try {
677
+ return fn.apply(this, arguments);
678
+ } catch (e) {
679
+ onError(e);
680
+ }
681
+ };
682
+ }
683
+ renderer.onload = guard(function () {
684
+ var W = renderer.contentWindow;
685
+ // NOTE: on Firefox, `Promise.resolve(P)` or `new Promise((resolve) => resolve(P))`
686
+ // does not appear to work if P comes from another frame
687
+ W.Promise.resolve(W.render(data, {
688
+ mkFrame: mkFrame,
689
+ sendMessage: function sendMessage(type, payload, onResponse) {
690
+ return _sendMessage(_extends({
691
+ adId: adId,
692
+ message: type
693
+ }, payload), onResponse ? guard(onResponse) : undefined);
694
+ }
695
+ }, win)).then(function () {
696
+ return _sendMessage((0, _messaging.renderEventMessage)(adId));
697
+ }, onError).then(resolve);
698
+ });
699
+ win.document.body.appendChild(renderer);
700
+ });
701
+ }
702
+
703
+ /***/ }),
704
+ /* 7 */
705
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
706
+
707
+ "use strict";
708
+
709
+
710
+ Object.defineProperty(exports, "__esModule", ({
711
+ value: true
712
+ }));
713
+ exports.renderAmpOrMobileAd = renderAmpOrMobileAd;
714
+ var _utils = __webpack_require__(1);
715
+ var _environment = __webpack_require__(4);
716
+ var _domHelper = __webpack_require__(2);
717
+ var _postscribeRender = __webpack_require__(8);
718
+ var DEFAULT_CACHE_HOST = 'prebid.adnxs.com';
719
+ var DEFAULT_CACHE_PATH = '/pbc/v1/cache';
720
+
721
+ /**
722
+ * Render mobile or amp ad
723
+ * @param {string} cacheHost Cache host
724
+ * @param {string} cachePath Cache path
725
+ * @param {string} uuid id to render response from cache endpoint
726
+ * @param {string} size size of the creative
727
+ * @param {string} hbPb final price of the winning bid
728
+ * @param {Bool} isMobileApp flag to detect mobile app
729
+ */
730
+ function renderAmpOrMobileAd(dataObject) {
731
+ var targetingData = (0, _utils.transformAuctionTargetingData)(dataObject);
732
+ var cacheHost = targetingData.cacheHost,
733
+ cachePath = targetingData.cachePath,
734
+ uuid = targetingData.uuid,
735
+ size = targetingData.size,
736
+ hbPb = targetingData.hbPb;
737
+ uuid = uuid || '';
738
+ // For MoPub, creative is stored in localStorage via SDK.
739
+ var search = 'Prebid_';
740
+ if (uuid.substr(0, search.length) === search) {
741
+ loadFromLocalCache(uuid);
742
+ //register creative right away to not miss initial geom-update
743
+ updateIframe(size);
744
+ } else {
745
+ var adUrl = "".concat(getCacheEndpoint(cacheHost, cachePath), "?uuid=").concat(uuid);
746
+ //register creative right away to not miss initial geom-update
747
+ updateIframe(size);
748
+ (0, _utils.sendRequest)(adUrl, responseCallback((0, _environment.isMobileApp)(targetingData.env), hbPb));
749
+ }
750
+ }
751
+
752
+ /**
753
+ * Load response from localStorage. In case of MoPub, sdk caches response
754
+ * @param {string} cacheId
755
+ */
756
+ function loadFromLocalCache(cacheId) {
757
+ var bid = window.localStorage.getItem(cacheId);
758
+ var displayFn = responseCallback(true);
759
+ displayFn(bid);
760
+ }
761
+
762
+ /**
763
+ * update iframe by using size string to resize
764
+ * @param {string} size
765
+ */
766
+ function updateIframe(size) {
767
+ if (size) {
768
+ var sizeArr = size.split('x').map(Number);
769
+ resizeIframe(sizeArr[0], sizeArr[1]);
770
+ } else {
771
+ console.log('Targeting key hb_size not found to resize creative');
772
+ }
773
+ }
774
+
775
+ /**
776
+ * Resize container iframe
777
+ * @param {Number} width width of creative
778
+ * @param {Number} height height of creative
779
+ */
780
+ function resizeIframe(width, height) {
781
+ var iframeWidth = window.innerWidth;
782
+ var iframeHeight = window.innerHeight;
783
+ if (iframeWidth !== width || iframeHeight !== height) {
784
+ if ((0, _environment.isSafeFrame)(window)) {
785
+ var resize = function resize() {
786
+ var newWidth = width - iframeWidth;
787
+ var newHeight = height - iframeHeight;
788
+ window.$sf.ext.expand({
789
+ r: newWidth,
790
+ b: newHeight,
791
+ push: true
792
+ });
793
+ };
794
+ window.$sf.ext.register(width, height, resize);
795
+ }
796
+ // AMP resize request in case the parent is AMP
797
+ window.parent.postMessage({
798
+ sentinel: 'amp',
799
+ type: 'embed-size',
800
+ width: width,
801
+ height: height
802
+ }, '*');
803
+ }
804
+ }
805
+
806
+ /**
807
+ * Returns cache endpoint concatenated with cache path
808
+ * @param {string} cacheHost Cache Endpoint host
809
+ * @param {string} cachePath Cache Endpoint path
810
+ */
811
+ function getCacheEndpoint(cacheHost, cachePath) {
812
+ var host = typeof cacheHost === 'undefined' || cacheHost === "" ? DEFAULT_CACHE_HOST : cacheHost;
813
+ var path = typeof cachePath === 'undefined' || cachePath === "" ? DEFAULT_CACHE_PATH : cachePath;
814
+ return "https://".concat(host).concat(path);
815
+ }
816
+
817
+ /**
818
+ * Cache request Callback to display creative
819
+ * @param {Bool} isMobileApp
820
+ * @param {string} hbPb final price of the winning bid
821
+ * @returns {function} a callback function that parses response
822
+ */
823
+ function responseCallback(isMobileApp, hbPb) {
824
+ return function (response) {
825
+ var bidObject = parseResponse(response);
826
+ var auctionPrice = bidObject.price || hbPb;
827
+ var ad = (0, _utils.getCreativeCommentMarkup)(bidObject);
828
+ var width = bidObject.width ? bidObject.width : bidObject.w;
829
+ var height = bidObject.height ? bidObject.height : bidObject.h;
830
+
831
+ // When Prebid Universal Creative reads from Prebid Cache, we need to have it check for the existence of the wurl parameter. If it exists, hit it.
832
+ if (bidObject.wurl) {
833
+ (0, _utils.triggerPixel)(decodeURIComponent(bidObject.wurl));
834
+ }
835
+ if (bidObject.adm) {
836
+ if (auctionPrice) {
837
+ // replace ${AUCTION_PRICE} macro with the bidObject.price or hb_pb.
838
+ bidObject.adm = bidObject.adm.replace('${AUCTION_PRICE}', auctionPrice);
839
+ } else {
840
+ /*
841
+ From OpenRTB spec 2.5: If the source value is an optional parameter that was not specified, the macro will simply be removed (i.e., replaced with a zero-length string).
842
+ */
843
+ bidObject.adm = bidObject.adm.replace('${AUCTION_PRICE}', '');
844
+ }
845
+ ad += isMobileApp ? constructMarkup(bidObject.adm, width, height) : bidObject.adm;
846
+ if (bidObject.nurl) {
847
+ ad += (0, _utils.createTrackPixelHtml)(decodeURIComponent(bidObject.nurl));
848
+ }
849
+ if (bidObject.burl) {
850
+ var triggerBurl = function triggerBurl() {
851
+ (0, _utils.triggerPixel)(bidObject.burl);
852
+ };
853
+ if (isMobileApp) {
854
+ (0, _utils.loadScript)(window, 'mraid.js', function () {
855
+ // Success loading MRAID
856
+ var result = registerMRAIDViewableEvent(triggerBurl);
857
+ if (!result) {
858
+ triggerBurl(); // Error registering event
859
+ }
860
+ }, triggerBurl // Error loading MRAID
861
+ );
862
+ } else {
863
+ triggerBurl(); // Not a mobile app
864
+ }
865
+ }
866
+ (0, _postscribeRender.writeAdHtml)(ad);
867
+ } else if (bidObject.nurl) {
868
+ if (isMobileApp) {
869
+ var adhtml = (0, _utils.loadScript)(window, bidObject.nurl);
870
+ ad += constructMarkup(adhtml.outerHTML, width, height);
871
+ (0, _postscribeRender.writeAdHtml)(ad);
872
+ } else {
873
+ var nurl = bidObject.nurl;
874
+ var commentElm = (0, _utils.getCreativeComment)(bidObject);
875
+ (0, _domHelper.insertElement)(commentElm, document, 'body');
876
+ (0, _utils.writeAdUrl)(nurl, width, height);
877
+ }
878
+ }
879
+ };
880
+ }
881
+ ;
882
+
883
+ /**
884
+ * Parse response
885
+ * @param {string} response
886
+ * @returns {Object} bidObject parsed response
887
+ */
888
+ function parseResponse(response) {
889
+ var bidObject;
890
+ try {
891
+ bidObject = JSON.parse(response);
892
+ } catch (error) {
893
+ console.log("Error parsing response from cache host: ".concat(error));
894
+ }
895
+ return bidObject;
896
+ }
897
+
898
+ /**
899
+ * Wrap mobile app creative in div
900
+ * @param {string} ad html for creative
901
+ * @param {Number} width width of creative
902
+ * @param {Number} height height of creative
903
+ * @returns {string} creative markup
904
+ */
905
+ function constructMarkup(ad, width, height) {
906
+ var id = (0, _utils.getUUID)();
907
+ return "<div id=\"".concat(id, "\" style=\"border-style: none; position: absolute; width:100%; height:100%;\">\n <div id=\"").concat(id, "_inner\" style=\"margin: 0 auto; width:").concat(width, "px; height:").concat(height, "px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);\">").concat(ad, "</div>\n </div>");
908
+ }
909
+ function registerMRAIDViewableEvent(callback) {
910
+ function exposureChangeListener(exposure) {
911
+ if (exposure > 0) {
912
+ mraid.removeEventListener('exposureChange', exposureChangeListener);
913
+ callback();
914
+ }
915
+ }
916
+ function viewableChangeListener(viewable) {
917
+ if (viewable) {
918
+ mraid.removeEventListener('viewableChange', viewableChangeListener);
919
+ callback();
920
+ }
921
+ }
922
+ function registerViewableChecks() {
923
+ if (window.MRAID_ENV && parseFloat(window.MRAID_ENV.version) >= 3) {
924
+ mraid.addEventListener('exposureChange', exposureChangeListener);
925
+ } else if (window.MRAID_ENV && parseFloat(window.MRAID_ENV.version) < 3) {
926
+ if (mraid.isViewable()) {
927
+ callback();
928
+ } else {
929
+ mraid.addEventListener('viewableChange', viewableChangeListener);
930
+ }
931
+ }
932
+ }
933
+ function readyListener() {
934
+ mraid.removeEventListener('ready', readyListener);
935
+ registerViewableChecks();
936
+ }
937
+ if (window.mraid && window.MRAID_ENV) {
938
+ if (mraid.getState() == 'loading') {
939
+ mraid.addEventListener('ready', readyListener);
940
+ } else {
941
+ registerViewableChecks();
942
+ }
943
+ return true;
944
+ } else {
945
+ return false;
946
+ }
947
+ }
948
+
949
+ /***/ }),
950
+ /* 8 */
951
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
952
+
953
+ "use strict";
954
+
955
+
956
+ Object.defineProperty(exports, "__esModule", ({
957
+ value: true
958
+ }));
959
+ exports.writeAdHtml = writeAdHtml;
960
+ var _postscribe = _interopRequireDefault(__webpack_require__(9));
961
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
962
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
963
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
964
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
965
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
966
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
967
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
968
+ function writeAdHtml(markup) {
969
+ var ps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _postscribe["default"];
970
+ // remove <?xml> and <!doctype> tags
971
+ // https://github.com/prebid/prebid-universal-creative/issues/134
972
+ markup = markup.replace(/<\?xml\b[^>]*(?:\?>|>)/gi, '').replace(/<!doctype\b[^>\[]*(?:\[[^\]]*\][^>]*)?>/gi, '');
973
+ var finalMarkup;
974
+ try {
975
+ finalMarkup = normalizeMarkup(markup);
976
+ } catch (error) {
977
+ console.error("Error normalizing markup:", error.message);
978
+ finalMarkup = markup;
979
+ }
980
+ ps(document.body, finalMarkup, {
981
+ error: console.error
982
+ });
983
+ }
984
+
985
+ /**
986
+ * Normalizes an HTML string by parsing and re-serializing it,
987
+ * returning the content between custom PUC_START and PUC_END markers.
988
+ *
989
+ * This function is specifically aimed at addressing an issue with `postscribe` where double quotes inside single-quoted
990
+ * HTML attributes are not correctly escaped.
991
+ */
992
+ function normalizeMarkup(markup) {
993
+ var timestamp = Date.now();
994
+ var startMarkerId = "PUC_START_".concat(timestamp);
995
+ var endMarkerId = "PUC_END_".concat(timestamp);
996
+ var startMarker = "<div id=\"".concat(startMarkerId, "\"></div>");
997
+ var endMarker = "<div id=\"".concat(endMarkerId, "\"></div>");
998
+ var doc = new DOMParser().parseFromString("".concat(startMarker).concat(markup).concat(endMarker), "text/html");
999
+ var textMap = new Map();
1000
+ var textId = 0;
1001
+ var replaceTextNodes = function replaceTextNodes(node) {
1002
+ if (node.nodeType === Node.TEXT_NODE && node.textContent.trim()) {
1003
+ var id = "PUC_NODE_TEXT_".concat(textId++, "_").concat(timestamp);
1004
+ textMap.set(id, node.textContent);
1005
+ var span = doc.createElement("span");
1006
+ span.dataset.textId = id;
1007
+ node.parentNode.replaceChild(span, node);
1008
+ } else {
1009
+ _toConsumableArray(node.childNodes).forEach(replaceTextNodes);
1010
+ }
1011
+ };
1012
+ var current = doc.querySelector("#".concat(startMarkerId)).nextSibling;
1013
+ var end = doc.querySelector("#".concat(endMarkerId));
1014
+ while (current && current !== end) {
1015
+ replaceTextNodes(current);
1016
+ current = current.nextSibling;
1017
+ }
1018
+ var serialized = new XMLSerializer().serializeToString(doc);
1019
+ var snippet = serialized.split(startMarker)[1].split(endMarker)[0].replace(/<span data-text-id="(PUC_NODE_TEXT_\d+_\d+)"[^>]*><\/span>/g, function (_, id) {
1020
+ return textMap.get(id) || "";
1021
+ });
1022
+ return snippet.trim();
1023
+ }
1024
+
1025
+ /***/ }),
1026
+ /* 9 */
1027
+ /***/ (function(module) {
1028
+
1029
+ /**
1030
+ * @file postscribe
1031
+ * @description Asynchronously write javascript, even with document.write.
1032
+ * @version v2.0.8
1033
+ * @see {@link https://krux.github.io/postscribe}
1034
+ * @license MIT
1035
+ * @author Derek Brans
1036
+ * @copyright 2016 Krux Digital, Inc
1037
+ */
1038
+ (function webpackUniversalModuleDefinition(root, factory) {
1039
+ if(true)
1040
+ module.exports = factory();
1041
+ else // removed by dead control flow
1042
+ {}
1043
+ })(this, function() {
1044
+ return /******/ (function(modules) { // webpackBootstrap
1045
+ /******/ // The module cache
1046
+ /******/ var installedModules = {};
1047
+ /******/
1048
+ /******/ // The require function
1049
+ /******/ function __nested_webpack_require_791__(moduleId) {
1050
+ /******/
1051
+ /******/ // Check if module is in cache
1052
+ /******/ if(installedModules[moduleId])
1053
+ /******/ return installedModules[moduleId].exports;
1054
+ /******/
1055
+ /******/ // Create a new module (and put it into the cache)
1056
+ /******/ var module = installedModules[moduleId] = {
1057
+ /******/ exports: {},
1058
+ /******/ id: moduleId,
1059
+ /******/ loaded: false
1060
+ /******/ };
1061
+ /******/
1062
+ /******/ // Execute the module function
1063
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_791__);
1064
+ /******/
1065
+ /******/ // Flag the module as loaded
1066
+ /******/ module.loaded = true;
1067
+ /******/
1068
+ /******/ // Return the exports of the module
1069
+ /******/ return module.exports;
1070
+ /******/ }
1071
+ /******/
1072
+ /******/
1073
+ /******/ // expose the modules object (__webpack_modules__)
1074
+ /******/ __nested_webpack_require_791__.m = modules;
1075
+ /******/
1076
+ /******/ // expose the module cache
1077
+ /******/ __nested_webpack_require_791__.c = installedModules;
1078
+ /******/
1079
+ /******/ // __webpack_public_path__
1080
+ /******/ __nested_webpack_require_791__.p = "";
1081
+ /******/
1082
+ /******/ // Load entry module and return exports
1083
+ /******/ return __nested_webpack_require_791__(0);
1084
+ /******/ })
1085
+ /************************************************************************/
1086
+ /******/ ([
1087
+ /* 0 */
1088
+ /***/ function(module, exports, __nested_webpack_require_2071__) {
1089
+
1090
+ 'use strict';
1091
+
1092
+ var _postscribe = __nested_webpack_require_2071__(1);
1093
+
1094
+ var _postscribe2 = _interopRequireDefault(_postscribe);
1095
+
1096
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1097
+
1098
+ module.exports = _postscribe2['default'];
1099
+
1100
+ /***/ },
1101
+ /* 1 */
1102
+ /***/ function(module, exports, __nested_webpack_require_2410__) {
1103
+
1104
+ 'use strict';
1105
+
1106
+ exports.__esModule = true;
1107
+
1108
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
1109
+
1110
+ exports['default'] = postscribe;
1111
+
1112
+ var _writeStream = __nested_webpack_require_2410__(2);
1113
+
1114
+ var _writeStream2 = _interopRequireDefault(_writeStream);
1115
+
1116
+ var _utils = __nested_webpack_require_2410__(4);
1117
+
1118
+ var utils = _interopRequireWildcard(_utils);
1119
+
1120
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
1121
+
1122
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1123
+
1124
+ /**
1125
+ * A function that intentionally does nothing.
1126
+ */
1127
+ function doNothing() {}
1128
+
1129
+ /**
1130
+ * Available options and defaults.
1131
+ *
1132
+ * @type {Object}
1133
+ */
1134
+ var OPTIONS = {
1135
+ /**
1136
+ * Called when an async script has loaded.
1137
+ */
1138
+ afterAsync: doNothing,
1139
+
1140
+ /**
1141
+ * Called immediately before removing from the write queue.
1142
+ */
1143
+ afterDequeue: doNothing,
1144
+
1145
+ /**
1146
+ * Called sync after a stream's first thread release.
1147
+ */
1148
+ afterStreamStart: doNothing,
1149
+
1150
+ /**
1151
+ * Called after writing buffered document.write calls.
1152
+ */
1153
+ afterWrite: doNothing,
1154
+
1155
+ /**
1156
+ * Allows disabling the autoFix feature of prescribe
1157
+ */
1158
+ autoFix: true,
1159
+
1160
+ /**
1161
+ * Called immediately before adding to the write queue.
1162
+ */
1163
+ beforeEnqueue: doNothing,
1164
+
1165
+ /**
1166
+ * Called before writing a token.
1167
+ *
1168
+ * @param {Object} tok The token
1169
+ */
1170
+ beforeWriteToken: function beforeWriteToken(tok) {
1171
+ return tok;
1172
+ },
1173
+
1174
+ /**
1175
+ * Called before writing buffered document.write calls.
1176
+ *
1177
+ * @param {String} str The string
1178
+ */
1179
+ beforeWrite: function beforeWrite(str) {
1180
+ return str;
1181
+ },
1182
+
1183
+ /**
1184
+ * Called when evaluation is finished.
1185
+ */
1186
+ done: doNothing,
1187
+
1188
+ /**
1189
+ * Called when a write results in an error.
1190
+ *
1191
+ * @param {Error} e The error
1192
+ */
1193
+ error: function error(e) {
1194
+ throw new Error(e.msg);
1195
+ },
1196
+
1197
+
1198
+ /**
1199
+ * Whether to let scripts w/ async attribute set fall out of the queue.
1200
+ */
1201
+ releaseAsync: false
1202
+ };
1203
+
1204
+ var nextId = 0;
1205
+ var queue = [];
1206
+ var active = null;
1207
+
1208
+ function nextStream() {
1209
+ var args = queue.shift();
1210
+ if (args) {
1211
+ var options = utils.last(args);
1212
+
1213
+ options.afterDequeue();
1214
+ args.stream = runStream.apply(undefined, args);
1215
+ options.afterStreamStart();
1216
+ }
1217
+ }
1218
+
1219
+ function runStream(el, html, options) {
1220
+ active = new _writeStream2['default'](el, options);
1221
+
1222
+ // Identify this stream.
1223
+ active.id = nextId++;
1224
+ active.name = options.name || active.id;
1225
+ postscribe.streams[active.name] = active;
1226
+
1227
+ // Override document.write.
1228
+ var doc = el.ownerDocument;
1229
+
1230
+ var stash = {
1231
+ close: doc.close,
1232
+ open: doc.open,
1233
+ write: doc.write,
1234
+ writeln: doc.writeln
1235
+ };
1236
+
1237
+ function _write(str) {
1238
+ str = options.beforeWrite(str);
1239
+ active.write(str);
1240
+ options.afterWrite(str);
1241
+ }
1242
+
1243
+ _extends(doc, {
1244
+ close: doNothing,
1245
+ open: doNothing,
1246
+ write: function write() {
1247
+ for (var _len = arguments.length, str = Array(_len), _key = 0; _key < _len; _key++) {
1248
+ str[_key] = arguments[_key];
1249
+ }
1250
+
1251
+ return _write(str.join(''));
1252
+ },
1253
+ writeln: function writeln() {
1254
+ for (var _len2 = arguments.length, str = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1255
+ str[_key2] = arguments[_key2];
1256
+ }
1257
+
1258
+ return _write(str.join('') + '\n');
1259
+ }
1260
+ });
1261
+
1262
+ // Override window.onerror
1263
+ var oldOnError = active.win.onerror || doNothing;
1264
+
1265
+ // This works together with the try/catch around WriteStream::insertScript
1266
+ // In modern browsers, exceptions in tag scripts go directly to top level
1267
+ active.win.onerror = function (msg, url, line) {
1268
+ options.error({ msg: msg + ' - ' + url + ': ' + line });
1269
+ oldOnError.apply(active.win, [msg, url, line]);
1270
+ };
1271
+
1272
+ // Write to the stream
1273
+ active.write(html, function () {
1274
+ // restore document.write
1275
+ _extends(doc, stash);
1276
+
1277
+ // restore window.onerror
1278
+ active.win.onerror = oldOnError;
1279
+
1280
+ options.done();
1281
+ active = null;
1282
+ nextStream();
1283
+ });
1284
+
1285
+ return active;
1286
+ }
1287
+
1288
+ function postscribe(el, html, options) {
1289
+ if (utils.isFunction(options)) {
1290
+ options = { done: options };
1291
+ } else if (options === 'clear') {
1292
+ queue = [];
1293
+ active = null;
1294
+ nextId = 0;
1295
+ return;
1296
+ }
1297
+
1298
+ options = utils.defaults(options, OPTIONS);
1299
+
1300
+ // id selector
1301
+ if (/^#/.test(el)) {
1302
+ el = window.document.getElementById(el.substr(1));
1303
+ } else {
1304
+ el = el.jquery ? el[0] : el;
1305
+ }
1306
+
1307
+ var args = [el, html, options];
1308
+
1309
+ el.postscribe = {
1310
+ cancel: function cancel() {
1311
+ if (args.stream) {
1312
+ args.stream.abort();
1313
+ } else {
1314
+ args[1] = doNothing;
1315
+ }
1316
+ }
1317
+ };
1318
+
1319
+ options.beforeEnqueue(args);
1320
+ queue.push(args);
1321
+
1322
+ if (!active) {
1323
+ nextStream();
1324
+ }
1325
+
1326
+ return el.postscribe;
1327
+ }
1328
+
1329
+ _extends(postscribe, {
1330
+ // Streams by name.
1331
+ streams: {},
1332
+ // Queue of streams.
1333
+ queue: queue,
1334
+ // Expose internal classes.
1335
+ WriteStream: _writeStream2['default']
1336
+ });
1337
+
1338
+ /***/ },
1339
+ /* 2 */
1340
+ /***/ function(module, exports, __nested_webpack_require_7899__) {
1341
+
1342
+ 'use strict';
1343
+
1344
+ exports.__esModule = true;
1345
+
1346
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
1347
+
1348
+ var _prescribe = __nested_webpack_require_7899__(3);
1349
+
1350
+ var _prescribe2 = _interopRequireDefault(_prescribe);
1351
+
1352
+ var _utils = __nested_webpack_require_7899__(4);
1353
+
1354
+ var utils = _interopRequireWildcard(_utils);
1355
+
1356
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
1357
+
1358
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1359
+
1360
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1361
+
1362
+ /**
1363
+ * Turn on to debug how each chunk affected the DOM.
1364
+ * @type {boolean}
1365
+ */
1366
+ var DEBUG_CHUNK = false;
1367
+
1368
+ /**
1369
+ * Prefix for data attributes on DOM elements.
1370
+ * @type {string}
1371
+ */
1372
+ var BASEATTR = 'data-ps-';
1373
+
1374
+ /**
1375
+ * ID for the style proxy
1376
+ * @type {string}
1377
+ */
1378
+ var PROXY_STYLE = 'ps-style';
1379
+
1380
+ /**
1381
+ * ID for the script proxy
1382
+ * @type {string}
1383
+ */
1384
+ var PROXY_SCRIPT = 'ps-script';
1385
+
1386
+ /**
1387
+ * Get data attributes
1388
+ *
1389
+ * @param {Object} el The DOM element.
1390
+ * @param {String} name The attribute name.
1391
+ * @returns {String}
1392
+ */
1393
+ function getData(el, name) {
1394
+ var attr = BASEATTR + name;
1395
+
1396
+ var val = el.getAttribute(attr);
1397
+
1398
+ // IE 8 returns a number if it's a number
1399
+ return !utils.existy(val) ? val : String(val);
1400
+ }
1401
+
1402
+ /**
1403
+ * Set data attributes
1404
+ *
1405
+ * @param {Object} el The DOM element.
1406
+ * @param {String} name The attribute name.
1407
+ * @param {null|*} value The attribute value.
1408
+ */
1409
+ function setData(el, name) {
1410
+ var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1411
+
1412
+ var attr = BASEATTR + name;
1413
+
1414
+ if (utils.existy(value) && value !== '') {
1415
+ el.setAttribute(attr, value);
1416
+ } else {
1417
+ el.removeAttribute(attr);
1418
+ }
1419
+ }
1420
+
1421
+ /**
1422
+ * Stream static html to an element, where "static html" denotes "html
1423
+ * without scripts".
1424
+ *
1425
+ * This class maintains a *history of writes devoid of any attributes* or
1426
+ * "proxy history".
1427
+ *
1428
+ * Injecting the proxy history into a temporary div has no side-effects,
1429
+ * other than to create proxy elements for previously written elements.
1430
+ *
1431
+ * Given the `staticHtml` of a new write, a `tempDiv`'s innerHTML is set to
1432
+ * `proxy_history + staticHtml`.
1433
+ * The *structure* of `tempDiv`'s contents, (i.e., the placement of new nodes
1434
+ * beside or inside of proxy elements), reflects the DOM structure that would
1435
+ * have resulted if all writes had been squashed into a single write.
1436
+ *
1437
+ * For each descendent `node` of `tempDiv` whose parentNode is a *proxy*,
1438
+ * `node` is appended to the corresponding *real* element within the DOM.
1439
+ *
1440
+ * Proxy elements are mapped to *actual* elements in the DOM by injecting a
1441
+ * `data-id` attribute into each start tag in `staticHtml`.
1442
+ *
1443
+ */
1444
+
1445
+ var WriteStream = function () {
1446
+ /**
1447
+ * Constructor.
1448
+ *
1449
+ * @param {Object} root The root element
1450
+ * @param {?Object} options The options
1451
+ */
1452
+ function WriteStream(root) {
1453
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1454
+
1455
+ _classCallCheck(this, WriteStream);
1456
+
1457
+ this.root = root;
1458
+ this.options = options;
1459
+ this.doc = root.ownerDocument;
1460
+ this.win = this.doc.defaultView || this.doc.parentWindow;
1461
+ this.parser = new _prescribe2['default']('', { autoFix: options.autoFix });
1462
+
1463
+ // Actual elements by id.
1464
+ this.actuals = [root];
1465
+
1466
+ // Embodies the "structure" of what's been written so far,
1467
+ // devoid of attributes.
1468
+ this.proxyHistory = '';
1469
+
1470
+ // Create a proxy of the root element.
1471
+ this.proxyRoot = this.doc.createElement(root.nodeName);
1472
+
1473
+ this.scriptStack = [];
1474
+ this.writeQueue = [];
1475
+
1476
+ setData(this.proxyRoot, 'proxyof', 0);
1477
+ }
1478
+
1479
+ /**
1480
+ * Writes the given strings.
1481
+ *
1482
+ * @param {...String} str The strings to write
1483
+ */
1484
+
1485
+
1486
+ WriteStream.prototype.write = function write() {
1487
+ var _writeQueue;
1488
+
1489
+ (_writeQueue = this.writeQueue).push.apply(_writeQueue, arguments);
1490
+
1491
+ // Process writes
1492
+ // When new script gets pushed or pending this will stop
1493
+ // because new writeQueue gets pushed
1494
+ while (!this.deferredRemote && this.writeQueue.length) {
1495
+ var arg = this.writeQueue.shift();
1496
+
1497
+ if (utils.isFunction(arg)) {
1498
+ this._callFunction(arg);
1499
+ } else {
1500
+ this._writeImpl(arg);
1501
+ }
1502
+ }
1503
+ };
1504
+
1505
+ /**
1506
+ * Calls the given function.
1507
+ *
1508
+ * @param {Function} fn The function to call
1509
+ * @private
1510
+ */
1511
+
1512
+
1513
+ WriteStream.prototype._callFunction = function _callFunction(fn) {
1514
+ var tok = { type: 'function', value: fn.name || fn.toString() };
1515
+ this._onScriptStart(tok);
1516
+ fn.call(this.win, this.doc);
1517
+ this._onScriptDone(tok);
1518
+ };
1519
+
1520
+ /**
1521
+ * The write implementation
1522
+ *
1523
+ * @param {String} html The HTML to write.
1524
+ * @private
1525
+ */
1526
+
1527
+
1528
+ WriteStream.prototype._writeImpl = function _writeImpl(html) {
1529
+ this.parser.append(html);
1530
+
1531
+ var tok = void 0;
1532
+ var script = void 0;
1533
+ var style = void 0;
1534
+ var tokens = [];
1535
+
1536
+ // stop if we see a script token
1537
+ while ((tok = this.parser.readToken()) && !(script = utils.isScript(tok)) && !(style = utils.isStyle(tok))) {
1538
+ tok = this.options.beforeWriteToken(tok);
1539
+
1540
+ if (tok) {
1541
+ tokens.push(tok);
1542
+ }
1543
+ }
1544
+
1545
+ if (tokens.length > 0) {
1546
+ this._writeStaticTokens(tokens);
1547
+ }
1548
+
1549
+ if (script) {
1550
+ this._handleScriptToken(tok);
1551
+ }
1552
+
1553
+ if (style) {
1554
+ this._handleStyleToken(tok);
1555
+ }
1556
+ };
1557
+
1558
+ /**
1559
+ * Write contiguous non-script tokens (a chunk)
1560
+ *
1561
+ * @param {Array<Object>} tokens The tokens
1562
+ * @returns {{tokens, raw, actual, proxy}|null}
1563
+ * @private
1564
+ */
1565
+
1566
+
1567
+ WriteStream.prototype._writeStaticTokens = function _writeStaticTokens(tokens) {
1568
+ var chunk = this._buildChunk(tokens);
1569
+
1570
+ if (!chunk.actual) {
1571
+ // e.g., no tokens, or a noscript that got ignored
1572
+ return null;
1573
+ }
1574
+
1575
+ chunk.html = this.proxyHistory + chunk.actual;
1576
+ this.proxyHistory += chunk.proxy;
1577
+ this.proxyRoot.innerHTML = chunk.html;
1578
+
1579
+ if (DEBUG_CHUNK) {
1580
+ chunk.proxyInnerHTML = this.proxyRoot.innerHTML;
1581
+ }
1582
+
1583
+ this._walkChunk();
1584
+
1585
+ if (DEBUG_CHUNK) {
1586
+ chunk.actualInnerHTML = this.root.innerHTML;
1587
+ }
1588
+
1589
+ return chunk;
1590
+ };
1591
+
1592
+ /**
1593
+ * Build a chunk.
1594
+ *
1595
+ * @param {Array<Object>} tokens The tokens to use.
1596
+ * @returns {{tokens: *, raw: string, actual: string, proxy: string}}
1597
+ * @private
1598
+ */
1599
+
1600
+
1601
+ WriteStream.prototype._buildChunk = function _buildChunk(tokens) {
1602
+ var nextId = this.actuals.length;
1603
+
1604
+ // The raw html of this chunk.
1605
+ var raw = [];
1606
+
1607
+ // The html to create the nodes in the tokens (with id's injected).
1608
+ var actual = [];
1609
+
1610
+ // Html that can later be used to proxy the nodes in the tokens.
1611
+ var proxy = [];
1612
+
1613
+ var len = tokens.length;
1614
+ for (var i = 0; i < len; i++) {
1615
+ var tok = tokens[i];
1616
+ var tokenRaw = tok.toString();
1617
+
1618
+ raw.push(tokenRaw);
1619
+
1620
+ if (tok.attrs) {
1621
+ // tok.attrs <==> startTag or atomicTag or cursor
1622
+ // Ignore noscript tags. They are atomic, so we don't have to worry about children.
1623
+ if (!/^noscript$/i.test(tok.tagName)) {
1624
+ var id = nextId++;
1625
+
1626
+ // Actual: inject id attribute: replace '>' at end of start tag with id attribute + '>'
1627
+ actual.push(tokenRaw.replace(/(\/?>)/, ' ' + BASEATTR + 'id=' + id + ' $1'));
1628
+
1629
+ // Don't proxy scripts: they have no bearing on DOM structure.
1630
+ if (tok.attrs.id !== PROXY_SCRIPT && tok.attrs.id !== PROXY_STYLE) {
1631
+ // Proxy: strip all attributes and inject proxyof attribute
1632
+ proxy.push(
1633
+ // ignore atomic tags (e.g., style): they have no "structural" effect
1634
+ tok.type === 'atomicTag' ? '' : '<' + tok.tagName + ' ' + BASEATTR + 'proxyof=' + id + (tok.unary ? ' />' : '>'));
1635
+ }
1636
+ }
1637
+ } else {
1638
+ // Visit any other type of token
1639
+ // Actual: append.
1640
+ actual.push(tokenRaw);
1641
+
1642
+ // Proxy: append endTags. Ignore everything else.
1643
+ proxy.push(tok.type === 'endTag' ? tokenRaw : '');
1644
+ }
1645
+ }
1646
+
1647
+ return {
1648
+ tokens: tokens,
1649
+ raw: raw.join(''),
1650
+ actual: actual.join(''),
1651
+ proxy: proxy.join('')
1652
+ };
1653
+ };
1654
+
1655
+ /**
1656
+ * Walk the chunks.
1657
+ *
1658
+ * @private
1659
+ */
1660
+
1661
+
1662
+ WriteStream.prototype._walkChunk = function _walkChunk() {
1663
+ var node = void 0;
1664
+ var stack = [this.proxyRoot];
1665
+
1666
+ // use shift/unshift so that children are walked in document order
1667
+ while (utils.existy(node = stack.shift())) {
1668
+ var isElement = node.nodeType === 1;
1669
+ var isProxy = isElement && getData(node, 'proxyof');
1670
+
1671
+ // Ignore proxies
1672
+ if (!isProxy) {
1673
+ if (isElement) {
1674
+ // New actual element: register it and remove the the id attr.
1675
+ this.actuals[getData(node, 'id')] = node;
1676
+ setData(node, 'id');
1677
+ }
1678
+
1679
+ // Is node's parent a proxy?
1680
+ var parentIsProxyOf = node.parentNode && getData(node.parentNode, 'proxyof');
1681
+ if (parentIsProxyOf) {
1682
+ // Move node under actual parent.
1683
+ this.actuals[parentIsProxyOf].appendChild(node);
1684
+ }
1685
+ }
1686
+
1687
+ // prepend childNodes to stack
1688
+ stack.unshift.apply(stack, utils.toArray(node.childNodes));
1689
+ }
1690
+ };
1691
+
1692
+ /**
1693
+ * Handles Script tokens
1694
+ *
1695
+ * @param {Object} tok The token
1696
+ */
1697
+
1698
+
1699
+ WriteStream.prototype._handleScriptToken = function _handleScriptToken(tok) {
1700
+ var _this = this;
1701
+
1702
+ var remainder = this.parser.clear();
1703
+
1704
+ if (remainder) {
1705
+ // Write remainder immediately behind this script.
1706
+ this.writeQueue.unshift(remainder);
1707
+ }
1708
+
1709
+ tok.src = tok.attrs.src || tok.attrs.SRC;
1710
+
1711
+ tok = this.options.beforeWriteToken(tok);
1712
+ if (!tok) {
1713
+ // User has removed this token
1714
+ return;
1715
+ }
1716
+
1717
+ if (tok.src && this.scriptStack.length) {
1718
+ // Defer this script until scriptStack is empty.
1719
+ // Assumption 1: This script will not start executing until
1720
+ // scriptStack is empty.
1721
+ this.deferredRemote = tok;
1722
+ } else {
1723
+ this._onScriptStart(tok);
1724
+ }
1725
+
1726
+ // Put the script node in the DOM.
1727
+ this._writeScriptToken(tok, function () {
1728
+ _this._onScriptDone(tok);
1729
+ });
1730
+ };
1731
+
1732
+ /**
1733
+ * Handles style tokens
1734
+ *
1735
+ * @param {Object} tok The token
1736
+ */
1737
+
1738
+
1739
+ WriteStream.prototype._handleStyleToken = function _handleStyleToken(tok) {
1740
+ var remainder = this.parser.clear();
1741
+
1742
+ if (remainder) {
1743
+ // Write remainder immediately behind this style.
1744
+ this.writeQueue.unshift(remainder);
1745
+ }
1746
+
1747
+ tok.type = tok.attrs.type || tok.attrs.TYPE || 'text/css';
1748
+
1749
+ tok = this.options.beforeWriteToken(tok);
1750
+
1751
+ if (tok) {
1752
+ // Put the style node in the DOM.
1753
+ this._writeStyleToken(tok);
1754
+ }
1755
+
1756
+ if (remainder) {
1757
+ this.write();
1758
+ }
1759
+ };
1760
+
1761
+ /**
1762
+ * Build a style and insert it into the DOM.
1763
+ *
1764
+ * @param {Object} tok The token
1765
+ */
1766
+
1767
+
1768
+ WriteStream.prototype._writeStyleToken = function _writeStyleToken(tok) {
1769
+ var el = this._buildStyle(tok);
1770
+
1771
+ this._insertCursor(el, PROXY_STYLE);
1772
+
1773
+ // Set content
1774
+ if (tok.content) {
1775
+ if (el.styleSheet && !el.sheet) {
1776
+ el.styleSheet.cssText = tok.content;
1777
+ } else {
1778
+ el.appendChild(this.doc.createTextNode(tok.content));
1779
+ }
1780
+ }
1781
+ };
1782
+
1783
+ /**
1784
+ * Build a style element from an atomic style token.
1785
+ *
1786
+ * @param {Object} tok The token
1787
+ * @returns {Element}
1788
+ */
1789
+
1790
+
1791
+ WriteStream.prototype._buildStyle = function _buildStyle(tok) {
1792
+ var el = this.doc.createElement(tok.tagName);
1793
+
1794
+ el.setAttribute('type', tok.type);
1795
+
1796
+ // Set attributes
1797
+ utils.eachKey(tok.attrs, function (name, value) {
1798
+ el.setAttribute(name, value);
1799
+ });
1800
+
1801
+ return el;
1802
+ };
1803
+
1804
+ /**
1805
+ * Append a span to the stream. That span will act as a cursor
1806
+ * (i.e. insertion point) for the element.
1807
+ *
1808
+ * @param {Object} el The element
1809
+ * @param {string} which The type of proxy element
1810
+ */
1811
+
1812
+
1813
+ WriteStream.prototype._insertCursor = function _insertCursor(el, which) {
1814
+ this._writeImpl('<span id="' + which + '"/>');
1815
+
1816
+ var cursor = this.doc.getElementById(which);
1817
+
1818
+ if (cursor) {
1819
+ cursor.parentNode.replaceChild(el, cursor);
1820
+ }
1821
+ };
1822
+
1823
+ /**
1824
+ * Called when a script is started.
1825
+ *
1826
+ * @param {Object} tok The token
1827
+ * @private
1828
+ */
1829
+
1830
+
1831
+ WriteStream.prototype._onScriptStart = function _onScriptStart(tok) {
1832
+ tok.outerWrites = this.writeQueue;
1833
+ this.writeQueue = [];
1834
+ this.scriptStack.unshift(tok);
1835
+ };
1836
+
1837
+ /**
1838
+ * Called when a script is done.
1839
+ *
1840
+ * @param {Object} tok The token
1841
+ * @private
1842
+ */
1843
+
1844
+
1845
+ WriteStream.prototype._onScriptDone = function _onScriptDone(tok) {
1846
+ // Pop script and check nesting.
1847
+ if (tok !== this.scriptStack[0]) {
1848
+ this.options.error({ msg: 'Bad script nesting or script finished twice' });
1849
+ return;
1850
+ }
1851
+
1852
+ this.scriptStack.shift();
1853
+
1854
+ // Append outer writes to queue and process them.
1855
+ this.write.apply(this, tok.outerWrites);
1856
+
1857
+ // Check for pending remote
1858
+
1859
+ // Assumption 2: if remote_script1 writes remote_script2 then
1860
+ // the we notice remote_script1 finishes before remote_script2 starts.
1861
+ // I think this is equivalent to assumption 1
1862
+ if (!this.scriptStack.length && this.deferredRemote) {
1863
+ this._onScriptStart(this.deferredRemote);
1864
+ this.deferredRemote = null;
1865
+ }
1866
+ };
1867
+
1868
+ /**
1869
+ * Build a script and insert it into the DOM.
1870
+ * Done is called once script has executed.
1871
+ *
1872
+ * @param {Object} tok The token
1873
+ * @param {Function} done The callback when complete
1874
+ */
1875
+
1876
+
1877
+ WriteStream.prototype._writeScriptToken = function _writeScriptToken(tok, done) {
1878
+ var el = this._buildScript(tok);
1879
+ var asyncRelease = this._shouldRelease(el);
1880
+ var afterAsync = this.options.afterAsync;
1881
+
1882
+ if (tok.src) {
1883
+ // Fix for attribute "SRC" (capitalized). IE does not recognize it.
1884
+ el.src = tok.src;
1885
+ this._scriptLoadHandler(el, !asyncRelease ? function () {
1886
+ done();
1887
+ afterAsync();
1888
+ } : afterAsync);
1889
+ }
1890
+
1891
+ try {
1892
+ this._insertCursor(el, PROXY_SCRIPT);
1893
+ if (!el.src || asyncRelease) {
1894
+ done();
1895
+ }
1896
+ } catch (e) {
1897
+ this.options.error(e);
1898
+ done();
1899
+ }
1900
+ };
1901
+
1902
+ /**
1903
+ * Build a script element from an atomic script token.
1904
+ *
1905
+ * @param {Object} tok The token
1906
+ * @returns {Element}
1907
+ */
1908
+
1909
+
1910
+ WriteStream.prototype._buildScript = function _buildScript(tok) {
1911
+ var el = this.doc.createElement(tok.tagName);
1912
+
1913
+ // Set attributes
1914
+ utils.eachKey(tok.attrs, function (name, value) {
1915
+ el.setAttribute(name, value);
1916
+ });
1917
+
1918
+ // Set content
1919
+ if (tok.content) {
1920
+ el.text = tok.content;
1921
+ }
1922
+
1923
+ return el;
1924
+ };
1925
+
1926
+ /**
1927
+ * Setup the script load handler on an element.
1928
+ *
1929
+ * @param {Object} el The element
1930
+ * @param {Function} done The callback
1931
+ * @private
1932
+ */
1933
+
1934
+
1935
+ WriteStream.prototype._scriptLoadHandler = function _scriptLoadHandler(el, done) {
1936
+ function cleanup() {
1937
+ el = el.onload = el.onreadystatechange = el.onerror = null;
1938
+ }
1939
+
1940
+ var error = this.options.error;
1941
+
1942
+ function success() {
1943
+ cleanup();
1944
+ if (done != null) {
1945
+ done();
1946
+ }
1947
+ done = null;
1948
+ }
1949
+
1950
+ function failure(err) {
1951
+ cleanup();
1952
+ error(err);
1953
+ if (done != null) {
1954
+ done();
1955
+ }
1956
+ done = null;
1957
+ }
1958
+
1959
+ function reattachEventListener(el, evt) {
1960
+ var handler = el['on' + evt];
1961
+ if (handler != null) {
1962
+ el['_on' + evt] = handler;
1963
+ }
1964
+ }
1965
+
1966
+ reattachEventListener(el, 'load');
1967
+ reattachEventListener(el, 'error');
1968
+
1969
+ _extends(el, {
1970
+ onload: function onload() {
1971
+ if (el._onload) {
1972
+ try {
1973
+ el._onload.apply(this, Array.prototype.slice.call(arguments, 0));
1974
+ } catch (err) {
1975
+ failure({ msg: 'onload handler failed ' + err + ' @ ' + el.src });
1976
+ }
1977
+ }
1978
+ success();
1979
+ },
1980
+ onerror: function onerror() {
1981
+ if (el._onerror) {
1982
+ try {
1983
+ el._onerror.apply(this, Array.prototype.slice.call(arguments, 0));
1984
+ } catch (err) {
1985
+ failure({ msg: 'onerror handler failed ' + err + ' @ ' + el.src });
1986
+ return;
1987
+ }
1988
+ }
1989
+ failure({ msg: 'remote script failed ' + el.src });
1990
+ },
1991
+ onreadystatechange: function onreadystatechange() {
1992
+ if (/^(loaded|complete)$/.test(el.readyState)) {
1993
+ success();
1994
+ }
1995
+ }
1996
+ });
1997
+ };
1998
+
1999
+ /**
2000
+ * Determines whether to release.
2001
+ *
2002
+ * @param {Object} el The element
2003
+ * @returns {boolean}
2004
+ * @private
2005
+ */
2006
+
2007
+
2008
+ WriteStream.prototype._shouldRelease = function _shouldRelease(el) {
2009
+ var isScript = /^script$/i.test(el.nodeName);
2010
+ return !isScript || !!(this.options.releaseAsync && el.src && el.hasAttribute('async'));
2011
+ };
2012
+
2013
+ return WriteStream;
2014
+ }();
2015
+
2016
+ exports['default'] = WriteStream;
2017
+
2018
+ /***/ },
2019
+ /* 3 */
2020
+ /***/ function(module, exports, __webpack_require__) {
2021
+
2022
+ /**
2023
+ * @file prescribe
2024
+ * @description Tiny, forgiving HTML parser
2025
+ * @version vundefined
2026
+ * @see {@link https://github.com/krux/prescribe/}
2027
+ * @license MIT
2028
+ * @author Derek Brans
2029
+ * @copyright 2016 Krux Digital, Inc
2030
+ */
2031
+ (function webpackUniversalModuleDefinition(root, factory) {
2032
+ if(true)
2033
+ module.exports = factory();
2034
+ else // removed by dead control flow
2035
+ {}
2036
+ })(this, function() {
2037
+ return /******/ (function(modules) { // webpackBootstrap
2038
+ /******/ // The module cache
2039
+ /******/ var installedModules = {};
2040
+
2041
+ /******/ // The require function
2042
+ /******/ function __nested_webpack_require_26473__(moduleId) {
2043
+
2044
+ /******/ // Check if module is in cache
2045
+ /******/ if(installedModules[moduleId])
2046
+ /******/ return installedModules[moduleId].exports;
2047
+
2048
+ /******/ // Create a new module (and put it into the cache)
2049
+ /******/ var module = installedModules[moduleId] = {
2050
+ /******/ exports: {},
2051
+ /******/ id: moduleId,
2052
+ /******/ loaded: false
2053
+ /******/ };
2054
+
2055
+ /******/ // Execute the module function
2056
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_26473__);
2057
+
2058
+ /******/ // Flag the module as loaded
2059
+ /******/ module.loaded = true;
2060
+
2061
+ /******/ // Return the exports of the module
2062
+ /******/ return module.exports;
2063
+ /******/ }
2064
+
2065
+
2066
+ /******/ // expose the modules object (__webpack_modules__)
2067
+ /******/ __nested_webpack_require_26473__.m = modules;
2068
+
2069
+ /******/ // expose the module cache
2070
+ /******/ __nested_webpack_require_26473__.c = installedModules;
2071
+
2072
+ /******/ // __webpack_public_path__
2073
+ /******/ __nested_webpack_require_26473__.p = "";
2074
+
2075
+ /******/ // Load entry module and return exports
2076
+ /******/ return __nested_webpack_require_26473__(0);
2077
+ /******/ })
2078
+ /************************************************************************/
2079
+ /******/ ([
2080
+ /* 0 */
2081
+ /***/ function(module, exports, __nested_webpack_require_27712__) {
2082
+
2083
+ 'use strict';
2084
+
2085
+ var _HtmlParser = __nested_webpack_require_27712__(1);
2086
+
2087
+ var _HtmlParser2 = _interopRequireDefault(_HtmlParser);
2088
+
2089
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2090
+
2091
+ module.exports = _HtmlParser2['default'];
2092
+
2093
+ /***/ },
2094
+ /* 1 */
2095
+ /***/ function(module, exports, __nested_webpack_require_28061__) {
2096
+
2097
+ 'use strict';
2098
+
2099
+ exports.__esModule = true;
2100
+
2101
+ var _supports = __nested_webpack_require_28061__(2);
2102
+
2103
+ var supports = _interopRequireWildcard(_supports);
2104
+
2105
+ var _streamReaders = __nested_webpack_require_28061__(3);
2106
+
2107
+ var streamReaders = _interopRequireWildcard(_streamReaders);
2108
+
2109
+ var _fixedReadTokenFactory = __nested_webpack_require_28061__(6);
2110
+
2111
+ var _fixedReadTokenFactory2 = _interopRequireDefault(_fixedReadTokenFactory);
2112
+
2113
+ var _utils = __nested_webpack_require_28061__(5);
2114
+
2115
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2116
+
2117
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
2118
+
2119
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2120
+
2121
+ /**
2122
+ * Detection regular expressions.
2123
+ *
2124
+ * Order of detection matters: detection of one can only
2125
+ * succeed if detection of previous didn't
2126
+
2127
+ * @type {Object}
2128
+ */
2129
+ var detect = {
2130
+ comment: /^<!--/,
2131
+ endTag: /^<\//,
2132
+ atomicTag: /^<\s*(script|style|noscript|iframe|textarea)[\s\/>]/i,
2133
+ startTag: /^</,
2134
+ chars: /^[^<]/
2135
+ };
2136
+
2137
+ /**
2138
+ * HtmlParser provides the capability to parse HTML and return tokens
2139
+ * representing the tags and content.
2140
+ */
2141
+
2142
+ var HtmlParser = function () {
2143
+ /**
2144
+ * Constructor.
2145
+ *
2146
+ * @param {string} stream The initial parse stream contents.
2147
+ * @param {Object} options The options
2148
+ * @param {boolean} options.autoFix Set to true to automatically fix errors
2149
+ */
2150
+ function HtmlParser() {
2151
+ var _this = this;
2152
+
2153
+ var stream = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2154
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2155
+
2156
+ _classCallCheck(this, HtmlParser);
2157
+
2158
+ this.stream = stream;
2159
+
2160
+ var fix = false;
2161
+ var fixedTokenOptions = {};
2162
+
2163
+ for (var key in supports) {
2164
+ if (supports.hasOwnProperty(key)) {
2165
+ if (options.autoFix) {
2166
+ fixedTokenOptions[key + 'Fix'] = true; // !supports[key];
2167
+ }
2168
+ fix = fix || fixedTokenOptions[key + 'Fix'];
2169
+ }
2170
+ }
2171
+
2172
+ if (fix) {
2173
+ this._readToken = (0, _fixedReadTokenFactory2['default'])(this, fixedTokenOptions, function () {
2174
+ return _this._readTokenImpl();
2175
+ });
2176
+ this._peekToken = (0, _fixedReadTokenFactory2['default'])(this, fixedTokenOptions, function () {
2177
+ return _this._peekTokenImpl();
2178
+ });
2179
+ } else {
2180
+ this._readToken = this._readTokenImpl;
2181
+ this._peekToken = this._peekTokenImpl;
2182
+ }
2183
+ }
2184
+
2185
+ /**
2186
+ * Appends the given string to the parse stream.
2187
+ *
2188
+ * @param {string} str The string to append
2189
+ */
2190
+
2191
+
2192
+ HtmlParser.prototype.append = function append(str) {
2193
+ this.stream += str;
2194
+ };
2195
+
2196
+ /**
2197
+ * Prepends the given string to the parse stream.
2198
+ *
2199
+ * @param {string} str The string to prepend
2200
+ */
2201
+
2202
+
2203
+ HtmlParser.prototype.prepend = function prepend(str) {
2204
+ this.stream = str + this.stream;
2205
+ };
2206
+
2207
+ /**
2208
+ * The implementation of the token reading.
2209
+ *
2210
+ * @private
2211
+ * @returns {?Token}
2212
+ */
2213
+
2214
+
2215
+ HtmlParser.prototype._readTokenImpl = function _readTokenImpl() {
2216
+ var token = this._peekTokenImpl();
2217
+ if (token) {
2218
+ this.stream = this.stream.slice(token.length);
2219
+ return token;
2220
+ }
2221
+ };
2222
+
2223
+ /**
2224
+ * The implementation of token peeking.
2225
+ *
2226
+ * @returns {?Token}
2227
+ */
2228
+
2229
+
2230
+ HtmlParser.prototype._peekTokenImpl = function _peekTokenImpl() {
2231
+ for (var type in detect) {
2232
+ if (detect.hasOwnProperty(type)) {
2233
+ if (detect[type].test(this.stream)) {
2234
+ var token = streamReaders[type](this.stream);
2235
+
2236
+ if (token) {
2237
+ if (token.type === 'startTag' && /script|style/i.test(token.tagName)) {
2238
+ return null;
2239
+ } else {
2240
+ token.text = this.stream.substr(0, token.length);
2241
+ return token;
2242
+ }
2243
+ }
2244
+ }
2245
+ }
2246
+ }
2247
+ };
2248
+
2249
+ /**
2250
+ * The public token peeking interface. Delegates to the basic token peeking
2251
+ * or a version that performs fixups depending on the `autoFix` setting in
2252
+ * options.
2253
+ *
2254
+ * @returns {object}
2255
+ */
2256
+
2257
+
2258
+ HtmlParser.prototype.peekToken = function peekToken() {
2259
+ return this._peekToken();
2260
+ };
2261
+
2262
+ /**
2263
+ * The public token reading interface. Delegates to the basic token reading
2264
+ * or a version that performs fixups depending on the `autoFix` setting in
2265
+ * options.
2266
+ *
2267
+ * @returns {object}
2268
+ */
2269
+
2270
+
2271
+ HtmlParser.prototype.readToken = function readToken() {
2272
+ return this._readToken();
2273
+ };
2274
+
2275
+ /**
2276
+ * Read tokens and hand to the given handlers.
2277
+ *
2278
+ * @param {Object} handlers The handlers to use for the different tokens.
2279
+ */
2280
+
2281
+
2282
+ HtmlParser.prototype.readTokens = function readTokens(handlers) {
2283
+ var tok = void 0;
2284
+ while (tok = this.readToken()) {
2285
+ // continue until we get an explicit "false" return
2286
+ if (handlers[tok.type] && handlers[tok.type](tok) === false) {
2287
+ return;
2288
+ }
2289
+ }
2290
+ };
2291
+
2292
+ /**
2293
+ * Clears the parse stream.
2294
+ *
2295
+ * @returns {string} The contents of the parse stream before clearing.
2296
+ */
2297
+
2298
+
2299
+ HtmlParser.prototype.clear = function clear() {
2300
+ var rest = this.stream;
2301
+ this.stream = '';
2302
+ return rest;
2303
+ };
2304
+
2305
+ /**
2306
+ * Returns the rest of the parse stream.
2307
+ *
2308
+ * @returns {string} The contents of the parse stream.
2309
+ */
2310
+
2311
+
2312
+ HtmlParser.prototype.rest = function rest() {
2313
+ return this.stream;
2314
+ };
2315
+
2316
+ return HtmlParser;
2317
+ }();
2318
+
2319
+ exports['default'] = HtmlParser;
2320
+
2321
+
2322
+ HtmlParser.tokenToString = function (tok) {
2323
+ return tok.toString();
2324
+ };
2325
+
2326
+ HtmlParser.escapeAttributes = function (attrs) {
2327
+ var escapedAttrs = {};
2328
+
2329
+ for (var name in attrs) {
2330
+ if (attrs.hasOwnProperty(name)) {
2331
+ escapedAttrs[name] = (0, _utils.escapeQuotes)(attrs[name], null);
2332
+ }
2333
+ }
2334
+
2335
+ return escapedAttrs;
2336
+ };
2337
+
2338
+ HtmlParser.supports = supports;
2339
+
2340
+ for (var key in supports) {
2341
+ if (supports.hasOwnProperty(key)) {
2342
+ HtmlParser.browserHasFlaw = HtmlParser.browserHasFlaw || !supports[key] && key;
2343
+ }
2344
+ }
2345
+
2346
+ /***/ },
2347
+ /* 2 */
2348
+ /***/ function(module, exports) {
2349
+
2350
+ 'use strict';
2351
+
2352
+ exports.__esModule = true;
2353
+ var tagSoup = false;
2354
+ var selfClose = false;
2355
+
2356
+ var work = window.document.createElement('div');
2357
+
2358
+ try {
2359
+ var html = '<P><I></P></I>';
2360
+ work.innerHTML = html;
2361
+ exports.tagSoup = tagSoup = work.innerHTML !== html;
2362
+ } catch (e) {
2363
+ exports.tagSoup = tagSoup = false;
2364
+ }
2365
+
2366
+ try {
2367
+ work.innerHTML = '<P><i><P></P></i></P>';
2368
+ exports.selfClose = selfClose = work.childNodes.length === 2;
2369
+ } catch (e) {
2370
+ exports.selfClose = selfClose = false;
2371
+ }
2372
+
2373
+ work = null;
2374
+
2375
+ exports.tagSoup = tagSoup;
2376
+ exports.selfClose = selfClose;
2377
+
2378
+ /***/ },
2379
+ /* 3 */
2380
+ /***/ function(module, exports, __nested_webpack_require_35326__) {
2381
+
2382
+ 'use strict';
2383
+
2384
+ exports.__esModule = true;
2385
+
2386
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2387
+
2388
+ exports.comment = comment;
2389
+ exports.chars = chars;
2390
+ exports.startTag = startTag;
2391
+ exports.atomicTag = atomicTag;
2392
+ exports.endTag = endTag;
2393
+
2394
+ var _tokens = __nested_webpack_require_35326__(4);
2395
+
2396
+ /**
2397
+ * Regular Expressions for parsing tags and attributes
2398
+ *
2399
+ * @type {Object}
2400
+ */
2401
+ var REGEXES = {
2402
+ startTag: /^<([\-A-Za-z0-9_]+)((?:\s+[\w\-]+(?:\s*=?\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
2403
+ endTag: /^<\/([\-A-Za-z0-9_]+)[^>]*>/,
2404
+ attr: /(?:([\-A-Za-z0-9_]+)\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))|(?:([\-A-Za-z0-9_]+)(\s|$)+)/g,
2405
+ fillAttr: /^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noresize|noshade|nowrap|readonly|selected)$/i
2406
+ };
2407
+
2408
+ /**
2409
+ * Reads a comment token
2410
+ *
2411
+ * @param {string} stream The input stream
2412
+ * @returns {CommentToken}
2413
+ */
2414
+ function comment(stream) {
2415
+ var index = stream.indexOf('-->');
2416
+ if (index >= 0) {
2417
+ return new _tokens.CommentToken(stream.substr(4, index - 1), index + 3);
2418
+ }
2419
+ }
2420
+
2421
+ /**
2422
+ * Reads non-tag characters.
2423
+ *
2424
+ * @param {string} stream The input stream
2425
+ * @returns {CharsToken}
2426
+ */
2427
+ function chars(stream) {
2428
+ var index = stream.indexOf('<');
2429
+ return new _tokens.CharsToken(index >= 0 ? index : stream.length);
2430
+ }
2431
+
2432
+ /**
2433
+ * Reads start tag token.
2434
+ *
2435
+ * @param {string} stream The input stream
2436
+ * @returns {StartTagToken}
2437
+ */
2438
+ function startTag(stream) {
2439
+ var endTagIndex = stream.indexOf('>');
2440
+ if (endTagIndex !== -1) {
2441
+ var match = stream.match(REGEXES.startTag);
2442
+ if (match) {
2443
+ var _ret = function () {
2444
+ var attrs = {};
2445
+ var booleanAttrs = {};
2446
+ var rest = match[2];
2447
+
2448
+ match[2].replace(REGEXES.attr, function (match, name) {
2449
+ if (!(arguments[2] || arguments[3] || arguments[4] || arguments[5])) {
2450
+ attrs[name] = '';
2451
+ } else if (arguments[5]) {
2452
+ attrs[arguments[5]] = '';
2453
+ booleanAttrs[arguments[5]] = true;
2454
+ } else {
2455
+ attrs[name] = arguments[2] || arguments[3] || arguments[4] || REGEXES.fillAttr.test(name) && name || '';
2456
+ }
2457
+
2458
+ rest = rest.replace(match, '');
2459
+ });
2460
+
2461
+ return {
2462
+ v: new _tokens.StartTagToken(match[1], match[0].length, attrs, booleanAttrs, !!match[3], rest.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''))
2463
+ };
2464
+ }();
2465
+
2466
+ if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
2467
+ }
2468
+ }
2469
+ }
2470
+
2471
+ /**
2472
+ * Reads atomic tag token.
2473
+ *
2474
+ * @param {string} stream The input stream
2475
+ * @returns {AtomicTagToken}
2476
+ */
2477
+ function atomicTag(stream) {
2478
+ var start = startTag(stream);
2479
+ if (start) {
2480
+ var rest = stream.slice(start.length);
2481
+ // for optimization, we check first just for the end tag
2482
+ if (rest.match(new RegExp('<\/\\s*' + start.tagName + '\\s*>', 'i'))) {
2483
+ // capturing the content is inefficient, so we do it inside the if
2484
+ var match = rest.match(new RegExp('([\\s\\S]*?)<\/\\s*' + start.tagName + '\\s*>', 'i'));
2485
+ if (match) {
2486
+ return new _tokens.AtomicTagToken(start.tagName, match[0].length + start.length, start.attrs, start.booleanAttrs, match[1]);
2487
+ }
2488
+ }
2489
+ }
2490
+ }
2491
+
2492
+ /**
2493
+ * Reads an end tag token.
2494
+ *
2495
+ * @param {string} stream The input stream
2496
+ * @returns {EndTagToken}
2497
+ */
2498
+ function endTag(stream) {
2499
+ var match = stream.match(REGEXES.endTag);
2500
+ if (match) {
2501
+ return new _tokens.EndTagToken(match[1], match[0].length);
2502
+ }
2503
+ }
2504
+
2505
+ /***/ },
2506
+ /* 4 */
2507
+ /***/ function(module, exports, __nested_webpack_require_39304__) {
2508
+
2509
+ 'use strict';
2510
+
2511
+ exports.__esModule = true;
2512
+ exports.EndTagToken = exports.AtomicTagToken = exports.StartTagToken = exports.TagToken = exports.CharsToken = exports.CommentToken = exports.Token = undefined;
2513
+
2514
+ var _utils = __nested_webpack_require_39304__(5);
2515
+
2516
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2517
+
2518
+ /**
2519
+ * Token is a base class for all token types parsed. Note we don't actually
2520
+ * use intheritance due to IE8's non-existent ES5 support.
2521
+ */
2522
+ var Token =
2523
+ /**
2524
+ * Constructor.
2525
+ *
2526
+ * @param {string} type The type of the Token.
2527
+ * @param {Number} length The length of the Token text.
2528
+ */
2529
+ exports.Token = function Token(type, length) {
2530
+ _classCallCheck(this, Token);
2531
+
2532
+ this.type = type;
2533
+ this.length = length;
2534
+ this.text = '';
2535
+ };
2536
+
2537
+ /**
2538
+ * CommentToken represents comment tags.
2539
+ */
2540
+
2541
+
2542
+ var CommentToken = exports.CommentToken = function () {
2543
+ /**
2544
+ * Constructor.
2545
+ *
2546
+ * @param {string} content The content of the comment
2547
+ * @param {Number} length The length of the Token text.
2548
+ */
2549
+ function CommentToken(content, length) {
2550
+ _classCallCheck(this, CommentToken);
2551
+
2552
+ this.type = 'comment';
2553
+ this.length = length || (content ? content.length : 0);
2554
+ this.text = '';
2555
+ this.content = content;
2556
+ }
2557
+
2558
+ CommentToken.prototype.toString = function toString() {
2559
+ return '<!--' + this.content;
2560
+ };
2561
+
2562
+ return CommentToken;
2563
+ }();
2564
+
2565
+ /**
2566
+ * CharsToken represents non-tag characters.
2567
+ */
2568
+
2569
+
2570
+ var CharsToken = exports.CharsToken = function () {
2571
+ /**
2572
+ * Constructor.
2573
+ *
2574
+ * @param {Number} length The length of the Token text.
2575
+ */
2576
+ function CharsToken(length) {
2577
+ _classCallCheck(this, CharsToken);
2578
+
2579
+ this.type = 'chars';
2580
+ this.length = length;
2581
+ this.text = '';
2582
+ }
2583
+
2584
+ CharsToken.prototype.toString = function toString() {
2585
+ return this.text;
2586
+ };
2587
+
2588
+ return CharsToken;
2589
+ }();
2590
+
2591
+ /**
2592
+ * TagToken is a base class for all tag-based Tokens.
2593
+ */
2594
+
2595
+
2596
+ var TagToken = exports.TagToken = function () {
2597
+ /**
2598
+ * Constructor.
2599
+ *
2600
+ * @param {string} type The type of the token.
2601
+ * @param {string} tagName The tag name.
2602
+ * @param {Number} length The length of the Token text.
2603
+ * @param {Object} attrs The dictionary of attributes and values
2604
+ * @param {Object} booleanAttrs If an entry has 'true' then the attribute
2605
+ * is a boolean attribute
2606
+ */
2607
+ function TagToken(type, tagName, length, attrs, booleanAttrs) {
2608
+ _classCallCheck(this, TagToken);
2609
+
2610
+ this.type = type;
2611
+ this.length = length;
2612
+ this.text = '';
2613
+ this.tagName = tagName;
2614
+ this.attrs = attrs;
2615
+ this.booleanAttrs = booleanAttrs;
2616
+ this.unary = false;
2617
+ this.html5Unary = false;
2618
+ }
2619
+
2620
+ /**
2621
+ * Formats the given token tag.
2622
+ *
2623
+ * @param {TagToken} tok The TagToken to format.
2624
+ * @param {?string} [content=null] The content of the token.
2625
+ * @returns {string} The formatted tag.
2626
+ */
2627
+
2628
+
2629
+ TagToken.formatTag = function formatTag(tok) {
2630
+ var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2631
+
2632
+ var str = '<' + tok.tagName;
2633
+ for (var key in tok.attrs) {
2634
+ if (tok.attrs.hasOwnProperty(key)) {
2635
+ str += ' ' + key;
2636
+
2637
+ var val = tok.attrs[key];
2638
+ if (typeof tok.booleanAttrs === 'undefined' || typeof tok.booleanAttrs[key] === 'undefined') {
2639
+ str += '="' + (0, _utils.escapeQuotes)(val) + '"';
2640
+ }
2641
+ }
2642
+ }
2643
+
2644
+ if (tok.rest) {
2645
+ str += ' ' + tok.rest;
2646
+ }
2647
+
2648
+ if (tok.unary && !tok.html5Unary) {
2649
+ str += '/>';
2650
+ } else {
2651
+ str += '>';
2652
+ }
2653
+
2654
+ if (content !== undefined && content !== null) {
2655
+ str += content + '</' + tok.tagName + '>';
2656
+ }
2657
+
2658
+ return str;
2659
+ };
2660
+
2661
+ return TagToken;
2662
+ }();
2663
+
2664
+ /**
2665
+ * StartTagToken represents a start token.
2666
+ */
2667
+
2668
+
2669
+ var StartTagToken = exports.StartTagToken = function () {
2670
+ /**
2671
+ * Constructor.
2672
+ *
2673
+ * @param {string} tagName The tag name.
2674
+ * @param {Number} length The length of the Token text
2675
+ * @param {Object} attrs The dictionary of attributes and values
2676
+ * @param {Object} booleanAttrs If an entry has 'true' then the attribute
2677
+ * is a boolean attribute
2678
+ * @param {boolean} unary True if the tag is a unary tag
2679
+ * @param {string} rest The rest of the content.
2680
+ */
2681
+ function StartTagToken(tagName, length, attrs, booleanAttrs, unary, rest) {
2682
+ _classCallCheck(this, StartTagToken);
2683
+
2684
+ this.type = 'startTag';
2685
+ this.length = length;
2686
+ this.text = '';
2687
+ this.tagName = tagName;
2688
+ this.attrs = attrs;
2689
+ this.booleanAttrs = booleanAttrs;
2690
+ this.html5Unary = false;
2691
+ this.unary = unary;
2692
+ this.rest = rest;
2693
+ }
2694
+
2695
+ StartTagToken.prototype.toString = function toString() {
2696
+ return TagToken.formatTag(this);
2697
+ };
2698
+
2699
+ return StartTagToken;
2700
+ }();
2701
+
2702
+ /**
2703
+ * AtomicTagToken represents an atomic tag.
2704
+ */
2705
+
2706
+
2707
+ var AtomicTagToken = exports.AtomicTagToken = function () {
2708
+ /**
2709
+ * Constructor.
2710
+ *
2711
+ * @param {string} tagName The name of the tag.
2712
+ * @param {Number} length The length of the tag text.
2713
+ * @param {Object} attrs The attributes.
2714
+ * @param {Object} booleanAttrs If an entry has 'true' then the attribute
2715
+ * is a boolean attribute
2716
+ * @param {string} content The content of the tag.
2717
+ */
2718
+ function AtomicTagToken(tagName, length, attrs, booleanAttrs, content) {
2719
+ _classCallCheck(this, AtomicTagToken);
2720
+
2721
+ this.type = 'atomicTag';
2722
+ this.length = length;
2723
+ this.text = '';
2724
+ this.tagName = tagName;
2725
+ this.attrs = attrs;
2726
+ this.booleanAttrs = booleanAttrs;
2727
+ this.unary = false;
2728
+ this.html5Unary = false;
2729
+ this.content = content;
2730
+ }
2731
+
2732
+ AtomicTagToken.prototype.toString = function toString() {
2733
+ return TagToken.formatTag(this, this.content);
2734
+ };
2735
+
2736
+ return AtomicTagToken;
2737
+ }();
2738
+
2739
+ /**
2740
+ * EndTagToken represents an end tag.
2741
+ */
2742
+
2743
+
2744
+ var EndTagToken = exports.EndTagToken = function () {
2745
+ /**
2746
+ * Constructor.
2747
+ *
2748
+ * @param {string} tagName The name of the tag.
2749
+ * @param {Number} length The length of the tag text.
2750
+ */
2751
+ function EndTagToken(tagName, length) {
2752
+ _classCallCheck(this, EndTagToken);
2753
+
2754
+ this.type = 'endTag';
2755
+ this.length = length;
2756
+ this.text = '';
2757
+ this.tagName = tagName;
2758
+ }
2759
+
2760
+ EndTagToken.prototype.toString = function toString() {
2761
+ return '</' + this.tagName + '>';
2762
+ };
2763
+
2764
+ return EndTagToken;
2765
+ }();
2766
+
2767
+ /***/ },
2768
+ /* 5 */
2769
+ /***/ function(module, exports) {
2770
+
2771
+ 'use strict';
2772
+
2773
+ exports.__esModule = true;
2774
+ exports.escapeQuotes = escapeQuotes;
2775
+
2776
+ /**
2777
+ * Escape quotes in the given value.
2778
+ *
2779
+ * @param {string} value The value to escape.
2780
+ * @param {string} [defaultValue=''] The default value to return if value is falsy.
2781
+ * @returns {string}
2782
+ */
2783
+ function escapeQuotes(value) {
2784
+ var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
2785
+
2786
+ // There's no lookback in JS, so /(^|[^\\])"/ only matches the first of two `"`s.
2787
+ // Instead, just match anything before a double-quote and escape if it's not already escaped.
2788
+ return !value ? defaultValue : value.replace(/([^"]*)"/g, function (_, prefix) {
2789
+ return (/\\/.test(prefix) ? prefix + '"' : prefix + '\\"'
2790
+ );
2791
+ });
2792
+ }
2793
+
2794
+ /***/ },
2795
+ /* 6 */
2796
+ /***/ function(module, exports) {
2797
+
2798
+ 'use strict';
2799
+
2800
+ exports.__esModule = true;
2801
+ exports['default'] = fixedReadTokenFactory;
2802
+ /**
2803
+ * Empty Elements - HTML 4.01
2804
+ *
2805
+ * @type {RegExp}
2806
+ */
2807
+ var EMPTY = /^(AREA|BASE|BASEFONT|BR|COL|FRAME|HR|IMG|INPUT|ISINDEX|LINK|META|PARAM|EMBED)$/i;
2808
+
2809
+ /**
2810
+ * Elements that you can intentionally leave open (and which close themselves)
2811
+ *
2812
+ * @type {RegExp}
2813
+ */
2814
+ var CLOSESELF = /^(COLGROUP|DD|DT|LI|OPTIONS|P|TD|TFOOT|TH|THEAD|TR)$/i;
2815
+
2816
+ /**
2817
+ * Corrects a token.
2818
+ *
2819
+ * @param {Token} tok The token to correct
2820
+ * @returns {Token} The corrected token
2821
+ */
2822
+ function correct(tok) {
2823
+ if (tok && tok.type === 'startTag') {
2824
+ tok.unary = EMPTY.test(tok.tagName) || tok.unary;
2825
+ tok.html5Unary = !/\/>$/.test(tok.text);
2826
+ }
2827
+ return tok;
2828
+ }
2829
+
2830
+ /**
2831
+ * Peeks at the next token in the parser.
2832
+ *
2833
+ * @param {HtmlParser} parser The parser
2834
+ * @param {Function} readTokenImpl The underlying readToken implementation
2835
+ * @returns {Token} The next token
2836
+ */
2837
+ function peekToken(parser, readTokenImpl) {
2838
+ var tmp = parser.stream;
2839
+ var tok = correct(readTokenImpl());
2840
+ parser.stream = tmp;
2841
+ return tok;
2842
+ }
2843
+
2844
+ /**
2845
+ * Closes the last token.
2846
+ *
2847
+ * @param {HtmlParser} parser The parser
2848
+ * @param {Array<Token>} stack The stack
2849
+ */
2850
+ function closeLast(parser, stack) {
2851
+ var tok = stack.pop();
2852
+
2853
+ // prepend close tag to stream.
2854
+ parser.prepend('</' + tok.tagName + '>');
2855
+ }
2856
+
2857
+ /**
2858
+ * Create a new token stack.
2859
+ *
2860
+ * @returns {Array<Token>}
2861
+ */
2862
+ function newStack() {
2863
+ var stack = [];
2864
+
2865
+ stack.last = function () {
2866
+ return this[this.length - 1];
2867
+ };
2868
+
2869
+ stack.lastTagNameEq = function (tagName) {
2870
+ var last = this.last();
2871
+ return last && last.tagName && last.tagName.toUpperCase() === tagName.toUpperCase();
2872
+ };
2873
+
2874
+ stack.containsTagName = function (tagName) {
2875
+ for (var i = 0, tok; tok = this[i]; i++) {
2876
+ if (tok.tagName === tagName) {
2877
+ return true;
2878
+ }
2879
+ }
2880
+ return false;
2881
+ };
2882
+
2883
+ return stack;
2884
+ }
2885
+
2886
+ /**
2887
+ * Return a readToken implementation that fixes input.
2888
+ *
2889
+ * @param {HtmlParser} parser The parser
2890
+ * @param {Object} options Options for fixing
2891
+ * @param {boolean} options.tagSoupFix True to fix tag soup scenarios
2892
+ * @param {boolean} options.selfCloseFix True to fix self-closing tags
2893
+ * @param {Function} readTokenImpl The underlying readToken implementation
2894
+ * @returns {Function}
2895
+ */
2896
+ function fixedReadTokenFactory(parser, options, readTokenImpl) {
2897
+ var stack = newStack();
2898
+
2899
+ var handlers = {
2900
+ startTag: function startTag(tok) {
2901
+ var tagName = tok.tagName;
2902
+
2903
+ if (tagName.toUpperCase() === 'TR' && stack.lastTagNameEq('TABLE')) {
2904
+ parser.prepend('<TBODY>');
2905
+ prepareNextToken();
2906
+ } else if (options.selfCloseFix && CLOSESELF.test(tagName) && stack.containsTagName(tagName)) {
2907
+ if (stack.lastTagNameEq(tagName)) {
2908
+ closeLast(parser, stack);
2909
+ } else {
2910
+ parser.prepend('</' + tok.tagName + '>');
2911
+ prepareNextToken();
2912
+ }
2913
+ } else if (!tok.unary) {
2914
+ stack.push(tok);
2915
+ }
2916
+ },
2917
+ endTag: function endTag(tok) {
2918
+ var last = stack.last();
2919
+ if (last) {
2920
+ if (options.tagSoupFix && !stack.lastTagNameEq(tok.tagName)) {
2921
+ // cleanup tag soup
2922
+ closeLast(parser, stack);
2923
+ } else {
2924
+ stack.pop();
2925
+ }
2926
+ } else if (options.tagSoupFix) {
2927
+ // cleanup tag soup part 2: skip this token
2928
+ readTokenImpl();
2929
+ prepareNextToken();
2930
+ }
2931
+ }
2932
+ };
2933
+
2934
+ function prepareNextToken() {
2935
+ var tok = peekToken(parser, readTokenImpl);
2936
+ if (tok && handlers[tok.type]) {
2937
+ handlers[tok.type](tok);
2938
+ }
2939
+ }
2940
+
2941
+ return function fixedReadToken() {
2942
+ prepareNextToken();
2943
+ return correct(readTokenImpl());
2944
+ };
2945
+ }
2946
+
2947
+ /***/ }
2948
+ /******/ ])
2949
+ });
2950
+ ;
2951
+
2952
+ /***/ },
2953
+ /* 4 */
2954
+ /***/ function(module, exports) {
2955
+
2956
+ 'use strict';
2957
+
2958
+ exports.__esModule = true;
2959
+
2960
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2961
+
2962
+ exports.existy = existy;
2963
+ exports.isFunction = isFunction;
2964
+ exports.each = each;
2965
+ exports.eachKey = eachKey;
2966
+ exports.defaults = defaults;
2967
+ exports.toArray = toArray;
2968
+ exports.last = last;
2969
+ exports.isTag = isTag;
2970
+ exports.isScript = isScript;
2971
+ exports.isStyle = isStyle;
2972
+ /**
2973
+ * Determine if the thing is not undefined and not null.
2974
+ *
2975
+ * @param {*} thing The thing to test
2976
+ * @returns {boolean} True if the thing is not undefined and not null.
2977
+ */
2978
+ function existy(thing) {
2979
+ return thing !== void 0 && thing !== null;
2980
+ }
2981
+
2982
+ /**
2983
+ * Is this a function?
2984
+ *
2985
+ * @param {*} x The variable to test
2986
+ * @returns {boolean} True if the variable is a function
2987
+ */
2988
+ function isFunction(x) {
2989
+ return 'function' === typeof x;
2990
+ }
2991
+
2992
+ /**
2993
+ * Loop over each item in an array-like value.
2994
+ *
2995
+ * @param {Array<*>} arr The array to loop over
2996
+ * @param {Function} fn The function to call
2997
+ * @param {?Object} target The object to bind to the function
2998
+ */
2999
+ function each(arr, fn, target) {
3000
+ var i = void 0;
3001
+ var len = arr && arr.length || 0;
3002
+ for (i = 0; i < len; i++) {
3003
+ fn.call(target, arr[i], i);
3004
+ }
3005
+ }
3006
+
3007
+ /**
3008
+ * Loop over each key/value pair in a hash.
3009
+ *
3010
+ * @param {Object} obj The object
3011
+ * @param {Function} fn The function to call
3012
+ * @param {?Object} target The object to bind to the function
3013
+ */
3014
+ function eachKey(obj, fn, target) {
3015
+ for (var key in obj) {
3016
+ if (obj.hasOwnProperty(key)) {
3017
+ fn.call(target, key, obj[key]);
3018
+ }
3019
+ }
3020
+ }
3021
+
3022
+ /**
3023
+ * Set default options where some option was not specified.
3024
+ *
3025
+ * @param {Object} options The destination
3026
+ * @param {Object} _defaults The defaults
3027
+ * @returns {Object}
3028
+ */
3029
+ function defaults(options, _defaults) {
3030
+ options = options || {};
3031
+ eachKey(_defaults, function (key, val) {
3032
+ if (!existy(options[key])) {
3033
+ options[key] = val;
3034
+ }
3035
+ });
3036
+ return options;
3037
+ }
3038
+
3039
+ /**
3040
+ * Convert value (e.g., a NodeList) to an array.
3041
+ *
3042
+ * @param {*} obj The object
3043
+ * @returns {Array<*>}
3044
+ */
3045
+ function toArray(obj) {
3046
+ try {
3047
+ return Array.prototype.slice.call(obj);
3048
+ } catch (e) {
3049
+ var _ret = function () {
3050
+ var ret = [];
3051
+ each(obj, function (val) {
3052
+ ret.push(val);
3053
+ });
3054
+ return {
3055
+ v: ret
3056
+ };
3057
+ }();
3058
+
3059
+ if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
3060
+ }
3061
+ }
3062
+
3063
+ /**
3064
+ * Get the last item in an array
3065
+ *
3066
+ * @param {Array<*>} array The array
3067
+ * @returns {*} The last item in the array
3068
+ */
3069
+ function last(array) {
3070
+ return array[array.length - 1];
3071
+ }
3072
+
3073
+ /**
3074
+ * Test if token is a script tag.
3075
+ *
3076
+ * @param {Object} tok The token
3077
+ * @param {String} tag The tag name
3078
+ * @returns {boolean} True if the token is a script tag
3079
+ */
3080
+ function isTag(tok, tag) {
3081
+ return !tok || !(tok.type === 'startTag' || tok.type === 'atomicTag') || !('tagName' in tok) ? !1 : !!~tok.tagName.toLowerCase().indexOf(tag);
3082
+ }
3083
+
3084
+ /**
3085
+ * Test if token is a script tag.
3086
+ *
3087
+ * @param {Object} tok The token
3088
+ * @returns {boolean} True if the token is a script tag
3089
+ */
3090
+ function isScript(tok) {
3091
+ return isTag(tok, 'script');
3092
+ }
3093
+
3094
+ /**
3095
+ * Test if token is a style tag.
3096
+ *
3097
+ * @param {Object} tok The token
3098
+ * @returns {boolean} True if the token is a style tag
3099
+ */
3100
+ function isStyle(tok) {
3101
+ return isTag(tok, 'style');
3102
+ }
3103
+
3104
+ /***/ }
3105
+ /******/ ])
3106
+ });
3107
+ ;
3108
+ //# sourceMappingURL=postscribe.js.map
3109
+
3110
+ /***/ })
3111
+ /******/ ]);
3112
+ /************************************************************************/
3113
+ /******/ // The module cache
3114
+ /******/ var __webpack_module_cache__ = {};
3115
+ /******/
3116
+ /******/ // The require function
3117
+ /******/ function __webpack_require__(moduleId) {
3118
+ /******/ // Check if module is in cache
3119
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
3120
+ /******/ if (cachedModule !== undefined) {
3121
+ /******/ return cachedModule.exports;
3122
+ /******/ }
3123
+ /******/ // Create a new module (and put it into the cache)
3124
+ /******/ var module = __webpack_module_cache__[moduleId] = {
3125
+ /******/ // no module.id needed
3126
+ /******/ // no module.loaded needed
3127
+ /******/ exports: {}
3128
+ /******/ };
3129
+ /******/
3130
+ /******/ // Execute the module function
3131
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
3132
+ /******/
3133
+ /******/ // Return the exports of the module
3134
+ /******/ return module.exports;
3135
+ /******/ }
3136
+ /******/
3137
+ /************************************************************************/
3138
+ var __webpack_exports__ = {};
3139
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
3140
+ !function() {
3141
+ "use strict";
3142
+
3143
+
3144
+ var _utils = __webpack_require__(1);
3145
+ var _renderingManager = __webpack_require__(3);
3146
+ var _mobileAndAmpRender = __webpack_require__(7);
3147
+ var _environment = __webpack_require__(4);
3148
+ /**
3149
+ * legacy.js
3150
+ * This is deprecated code, publishers should not use one .js creative to handle all different types of creative.
3151
+ * To reduce bytes transfered for each ad, publishers should use specific .js based on hb_format targeting key-value.
3152
+ *
3153
+ * This file is inserted into the prebid creative as a placeholder for the winning prebid creative. It should support the following formats:
3154
+ * - Banner
3155
+ * - AMP
3156
+ * - Mobile
3157
+ * - Outstream Video
3158
+ * - All safeFrame creatives
3159
+ */
3160
+
3161
+ window.ucTag = window.ucTag || {};
3162
+ window.ucTag.renderAd = function (doc, dataObject) {
3163
+ var targetingData = (0, _utils.transformAuctionTargetingData)(dataObject);
3164
+ if ((0, _environment.isMobileApp)(targetingData.env) || (0, _environment.isAmp)(targetingData.uuid, window)) {
3165
+ (0, _mobileAndAmpRender.renderAmpOrMobileAd)(dataObject);
3166
+ } else {
3167
+ (0, _renderingManager.renderBannerOrDisplayAd)(doc, dataObject);
3168
+ }
3169
+ };
3170
+ }();
3171
+ /******/ })()
3172
+ ;