PageSourceSearch

https://www.dcunited.com/assets/js/vendors-_yarn_cache_brightcove-…?_t=66d5a7e5e4f9faba0ba5

js dcunited.com collected 2026-09-24 19:11:51 UTC 37,489 bytes, 1,239 lines download raw bytes

1(self["webpackChunk_mlssoccer_netcore"] = self["webpackChunk_mlssoccer_netcore"] || []).push([["vendors-_yarn_cache_brightcove-player-loader-npm-1_8_0-fa9f4ca49e-095bc1a3b4_zip_node_modules-c02406"],{
2
vendor: 35,460 bytes, lines 3-1187
3/***/ "./.yarn/cache/@brightcove-player-loader-npm-1.8.0-fa9f4ca49e-095bc1a3b4.zip/node_modules/@brightcove/player-loader/dist/brightcove-player-loader.es.js":
4/*!**************************************************************************************************************************************************************!*\
5  !*** ./.yarn/cache/@brightcove-player-loader-npm-1.8.0-fa9f4ca49e-095bc1a3b4.zip/node_modules/@brightcove/player-loader/dist/brightcove-player-loader.es.js ***!
6  \**************************************************************************************************************************************************************/
7/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
9"use strict";
10__webpack_require__.r(__webpack_exports__);
11/* harmony export */ __webpack_require__.d(__webpack_exports__, {
12/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
13/* harmony export */ });
14/* harmony import */ var global_document__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/document */ "./.yarn/cache/global-npm-4.4.0-888ee8033d-9c057557c8.zip/node_modules/global/document.js");
15/* harmony import */ var global_document__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_document__WEBPACK_IMPORTED_MODULE_0__);
16/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! global/window */ "./.yarn/cache/global-npm-4.4.0-888ee8033d-9c057557c8.zip/node_modules/global/window.js");
17/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_1__);
18/*! @name @brightcove/player-loader @version 1.8.0 @license Apache-2.0 */
19
20
21
22function _extends() {
23  _extends = Object.assign || function (target) {
24    for (var i = 1; i < arguments.length; i++) {
25      var source = arguments[i];
26
27      for (var key in source) {
28        if (Object.prototype.hasOwnProperty.call(source, key)) {
29          target[key] = source[key];
30        }
31      }
32    }
33
34    return target;
35  };
36
37  return _extends.apply(this, arguments);
38}
39
40var version = "1.8.0";
41
42/*! @name @brightcove/player-url @version 1.2.0 @license Apache-2.0 */
43var version$1 = "1.2.0";
44
45var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
46  return typeof obj;
47} : function (obj) {
48  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
49};
50
51// The parameters that may include JSON.
52var JSON_ALLOWED_PARAMS = ['catalogSearch', 'catalogSequence'];
53
54// The parameters that may be set as query string parameters for iframes.
55var IFRAME_ALLOWED_QUERY_PARAMS = ['adConfigId', 'applicationId', 'catalogSearch', 'catalogSequence', 'playlistId', 'playlistVideoId', 'videoId'];
56
57/**
58 * Gets the value of a parameter and encodes it as a string.
59 *
60 * For certain keys, JSON is allowed and will be encoded.
61 *
62 * @private
63 * @param   {Object} params
64 *          A parameters object. See README for details.
65 *
66 * @param   {string} key
67 *          The key in the params object.
68 *
69 * @return  {string|undefined}
70 *          The encoded value - or `undefined` if none.
71 */
72var getQueryParamValue = function getQueryParamValue(params, key) {
73
74  if (!params || params[key] === undefined) {
75    return;
76  }
77
78  // If it's not a string, such as with a catalog search or sequence, we
79  // try to encode it as JSON.
80  if (typeof params[key] !== 'string' && JSON_ALLOWED_PARAMS.indexOf(key) !== -1) {
81    try {
82      return encodeURIComponent(JSON.stringify(params[key]));
83    } catch (x) {
84
85      // If it's not a string and we can't encode as JSON, it's ignored entirely.
86      return;
87    }
88  }
89
90  return encodeURIComponent(String(params[key]).trim()) || undefined;
91};
92
93/**
94 * In some cases, we need to add query string parameters to an iframe URL.
95 *
96 * @private
97 * @param   {Object} params
98 *          An object of query parameters.
99 *
100 * @return  {string}
101 *          A query string starting with `?`. If no valid parameters are given,
102 *          returns an empty string.
103 */
104var getQueryString = function getQueryString(params) {
105  return Object.keys(params).filter(function (k) {
106    return IFRAME_ALLOWED_QUERY_PARAMS.indexOf(k) !== -1;
107  }).reduce(function (qs, k) {
108    var value = getQueryParamValue(params, k);
109
110    if (value !== undefined) {
111      qs += qs ? '&' : '?';
112      qs += encodeURIComponent(k) + '=' + value;
113    }
114
115    return qs;
116  }, '');
117};
118
119/**
120 * Generate a URL to a Brightcove Player.
121 *
122 * @param  {Object}  params
123 *         A set of parameters describing the player URL to create.
124 *
125 * @param  {string}  params.accountId
126 *         A Brightcove account ID.
127 *
128 * @param  {string}  [params.playerId="default"]
129 *         A Brightcove player ID.
130 *
131 * @param  {string}  [params.embedId="default"]
132 *         A Brightcove player embed ID.
133 *
134 * @param  {boolean} [params.iframe=false]
135 *         Whether to return a URL for an HTML document to be embedded in
136 *         an iframe.
137 *
138 * @param  {boolean} [params.minified=true]
139 *         When the `iframe` argument is `false`, this can be used to control
140 *         whether the minified or unminified JavaScript URL is returned.
141 *
142 * @param  {string} [params.base="https://players.brightcove.net"]
143 *         A base CDN protocol and hostname. Mainly used for testing.
144 *
145 * @return {string}
146 *         A URL to a Brightcove Player.
147 */
148var brightcovePlayerUrl = function brightcovePlayerUrl(_ref) {
149  var accountId = _ref.accountId,
150      _ref$base = _ref.base,
151      base = _ref$base === undefined ? 'https://players.brightcove.net' : _ref$base,
152      _ref$playerId = _ref.playerId,
153      playerId = _ref$playerId === undefined ? 'default' : _ref$playerId,
154      _ref$embedId = _ref.embedId,
155      embedId = _ref$embedId === undefined ? 'default' : _ref$embedId,
156      _ref$iframe = _ref.iframe,
157      iframe = _ref$iframe === undefined ? false : _ref$iframe,
158      _ref$minified = _ref.minified,
159      minified = _ref$minified === undefined ? true : _ref$minified,
160      _ref$queryParams = _ref.queryParams,
161      queryParams = _ref$queryParams === undefined ? null : _ref$queryParams;
162
163  var ext = '';
164
165  if (iframe) {
166    ext += 'html';
167  } else {
168    if (minified) {
169      ext += 'min.';
170    }
171    ext += 'js';
172  }
173
174  if (base.charAt(base.length - 1) === '/') {
175    base = base.substring(0, base.length - 1);
176  }
177
178  var qs = '';
179
180  if (iframe && queryParams && (typeof queryParams === 'undefined' ? 'undefined' : _typeof(queryParams)) === 'object') {
181    qs = getQueryString(queryParams);
182  }
183
184  accountId = encodeURIComponent(accountId);
185  playerId = encodeURIComponent(playerId);
186  embedId = encodeURIComponent(embedId);
187
188  return base + '/' + accountId + '/' + playerId + '_' + embedId + '/index.' + ext + qs;
189};
190
191/**
192 * The version of this module.
193 *
194 * @type {string}
195 */
196brightcovePlayerUrl.VERSION = version$1;
197
198var DEFAULTS = {
199  embedId: 'default',
200  embedType: 'in-page',
201  playerId: 'default',
202  Promise: (global_window__WEBPACK_IMPORTED_MODULE_1___default().Promise),
203  refNodeInsert: 'append'
204};
205var DEFAULT_ASPECT_RATIO = '16:9';
206var DEFAULT_IFRAME_HORIZONTAL_PLAYLIST = false;
207var DEFAULT_MAX_WIDTH = '100%';
208var EMBED_TAG_NAME_VIDEO = 'video';
209var EMBED_TAG_NAME_VIDEOJS = 'video-js';
210var EMBED_TYPE_IN_PAGE = 'in-page';
211var EMBED_TYPE_IFRAME = 'iframe';
212var REF_NODE_INSERT_APPEND = 'append';
213var REF_NODE_INSERT_PREPEND = 'prepend';
214var REF_NODE_INSERT_BEFORE = 'before';
215var REF_NODE_INSERT_AFTER = 'after';
216var REF_NODE_INSERT_REPLACE = 'replace';
217var JSON_ALLOWED_ATTRS = ['catalogSearch', 'catalogSequence'];
218
219var BASE_URL = 'https://players.brightcove.net/';
220/**
221 * Gets the URL to a player on CDN.
222 *
223 * @private
224 * @param  {Object} params
225 *         A parameters object. See README for details.
226 *
227 * @return {string}
228 *         A URL.
229 */
230
231var getUrl = function getUrl(params) {
232  if (params.playerUrl) {
233    return params.playerUrl;
234  }
235
236  var accountId = params.accountId,
237      playerId = params.playerId,
238      embedId = params.embedId,
239      embedOptions = params.embedOptions;
240  var iframe = params.embedType === EMBED_TYPE_IFRAME;
241  return brightcovePlayerUrl({
242    accountId: accountId,
243    playerId: playerId,
244    embedId: embedId,
245    iframe: iframe,
246    base: BASE_URL,
247    // The unminified embed option is the exact reverse of the minified option
248    // here.
249    minified: embedOptions ? !embedOptions.unminified : true,
250    // Pass the entire params object as query params. This is safe because
251    // @brightcove/player-url only accepts a whitelist of parameters. Anything
252    // else will be ignored.
253    queryParams: params
254  });
255};
256/**
257 * Function used to get the base URL - primarily for testing.
258 *
259 * @private
260 * @return {string}
261 *         The current base URL.
262 */
263
264
265var getBaseUrl = function getBaseUrl() {
266  return BASE_URL;
267};
268/**
269 * Function used to set the base URL - primarily for testing.
270 *
271 * @private
272 * @param {string} baseUrl
273 *        A new base URL (instead of Brightcove CDN).
274 */
275
276
277var setBaseUrl = function setBaseUrl(baseUrl) {
278  BASE_URL = baseUrl;
279};
280
281var urls = {
282  getUrl: getUrl,
283  getBaseUrl: getBaseUrl,
284  setBaseUrl: setBaseUrl
285};
286
287/**
288 * Is this value an element?
289 *
290 * @param  {Element} el
291 *         A maybe element.
292 *
293 * @return {boolean}
294 *         Whether or not the value is a element.
295 */
296
297var isEl = function isEl(el) {
298  return Boolean(el && el.nodeType === 1);
299};
300/**
301 * Is this value an element with a parent node?
302 *
303 * @param  {Element} el
304 *         A maybe element.
305 *
306 * @return {boolean}
307 *         Whether or not the value is a element with a parent node.
308 */
309
310
311var isElInDom = function isElInDom(el) {
312  return Boolean(isEl(el) && el.parentNode);
313};
314/**
315 * Creates an iframe embed code.
316 *
317 * @private
318 * @param  {Object} params
319 *         A parameters object. See README for details.
320 *
321 * @return {Element}
322 *         The DOM element that will ultimately be passed to the `bc()` function.
323 */
324
325
326var createIframeEmbed = function createIframeEmbed(params) {
327  var el = global_document__WEBPACK_IMPORTED_MODULE_0___default().createElement('iframe');
328  el.setAttribute('allow', 'autoplay;encrypted-media;fullscreen');
329  el.setAttribute('allowfullscreen', 'allowfullscreen');
330  el.src = urls.getUrl(params);
331  return el;
332};
333/**
334 * Creates an in-page embed code.
335 *
336 * @private
337 * @param  {Object} params
338 *         A parameters object. See README for details.
339 *
340 * @return {Element}
341 *         The DOM element that will ultimately be passed to the `bc()` function.
342 */
343
344
345var createInPageEmbed = function createInPageEmbed(params) {
346  var embedOptions = params.embedOptions; // We DO NOT include the data-account, data-player, or data-embed attributes
347  // here because we will be manually initializing the player.
348
349  var paramsToAttrs = {
350    adConfigId: 'data-ad-config-id',
351    applicationId: 'data-application-id',
352    catalogSearch: 'data-catalog-search',
353    catalogSequence: 'data-catalog-sequence',
354    deliveryConfigId: 'data-delivery-config-id',
355    playlistId: 'data-playlist-id',
356    playlistVideoId: 'data-playlist-video-id',
357    poster: 'poster',
358    videoId: 'data-video-id'
359  };
360  var tagName = embedOptions && embedOptions.tagName || EMBED_TAG_NAME_VIDEOJS;
361  var el = global_document__WEBPACK_IMPORTED_MODULE_0___default().createElement(tagName);
362  Object.keys(paramsToAttrs).filter(function (key) {
363    return params[key];
364  }).forEach(function (key) {
365    var value; // If it's not a string, such as with a catalog search or sequence, we
366    // try to encode it as JSON.
367
368    if (typeof params[key] !== 'string' && JSON_ALLOWED_ATTRS.indexOf(key) !== -1) {
369      try {
370        value = JSON.stringify(params[key]); // If it fails, don't set anything.
371      } catch (x) {
372        return;
373      }
374    } else {
375      value = String(params[key]).trim();
376    }
377
378    el.setAttribute(paramsToAttrs[key], value);
379  });
380  el.setAttribute('controls', 'controls');
381  el.classList.add('video-js');
382  return el;
383};
384/**
385 * Wraps an element in responsive intrinsic ratio elements.
386 *
387 * @private
388 * @param  {string} embedType
389 *         The type of the embed.
390 *
391 * @param  {Object} embedOptions
392 *         Embed options from the params.
393 *
394 * @param  {Element} el
395 *         The DOM element.
396 *
397 * @return {Element}
398 *         A new element (if needed).
399 */
400
401
402var wrapResponsive = function wrapResponsive(embedType, embedOptions, el) {
403  if (!embedOptions.responsive) {
404    return el;
405  }
406
407  el.style.position = 'absolute';
408  el.style.top = '0px';
409  el.style.right = '0px';
410  el.style.bottom = '0px';
411  el.style.left = '0px';
412  el.style.width = '100%';
413  el.style.height = '100%';
414
415  var responsive = _extends({
416    aspectRatio: DEFAULT_ASPECT_RATIO,
417    iframeHorizontalPlaylist: DEFAULT_IFRAME_HORIZONTAL_PLAYLIST,
418    maxWidth: DEFAULT_MAX_WIDTH
419  }, embedOptions.responsive); // This value is validate at a higher level, so we can trust that it's in the
420  // correct format.
421
422
423  var aspectRatio = responsive.aspectRatio.split(':').map(Number);
424  var inner = global_document__WEBPACK_IMPORTED_MODULE_0___default().createElement('div');
425  var paddingTop = aspectRatio[1] / aspectRatio[0] * 100; // For iframes with a horizontal playlist, the playlist takes up 20% of the
426  // vertical space (if shown); so, adjust the vertical size of the embed to
427  // avoid black bars.
428
429  if (embedType === EMBED_TYPE_IFRAME && responsive.iframeHorizontalPlaylist) {
430    paddingTop *= 1.25;
431  }
432
433  inner.style.paddingTop = paddingTop + '%';
434  inner.appendChild(el);
435  var outer = global_document__WEBPACK_IMPORTED_MODULE_0___default().createElement('div');
436  outer.style.position = 'relative';
437  outer.style.display = 'block';
438  outer.style.maxWidth = responsive.maxWidth;
439  outer.appendChild(inner);
440  return outer;
441};
442/**
443 * Wraps an element in a Picture-in-Picture plugin container.
444 *
445 * @private
446 * @param  {Object} embedOptions
447 *         Embed options from the params.
448 *
449 * @param  {Element} el
450 *         The DOM element.
451 *
452 * @return {Element}
453 *         A new element (if needed).
454 */
455
456
457var wrapPip = function wrapPip(embedOptions, el) {
458  if (!embedOptions.pip) {
459    return el;
460  }
461
462  var pip = global_document__WEBPACK_IMPORTED_MODULE_0___default().createElement('div');
463  pip.classList.add('vjs-pip-container');
464  pip.appendChild(el);
465  return pip;
466};
467/**
468 * Wraps a bare embed element with necessary parent elements, depending on
469 * embed options given in params.
470 *
471 * @private
472 * @param  {string} embedType
473 *         The type of the embed.
474 *
475 * @param  {Object} embedOptions
476 *         Embed options from the params.
477 *
478 * @param  {Element} embed
479 *         The embed DOM element.
480 *
481 * @return {Element}
482 *         A new element (if needed) or the embed itself.
483 */
484
485
486var wrapEmbed = function wrapEmbed(embedType, embedOptions, embed) {
487  if (!embedOptions) {
488    return embed;
489  }
490
491  return wrapPip(embedOptions, wrapResponsive(embedType, embedOptions, embed));
492};
493/**
494 * Inserts a previously-created embed element into the page based on params.
495 *
496 * @private
497 * @param  {Object} params
498 *         A parameters object. See README for details.
499 *
500 * @param  {Element} embed
501 *         The embed DOM element.
502 *
503 * @return {Element}
504 *         The embed DOM element.
505 */
506
507
508var insertEmbed = function insertEmbed(params, embed) {
509  var refNode = params.refNode,
510      refNodeInsert = params.refNodeInsert;
511  var refNodeParent = refNode.parentNode; // Wrap the embed, if needed, in container elements to support various
512  // plugins.
513
514  var wrapped = wrapEmbed(params.embedType, params.embedOptions, embed); // Decide where to insert the wrapped embed.
515
516  if (refNodeInsert === REF_NODE_INSERT_BEFORE) {
517    refNodeParent.insertBefore(wrapped, refNode);
518  } else if (refNodeInsert === REF_NODE_INSERT_AFTER) {
519    refNodeParent.insertBefore(wrapped, refNode.nextElementSibling || null);
520  } else if (refNodeInsert === REF_NODE_INSERT_REPLACE) {
521    refNodeParent.replaceChild(wrapped, refNode);
522  } else if (refNodeInsert === REF_NODE_INSERT_PREPEND) {
523    refNode.insertBefore(wrapped, refNode.firstChild || null); // Append is the default.
524  } else {
525    refNode.appendChild(wrapped);
526  } // If the playlist embed option is provided, we need to add a playlist element
527  // immediately after the embed. This has to happen after the embed is inserted
528  // into the DOM (above).
529
530
531  if (params.embedOptions && params.embedOptions.playlist) {
532    var playlistTagName = params.embedOptions.playlist.legacy ? 'ul' : 'div';
533    var playlist = global_document__WEBPACK_IMPORTED_MODULE_0___default().createElement(playlistTagName);
534    playlist.classList.add('vjs-playlist');
535    embed.parentNode.insertBefore(playlist, embed.nextElementSibling || null);
536  } // Clean up internal reference to the refNode to avoid potential memory
537  // leaks in case the params get persisted somewhere. We won't need it beyond
538  // this point.
539
540
541  params.refNode = null; // Return the original embed element that can be passed to `bc()`.
542
543  return embed;
544};
545/**
546 * Handles `onEmbedCreated` callback invocation.
547 *
548 * @private
549 * @param  {Object} params
550 *         A parameters object. See README for details.
551 *
552 * @param  {Element} embed
553 *         The embed DOM element.
554 *
555 * @return {Element}
556 *         A possibly-new DOM element.
557 */
558
559
560var onEmbedCreated = function onEmbedCreated(params, embed) {
561  if (typeof params.onEmbedCreated !== 'function') {
562    return embed;
563  }
564
565  var result = params.onEmbedCreated(embed);
566
567  if (isEl(result)) {
568    return result;
569  }
570
571  return embed;
572};
573/**
574 * Creates an embed code of the appropriate type, runs any customizations
575 * necessary, and inserts it into the DOM.
576 *
577 * @param  {Object} params
578 *         A parameters object. See README for details.
579 *
580 * @return {Element}
581 *         The DOM element that will ultimately be passed to the `bc()`
582 *         function. Even when customized or wrapped, the return value will be
583 *         the target element.
584 */
585
586
587var createEmbed = function createEmbed(params) {
588  var embed = params.embedType === EMBED_TYPE_IFRAME ? createIframeEmbed(params) : createInPageEmbed(params);
589  return insertEmbed(params, onEmbedCreated(params, embed));
590};
591
592//
593// The keys follow the format "accountId_playerId_embedId" where accountId is
594// optional and defaults to "*". This happens when we detect pre-existing
595// player globals.
596
597var actualCache = new (global_window__WEBPACK_IMPORTED_MODULE_1___default().Map)();
598/**
599 * Get the cache key given some properties.
600 *
601 * @private
602 * @param  {Object} props
603 *         Properties describing the player record to cache.
604 *
605 * @param  {string} props.playerId
606 *         A player ID.
607 *
608 * @param  {string} props.embedId
609 *         An embed ID.
610 *
611 * @param  {string} [props.accountId="*"]
612 *         An optional account ID. This is optional because when we search for
613 *         pre-existing players to avoid downloads, we will not necessarily
614 *         know the account ID.
615 *
616 * @return {string}
617 *         A key to be used in the script cache.
618 */
619
620var key = function key(_ref) {
621  var accountId = _ref.accountId,
622      playerId = _ref.playerId,
623      embedId = _ref.embedId;
624  return (accountId || '*') + "_" + playerId + "_" + embedId;
625};
626/**
627 * Add an entry to the script cache.
628 *
629 * @private
630 * @param  {Object} props
631 *         Properties describing the player record to cache.
632 *
633 * @param  {string} props.playerId
634 *         A player ID.
635 *
636 * @param  {string} props.embedId
637 *         An embed ID.
638 *
639 * @param  {string} [props.accountId="*"]
640 *         An optional account ID. This is optional because when we search for
641 *         pre-existing players to avoid downloads, we will not necessarily
642 *         know the account ID. If not given, we assume that no script was
643 *         downloaded for this player.
644 */
645
646
647var store = function store(props) {
648  actualCache.set(key(props), props.accountId ? urls.getUrl(props) : '');
649};
650/**
651 * Checks if the script cache has an entry.
652 *
653 * @private
654 * @param  {Object} props
655 *         Properties describing the player record to cache.
656 *
657 * @param  {string} props.playerId
658 *         A player ID.
659 *
660 * @param  {string} props.embedId
661 *         An embed ID.
662 *
663 * @param  {string} [props.accountId="*"]
664 *         An optional account ID. This is optional because when we search for
665 *         pre-existing players to avoid downloads, we will not necessarily
666 *         know the account ID.
667 *
668 * @return {boolean}
669 *         Will be `true` if there is a matching cache entry.
670 */
671
672
673var has = function has(props) {
674  return actualCache.has(key(props));
675};
676/**
677 * Gets a cache entry.
678 *
679 * @private
680 * @param  {Object} props
681 *         Properties describing the player record to cache.
682 *
683 * @param  {string} props.playerId
684 *         A player ID.
685 *
686 * @param  {string} props.embedId
687 *         An embed ID.
688 *
689 * @param  {string} [props.accountId="*"]
690 *         An optional account ID. This is optional because when we search for
691 *         pre-existing players to avoid downloads, we will not necessarily
692 *         know the account ID.
693 *
694 * @return {string}
695 *         A cache entry - a URL or empty string.
696 *
697 */
698
699
700var get = function get(props) {
701  return actualCache.get(key(props));
702};
703/**
704 * Clears the cache.
705 */
706
707
708var clear = function clear() {
709  actualCache.clear();
710};
711/**
712 * Iterates over the cache.
713 *
714 * @param  {Function} fn
715 *         A callback function that will be called with a value and a key
716 *         for each item in the cache.
717 */
718
719
720var forEach = function forEach(fn) {
721  actualCache.forEach(fn);
722};
723
724var playerScriptCache = {
725  clear: clear,
726  forEach: forEach,
727  get: get,
728  has: has,
729  key: key,
730  store: store
731};
732
733var REGEX_PLAYER_EMBED = /^([A-Za-z0-9]+)_([A-Za-z0-9]+)$/;
734/**
735 * Gets an array of current per-player/per-embed `bc` globals that are
736 * attached to the `bc` global (e.g. `bc.abc123xyz_default`).
737 *
738 * If `bc` is not defined, returns an empty array.
739 *
740 * @private
741 * @return {string[]}
742 *         An array of keys.
743 */
744
745var getBcGlobalKeys = function getBcGlobalKeys() {
746  return (global_window__WEBPACK_IMPORTED_MODULE_1___default().bc) ? Object.keys((global_window__WEBPACK_IMPORTED_MODULE_1___default().bc)).filter(function (k) {
747    return REGEX_PLAYER_EMBED.test(k);
748  }) : [];
749};
750/**
751 * Gets known global object keys that Brightcove Players may create.
752 *
753 * @private
754 * @return {string[]}
755 *         An array of global variables that were added during testing.
756 */
757
758
759var getGlobalKeys = function getGlobalKeys() {
760  return Object.keys((global_window__WEBPACK_IMPORTED_MODULE_1___default())).filter(function (k) {
761    return /^videojs/i.test(k) || /^(bc)$/.test(k);
762  });
763};
764/**
765 * Dispose all players from a copy of Video.js.
766 *
767 * @param  {Function} videojs
768 *         A copy of Video.js.
769 */
770
771
772var disposeAll = function disposeAll(videojs) {
773  if (!videojs) {
774    return;
775  }
776
777  Object.keys(videojs.players).forEach(function (k) {
778    var p = videojs.players[k];
779
780    if (p) {
781      p.dispose();
782    }
783  });
784};
785/**
786 * Resets environment state.
787 *
788 * This will dispose ALL Video.js players on the page and remove ALL `bc` and
789 * `videojs` globals it finds.
790 */
791
792
793var reset = function reset() {
794  // Remove all script elements from the DOM.
795  playerScriptCache.forEach(function (value, key) {
796    // If no script URL is associated, skip it.
797    if (!value) {
798      return;
799    } // Find all script elements and remove them.
800
801
802    Array.prototype.slice.call(global_document__WEBPACK_IMPORTED_MODULE_0___default().querySelectorAll("script[src=\"" + value + "\"]")).forEach(function (el) {
803      return el.parentNode.removeChild(el);
804    });
805  }); // Clear the internal cache that have been downloaded.
806
807  playerScriptCache.clear(); // Dispose any remaining players from the `videojs` global.
808
809  disposeAll((global_window__WEBPACK_IMPORTED_MODULE_1___default().videojs)); // There may be other `videojs` instances lurking in the bowels of the
810  // `bc` global. This should eliminate any of those.
811
812  getBcGlobalKeys().forEach(function (k) {
813    return disposeAll((global_window__WEBPACK_IMPORTED_MODULE_1___default().bc)[k].videojs);
814  }); // Delete any global object keys that were created.
815
816  getGlobalKeys().forEach(function (k) {
817    delete (global_window__WEBPACK_IMPORTED_MODULE_1___default())[k];
818  });
819};
820/**
821 * At runtime, populate the cache with pre-detected players. This allows
822 * people who have bundled their player or included a script tag before this
823 * runs to not have to re-download players.
824 */
825
826
827var detectPlayers = function detectPlayers() {
828  getBcGlobalKeys().forEach(function (k) {
829    var matches = k.match(REGEX_PLAYER_EMBED);
830    var props = {
831      playerId: matches[1],
832      embedId: matches[2]
833    };
834
835    if (!playerScriptCache.has(props)) {
836      playerScriptCache.store(props);
837    }
838  });
839};
840
841var env = {
842  detectPlayers: detectPlayers,
843  reset: reset
844};
845
846env.detectPlayers();
847/**
848 * Is this value a function?
849 *
850 * @private
851 * @param  {Function} fn
852 *         A maybe function.
853 *
854 * @return {boolean}
855 *         Whether or not the value is a function.
856 */
857
858var isFn = function isFn(fn) {
859  return typeof fn === 'function';
860};
861/**
862 * Checks whether an embedType parameter is valid.
863 *
864 * @private
865 * @param  {string} embedType
866 *         The value to test.
867 *
868 * @return {boolean}
869 *         Whether the value is valid.
870 */
871
872
873var isValidEmbedType = function isValidEmbedType(embedType) {
874  return embedType === EMBED_TYPE_IN_PAGE || embedType === EMBED_TYPE_IFRAME;
875};
876/**
877 * Checks whether an embedOptions.tagName parameter is valid.
878 *
879 * @private
880 * @param  {string} tagName
881 *         The value to test.
882 *
883 * @return {boolean}
884 *         Whether the value is valid.
885 */
886
887
888var isValidTagName = function isValidTagName(tagName) {
889  return tagName === EMBED_TAG_NAME_VIDEOJS || tagName === EMBED_TAG_NAME_VIDEO;
890};
891/**
892 * Checks whether a refNodeInsert parameter is valid.
893 *
894 * @private
895 * @param  {string} refNodeInsert
896 *         The value to test.
897 *
898 * @return {boolean}
899 *         Whether the value is valid.
900 */
901
902
903var isValidRootInsert = function isValidRootInsert(refNodeInsert) {
904  return refNodeInsert === REF_NODE_INSERT_APPEND || refNodeInsert === REF_NODE_INSERT_PREPEND || refNodeInsert === REF_NODE_INSERT_BEFORE || refNodeInsert === REF_NODE_INSERT_AFTER || refNodeInsert === REF_NODE_INSERT_REPLACE;
905};
906/**
907 * Checks parameters and throws an error on validation problems.
908 *
909 * @private
910 * @param  {Object} params
911 *         A parameters object. See README for details.
912 *
913 * @throws {Error} If accountId is missing.
914 * @throws {Error} If refNode is missing or invalid.
915 * @throws {Error} If embedType is missing or invalid.
916 * @throws {Error} If attempting to use an iframe embed with options.
917 * @throws {Error} If attempting to use embedOptions.responsiveIframe with a
918 *                 non-iframe embed.
919 * @throws {Error} If refNodeInsert is missing or invalid.
920 */
921
922
923var checkParams = function checkParams(params) {
924  var accountId = params.accountId,
925      embedOptions = params.embedOptions,
926      embedType = params.embedType,
927      options = params.options,
928      refNode = params.refNode,
929      refNodeInsert = params.refNodeInsert;
930
931  if (!accountId) {
932    throw new Error('accountId is required');
933  } else if (!isElInDom(refNode)) {
934    throw new Error('refNode must resolve to a node attached to the DOM');
935  } else if (!isValidEmbedType(embedType)) {
936    throw new Error('embedType is missing or invalid');
937  } else if (embedType === EMBED_TYPE_IFRAME && options) {
938    throw new Error('cannot use options with an iframe embed');
939  } else if (embedOptions && embedOptions.tagName !== undefined && !isValidTagName(embedOptions.tagName)) {
940    throw new Error("embedOptions.tagName is invalid (value: \"" + embedOptions.tagName + "\")");
941  } else if (embedOptions && embedOptions.responsive && embedOptions.responsive.aspectRatio && !/^\d+\:\d+$/.test(embedOptions.responsive.aspectRatio)) {
942    throw new Error("embedOptions.responsive.aspectRatio must be in the \"n:n\" format (value: \"" + embedOptions.responsive.aspectRatio + "\")");
943  } else if (!isValidRootInsert(refNodeInsert)) {
944    throw new Error('refNodeInsert is missing or invalid');
945  }
946};
947/**
948 * Normalizes a `refNode` param to an element - or `null`.
949 *
950 * @private
951 * @param  {Element|string} refNode
952 *         The value of a `refNode` param.
953 *
954 * @return {Element|null}
955 *         A DOM element or `null` if the `refNode` was given as a string and
956 *         did not match an element.
957 */
958
959
960var resolveRefNode = function resolveRefNode(refNode) {
961  if (isElInDom(refNode)) {
962    return refNode;
963  }
964
965  if (typeof refNode === 'string') {
966    return global_document__WEBPACK_IMPORTED_MODULE_0___default().querySelector(refNode);
967  }
968
969  return null;
970};
971/**
972 * Initializes a player and returns it.
973 *
974 * @private
975 * @param  {Object} params
976 *         A parameters object. See README for details.
977 *
978 * @param  {Element} embed
979 *         An element that will be passed to the `bc()` function.
980 *
981 * @param  {Function} resolve
982 *         A function to call if a player is successfully initialized.
983 *
984 * @param  {Function} reject
985 *         A function to call if a player fails to be initialized.
986 *
987 * @return {Object}
988 *         A success object whose `ref` is a player.
989 */
990
991
992var initPlayer = function initPlayer(params, embed, resolve, reject) {
993  var embedId = params.embedId,
994      playerId = params.playerId;
995  var bc = (global_window__WEBPACK_IMPORTED_MODULE_1___default().bc)[playerId + "_" + embedId] || (global_window__WEBPACK_IMPORTED_MODULE_1___default().bc);
996
997  if (!bc) {
998    return reject(new Error("missing bc function for " + playerId));
999  }
1000
1001  playerScriptCache.store(params);
1002  var player;
1003
1004  try {
1005    player = bc(embed, params.options); // Add a PLAYER_LOADER property to bcinfo to indicate this player was
1006    // loaded via that mechanism.
1007
1008    if (player.bcinfo) {
1009      player.bcinfo.PLAYER_LOADER = true;
1010    }
1011  } catch (x) {
1012    var message = 'Could not initialize the Brightcove Player.'; // Update the rejection message based on known conditions that can cause it.
1013
1014    if (params.embedOptions.tagName === EMBED_TAG_NAME_VIDEOJS) {
1015      message += ' You are attempting to embed using a "video-js" element.' + ' Please ensure that your Player is v6.11.0 or newer in order to' + ' support this embed type. Alternatively, pass `"video"` for' + ' `embedOptions.tagName`.';
1016    }
1017
1018    return reject(new Error(message));
1019  }
1020
1021  resolve({
1022    type: EMBED_TYPE_IN_PAGE,
1023    ref: player
1024  });
1025};
1026/**
1027 * Loads a player from CDN and embeds it.
1028 *
1029 * @private
1030 * @param  {Object} params
1031 *         A parameters object. See README for details.
1032 *
1033 * @param  {Function} resolve
1034 *         A function to call if a player is successfully initialized.
1035 *
1036 * @param  {Function} reject
1037 *         A function to call if a player fails to be initialized.
1038 */
1039
1040
1041var loadPlayer = function loadPlayer(params, resolve, reject) {
1042  params.refNode = resolveRefNode(params.refNode);
1043  checkParams(params);
1044  var refNode = params.refNode,
1045      refNodeInsert = params.refNodeInsert; // Store a reference to the refNode parent. When we use the replace method,
1046  // we'll need it as the location to store the script element.
1047
1048  var refNodeParent = refNode.parentNode;
1049  var embed = createEmbed(params); // If this is an iframe, all we need to do is create the embed code and
1050  // inject it. Because there is no reliable way to hook into an iframe from
1051  // the parent page, we simply resolve immediately upon creating the embed.
1052
1053  if (params.embedType === EMBED_TYPE_IFRAME) {
1054    resolve({
1055      type: EMBED_TYPE_IFRAME,
1056      ref: embed
1057    });
1058    return;
1059  } // If we've already downloaded this script or detected a matching global, we
1060  // should have the proper `bc` global and can bypass the script creation
1061  // process.
1062
1063
1064  if (playerScriptCache.has(params)) {
1065    return initPlayer(params, embed, resolve, reject);
1066  }
1067
1068  var script = global_document__WEBPACK_IMPORTED_MODULE_0___default().createElement('script');
1069
1070  script.onload = function () {
1071    return initPlayer(params, embed, resolve, reject);
1072  };
1073
1074  script.onerror = function () {
1075    reject(new Error('player script could not be downloaded'));
1076  };
1077
1078  script.async = true;
1079  script.charset = 'utf-8';
1080  script.src = urls.getUrl(params);
1081
1082  if (refNodeInsert === REF_NODE_INSERT_REPLACE) {
1083    refNodeParent.appendChild(script);
1084  } else {
1085    refNode.appendChild(script);
1086  }
1087};
1088/**
1089 * A function for asynchronously loading a Brightcove Player into a web page.
1090 *
1091 * @param  {Object} parameters
1092 *         A parameters object. See README for details.
1093 *
1094 * @return {Promise|undefined}
1095 *         A Promise, if possible.
1096 */
1097
1098
1099var brightcovePlayerLoader = function brightcovePlayerLoader(parameters) {
1100  var params = _extends({}, DEFAULTS, parameters);
1101
1102  var Promise = params.Promise,
1103      onSuccess = params.onSuccess,
1104      onFailure = params.onFailure; // When Promise is not available or any success/failure callback is given,
1105  // do not attempt to use Promises.
1106
1107  if (!isFn(Promise) || isFn(onSuccess) || isFn(onFailure)) {
1108    return loadPlayer(params, isFn(onSuccess) ? onSuccess : function () {}, isFn(onFailure) ? onFailure : function (err) {
1109      throw err;
1110    });
1111  } // Promises are supported, use 'em.
1112
1113
1114  return new Promise(function (resolve, reject) {
1115    return loadPlayer(params, resolve, reject);
1116  });
1117};
1118/**
1119 * Expose a non-writable, non-configurable property on the
1120 * `brightcovePlayerLoader` function.
1121 *
1122 * @private
1123 * @param  {string} key
1124 *         The property key.
1125 *
1126 * @param  {string|Function} value
1127 *         The value.
1128 */
1129
1130
1131var expose = function expose(key, value) {
1132  Object.defineProperty(brightcovePlayerLoader, key, {
1133    configurable: false,
1134    enumerable: true,
1135    value: value,
1136    writable: false
1137  });
1138};
1139/**
1140 * Get the base URL for players. By default, this will be the Brightcove CDN.
1141 *
1142 * @return {string}
1143 *         The current base URL.
1144 */
1145
1146
1147expose('getBaseUrl', function () {
1148  return urls.getBaseUrl();
1149});
1150/**
1151 * Set the base URL for players. By default, this will be the Brightcove CDN,
1152 * but can be overridden with this function.
1153 *
1154 * @param {string} baseUrl
1155 *        A new base URL (instead of Brightcove CDN).
1156 */
1157
1158expose('setBaseUrl', function (baseUrl) {
1159  urls.setBaseUrl(baseUrl);
1160});
1161/**
1162 * Get the URL for a player.
1163 */
1164
1165expose('getUrl', function (options) {
1166  return urls.getUrl(options);
1167});
1168/**
1169 * Completely resets global state.
1170 *
1171 * This will dispose ALL Video.js players on the page and remove ALL `bc` and
1172 * `videojs` globals it finds.
1173 */
1174
1175expose('reset', function () {
1176  return env.reset();
1177}); // Define some read-only constants on the exported function.
1178
1179[['EMBED_TAG_NAME_VIDEO', EMBED_TAG_NAME_VIDEO], ['EMBED_TAG_NAME_VIDEOJS', EMBED_TAG_NAME_VIDEOJS], ['EMBED_TYPE_IN_PAGE', EMBED_TYPE_IN_PAGE], ['EMBED_TYPE_IFRAME', EMBED_TYPE_IFRAME], ['REF_NODE_INSERT_APPEND', REF_NODE_INSERT_APPEND], ['REF_NODE_INSERT_PREPEND', REF_NODE_INSERT_PREPEND], ['REF_NODE_INSERT_BEFORE', REF_NODE_INSERT_BEFORE], ['REF_NODE_INSERT_AFTER', REF_NODE_INSERT_AFTER], ['REF_NODE_INSERT_REPLACE', REF_NODE_INSERT_REPLACE], ['VERSION', version]].forEach(function (arr) {
1180  expose(arr[0], arr[1]);
1181});
1182
1183/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (brightcovePlayerLoader);
1184
1185
1186/***/ }),
1187
vendor: 932 bytes, lines 1188-1214
1188/***/ "./.yarn/cache/global-npm-4.4.0-888ee8033d-9c057557c8.zip/node_modules/global/document.js":
1189/*!************************************************************************************************!*\
1190  !*** ./.yarn/cache/global-npm-4.4.0-888ee8033d-9c057557c8.zip/node_modules/global/document.js ***!
1191  \************************************************************************************************/
1192/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1193
1194var topLevel = typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g :
1195    typeof window !== 'undefined' ? window : {}
1196var minDoc = __webpack_require__(/*! min-document */ "?6f26");
1197
1198var doccy;
1199
1200if (typeof document !== 'undefined') {
1201    doccy = document;
1202} else {
1203    doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
1204
1205    if (!doccy) {
1206        doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
1207    }
1208}
1209
1210module.exports = doccy;
1211
1212
1213/***/ }),
1214
vendor: 736 bytes, lines 1215-1236
1215/***/ "./.yarn/cache/global-npm-4.4.0-888ee8033d-9c057557c8.zip/node_modules/global/window.js":
1216/*!**********************************************************************************************!*\
1217  !*** ./.yarn/cache/global-npm-4.4.0-888ee8033d-9c057557c8.zip/node_modules/global/window.js ***!
1218  \**********************************************************************************************/
1219/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1220
1221var win;
1222
1223if (typeof window !== "undefined") {
1224    win = window;
1225} else if (typeof __webpack_require__.g !== "undefined") {
1226    win = __webpack_require__.g;
1227} else if (typeof self !== "undefined"){
1228    win = self;
1229} else {
1230    win = {};
1231}
1232
1233module.exports = win;
1234
1235
1236/***/ })
1236
1237
1238}]);
1239//# sourceMappingURL=vendors-_yarn_cache_brightcove-player-loader-npm-1_8_0-fa9f4ca49e-095bc1a3b4_zip_node_modules-c02406.js.map?_t=66d5a7e5e4f9faba0ba5

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.