@widgetic/editor 3.10.32 → 3.10.37

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.
package/lib/dev/editor.js CHANGED
@@ -1313,6 +1313,8 @@ Service = (function(superClass) {
1313
1313
 
1314
1314
  Service.browser = 'browser/controller';
1315
1315
 
1316
+ Service.authenticating = false;
1317
+
1316
1318
  Service.include(Events);
1317
1319
 
1318
1320
  function Service(title, options) {
@@ -5973,6 +5975,7 @@ Browser = (function(superClass) {
5973
5975
  this._release = bind(this._release, this);
5974
5976
  this._active = bind(this._active, this);
5975
5977
  this.onFolderRefresh = bind(this.onFolderRefresh, this);
5978
+ this.updateCurrentCount = bind(this.updateCurrentCount, this);
5976
5979
  this.refreshChildren = bind(this.refreshChildren, this);
5977
5980
  this.setFolder = bind(this.setFolder, this);
5978
5981
  this.onLogout = bind(this.onLogout, this);
@@ -5981,11 +5984,7 @@ Browser = (function(superClass) {
5981
5984
  Browser.__super__.constructor.apply(this, arguments);
5982
5985
  this.service = new this.Service(this.title, this.options);
5983
5986
  this.serviceTitle || (this.serviceTitle = this.service.title);
5984
- this.delay((function(_this) {
5985
- return function() {
5986
- return _this.tab.count(_this.content.length);
5987
- };
5988
- })(this));
5987
+ this.currentContent = [];
5989
5988
  this.addNavBar();
5990
5989
  this.intent = $(Intent(this.service.options));
5991
5990
  this.el.addClass(this.title);
@@ -6046,6 +6045,12 @@ Browser = (function(superClass) {
6046
6045
 
6047
6046
  Browser.prototype.onAuth = function(authenticated) {
6048
6047
  this.authenticated = authenticated;
6048
+ this.currentContent = [];
6049
+ if (this.authenticated) {
6050
+ this.updateCurrentCount();
6051
+ } else {
6052
+ this.tab.count(0);
6053
+ }
6049
6054
  this.el.attr({
6050
6055
  authenticated: this.authenticated
6051
6056
  });
@@ -6098,11 +6103,50 @@ Browser = (function(superClass) {
6098
6103
  }
6099
6104
  };
6100
6105
 
6106
+ Browser.prototype.updateCurrentCount = function() {
6107
+ return this.tab.count(this.content.filter((function(_this) {
6108
+ return function(a) {
6109
+ return _this.currentContent.some(function(b) {
6110
+ return a.id === b.id;
6111
+ });
6112
+ };
6113
+ })(this)).length);
6114
+ };
6115
+
6101
6116
  Browser.prototype.onFolderRefresh = function(children, opts) {
6102
- var controller, isFolder, item, j, len;
6117
+ var controller, isFolder, item, j, len, rootChildren, subfoldersChildren;
6103
6118
  if (opts == null) {
6104
6119
  opts = {};
6105
6120
  }
6121
+ if (opts.root) {
6122
+ rootChildren = [];
6123
+ subfoldersChildren = [];
6124
+ children.map((function(_this) {
6125
+ return function(child) {
6126
+ if (child.type === "folder") {
6127
+ return subfoldersChildren = subfoldersChildren.concat(child.children.map(function(subChild) {
6128
+ return _this.service.newEntry('audio', subChild, child.id);
6129
+ }));
6130
+ } else {
6131
+ return rootChildren.push(child);
6132
+ }
6133
+ };
6134
+ })(this));
6135
+ if (subfoldersChildren.length && !this.currentContent.length) {
6136
+ this.currentContent = this.currentContent.concat(subfoldersChildren);
6137
+ }
6138
+ if (rootChildren.length) {
6139
+ children = rootChildren = rootChildren.filter((function(_this) {
6140
+ return function(child) {
6141
+ return !_this.currentContent.some(function(subChild) {
6142
+ return subChild.id === child.id;
6143
+ });
6144
+ };
6145
+ })(this));
6146
+ this.currentContent = this.currentContent.concat(rootChildren);
6147
+ }
6148
+ this.updateCurrentCount();
6149
+ }
6106
6150
  if (opts.hard) {
6107
6151
  this.empty().$addClass('loading');
6108
6152
  }
@@ -6218,7 +6262,8 @@ Browser = (function(superClass) {
6218
6262
  if (this.content.indexOf(itm) !== -1) {
6219
6263
  return;
6220
6264
  }
6221
- return this.tab.count(this.content.push(item));
6265
+ this.content.push(item);
6266
+ return this.updateCurrentCount();
6222
6267
  };
6223
6268
 
6224
6269
  Browser.prototype.removeEntry = function(item) {
@@ -6231,7 +6276,7 @@ Browser = (function(superClass) {
6231
6276
  }
6232
6277
  }
6233
6278
  this.content.splice(this.content.indexOf(itm), 1);
6234
- this.tab.count(this.content.length);
6279
+ this.updateCurrentCount();
6235
6280
  ref1 = this.children();
6236
6281
  results = [];
6237
6282
  for (k = 0, len1 = ref1.length; k < len1; k++) {
@@ -13302,7 +13347,7 @@ WidgetEditor = (function(superClass) {
13302
13347
  this.el.append(this.tabs.el);
13303
13348
  LoginPopup.place(this.el);
13304
13349
  Blogvio.pubsub.subscribe('api/token/update', this._updateLoggedInStatus);
13305
- this.el.attr('editorVersion', "3.10.32");
13350
+ this.el.attr('editorVersion', "3.10.37");
13306
13351
  }
13307
13352
 
13308
13353
 
@@ -15101,6 +15146,7 @@ Content = (function(superClass) {
15101
15146
  this.addBrowser(UploadBrowser);
15102
15147
  sources = (ref1 = this.meta.browser) != null ? ref1.sources : void 0;
15103
15148
  if (sources) {
15149
+ delete sources.facebook;
15104
15150
  delete sources.websearch;
15105
15151
  delete sources.blogvio;
15106
15152
  delete sources.dropbox;
@@ -15298,7 +15344,8 @@ Content = (function(superClass) {
15298
15344
  this.stopListening(ContentModel, 'destroy', this.onItemDestroy);
15299
15345
  removedContent = ContentModel.all().filter((function(_this) {
15300
15346
  return function(i) {
15301
- return i.metadata === item && i.composition_id === _this.composition.id;
15347
+ var ref;
15348
+ return ((ref = i.metadata) != null ? ref.id : void 0) === item.id && i.composition_id === _this.composition.id;
15302
15349
  };
15303
15350
  })(this));
15304
15351
  if ((ref = removedContent[0]) != null) {
@@ -16526,15 +16573,20 @@ var ContentServiceWithEvents = function (_EventsMixin) {
16526
16573
  var extra = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
16527
16574
  var metadata = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
16528
16575
 
16576
+
16529
16577
  var item = this.getItemsByService(service).filter(function (item) {
16530
16578
  return item.metadata.id === id;
16531
16579
  }).pop();
16580
+ // console.log("Content toggleItem:", id, item)
16532
16581
 
16582
+ // remove item
16533
16583
  if (item) {
16534
16584
  item.destroy();
16535
- } else {
16536
- this.addItem(composition, value, extra, Object.assign({}, metadata, { id: id, service: service }));
16537
16585
  }
16586
+ // add item
16587
+ else {
16588
+ this.addItem(composition, value, extra, Object.assign({}, metadata, { id: id, service: service }));
16589
+ }
16538
16590
  }
16539
16591
  }, {
16540
16592
  key: 'clearContent',
@@ -16631,7 +16683,7 @@ var UploadService = function (_EventsMixin) {
16631
16683
  var _this = _possibleConstructorReturn(this, (UploadService.__proto__ || Object.getPrototypeOf(UploadService)).call(this));
16632
16684
 
16633
16685
  _this.user = user.id;
16634
- _this.maxFilesize = user.premium ? 100 : 25;
16686
+ _this.maxFilesize = user.premium ? 250 : 100;
16635
16687
  _this.token = token;
16636
16688
 
16637
16689
  _this.files = [];
@@ -23222,7 +23274,9 @@ INSTAGRAM_DEFAULTS = {
23222
23274
 
23223
23275
  api = window.INSTAGRAM_SERVICE_CONFIG || INSTAGRAM_DEFAULTS;
23224
23276
 
23225
- api.token = localStorage.getItem('instagramAuthToken');
23277
+ try {
23278
+ api.token = localStorage.getItem('instagramAuthToken');
23279
+ } catch (error) {}
23226
23280
 
23227
23281
  auth_url = "https://api.instagram.com/oauth/authorize/?client_id=" + api.client_id + "&redirect_uri=" + api.redirect_uri + "&response_type=" + api.response_type + "&scope=" + api.scope;
23228
23282
 
@@ -23277,7 +23331,10 @@ InstagramService = (function(superClass) {
23277
23331
  InstagramService.prototype.showAuthPopup = function() {
23278
23332
  window.instagramReady = (function(_this) {
23279
23333
  return function(token, user) {
23280
- localStorage.setItem('instagramAuthToken', api.token = token);
23334
+ api.token = token;
23335
+ try {
23336
+ localStorage.setItem('instagramAuthToken', api.token = token);
23337
+ } catch (error) {}
23281
23338
  _this.user = user;
23282
23339
  return _this.trigger('auth', _this.authenticated = true);
23283
23340
  };
@@ -23294,7 +23351,9 @@ InstagramService = (function(superClass) {
23294
23351
  this.authenticated = false;
23295
23352
  api.token = null;
23296
23353
  this.trigger('auth', this.authenticated);
23297
- return localStorage.removeItem('instagramAuthToken');
23354
+ try {
23355
+ return localStorage.removeItem('instagramAuthToken');
23356
+ } catch (error) {}
23298
23357
  };
23299
23358
 
23300
23359
  return InstagramService;
@@ -23337,7 +23396,9 @@ INSTAGRAM_DEFAULTS = {
23337
23396
 
23338
23397
  api = window.INSTAGRAM_SERVICE_CONFIG || INSTAGRAM_DEFAULTS;
23339
23398
 
23340
- api.token = localStorage.getItem('instagramAuthToken');
23399
+ try {
23400
+ api.token = localStorage.getItem('instagramAuthToken');
23401
+ } catch (error1) {}
23341
23402
 
23342
23403
  auth_url = "https://api.instagram.com/oauth/authorize/?client_id=" + api.client_id + "&redirect_uri=" + api.redirect_uri + "&response_type=" + api.response_type + "&scope=" + api.scope;
23343
23404
 
@@ -23410,7 +23471,10 @@ InstagramService = (function(superClass) {
23410
23471
  InstagramService.prototype.showAuthPopup = function() {
23411
23472
  window.instagramReady = (function(_this) {
23412
23473
  return function(token, user) {
23413
- localStorage.setItem('instagramAuthToken', api.token = token);
23474
+ api.token = token;
23475
+ try {
23476
+ localStorage.setItem('instagramAuthToken', api.token = token);
23477
+ } catch (error1) {}
23414
23478
  _this.user = user;
23415
23479
  return _this.trigger('auth', _this.authenticated = true);
23416
23480
  };
@@ -23422,7 +23486,9 @@ InstagramService = (function(superClass) {
23422
23486
  this.authenticated = false;
23423
23487
  api.token = null;
23424
23488
  this.trigger('auth', this.authenticated);
23425
- return localStorage.removeItem('instagramAuthToken');
23489
+ try {
23490
+ return localStorage.removeItem('instagramAuthToken');
23491
+ } catch (error1) {}
23426
23492
  };
23427
23493
 
23428
23494
  InstagramService.prototype.refresh = function(entry1) {
@@ -23570,7 +23636,7 @@ module.exports = InstagramService;
23570
23636
  /* 170 */
23571
23637
  /***/ (function(module, exports, __webpack_require__) {
23572
23638
 
23573
- var Entry, SC, Service, SoundCloudService,
23639
+ var Entry, SC, Service, SoundCloudService, config,
23574
23640
  bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
23575
23641
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
23576
23642
  hasProp = {}.hasOwnProperty;
@@ -23581,6 +23647,29 @@ Entry = __webpack_require__(9);
23581
23647
 
23582
23648
  SC = __webpack_require__(171);
23583
23649
 
23650
+ config = {
23651
+ client_id: 'aed0aa63baf747a83ad0b6b246acddca',
23652
+ redirect_uri: 'https://widgetic.com/connect/soundcloud',
23653
+ grant_type: 'refresh_token',
23654
+ api_url: 'https://api.soundcloud.com'
23655
+ };
23656
+
23657
+ SC.initialize(config);
23658
+
23659
+ SC.client_id = config.client_id;
23660
+
23661
+ SC.redirect_uri = config.redirect_uri;
23662
+
23663
+ SC.api_url = config.api_url;
23664
+
23665
+ try {
23666
+ SC.auth_token = localStorage.getItem('soundcloudAuthToken');
23667
+ } catch (error1) {}
23668
+
23669
+ try {
23670
+ SC.userId = localStorage.getItem('soundcloudUserId');
23671
+ } catch (error1) {}
23672
+
23584
23673
  SoundCloudService = (function(superClass) {
23585
23674
  extend(SoundCloudService, superClass);
23586
23675
 
@@ -23591,57 +23680,134 @@ SoundCloudService = (function(superClass) {
23591
23680
  this.checkAuth = bind(this.checkAuth, this);
23592
23681
  this.auth = bind(this.auth, this);
23593
23682
  SoundCloudService.__super__.constructor.apply(this, arguments);
23594
- this.authenticated = false;
23595
23683
  }
23596
23684
 
23685
+ SoundCloudService.prototype.SCGet = function(path) {
23686
+ var url;
23687
+ url = ("" + SC.api_url) + path;
23688
+ console.log("SCGet path:", path, SC.auth_token);
23689
+ return $.ajax({
23690
+ url: url,
23691
+ type: 'GET',
23692
+ dataType: 'json',
23693
+ headers: {
23694
+ 'Authorization': 'OAuth ' + SC.auth_token
23695
+ }
23696
+ });
23697
+ };
23698
+
23597
23699
  SoundCloudService.prototype.auth = function(interactive) {
23598
- return SC.ready().then((function(_this) {
23599
- return function() {
23600
- if (interactive) {
23601
- SC.connect(_this.checkAuth);
23602
- }
23603
- return _this.checkAuth();
23700
+ if (!SC.userId && interactive) {
23701
+ return this.showAuthPopup();
23702
+ } else {
23703
+ return this.checkAuth();
23704
+ }
23705
+ };
23706
+
23707
+ SoundCloudService.prototype.showAuthPopup = function() {
23708
+ return SC.connect().then((function(_this) {
23709
+ return function(response) {
23710
+ SC.auth_token = response.oauth_token;
23711
+ try {
23712
+ localStorage.setItem('soundcloudAuthToken', SC.auth_token);
23713
+ } catch (error1) {}
23714
+ return _this.SCGet("/me").then(function(response) {
23715
+ SC.userId = response.id;
23716
+ try {
23717
+ localStorage.setItem('soundcloudUserId', SC.userId);
23718
+ } catch (error1) {}
23719
+ return _this.checkAuth();
23720
+ })["catch"](function(error) {
23721
+ console.log("Editor getUser error:", error);
23722
+ return _this.deauth();
23723
+ });
23724
+ };
23725
+ })(this))["catch"]((function(_this) {
23726
+ return function(error) {
23727
+ console.log('SC Connect Error: ' + error.message);
23728
+ return _this.deauth();
23604
23729
  };
23605
23730
  })(this));
23606
23731
  };
23607
23732
 
23608
23733
  SoundCloudService.prototype.checkAuth = function() {
23609
- return this.trigger('auth', this.authenticated = SC.isConnected());
23734
+ return this.trigger('auth', SC.userId !== null);
23735
+ };
23736
+
23737
+ SoundCloudService.prototype.deauth = function() {
23738
+ SC.auth_token = null;
23739
+ try {
23740
+ localStorage.removeItem('soundcloudAuthToken');
23741
+ } catch (error1) {}
23742
+ SC.userId = null;
23743
+ try {
23744
+ localStorage.removeItem('soundcloudUserId');
23745
+ } catch (error1) {}
23746
+ return this.checkAuth();
23610
23747
  };
23611
23748
 
23612
23749
  SoundCloudService.prototype.refresh = function(currentFolder) {
23613
23750
  this.currentFolder = currentFolder;
23614
23751
  if (this.currentFolder.root) {
23615
- this.fetchPlaylists();
23752
+ return this.fetchPlaylists();
23753
+ } else {
23754
+ return this.fetchTracks(this.currentFolder.id);
23616
23755
  }
23617
- return this.fetchTracks(this.currentFolder.id);
23618
23756
  };
23619
23757
 
23620
23758
  SoundCloudService.prototype.fetchPlaylists = function() {
23621
- return SC.get('/me/playlists', (function(_this) {
23759
+ return this.SCGet("/users/" + SC.userId + "/playlists").then((function(_this) {
23622
23760
  return function(playlists) {
23623
- return _this.trigger('refresh', playlists.map(_this.newEntry.bind(_this, 'folder')));
23761
+ _this.trigger('refresh', playlists.map(_this.newEntry.bind(_this, 'folder')), {
23762
+ root: true
23763
+ });
23764
+ return _this.fetchTracks(_this.currentFolder.id);
23765
+ };
23766
+ })(this))["catch"]((function(_this) {
23767
+ return function(error) {
23768
+ return console.log('Fetch Playlist error: ' + error.message);
23624
23769
  };
23625
23770
  })(this));
23626
23771
  };
23627
23772
 
23628
- SoundCloudService.prototype.fetchTracks = function(id) {
23773
+ SoundCloudService.prototype.fetchTracks = function(playlistId) {
23629
23774
  var path;
23630
- path = id ? "/playlists/" + id : '/me';
23631
- return SC.get(path + '/tracks', (function(_this) {
23632
- return function(tracks) {
23633
- return _this.trigger('refresh', tracks.map(_this.newEntry.bind(_this, 'audio')));
23775
+ path = playlistId ? "/playlists/" + playlistId : "/users/" + SC.userId + "/tracks";
23776
+ path += "?access=playable";
23777
+ return this.SCGet(path).then((function(_this) {
23778
+ return function(result) {
23779
+ var tracks;
23780
+ tracks = result;
23781
+ if (result.tracks) {
23782
+ tracks = result.tracks;
23783
+ }
23784
+ return _this.trigger('refresh', tracks.map(function(track) {
23785
+ return _this.newEntry('audio', track);
23786
+ }), {
23787
+ root: (playlistId ? false : true)
23788
+ });
23789
+ };
23790
+ })(this))["catch"]((function(_this) {
23791
+ return function(error) {
23792
+ return console.log('Fetch Tracks error: ' + error.message);
23634
23793
  };
23635
23794
  })(this));
23636
23795
  };
23637
23796
 
23638
- SoundCloudService.prototype.newEntry = function(type, item) {
23639
- var artwork_url, duration, id, path, stream_url, title;
23640
- path = this.currentFolder.path;
23641
- if (!this.currentFolder.root) {
23642
- path += '/';
23797
+ SoundCloudService.prototype.newEntry = function(type, item, parentId) {
23798
+ var artwork_url, children, duration, id, path, stream_url, title;
23799
+ if (!parentId) {
23800
+ path = this.currentFolder.path;
23801
+ if (!this.currentFolder.root) {
23802
+ path += '/';
23803
+ }
23804
+ } else {
23805
+ path = parentId + '/';
23643
23806
  }
23644
23807
  path += item.id;
23808
+ if (type === "folder") {
23809
+ children = item.tracks;
23810
+ }
23645
23811
  artwork_url = item.artwork_url, id = item.id, duration = item.duration, title = item.title, stream_url = item.stream_url;
23646
23812
  return new Entry($.extend({}, {
23647
23813
  service: this,
@@ -23649,7 +23815,8 @@ SoundCloudService = (function(superClass) {
23649
23815
  path: path,
23650
23816
  artwork_url: artwork_url,
23651
23817
  id: id,
23652
- duration: duration,
23818
+ children: children,
23819
+ duration: duration / 1000,
23653
23820
  title: title,
23654
23821
  stream_url: stream_url,
23655
23822
  name: item.title
@@ -23657,12 +23824,16 @@ SoundCloudService = (function(superClass) {
23657
23824
  };
23658
23825
 
23659
23826
  SoundCloudService.prototype.getURL = function(entry, callback) {
23660
- return callback(entry.stream_url + "?client_id=" + (SC.clientId()));
23661
- };
23662
-
23663
- SoundCloudService.prototype.deauth = function() {
23664
- SC.disconnect();
23665
- return this.trigger('auth', this.authenticated = SC.isConnected());
23827
+ return this.SCGet("/tracks/" + entry.id + "/stream").then((function(_this) {
23828
+ return function(streams) {
23829
+ console.log("fetchTrackStreams result:", streams);
23830
+ return callback(streams);
23831
+ };
23832
+ })(this))["catch"]((function(_this) {
23833
+ return function(error) {
23834
+ return console.log('Fetch Track Streams error: ' + error);
23835
+ };
23836
+ })(this));
23666
23837
  };
23667
23838
 
23668
23839
  return SoundCloudService;
@@ -23674,67 +23845,35 @@ module.exports = SoundCloudService;
23674
23845
 
23675
23846
  /***/ }),
23676
23847
  /* 171 */
23677
- /***/ (function(module, exports) {
23678
-
23679
- var client_id, initPromise, initSDK, loadSDK, lsAuthKey, redirect_uri, sdk,
23680
- slice = [].slice,
23681
- hasProp = {}.hasOwnProperty;
23682
-
23683
- client_id = 'aed0aa63baf747a83ad0b6b246acddca';
23684
-
23685
- redirect_uri = window.location.origin + "/connect/soundcloud";
23686
-
23687
- lsAuthKey = 'wdtc-sc-at';
23688
-
23689
- loadSDK = function() {
23690
- return $.getScript("//connect.soundcloud.com/sdk-2.0.0.js");
23691
- };
23692
-
23693
- initPromise = null;
23694
-
23695
- initSDK = function() {
23696
- return initPromise || (initPromise = loadSDK().then(function() {
23697
- return SC.initialize({
23698
- client_id: client_id,
23699
- redirect_uri: redirect_uri
23700
- });
23701
- }).then(function() {
23702
- var _, callSC, key;
23703
- callSC = function() {
23704
- var args, method;
23705
- method = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
23706
- return SC[method].apply(SC, args);
23707
- };
23708
- for (key in SC) {
23709
- if (!hasProp.call(SC, key)) continue;
23710
- _ = SC[key];
23711
- if (!sdk[key] && typeof SC[key] === 'function') {
23712
- sdk[key] = callSC.bind(SC, key);
23713
- }
23714
- }
23715
- if ((key = localStorage.getItem(lsAuthKey)) != null) {
23716
- return SC.accessToken(key);
23717
- }
23718
- }));
23719
- };
23720
-
23721
- module.exports = sdk = {
23722
- ready: initSDK,
23723
- connect: function(callback) {
23724
- return SC.connect(function() {
23725
- localStorage.setItem(lsAuthKey, SC.accessToken());
23726
- return callback();
23727
- });
23728
- },
23729
- disconnect: function() {
23730
- SC.disconnect();
23731
- return localStorage.removeItem(lsAuthKey);
23732
- },
23733
- clientId: function() {
23734
- return client_id;
23735
- }
23736
- };
23848
+ /***/ (function(module, exports, __webpack_require__) {
23737
23849
 
23850
+ !function(e,t){if(true)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){(function(t){"use strict";var n=r(4),o=r(8),i=r(3),a=r(9),s=r(2).Promise,u=r(16),l=r(17);e.exports=t.SC={initialize:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];i.set("oauth_token",e.oauth_token),i.set("client_id",e.client_id),i.set("redirect_uri",e.redirect_uri),i.set("baseURL",e.baseURL),i.set("connectURL",e.connectURL)},get:function(e,t){return n.request("GET",e,t)},post:function(e,t){return n.request("POST",e,t)},put:function(e,t){return n.request("PUT",e,t)},delete:function(e){return n.request("DELETE",e)},upload:function(e){return n.upload(e)},connect:function(e){return a(e)},isConnected:function(){return void 0!==i.get("oauth_token")},oEmbed:function(e,t){return n.oEmbed(e,t)},resolve:function(e){return n.resolve(e)},Recorder:u,Promise:s,stream:function(e,t){return l(e,t)},connectCallback:function(){o.notifyDialog(this.location)}}}).call(t,function(){return this}())},function(e,t){e.exports=function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports={SCAudio:r(1),SCAudioControllerHTML5Player:r(3),SCAudioControllerHLSMSEPlayer:r(5),SCAudioPublicApiStreamURLRetriever:r(12),MaestroCore:r(2),MaestroLoaders:r(11)}},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=99)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(5);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,r){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t,r){"use strict";e.exports=r(55)()?Symbol:r(54)},function(e,t,r){"use strict";var n,o=r(11),i=r(18),a=r(59),s=r(17);n=e.exports=function(e,t){var r,n,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(r=a=!0,n=!1):(r=s.call(e,"c"),n=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:r,enumerable:n,writable:a},u?o(i(u),l):l},n.gs=function(e,t,r){var n,u,l,c;return"string"!=typeof e?(l=r,r=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==r?r=void 0:a(r)||(l=r,r=void 0):(l=t,t=r=void 0),null==e?(n=!0,u=!1):(n=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:r,configurable:n,enumerable:u},l?o(i(l),c):c}},function(e,t,r){"use strict";var n=r(22)();e.exports=function(e){return e!==n&&null!==e}},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,t||"There was no format available that a player was able to play.")||this}return n(t,e),t.prototype.getCode=function(){return"SCAUDIO.NOT_SUPPORTED_ERROR"},t}(o.errors.PlayerFatalError);t.NotSupportedError=i},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call("");e.exports=function(e){return"string"==typeof e||e&&"object"==typeof e&&(e instanceof String||n.call(e)===o)||!1}},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call(function(){return arguments}());e.exports=function(e){return n.call(e)===o}},function(e,t,r){"use strict";e.exports=r(20)()?Object.setPrototypeOf:r(19)},function(e,t,r){"use strict";var n,o=r(23),i=r(11),a=r(2),s=r(1),u=r(4),l=r(47),c=r(3),d=Object.defineProperty,p=Object.defineProperties;e.exports=n=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");p(this,{__list__:u("w",s(e)),__context__:u("w",t),__nextIndex__:u("w",0)}),t&&(a(t.on),t.on("_add",this._onAdd),t.on("_delete",this._onDelete),t.on("_clear",this._onClear))},delete n.prototype.constructor,p(n.prototype,i({_next:u(function(){var e;if(this.__list__)return this.__redo__&&(e=this.__redo__.shift(),void 0!==e)?e:this.__nextIndex__<this.__list__.length?this.__nextIndex__++:void this._unBind()}),next:u(function(){return this._createResult(this._next())}),_createResult:u(function(e){return void 0===e?{done:!0,value:void 0}:{done:!1,value:this._resolve(e)}}),_resolve:u(function(e){return this.__list__[e]}),_unBind:u(function(){this.__list__=null,delete this.__redo__,this.__context__&&(this.__context__.off("_add",this._onAdd),this.__context__.off("_delete",this._onDelete),this.__context__.off("_clear",this._onClear),this.__context__=null)}),toString:u(function(){return"[object "+(this[c.toStringTag]||"Object")+"]"})},l({_onAdd:u(function(e){if(!(e>=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void d(this,"__redo__",u("c",[e]));this.__redo__.forEach(function(t,r){t>=e&&(this.__redo__[r]=++t)},this),this.__redo__.push(e)}}),_onDelete:u(function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(t=this.__redo__.indexOf(e),t!==-1&&this.__redo__.splice(t,1),this.__redo__.forEach(function(t,r){t>e&&(this.__redo__[r]=--t)},this)))}),_onClear:u(function(){this.__redo__&&o.call(this.__redo__),this.__nextIndex__=0})}))),d(n.prototype,c.iterator,u(function(){return this}))},function(e,t,r){"use strict";e.exports=r(64)()?Object.assign:r(63)},function(e,t,r){"use strict";function n(){switch(window.document.hidden){case!0:return"background";case!1:return"foreground";default:return}}Object.defineProperty(t,"__esModule",{value:!0}),t.getAppState=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(97),o=r(96),i=r(95),a=r(94),s=r(93),u=r(92),l=r(91),c=r(90),d=r(89),p=r(88);t.renditions={httpMp3:n.httpMp3,httpAACHQ:p.httpAACHQ,hlsMp3:o.hlsMp3,encryptedHlsMp3:i.encryptedHlsMp3,hlsOpus:c.hlsOpus,encryptedHlsOpus:d.encryptedHlsOpus,hlsAACHQ:a.hlsAACHQ,encryptedHlsAACHQ:s.encryptedHlsAACHQ,apiMobile:u.apiMobile,maestroChromecast:l.maestroChromecast},t.allRenditions=Object.keys(t.renditions).map(function(e){return t.renditions[e]})},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=function(e){function t(){return e.call(this,"Failed to retrieve stream url.")||this}return n(t,e),t.prototype.getCode=function(){return"SCAUDIO.FAILED_RETRIEVING_URL"},t}(o.NotSupportedError);t.FailedRetrievingUrlError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=function(e){function t(){return e.call(this,"There were no stream URLs.")||this}return n(t,e),t.prototype.getCode=function(){return"SCAUDIO.NO_STREAMS"},t}(o.NotSupportedError);t.NoStreamsError=i},function(e,t,r){"use strict";var n=r(51);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not iterable");return e}},function(e,t,r){"use strict";e.exports=r(58)()?String.prototype.contains:r(57)},function(e,t,r){"use strict";var n=r(5),o=Array.prototype.forEach,i=Object.create,a=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=i(null);return o.call(arguments,function(e){n(e)&&a(Object(e),t)}),t}},function(e,t,r){"use strict";var n,o=r(66),i=r(1),a=Object.prototype.isPrototypeOf,s=Object.defineProperty,u={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(e,t){if(i(e),null===t||o(t))return e;throw new TypeError("Prototype must be null or an object")},e.exports=function(e){var t,r;return e?(2===e.level?e.set?(r=e.set,t=function(e,t){return r.call(n(e,t),t),e}):t=function(e,t){return n(e,t).__proto__=t,e}:t=function e(t,r){var o;return n(t,r),o=a.call(e.nullPolyfill,t),o&&delete e.nullPolyfill.__proto__,null===r&&(r=e.nullPolyfill),t.__proto__=r,o&&s(e.nullPolyfill,"__proto__",u),t},Object.defineProperty(t,"level",{configurable:!1,enumerable:!1,writable:!1,value:e.level})):null}(function(){var e,t=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{e=n.set,e.call(t,r)}catch(e){}if(Object.getPrototypeOf(t)===r)return{set:e,level:2}}return t.__proto__=r,Object.getPrototypeOf(t)===r?{level:2}:(t={},t.__proto__=r,Object.getPrototypeOf(t)===r&&{level:1})}()),r(65)},function(e,t,r){"use strict";var n=Object.create,o=Object.getPrototypeOf,i={};e.exports=function(){var e=Object.setPrototypeOf,t=arguments[0]||n;return"function"==typeof e&&o(e(t(null),i))===i}},function(e,t,r){"use strict";var n=r(70),o=Math.max;e.exports=function(e){return o(0,n(e))}},function(e,t,r){"use strict";e.exports=function(){}},function(e,t,r){"use strict";var n=r(1);e.exports=function(){return n(this).length=0,this}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.notSupportedError=new Error("Not supported.");var n=function(){function e(){this.supportsVolumeAutomation=!0,this.syncConfig={}}return e}();t.BaseController=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e}();t.BaseStreamUrlRetriever=n},function(e,t,r){"use strict";function n(e){return new i({startPos:0,endPos:e,startLevel:0,endLevel:1,fromEnd:!1})}function o(e){return new i({startPos:e,endPos:0,startLevel:1,endLevel:0,fromEnd:!0})}Object.defineProperty(t,"__esModule",{value:!0}),t.buildFadeIn=n,t.buildFadeOut=o;var i=function(){function e(e){var t=e.startPos,r=e.endPos,n=e.startLevel,o=e.endLevel,i=e.fromEnd,a=void 0!==i&&i;if(t<0)throw new Error("startPos invalid.");if(r<0||!a&&r<t||a&&t<r)throw new Error("endPos invalid.");if(n<0||n>1)throw new Error("startLevel invalid.");if(o<0||o>1)throw new Error("endLevel invalid.");this._startPos=t,this._endPos=r,this._startLevel=n,this._endLevel=o,this._fromEnd=a}return e.prototype.calculate=function(e,t){var r=this._fromEnd?t-500-this._startPos:this._startPos,n=this._fromEnd?t-500-this._endPos:this._endPos;if(e<r)return{level:this._startLevel,nextCalculatePosition:r-e};if(e<=n){var o=(e-r)/(n-r),i=Math.cos(o*Math.PI)/-2+.5,a=this._startLevel+(this._endLevel-this._startLevel)*i;return{level:a,nextCalculatePosition:e}}return{level:this._endLevel,nextCalculatePosition:1/0}},e}();t.Fade=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(6),i=r(15),a=r(14);!function(e){e.NotSupportedError=o.NotSupportedError,e.NoStreamsError=i.NoStreamsError,e.FailedRetrievingUrlError=a.FailedRetrievingUrlError}(n=t.errors||(t.errors={}))},function(e,t,r){"use strict";function n(e){switch(e){case o.SQ:return o.SQ;case o.HQ:return o.HQ}return null}Object.defineProperty(t,"__esModule",{value:!0});var o;!function(e){e.SQ="sq",e.HQ="hq"}(o=t.Quality||(t.Quality={})),t.resolveQuality=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=1500,i=function(){function e(e){var t=this;this._player=e,this._onConnectionRequired=new n.eventDispatcher.EventDispatcher,this._onConnectionRecovered=new n.eventDispatcher.EventDispatcher,this._connectionRequired=!1,this._connectionLossTimer=null,this.onConnectionRequired=this._onConnectionRequired.getHandle(),this.onConnectionRecovered=this._onConnectionRecovered.getHandle();var r=function(){return t._calculateIfConnectionRequired()};window.addEventListener("online",r),window.addEventListener("offline",r),this._calculateIfConnectionRequired(),e.onChange.subscribe(function(n){var o=n.loading,i=n.dead;i&&null!==t._connectionLossTimer&&(window.clearTimeout(t._connectionLossTimer),window.removeEventListener("online",r),window.removeEventListener("offline",r)),e.isDead()||void 0===o||t._calculateIfConnectionRequired()})}return e.prototype.isConnectionRequired=function(){return this._connectionRequired},e.prototype._calculateIfConnectionRequired=function(){var e=this,t=this._player.isLoading()&&"navigator"in window&&!window.navigator.onLine;t?null===this._connectionLossTimer&&(this._connectionLossTimer=window.setTimeout(function(){e._connectionLossTimer=null,e._connectionRequired=!0,e._onConnectionRequired.dispatch(void 0)},o)):this._connectionRequired?(this._connectionRequired=!1,this._onConnectionRecovered.dispatch(void 0)):null!==this._connectionLossTimer&&(window.clearTimeout(this._connectionLossTimer),this._connectionLossTimer=null)},e}();t.ConnectionRequiredHelper=i},function(e,t,r){"use strict";function n(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="",r=0;r<20;r++)t+=e.charAt(Math.floor(Math.random()*e.length));return t}Object.defineProperty(t,"__esModule",{value:!0}),t.generateLogId=n},function(e,t,r){"use strict";function n(e,t){return void 0!==e?e:t}function o(e){if(!(e.streamUrlRetriever instanceof i.BaseStreamUrlRetriever))throw new Error("StreamUrlRetriever invalid.");if(void 0!==e.duration&&("number"!=typeof e.duration||e.duration<0))throw new Error("duration invalid.");if(void 0!==e.getURLOpts&&"object"!=typeof e.getURLOpts)throw new Error("getURLOpts invalid.");if(void 0!==e.preloadingEnabled&&"boolean"!=typeof e.preloadingEnabled)throw new Error("preloadingEnabled invalid.");if(void 0!==e.fadeOnPauseAndPlay&&"boolean"!=typeof e.fadeOnPauseAndPlay)throw new Error("fadeOnPauseAndPlay invalid.");if(void 0!==e.fadeOnSeek&&"boolean"!=typeof e.fadeOnSeek)throw new Error("fadeOnSeek invalid.");if(void 0!==e.mediaSessionEnabled&&"boolean"!=typeof e.mediaSessionEnabled)throw new Error("mediaSessionEnabled invalid.");if(void 0!==e.pausedMaxBufferLength&&("number"!=typeof e.pausedMaxBufferLength||e.pausedMaxBufferLength<0))throw new Error("pausedMaxBufferLength invalid.");if(void 0!==e.playingMaxBufferLength&&("number"!=typeof e.playingMaxBufferLength||e.playingMaxBufferLength<0))throw new Error("playingMaxBufferLength invalid.");if(void 0!==e.logger&&"function"!=typeof e.logger&&"object"!=typeof e.logger)throw new Error("logger invalid.");if(void 0!==e.audioReporter&&"function"!=typeof e.audioReporter)throw new Error("audioReporter invalid.");if(void 0!==e.audioCheckpointInterval&&("number"!=typeof e.audioCheckpointInterval||e.audioCheckpointInterval<0))throw new Error("audioCheckpointInterval invalid.");if(void 0!==e.audioPerformanceReporter&&"function"!=typeof e.audioPerformanceReporter)throw new Error("audioPerformanceReporter invalid.");if(void 0!==e.errorReporter&&"function"!=typeof e.errorReporter)throw new Error("errorReporter invalid.");if(void 0!==e.urlProviderRetryDelayCalculator&&"function"!=typeof e.urlProviderRetryDelayCalculator)throw new Error("urlProviderRetryDelayCalculator invalid.");return{controllers:e.controllers,streamUrlRetriever:e.streamUrlRetriever,getURLOpts:n(e.getURLOpts,{}),preloadingEnabled:n(e.preloadingEnabled,!1),pausedMaxBufferLength:n(e.pausedMaxBufferLength,2e3),playingMaxBufferLength:n(e.playingMaxBufferLength,9e4),fadeOnPauseAndPlay:n(e.fadeOnPauseAndPlay,!1),fadeOnSeek:n(e.fadeOnSeek,!1),audioCheckpointInterval:n(e.audioCheckpointInterval,3e4),urlProviderRetryDelayCalculator:n(e.urlProviderRetryDelayCalculator,a.helpers.retry.buildExponentialDelayCalculator()),streamUrlsExpire:n(e.streamUrlsExpire,!0),fetchEnabled:n(e.fetchEnabled,!0),duration:e.duration,audioReporter:e.audioReporter,audioPerformanceReporter:e.audioPerformanceReporter,errorReporter:e.errorReporter}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(25),a=r(0);t.validatePlayerDependencies=o},function(e,t,r){"use strict";function n(e){var r=e.streamUrlRetriever,n=e.getURLOpts,a=e.logger,s=e.urlProviderRetryDelayCalculator,u=new o.helpers.abortableJob.AbortableJob(function(){var e=o.helpers.deferred.buildDeferred(),u=o.helpers.retry.retry(s,function(t){var s=t.scheduleRetry,u=r.getUrl(n);return a.debug("Retrieving a URL..."),u.onCompletion(function(t){t?t.rendition&&i.allRenditions.indexOf(t.rendition)<0?(a.warn("Unknown rendition. Skipping...",t.rendition),r.excludeRendition(t.rendition),s()):!t.success&&t.error.isTransient()?(a.warn("Transient error retrieving url.",t.error),s()):e.resolve(t):(a.debug("No URL provided."),e.resolve(null))}),u.onError(function(t){t!==o.helpers.abortableJob.abortedError&&a.error("Error retrieving URL.",t),e.reject(t)}),{onCancel:function(){return u.abort()}}},{onNoMoreRetries:function(){return e.reject(t.NoMoreAttemptsError)}}).cancel;return{result:e.promise,abort:function(){return u()}}});return u.run()}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(13);t.NoMoreAttemptsError=new Error("No more attempts to retrieve URL."),t.retrieveUrl=n},function(e,t,r){"use strict";function n(e,t){var r=e.getMemoryCacheController();r&&r.setMaxCacheSize(t)}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=2e4,a=function(){function e(e,t){this._maxCacheSize=e,this._players=[],this._updateTimer=null,this._logger=o.logger.prefixLogger(t,"CacheManager"),this._logger.debug("Initialized with cache size "+e+" bytes.")}return e.prototype.setCacheSize=function(e){this._maxCacheSize!==e&&(this._logger.debug("Updating cache size to "+e+" bytes."),this._maxCacheSize=e,this._update())},e.prototype.addPlayer=function(e){var t=this;if(this._logger.debug("Adding player to cache manager."),e.isDead())return void this._logger.debug("Player was dead.");var r=this._players;e.onChange.subscribe(function(n){var o=n.playing,i=n.dead;i===!0?(t._logger.debug("Removing player that became dead."),r.splice(r.indexOf(e),1),t._update()):o===!0?(t._logger.debug("Updating because player started playing."),r.splice(r.indexOf(e),1),r.unshift(e),t._update()):o===!1&&(t._logger.debug("Updating because player became paused."),t._update())}),e.isPlaying()?r.unshift(e):r.push(e),this._update()},e.prototype._update=function(){var e=this;if(this._updateTimer&&(window.clearTimeout(this._updateTimer),this._updateTimer=null),0===this._players.length)return void this._logger.debug("There are no longer any players to manage.");var t=this._players.reduce(function(e,t){return t.isPlaying()?e.playingPlayers.push(t):e.pausedPlayers.push(t),e},{playingPlayers:[],pausedPlayers:[]}),r=t.playingPlayers,o=t.pausedPlayers,a=r.reduce(function(e,t){return e+(t.getMemoryCacheUsage()||0)},0),s=o.reduce(function(e,t){return e+(t.getMemoryCacheUsage()||0)},0);if(a>this._maxCacheSize){this._logger.debug("All playing players are using more than the max cache size. Cleaning...",a,this._maxCacheSize);var u=this._maxCacheSize/r.length;r.forEach(function(e){return n(e,u)}),o.forEach(function(e){return n(e,0)})}else this._logger.debug("Recalculating cache sizes...",a+s,this._maxCacheSize),r.concat(o).reduce(function(t,r){return n(r,Math.max(0,e._maxCacheSize-t)),t+(r.getMemoryCacheUsage()||0)},0);this._updateTimer=window.setTimeout(function(){return e._update()},i)},e}();t.CacheManager=a},function(e,t,r){"use strict";e.exports=function(){return"undefined"!=typeof Map&&"[object Map]"===Object.prototype.toString.call(new Map)}()},function(e,t,r){"use strict";var n=Array.prototype.forEach,o=Object.create;e.exports=function(e){var t=o(null);return n.call(arguments,function(e){t[e]=!0}),t}},function(e,t,r){"use strict";e.exports=r(35)("key","value","key+value")},function(e,t,r){"use strict";var n,o=r(9),i=r(4),a=r(10),s=r(3).toStringTag,u=r(36),l=Object.defineProperties,c=a.prototype._unBind;n=e.exports=function(e,t){return this instanceof n?(a.call(this,e.__mapKeysData__,e),t&&u[t]||(t="key+value"),void l(this,{__kind__:i("",t),__values__:i("w",e.__mapValuesData__)})):new n(e,t)},o&&o(n,a),n.prototype=Object.create(a.prototype,{constructor:i(n),_resolve:i(function(e){return"value"===this.__kind__?this.__values__[e]:"key"===this.__kind__?this.__list__[e]:[this.__list__[e],this.__values__[e]]}),_unBind:i(function(){this.__values__=null,c.call(this)}),toString:i(function(){return"[object Map Iterator]"})}),Object.defineProperty(n.prototype,s,i("c","Map Iterator"))},function(e,t,r){"use strict";var n,o=r(9),i=r(4),a=r(3),s=r(10),u=Object.defineProperty;n=e.exports=function(e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");e=String(e),s.call(this,e),u(this,"__length__",i("",e.length))},o&&o(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:i(function(){if(this.__list__)return this.__nextIndex__<this.__length__?this.__nextIndex__++:void this._unBind()}),_resolve:i(function(e){var t,r=this.__list__[e];return this.__nextIndex__===this.__length__?r:(t=r.charCodeAt(0),t>=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,a.toStringTag,i("c","String Iterator"))},function(e,t,r){"use strict";var n=r(2),o=r(1),i=Function.prototype.bind,a=Function.prototype.call,s=Object.keys,u=Object.prototype.propertyIsEnumerable;e.exports=function(e,t){return function(r,l){var c,d=arguments[2],p=arguments[3];return r=Object(o(r)),n(l),c=s(r),p&&c.sort("function"==typeof p?i.call(p,r):void 0),"function"!=typeof e&&(e=c[e]),a.call(e,c,function(e,n){return u.call(r,e)?a.call(l,d,r[e],e,r,n):t})}}},function(e,t,r){"use strict";e.exports=r(39)("forEach")},function(e,t,r){"use strict";var n=r(2),o=r(40),i=Function.prototype.call;e.exports=function(e,t){var r={},a=arguments[2];return n(t),o(e,function(e,n,o,s){r[n]=i.call(t,a,e,n,o,s)}),r}},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call(r(22));e.exports=function(e){return"function"==typeof e&&n.call(e)===o}},function(e,t,r){"use strict";var n=r(3).iterator,o=r(8),i=r(42),a=r(21),s=r(2),u=r(1),l=r(5),c=r(7),d=Array.isArray,p=Function.prototype.call,f={configurable:!0,enumerable:!0,writable:!0,value:null},h=Object.defineProperty;e.exports=function(e){var t,r,_,g,y,v,m,E,b,w,P=arguments[1],S=arguments[2];if(e=Object(u(e)),l(P)&&s(P),this&&this!==Array&&i(this))t=this;else{if(!P){if(o(e))return y=e.length,1!==y?Array.apply(null,e):(g=new Array(1),g[0]=e[0],g);if(d(e)){for(g=new Array(y=e.length),r=0;r<y;++r)g[r]=e[r];return g}}g=[]}if(!d(e))if(void 0!==(b=e[n])){for(m=s(b).call(e),t&&(g=new t),E=m.next(),r=0;!E.done;)w=P?p.call(P,S,E.value,r):E.value,t?(f.value=w,h(g,r,f)):g[r]=w,E=m.next(),++r;y=r}else if(c(e)){for(y=e.length,t&&(g=new t),r=0,_=0;r<y;++r)w=e[r],r+1<y&&(v=w.charCodeAt(0),v>=55296&&v<=56319&&(w+=e[++r])),w=P?p.call(P,S,w,_):w,t?(f.value=w,h(g,_,f)):g[_]=w,++_;y=_}if(void 0===y)for(y=a(e.length),t&&(g=new t(y)),r=0;r<y;++r)w=P?p.call(P,S,e[r],r):e[r],t?(f.value=w,h(g,r,f)):g[r]=w;return t&&(f.value=null,g.length=y),g}},function(e,t,r){"use strict";e.exports=function(){var e,t,r=Array.from;return"function"==typeof r&&(e=["raz","dwa"],t=r(e),Boolean(t&&t!==e&&"dwa"===t[1]))}},function(e,t,r){"use strict";e.exports=r(44)()?Array.from:r(43)},function(e,t,r){"use strict";var n=r(45),o=r(11),i=r(1);e.exports=function(e){var t=Object(i(e)),r=arguments[1],a=Object(arguments[2]);if(t!==e&&!r)return t;var s={};return r?n(r,function(t){(a.ensure||t in e)&&(s[t]=e[t])}):o(s,e),s}},function(e,t,r){"use strict";var n,o=r(46),i=r(18),a=r(2),s=r(41),u=r(2),l=r(1),c=Function.prototype.bind,d=Object.defineProperty,p=Object.prototype.hasOwnProperty;n=function(e,t,r){var n,i=l(t)&&u(t.value);return n=o(t),delete n.writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&p.call(this,e)?i:(t.value=c.call(i,r.resolveContext?r.resolveContext(this):this),d(this,e,t),this[e])},n},e.exports=function(e){var t=i(arguments[1]);return null!=t.resolveContext&&a(t.resolveContext),s(e,function(e,r){return n(r,e,t)})}},function(e,t,r){"use strict";var n,o=r(9),i=r(17),a=r(4),s=r(3),u=r(10),l=Object.defineProperty;n=e.exports=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,e),t=t?i.call(t,"key+value")?"key+value":i.call(t,"key")?"key":"value":"value",l(this,"__kind__",a("",t))},o&&o(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:a(function(e){return"value"===this.__kind__?this.__list__[e]:"key+value"===this.__kind__?[e,this.__list__[e]]:e})}),l(n.prototype,s.toStringTag,a("c","Array Iterator"))},function(e,t,r){"use strict";var n=r(8),o=r(7),i=r(48),a=r(38),s=r(16),u=r(3).iterator;e.exports=function(e){return"function"==typeof s(e)[u]?e[u]():n(e)?new i(e):o(e)?new a(e):new i(e)}},function(e,t,r){"use strict";var n=r(8),o=r(2),i=r(7),a=r(49),s=Array.isArray,u=Function.prototype.call,l=Array.prototype.some;e.exports=function(e,t){var r,c,d,p,f,h,_,g,y=arguments[2];if(s(e)||n(e)?r="array":i(e)?r="string":e=a(e),o(t),d=function(){p=!0},"array"===r)return void l.call(e,function(e){return u.call(t,y,e,d),p});if("string"!==r)for(c=e.next();!c.done;){if(u.call(t,y,c.value,d),p)return;c=e.next()}else for(h=e.length,f=0;f<h&&(_=e[f],f+1<h&&(g=_.charCodeAt(0),g>=55296&&g<=56319&&(_+=e[++f])),u.call(t,y,_,d),!p);++f);}},function(e,t,r){"use strict";var n=r(8),o=r(5),i=r(7),a=r(3).iterator,s=Array.isArray;e.exports=function(e){return!(!o(e)||!s(e)&&!i(e)&&!n(e)&&"function"!=typeof e[a])}},function(e,t,r){"use strict";e.exports=function(e){return!!e&&("symbol"==typeof e||!!e.constructor&&"Symbol"===e.constructor.name&&"Symbol"===e[e.constructor.toStringTag])}},function(e,t,r){"use strict";var n=r(52);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not a symbol");return e}},function(e,t,r){"use strict";var n,o,i,a,s=r(4),u=r(53),l=Object.create,c=Object.defineProperties,d=Object.defineProperty,p=Object.prototype,f=l(null);if("function"==typeof Symbol){n=Symbol;try{String(n()),a=!0}catch(e){}}var h=function(){var e=l(null);return function(t){for(var r,n,o=0;e[t+(o||"")];)++o;return t+=o||"",e[t]=!0,r="@@"+t,d(p,r,s.gs(null,function(e){n||(n=!0,d(this,r,s(e)),n=!1)})),r}}();i=function(e){if(this instanceof i)throw new TypeError("Symbol is not a constructor");return o(e)},e.exports=o=function e(t){var r;if(this instanceof e)throw new TypeError("Symbol is not a constructor");return a?n(t):(r=l(i.prototype),t=void 0===t?"":String(t),c(r,{__description__:s("",t),__name__:s("",h(t))}))},c(o,{for:s(function(e){return f[e]?f[e]:f[e]=o(String(e))}),keyFor:s(function(e){var t;u(e);for(t in f)if(f[t]===e)return t}),hasInstance:s("",n&&n.hasInstance||o("hasInstance")),isConcatSpreadable:s("",n&&n.isConcatSpreadable||o("isConcatSpreadable")),iterator:s("",n&&n.iterator||o("iterator")),match:s("",n&&n.match||o("match")),replace:s("",n&&n.replace||o("replace")),search:s("",n&&n.search||o("search")),species:s("",n&&n.species||o("species")),split:s("",n&&n.split||o("split")),toPrimitive:s("",n&&n.toPrimitive||o("toPrimitive")),toStringTag:s("",n&&n.toStringTag||o("toStringTag")),unscopables:s("",n&&n.unscopables||o("unscopables"))}),c(i.prototype,{constructor:s(o),toString:s("",function(){return this.__name__})}),c(o.prototype,{toString:s(function(){return"Symbol ("+u(this).__description__+")"}),valueOf:s(function(){return u(this)})}),d(o.prototype,o.toPrimitive,s("",function(){var e=u(this);return"symbol"==typeof e?e:e.toString()})),d(o.prototype,o.toStringTag,s("c","Symbol")),d(i.prototype,o.toStringTag,s("c",o.prototype[o.toStringTag])),d(i.prototype,o.toPrimitive,s("c",o.prototype[o.toPrimitive]))},function(e,t,r){"use strict";var n={object:!0,symbol:!0};e.exports=function(){var e;if("function"!=typeof Symbol)return!1;e=Symbol("test symbol");try{String(e)}catch(e){return!1}return!!n[typeof Symbol.iterator]&&!!n[typeof Symbol.toPrimitive]&&!!n[typeof Symbol.toStringTag]}},function(e,t,r){"use strict";var n,o,i,a,s,u,l,c=r(4),d=r(2),p=Function.prototype.apply,f=Function.prototype.call,h=Object.create,_=Object.defineProperty,g=Object.defineProperties,y=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};n=function(e,t){var r;return d(t),y.call(this,"__ee__")?r=this.__ee__:(r=v.value=h(null),_(this,"__ee__",v),v.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},o=function(e,t){var r,o;return d(t),o=this,n.call(this,e,r=function(){i.call(o,e,r),p.call(t,this,arguments)}),r.__eeOnceListener__=t,this},i=function(e,t){var r,n,o,i;if(d(t),!y.call(this,"__ee__"))return this;if(r=this.__ee__,!r[e])return this;if(n=r[e],"object"==typeof n)for(i=0;o=n[i];++i)o!==t&&o.__eeOnceListener__!==t||(2===n.length?r[e]=n[i?0:1]:n.splice(i,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},a=function(e){var t,r,n,o,i;if(y.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(r=arguments.length,i=new Array(r-1),t=1;t<r;++t)i[t-1]=arguments[t];for(o=o.slice(),t=0;n=o[t];++t)p.call(n,this,i)}else switch(arguments.length){case 1:f.call(o,this);break;case 2:f.call(o,this,arguments[1]);break;case 3:f.call(o,this,arguments[1],arguments[2]);break;default:for(r=arguments.length,i=new Array(r-1),t=1;t<r;++t)i[t-1]=arguments[t];p.call(o,this,i)}},s={on:n,once:o,off:i,emit:a},u={on:c(n),once:c(o),off:c(i),emit:c(a)},l=g({},u),e.exports=t=function(e){return null==e?h(l):g(Object(e),u)},t.methods=s},function(e,t,r){"use strict";var n=String.prototype.indexOf;e.exports=function(e){return n.call(this,e,arguments[1])>-1}},function(e,t,r){"use strict";var n="razdwatrzy";e.exports=function(){return"function"==typeof n.contains&&n.contains("dwa")===!0&&n.contains("foo")===!1}},function(e,t,r){"use strict";e.exports=function(e){return"function"==typeof e}},function(e,t,r){"use strict";var n=r(5),o=Object.keys;e.exports=function(e){return o(n(e)?Object(e):e)}},function(e,t,r){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,r){"use strict";e.exports=r(61)()?Object.keys:r(60)},function(e,t,r){"use strict";var n=r(62),o=r(1),i=Math.max;e.exports=function(e,t){var r,a,s,u=i(arguments.length,2);for(e=Object(o(e)),s=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},a=1;a<u;++a)t=arguments[a],n(t).forEach(s);if(void 0!==r)throw r;return e}},function(e,t,r){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(e={foo:"raz"},t(e,{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,r){"use strict";var n,o=Object.create;r(20)()||(n=r(19)),e.exports=function(){var e,t,r;return n?1!==n.level?o:(e={},t={},r={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(e){return"__proto__"===e?void(t[e]={configurable:!0,enumerable:!1,writable:!0,value:void 0}):void(t[e]=r)}),Object.defineProperties(e,t),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:e}),function(t,r){return o(null===t?e:t,r)}):o}()},function(e,t,r){"use strict";var n=r(5),o={function:!0,object:!0};e.exports=function(e){return n(e)&&o[typeof e]||!1};
23851
+ },function(e,t,r){"use strict";e.exports=function(e){return e=Number(e),isNaN(e)||0===e?e:e>0?1:-1}},function(e,t,r){"use strict";e.exports=function(){var e=Math.sign;return"function"==typeof e&&1===e(10)&&e(-20)===-1}},function(e,t,r){"use strict";e.exports=r(68)()?Math.sign:r(67)},function(e,t,r){"use strict";var n=r(69),o=Math.abs,i=Math.floor;e.exports=function(e){return isNaN(e)?0:(e=Number(e),0!==e&&isFinite(e)?n(e)*i(o(e)):e)}},function(e,t,r){"use strict";e.exports=function(e){return e!==e}},function(e,t,r){"use strict";e.exports=function(){var e=Number.isNaN;return"function"==typeof e&&!e({})&&e(NaN)&&!e(34)}},function(e,t,r){"use strict";e.exports=r(72)()?Number.isNaN:r(71)},function(e,t,r){"use strict";var n=r(73),o=r(21),i=r(1),a=Array.prototype.indexOf,s=Object.prototype.hasOwnProperty,u=Math.abs,l=Math.floor;e.exports=function(e){var t,r,c,d;if(!n(e))return a.apply(this,arguments);for(r=o(i(this).length),c=arguments[1],c=isNaN(c)?0:c>=0?l(c):o(this.length)-l(u(c)),t=c;t<r;++t)if(s.call(this,t)&&(d=this[t],n(d)))return t;return-1}},function(e,t,r){"use strict";var n,o=r(23),i=r(74),a=r(9),s=r(2),u=r(1),l=r(4),c=r(56),d=r(3),p=r(16),f=r(50),h=r(37),_=r(34),g=Function.prototype.call,y=Object.defineProperties,v=Object.getPrototypeOf;e.exports=n=function(){var e,t,r,o=arguments[0];if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");return r=_&&a&&Map!==n?a(new Map,v(this)):this,null!=o&&p(o),y(r,{__mapKeysData__:l("c",e=[]),__mapValuesData__:l("c",t=[])}),o?(f(o,function(r){var n=u(r)[0];r=r[1],i.call(e,n)===-1&&(e.push(n),t.push(r))},r),r):r},_&&(a&&a(n,Map),n.prototype=Object.create(Map.prototype,{constructor:l(n)})),c(y(n.prototype,{clear:l(function(){this.__mapKeysData__.length&&(o.call(this.__mapKeysData__),o.call(this.__mapValuesData__),this.emit("_clear"))}),delete:l(function(e){var t=i.call(this.__mapKeysData__,e);return t!==-1&&(this.__mapKeysData__.splice(t,1),this.__mapValuesData__.splice(t,1),this.emit("_delete",t,e),!0)}),entries:l(function(){return new h(this,"key+value")}),forEach:l(function(e){var t,r,n=arguments[1];for(s(e),t=this.entries(),r=t._next();void 0!==r;)g.call(e,n,this.__mapValuesData__[r],this.__mapKeysData__[r],this),r=t._next()}),get:l(function(e){var t=i.call(this.__mapKeysData__,e);if(t!==-1)return this.__mapValuesData__[t]}),has:l(function(e){return i.call(this.__mapKeysData__,e)!==-1}),keys:l(function(){return new h(this,"key")}),set:l(function(e,t){var r,n=i.call(this.__mapKeysData__,e);return n===-1&&(n=this.__mapKeysData__.push(e)-1,r=!0),this.__mapValuesData__[n]=t,r&&this.emit("_add",n,e),this}),size:l.gs(function(){return this.__mapKeysData__.length}),values:l(function(){return new h(this,"value")}),toString:l(function(){return"[object Map]"})})),Object.defineProperty(n.prototype,d.iterator,l(function(){return this.entries()})),Object.defineProperty(n.prototype,d.toStringTag,l("c","Map"))},function(e,t,r){"use strict";e.exports=function(){var e,t,r;if("function"!=typeof Map)return!1;try{e=new Map([["raz","one"],["dwa","two"],["trzy","three"]])}catch(e){return!1}return"[object Map]"===String(e)&&3===e.size&&"function"==typeof e.clear&&"function"==typeof e.delete&&"function"==typeof e.entries&&"function"==typeof e.forEach&&"function"==typeof e.get&&"function"==typeof e.has&&"function"==typeof e.keys&&"function"==typeof e.set&&"function"==typeof e.values&&(t=e.entries(),r=t.next(),r.done===!1&&!!r.value&&"raz"===r.value[0]&&"one"===r.value[1])}},function(e,t,r){"use strict";e.exports=r(76)()?Map:r(75)},function(e,t,r){"use strict";function n(e){var t=e.split("//",2);return 1===t.length?t[0].split("/",1)[0]:t[1]?t[1].split("/",1)[0]:""}function o(e){var t=l.exec(e);return t&&t[0]||""}function i(e,t,r){return{name:t.name,preset:e.preset,bitrate:e.bitrate,protocol:e.rendition.scProtocol,host:n(r),url:o(r),format:e.rendition.scFormat,quality:e.quality}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(77),s=r(0),u=r(24),l=/^[^?#]*/,c=function(){function e(e){var t=e.logger,r=e.controllers,n=e.playerId,o=e.streamUrlsExpire,i=e.fetchEnabled,u=e.fadeOnPauseAndPlay,l=e.fadeOnSeek,c=e.cacheManager,d=e.providePlayer,p=e.removePlayer,f=e.streamUrlRetriever,h=e.getURLOpts,_=e.errorEventGenerator,g=e.audioPerformanceEventGenerator;this._quality=null,this._onQualityChanged=new s.eventDispatcher.EventDispatcher,this._controllerIndexByRendition=new a,this._controlledPlayerWithRendition=null,this.onQualityChanged=this._onQualityChanged.getHandle(),this._logger=s.logger.prefixLogger(t,"ControllerManager"),this._controllers=r,this._playerId=n,this._streamUrlsExpire=o,this._fetchEnabled=i,this._fadeOnPauseAndPlay=u,this._fadeOnSeek=l,this._cacheManager=c,this._providePlayer=d,this._removePlayer=p,this._streamUrlRetriever=f,this._getURLOpts=h,this._errorEventGenerator=_||null,this._audioPerformanceEventGenerator=g||null}return e.prototype.buildNextController=function(e,t){var r=this;if(this._controlledPlayerWithRendition)throw new Error("A player is already being controlled.");this._logger.debug("Building next controller.");var n=this._controllerIndexByRendition.get(e.rendition)||0;if(n>=this._controllers.length)this._logger.debug("No more controllers for this rendition."),t({excludeRendition:!0,immediateRetry:!0});else{var o=!1,i=function(i){if(o)throw new Error("performNextAction() already called");o=!0,"MOVE_ON"!==i&&"MOVE_ON_SAME_RENDITION"!==i||(r._logger.debug("Controller will not be used again."),r._controllerIndexByRendition.set(e.rendition,n+1)),"MOVE_ON_SAME_RENDITION"===i?r.buildNextController(e,t):t({excludeRendition:!1,immediateRetry:"MOVE_ON"===i})};this._manageController(e,this._controllers[n],i)}},e.prototype.releaseCurrentController=function(e){var t=e.retry;if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");this._controlledPlayerWithRendition.releaseControl({retry:t})},e.prototype.getQuality=function(){return this._quality},e.prototype.getPlayerDetails=function(){if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");var e=this._controlledPlayerWithRendition,t=e.initialUrlAndRendition,r=e.controller,n=e.controlledPlayer;return i(t,r,n.getUrl())},e.prototype._manageController=function(e,t,r){var n=this,o=function(){n._removePlayer(),n._controlledPlayerWithRendition=null,a&&a.kill()};if(this._logger.debug("Preparing controller.",t.name),!t.isRenditionSupported(e.rendition,{streamUrlExpires:this._streamUrlsExpire}))return this._logger.debug("Skipping controller because rendition not supported."),void r("MOVE_ON_SAME_RENDITION");var a,l=!1,c=function(e){var t=e.retry;l||(l=!0,n._logger.debug("Releasing control."),o(),r(t?"RETRY":"MOVE_ON"))};try{this._logger.debug("Building player.");var d=t.buildPlayer({logger:s.logger.prefixLogger(this._logger,t.name+"-Controller"),playerId:this._playerId,urlAndRendition:e,streamUrlExpires:this._streamUrlsExpire,fetchEnabled:this._fetchEnabled,releaseControl:c,fadeOnPauseAndPlay:this._fadeOnPauseAndPlay,fadeOnSeek:this._fadeOnSeek,getNewUrl:function(){return n._getNewUrlWithSameRendition(e.rendition)},reportError:function(r){n._errorEventGenerator&&n._errorEventGenerator.reportManualEvent(r,i(e,t,d?d.getUrl():e.url))},reportPerformance:function(e){!l&&n._audioPerformanceEventGenerator&&n._audioPerformanceEventGenerator.reportManualEvent(e)}});if(a=d.getPlayer(),l)this._logger.warn("Player released during constrution."),a.kill();else if(a.isDead()){var p=a.getFatalError();p instanceof s.errors.NotSupportedError?this._logger.debug("Player not supported (during construction)."):this._logger.error("Error during construction.",p),r("MOVE_ON_SAME_RENDITION")}else{this._logger.debug("Player built."),a.onChange.subscribe(function(e){var t=e.dead,r=e.fatalError;t&&(r&&n._logger.error("Fatal player error occurred.",r),c({retry:!1}))}),this._cacheManager.addPlayer(a),this._controlledPlayerWithRendition={controller:t,controlledPlayer:d,initialUrlAndRendition:e,releaseControl:c},this._providePlayer(d.getPlayer(),t.syncConfig,t.supportsVolumeAutomation),this._logger.debug("Player provided to proxy.");var f=e.quality||null;this._quality!==f&&(this._logger.debug("Quality changed.",f),this._quality=f,this._onQualityChanged.dispatch(f))}}catch(e){e===u.notSupportedError?this._logger.debug("Player not supported. Not constructed."):this._logger.error("Error during construction.",e),o(),r("MOVE_ON_SAME_RENDITION")}},e.prototype._getNewUrlWithSameRendition=function(e){var t=this,r=new s.helpers.abortableJob.AbortableJob(function(){var r=t._streamUrlRetriever.getUrl(t._getURLOpts),n=r.whenComplete().then(function(t){var r=null;return t&&t.success&&t.rendition===e&&(r=t.url),r});return{result:n,abort:function(){return r.abort()}}});return r.run()},e}();t.ControllerManager=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(12),i=1e3,a=function(){function e(e,t,r,o,a){this._checkpointTimer=null,this._logger=n.logger.prefixLogger(o,"AudioEventGenerator"),this._player=e,this._eventReporter=t,this._checkpointInterval=Math.max(i,r),this._getPlayerDetails=a,this._startReporting()}return e.prototype._startReporting=function(){var e=this,t=this._player;t.onChange.subscribe(function(r){var n=r.actuallyPlaying,o=r.ended;n===!0&&!t.isEnded()||o===!1&&t.isActuallyPlaying()?(e._checkpointTimer||(e._checkpointTimer=window.setInterval(function(){e._reportEvent("checkpoint")},e._checkpointInterval)),e._reportEvent("play")):(n===!1&&!t.isEnded()||o===!0&&t.isActuallyPlaying())&&(e._checkpointTimer&&(window.clearInterval(e._checkpointTimer),e._checkpointTimer=null),e._reportEvent("pause"))})},e.prototype._reportEvent=function(e){var t=this._getPlayerDetails();if(!t)return void this._logger.warn("Cannot report event because there is no player.",e);var r=this._player.getDuration();if(null===r)throw new Error("Duration should exist now.");var n={type:e,position:this._player.getPosition(),duration:r,preset:t.preset,quality:t.quality,playerType:t.name,appState:o.getAppState()};this._logger.debug("Generated audio event.",n),this._eventReporter(n)},e}();t.AudioEventGenerator=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this._delayFactor=0,this._lastRequestTime=0}return e.prototype.getDelay=function(e){var t=void 0===e?{}:e,r=t.maxDelay,n=void 0===r?3e4:r,o=t.numInstantRuns,i=void 0===o?5:o,a=Date.now()-this._lastRequestTime;this._lastRequestTime=Date.now(),this._delayFactor=Math.max(0,this._delayFactor-a/n),this._delayFactor++;var s=this._delayFactor-i;return s>0?Math.pow(2,s):0},e}();t.DecayingExponentialDelayCalculator=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(12),i=function(){function e(e,t,r,o,i,a){this._logger=n.logger.prefixLogger(a,"ErrorGenerator"),this._player=e,this._logCollector=t,this._logId=r,this._trackId=o,this._eventReporter=i,this._listenForProxyFatalError()}return e.prototype.reportManualEvent=function(e,t){"NOT_SUPPORTED_ERROR"!==e&&"HLS_MSE_PLAYER.NO_TRANSMUXER_ERROR"!==e&&(this._logger.debug("Reporting manual error event.",e),this._reportEvent(e,t))},e.prototype._listenForProxyFatalError=function(){var e=this;this._player.onError.subscribe(function(t){t instanceof n.errors.PlayerFatalError&&e._reportEvent(t.getCode())})},e.prototype._reportEvent=function(e,t){var r={errorCode:e,log:this._logCollector.getLog(),logId:this._logId,trackId:this._trackId,protocol:t&&t.protocol,playerType:t&&t.name?t.name:"MaestroUnknown",host:t&&t.host,bitrate:t&&t.bitrate,format:t&&t.format,preset:t&&t.preset,quality:t&&t.quality,url:t&&t.url,appState:o.getAppState()};this._logger.debug("Generated audio error event.",r),this._eventReporter(r)},e}();t.ErrorEventGenerator=i},function(e,t,r){"use strict";function n(e,t){var r=e.getBufferedTimeRanges();return r?a(r,function(e){return e.containsTime(t)})||new o.TimeRange(t,0):null}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=2e3,a=o.helpers.find,s=function(){function e(e){var t=e.proxy,r=e.getPlayer;this._getPlayer=r;var o=this._position=t.getPosition(),i=this._initialActualPlayer=r();if(i){var a=n(i,o);a?this._initialBuffered=a.end-o:this._initialBuffered=null}else this._initialBuffered=null}return e.prototype.getPreloaded=function(){var e=this._initialBuffered;return null!==e&&this._initialActualPlayer&&this._getPlayer()===this._initialActualPlayer?0===e?"no":e>=i?"yes":"partial":null},e}();t.PreloadingCalculator=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=n.helpers.time.now,i=function(){function e(){this._start=null,this._end=null}return e.prototype.start=function(){if(this.isComplete())throw new Error("Timer completed.");this._start=o()},e.prototype.isComplete=function(){return null!==this._end},e.prototype.stop=function(){if(null===this._start)throw new Error("Not started.");this._end=o()},e.prototype.getTime=function(){if(null===this._end)throw new Error("Not completed.");return this._end-this._start},e}();t.Timer=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(83),i=r(82),a=r(12),s=3e4,u=1e3,l=function(){function e(e,t,r,o,i){this._logger=n.logger.prefixLogger(o,"AudioPerformanceEventGenerator"),this._proxy=e,this._getPlayer=t,this._eventReporter=r,this._getPlayerDetails=i,this._measureGeneralEvents()}return e.prototype.reportManualEvent=function(e){this._logger.debug("Reporting manual audio performance event.",e),this._eventReporter(e)},e.prototype._measureGeneralEvents=function(){var e=this,t=this._proxy,r=null,n=null,a=null,l=null,c=null,d=null,p=null,f=!0;t.onChange.subscribe(function(h){var _=h.playing,g=h.actuallyPlaying,y=h.seek,v=h.seeking,m=h.stalled,E=h.ended,b=h.dead;if(b!==!0&&_!==!1||!l||(l.stop(),l.getTime()>=u&&e._reportEvent("rageSkip",l.getTime(),null),l=null),t.isDead())return void(p&&window.clearTimeout(p));var w=t.getSeekState();t.isActuallyPlaying()||l||!(_===!0||t.isPlaying()&&m===!0)||(l=new o.Timer,l.start()),_===!0&&(r||(r=new o.Timer,r.start(),n=new i.PreloadingCalculator({proxy:t,getPlayer:e._getPlayer}),p=window.setTimeout(function(){e._reportEvent("longInitialBuffering",0,null)},s),0===t.getPosition()&&(f=!1))),_===!1&&(p&&window.clearTimeout(p),r&&!r.isComplete()&&(r=null)),g===!0&&(l=null,r&&!r.isComplete()&&(r.stop(),p&&window.clearTimeout(p),e._reportEvent("play",r.getTime(),n.getPreloaded()))),y&&"IN_PROGRESS"===y.state&&t.isReady()&&(a=new o.Timer,a.start(),c=new i.PreloadingCalculator({proxy:t,getPlayer:e._getPlayer}),v===!0&&e._reportEvent("seekStart",0,null)),(y&&"COMPLETED"===y.state&&!t.isStalled()||m===!1&&w&&"COMPLETED"===w.state)&&a&&(a.stop(),e._reportEvent("seek",a.getTime(),c.getPreloaded()),a=null),m!==!0||!t.isPlaying()||w&&"IN_PROGRESS"===w.state||r&&r.isComplete()&&(d=new o.Timer,d.start(),e._reportEvent("rebufferingStart",t.getPosition(),null)),m===!1&&(r&&r.isComplete()&&(l=null),d&&(d.stop(),e._reportEvent("rebufferingEnd",d.getTime(),null),d=null)),E!==!0||f||(e._reportEvent("uninterruptedPlay",0,null),f=!0);var P=w&&"IN_PROGRESS"===w.state;!P&&m===!0&&t.isActuallyPlaying()&&(f=!0)})},e.prototype._reportEvent=function(e,t,r){var n=this._getPlayerDetails();if(!n)return void this._logger.warn("Cannot report event because there is no player.",e,t);var o={type:e,latency:t,protocol:n.protocol,playerType:n.name,host:n.host,bitrate:n.bitrate,format:n.format,preset:n.preset,quality:n.quality,preloaded:r||void 0,appState:a.getAppState()};this._logger.debug("Generated audio performance event.",o),this._eventReporter(o)},e}();t.AudioPerformanceEventGenerator=l},function(e,t,r){"use strict";function n(e){return e.map(function(e){try{return JSON.stringify(e)}catch(e){return"<unavailable>"}})}var o=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){void 0===e&&(e=200),this._bufferSize=e,this._log=[]}return e.prototype.getLog=function(){return this._log.map(function(e){return o({},e,{data:n(e.data)})})},e.prototype.debug=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this._push({level:"debug",msg:e,data:t,time:Date.now()})},e.prototype.info=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this._push({level:"info",msg:e,data:t,time:Date.now()})},e.prototype.warn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this._push({level:"warn",msg:e,data:t,time:Date.now()})},e.prototype.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this._push({level:"error",msg:e,data:t,time:Date.now()})},e.prototype._push=function(e){this._log.push(e)>this._bufferSize&&this._log.shift()},e}();t.LogCollector=i},function(e,t,r){"use strict";function n(e,t,r){return Math.min(t,Math.max(e,r))}function o(e){if("number"!=typeof e)throw new Error("level must be a number.");if(e<0||e>1)throw new Error("Invalid volume level.");N=e,L.forEach(function(t){return t.setVolume(e)})}function i(){return N}function a(e){if("boolean"!=typeof e)throw new Error("muteEnabled must be a boolean.");F=e,L.forEach(function(t){return t.setMuted(e)})}function s(){return F}function u(e){if("number"!=typeof e||e<0)throw new Error("Invalid size.");D.setCacheSize(e)}var l=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var c=r(0),d=r(26),p=r(85),f=r(84),h=r(81),_=r(80),g=r(79),y=r(78),v=r(33),m=r(32),E=r(6),b=r(15),w=r(31),P=r(30),S=r(29),R=r(14),A=r(13),O=3e3,T=c.eventDispatcher.EventDispatcher,x=c.helpers.Promise,M=c.helpers.deferred.buildDeferred,D=new v.CacheManager(15e7,c.logger.noOpLogger),k=100,I=5e3,C=-1,L=[],N=1,F=!1;t.setGlobalVolume=o,t.getGlobalVolume=i,t.setGlobalMuted=a,t.getGlobalMuted=s,t.setCacheSize=u;var U=function(e){function t(t){var r=e.call(this,t)||this;r._onPreloadingEnabled=new T,r._onPreloadingDisabled=new T,r._retryDelayCalculator=new _.DecayingExponentialDelayCalculator,r._errorEventGenerator=null,r._fadeOutVolumeAutomator=null,r._volumeAutomators=[],r._volumeScale=1,r._userVolume=1,r._volumeAutomationSupported=!1,r._timer=null,r._pauseFadeTimer=null,r._pauseFadeDeferred=null,r._pauseFade=null,r._executionState={state:"IDLE"},r._preloadingListeners=[],r._retrieveAndBuildTimer=null,r._hadAStreamUrl=!1;var n=r._config=w.validatePlayerDependencies(t);r._preloadingEnabled=n.preloadingEnabled,r._getURLOpts=n.getURLOpts,r._controllers=n.controllers;var o=r._connectionRequiredHelper=new S.ConnectionRequiredHelper(r);r.onPreloadingEnabled=r._onPreloadingEnabled.getHandle(),r.onPreloadingDisabled=r._onPreloadingDisabled.getHandle(),r.onConnectionRequired=o.onConnectionRequired,r.onConnectionRecovered=o.onConnectionRecovered,r.onChange.subscribe(function(e){r.isDead()||((e.playing===!1||e.positionJumped||e.stalled||e.ended)&&r._completePauseFade(),r._pauseFade&&(e.actuallyPlaying===!1||e.ended||e.playing===!0)&&(r._removeVolumeAutomator(r._pauseFade),r._pauseFade=null),(e.positionJumped||void 0!==e.actuallyPlaying||void 0!==e.stalled)&&r._updateVolume(),void 0!==e.playing&&r._updateMaxBufferLength())});var i="SCAudio-"+ ++C,a=n.streamUrlRetriever.getTrackId();null!==a&&(i+="-"+a);var s=new p.LogCollector,u=c.logger.cloneLogger(s,r._logger);r._logger=c.logger.prefixLogger(u,i);var l=P.generateLogId();r._logger.info("Building player...",{ua:navigator.userAgent,getURLOpts:r._getURLOpts,logId:l}),L.push(r),r.setVolume(N,F),r._updateFadeOut();var d=null,v=null;n.audioPerformanceReporter&&(d=new f.AudioPerformanceEventGenerator(r,function(){return r._getPlayer()},n.audioPerformanceReporter,r._logger,function(){return r._getActivePlayerDetails()})),n.audioReporter&&new g.AudioEventGenerator(r,n.audioReporter,n.audioCheckpointInterval,r._logger,function(){return r._getActivePlayerDetails()}),n.errorReporter&&(v=r._errorEventGenerator=new h.ErrorEventGenerator(r,s,l,a,n.errorReporter,r._logger)),r._excludeUnsupportedRenditions();var m=r._controllerManager=new y.ControllerManager({logger:r._logger,controllers:n.controllers,playerId:i,streamUrlsExpire:n.streamUrlsExpire,fetchEnabled:n.fetchEnabled,fadeOnPauseAndPlay:n.fadeOnPauseAndPlay,fadeOnSeek:n.fadeOnSeek,cacheManager:D,providePlayer:function(e,t,n){r._volumeAutomationSupported=n,r._providePlayer(e,t),r._updateMaxBufferLength()},removePlayer:function(){r._getPlayer()&&r._removePlayer()},streamUrlRetriever:r._config.streamUrlRetriever,getURLOpts:r._getURLOpts,errorEventGenerator:v||void 0,audioPerformanceEventGenerator:d||void 0});if(r.onQualityChanged=m.onQualityChanged,void 0!==n.duration&&(r._logger.debug("Setting initial duration.",n.duration),r._setInitialDuration(n.duration)),r._preloadingEnabled)r._logger.debug("Preloading is enabled, so performing retrieve immediately."),r._retrieveAndBuild();else{r._logger.debug("Preloading is disabled, so deferring retrieve until either a play intent or preloading is enabled.");var E=function(){r._removePreloadingListeners(),r._logger.debug("Preloading now enabled or received a play request. Peforming retrieve."),r._retrieveAndBuild()};r._preloadingListeners.push(r.onPreloadingEnabled.subscribe(E),r.onPlayIntent.subscribe(E))}return r}return l(t,e),t.prototype.reload=function(e){void 0===e&&(e={}),this._ensureNotDead(),this._reloadStreamUrls(e)},t.prototype.enablePreloading=function(){this.isDead()||this._preloadingEnabled||(this._preloadingEnabled=!0,this._updateMaxBufferLength(),this._onPreloadingEnabled.dispatch(void 0))},t.prototype.disablePreloading=function(){this.isDead()||this._preloadingEnabled&&(this._preloadingEnabled=!1,this._updateMaxBufferLength(),this._onPreloadingDisabled.dispatch(void 0))},t.prototype.isPreloadingEnabled=function(){return this._preloadingEnabled},t.prototype.pauseAfterFade=function(e){var t=this;if(this._ensureNotDead(),this._pauseFadeDeferred)return this._pauseFadeDeferred.promise;if(!this.isPlaying()||!this.isActuallyPlaying())return x.resolve(this.pause());var r=M();this._pauseFadeDeferred=r;var n=this.getPosition();if(this._pauseFade)throw new Error("Fade should not already be assigned.");return this._pauseFade=new d.Fade({startPos:n,endPos:n+e,startLevel:1,endLevel:0}),this._addVolumeAutomator(this._pauseFade),this._pauseFadeTimer=window.setTimeout(function(){t._pauseFadeDeferred=null,r.resolve(t.pause({fadeDuration:0}))},e+50),r.promise},t.prototype.isConnectionRequired=function(){return this._connectionRequiredHelper.isConnectionRequired()},t.prototype.getQuality=function(){return this._controllerManager.getQuality()},t.prototype.getVolume=function(){return this._volumeAutomationSupported?this._userVolume:e.prototype.getVolume.call(this)},t.prototype._handleFatalError=function(e){this._logger.warn("Fatal error from current player.",e)},t.prototype._handleVolumeChange=function(t,r){this._userVolume=t,e.prototype._notifyVolumeChange.call(this,t,r),this._calculateAndSetVolume()},t.prototype._notifyVolumeChange=function(){},t.prototype._kill=function(){e.prototype._kill.call(this),this._timer&&window.clearTimeout(this._timer),this._abortPauseFade(),this._removePreloadingListeners(),L.splice(L.indexOf(this),1),"RETRIEVING_URL"===this._executionState.state?this._executionState.retrieveJob.abort():"CONTROLLING_PLAYER"===this._executionState.state&&this._controllerManager.releaseCurrentController({retry:!1}),this._executionState={state:"DEAD"},this._retrieveAndBuildTimer&&window.clearTimeout(this._retrieveAndBuildTimer)},t.prototype._excludeUnsupportedRenditions=function(){var e=this,t={streamUrlExpires:this._config.streamUrlsExpire},r=A.allRenditions.filter(function(r){return!e._controllers.some(function(e){return e.isRenditionSupported(r,t)})});r.forEach(function(t){e._config.streamUrlRetriever.excludeRendition(t)})},t.prototype._addVolumeAutomator=function(e){var t=this._volumeAutomators.indexOf(e);t<0&&(this._volumeAutomators.push(e),this._updateVolume())},t.prototype._removeVolumeAutomator=function(e){var t=this._volumeAutomators.indexOf(e);t>=0&&(this._volumeAutomators.splice(t,1),this._updateVolume())},t.prototype._removePreloadingListeners=function(){this._preloadingListeners.forEach(function(e){return e.remove()})},t.prototype._getActivePlayerDetails=function(){return"CONTROLLING_PLAYER"!==this._executionState.state?null:this._controllerManager.getPlayerDetails()},t.prototype._updateFadeOut=function(){this._fadeOutVolumeAutomator&&this._removeVolumeAutomator(this._fadeOutVolumeAutomator),this._getURLOpts.snippet&&(this._fadeOutVolumeAutomator=d.buildFadeOut(O),this._addVolumeAutomator(this._fadeOutVolumeAutomator))},t.prototype._handleUnexpectedError=function(e){try{e()}catch(e){this._logger.error("Unexpected error.",e),this._triggerError(new c.errors.PlayerFatalError("An unexpected error occurred.",e))}},t.prototype._retrieveAndBuild=function(){var e=this;this._handleUnexpectedError(function(){if(["IDLE","WAITING_TO_RETRIEVE"].indexOf(e._executionState.state)===-1)throw new Error("Invalid state for retrieveAndBuild().");e._logger.debug("Retrieving URL...");var t=m.retrieveUrl({streamUrlRetriever:e._config.streamUrlRetriever,urlProviderRetryDelayCalculator:e._config.urlProviderRetryDelayCalculator,getURLOpts:e._getURLOpts,logger:e._logger});e._executionState={state:"RETRIEVING_URL",retrieveJob:t},t.onCompletion(function(t){if(e._logger.debug("Retrieved URL.",!!t),t&&t.success){e._hadAStreamUrl=!0;var r=!1,n=function(n){var o=n.excludeRendition,i=n.immediateRetry;e._handleUnexpectedError(function(){if(r)throw new Error("startOver called multiple times.");if(r=!0,o&&e._config.streamUrlRetriever.excludeRendition(t.rendition),e._executionState={state:"WAITING_TO_RETRIEVE"},e.isDead())return void e._logger.debug("Stopping execution because player is dead.");if(i)e._logger.debug("Moving on immediately."),e._retrieveAndBuild();else{var n=e._retryDelayCalculator.getDelay();e._logger.debug("Will move on in "+n+"ms."),n?e._retrieveAndBuildTimer=window.setTimeout(function(){return e._retrieveAndBuild()},n):e._retrieveAndBuild()}})};e._handleUnexpectedError(function(){e._executionState={state:"CONTROLLING_PLAYER"},e._logger.debug("Building controller..."),e._controllerManager.buildNextController(t,n),e._logger.debug("Built controller.")})}else if(t&&t.rendition){if(e._logger.warn("Error retrieving URL. Moving on.",t.error),e._errorEventGenerator){var o="SCAUDIO.URL_RETRIEVER_ERROR."+e._config.streamUrlRetriever.name+"."+t.error.getCode();e._errorEventGenerator.reportManualEvent(o,{preset:t.preset,quality:t.quality,bitrate:t.bitrate,format:t.rendition.scFormat,protocol:t.rendition.scProtocol})}e._config.streamUrlRetriever.excludeRendition(t.rendition),e._executionState={state:"WAITING_TO_RETRIEVE"},e._retrieveAndBuild()}else t&&t.rendition&&e._logger.warn("Error retrieving URL for any rendition.",t.error),e._logger.info("Ran out of streams.",e._hadAStreamUrl),e._triggerError(e._hadAStreamUrl?new E.NotSupportedError:new b.NoStreamsError)}),t.onError(function(t){t!==c.helpers.abortableJob.abortedError&&(t===m.NoMoreAttemptsError?e._logger.error("Ran out of retries to retrieve URL."):e._logger.error("Unexpected error when retrieving a URL.",t),e._triggerError(new R.FailedRetrievingUrlError))})})},t.prototype._reloadStreamUrls=function(e){this._getURLOpts=e,this._updateFadeOut(),this._logger.info("Reloading stream URL's...",this._getURLOpts),"RETRIEVING_URL"===this._executionState.state?(this._logger.debug("Aborting current URL retrieve."),this._executionState.retrieveJob.abort(),this._executionState={state:"WAITING_TO_RETRIEVE"},this._retrieveAndBuild()):"CONTROLLING_PLAYER"===this._executionState.state?(this._logger.debug("Releasing controller."),this._controllerManager.releaseCurrentController({retry:!0})):this._logger.debug("Nothing to do."),this._logger.info("Reloaded stream URL's.")},t.prototype._completePauseFade=function(){if(this._pauseFadeDeferred){this._pauseFadeTimer&&window.clearTimeout(this._pauseFadeTimer);var e=this._pauseFadeDeferred;this._pauseFadeDeferred=null,e.resolve(this.pause())}},t.prototype._abortPauseFade=function(){this._pauseFadeTimer&&(window.clearTimeout(this._pauseFadeTimer),this._pauseFadeTimer=null),this._pauseFadeDeferred&&(this._pauseFadeDeferred.reject(new Error("Player was killed.")),this._pauseFadeDeferred=null)},t.prototype._updateVolume=function(){var e=this;if(this._volumeAutomationSupported){this._ensureNotDead(),this._timer&&(window.clearTimeout(this._timer),this._timer=null);var t=this.getDuration();if(null!==t){var r=this._volumeAutomators,o=this.getPosition(),i=1/0,a=1;r.forEach(function(e){var r=e.calculate(o,t),s=r.nextCalculatePosition,u=r.level;a*=n(0,1,u),s<i&&(i=s)}),this._volumeScale!==a&&(this._volumeScale=a,this._calculateAndSetVolume()),i<1/0&&this.isActuallyPlaying()&&!this.isStalled()&&(this._timer=window.setTimeout(function(){e._timer=null,e._updateVolume()},n(k,I,i-this.getPosition())))}}},t.prototype._calculateAndSetVolume=function(){this._volumeAutomationSupported?e.prototype._handleVolumeChange.call(this,this._userVolume*this._volumeScale,this.getMuted()):e.prototype._handleVolumeChange.call(this,this._userVolume,this.getMuted())},t.prototype._updateMaxBufferLength=function(){var e=this._getPlayer(),t=e&&e.getBufferController();t&&(this.isPlaying()?t.setMaxBufferLength(this._config.playingMaxBufferLength):t.setMaxBufferLength(this._preloadingEnabled?this._config.pausedMaxBufferLength:0))},t}(c.ProxyPlayerBase);t.Player=U},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t,r){void 0===e&&(e="UNKNOWN"),void 0===t&&(t=!1),void 0===r&&(r=null),this._code=e,this._transient=t,this._cause=r}return e.prototype.isTransient=function(){return this._transient},e.prototype.getCode=function(){return this._code},e.prototype.getCause=function(){return this._cause},e}();t.UrlRetrieverError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.httpAACHQ={scProtocol:"http",scFormat:"aac",maestroFormat:{mimeType:"audio/mp4",audioCodec:{id:"mp4a.40.2"}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encryptedHlsOpus={scProtocol:"encrypted-hls",scFormat:"opus",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/ogg",audioCodec:{id:"opus"}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hlsOpus={scProtocol:"hls",scFormat:"opus",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/ogg",audioCodec:{id:"opus"}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.maestroChromecast={scProtocol:"maestro.chromecast",maestroFormat:{}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.apiMobile={scProtocol:"sc.api-mobile",maestroFormat:{}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encryptedHlsAACHQ={scProtocol:"encrypted-hls",scFormat:"aac",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mp4",audioCodec:{id:"mp4a.40.2"}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hlsAACHQ={scProtocol:"hls",scFormat:"aac",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mp4",audioCodec:{id:"mp4a.40.2"}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encryptedHlsMp3={scProtocol:"encrypted-hls",scFormat:"mp3",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mpeg"
23852
+ }}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hlsMp3={scProtocol:"hls",scFormat:"mp3",maestroFormat:{mimeType:"application/x-mpegURL"},maestroSegmentFormat:{mimeType:"audio/mpeg"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.httpMp3={scProtocol:"http",scFormat:"mp3",maestroFormat:{mimeType:"audio/mpeg"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(26);!function(e){e.Fade=o.Fade,e.buildFadeIn=o.buildFadeIn,e.buildFadeOut=o.buildFadeOut}(n=t.volumeAutomation||(t.volumeAutomation={}))},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.1.0",t.buildNumber=845;var o=r(98);t.volumeAutomation=o.volumeAutomation;var i=r(25);t.BaseStreamUrlRetriever=i.BaseStreamUrlRetriever,n(r(24));var a=r(13);t.renditions=a.renditions,t.allRenditions=a.allRenditions;var s=r(87);t.UrlRetrieverError=s.UrlRetrieverError;var u=r(86);t.Player=u.Player,t.setGlobalVolume=u.setGlobalVolume,t.setGlobalMuted=u.setGlobalMuted,t.getGlobalVolume=u.getGlobalVolume,t.getGlobalMuted=u.getGlobalMuted,t.setCacheSize=u.setCacheSize;var l=r(28);t.Quality=l.Quality,t.resolveQuality=l.resolveQuality,n(r(27))}])})},function(e,t,r){!function(t,r){e.exports=r()}(window,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=97)}([function(e,t,r){"use strict";var n=r(4);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,r){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t,r){"use strict";e.exports=r(62)()?Symbol:r(61)},function(e,t,r){"use strict";function n(e){try{e()}catch(e){window.setTimeout(function(){throw e},0)}}Object.defineProperty(t,"__esModule",{value:!0}),t.deferException=n},function(e,t,r){"use strict";var n=r(24)();e.exports=function(e){return e!==n&&null!==e}},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(11),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"PLAYER_FATAL_ERROR"},t}(o.PlayerError);t.PlayerFatalError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(19),o=function(){function e(){this._listeners=[],this.dispatch=this.dispatch.bind(this)}return e.prototype.subscribe=function(e){var t=this,r={fn:e,payloads:[]};return this._listeners.push(r),{remove:function(){var e=t._listeners.indexOf(r);return e>=0&&(t._listeners.splice(e,1),!0)},retrieve:function(){return t._dispatchListenerPayloads(r)}}},e.prototype.dispatch=function(e,t){var r=this,o="number"==typeof t?{time:t}:t||{},i=void 0!==o.time?o.time:n.now(),a=this._listeners;a.forEach(function(t){return t.payloads.push({time:i,payload:e})});var s=!1;do s=!a.some(function(e){var t=e.fn,n=e.payloads,o=n.shift();return!!o&&(r._callHandler(t,o),!0)});while(!s)},e.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},e.prototype._dispatchListenerPayloads=function(e){for(var t=e.fn,r=e.payloads;;){var n=r.shift();if(!n)break;this._callHandler(t,n)}},e.prototype._callHandler=function(e,t){try{e(t.payload,t.time)}catch(e){window.setTimeout(function(){throw e},0)}},e}();t.EventDispatcher=o},function(e,t,r){"use strict";var n,o=r(14),i=r(23),a=r(66),s=r(22);n=e.exports=function(e,t){var r,n,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(r=a=!0,n=!1):(r=s.call(e,"c"),n=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:r,enumerable:n,writable:a},u?o(i(u),l):l},n.gs=function(e,t,r){var n,u,l,c;return"string"!=typeof e?(l=r,r=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==r?r=void 0:a(r)||(l=r,r=void 0):(l=t,t=r=void 0),null==e?(n=!0,u=!1):(n=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:r,configurable:n,enumerable:u},l?o(i(l),c):c}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(95);t.Promise=n.Promise},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call("");e.exports=function(e){return"string"==typeof e||e&&"object"==typeof e&&(e instanceof String||n.call(e)===o)||!1}},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call(function(){return arguments}());e.exports=function(e){return n.call(e)===o}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._msg=e,this._cause=t}return e.prototype.getCode=function(){return"PLAYER_ERROR"},e.prototype.getMsg=function(){return this._msg},e.prototype.getCause=function(){return this._cause},e}();t.PlayerError=n},function(e,t,r){"use strict";function n(e,t){return{debug:function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return e.debug.apply(e,["["+t+"] "+r].concat(n))},error:function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return e.error.apply(e,["["+t+"] "+r].concat(n))},info:function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return e.info.apply(e,["["+t+"] "+r].concat(n))},warn:function(r){for(var n=[],o=1;o<arguments.length;o++)n[o-1]=arguments[o];return e.warn.apply(e,["["+t+"] "+r].concat(n))}}}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{debug:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e.forEach(function(e){return e.debug.apply(e,[t].concat(r))})},error:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e.forEach(function(e){return e.error.apply(e,[t].concat(r))})},info:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e.forEach(function(e){return e.info.apply(e,[t].concat(r))})},warn:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return e.forEach(function(e){return e.warn.apply(e,[t].concat(r))})}}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(36),a=i.isIE();t.noOpLogger={debug:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r]},error:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r]},info:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r]},warn:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r]}},t.consoleLogger={debug:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];a?console.log(e,t):(n=console.debug||console.log).call.apply(n,[console,e].concat(t));var n},error:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];a?console.log(e,t):(n=console.error||console.log).call.apply(n,[console,e].concat(t));var n},info:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];a?console.log(e,t):(n=console.info||console.log).call.apply(n,[console,e].concat(t));var n},warn:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];a?console.log(e,t):(n=console.warn||console.log).call.apply(n,[console,e].concat(t));var n}},t.prefixLogger=n,t.cloneLogger=o},function(e,t,r){"use strict";function n(){var e,t,r=!1,n=new o.Promise(function(r,n){e=r,t=n});return{promise:n,resolve:function(t){r||(r=!0,e(t))},reject:function(e){r||(r=!0,t(e))},isSettled:function(){return r}}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(8);t.buildDeferred=n},function(e,t,r){"use strict";e.exports=r(71)()?Object.assign:r(70)},function(e,t,r){"use strict";e.exports=r(27)()?Object.setPrototypeOf:r(26)},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(28),i=function(e){function t(t,r,n){return void 0===n&&(n="The player that the proxy was controlling had a fatal error."),e.call(this,t,r,n)||this}return n(t,e),t.prototype.getCode=function(){return"PROXY_PLAYER_PROVIDED_PLAYER_FATAL_ERROR"},t}(o.ProxyProvidedPlayerError);t.ProxyProvidedPlayerFatalError=i},function(e,t,r){"use strict";function n(e,t){var r=void 0;return e.some(function(e){return!!t(e)&&(r=e,!0)}),r}Object.defineProperty(t,"__esModule",{value:!0}),t.find=n},function(e,t,r){"use strict";function n(e,t){return e.then(t,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.always=n},function(e,t,r){"use strict";function n(){return"performance"in window&&window.performance.now?window.performance.now():Date.now()-o}Object.defineProperty(t,"__esModule",{value:!0});var o=Date.now();t.now=n},function(e,t,r){"use strict";var n,o=r(58),i=r(14),a=r(1),s=r(0),u=r(7),l=r(57),c=r(2),d=Object.defineProperty,p=Object.defineProperties;e.exports=n=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");p(this,{__list__:u("w",s(e)),__context__:u("w",t),__nextIndex__:u("w",0)}),t&&(a(t.on),t.on("_add",this._onAdd),t.on("_delete",this._onDelete),t.on("_clear",this._onClear))},delete n.prototype.constructor,p(n.prototype,i({_next:u(function(){var e;if(this.__list__)return this.__redo__&&(e=this.__redo__.shift(),void 0!==e)?e:this.__nextIndex__<this.__list__.length?this.__nextIndex__++:void this._unBind()}),next:u(function(){return this._createResult(this._next())}),_createResult:u(function(e){return void 0===e?{done:!0,value:void 0}:{done:!1,value:this._resolve(e)}}),_resolve:u(function(e){return this.__list__[e]}),_unBind:u(function(){this.__list__=null,delete this.__redo__,this.__context__&&(this.__context__.off("_add",this._onAdd),this.__context__.off("_delete",this._onDelete),this.__context__.off("_clear",this._onClear),this.__context__=null)}),toString:u(function(){return"[object "+(this[c.toStringTag]||"Object")+"]"})},l({_onAdd:u(function(e){if(!(e>=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void d(this,"__redo__",u("c",[e]));this.__redo__.forEach(function(t,r){t>=e&&(this.__redo__[r]=++t)},this),this.__redo__.push(e)}}),_onDelete:u(function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(t=this.__redo__.indexOf(e),t!==-1&&this.__redo__.splice(t,1),this.__redo__.forEach(function(t,r){t>e&&(this.__redo__[r]=--t)},this)))}),_onClear:u(function(){this.__redo__&&o.call(this.__redo__),this.__nextIndex__=0})}))),d(n.prototype,c.iterator,u(function(){return this}))},function(e,t,r){"use strict";var n=r(10),o=r(9),i=r(63),a=r(43),s=r(42),u=r(2).iterator;e.exports=function(e){return"function"==typeof s(e)[u]?e[u]():n(e)?new i(e):o(e)?new a(e):new i(e)}},function(e,t,r){"use strict";e.exports=r(65)()?String.prototype.contains:r(64)},function(e,t,r){"use strict";var n=r(4),o=Array.prototype.forEach,i=Object.create,a=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=i(null);return o.call(arguments,function(e){n(e)&&a(Object(e),t)}),t}},function(e,t,r){"use strict";e.exports=function(){}},function(e,t,r){"use strict";var n=r(4),o={function:!0,object:!0};e.exports=function(e){return n(e)&&o[typeof e]||!1}},function(e,t,r){"use strict";var n,o=r(25),i=r(0),a=Object.prototype.isPrototypeOf,s=Object.defineProperty,u={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(e,t){if(i(e),null===t||o(t))return e;throw new TypeError("Prototype must be null or an object")},e.exports=function(e){var t,r;return e?(2===e.level?e.set?(r=e.set,t=function(e,t){return r.call(n(e,t),t),e}):t=function(e,t){return n(e,t).__proto__=t,e}:t=function e(t,r){var o;return n(t,r),o=a.call(e.nullPolyfill,t),o&&delete e.nullPolyfill.__proto__,null===r&&(r=e.nullPolyfill),t.__proto__=r,o&&s(e.nullPolyfill,"__proto__",u),t},Object.defineProperty(t,"level",{configurable:!1,enumerable:!1,writable:!1,value:e.level})):null}(function(){var e,t=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{e=n.set,e.call(t,r)}catch(e){}if(Object.getPrototypeOf(t)===r)return{set:e,level:2}}return t.__proto__=r,Object.getPrototypeOf(t)===r?{level:2}:(t={},t.__proto__=r,Object.getPrototypeOf(t)===r&&{level:1})}()),r(74)},function(e,t,r){"use strict";var n=Object.create,o=Object.getPrototypeOf,i={};e.exports=function(){var e=Object.setPrototypeOf,t=arguments[0]||n;return"function"==typeof e&&o(e(t(null),i))===i}},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(11),i=function(e){function t(t,r,n){void 0===n&&(n="The player that the proxy was controlling had an error.");var o=e.call(this,n)||this;return o._providedPlayerError=t,o._providedPlayer=r,o}return n(t,e),t.prototype.getCode=function(){return"PROXY_PLAYER_PROVIDED_PLAYER_ERROR"},t.prototype.getProvidedPlayerError=function(){return this._providedPlayerError},t.prototype.getProvidedPlayer=function(){return this._providedPlayer},t}(o.PlayerError);t.ProxyProvidedPlayerError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=function(e){function t(t,r){return e.call(this,t,r)||this}return n(t,e),t.prototype.getCode=function(){return"IMPLEMENTATION_ERROR"},t}(o.PlayerFatalError);t.ImplementationError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=function(){function e(e,t){this._inCallback=!1,this._onExit=e,this._onEnter=t||null}return e.prototype.enter=function(e){var t=this;if(this._inCallback)return e?e(this._onEnterResultRetriever):void 0;this._inCallback=!0;var r=[],o=!1;this._onEnter&&(this._onEnterResultRetriever={getResult:function(e){o?n.deferException(function(){return e(t._onEnterError,t._onEnterResult)}):r.push(e)}});try{var i=e?e(this._onEnterResultRetriever):void 0;if(this._onEnter){this._onEnterError=void 0,this._onEnterResult=void 0;try{this._onEnterResult=this._onEnter()}catch(e){this._onEnterError=e}o=!0,r.forEach(function(e){return n.deferException(function(){return e(t._onEnterError,t._onEnterResult)})})}return i}finally{this._inCallback=!1,n.deferException(function(){return t._onExit(t._onEnterError,t._onEnterResult)})}},e}();t.OnExit=o},function(e,t,r){"use strict";function n(e){var t=Object.create(null);return Object.keys(e).forEach(function(r){t[r]=e[r]}),t}Object.defineProperty(t,"__esModule",{value:!0});var o=r(30),i=r(3),a=function(){},s=function(){function e(e,t){void 0===t&&(t={});var r=this;this._subscribers=[],this._onExit=new o.OnExit(function(){return r._after()},function(){return r._onEnter()}),this._beforeUpdateError=void 0,this._inAfterUpdate=!1,this._dead=!1,this._officiallyDead=!1,this._errors=[],this._state=n(e),this._initialState=n(e),this._beforeUpdate=t.beforeUpdate||function(){},this._afterUpdate=t.afterUpdate||a,this._afterDispatches=t.afterDispatches||a}return e.prototype.subscribe=function(e,t){var r=this;if(void 0===t&&(t=!0),this._dead){var o=!1;return{retrieve:function(){},remove:function(){return!o&&(o=!0)}}}var i={callback:e,localState:t?n(this._state):this._initialState};return this._subscribers.push(i),t||this._updateSubscriber(i),{remove:function(){var t=r._subscribers.map(function(e){return e.callback}).indexOf(e);return t>=0&&(r._subscribers.splice(t,1),!0)},retrieve:function(){r._updateSubscriber(i)}}},e.prototype.subscribeIndividual=function(e,t,r){return this.subscribe(function(r){var n=r[e];void 0!==n&&t(n)},r)},e.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},e.prototype.getIndividualHandle=function(e){var t=this;return{subscribe:function(r){return t.subscribeIndividual(e,r)}}},e.prototype.update=function(e){var t=this;this._officiallyDead||(this._inAfterUpdate?e&&e(this._state,this._beforeUpdateError):this._onExit.enter(function(r){r.getResult(function(){try{e&&e(t._state,t._beforeUpdateError)}catch(e){t._errors.push(e)}})}))},e.prototype.getState=function(){return this._state},e.prototype.kill=function(){var e=this;this._dead||(this._dead=!0,window.setTimeout(function(){e._subscribers.splice(0),e._officiallyDead=!0},0))},e.prototype.isDead=function(){return this._dead},e.prototype._onEnter=function(){this._beforeUpdateError=void 0;try{this._beforeUpdate(this._state)}catch(e){this._beforeUpdateError=e}},e.prototype._after=function(){var e=this,t=this._errors;this._errors=[],i.deferException(function(){e._inAfterUpdate=!0;try{e._afterUpdate(e._state,{beforeUpdate:e._beforeUpdateError,update:t})}catch(t){throw e._inAfterUpdate=!1,t}e._inAfterUpdate=!1,e._subscribers.slice().forEach(function(t){return e._updateSubscriber(t)}),e._afterDispatches(e._state)})},e.prototype._updateSubscriber=function(e){var t=this._calculateDiff(e.localState);Object.keys(t).length&&(e.localState=n(this._state),i.deferException(function(){return e.callback(t,e.localState)}))},e.prototype._calculateDiff=function(e){var t=this,r=Object.create(null);return Object.keys(this._state).forEach(function(n){var o=t._state[n];o!==e[n]&&(r[n]=o)}),r},e}();t.StateManager=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e[e.LOADING=0]="LOADING",e[e.PLAYING=1]="PLAYING",e[e.PAUSED=2]="PAUSED",e[e.DEAD=3]="DEAD"}(n=t.State||(t.State={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=function(e){function t(t){return e.call(this,t||"The player cannot play the provided descriptor.")||this}return n(t,e),t.prototype.getCode=function(){return"NOT_SUPPORTED_ERROR"},t}(o.PlayerFatalError);t.NotSupportedError=i},function(e,t,r){"use strict";function n(){return{ended:!1,loading:!1,playing:!1,actuallyPlaying:!1,volume:1,muted:!1,isFading:!1,fadeRate:null,isFadingForSeek:!1,playDeferred:null,pauseDeferred:null,ready:!1,seeking:!1,seek:null,positionJumped:null,stalled:!0,duration:null,dead:!1,state:d.State.PAUSED,fatalError:null,errorOccurred:null,position:0}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=r(33),a=r(6),s=r(13),u=r(17),l=r(19),c=r(8),d=r(32),p=r(12),f=r(31),h=r(29),_=r(3),g="undefined"!=typeof navigator&&"mediaSession"in navigator,y=5e3,v=150,m=25,E=35,b=1e3,w=g?navigator.mediaSession:null,P=function(){function e(e){var t=this;this._stateManager=new f.StateManager(n(),{afterUpdate:function(e,r){return t._afterUpdate(e,r)},afterDispatches:function(){return t._afterDispatches()},beforeUpdate:function(e){if(!e.dead&&(e.ready||!t._fatalErrorTriggered)){var r=t._getPosition(),n=e.duration;if(r<0)throw t._logger.error("Player provided invalid position.",r,n),t._triggerError(new h.ImplementationError("Player provided a position that was invalid.")),new Error("Player provided invalid position.");e.position=r,t._updateEndedInState(e)}}}),this._onError=new a.EventDispatcher,this._errors=[],this._fatalErrorTriggered=!1,this._loadingDelayTimer=null,this._stalled=!1,this._queuedDuration=null,this._readyDeferred=s.buildDeferred(),this._queuedSeekDeferreds=[],this._lastPlayError=null,this._lastPauseError=null,this._lastPlayedPosition=null,this._listenTimeBase=0,this._timePlaybackStarted=null,this._positionAfterLastUpdate=0,this._positionWhenStartedFadeOut=null,this._fadeStartAllowed=!1,this._seekFadeStartAllowed=!1,this._implementationIsFading=!1;var r=e.name;if(this._logger=p.prefixLogger(e.logger,"BasePlayer"+(r?"-"+r:"")),this._mediaSessionEnabled=!!e.mediaSessionEnabled,e.defaultFadeDuration&&e.defaultFadeDuration<0)throw new Error("defaultFadeDuration must be >= 0.");if(e.loadingDelay&&e.loadingDelay<0)throw new Error("loadingDelay must be >= 0.");this._defaultFadeDuration=void 0!==e.defaultFadeDuration?e.defaultFadeDuration:v,this._defaultSeekFadeOutDuration=void 0!==e.defaultSeekFadeOutDuration?e.defaultSeekFadeOutDuration:m,this._defaultSeekFadeInDuration=void 0!==e.defaultSeekFadeInDuration?e.defaultSeekFadeInDuration:E,this._loadingDelay=void 0!==e.loadingDelay?e.loadingDelay:b,this.onError=this._onError.getHandle(),this.whenReady=this._readyDeferred.promise,this._stateManager.subscribe(function(e,r){return t._onChange(e,r)}),this._stateManager.subscribe(function(e){var r=e.actuallyPlaying,n=e.seek;r===!0&&(t._fadeStartAllowed=!1),n&&"IN_PROGRESS"!==n.state&&(t._seekFadeStartAllowed=!1)}),this._stateManager.subscribe(function(e,r){var n=e.isFading,o=r.dead;!o&&n===!1&&t._implementationIsFading&&t._triggerError(new h.ImplementationError("Fade was still running when not allowed."))}),this._stateManager.subscribe(function(e,r){var n=e.playing,o=r.dead,i=r.fadeRate;if(!o&&void 0!==n)try{t._handlePlayPauseChange(n,{fadeRate:i||void 0}),n||(t._fadeStartAllowed=!1)}catch(e){t._triggerError(new h.ImplementationError("Exception occurred whilst handling play/pause change.",e))}}),this._stateManager.subscribe(function(e,r){var n=e.seek,o=r.dead;if(!o&&n&&"IN_PROGRESS"===n.state)try{t._seekFadeStartAllowed=!0,t._handleSeekChange(n.position,{fadeRate:{beforeSeek:n.fadeRate.beforeSeek||void 0,afterSeek:n.fadeRate.afterSeek||void 0}}),t._seekFadeStartAllowed=!1}catch(e){t._triggerError(new h.ImplementationError("Exception occurred whilst handling seek change.",e))}}),this.onChange=this._buildEventHandle(function(e,r){var n=r.ready;if(void 0!==n&&n!==!0)throw new Error("Ready state is invalid.");var o=r.duration;if(void 0!==o&&null===o)throw new Error("Duration state is invalid.");var i=r.dead;if(void 0!==i&&i!==!0)throw new Error("Dead state is invalid.");var a={ready:n,ended:r.ended,duration:o,volume:r.volume,muted:r.muted,playing:r.playing,actuallyPlaying:r.actuallyPlaying,stalled:r.stalled,loading:r.loading,fading:r.isFading,fadingForSeek:r.isFadingForSeek,playRejection:r.playing===!1?t._lastPlayError||void 0:void 0,pauseRejection:r.playing===!0?t._lastPauseError||void 0:void 0,seeking:r.seeking,seek:r.seek||void 0,positionJumped:void 0!==r.positionJumped||void 0,state:r.state,fatalError:r.fatalError||void 0,dead:i};Object.keys(a).some(function(e){return void 0!==a[e]})&&e(a)});var o=e.registerListeners;o&&_.deferException(function(){o({onChange:t.onChange,onError:t.onError})}),this._registerMediaSessionActionHandlers(),this._notifyMediaSessionPaused(),this.onDurationChange=this._buildEventHandle(function(e,t){var r=t.duration;void 0!==r&&null!==r&&e(r)}),this.onReady=this._buildEventHandle(function(e,t){var r=t.ready;r===!0&&e(void 0)}),this.onStateChange=this._buildEventHandle(function(e,t){var r=t.state;void 0!==r&&e(r)}),this.onVolumeChange=this._buildEventHandle(function(e,t,r){var n=t.volume,o=t.muted,i=r.volume,a=r.muted;void 0===n&&void 0===o||e({volume:i,muted:a})}),this.onPlay=this._buildEventHandle(function(e,t){var r=t.actuallyPlaying;r===!0&&e(void 0)}),this.onPlayIntent=this._buildEventHandle(function(e,t){var r=t.playing;r===!0&&e(void 0)}),this.onPlayRejection=this._buildEventHandle(function(e,r){var n=r.playing;n===!1&&t._lastPlayError&&e(t._lastPlayError)}),this.onPause=this._buildEventHandle(function(e,t){var r=t.actuallyPlaying;r===!1&&e(void 0)}),this.onPauseIntent=this._buildEventHandle(function(e,t){var r=t.playing;r===!1&&e(void 0)}),this.onPauseRejection=this._buildEventHandle(function(e,r){var n=r.playing;n===!0&&t._lastPauseError&&e(t._lastPauseError)}),this.onSeek=this._buildEventHandle(function(e,t){var r=t.seek;r&&"COMPLETED"===r.state&&e(void 0)}),this.onSeekIntent=this._buildEventHandle(function(e,t){var r=t.seeking;r===!0&&e(void 0)}),this.onSeekRejection=this._buildEventHandle(function(e,t){var r=t.seek;r&&"ERROR"===r.state&&e(r.error)}),this.onPositionJumped=this._buildEventHandle(function(e,t){var r=t.positionJumped;void 0!==r&&e(void 0)}),this.onEnded=this._buildEventHandle(function(e,t){var r=t.ended;r===!0&&e(void 0)}),this.onLeftEnded=this._buildEventHandle(function(e,t){var r=t.ended;r===!1&&e(void 0)}),this.onStallStart=this._buildEventHandle(function(e,t){var r=t.stalled;r===!0&&e(void 0)}),this.onStallEnd=this._buildEventHandle(function(e,t){var r=t.stalled;r===!1&&e(void 0)}),this.onLoadStart=this._buildEventHandle(function(e,t){var r=t.loading;r===!0&&e(void 0)}),this.onLoadEnd=this._buildEventHandle(function(e,t){var r=t.loading;r===!1&&e(void 0)}),this.onFadeStart=this._buildEventHandle(function(e,t){var r=t.isFading;r===!0&&e(void 0)}),this.onFadeEnd=this._buildEventHandle(function(e,t){var r=t.isFading;r===!1&&e(void 0)}),this.onFadeForSeekStart=this._buildEventHandle(function(e,t){var r=t.isFadingForSeek;r===!0&&e(void 0)}),this.onFadeForSeekEnd=this._buildEventHandle(function(e,t){var r=t.isFadingForSeek;r===!1&&e(void 0)})}return e.prototype.isReady=function(){return this._stateManager.getState().ready},e.prototype.getPosition=function(){return this._getPositionOrPositionSeekingTo()},e.prototype.getLastPlayedPosition=function(){var e=this._stateManager.getState(),t=e.actuallyPlaying,r=e.stalled;return t&&!r?this.getPosition():this._lastPlayedPosition},e.prototype.getListenTime=function(){var e=this._stateManager.getState(),t=e.actuallyPlaying,r=e.ended,n=this._listenTimeBase;return t&&!r&&(n+=l.now()-this._timePlaybackStarted),n},e.prototype.isStalled=function(){return this._stateManager.getState().stalled},e.prototype.isLoading=function(){return this._stateManager.getState().loading},e.prototype.isFading=function(){return this._stateManager.getState().isFading},e.prototype.isFadingForSeek=function(){return this._stateManager.getState().isFadingForSeek},e.prototype.isPlaying=function(){return this._stateManager.getState().playing},e.prototype.isActuallyPlaying=function(){return this._stateManager.getState().actuallyPlaying},e.prototype.isEnded=function(){return this._stateManager.getState().ended},e.prototype.getState=function(){return this._stateManager.getState().state},e.prototype.getBufferController=function(){return null},e.prototype.getMemoryCacheMaxSize=function(){return null},e.prototype.getMemoryCacheUsage=function(){return null},e.prototype.getMemoryCacheController=function(){return null},e.prototype.getFatalError=function(){return this._stateManager.getState().fatalError},e.prototype.isDead=function(){return this._stateManager.getState().dead},e.prototype.getVolume=function(){return this._stateManager.getState().volume},e.prototype.getMuted=function(){return this._stateManager.getState().muted},e.prototype.getDuration=function(){var e=this._stateManager.getState(),t=e.ready,r=e.duration;return t?r:null},e.prototype.setVolume=function(e,t){if(e<0||e>1)throw new Error("Volume must be >= 0 and <= 1.");if(!this._stateManager.getState().dead){var r=this._stateManager.getState().muted;void 0===t&&(t=r);try{this._handleVolumeChange(e,t)}catch(e){throw this._triggerError(new h.ImplementationError("Exception occurred updating volume.",e)),e}}},e.prototype.setMuted=function(e){this.setVolume(this._stateManager.getState().volume,e)},e.prototype.getCurrentBufferedTimeRange=function(){var e=this.getBufferedTimeRanges();if(!e)return null;var t=this.getPosition();return u.find(e,function(e){return e.containsTime(t)})||null},e.prototype.play=function(e){var t=this;this._ensureNotDead(),this._logger.debug("play() called.",e);var r=s.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing)t._logger.debug("Intent is already to be playing.");else{t._logger.debug("Requesting play."),n.playing=!0;var o=t._extractFadeDuration(e);o?n.fadeRate=1/o:n.fadeRate=null,t._lastPlayError=null}n.playDeferred&&!n.playDeferred.isSettled()||(n.playDeferred=s.buildDeferred()),r.resolve(n.playDeferred.promise)}),r.promise}catch(e){return this._triggerError(new o.PlayerFatalError("Unexpected error when attempting to play.",e)),c.Promise.reject(e)}},e.prototype.pause=function(e){var t=this;this._ensureNotDead(),this._logger.debug("pause() called.",e);var r=s.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing){t._logger.debug("Requesting pause."),t._positionWhenStartedFadeOut=t._getPositionOrPositionSeekingTo(),n.playing=!1;var o=t._extractFadeDuration(e);o?n.fadeRate=-1*(1/o):n.fadeRate=null,t._fadeStartAllowed=!0,t._lastPauseError=null}else t._logger.debug("Intent is already to be paused.");n.pauseDeferred&&!n.pauseDeferred.isSettled()||(n.pauseDeferred=s.buildDeferred()),r.resolve(n.pauseDeferred.promise)}),r.promise}catch(e){return this._triggerError(new o.PlayerFatalError("Unexpected error when attempting to pause.",e)),c.Promise.reject(e)}},e.prototype.seek=function(e,t){var r=this;this._ensureNotDead(),this._logger.debug("seek() called.",e);var n=s.buildDeferred();return this._stateManager.update(function(o){if(e<0)r._logger.warn("Rejecting seek immediately as the position was negative."),n.reject(new Error("You were attempting to seek to a negative time."));else if(null!==o.duration&&e>o.duration)r._logger.warn("Rejecting seek immediately as the duration is now known, and the requested positon was past it."),n.reject(new Error("You were attempting to seek past the end of the media."));else{o.stalled||!o.actuallyPlaying||o.seek&&"IN_PROGRESS"===o.seek.state||(r._lastPlayedPosition=r._getPositionOrPositionSeekingTo());var i=s.buildDeferred();if(o.seek&&"IN_PROGRESS"===o.seek.state&&o.seek.position===e)r._logger.debug("Seek already requested to the same position.",e);else{r._logger.debug("Requesting seek.",e),o.seeking=!0,r._positionWhenStartedFadeOut=null;var a=r._extractSeekFadeDurations(t,e),u=a.fadeOutDuration?-1*(1/a.fadeOutDuration):null,l=a.fadeInDuration?1/a.fadeInDuration:null;o.seek={state:"IN_PROGRESS",position:e,fadeRate:{beforeSeek:u,afterSeek:l}},o.positionJumped=Object.create(null)}r._queuedSeekDeferreds.push({position:e,deferred:i}),n.resolve(i.promise)}}),n.promise},e.prototype.getSeekState=function(){return this._stateManager.getState().seek},e.prototype.kill=function(){var e=this;this._stateManager.update(function(t){t.dead||(e._logger.debug("kill() called."),t.dead=!0)})},e.prototype._update=function(e){this._stateManager.update(function(){return e&&e()})},e.prototype._ensureNotDead=function(){if(this._stateManager.getState().dead)throw new Error("Player is dead.")},e.prototype._notifyStalled=function(e){this._ensureNotDead(),this._stalled!==e&&(this._logger.debug("notifyStalled() called.",e),this._stalled=e,this._stateManager.update())},e.prototype._getQueuedSeekPosition=function(){var e=this.getSeekState();
23853
+ return e&&"IN_PROGRESS"===e.state?e.position:null},e.prototype._provideDuration=function(e){var t=this;this._ensureNotDead(),this._stateManager.update(function(r){if(r.duration!==e){var n=t._getPositionOrPositionSeekingTo();if(e<0||r.ready&&n>e)throw t._triggerError(new h.ImplementationError("Attempt to update duration to an invalid value.")),new Error("Duration cannot be less than the current position.");t._logger.debug("provideDuration() called.",e),r.ready?r.duration=e:t._queuedDuration=e}})},e.prototype._notifyVolumeChange=function(e,t){if(e<0||e>1)throw this._triggerError(new h.ImplementationError("Volume was out of range.",e)),new Error("Volume was out of range.");this._stateManager.update(function(r){r.volume=e,r.muted=t})},e.prototype._notifyPlaying=function(e){var t=this;this._ensureNotDead(),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to register playback as started before ready.")),new Error("Player must be ready first.");e!==r.actuallyPlaying&&(t._logger.debug("notifyPlaying() called.",e),e||r.seeking||r.stalled||(t._lastPlayedPosition=t._getPositionOrPositionSeekingTo()),r.actuallyPlaying=r.playing=e,e?(t._lastPlayError=null,t._fadeStartAllowed=!0):(r.isFading=!1,t._fadeStartAllowed=!1,t._lastPauseError=null))})},e.prototype._notifyPlayRejection=function(e){var t=this;this._ensureNotDead(),e=e||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to reject a play request before player ready.")),new Error("Player must be ready first.");if(r.actuallyPlaying||!r.playing)throw t._triggerError(new h.ImplementationError("Attempt to reject a play request when not valid.")),new Error("Playing state is incorrect.");t._logger.debug("notifyPlayRejection() called.",e),r.playing=!1,t._lastPlayError=e})},e.prototype._notifyPauseRejection=function(e){var t=this;this._ensureNotDead(),e=e||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to reject pause request before player ready.")),new Error("Player must be ready first.");if(!r.actuallyPlaying||r.playing)throw t._triggerError(new h.ImplementationError("Attempt to reject pause request when not valid.")),new Error("Playing state is incorrect.");t._logger.debug("notifyPauseRejection() called.",e),r.playing=!0,r.fadeRate&&(r.fadeRate*=-1),t._lastPauseError=e})},e.prototype._notifySeekRejection=function(e){var t=this;this._ensureNotDead(),e=e||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to reject seek request before player ready.")),new Error("Player must be ready first.");if(!r.seek||"IN_PROGRESS"!==r.seek.state)throw t._triggerError(new h.ImplementationError("Attempt to reject seek request when none requested.")),new Error("A seek hasn't been requested.");if(null!==r.duration&&r.position>r.duration)throw t._triggerError(new h.ImplementationError("Attempt to reject seek request after duration changed below current position.")),new Error("Attempt to reject seek request after duration changed below current position.");t._logger.debug("notifySeekRejection() called.",e),r.seeking=!1,r.seek={state:"ERROR",error:e},r.positionJumped=Object.create(null)})},e.prototype._notifyFading=function(e){var t=this;if(this._ensureNotDead(),e&&!this._fadeStartAllowed){var r="Attempt to register fade as starting when not allowed.";throw this._triggerError(new h.ImplementationError(r)),new Error(r)}this._implementationIsFading=e,this._stateManager.update(function(r){r.isFading!==e&&(t._logger.debug("notifyFading() called",e),e||r.playing||null===t._positionWhenStartedFadeOut||t.seek(t._positionWhenStartedFadeOut,{fadeInDuration:0,fadeOutDuration:0}).catch(function(e){t._logger.warn("Seek back to position where fade out started failed.",e)}),r.isFading=e)})},e.prototype._notifyFadingForSeek=function(e){var t=this;if(this._ensureNotDead(),e&&!this._seekFadeStartAllowed){var r="Attempt to register fade as starting for seek when not allowed.";throw this._triggerError(new h.ImplementationError(r)),new Error(r)}this._stateManager.update(function(r){r.isFadingForSeek!==e&&(t._logger.debug("notifyFadingForSeek() called",e),r.isFadingForSeek=e)})},e.prototype._signalReady=function(){var e=this;this._ensureNotDead(),this._stateManager.update(function(t){if(t.ready)throw e._triggerError(new h.ImplementationError("Attempt to signal ready twice.")),new Error("Ready already signalled.");if(null===e._queuedDuration)throw e._triggerError(new h.ImplementationError("Attempt to signal ready when duration unknown.")),new Error("Duration is still unknown.");e._logger.debug("signalReady() called."),t.ready=!0,t.duration=e._queuedDuration,t.seek&&"IN_PROGRESS"===t.seek.state&&t.seek.position>t.duration&&(t.seeking=!1,t.seek={state:"ERROR",error:new Error("You were attempting to seek past the end of the media.")})})},e.prototype._signalSeekComplete=function(){var e=this;this._ensureNotDead(),this._stateManager.update(function(t){if(!t.ready)throw e._triggerError(new h.ImplementationError("Attempt to signal seek as complete before player ready.")),new Error("Player must be ready first.");if(!t.seek||"IN_PROGRESS"!==t.seek.state)throw e._triggerError(new h.ImplementationError("Attempt to signal seek as complete when none requested.")),new Error("There shouldn't be a seek in progress.");var r=t.duration;if(t.seek&&"IN_PROGRESS"===t.seek.state&&t.seek.position>r)throw new Error("Seek cannot have completed given it was to a time greater than the duration.");e._logger.debug("signalSeekComplete() called."),e._seekFadeStartAllowed=!0,t.seek={state:"COMPLETED",position:t.seek.position,fadeRate:t.seek.fadeRate},t.seeking=!1,t.position=t.seek.position})},e.prototype._triggerError=function(e){var t=this;e instanceof o.PlayerFatalError&&(this._fatalErrorTriggered=!0),this._stateManager.update(function(r){var n=!1;if(r.ready&&e instanceof i.NotSupportedError&&(e=new h.ImplementationError("Invalid NotSupportedError."),n=!0),e instanceof o.PlayerFatalError?(e instanceof i.NotSupportedError?t._logger.info("NotSupportedError occurred.",e):t._logger.error("Fatal error occurred.",e),r.fatalError?t._logger.warn("A fatal error already occurred.",r.fatalError):r.fatalError=e,t._errors.push(e),r.errorOccurred=Object.create(null),r.dead=!0):(t._logger.warn("Non-fatal error occurred.",e),t._errors.push(e),r.errorOccurred=Object.create(null)),n)throw new Error("Not supported errors are only valid before the player is ready.")})},e.prototype._buildEventHandle=function(e){var t=this;return{subscribe:function(r){var n=function(e){return r(e,l.now())};return t._stateManager.subscribe(function(t,r){e(n,t,r)})}}},e.prototype._finalizeState=function(e){this._updateEndedInState(e);var t=this._getPositionOrPositionSeekingTo();if(e.dead)this._lastPlayError=new Error("Player was killed."),e.loading=!1,this._clearLoadingDelay(),!e.playing&&e.isFading&&null!==this._positionWhenStartedFadeOut&&(this._logger.debug("Fade out was in progress. Pretending it completed."),e.isFading=!1,e.position=this._positionWhenStartedFadeOut),e.stalled=!0,e.actuallyPlaying=!1,e.isFadingForSeek=!1,e.playing=!1,e.state=d.State.DEAD;else{var r=!e.ended&&(!e.ready||this._stalled||!(!e.seek||"IN_PROGRESS"!==e.seek.state));r&&!e.stalled&&!e.seeking&&e.actuallyPlaying&&(this._lastPlayedPosition=t),e.stalled=r;var n=!e.ended&&!e.isFading&&!e.isFadingForSeek&&(e.playing||e.actuallyPlaying)&&(e.stalled||e.playing!==e.actuallyPlaying);n?this._loadingDelay?this._scheduleLoadingDelay():e.loading=!0:(e.loading=!1,this._clearLoadingDelay()),this._positionAfterLastUpdate!==t&&(this._positionAfterLastUpdate=t,e.playing||e.actuallyPlaying||(e.positionJumped=Object.create(null))),e.state=this._calculateState(e)}},e.prototype._updateEndedInState=function(e){e.ended=e.ready&&this._getPositionOrPositionSeekingTo()===e.duration},e.prototype._scheduleLoadingDelay=function(){var e=this;this._loadingDelayTimer||(this._loadingDelayTimer=window.setTimeout(function(){e._stateManager.update(function(e){return e.loading=!0})},this._loadingDelay))},e.prototype._clearLoadingDelay=function(){this._loadingDelayTimer&&(window.clearTimeout(this._loadingDelayTimer),this._loadingDelayTimer=null)},e.prototype._getPositionOrPositionSeekingTo=function(){this._stateManager.update();var e=this._stateManager.getState();return e.seek&&"IN_PROGRESS"===e.seek.state?e.seek.position:e.isFading&&!e.playing&&null!==this._positionWhenStartedFadeOut?this._positionWhenStartedFadeOut:e.ready&&null!==e.duration?e.position:0},e.prototype._calculateState=function(e){var t=e.dead,r=e.loading,n=e.playing,o=e.ended;return t?d.State.DEAD:r?d.State.LOADING:n&&!o?d.State.PLAYING:d.State.PAUSED},e.prototype._registerMediaSessionActionHandlers=function(){var e=this;this._mediaSessionEnabled&&w&&(w.setActionHandler("play",function(){e.isDead()||e.play()}),w.setActionHandler("pause",function(){e.isDead()||e.pause()}),w.setActionHandler("seekbackward",function(){e.isDead()||e.seek(Math.max(0,e.getPosition()-y))}),w.setActionHandler("seekforward",function(){e.isDead()||e.seek(Math.min(e.getDuration()||0,e.getPosition()+y))}))},e.prototype._notifyMediaSessionPlaying=function(){this._mediaSessionEnabled&&w&&(w.playbackState="playing")},e.prototype._notifyMediaSessionPaused=function(){this._mediaSessionEnabled&&w&&(w.playbackState="paused")},e.prototype._extractFadeDuration=function(e){return void 0===e&&(e={}),void 0===e.fadeDuration?!this._stateManager.getState().playing||this._getPositionOrPositionSeekingTo()>0?this._defaultFadeDuration:0:e.fadeDuration>0?e.fadeDuration:0},e.prototype._extractSeekFadeDurations=function(e,t){void 0===e&&(e={});var r;r=void 0!==e.fadeOutDuration?e.fadeOutDuration>0?e.fadeOutDuration:0:this._defaultSeekFadeOutDuration;var n;return n=void 0!==e.fadeInDuration?e.fadeInDuration>0?e.fadeInDuration:0:t>0?this._defaultSeekFadeInDuration:0,{fadeOutDuration:r,fadeInDuration:n}},e.prototype._afterUpdate=function(e,t){if(t.beforeUpdate||t.update.length>0)this._logger.error("Errors occurred during state update. Killing player.",t),this._triggerError(new o.PlayerFatalError("Errors occurred during state update.",t));else if(!e.dead&&e.ready){var r=e.duration;null!==r&&!e.seeking&&e.position>r&&(this._logger.error("Player provided invalid position.",e.position,r),this._triggerError(new h.ImplementationError("Player provided a position that was invalid.")))}this._finalizeState(e)},e.prototype._afterDispatches=function(){var e=this,t=this._errors;this._errors=[],t.forEach(function(t){return e._onError.dispatch(t)})},e.prototype._onChange=function(e,t){var r=this,n=e.ready,o=e.dead,i=e.fatalError,a=e.playing,s=e.actuallyPlaying,u=e.ended;if(n===!0&&(this._logger.debug("Resolving ready deferred."),this._readyDeferred.resolve(void 0)),s===!0&&this._registerMediaSessionActionHandlers(),a===!0?this._notifyMediaSessionPlaying():a===!1&&this._notifyMediaSessionPaused(),t.pauseDeferred&&!t.pauseDeferred.isSettled()&&t.playing){var c=this._lastPauseError||new Error("Pause request aborted.");this._logger.debug("Rejecting pause deferred.",c),t.pauseDeferred.reject(c)}if(t.playDeferred&&!t.playDeferred.isSettled()&&!t.playing){var c=this._lastPlayError||new Error("Play request aborted.");this._logger.debug("Rejecting play deferred.",c),t.playDeferred.reject(c)}if(t.playDeferred&&!t.playDeferred.isSettled()&&t.actuallyPlaying&&(this._logger.debug("Resolving play deferred."),t.playDeferred.resolve(void 0)),!t.pauseDeferred||t.pauseDeferred.isSettled()||t.actuallyPlaying||(this._logger.debug("Resolving pause deferred."),t.pauseDeferred.resolve(void 0)),s===!0&&!t.ended||u===!1&&t.actuallyPlaying?this._timePlaybackStarted=l.now():(s===!1&&!t.ended||u===!0&&t.actuallyPlaying)&&(this._listenTimeBase+=l.now()-this._timePlaybackStarted,this._timePlaybackStarted=null),this._queuedSeekDeferreds=this._queuedSeekDeferreds.filter(function(e){var n=e.position,o=e.deferred;if(t.seek)if("IN_PROGRESS"!==t.seek.state){if(!t.stalled||"ERROR"===t.seek.state)return"ERROR"!==t.seek.state?(r._logger.debug("Resolving seek()."),o.resolve(void 0)):(r._logger.debug("Rejecting seek().",t.seek.error),o.reject(t.seek.error)),!1}else if("IN_PROGRESS"!==t.seek.state||t.seek.position!==n)return r._logger.debug("Rejecting seek() because another seek was requested.",n),o.reject(new Error("Seek request aborted because another seek was requested to a different position.")),!1;return!0}),o===!0){this._logger.debug("Calling _kill() on player.");try{this._kill(),this._logger.info("Player killed.")}catch(e){this._triggerError(new h.ImplementationError("Exception occurred in _kill().",e)),this._logger.error("Exception when implementation was being killed.",e)}if(!t.ready){var c=i||new Error("Player was killed.");this._logger.debug("Rejecting whenReady."),this._readyDeferred.reject(c)}this._queuedSeekDeferreds.forEach(function(e){var t=e.position,n=e.deferred,o=i||new Error("Seek aborted as player killed.");r._logger.debug("Rejecting seek().",t),n.reject(o)}),this._stateManager.kill(),this._logger.debug("Player dead.")}},e}();t.BasePlayer=P},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),o=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};Object.defineProperty(t,"__esModule",{value:!0});var i=r(34),a=r(11),s=r(5),u=r(12),l=r(6),c=r(28),d=r(16),p=function(e){function t(t){var r=e.call(this,t)||this;return r._onProvidedPlayerError=new l.EventDispatcher,r._errorHandler=null,r._changeHandler=null,r._player=null,r._instanceLock=null,r._playConfig=void 0,r._pauseConfig=void 0,r._seekConfig=void 0,r._lastPlayerPosition=0,r._synced=!1,r._unsyncInProgress=!1,r._logger=u.prefixLogger(r._logger,"ProxyPlayerBase"),r.onProvidedPlayerError=r._onProvidedPlayerError.getHandle(),r}return n(t,e),t.prototype.play=function(t){return this._playConfig=t,e.prototype.play.call(this)},t.prototype.pause=function(t){return this._pauseConfig=t,e.prototype.pause.call(this)},t.prototype.seek=function(t,r){return this._seekConfig=r,e.prototype.seek.call(this,t)},t.prototype.getBufferedTimeRanges=function(){return this._player&&this._synced?this._player.getBufferedTimeRanges():null},t.prototype.getCurrentBufferedTimeRange=function(){return this._player&&this._synced?this._player.getCurrentBufferedTimeRange():null},t.prototype.getMaxBufferLength=function(){return this._player&&this._synced?this._player.getMaxBufferLength():null},t.prototype._providePlayer=function(e,t){if(void 0===t&&(t={}),t=o({syncPosition:!0,syncVolume:!0},t),this._ensureNotDead(),this._player)throw new Error("A player has already been provided.");this._logger.debug("providePlayer() called."),this._instanceLock=Object.create(null),this._player=e,this._sync(t)},t.prototype._removePlayer=function(){var e=this;if(this._ensureNotDead(),!this._player)throw new Error("There is no player to remove.");if(this._unsyncInProgress)throw new Error("Player is currently unsyncing.");this._logger.debug("removePlayer() called."),this._instanceLock=null,this._unsync(),this._player=null,this.isReady()&&!this.isDead()&&this._update(function(){var t=null!==e._getQueuedSeekPosition();e._notifyFading(!1),t||null===e._getQueuedSeekPosition()||e._signalSeekComplete(),e._notifyFadingForSeek(!1),e._notifyStalled(!0)})},t.prototype._setInitialDuration=function(e){var t=this;if(this._ensureNotDead(),e<0)throw new Error("Cannot set duration to a value < 0.");null===this.getDuration()&&this._update(function(){t._ensureBelowPosition(e),t._provideDuration(e),t.isReady()||(t._signalReady(),t._handleSkippedSeek())})},t.prototype._triggerError=function(t){e.prototype._triggerError.call(this,t)},t.prototype._getPlayer=function(){return this.isDead()?null:this._player},t.prototype._handleVolumeChange=function(e,t){this._synced&&this._player?this._player.setVolume(e,t):this._notifyVolumeChange(e,t)},t.prototype._handlePlayPauseChange=function(e){var t=this,r=this._player;r&&this._update(function(){e?t._playAndHandleAbort(r):(t._pauseAndHandleAbort(r),r.isFading()&&t._notifyFading(!0))})},t.prototype._handleSeekChange=function(e){var t=this._player;if(t&&this._synced){var r=this._seekConfig;this._seekConfig=void 0,t.seek(e,r),t.isFadingForSeek()&&this._notifyFadingForSeek(!0)}},t.prototype._getPosition=function(){if(this._player&&this._synced){if(!this._changeHandler)throw new Error("Handler should exist.");if(this._changeHandler.retrieve(),this._synced)return this._player.getPosition()}return this._lastPlayerPosition},t.prototype._kill=function(){this._player&&(this._unsync(),this._player.kill()),this._player=null},t.prototype._handleSkippedSeek=function(){if(this._player&&this._synced){var e=this.getSeekState(),t=this._player.getSeekState();!e||"IN_PROGRESS"!==e.state||t&&"IN_PROGRESS"===t.state||(this._logger.debug("Signalling seek as complete on proxy because provided player isn't seeking."),this._signalSeekComplete())}},t.prototype._ensureBelowPosition=function(e){this.getPosition()>e&&(this._logger.debug("Capping position.",e),this.seek(e),this.isReady()&&(this._lastPlayerPosition=e,this._signalSeekComplete()))},t.prototype._sync=function(e){var t=this,r=this._player;if(!r)throw new Error("Player should have become available by now.");if(this._logger.debug("Syncing...",this.isPlaying(),this.isActuallyPlaying()),r.isDead()){this._logger.debug("Provided player is dead.");var n=r.getFatalError();return void(n&&this._handleFatalError(n,r))}this._errorHandler=r.onError.subscribe(function(e){e instanceof s.PlayerFatalError?t._onProvidedPlayerError.dispatch(new d.ProxyProvidedPlayerFatalError(e,r)):(t._triggerError(e),t._onProvidedPlayerError.dispatch(new c.ProxyProvidedPlayerError(e,r)))}),this._changeHandler=r.onChange.subscribe(function(e){t._update(function(){if(t._logger.debug("Handling changes.",e),e.dead)return t._logger.debug("Player has gone to DEAD state."),t._unsync(),void(t.isDead()||e.fatalError&&t._handleFatalError(e.fatalError,r));if(void 0===e.volume&&void 0===e.muted||t._notifyVolumeChange(r.getVolume(),r.getMuted()),void 0!==e.duration&&(t._ensureBelowPosition(e.duration),t._provideDuration(e.duration),t.isReady()||(t._signalReady(),t._handleSkippedSeek(),t._notifyStalled(r.isStalled()))),e.seek){var n=t.getSeekState();n&&"IN_PROGRESS"===n.state||"IN_PROGRESS"!==e.seek.state?n&&"IN_PROGRESS"===n.state&&("COMPLETED"===e.seek.state&&n.position===e.seek.position?(t._signalSeekComplete(),r.isFadingForSeek()&&t._notifyFadingForSeek(!0)):"COMPLETED"===e.seek.state&&n.position!==e.seek.position?t._notifySeekRejection(new Error("Another seek occurred to a different position.")):"IN_PROGRESS"===e.seek.state&&n.position!==e.seek.position?t.seek(e.seek.position):"ERROR"===e.seek.state&&t._notifySeekRejection(e.seek.error)):t.seek(e.seek.position)}void 0!==e.stalled&&t._notifyStalled(e.stalled),e.playing===!1&&e.playRejection?t.isActuallyPlaying()?(t._triggerError(new a.PlayerError("Paused because a player was provided that refused to play.")),t._notifyPlaying(!1)):t._notifyPlayRejection(e.playRejection):e.playing===!1&&(r.isActuallyPlaying()?t.pause():void 0===e.actuallyPlaying&&t.isReady()&&t._notifyPlaying(!1)),e.playing===!0&&e.pauseRejection?t._notifyPauseRejection(e.pauseRejection):e.playing===!0&&t.play(),void 0!==e.actuallyPlaying&&e.actuallyPlaying!==t.isActuallyPlaying()&&(t._notifyPlaying(e.actuallyPlaying),e.actuallyPlaying&&r.isFading()&&t._notifyFading(!0)),e.fading===!1&&t._notifyFading(!1),e.fadingForSeek===!1&&t._notifyFadingForSeek(!1)})}),this._update(function(){var n=t._instanceLock;try{if(t._notifyStalled(r.isStalled()),r.isReady()){var o=r.getDuration();t._ensureBelowPosition(o),t._provideDuration(o),t.isReady()||(t._logger.debug("Provided player is already ready. Making proxy player ready."),t._signalReady())}if(e.syncVolume&&(r.setVolume(t.getVolume(),t.getMuted()),t._instanceLock!==n))return;var i=t.getSeekState();if(e.syncPosition){t._logger.debug("Seeking to match position.");var a=t.getPosition();r.getPosition()!==a?r.seek(a):(t._logger.debug("Skipping seek because already at same position."),t.isReady()&&i&&"IN_PROGRESS"===i.state&&t._signalSeekComplete())}else if(i&&"IN_PROGRESS"===i.state){t._logger.debug("Seeking to match position because a seek has been queued.");var u=t._seekConfig;t._seekConfig=void 0,r.seek(t.getPosition(),u)}else{var l=r.getSeekState();l&&"IN_PROGRESS"===l.state&&(t._logger.debug("Seeking on proxy to match seek that is in progress on provided player."),t.seek(l.position))}if(t._instanceLock!==n)return;if(r.isActuallyPlaying()?(t._logger.debug("Provided player is already playing."),t.isActuallyPlaying()||(t._notifyPlaying(!0),r.isFading()&&t._notifyFading(!0))):r.isPlaying()?(t._logger.debug("Provided player is preparing to play."),t.play()):t.isPlaying()?(t._logger.debug("Calling play() on provided player to match proxy."),t._playAndHandleAbort(r)):t.isReady()&&t.isActuallyPlaying()&&(t._logger.debug("Switching to paused state, as provided player and proxy intended state is paused."),t._notifyPlaying(!1)),t._instanceLock!==n)return;t._synced=!0,t._notifyVolumeChange(r.getVolume(),r.getMuted())}catch(e){t._triggerError(new s.PlayerFatalError("Unexpected error occurred whilst syncing.",e))}})},t.prototype._playAndHandleAbort=function(e){var t=this._instanceLock;this._logger.debug("Calling play() on provided player.");var r=this._playConfig;this._playConfig=this._pauseConfig=void 0,e.play(r),this._instanceLock===t&&!e.isPlaying()&&this.isPlaying()&&(this._logger.debug("Provided player was not playing after play() call completed."),this.isActuallyPlaying()?(this._triggerError(new a.PlayerError("Paused because a player was provided that refused to play.")),this._notifyPlaying(!1)):this.pause())},t.prototype._pauseAndHandleAbort=function(e){var t=this._instanceLock;this._logger.debug("Calling pause() on provided player.");var r=this._pauseConfig;this._playConfig=this._pauseConfig=void 0,e.pause(r),this._instanceLock===t&&e.isPlaying()&&!this.isPlaying()&&(this._logger.debug("Provided player was not paused after pause() call completed."),this.play())},t.prototype._unsync=function(){if(this._logger.debug("Unsyncing..."),this._changeHandler&&(this._changeHandler.remove(),this._changeHandler=null),this._errorHandler&&(this._errorHandler.remove(),this._errorHandler=null),!this._synced)return void this._logger.debug("Unsynced. (Sync never completed)");this._synced=!1,this._unsyncInProgress=!0;var e=this._player;if(e)try{this._lastPlayerPosition=e.getPosition()}catch(e){this._logger.error("Error whilst unsyncing.",e)}this._unsyncInProgress=!1,this._logger.debug("Unsynced.",this.isPlaying(),this.isActuallyPlaying())},t}(i.BasePlayer);t.ProxyPlayerBase=p},function(e,t,r){"use strict";function n(){return f}function o(){return y}function i(){return g}function a(){return h}function s(){return _}function u(){return d(v)}function l(){return d(m)}function c(){return d(E)}function d(e){var t=navigator.userAgent.match(e);if(t&&t.length>=3){var r=parseInt(t[1],10),n=parseInt(t[2],10);if(!isNaN(r)&&!isNaN(n))return{major:r,minor:n}}return null}Object.defineProperty(t,"__esModule",{value:!0});var p="undefined"!=typeof navigator?navigator.userAgent:"",f=!/chrome|opera/i.test(p)&&/safari/i.test(p),h=p.indexOf("MSIE ")>=0||p.indexOf("Trident/")>=0,_=p.indexOf("Edge/")>=0,g=/Chrom(?:e|ium)/.test(p),y=p.toLowerCase().indexOf("firefox")>=0,v=/version\/(\d+)\.(\d+)/i,m=/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)/,E=/Firefox\/(\d+)\.(\d+)/;t.isSafari=n,t.isFirefox=o,t.isChrome=i,t.isIE=a,t.isEdge=s,t.getSafariVersion=u,t.getChromeVersion=l,t.getFirefoxVersion=c},function(e,t,r){"use strict";function n(e,t){var r=t.convertResult,n=t.convertProgressUpdate,o=t.abortableJobOpts,a=t.passThroughAbort,s=void 0===a||a;return new l(function(){var t=e(),o=new u.EventDispatcher,a=!0,l=i.buildDeferred();return n&&t.onProgressUpdate(function(e){o.dispatch(n(e,a)),a=!1},{skipPast:!0}),t.onCompletion(function(e){try{l.resolve(r(e))}catch(e){l.reject(e)}}),t.onError(l.reject),{result:l.promise,progressUpdates:n?{onProgressUpdate:o,getProgressSoFar:function(){var e=t.getProgressSoFar();if(e){var r=n(e,a);return a=!1,r}return null}}:void 0,abort:function(){return s&&t.abort()}}},o)}Object.defineProperty(t,"__esModule",{value:!0});var o=r(8),i=r(13),a=r(18),s=r(3),u=r(6);t.abortedError=new Error("Job aborted."),t.map=n;var l=function(){function e(e,t){void 0===t&&(t={}),this._job=e,this._opts=t,this._counter=0,this._jobControl=null,this._promise=null,this._jobCompleted=!1}return e.prototype.run=function(){var e,r=this;if(this._jobControl)e=this._jobControl;else{try{e=this._jobControl=this._job()}catch(t){e=this._jobControl={result:o.Promise.reject(t)}}this._promise=e.result,a.always(this._promise,function(){r._jobCompleted=!0,r._opts.storeResult||(r._jobCompleted=!1,r._promise=null,r._jobControl=null)})}var n=this._promise;this._counter++;var u=i.buildDeferred(),l=!1,c=!1,d=void 0,p=!1,f=[],h=[],_=[],g=function(){p||(l=!0,r._counter--),f.forEach(function(e){return e.remove()})};return a.always(n,g),n.then(function(e){p||(d=e,h.forEach(function(t){return s.deferException(function(){return t(e)})}),h.splice(0),u.resolve(e))},function(e){p||(c=!0,d=e,_.forEach(function(t){return t(e)}),_.splice(0),u.reject(e))}),{whenComplete:function(){return u.promise},onProgressUpdate:function(t,r){if(void 0===r&&(r={}),e.progressUpdates){if(!p&&!l){var n=e.progressUpdates.onProgressUpdate.subscribe(function(e){return t(e)});f.push(n)}if(!r.skipPast){var o=e.progressUpdates.getProgressSoFar();o&&t(o)}}},getProgressSoFar:function(){return e.progressUpdates?e.progressUpdates.getProgressSoFar():null},onCompletion:function(e){l?!c&&s.deferException(function(){return e(d)}):h.push(e)},onError:function(e){p?s.deferException(function(){return e(t.abortedError)}):l?c&&s.deferException(function(){return e(d)}):_.push(e)},hasCompleted:function(){return l},hasErrored:function(){return c},isAborted:function(){return p},abort:function(){p||l||(p=!0,f.forEach(function(e){return e.remove()}),0===--r._counter&&!r._jobCompleted&&r._jobControl&&r._jobControl.abort&&(r._jobControl.abort(),r._promise=null,r._jobControl=null),_.forEach(function(e){return s.deferException(function(){return e(t.abortedError)})}),u.reject(t.abortedError))}}},e}();t.AbortableJob=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){if(this.start=e,this.duration=t,t<0)throw new RangeError("Duration must be >= 0.");this.end=e+t}return e.normalizeRawTimeRanges=function(e){return e.slice(0).sort(function(e,t){return e.start-t.start}).reduce(function(e,t,r){var n=e.length-1;return r>0&&e[n].end>=t.start?e[n].end=t.end:e.push(t),e},[])},e.normalize=function(t){return e.normalizeRawTimeRanges(t.map(function(e){return{start:e.start,end:e.end}})).map(function(t){return new e(t.start,t.end-t.start)})},e.getCoverage=function(t){if(0===t.length)return new e(0,0);var r=1/0,n=0;return t.forEach(function(e){e.start<r&&(r=e.start),e.end>n&&(n=e.end)}),new e(r,n-r)},e.rangesContainTime=function(e,t){return t.some(function(t){return t.containsTime(e)})},e.prototype.containsTime=function(e){return this.start<=e&&this.end>e},e}();t.TimeRange=n},function(e,t,r){"use strict";e.exports=function(){return"function"==typeof WeakMap&&"[object WeakMap]"===Object.prototype.toString.call(new WeakMap)}()},function(e,t,r){"use strict";var n=r(10),o=r(1),i=r(9),a=r(21),s=Array.isArray,u=Function.prototype.call,l=Array.prototype.some;e.exports=function(e,t){var r,c,d,p,f,h,_,g,y=arguments[2];if(s(e)||n(e)?r="array":i(e)?r="string":e=a(e),o(t),d=function(){p=!0},"array"===r)return void l.call(e,function(e){return u.call(t,y,e,d),p});if("string"!==r)for(c=e.next();!c.done;){if(u.call(t,y,c.value,d),p)return;c=e.next()}else for(h=e.length,f=0;f<h&&(_=e[f],f+1<h&&(g=_.charCodeAt(0),g>=55296&&g<=56319&&(_+=e[++f])),u.call(t,y,_,d),!p);++f);}},function(e,t,r){"use strict";var n=r(10),o=r(4),i=r(9),a=r(2).iterator,s=Array.isArray;e.exports=function(e){return!(!o(e)||!s(e)&&!i(e)&&!n(e)&&"function"!=typeof e[a])}},function(e,t,r){"use strict";var n=r(41);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not iterable");return e}},function(e,t,r){"use strict";var n,o=r(15),i=r(7),a=r(2),s=r(20),u=Object.defineProperty;n=e.exports=function(e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");e=String(e),s.call(this,e),u(this,"__length__",i("",e.length))},o&&o(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:i(function(){if(this.__list__)return this.__nextIndex__<this.__length__?this.__nextIndex__++:void this._unBind()}),_resolve:i(function(e){var t,r=this.__list__[e];return this.__nextIndex__===this.__length__?r:(t=r.charCodeAt(0),t>=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,a.toStringTag,i("c","String Iterator"))},function(e,t,r){"use strict";var n=r(1),o=r(0),i=Function.prototype.bind,a=Function.prototype.call,s=Object.keys,u=Object.prototype.propertyIsEnumerable;e.exports=function(e,t){return function(r,l){var c,d=arguments[2],p=arguments[3];return r=Object(o(r)),n(l),c=s(r),p&&c.sort("function"==typeof p?i.call(p,r):void 0),"function"!=typeof e&&(e=c[e]),a.call(e,c,function(e,n){return u.call(r,e)?a.call(l,d,r[e],e,r,n):t})}}},function(e,t,r){"use strict";e.exports=r(44)("forEach")},function(e,t,r){"use strict";var n=r(1),o=r(45),i=Function.prototype.call;e.exports=function(e,t){var r={},a=arguments[2];return n(t),o(e,function(e,n,o,s){r[n]=i.call(t,a,e,n,o,s)}),r}},function(e,t,r){"use strict";e.exports=function(e){return e=Number(e),isNaN(e)||0===e?e:e>0?1:-1}},function(e,t,r){"use strict";e.exports=function(){var e=Math.sign;return"function"==typeof e&&1===e(10)&&e(-20)===-1}},function(e,t,r){"use strict";e.exports=r(48)()?Math.sign:r(47)},function(e,t,r){"use strict";var n=r(49),o=Math.abs,i=Math.floor;e.exports=function(e){return isNaN(e)?0:(e=Number(e),0!==e&&isFinite(e)?n(e)*i(o(e)):e)}},function(e,t,r){"use strict";var n=r(50),o=Math.max;e.exports=function(e){return o(0,n(e))}},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call(r(24));e.exports=function(e){return"function"==typeof e&&n.call(e)===o}},function(e,t,r){"use strict";var n=r(2).iterator,o=r(10),i=r(52),a=r(51),s=r(1),u=r(0),l=r(4),c=r(9),d=Array.isArray,p=Function.prototype.call,f={configurable:!0,enumerable:!0,writable:!0,value:null},h=Object.defineProperty;e.exports=function(e){var t,r,_,g,y,v,m,E,b,w,P=arguments[1],S=arguments[2];if(e=Object(u(e)),l(P)&&s(P),this&&this!==Array&&i(this))t=this;else{if(!P){if(o(e))return y=e.length,1!==y?Array.apply(null,e):(g=new Array(1),g[0]=e[0],g);if(d(e)){for(g=new Array(y=e.length),r=0;r<y;++r)g[r]=e[r];return g}}g=[]}if(!d(e))if(void 0!==(b=e[n])){for(m=s(b).call(e),t&&(g=new t),E=m.next(),r=0;!E.done;)w=P?p.call(P,S,E.value,r):E.value,t?(f.value=w,h(g,r,f)):g[r]=w,E=m.next(),++r;y=r}else if(c(e)){for(y=e.length,t&&(g=new t),r=0,_=0;r<y;++r)w=e[r],r+1<y&&(v=w.charCodeAt(0),v>=55296&&v<=56319&&(w+=e[++r])),w=P?p.call(P,S,w,_):w,t?(f.value=w,h(g,_,f)):g[_]=w,++_;y=_}if(void 0===y)for(y=a(e.length),t&&(g=new t(y)),r=0;r<y;++r)w=P?p.call(P,S,e[r],r):e[r],t?(f.value=w,h(g,r,f)):g[r]=w;return t&&(f.value=null,g.length=y),g}},function(e,t,r){"use strict";e.exports=function(){var e,t,r=Array.from;return"function"==typeof r&&(e=["raz","dwa"],t=r(e),Boolean(t&&t!==e&&"dwa"===t[1]))}},function(e,t,r){"use strict";e.exports=r(54)()?Array.from:r(53);
23854
+ },function(e,t,r){"use strict";var n=r(55),o=r(14),i=r(0);e.exports=function(e){var t=Object(i(e)),r=arguments[1],a=Object(arguments[2]);if(t!==e&&!r)return t;var s={};return r?n(r,function(t){(a.ensure||t in e)&&(s[t]=e[t])}):o(s,e),s}},function(e,t,r){"use strict";var n,o=r(56),i=r(23),a=r(1),s=r(46),u=r(1),l=r(0),c=Function.prototype.bind,d=Object.defineProperty,p=Object.prototype.hasOwnProperty;n=function(e,t,r){var n,i=l(t)&&u(t.value);return n=o(t),delete n.writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&p.call(this,e)?i:(t.value=c.call(i,r.resolveContext?r.resolveContext(this):this),d(this,e,t),this[e])},n},e.exports=function(e){var t=i(arguments[1]);return null!=t.resolveContext&&a(t.resolveContext),s(e,function(e,r){return n(r,e,t)})}},function(e,t,r){"use strict";var n=r(0);e.exports=function(){return n(this).length=0,this}},function(e,t,r){"use strict";e.exports=function(e){return!!e&&("symbol"==typeof e||!!e.constructor&&"Symbol"===e.constructor.name&&"Symbol"===e[e.constructor.toStringTag])}},function(e,t,r){"use strict";var n=r(59);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not a symbol");return e}},function(e,t,r){"use strict";var n,o,i,a,s=r(7),u=r(60),l=Object.create,c=Object.defineProperties,d=Object.defineProperty,p=Object.prototype,f=l(null);if("function"==typeof Symbol){n=Symbol;try{String(n()),a=!0}catch(e){}}var h=function(){var e=l(null);return function(t){for(var r,n,o=0;e[t+(o||"")];)++o;return t+=o||"",e[t]=!0,r="@@"+t,d(p,r,s.gs(null,function(e){n||(n=!0,d(this,r,s(e)),n=!1)})),r}}();i=function(e){if(this instanceof i)throw new TypeError("Symbol is not a constructor");return o(e)},e.exports=o=function e(t){var r;if(this instanceof e)throw new TypeError("Symbol is not a constructor");return a?n(t):(r=l(i.prototype),t=void 0===t?"":String(t),c(r,{__description__:s("",t),__name__:s("",h(t))}))},c(o,{for:s(function(e){return f[e]?f[e]:f[e]=o(String(e))}),keyFor:s(function(e){var t;u(e);for(t in f)if(f[t]===e)return t}),hasInstance:s("",n&&n.hasInstance||o("hasInstance")),isConcatSpreadable:s("",n&&n.isConcatSpreadable||o("isConcatSpreadable")),iterator:s("",n&&n.iterator||o("iterator")),match:s("",n&&n.match||o("match")),replace:s("",n&&n.replace||o("replace")),search:s("",n&&n.search||o("search")),species:s("",n&&n.species||o("species")),split:s("",n&&n.split||o("split")),toPrimitive:s("",n&&n.toPrimitive||o("toPrimitive")),toStringTag:s("",n&&n.toStringTag||o("toStringTag")),unscopables:s("",n&&n.unscopables||o("unscopables"))}),c(i.prototype,{constructor:s(o),toString:s("",function(){return this.__name__})}),c(o.prototype,{toString:s(function(){return"Symbol ("+u(this).__description__+")"}),valueOf:s(function(){return u(this)})}),d(o.prototype,o.toPrimitive,s("",function(){var e=u(this);return"symbol"==typeof e?e:e.toString()})),d(o.prototype,o.toStringTag,s("c","Symbol")),d(i.prototype,o.toStringTag,s("c",o.prototype[o.toStringTag])),d(i.prototype,o.toPrimitive,s("c",o.prototype[o.toPrimitive]))},function(e,t,r){"use strict";var n={object:!0,symbol:!0};e.exports=function(){var e;if("function"!=typeof Symbol)return!1;e=Symbol("test symbol");try{String(e)}catch(e){return!1}return!!n[typeof Symbol.iterator]&&!!n[typeof Symbol.toPrimitive]&&!!n[typeof Symbol.toStringTag]}},function(e,t,r){"use strict";var n,o=r(15),i=r(22),a=r(7),s=r(2),u=r(20),l=Object.defineProperty;n=e.exports=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,e),t=t?i.call(t,"key+value")?"key+value":i.call(t,"key")?"key":"value":"value",l(this,"__kind__",a("",t))},o&&o(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:a(function(e){return"value"===this.__kind__?this.__list__[e]:"key+value"===this.__kind__?[e,this.__list__[e]]:e})}),l(n.prototype,s.toStringTag,a("c","Array Iterator"))},function(e,t,r){"use strict";var n=String.prototype.indexOf;e.exports=function(e){return n.call(this,e,arguments[1])>-1}},function(e,t,r){"use strict";var n="razdwatrzy";e.exports=function(){return"function"==typeof n.contains&&n.contains("dwa")===!0&&n.contains("foo")===!1}},function(e,t,r){"use strict";e.exports=function(e){return"function"==typeof e}},function(e,t,r){"use strict";var n=r(4),o=Object.keys;e.exports=function(e){return o(n(e)?Object(e):e)}},function(e,t,r){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,r){"use strict";e.exports=r(68)()?Object.keys:r(67)},function(e,t,r){"use strict";var n=r(69),o=r(0),i=Math.max;e.exports=function(e,t){var r,a,s,u=i(arguments.length,2);for(e=Object(o(e)),s=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},a=1;a<u;++a)t=arguments[a],n(t).forEach(s);if(void 0!==r)throw r;return e}},function(e,t,r){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(e={foo:"raz"},t(e,{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,r){"use strict";var n=Object.create(null),o=Math.random;e.exports=function(){var e;do e=o().toString(36).slice(2);while(n[e]);return e}},function(e,t,r){"use strict";var n=r(25);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not an Object");return e}},function(e,t,r){"use strict";var n,o=Object.create;r(27)()||(n=r(26)),e.exports=function(){var e,t,r;return n?1!==n.level?o:(e={},t={},r={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(e){return"__proto__"===e?void(t[e]={configurable:!0,enumerable:!1,writable:!0,value:void 0}):void(t[e]=r)}),Object.defineProperties(e,t),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:e}),function(t,r){return o(null===t?e:t,r)}):o}()},function(e,t,r){"use strict";var n,o=r(15),i=r(73),a=r(0),s=r(72),u=r(7),l=r(21),c=r(40),d=r(2).toStringTag,p=r(39),f=Array.isArray,h=Object.defineProperty,_=Object.prototype.hasOwnProperty,g=Object.getPrototypeOf;e.exports=n=function(){var e,t=arguments[0];if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");return e=p&&o&&WeakMap!==n?o(new WeakMap,g(this)):this,null!=t&&(f(t)||(t=l(t))),h(e,"__weakMapData__",u("c","$weakMap$"+s())),t?(c(t,function(t){a(t),e.set(t[0],t[1])}),e):e},p&&(o&&o(n,WeakMap),n.prototype=Object.create(WeakMap.prototype,{constructor:u(n)})),Object.defineProperties(n.prototype,{delete:u(function(e){return!!_.call(i(e),this.__weakMapData__)&&(delete e[this.__weakMapData__],!0)}),get:u(function(e){if(_.call(i(e),this.__weakMapData__))return e[this.__weakMapData__]}),has:u(function(e){return _.call(i(e),this.__weakMapData__)}),set:u(function(e,t){return h(i(e),this.__weakMapData__,u("c",t)),this}),toString:u(function(){return"[object WeakMap]"})}),h(n.prototype,d,u("c","WeakMap"))},function(e,t,r){"use strict";e.exports=function(){var e,t;if("function"!=typeof WeakMap)return!1;try{e=new WeakMap([[t={},"one"],[{},"two"],[{},"three"]])}catch(e){return!1}return"[object WeakMap]"===String(e)&&"function"==typeof e.set&&e.set({},1)===e&&"function"==typeof e.delete&&"function"==typeof e.has&&"one"===e.get(t)}},function(e,t,r){"use strict";e.exports=r(76)()?WeakMap:r(75)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(77),o=function(){function e(){this._map=new n}return e.prototype.get=function(e){return this._map.get(e)},e.prototype.set=function(e,t){this._map.set(e,t)},e.prototype.has=function(e){return this._map.has(e)},e.prototype.delete=function(e){return this._map.delete(e)},e}();t.SCWeakMap=o},function(e,t,r){!function(t){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,n=/^([^\/?#]*)(.*)$/,o=/(?:\/|^)\.(?=\/)/g,i=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,a={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),t=t.trim(),!t){if(!r.alwaysNormalize)return e;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");return o.path=a.normalizePath(o.path),a.buildURLFromParts(o)}var i=a.parseURL(t);if(!i)throw new Error("Error trying to parse relative URL.");if(i.scheme)return r.alwaysNormalize?(i.path=a.normalizePath(i.path),a.buildURLFromParts(i)):t;var s=a.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var u=n.exec(s.path);s.netLoc=u[1],s.path=u[2]}s.netLoc&&!s.path&&(s.path="/");var l={scheme:s.scheme,netLoc:i.netLoc,path:null,params:i.params,query:i.query,fragment:i.fragment};if(!i.netLoc&&(l.netLoc=s.netLoc,"/"!==i.path[0]))if(i.path){var c=s.path,d=c.substring(0,c.lastIndexOf("/")+1)+i.path;l.path=a.normalizePath(d)}else l.path=s.path,i.params||(l.params=s.params,i.query||(l.query=s.query));return null===l.path&&(l.path=r.alwaysNormalize?a.normalizePath(i.path):i.path),a.buildURLFromParts(l)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(o,"");e.length!==(e=e.replace(i,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=a}(this)},function(e,t,r){"use strict";function n(e){var t=a.exec(e);return t?t[1].toLowerCase():null}function o(e,t){return i.buildAbsoluteURL(e,t,{alwaysNormalize:!0})}Object.defineProperty(t,"__esModule",{value:!0});var i=r(79),a=/^.*\.([^\.;\?#]*).*$/;t.getExtension=n,t.buildAbsoluteUrl=o},function(e,t,r){"use strict";function n(e){var t=new Uint8Array(e.reduce(function(e,t){return e+t.byteLength},0)),r=0;return e.forEach(function(e){t.set(e,r),r+=e.byteLength}),t}function o(e,t){if(Uint8Array.prototype.fill)e.fill(t);else for(var r=0;r<e.length;r++)e[r]=t}function i(e,t){if(Uint8Array.prototype.forEach)e.forEach(t);else for(var r=0;r<e.length;r++)t(e[r],r)}function a(e,t){if(void 0===t&&(t=!1),e=Math.round(e),e<0)throw new Error("Negative numbers not supported.");for(var r=Math.max(1,Math.ceil(Math.log(e+1)/Math.log(2)/8)),n=new Uint8Array(r),o=0;o<r;o++)n[t?o:r-1-o]=255&e,e>>>=8;return n}function s(e){if(e<0||e>Math.pow(2,53))throw new Error("Unrepresentable value: "+e);var t;for(t=1;t<=8&&!(e<Math.pow(2,7*t)-1);t++);for(var r=new Uint8Array(t),n=1;n<=t;n++){var o=255&e;r[t-n]=o,e-=o,e/=Math.pow(2,8)}return r[0]|=1<<8-t,r}Object.defineProperty(t,"__esModule",{value:!0}),t.combine=n,t.fill=o,t.forEach=i,t.numberToUint8Array=a,t.createVintBuffer=s},function(e,t,r){"use strict";function n(e){return e.filter(function(e){return null!=e})}Object.defineProperty(t,"__esModule",{value:!0}),t.compact=n},function(e,t,r){"use strict";function n(e,t,r){return void 0===r&&(r=new Error("Timed out.")),new o.Promise(function(n,o){var a=window.setTimeout(function(){o(r)},t);i.always(e,function(e){return window.clearTimeout(a),e}).then(n,o)})}Object.defineProperty(t,"__esModule",{value:!0});var o=r(8),i=r(18);t.promiseWithTimeout=n},function(e,t,r){"use strict";function n(){return i?new window.Map:new a}Object.defineProperty(t,"__esModule",{value:!0});var o=r(17),i="undefined"!=typeof window&&"Map"in window;t.buildCache=n;var a=function(){function e(){this._store=[]}return e.prototype.set=function(e,t){var r=o.find(this._store,function(t){return t.key===e});r?r.val=t:this._store.push({key:e,val:t})},e.prototype.get=function(e){var t=o.find(this._store,function(t){return t.key===e});if(t)return t.val},e}()},function(e,t,r){"use strict";function n(e,t,r){void 0===r&&(r={});var n=null,o=0,a=!1,s=null,u=function(){var l=!1,c=function(){if(l)throw new Error("scheduleRetry() already called.");if(l=!0,s=null,a)return!1;var t=e(++o);if(null===t){var c=r.onNoMoreRetries;return c&&i.deferException(function(){return c()}),!1}return n=window.setTimeout(u,t),!0};s=t({attemptNum:o,scheduleRetry:c})||null};return u(),{cancel:function(){a||(a=!0,n&&(window.clearTimeout(n),n=null),s&&s.onCancel())}}}function o(e){var t=void 0===e?{}:e,r=t.timeBase,n=void 0===r?500:r,o=t.threshold,i=void 0===o?3:o,a=t.delayCap,s=void 0===a?45e3:a,u=t.jitter,l=void 0===u?200:u,c=t.maxAttempts,d=void 0===c?null:c;if(n<=0)throw new Error("Time base must be > 0.");if(i<=0)throw new Error("Threshold must be > 0.");if(null!==s&&s<=0)throw new Error("Delay cap must be null or > 0.");if(null!==d&&d<1)throw new Error("Max attempts must be >= 1.");return function(e){if(null!==d&&e>=d)return null;var t=e>0?Math.pow(2,e/i-1):0;return Math.min(t*n,s||1/0)+Math.round(Math.random()*l)}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(3);t.retry=n,t.buildExponentialDelayCalculator=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(13),i=r(37),a=r(85),s=r(30),u=r(17),l=r(84),c=r(19),d=r(8),p=r(83),f=r(18),h=r(82),_=r(81),g=r(3),y=r(36),v=r(80),m=r(78);!function(e){e.OnExit=s.OnExit,e.find=u.find,e.Promise=d.Promise,e.promiseWithTimeout=p.promiseWithTimeout,e.always=f.always,e.compact=h.compact,e.deferException=g.deferException,e.SCWeakMap=m.SCWeakMap;var t;!function(e){e.buildCache=l.buildCache}(t=e.cache||(e.cache={}));var r;!function(e){e.buildDeferred=o.buildDeferred}(r=e.deferred||(e.deferred={}));var n;!function(e){e.getExtension=v.getExtension,e.buildAbsoluteUrl=v.buildAbsoluteUrl}(n=e.url||(e.url={}));var E;!function(e){e.AbortableJob=i.AbortableJob,e.map=i.map,e.abortedError=i.abortedError}(E=e.abortableJob||(e.abortableJob={}));var b;!function(e){e.retry=a.retry,e.buildExponentialDelayCalculator=a.buildExponentialDelayCalculator}(b=e.retry||(e.retry={}));var w;!function(e){e.isSafari=y.isSafari,e.getSafariVersion=y.getSafariVersion,e.isIE=y.isIE,e.isEdge=y.isEdge,e.isFirefox=y.isFirefox,e.isChrome=y.isChrome,e.getChromeVersion=y.getChromeVersion,e.getFirefoxVersion=y.getFirefoxVersion}(w=e.browser||(e.browser={}));var P;!function(e){e.combine=_.combine,e.fill=_.fill,e.forEach=_.forEach,e.numberToUint8Array=_.numberToUint8Array,e.createVintBuffer=_.createVintBuffer}(P=e.arrayBuffer||(e.arrayBuffer={}));var S;!function(e){e.now=c.now}(S=e.time||(e.time={}))}(n=t.helpers||(t.helpers={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._msg=e,this._cause=t}return e.prototype.getMsg=function(){return this._msg},e.prototype.getCause=function(){return this._cause},e}();t.LoaderError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(87);!function(e){e.LoaderError=o.LoaderError}(n=t.loaderErrors||(t.loaderErrors={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=function(e){function t(t,r){return e.call(this,t||"The URL update failed for some reason.",r)||this}return n(t,e),t.prototype.getCode=function(){return"URL_UPDATE_ERROR"},t}(o.PlayerFatalError);t.URLUpdateError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(33),i=r(89),a=r(29),s=r(16),u=r(11),l=r(5);!function(e){e.PlayerError=u.PlayerError,e.PlayerFatalError=l.PlayerFatalError,e.NotSupportedError=o.NotSupportedError,e.URLUpdateError=i.URLUpdateError,e.ImplementationError=a.ImplementationError,e.ProxyProvidedPlayerFatalError=s.ProxyProvidedPlayerFatalError}(n=t.errors||(t.errors={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(12),a=r(35),s=r(16),u=function(e){function t(t){var r=e.call(this,t)||this;return r._onPlayerProvided=new o.EventDispatcher,r._onPlayerRemoved=new o.EventDispatcher,r._shouldPassThroughFatalErrors=!!t.shouldPassThroughFatalErrors,r.onPlayerProvided=r._onPlayerProvided.getHandle(),r.onPlayerRemoved=r._onPlayerRemoved.getHandle(),r._logger=i.prefixLogger(r._logger,"ProxyPlayer"),r}return n(t,e),t.prototype.providePlayer=function(e,t){void 0===t&&(t={}),this._providePlayer(e,t),this._onPlayerProvided.dispatch(e)},t.prototype.removePlayer=function(){var e=this._getPlayer();if(!e)throw new Error("There is no player to remove.");this._removePlayer(),this._onPlayerRemoved.dispatch(e)},t.prototype.setInitialDuration=function(e){this._setInitialDuration(e)},t.prototype.getPlayer=function(){return this._getPlayer()},t.prototype._handleFatalError=function(e,t){this._shouldPassThroughFatalErrors?this._triggerError(e):this._triggerError(new s.ProxyProvidedPlayerFatalError(e,t))},t}(a.ProxyPlayerBase);t.ProxyPlayer=u},function(e,t){},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===n||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function a(){_&&f&&(_=!1,f.length?h=f.concat(h):g=-1,h.length&&s())}function s(){if(!_){var e=o(a);_=!0;for(var t=h.length;t;){for(f=h,h=[];++g<t;)f&&f[g].run();g=-1,t=h.length}f=null,_=!1,i(e)}}function u(e,t){this.fun=e,this.array=t}function l(){}var c,d,p=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(e){c=r}try{d="function"==typeof clearTimeout?clearTimeout:n}catch(e){d=n}}();var f,h=[],_=!1,g=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];h.push(new u(e,t)),1!==h.length||_||o(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.prependListener=l,p.prependOnceListener=l,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,r){(function(t,n){/*!
23855
+ * @overview es6-promise - a tiny implementation of Promises/A+.
23856
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
23857
+ * @license Licensed under MIT license
23858
+ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
23859
+ * @version 4.0.5
23860
+ */
23861
+ !function(t,r){e.exports=r()}(this,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function i(e){Q=e}function a(e){Y=e}function s(){return function(){return t.nextTick(p)}}function u(){return"undefined"!=typeof K?function(){K(p)}:d()}function l(){var e=0,t=new $(p),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function c(){var e=new MessageChannel;return e.port1.onmessage=p,function(){return e.port2.postMessage(0)}}function d(){var e=setTimeout;return function(){return e(p,1)}}function p(){for(var e=0;e<J;e+=2){var t=re[e],r=re[e+1];t(r),re[e]=void 0,re[e+1]=void 0}J=0}function f(){try{var e=r(92);return K=e.runOnLoop||e.runOnContext,u()}catch(e){return d()}}function h(e,t){var r=arguments,n=this,o=new this.constructor(g);void 0===o[oe]&&L(o);var i=n._state;return i?!function(){var e=r[i-1];Y(function(){return k(i,o,e,n._result)})}():T(n,o,e,t),o}function _(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(g);return S(r,e),r}function g(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function v(){return new TypeError("A promises callback cannot return that same promise.")}function m(e){try{return e.then}catch(e){return ue.error=e,ue}}function E(e,t,r,n){try{e.call(t,r,n)}catch(e){return e}}function b(e,t,r){Y(function(e){var n=!1,o=E(r,t,function(r){n||(n=!0,t!==r?S(e,r):A(e,r))},function(t){n||(n=!0,O(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&o&&(n=!0,O(e,o))},e)}function w(e,t){t._state===ae?A(e,t._result):t._state===se?O(e,t._result):T(t,void 0,function(t){return S(e,t)},function(t){return O(e,t)})}function P(e,t,r){t.constructor===e.constructor&&r===h&&t.constructor.resolve===_?w(e,t):r===ue?O(e,ue.error):void 0===r?A(e,t):o(r)?b(e,t,r):A(e,t)}function S(t,r){t===r?O(t,y()):e(r)?P(t,r,m(r)):A(t,r)}function R(e){e._onerror&&e._onerror(e._result),x(e)}function A(e,t){e._state===ie&&(e._result=t,e._state=ae,0!==e._subscribers.length&&Y(x,e))}function O(e,t){e._state===ie&&(e._state=se,e._result=t,Y(R,e))}function T(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ae]=r,o[i+se]=n,0===i&&e._state&&Y(x,e)}function x(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n=void 0,o=void 0,i=e._result,a=0;a<t.length;a+=3)n=t[a],o=t[a+r],n?k(r,n,o,i):o(i);e._subscribers.length=0}}function M(){this.error=null}function D(e,t){try{return e(t)}catch(e){return le.error=e,le}}function k(e,t,r,n){var i=o(r),a=void 0,s=void 0,u=void 0,l=void 0;if(i){if(a=D(r,n),a===le?(l=!0,s=a.error,a=null):u=!0,t===a)return void O(t,v())}else a=n,u=!0;t._state!==ie||(i&&u?S(t,a):l?O(t,s):e===ae?A(t,a):e===se&&O(t,a))}function I(e,t){try{t(function(t){S(e,t)},function(t){O(e,t)})}catch(t){O(e,t)}}function C(){return ce++}function L(e){e[oe]=ce++,e._state=void 0,e._result=void 0,e._subscribers=[]}function N(e,t){this._instanceConstructor=e,this.promise=new e(g),this.promise[oe]||L(this.promise),W(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?A(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&A(this.promise,this._result))):O(this.promise,F())}function F(){return new Error("Array Methods must be provided an Array")}function U(e){return new N(this,e).promise}function j(e){var t=this;return new t(W(e)?function(r,n){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(r,n)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function B(e){var t=this,r=new t(g);return O(r,e),r}function q(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function H(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function z(e){this[oe]=C(),this._result=this._state=void 0,this._subscribers=[],g!==e&&("function"!=typeof e&&q(),this instanceof z?I(this,e):H())}function G(){var e=void 0;if("undefined"!=typeof n)e=n;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=z}var V=void 0;V=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var W=V,J=0,K=void 0,Q=void 0,Y=function(e,t){re[J]=e,re[J+1]=t,J+=2,2===J&&(Q?Q(p):ne())},X="undefined"!=typeof window?window:void 0,Z=X||{},$=Z.MutationObserver||Z.WebKitMutationObserver,ee="undefined"==typeof self&&"undefined"!=typeof t&&"[object process]"==={}.toString.call(t),te="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,re=new Array(1e3),ne=void 0;ne=ee?s():$?l():te?c():void 0===X?f():d();var oe=Math.random().toString(36).substring(16),ie=void 0,ae=1,se=2,ue=new M,le=new M,ce=0;return N.prototype._enumerate=function(){for(var e=this.length,t=this._input,r=0;this._state===ie&&r<e;r++)this._eachEntry(t[r],r)},N.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,n=r.resolve;if(n===_){var o=m(e);if(o===h&&e._state!==ie)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(r===z){var i=new r(g);P(i,e,o),this._willSettleAt(i,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},N.prototype._settledAt=function(e,t,r){var n=this.promise;n._state===ie&&(this._remaining--,e===se?O(n,r):this._result[t]=r),0===this._remaining&&A(n,this._result)},N.prototype._willSettleAt=function(e,t){var r=this;T(e,void 0,function(e){return r._settledAt(ae,t,e)},function(e){return r._settledAt(se,t,e)})},z.all=U,z.race=j,z.resolve=_,z.reject=B,z._setScheduler=i,z._setAsap=a,z._asap=Y,z.prototype={constructor:z,then:h,catch:function(e){return this.then(null,e)}},z.polyfill=G,z.Promise=z,z})}).call(this,r(94),r(93))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(13),i=r(6),a=r(37),s=r(3);!function(e){e[e.PENDING=0]="PENDING",e[e.WAITING=1]="WAITING",e[e.IN_PROGRESS=2]="IN_PROGRESS",e[e.COMPLETED=3]="COMPLETED",e[e.ERRORED=4]="ERRORED"}(n=t.ResponseState||(t.ResponseState={}));var u=function(){function e(){var e=this;this._responseDeferred=o.buildDeferred(),this._requestStartCallbacks=[],this._parts=[],this._progressEventDispatcher=new i.EventDispatcher,this._cachedCompleteParts=null,this._state=n.PENDING,this._statusAndHeaders=null,this._getProgressSoFar=function(){if(!e._parts.length)return null;if(!e._statusAndHeaders)throw new Error("Headers should be set.");return{initial:!0,statusCode:e._statusAndHeaders.statusCode,headers:e._statusAndHeaders.headers,part:e._getDataSoFar()}};var t=new a.AbortableJob(function(){return{result:e._responseDeferred.promise,progressUpdates:{getProgressSoFar:e._getProgressSoFar,onProgressUpdate:e._progressEventDispatcher}}},{storeResult:!0});this._jobHandle=t.run()}return e.prototype.onProgress=function(e){this._jobHandle.onProgressUpdate(e)},e.prototype.getResponse=function(){return this._jobHandle.whenComplete()},e.prototype.onRequestStart=function(e){this._state!==n.PENDING?s.deferException(e):this._requestStartCallbacks.push(e)},e.prototype.onResponseReceived=function(e){this._jobHandle.onCompletion(e)},e.prototype.onError=function(e){this._jobHandle.onError(e)},e.prototype.hasRequestStarted=function(){return this._state!==n.PENDING},e.prototype.hasCompleted=function(){return this._state===n.COMPLETED||this._state===n.ERRORED},e.prototype.getState=function(){return this._state},e.prototype.abort=function(){[n.ERRORED,n.COMPLETED].indexOf(this._state)===-1&&(this._jobHandle.abort(),this._state=n.ERRORED,this._abort())},e.prototype._signalRequestStart=function(){this._enforceState(n.PENDING),this._state=n.WAITING,this._requestStartCallbacks.splice(0).forEach(function(e){return s.deferException(e)})},e.prototype._signalTimeout=function(){this._enforceState(n.WAITING,n.IN_PROGRESS),this._state=n.COMPLETED,this._requestStartCallbacks.splice(0),this._responseDeferred.resolve(null)},e.prototype._provideStatusAndHeaders=function(e,t){this._enforceState(n.WAITING),this._statusAndHeaders=e,this._state=n.IN_PROGRESS,this._providePart(t)},e.prototype._providePart=function(e){this._enforceState(n.IN_PROGRESS);var t=!this._parts.length;if(this._parts.push(e),!this._statusAndHeaders)throw new Error("Headers should be set.");this._progressEventDispatcher.dispatch({initial:t,statusCode:this._statusAndHeaders.statusCode,headers:this._statusAndHeaders.headers,part:e})},e.prototype._finalize=function(e){var t=this;if(e)this._enforceState(n.PENDING,n.WAITING,n.IN_PROGRESS),this._state=n.ERRORED,this._requestStartCallbacks.splice(0),this._responseDeferred.reject(e);else{if(this._enforceState(n.IN_PROGRESS),this._state=n.COMPLETED,!this._statusAndHeaders)throw new Error("Headers should be set.");this._responseDeferred.resolve({statusCode:this._statusAndHeaders.statusCode,headers:this._statusAndHeaders.headers,getData:function(){if(!t._parts.length)throw new Error("Unexpected error. No parts.");return t._cachedCompleteParts?t._cachedCompleteParts:t._cachedCompleteParts=t._getDataSoFar()}})}},e.prototype._getDataSoFar=function(){var e=this._parts.length;if(!e)throw new Error("No parts.");return 1===e?this._parts[0]:this._reduceParts(this._parts)},e.prototype._enforceState=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.indexOf(this._state)===-1)throw new Error("Invalid state. Got "+this._state+" Expecting one of "+e.join(","))},e}();t.LoaderRequest=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(6),o=r(96),i=r(12),a=r(91);t.ProxyPlayer=a.ProxyPlayer;var s=r(35);t.ProxyPlayerBase=s.ProxyPlayerBase;var u=r(90);t.errors=u.errors;var l=r(88);t.loaderErrors=l.loaderErrors;var c=r(86);t.helpers=c.helpers;var d=r(34);t.BasePlayer=d.BasePlayer;var p=r(32);t.State=p.State;var f=r(31);t.StateManager=f.StateManager;var h=r(38);t.TimeRange=h.TimeRange;var _;!function(e){e.EventDispatcher=n.EventDispatcher}(_=t.eventDispatcher||(t.eventDispatcher={}));var g;!function(e){e.LoaderRequest=o.LoaderRequest,e.ResponseState=o.ResponseState}(g=t.loader||(t.loader={}));var y;!function(e){e.noOpLogger=i.noOpLogger,e.consoleLogger=i.consoleLogger,e.prefixLogger=i.prefixLogger,e.cloneLogger=i.cloneLogger}(y=t.logger||(t.logger={}))}])})},function(e,t,r){!function(t,n){e.exports=n(r(4),r(2),r(1))}(window,function(e,t,r){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(0),i=new o.WebAudioContext,a=function(){function e(e,t){this._playerListeners=new n.helpers.SCWeakMap,this._playerWithElement=null,this._canActivate=!0,this._provideMediaElementErrorRunCheck={},this._element=document.createElement(e),this._logger=n.logger.prefixLogger(t,"MediaElementManager")}return e.prototype.activate=function(){this._canActivate&&(this._logger.debug("Activating media element."),this._element.load()),this._logger.debug("Activating web audio context."),i.activate()},e.prototype.registerPlayer=function(e,t){var r=this;if(this._playerListeners.has(e))throw new Error("Player already registered.");var n=function(){if(e.getMediaElement()!==r._element){r._playerWithElement&&(r._playerWithElement.getMediaElement()===r._element&&(r._logger.debug("Revoking media element from previous player."),r._playerWithElement.isPlaying()&&r._logger.warn("Revoking media element from a playing player."),r._playerWithElement.revokeMediaElement()),r._playerWithElement=null),r._canActivate=!1;var n=r._provideMediaElementErrorRunCheck={};r._logger.debug("Providing media element to new player."),e.provideMediaElement(r._element).catch(function(o){e.isDead()||r._provideMediaElementErrorRunCheck!==n||(r._logger.error("Error occurred providing media element to new player.",o),t(o))}),r._playerWithElement=e}},o=e.onChange.subscribe(function(e){var t=e.playing;t&&n()});this._playerListeners.set(e,o),e.getMediaElement()&&e.revokeMediaElement(),e.isPlaying()&&n()},e.prototype.unregisterPlayer=function(e){var t=this._playerListeners.get(e);t&&(t.remove(),this._playerWithElement===e&&(this._playerWithElement=null,e.getMediaElement()===this._element&&e.revokeMediaElement()),this._playerListeners.delete(e))},e.prototype.getWebAudioContext=function(){return i},e}();t.MediaElementManager=a},function(e,t){e.exports=r},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(3),i=r(1),a=r(0),s=function(e){function t(t){var r=e.call(this)||this;return r._mediaElementManager=t,r.name="MaestroHTML5",r}return n(t,e),t.errorQualifiesAbort=function(e){return!(e instanceof a.errors.WebAudioInitializeError)},t.prototype.isRenditionSupported=function(e,t){return("http"===e.scProtocol||["hls","encrypted-hls"].indexOf(e.scProtocol)!==-1&&!t.streamUrlExpires)&&a.HTML5Player.isFormatSupported(e.maestroFormat)},t.prototype.buildPlayer=function(e){var t=e.urlAndRendition,r=t.rendition,n=t.timeRetrieved;if(e.streamUrlExpires&&(["hls","encrypted-hls"].indexOf(r.scProtocol)>=0||void 0===n))throw o.notSupportedError;return new u(e,this._mediaElementManager)},t}(o.BaseController);t.HTML5PlayerController=s;var u=function(){function e(e,t){var r=this;this._config=e,this._mediaElementManager=t;var n=e.logger,o=e.playerId,i=e.urlAndRendition,u=e.streamUrlExpires,l=e.reportError,c=e.fadeOnPauseAndPlay,d=e.fadeOnSeek,p=e.releaseControl;this._logger=n;var f=i.rendition,h=i.timeRetrieved;if(u){if(void 0===h)throw new Error("Expecting timeUrlRetrieved to be set.");this._expirationConfig={urlExpires:!0,timeUrlRetrieved:h}}else this._expirationConfig={urlExpires:!1};var _=this._player=new a.HTML5Player({url:i.url,format:f.maestroFormat},{name:o,mediaElement:null,fadeSupportEnabled:c||d,defaultFadeDuration:c?void 0:0,defaultSeekFadeInDuration:d?void 0:0,defaultSeekFadeOutDuration:d?void 0:0,webAudioContext:this._mediaElementManager.getWebAudioContext(),logger:this._logger,registerListeners:function(e){var t=e.onError,n=e.onChange;t.subscribe(function(e){e instanceof a.errors.NetworkError&&r._hasExpired()?(r._logger.info("Releasing control as a network error occurred, and the URL has expired."),p({retry:!0})):(l(e.getCode()),s.errorQualifiesAbort(e)&&p({retry:!1}))}),n.subscribe(function(e){var t=e.dead,n=e.playing,o=e.actuallyPlaying,i=e.seeking,a=e.duration;return t?void p({retry:!1}):a===1/0?(r._logger.info("Releasing control because the duration was Infinity."),void p({retry:!1})):void(r._expirationConfig.urlExpires&&(n||o||i)&&r._checkIfUrlWillExpireBeforeEnd())})}});this._mediaElementManager.registerPlayer(_,function(){return p({retry:!1})})}return e.prototype.getPlayer=function(){return this._player},e.prototype.getUrl=function(){return this._config.urlAndRendition.url},e.prototype._checkIfUrlWillExpireBeforeEnd=function(){var e=this._player.getDuration(),t=this._getExpireTime();if(null!==e&&null!==t){var r=e-this._player.getPosition();i.helpers.time.now()+r>t&&(this._logger.info("Releasing control because stream URL would expire before reaching end."),this._config.releaseControl({retry:!0}))}},e.prototype._getExpireTime=function(){if(!this._expirationConfig.urlExpires)return null;var e=this._player.getDuration();return null===e?null:this._expirationConfig.timeUrlRetrieved+e+105e3},e.prototype._hasExpired=function(){var e=this._getExpireTime();return null!==e&&e<=i.helpers.time.now()},e}();t.ControlledPlayer=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.1.0",t.buildNumber=845;var n=r(4);t.HTML5PlayerController=n.HTML5PlayerController;var o=r(2);t.MediaElementManager=o.MediaElementManager;var i=r(0);t.HTML5Player=i.HTML5Player}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=18)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e,t){void 0===t&&(t={});var r=e.mimeType||t.mimeType;if(!r)return null;var n=e.audioCodec||t.audioCodec,i=e.videoCodec||t.videoCodec,a=o.helpers.compact([n,i]),s=a.length>0?'; codecs="'+a.map(function(e){return e.id}).join(",")+'"':"";return r+s}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0);t.buildMimeTypeFromFormat=n},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t,r){return void 0===t&&(t="An error occurred when initializing web audio."),e.call(this,t,r)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_INITIALIZE_ERROR"},t}(o.errors.PlayerError);t.WebAudioInitializeError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t,r){return void 0===t&&(t="An error occurred when activating web audio."),e.call(this,t,r)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_ACTIVATION_ERROR"},t}(o.errors.PlayerFatalError);t.WebAudioActivationError=i},function(e,t,r){"use strict";function n(){return"AudioContext"in window&&(a.helpers.browser.isChrome()||u&&u.major>=48||a.helpers.browser.isEdge())}function o(){if(l)return l;if(!n())throw new Error("Web audio is not enabled.");var e=new window.AudioContext;if(!e.destination.maxChannelCount)throw t.WEB_AUDIO_NO_OUTPUT_CHANNELS_ERROR;return l={context:e,suspender:new s.WebAudioContextSuspender(e)}}function i(e){return e.state&&e.resume&&"running"!==e.state?a.helpers.promiseWithTimeout(e.resume(),t.WEB_AUDIO_ACTIVATION_TIMEOUT,t.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR):a.helpers.Promise.resolve()}Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(15),u=a.helpers.browser.getFirefoxVersion();t.WEB_AUDIO_ACTIVATION_TIMEOUT=5e3,t.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR=new Error("Web audio activation timed out."),t.WEB_AUDIO_NO_OUTPUT_CHANNELS_ERROR=new Error("Web audio found no output channels.");var l=null,c=function(){function e(){}return e.prototype.getAudioContextWithSuspender=function(){return n()?o():null},e.prototype.activate=function(){if(!n())return a.helpers.Promise.resolve(void 0);try{var e=o().context;return i(e)}catch(e){return a.helpers.Promise.reject(e)}},e}();t.WebAudioContext=c},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),i=function(e){function t(t){return e.call(this,"Web audio found no channels.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_INITIALIZE_NO_CHANNELS_ERROR"},t}(o.WebAudioInitializeError);t.WebAudioInitializeNoChannelsError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(3),i=function(e){function t(t){return e.call(this,"We timed out when trying to activate web audio.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR"},t}(o.WebAudioActivationError);t.WebAudioActivationTimeoutError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){var r=e.call(this,"Unexpected error from media element.",t)||this;return r._error=t,r}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.UNEXPECTED_MEDIA_ELEMENT_ERROR_"+(this._error&&this._error.code||"UNKNWON")},t}(o.errors.PlayerFatalError);t.MediaElementError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return e.call(this,"An unrecoverable error occurred whilst decoding.")||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.DECODE_ERROR"},t}(o.errors.PlayerFatalError);t.DecodeError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return e.call(this,"An unrecoverable network error occurred.")||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.NETWORK_ERROR"},t}(o.errors.PlayerFatalError);t.NetworkError=i},function(e,t,r){"use strict";function n(e){for(var t=[],r=e.length,n=0;n<r;n++)t.push({end:1e3*e.end(n),start:1e3*e.start(n)});return o.TimeRange.normalizeRawTimeRanges(t).map(function(e){return new o.TimeRange(e.start,e.end-e.start)})}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0);t.buildTimeRanges=n},function(e,t,r){"use strict";function n(){return C?C:C=new v.WebAudioContext}function o(e){e.load()}function i(e){try{var t=document.createElement("audio");return!!t.canPlayType(e)}catch(e){return!1}}var a=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var s=r(0),u=r(10),l=r(17),c=r(9),d=r(8),p=r(7),f=r(16),h=r(6),_=r(2),g=r(5),y=r(3),v=r(4),m=r(1),E=s.helpers.deferred.buildDeferred,b=s.helpers.url.getExtension,w=s.helpers.Promise,P=s.helpers.browser,S=s.logger.prefixLogger,R=s.errors.NotSupportedError,A=s.errors.PlayerFatalError,O=new Error("Media element was revoked."),T=10,x=200,M=500,D=400,k=[],I=new s.helpers.SCWeakMap,C=null,L=s.helpers.retry.buildExponentialDelayCalculator({jitter:0,timeBase:50}),N=function(e){function t(t){var r=e.call(this,t)||this;r._duration=null,r._stallDetected=!1,r._fadeManagers=null,r._shouldCoverGlitch=!0,r._initialized=!1,r._muted=!1,r._volume=1,r._deferredProvideMediaElementCallback=null,r._playInProgress={inProgress:!1},r._lastStallCheckPos=null,r._stallCheckTimerId=null,r._timeWhenPositionChanged=0,r._endedOverride=!1,r._pauseEventTimer=null,r._positionWhenMediaElementRevoked=0,r._playingWhenMediaElementRevoked=!1,r._provideMediaElementDeferred=null,r._mediaElementAndState=null,r._listeners=[],r._currentSeek=null,r._playDetectionPosition=0,r._playDetectionTimer=null,r._playDetectionTimerNumAttempts=0,r._fadeRate=null,r._seekFadeRate=null,r._webAudioOrchestration=null,r._fadeEndedHandle=null,r._onSeekFadeOutCompleted=null,r._fadeRateAfterSeek=1/0,r._mediaElPlayShouldBeAborted=new s.helpers.SCWeakMap,r._mediaElPaused=new s.helpers.SCWeakMap,r._mediaElPlayTracker=null,r._logger=S(r._logger,"HTML5PlayerBase"),r._playerDependencies=t,r._webAudioContext=t.webAudioContext||n();var o=r._webAudioOrchestration=t.fadeSupportEnabled?r._initWebAudio():null;o&&(r._logger.debug("Fading supported."),r._fadeManagers={pausePlay:new l.FadeManager(o.context,o.gainNodes.pausePlay),seek:new l.FadeManager(o.context,o.gainNodes.seek)}),r._handleDurationUpdates();var i=void 0!==t.mediaElement?t.mediaElement:r._createDefaultMediaElement();i&&r.provideMediaElement(i).catch(function(e){return e===O?void r._logger.debug("Initial provideMediaElement() call was aborted."):void r._triggerError(new f.InitializeError(e))});var a=r._fadeManagers;return a&&r.onChange.subscribe(function(e){var t=e.stalled,n=e.seek,o=e.ended;if(o&&a.seek.getDirection()===l.FadeDirection.UP&&a.seek.isFading())r._logger.debug("Completing fade in after seek early because reached end."),a.seek.performFade(1/0),r._notifyFadingForSeek(!1);else{var i=r.getSeekState(),s=i&&"COMPLETED"===i.state,u=n&&"COMPLETED"===n.state;(t===!1&&s||u&&!r.isStalled())&&a.seek.getDirection()===l.FadeDirection.DOWN&&(r._logger.debug("Fading in after seek.",r._fadeRateAfterSeek),a.seek.performFade(r._fadeRateAfterSeek,function(){return r._notifyFadingForSeek(!1)}))}}),r._logger.info("Checking if the player can play the provided descriptor."),r._canPlayTimer=window.setTimeout(function(){r._canPlay().then(function(e){if(!r.isDead())return e instanceof s.errors.NotSupportedError?(r._logger.info("Player not supported.",e),void r._triggerError(e)):e?(r._logger.info("Player supported."),void r._initialize()):(r._logger.info("Player not supported."),void r._triggerError(new R))}).catch(function(e){r._logger.error("Unexpected error during can play check.",e),r._triggerError(new A("An unexpected error occured during initialization.",e))})},0),r}return a(t,e),t.isFormatSupported=function(e){var t=m.buildMimeTypeFromFormat(e);return!!t&&i(t)},t.prototype.getMediaElement=function(){return this._mediaElementAndState&&this._mediaElementAndState.element},t.prototype.provideMediaElement=function(e){var t=this;if(this._ensureNotDead(),this._mediaElementAndState)throw new Error("Already have a media element.");if(k.indexOf(e)>=0)throw new Error("The same media element is currently being used in another player.");if(!this._webAudioOrchestration&&I.has(e))throw new Error("The same media element has been used in another player with fading enabled.");k.push(e);var r=this._provideMediaElementDeferred=E();return this._update(function(){t._logger.debug("provideMediaElement() called.",e),t._initMediaElementLocal(e,!1);var n=t._mediaElementAndState={element:e,state:"INITIALIZING"},o=function(){t._logger.debug("Initializing media element."),t._initMediaElement(e,!0),t._addPausedHandlers(e),t._attachListeners();var o=t._listenToOnce("error",function(){t._provideMediaElementDeferred=null;var n=e.error,o=n?n.code:"unknown";t._logger.error("Error whilst initializing media element.",o),t.revokeMediaElement(),r.reject(new Error("Error when initializing media element. Error: "+o))},{earlyAttach:!0}),i=function(){t._logger.debug("Putting media element in the state that is expected..."),a()},a=function(){null===t._getQueuedSeekPosition()&&t._positionWhenMediaElementRevoked>0?(t._logger.debug("Seeking to expected position..."),t._performSeek(t._positionWhenMediaElementRevoked,function(e){return void 0!==e?(t._provideMediaElementDeferred=null,t._logger.error("An error occurred when trying to seek to the expected position."),t.revokeMediaElement(),void r.reject(new Error("An error occurred when trying to restore the position."))):(t._logger.debug("Seeked to expected position."),void s())})):s()},s=function(){t.isPlaying()===t.isActuallyPlaying()&&t._playingWhenMediaElementRevoked?(t._logger.debug("Calling play to match previous state..."),t._mediaElementPlay().catch(function(e){t._provideMediaElementDeferred=null,t._logger.error("An error occurred when trying to play.",e),n===t._mediaElementAndState&&t.revokeMediaElement(),r.reject(new Error("Browser refused play() request on media element."))}),t._listenToOnce("play",function(){t._logger.debug("Play succeeded."),u()},{earlyAttach:!0})):u()},u=function(){return t._mediaElementAndState!==n?void t._triggerError(new A("Media element switched unexpectedly.")):(t._provideMediaElementDeferred=null,o.remove(),r.resolve(void 0),t._mediaElementAndState.state="STABLE",t._logger.debug("Finished putting element in expected state."),t._shouldCoverGlitch=!0,void(null!==t._duration&&t._update(function(){t.isReady()||t._signalReady(),t._handleDeferredPauseAndSeek()})))};t._listenToOnce("emptied",function(){t._logger.debug("Got emptied event from media element."),i()},{earlyAttach:!0})};t._initialized?o():t._deferredProvideMediaElementCallback=o}),r.promise},t.prototype.revokeMediaElement=function(){var e=this;if(!this._mediaElementAndState)throw new Error("There is no media element to revoke.");this._deferredProvideMediaElementCallback=null,this._provideMediaElementDeferred&&(this._provideMediaElementDeferred.reject(O),this._provideMediaElementDeferred=null),this._logger.debug("revokeMediaElement() called."),this._detachListeners();var t=this._mediaElementAndState.element,r=k.indexOf(t);r>=0&&k.splice(r,1),this._onSeekFadeOutCompleted=null,this.isDead()||(this._positionWhenMediaElementRevoked=this.getPosition(),this._playingWhenMediaElementRevoked=this.isPlaying()),this._mediaElementAndState=null,this._initMediaElement(t,!1),this._removePausedHandlers(t),this._completeCurrentFade(),this._completeSeekFadeOutAndIn(),this._update(function(){e.isDead()||(!e.isPlaying()&&e.isActuallyPlaying()&&e._notifyPlaying(!1),e._handleStalled())})},t.prototype.getBufferedTimeRanges=function(){return this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state?u.buildTimeRanges(this._mediaElementAndState.element.buffered):[];
23862
+ },t.prototype.getMaxBufferLength=function(){return null},t.prototype._hasInitialized=function(){return this._initialized},t.prototype._inferFormat=function(e){var t=b(e);switch(t){case"mp3":return{mimeType:"audio/mpeg"};case"opus":return{mimeType:"audio/ogg",audioCodec:{id:"opus"}};case"mp4":return{mimeType:"video/mp4"};case"m4a":return{mimeType:"audio/mp4"};case"m3u8":return{mimeType:"application/x-mpegURL"};default:return{}}},t.prototype._canPlayType=function(e){return i(e)},t.prototype._initialize=function(){var e=this;this._initialized=!0,this._listenTo("error",function(){if("INITIALIZING"===e._mediaElementAndState.state)return void e._logger.debug("An error occurred, but the media element is initializing, so ignoring...");var t=e._mediaElementAndState.element.error;switch(t&&t.code){case 2:e._triggerError(new c.NetworkError);break;case 3:e._triggerError(new d.DecodeError);break;default:e._logger.error("Unexpected error from media element.",t&&t.code,t&&t.message),e._triggerError(new p.MediaElementError(t))}},{earlyAttach:!0}),this._listenTo("play",function(){e._logger.debug("Media element play event."),e.isPlaying()||e.isActuallyPlaying()||!e._mediaElementAndState||e._isMediaElementPaused(e._mediaElementAndState.element)||(e._logger.debug("Calling play() because something external called play() on media element."),e.play())}),this._listenTo("playing",function(){e._logger.debug("Media element playing event."),e._mediaElementAndState&&!e._isMediaElementPaused(e._mediaElementAndState.element)?e._handlePlayingEvent():e._logger.debug("Ignoring playing event because media element is reporting it is paused.")}),this._listenTo("timeupdate",function(){return e._determineIfPlaying()}),this._listenTo("pause",function(){e._logger.debug("Media element pause event."),e._mediaElementAndState&&e._isMediaElementPaused(e._mediaElementAndState.element)?e._handlePauseEvent():e._logger.debug("Ignoring pause event because media element is reporting it is not paused.")}),this._listenTo("ended",function(){e._logger.debug("Media element ended event."),e._mediaElementAndState&&e._mediaElementAndState.element.ended?e._handleEndedEvent():e._logger.debug("Ignoring ended event because media element is reporting it is not ended.")}),this._listenTo("stalled",function(){e._logger.debug("Media element stalled event."),e._checkIfStalled()}),this._listenTo("volumechange",function(){e._mediaElementAndState&&e._notifyVolumeChangeFromMediaEl(e._mediaElementAndState.element)}),this._stallCheckTimerId=window.setInterval(function(){return e._checkIfStalled()},D),this._deferredProvideMediaElementCallback&&this._deferredProvideMediaElementCallback()},t.prototype._handleDurationChange=function(){var e=this,t=this._duration;null!==t&&this._update(function(){e._provideDuration(t),e._mediaElementAndState&&"STABLE"===e._mediaElementAndState.state&&(e._signalReady(),e._handleDeferredPauseAndSeek())})},t.prototype._createDefaultMediaElement=function(){return document.createElement(this._playerDependencies.mediaElementType||"audio")},t.prototype._handlePauseEvent=function(){var e=this;if(!this._mediaElementAndState)throw new Error("Media element should exist.");var t=this._mediaElementAndState.element;this.isActuallyPlaying()&&this._update(function(){t.ended||(e._notifyNotStalled(),e._completeCurrentFade(),e._completeSeekFadeOutAndIn(),e._notifyPlaying(!1))})},t.prototype._handlePlayingEvent=function(){var e=this,t=this._duration;if(null===t)throw new Error("Expecting duration to exist.");var r=this._getTruePosition();return r>=t?void this._logger.warn("Got a media element playing event and the positon was >= the duration.",r,t):this.isEnded()||this._shouldBeEnded()?void this._logger.warn("Got a media element playing event when the player is/should be ended."):void this._update(function(){e._notifyNotStalled(),e._determineIfPlaying(),e.isActuallyPlaying()||(e._playDetectionTimerNumAttempts=0,e._playDetectionTimer||(e._playDetectionTimer=window.setInterval(function(){return e._determineIfPlaying()},T)))})},t.prototype._handleEndedEvent=function(){return null!==this._getQueuedSeekPosition()?void this._logger.warn("Got a media element ended event but ignoring because a seek is in progress."):void this._update()},t.prototype._shouldBeEnded=function(){return this._endedOverride||this._mediaElementReportingEnded()},t.prototype._mediaElementReportingEnded=function(){return!!(this._mediaElementAndState&&this._mediaElementAndState.element.ended&&this._mediaElementAndState.element.paused)},t.prototype._handleDurationUpdates=function(){var e=this;this._listenToOnce("loadedmetadata",function(){return e._updateDurationFromMediaElement()},{reattach:!0,earlyAttach:!0}),this._listenTo("durationchange",function(){return e._updateDurationFromMediaElement()})},t.prototype._updateDurationFromMediaElement=function(){var e=this._mediaElementAndState;e&&(this._duration=1e3*e.element.duration,this._handleDurationChange())},t.prototype._handlePlayPauseChange=function(e,t){var r=this,n=t.fadeRate;this._fadeRate=n||null;var o=function(){r._mediaElementAndState&&"USABLE"===r._mediaElementAndState.state&&r._callMediaElementPause(r._mediaElementAndState.element),r._notifyFading(!1),r._completeSeekFadeOutAndIn(),r._notifyPlaying(!1)};if(this.isEnded())e?this._notifyPlaying(!0):o();else if(this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state){var i=this._playInProgress.inProgress||!this._isMediaElementPaused(this._mediaElementAndState.element);e&&!i?(this._fadeManagers&&this._fadeManagers.pausePlay.performFade(-(1/0)),this._playDetectionPosition=this._getTruePosition(),this._play(function(e){return r._notifyPlayRejection(e)})):!e&&i?this._update(function(){r._fadeManagers&&r._fadeManagers.pausePlay.getDirection()===l.FadeDirection.UP?(r._notifyFading(!0),r._fadeManagers.pausePlay.performFade(n||-(1/0),function(){return o()})):o()}):e&&i?this._update(function(){r._fadeManagers&&r._fadeManagers.pausePlay.getDirection()===l.FadeDirection.DOWN&&r._fadeManagers.pausePlay.performFade(n||1/0,function(){return r._notifyFading(!1)}),r._notifyPlaying(!0)}):this._notifyPlaying(e)}},t.prototype._handleVolumeChange=function(e,t){if(this._mediaElementAndState){var r=this._mediaElementAndState.element;r.muted=t,r.volume=e,this._notifyVolumeChangeFromMediaEl(r)}else this._muted=t,this._volume=e,this._notifyVolumeChange(e,t)},t.prototype._handleSeekChange=function(e,t){var r=this,n=t.fadeRate;this._seekFadeRate=n,this._fadeRateAfterSeek=n.afterSeek||1/0;var o=this._mediaElementAndState;if(o&&"USABLE"===o.state){this._onSeekFadeOutCompleted=function(){r._onSeekFadeOutCompleted=null,a&&a.remove(),i&&i.seek.getDirection()===l.FadeDirection.DOWN&&(r._logger.debug("Fade out for seek completed.",e,n),i.seek.performFade(-(1/0)),r._notifyFadingForSeek(!1));var t=r._mediaElementReportingEnded();r._endedOverride=!1,r._performSeek(e,function(t){return void 0!==t?void r._triggerError(new s.errors.PlayerFatalError("An error occurred when trying to seek.",t)):(e===r._duration&&(r._endedOverride=!0),void r._update(function(){r.isActuallyPlaying()&&r._assumeStalled(),r._signalSeekComplete(),i&&(!r.isActuallyPlaying()||r._fadeRateAfterSeek===1/0||r.isEnded()?i.seek.performFade(1/0):r._notifyFadingForSeek(!0))}))}),t&&r.isPlaying()&&r._play(function(e){r._triggerError(new s.errors.PlayerFatalError("Error when trying to play after seek from end.",e))})},this._fadeEndedHandle&&(this._fadeEndedHandle.remove(),this._fadeEndedHandle=null);var i=this._fadeManagers,a=null,u=function(){r._onSeekFadeOutCompleted&&r._onSeekFadeOutCompleted()};this._update(function(){i&&(n.beforeSeek||n.afterSeek)?(r._logger.debug("Fading out ready for seek.",e,n),(i.seek.getDirection()===l.FadeDirection.UP||i.seek.isFading())&&r.isActuallyPlaying()&&n.beforeSeek&&!r._mediaElementReportingEnded()?(r._notifyFadingForSeek(!0),a=r._fadeEndedHandle=r._listenToOnce("ended",u),i.seek.performFade(n.beforeSeek||-(1/0),u)):(i.seek.performFade(-(1/0)),u())):u()})}},t.prototype._performSeek=function(e,t){var r=this,n=this._mediaElementAndState;if(!n)throw new Error("Media element does not exist.");var o=this._currentSeek;o&&(this._currentSeek=null,o.abort());var i=n.element;if(i.currentTime===e/1e3)return void t();var a=0,s=function(){var n=[],o=function(){r._currentSeek&&(r._currentSeek.abort(),r._currentSeek=null),t()};try{i.currentTime=e/1e3}catch(t){r._logger.warn("Error when trying to seek.",t,e)}r._playDetectionPosition=1e3*i.currentTime;var u=window.setTimeout(function(){r._logger.warn("Seek attempt failed. Retrying...",e,a),l(),s()},L(++a));n.push(r._listenToOnce("seeking",function(){window.clearTimeout(u)},{earlyAttach:!0})),n.push(r._listenToOnce("seeked",function(){var t=1e3*i.currentTime;Math.abs(t-e)<=100?o():(r._logger.warn("Seek attempt failed. Incorect position. Retrying...",t,e),l(),s())},{earlyAttach:!0}));var l=function(){n.forEach(function(e){return e.remove()}),window.clearTimeout(u)};r._currentSeek={abort:l}};s()},t.prototype._getPosition=function(){var e=null!==this._duration?this._duration:1/0;if(!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state)return this._positionWhenMediaElementRevoked;this._determineIfPlaying();var t=Math.min(this._getTruePosition(),e);return this._shouldBeEnded()?e:t},t.prototype._getTruePosition=function(){if(!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state)throw new Error("Media element does not exist or is in invalid state.");var e=this._mediaElementAndState.element;return 1e3*e.currentTime},t.prototype._kill=function(){window.clearTimeout(this._canPlayTimer),this._playDetectionTimer&&window.clearInterval(this._playDetectionTimer),this._mediaElementAndState&&this.revokeMediaElement(),this._stallCheckTimerId&&window.clearInterval(this._stallCheckTimerId),this._webAudioOrchestration&&this._webAudioOrchestration.gainNodes.glitchCoverup.disconnect(this._webAudioOrchestration.context.destination),this._listeners=[]},t.prototype._listenToOnce=function(e,t,r){void 0===r&&(r={});var n=r.reattach,o=r.earlyAttach;void 0===n&&(n=!1),void 0===o&&(o=!1);var i=function(e){a.remove(),t(e)},a=this._listenTo(e,i,{reattach:n,earlyAttach:o});return a},t.prototype._listenTo=function(e,t,r){var n=this;void 0===r&&(r={});var o=r.reattach,i=r.earlyAttach;void 0===o&&(o=!0),void 0===i&&(i=!1);var a=function(r){if(s.attachedToElement)switch(e){case"play":var o=n._mediaElPlayShouldBeAborted.get(s.attachedToElement);if(n._mediaElPlayShouldBeAborted.delete(s.attachedToElement),o){n._logger.warn("Calling pause() on media element because the play request should have been rejected."),s.attachedToElement.pause();break}default:t(r)}else n._logger.warn("Got media element event after handler was removed. Ignoring.",r)},s={attachedToElement:null,handler:a,eventType:e,once:!1,reattach:o,earlyAttach:i};if(this._listeners.push(s),!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state&&!i)return{remove:function(){var e=n._listeners.indexOf(s);e>=0&&n._listeners.splice(e,1)}};var u=this._mediaElementAndState.element;return u.addEventListener(e,a,!1),s.attachedToElement=u,{remove:function(){var t=n._listeners.indexOf(s);t>=0&&(n._listeners.splice(t,1),s.attachedToElement=null,u.removeEventListener(e,a,!1))}}},t.prototype._notifyNotStalled=function(){this._stallDetected=!1,this._lastStallCheckPos=null,this._handleStalled()},t.prototype._assumeStalled=function(){this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state&&(this._lastStallCheckPos=this._mediaElementAndState.element.currentTime,this._timeWhenPositionChanged=0,this._stallDetected=!0,this._handleStalled())},t.prototype._initMediaElement=function(e,t){this._initMediaElementLocal(e,t)},t.prototype._callMediaElementPlay=function(e){var t=this;P.isEdge()&&this._mediaElPlayShouldBeAborted.set(e,!1);var r=this._mediaElPaused.get(e);r&&(r.paused=!1);var n=this._mediaElPlayTracker={},o=e.play();return r&&o&&o.catch&&o.catch(function(){n===t._mediaElPlayTracker&&(r.paused=!0)}),o},t.prototype._callMediaElementPause=function(e){this._playInProgress.inProgress=!1,P.isEdge()&&this._mediaElPlayShouldBeAborted.has(e)&&this._mediaElPlayShouldBeAborted.set(e,!0);var t=this._mediaElPaused.get(e);t&&(t.paused=!0),e.pause()},t.prototype._isMediaElementPaused=function(e){var t=this._mediaElPaused.get(e);return!t||t.paused},t.prototype._completeCurrentFade=function(){var e=this._fadeManagers;e&&(e.pausePlay.performFade(this.isPlaying()?1/0:-(1/0)),this.isDead()||this._notifyFading(!1))},t.prototype._completeSeekFadeOutAndIn=function(){var e=this,t=this._fadeManagers;t&&this._update(function(){t.seek.performFade(1/0),e.isDead()||(e._notifyFadingForSeek(!1),e._onSeekFadeOutCompleted&&e._onSeekFadeOutCompleted())})},t.prototype._determineIfPlaying=function(){var e=this;this._playDetectionTimer&&(!this.isPlaying()||++this._playDetectionTimerNumAttempts>=x)&&(window.clearInterval(this._playDetectionTimer),this._playDetectionTimer=null),this._update(function(){e._mediaElementAndState&&"USABLE"===e._mediaElementAndState.state&&(e.isDead()||!e.isReady()||!e.isPlaying()||e.isActuallyPlaying()||e._isMediaElementPaused(e._mediaElementAndState.element)||e._getTruePosition()===e._playDetectionPosition||(e._logger.debug("Detected that playback has started."),e._playDetectionTimer&&(window.clearInterval(e._playDetectionTimer),e._playDetectionTimer=null),e._notifyPlaying(!0),e._fadeManagers&&(e._notifyFading(!0),e._fadeManagers.pausePlay.performFade(e._fadeRate||1/0,function(){return e._notifyFading(!1)}))))})},t.prototype._initMediaElementLocal=function(e,t){if(e.setAttribute("msAudioCategory","BackgroundCapableMedia"),e.mozAudioChannelType="content",e.removeAttribute("src"),o(e),this._activateWebAudio(),this._pauseEventTimer&&(this._logger.debug("Clearing pause event timer."),window.clearTimeout(this._pauseEventTimer),this._pauseEventTimer=null),this._webAudioOrchestration&&this._webAudioOrchestration.mediaElementSource&&(this._logger.debug("Disconnecting media element from gain node."),this._webAudioOrchestration.mediaElementSource.disconnect(this._webAudioOrchestration.gainNodes.pausePlay),this._webAudioOrchestration.mediaElementSource=void 0),this._currentSeek&&(this._logger.debug("Aborting seek attempt."),this._currentSeek.abort(),this._currentSeek=null),t){this._webAudioOrchestration&&(this._logger.debug("Adding crossorigin attribute to media element because fading enabled."),e.setAttribute("crossorigin","anonymous"));var r=this._getUrlForMediaElement();if(this._logger.debug("Setting media element src.",r),e.src=r,e.volume=this._volume,e.muted=this._muted,this._webAudioOrchestration&&this._fadeManagers){this._logger.debug("Creating media element source node...");var n=I.get(e);if(n?this._logger.debug("Reusing media element source node."):(n=this._webAudioOrchestration.context.createMediaElementSource(e),I.set(e,n)),this._webAudioOrchestration.mediaElementSource=n,n.connect(this._webAudioOrchestration.gainNodes.pausePlay),this._logger.debug("Created media element source node."),this._shouldCoverGlitch){var i=this._webAudioOrchestration.context.currentTime,a=this._webAudioOrchestration.gainNodes.glitchCoverup;a.gain.setValueAtTime(0,i),a.gain.setValueAtTime(1,i+.1),this._shouldCoverGlitch=!1}}}e.playbackRate=1,e.setAttribute("preload","metadata"),this._callMediaElementPause(e),e.load()},t.prototype._addPausedHandlers=function(e){var t={removeListeners:function(){e.removeEventListener("play",r),e.removeEventListener("playing",r),e.removeEventListener("pause",r),e.removeEventListener("ended",r)},paused:!1},r=function(){t.paused=e.paused};r(),e.addEventListener("play",r),e.addEventListener("playing",r),e.addEventListener("pause",r),e.addEventListener("ended",r),this._mediaElPaused.set(e,t)},t.prototype._removePausedHandlers=function(e){var t=this._mediaElPaused.get(e);t&&t.removeListeners(),this._mediaElPaused.delete(e)},t.prototype._checkIfStalled=function(){if(this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state&&this.isActuallyPlaying()){var e=this._mediaElementAndState.element,t=e.currentTime,r=s.helpers.time.now();t!==this._lastStallCheckPos&&(this._timeWhenPositionChanged=r),this._stallDetected=e.readyState<=2||this._timeWhenPositionChanged<=r-M,this._lastStallCheckPos=t,this._handleStalled()}},t.prototype._handleStalled=function(){this._shouldBeEnded()&&null===this._getQueuedSeekPosition()?this.isEnded()||(this._logger.debug("Updating because stalled near end."),this._update()):this._notifyStalled(this._stallDetected||!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state)},t.prototype._play=function(e){var t=this,r=this._activateWebAudio(),n={inProgress:!0};this._playInProgress=n,this._mediaElementPlay().then(function(){n.inProgress=!1,r.catch(function(e){t._logger.error("Error activating web audio.",e),e===v.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR?t._triggerError(new h.WebAudioActivationTimeoutError):t._triggerError(new y.WebAudioActivationError)})}).catch(function(r){return t._playInProgress!==n?void t._logger.debug("Ignoring play error because paused since.",r):(n.inProgress=!1,void(e&&e(r)))})},t.prototype._mediaElementPlay=function(){var e=this;if(!this._mediaElementAndState)throw new Error("Media element doesn't exist.");if(this._mediaElementReportingEnded())return this._logger.debug("Not calling play() because we are at the end. It will be called after a seek."),w.resolve();var t=this._mediaElementAndState.element,r=this._callMediaElementPlay(t);return new w(function(t,n){r?(r=r.then(function(){return t()}),r.catch&&(r=r.catch(function(r){"AbortError"===r.name?(e._logger.debug("Media element play() promise rejected with AbortError."),t()):n(r)}))):t()})},t.prototype._notifyVolumeChangeFromMediaEl=function(e){this._volume=e.volume,this._muted=e.muted,this._notifyVolumeChange(e.volume,e.muted)},t.prototype._initWebAudio=function(){try{var e=this._webAudioContext.getAudioContextWithSuspender();if(!e)return this._logger.debug("WebAudio not supported/enabled."),null;this._logger.debug("WebAudio supported.");var t=e.context,r=e.suspender;r.watchPlayer(this);var n=t.createGain(),o=t.createGain(),i=t.createGain();return n.connect(o),o.connect(i),i.connect(t.destination),{context:t,suspender:r,gainNodes:{glitchCoverup:i,pausePlay:n,seek:o}}}catch(e){return e===v.WEB_AUDIO_NO_OUTPUT_CHANNELS_ERROR?this._triggerError(new g.WebAudioInitializeNoChannelsError(e)):this._triggerError(new _.WebAudioInitializeError(e)),this._logger.error("Failed initializing web audio.",e),null}},t.prototype._activateWebAudio=function(){return this._webAudioOrchestration?this._webAudioContext.activate():w.resolve(void 0)},t.prototype._handleDeferredPauseAndSeek=function(){var e=this;if(!this._mediaElementAndState||"STABLE"!==this._mediaElementAndState.state)throw new Error("Media element must be in the STABLE state.");this._logger.debug("Handling deferred pause and seek..."),this._mediaElementAndState.state="USABLE",this._attachListeners(),this._update(function(){e._handleStalled();var t=e._getQueuedSeekPosition();if(null!==t){var r=e._seekFadeRate?e._seekFadeRate.afterSeek:void 0;e._handleSeekChange(t,{fadeRate:{afterSeek:r}})}e.isPlaying()!==e.isActuallyPlaying()&&e._handlePlayPauseChange(e.isPlaying(),{fadeRate:e._fadeRate||void 0})})},t.prototype._detachListeners=function(){if(!this._mediaElementAndState)throw new Error("Media element doesn't exist.");var e=this._mediaElementAndState.element;this._listeners.forEach(function(t){t.attachedToElement&&(t.attachedToElement=null,e.removeEventListener(t.eventType,t.handler,!1))}),this._listeners=this._listeners.filter(function(e){return e.reattach})},t.prototype._attachListeners=function(){if(!this._mediaElementAndState)throw new Error("Media element doesn't exist.");this._logger.debug("Attaching listeners...");var e=this._mediaElementAndState,t=e.element,r=e.state;this._listeners.forEach(function(e){e.attachedToElement||!e.reattach||"USABLE"!==r&&!e.earlyAttach||(t.addEventListener(e.eventType,e.handler,!1),e.attachedToElement=t)}),this._logger.debug("Attached listeners.")},t}(s.BasePlayer);t.HTML5PlayerBase=N},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(10),i=r(1);!function(e){var t;!function(e){e.buildTimeRanges=o.buildTimeRanges}(t=e.timeRanges||(e.timeRanges={}));var r;!function(e){e.buildMimeTypeFromFormat=i.buildMimeTypeFromFormat}(r=e.mimeType||(e.mimeType={}))}(n=t.helpers||(t.helpers={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(8),i=r(9),a=r(7),s=r(2),u=r(5),l=r(3),c=r(6);!function(e){e.DecodeError=o.DecodeError,e.NetworkError=i.NetworkError,e.MediaElementError=a.MediaElementError,e.WebAudioInitializeError=s.WebAudioInitializeError,e.WebAudioInitializeNoChannelsError=u.WebAudioInitializeNoChannelsError,e.WebAudioActivationError=l.WebAudioActivationError,e.WebAudioActivationTimeoutError=c.WebAudioActivationTimeoutError}(n=t.errors||(t.errors={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(11),a=r(1),s=o.helpers.Promise,u=function(e){function t(t,r){var n=e.call(this,r)||this;return n._descriptor=t,n._mimeType=t.format.mimeType||a.buildMimeTypeFromFormat(t.format,n._inferFormat(t.url)),n}return n(t,e),t.prototype._getUrlForMediaElement=function(){return this._descriptor.url},t.prototype._canPlay=function(){return this._mimeType&&this._canPlayType(this._mimeType)?s.resolve(!0):s.resolve(!1)},t}(i.HTML5PlayerBase);t.HTML5Player=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=2e4,o=function(){function e(e,t){void 0===t&&(t=n),this._audioContext=e,this._idleTime=t,this._players=[],this._prevPlayingCount=0,this._playingCount=0,this._timerId=null,this._suspendTimerId=null,this._suspendSupported="function"==typeof e.suspend}return e.prototype.watchPlayer=function(e){var t=this;!this._suspendSupported||e.isDead()||this._players.indexOf(e)>=0||(e.onChange.subscribe(function(r){var n=r.dead,o=r.playing;if(void 0!==o&&t._handleCountChange(o),n){var i=t._players.indexOf(e);i>=0&&(t._players.splice(i,1),!t._players.length&&t._suspendTimerId&&(window.clearInterval(t._suspendTimerId),t._suspendTimerId=null))}}),this._players.length||(this._suspendTimerId=window.setInterval(function(){0===t._playingCount&&null===t._timerId&&"suspended"!==t._audioContext.state&&t._scheduleSuspend(5e3)},5e3)),this._players.push(e),e.isPlaying()&&this._handleCountChange(!0))},e.prototype._handleCountChange=function(e){e?this._playingCount++:this._playingCount--,this._playingCount!==this._prevPlayingCount&&(this._prevPlayingCount=this._playingCount,0===this._playingCount?this._scheduleSuspend(this._idleTime):1===this._playingCount&&this._abortSuspend())},e.prototype._scheduleSuspend=function(e){var t=this;this._timerId=window.setTimeout(function(){t._timerId=null,t._audioContext.suspend()},e)},e.prototype._abortSuspend=function(){this._timerId&&(window.clearTimeout(this._timerId),this._timerId=null)},e}();t.WebAudioContextSuspender=o},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,"An error occurred when initializing the media element.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.INITIALIZE_ERROR"},t}(o.errors.PlayerFatalError);t.InitializeError=i},function(e,t,r){"use strict";function n(e,t,r){return Math.min(t,Math.max(e,r))}Object.defineProperty(t,"__esModule",{value:!0});var o;!function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"}(o=t.FadeDirection||(t.FadeDirection={}));var i=function(){function e(e,t){this._context=e,this._gain=t,this._currentFade={startTime:0,startValue:1,rate:0},this._fadeEndTimer=null}return e.prototype.isFading=function(){return!!this._fadeEndTimer},e.prototype.getDirection=function(){var e=this._currentFade,t=e.rate,r=e.startValue;return 0===t?0===r?o.DOWN:o.UP:t<0?o.DOWN:o.UP},e.prototype.performFade=function(e,t){var r=this;if(0===e)throw new Error("Rate cannot be 0.");this._fadeEndTimer&&window.clearTimeout(this._fadeEndTimer);var o=this._context.currentTime,i=this._gain;if(e===1/0||e===-(1/0)){i.gain.cancelScheduledValues(o);var a=e===1/0?1:0;i.gain.setValueAtTime(a,o),this._currentFade={startTime:o,startValue:a,rate:0},this._fadeEndTimer=null,t&&t()}else{var s=this._currentFade,u=n(0,1,s.startValue+1e3*s.rate*(o-s.startTime)),l=e>0?1-u:u,c=l*(1/Math.abs(1e3*e)),d=o+c;this._currentFade={startTime:o,rate:e,startValue:u},i.gain.cancelScheduledValues(o),i.gain.setValueAtTime(u,o),i.gain.linearRampToValueAtTime(e>0?1:0,d),this._fadeEndTimer=window.setTimeout(function(){r._fadeEndTimer=null,t&&t()},1e3*c)}},e}();t.FadeManager=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(11);t.HTML5PlayerBase=n.HTML5PlayerBase;var o=r(14);t.HTML5Player=o.HTML5Player;var i=r(13);t.errors=i.errors;var a=r(12);t.helpers=a.helpers;var s=r(4);t.WebAudioContext=s.WebAudioContext}])})},function(e,t,r){!function(t,n){e.exports=n(r(6),r(10),r(11),r(2),r(3),r(1))}(window,function(e,t,r,n,o,i){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=i},function(e,t,r){"use strict";function n(e){return e.match(d)[0]}var o=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=r(5),a=r(4),s=r(3),u=r(2),l=r(1),c=r(0),d=/^[^\?#]*/,p=function(e){function t(t){var r=e.call(this)||this;return r._mediaElementManager=t,r.name="MaestroHLSMSE",r}return o(t,e),t.prototype.isRenditionSupported=function(e){return["hls","encrypted-hls"].indexOf(e.scProtocol)!==-1&&c.HLSMSEPlayer.isFormatSupported(e.maestroSegmentFormat||{})},t.prototype.buildPlayer=function(e){return new f(e,this._mediaElementManager)},t}(i.BaseController);t.HLSMSEPlayerController=p;var f=function(){function e(e,t){var r=this;this._config=e,this._mediaElementManager=t,this._urlRefreshRetrieveHandle=null;var o=e.logger,i=e.playerId,u=e.urlAndRendition,l=e.streamUrlExpires,d=e.reportError,p=e.fadeOnPauseAndPlay,f=e.fadeOnSeek,h=e.releaseControl,_=e.getNewUrl;this._currentUrl=u.url;var g=u.rendition.maestroSegmentFormat||{},y=this._buildPlaylist(u.url),v=this._player=new c.HLSMSEPlayer({playlist:y,segmentFormat:g},{name:i,mediaElement:null,fadeSupportEnabled:p||f,defaultFadeDuration:p?void 0:0,defaultSeekFadeInDuration:f?void 0:0,defaultSeekFadeOutDuration:f?void 0:0,logger:o,registerListeners:function(e){var t=e.onError,i=e.onChange;t.subscribe(function(e){if(l){if(e instanceof s.errors.URLUpdateError)return o.error("URL refresh failed for some reason.",e),void h({retry:!0});if(r._isErrorWhichShouldTriggerURLRefresh(e)){if(r._urlRefreshRetrieveHandle)return void o.debug("Got a 403 status code, but URL refresh already in progress.");o.info("Got a 403 status code. Peforming a URL refresh...");var t=r._urlRefreshRetrieveHandle=_();return void t.whenComplete().then(function(e){r._urlRefreshRetrieveHandle=null,e?n(e)!==n(r._currentUrl)?(o.warn("Got a new URL but the rendition did not match the original."),h({retry:!1})):(r._currentUrl=e,o.info("Got a new URL. Updating..."),v.switchPlaylist(r._buildPlaylist(e))):(o.warn("Could not get a new URL."),h({retry:!1}))}).catch(function(e){o.error("Unexpected error when trying to retrieve a new URL.",e),h({retry:!1})})}}d(e.getCode()),a.HTML5PlayerController.errorQualifiesAbort(e)&&h({retry:!1})}),i.subscribe(function(e){var t=e.dead;t&&(r._urlRefreshRetrieveHandle&&(r._urlRefreshRetrieveHandle.abort(),r._urlRefreshRetrieveHandle=null),h({retry:!1}))})}});this._mediaElementManager.registerPlayer(v,function(){return h({retry:!1})})}return e.prototype.getPlayer=function(){return this._player},e.prototype.getUrl=function(){return this._currentUrl},e.prototype._buildPlaylist=function(e){var t=new u.ArrayBufferLoader({fetchEnabled:this._config.fetchEnabled});return new l.PlaylistHLS({url:e,playlistLoader:u.stringLoader,segmentLoader:t,keyLoader:t,segmentFormat:this._config.urlAndRendition.rendition.maestroSegmentFormat||{},logger:this._config.logger})},e.prototype._isErrorWhichShouldTriggerURLRefresh=function(e){if(e instanceof c.errors.RetrievalError){var t=e.getCause();if(t instanceof c.retrievalErrors.UnacceptableResponseStatusCodeError)return 403===t.getStatusCode()}return!1},e}();t.ControlledPlayer=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.1.0",t.buildNumber=845;var n=r(6);t.HLSMSEPlayerController=n.HLSMSEPlayerController;var o=r(0);t.HLSMSEPlayer=o.HLSMSEPlayer}])})},function(e,t,r){!function(t,n){e.exports=n(r(2),r(4),r(7))}(window,function(e,t,r){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=15)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.PLAYLIST_UPDATE_ERROR"},t}(o.errors.PlayerFatalError);t.PlaylistUpdateError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return e.call(this,"A transmuxer could not be found.")||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.NO_TRANSMUXER_ERROR";
23863
+ },t}(o.errors.NotSupportedError);t.NoTransmuxerError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){var r=e.call(this,"An error occurred when trying to retrieve a playlist/segment/key.",t)||this;return r._internalRetrievalError=t,r}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.RETRIEVAL_ERROR."+this._internalRetrievalError.getCode()},t}(o.errors.PlayerError);t.RetrievalError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,"An error occurred trying to initialize the buffer.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.INITIALIZE_ERROR"},t}(o.errors.PlayerFatalError);t.InitializeError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,"An error occurred trying to append to the buffer.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.APPEND_ERROR"},t}(o.errors.PlayerError);t.AppendError=i},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(5),i=r(4),a=r(1),s=r(2),u=r(3);!function(e){e.AppendError=o.AppendError,e.InitializeError=i.InitializeError,e.PlaylistUpdateError=a.PlaylistUpdateError,e.NoTransmuxerError=s.NoTransmuxerError,e.RetrievalError=u.RetrievalError}(n=t.errors||(t.errors={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=n.eventDispatcher.EventDispatcher,i=n.logger.prefixLogger,a=n.logger.noOpLogger,s=15e3,u=2e4,l=function(){function e(e,t,r,n,s){void 0===s&&(s=a);var u=this;this._onAppendQueued=new o,this._onAppendEnd=new o,this._needsInitData=!0,this._updateTimerId=null,this._gcTimerId=null,this._waitingForData=!1,this._started=!1,this._error=null,this._currentRetrieveHandle=null,this._logger=i(s,"SimpleMSE"),this.onAppendQueued=this._onAppendQueued.getHandle(),this.onAppendEnd=this._onAppendEnd.getHandle(),this._mse=e,this._getNextSegmentData=t,this._getPosition=r,this._onError=n,e.whenInitialized().then(function(){!u._error&&u._started&&(u._logger.debug("MSE initialized. Preparing to update."),u._prepareUpdate())}).catch(function(e){u._error||(u._logger.error("Error when waiting for MSE to initialize.",e),u._handleError(e||new Error("Error waiting for MSE to initialize.")))})}return e.prototype.start=function(){if(this._checkNotErrored(),this._started)throw new Error("Already started.");this._logger.debug("start() called."),this._scheduleGC(),this._started=!0,this._prepareUpdate()},e.prototype.kill=function(){this._error||(this._logger.debug("kill() called."),this._error=new Error("Killed."),this._clearTimers(),this._logger.debug("Killed."))},e.prototype.waitingForSegmentData=function(){return this._checkNotErrored(),this._waitingForData},e.prototype.provideNextSegmentData=function(e){if(this._checkNotErrored(),!this._waitingForData)throw new Error("Not waiting for data.");this._logger.debug("Segment data provided."),this._waitingForData=!1,this._update(e)},e.prototype._prepareUpdate=function(){if(!this._updateTimerId){var e=this._mse;if(e.hasInitialized()){var t=n.TimeRange.getCoverage(e.getBuffered());if(t.end<=this._getPosition()+s){this._logger.debug("Requesting next segment data.");var r=this._getNextSegmentData();r?(this._logger.debug("Got segment data."),this._update(r)):(this._logger.debug("Did not get any data."),this._waitingForData=!0)}else this._scheduleUpdate()}}},e.prototype._gc=function(){var e=this,t=this._mse;if(!t.hasInitialized())return void this._scheduleGC();var r=n.TimeRange.getCoverage(t.getBuffered()),o=this._getPosition()-5e3;if(r.start<o){var i=new n.TimeRange(r.start,o-r.start);this._logger.debug("Removing media that has been played.",i),t.remove(i).then(function(){e._logger.debug("Removed media that has been played.",i),e._error||e._scheduleGC()}).catch(function(t){e._logger.error("Error when attempting to remove media that has been played.",i,t),e._error||e._scheduleGC()})}else this._scheduleGC()},e.prototype._update=function(e){var t=this,r=e.data,o=e.eventRepresentation,i=this._mse;this._onAppendQueued.dispatch({segment:o}),this._logger.debug("Appending...",o);var a=[],s=!1,u=!1,l=!1,c=this._currentRetrieveHandle=r.run(),d=function(){if(!s&&!t._error){var e=a.shift();e&&!e.byteLength?(t._logger.warn("Got 0 bytes to append. Skipping..."),d()):e?(s=!0,t._logger.debug("Appending part...",o,e.byteLength),i.append(e).then(function(){s=!1,u=!0,d()}).catch(function(e){t._error||(t._logger.error("Error updating MSE.",e,o),t._handleError(e||new Error("Error updating MSE.")))})):l&&(t._logger.debug("Append finished.",o),u||t._logger.warn("There was nothing to append."),t._currentRetrieveHandle=null,t._onAppendEnd.dispatch({segment:o}),t._prepareUpdate())}};c.onProgressUpdate(function(e){var r;r=t._needsInitData&&e.initData?n.helpers.arrayBuffer.combine([e.initData,e.data]):e.data,t._needsInitData=!1,a.push(r),d()}),c.onError(function(e){t._error||(t._logger.error("Error whilst retrieving data.",e,o),t._handleError(e||new Error("Error retrieving data for MSE.")))}),c.onCompletion(function(){t._logger.debug("Got all data for append.",o),l=!0,d()})},e.prototype._scheduleUpdate=function(){var e=this;this._updateTimerId=window.setTimeout(function(){e._updateTimerId=null,e._prepareUpdate()},500)},e.prototype._scheduleGC=function(){var e=this;this._gcTimerId||(this._gcTimerId=window.setTimeout(function(){e._gcTimerId=null,e._gc()},u))},e.prototype._checkNotErrored=function(){if(this._error)throw this._error},e.prototype._clearTimers=function(){this._updateTimerId&&(this._logger.debug("Clearing update timer."),window.clearTimeout(this._updateTimerId),this._updateTimerId=null),this._gcTimerId&&(window.clearTimeout(this._gcTimerId),this._gcTimerId=null),this._currentRetrieveHandle&&(this._currentRetrieveHandle.abort(),this._currentRetrieveHandle=null)},e.prototype._handleError=function(e){this._error||(this._error=e,this._logger.error("Error occurred.",e),this._clearTimers(),this._onError(e))},e}();t.SimpleMSE=l},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){(function(e){var r,n,o=function(e){"use strict";function t(e,r){return"undefined"==typeof e?t[0]:"undefined"!=typeof r?10===+r?V(e):re(e,r):V(e)}function r(e,t){this.value=e,this.sign=t,this.isSmall=!1}function n(e){this.value=e,this.sign=e<0,this.isSmall=!0}function i(e){return-K<e&&e<K}function a(e){return e<1e7?[e]:e<1e14?[e%1e7,Math.floor(e/1e7)]:[e%1e7,Math.floor(e/1e7)%1e7,Math.floor(e/1e14)]}function s(e){u(e);var t=e.length;if(t<4&&T(e,Q)<0)switch(t){case 0:return 0;case 1:return e[0];case 2:return e[0]+e[1]*W;default:return e[0]+(e[1]+e[2]*W)*W}return e}function u(e){for(var t=e.length;0===e[--t];);e.length=t+1}function l(e){for(var t=new Array(e),r=-1;++r<e;)t[r]=0;return t}function c(e){return e>0?Math.floor(e):Math.ceil(e)}function d(e,t){var r,n,o=e.length,i=t.length,a=new Array(o),s=0,u=W;for(n=0;n<i;n++)r=e[n]+t[n]+s,s=r>=u?1:0,a[n]=r-s*u;for(;n<o;)r=e[n]+s,s=r===u?1:0,a[n++]=r-s*u;return s>0&&a.push(s),a}function p(e,t){return e.length>=t.length?d(e,t):d(t,e)}function f(e,t){var r,n,o=e.length,i=new Array(o),a=W;for(n=0;n<o;n++)r=e[n]-a+t,t=Math.floor(r/a),i[n]=r-t*a,t+=1;for(;t>0;)i[n++]=t%a,t=Math.floor(t/a);return i}function h(e,t){var r,n,o=e.length,i=t.length,a=new Array(o),s=0,l=W;for(r=0;r<i;r++)n=e[r]-s-t[r],n<0?(n+=l,s=1):s=0,a[r]=n;for(r=i;r<o;r++){if(n=e[r]-s,!(n<0)){a[r++]=n;break}n+=l,a[r]=n}for(;r<o;r++)a[r]=e[r];return u(a),a}function _(e,t,o){var i;return T(e,t)>=0?i=h(e,t):(i=h(t,e),o=!o),i=s(i),"number"==typeof i?(o&&(i=-i),new n(i)):new r(i,o)}function g(e,t,o){var i,a,u=e.length,l=new Array(u),c=-t,d=W;for(i=0;i<u;i++)a=e[i]+c,c=Math.floor(a/d),a%=d,l[i]=a<0?a+d:a;return l=s(l),"number"==typeof l?(o&&(l=-l),new n(l)):new r(l,o)}function y(e,t){var r,n,o,i,a,s=e.length,c=t.length,d=s+c,p=l(d),f=W;for(o=0;o<s;++o){i=e[o];for(var h=0;h<c;++h)a=t[h],r=i*a+p[o+h],n=Math.floor(r/f),p[o+h]=r-n*f,p[o+h+1]+=n}return u(p),p}function v(e,t){var r,n,o=e.length,i=new Array(o),a=W,s=0;for(n=0;n<o;n++)r=e[n]*t+s,s=Math.floor(r/a),i[n]=r-s*a;for(;s>0;)i[n++]=s%a,s=Math.floor(s/a);return i}function m(e,t){for(var r=[];t-- >0;)r.push(0);return r.concat(e)}function E(e,t){var r=Math.max(e.length,t.length);if(r<=30)return y(e,t);r=Math.ceil(r/2);var n=e.slice(r),o=e.slice(0,r),i=t.slice(r),a=t.slice(0,r),s=E(o,a),l=E(n,i),c=E(p(o,n),p(a,i)),d=p(p(s,m(h(h(c,s),l),r)),m(l,2*r));return u(d),d}function b(e,t){return-.012*e-.012*t+15e-6*e*t>0}function w(e,t,n){return e<W?new r(v(t,e),n):new r(y(t,a(e)),n)}function P(e){var t,r,n,o,i,a=e.length,s=l(a+a),c=W;for(n=0;n<a;n++){o=e[n],r=0-o*o;for(var d=n;d<a;d++)i=e[d],t=2*(o*i)+s[n+d]+r,r=Math.floor(t/c),s[n+d]=t-r*c;s[n+a]=r}return u(s),s}function S(e,t){var r,n,o,i,a,u,c,d=e.length,p=t.length,f=W,h=l(t.length),_=t[p-1],g=Math.ceil(f/(2*_)),y=v(e,g),m=v(t,g);for(y.length<=d&&y.push(0),m.push(0),_=m[p-1],n=d-p;n>=0;n--){for(r=f-1,y[n+p]!==_&&(r=Math.floor((y[n+p]*f+y[n+p-1])/_)),o=0,i=0,u=m.length,a=0;a<u;a++)o+=r*m[a],c=Math.floor(o/f),i+=y[n+a]-(o-c*f),o=c,i<0?(y[n+a]=i+f,i=-1):(y[n+a]=i,i=0);for(;0!==i;){for(r-=1,o=0,a=0;a<u;a++)o+=y[n+a]-f+m[a],o<0?(y[n+a]=o+f,o=0):(y[n+a]=o,o=1);i+=o}h[n]=r}return y=A(y,g)[0],[s(h),s(y)]}function R(e,t){for(var r,n,o,i,a,l=e.length,c=t.length,d=[],p=[],f=W;l;)if(p.unshift(e[--l]),u(p),T(p,t)<0)d.push(0);else{n=p.length,o=p[n-1]*f+p[n-2],i=t[c-1]*f+t[c-2],n>c&&(o=(o+1)*f),r=Math.ceil(o/i);do{if(a=v(t,r),T(a,p)<=0)break;r--}while(r);d.push(r),p=h(p,a)}return d.reverse(),[s(d),s(p)]}function A(e,t){var r,n,o,i,a=e.length,s=l(a),u=W;for(o=0,r=a-1;r>=0;--r)i=o*u+e[r],n=c(i/t),o=i-n*t,s[r]=0|n;return[s,0|o]}function O(e,o){var i,u,l=V(o),d=e.value,p=l.value;if(0===p)throw new Error("Cannot divide by zero");if(e.isSmall)return l.isSmall?[new n(c(d/p)),new n(d%p)]:[t[0],e];if(l.isSmall){if(1===p)return[e,t[0]];if(p==-1)return[e.negate(),t[0]];var f=Math.abs(p);if(f<W){i=A(d,f),u=s(i[0]);var h=i[1];return e.sign&&(h=-h),"number"==typeof u?(e.sign!==l.sign&&(u=-u),[new n(u),new n(h)]):[new r(u,e.sign!==l.sign),new n(h)]}p=a(f)}var _=T(d,p);if(_===-1)return[t[0],e];if(0===_)return[t[e.sign===l.sign?1:-1],t[0]];i=d.length+p.length<=200?S(d,p):R(d,p),u=i[0];var g=e.sign!==l.sign,y=i[1],v=e.sign;return"number"==typeof u?(g&&(u=-u),u=new n(u)):u=new r(u,g),"number"==typeof y?(v&&(y=-y),y=new n(y)):y=new r(y,v),[u,y]}function T(e,t){if(e.length!==t.length)return e.length>t.length?1:-1;for(var r=e.length-1;r>=0;r--)if(e[r]!==t[r])return e[r]>t[r]?1:-1;return 0}function x(e){var t=e.abs();return!t.isUnit()&&(!!(t.equals(2)||t.equals(3)||t.equals(5))||!(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5))&&(!!t.lesser(25)||void 0))}function M(e){return("number"==typeof e||"string"==typeof e)&&+Math.abs(e)<=W||e instanceof r&&e.value.length<=1}function D(e,t,r){t=V(t);for(var n=e.isNegative(),i=t.isNegative(),a=n?e.not():e,s=i?t.not():t,u=0,l=0,c=null,d=null,p=[];!a.isZero()||!s.isZero();)c=O(a,$),u=c[1].toJSNumber(),n&&(u=$-1-u),d=O(s,$),l=d[1].toJSNumber(),i&&(l=$-1-l),a=c[0],s=d[0],p.push(r(u,l));for(var f=o(0!==r(n?1:0,i?1:0)?-1:0),h=p.length-1;h>=0;h-=1)f=f.multiply($).add(o(p[h]));return f}function k(e){var t=e.value,r="number"==typeof t?t|ee:t[0]+t[1]*W|te;return r&-r}function I(e,t){if(t.compareTo(e)<=0){var r=I(e,t.square(t)),n=r.p,i=r.e,a=n.multiply(t);return a.compareTo(e)<=0?{p:a,e:2*i+1}:{p:n,e:2*i}}return{p:o(1),e:0}}function C(e,t){return e=V(e),t=V(t),e.greater(t)?e:t}function L(e,t){return e=V(e),t=V(t),e.lesser(t)?e:t}function N(e,r){if(e=V(e).abs(),r=V(r).abs(),e.equals(r))return e;if(e.isZero())return r;if(r.isZero())return e;for(var n,o,i=t[1];e.isEven()&&r.isEven();)n=Math.min(k(e),k(r)),e=e.divide(n),r=r.divide(n),i=i.multiply(n);for(;e.isEven();)e=e.divide(k(e));do{for(;r.isEven();)r=r.divide(k(r));e.greater(r)&&(o=r,r=e,e=o),r=r.subtract(e)}while(!r.isZero());return i.isUnit()?e:e.multiply(i)}function F(e,t){return e=V(e).abs(),t=V(t).abs(),e.divide(N(e,t)).multiply(t)}function U(e,t){e=V(e),t=V(t);var o=L(e,t),i=C(e,t),a=i.subtract(o).add(1);if(a.isSmall)return o.add(Math.floor(Math.random()*a));for(var u=a.value.length-1,l=[],d=!0,p=u;p>=0;p--){var f=d?a.value[p]:W,h=c(Math.random()*f);l.unshift(h),h<f&&(d=!1)}return l=s(l),o.add("number"==typeof l?new n(l):new r(l,!1))}function j(e,r,n){var o,i=t[0],a=t[1];for(o=e.length-1;o>=0;o--)i=i.add(e[o].times(a)),a=a.times(r);return n?i.negate():i}function B(e){return e<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e):"<"+e+">"}function q(e,t){if(t=o(t),t.isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(+e-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var n=!1;if(e.isNegative()&&t.isPositive()&&(n=!0,e=e.abs()),t.equals(1))return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+e)).map(Number.prototype.valueOf,1),isNegative:n};for(var i,a=[],s=e;s.isNegative()||s.compareAbs(t)>=0;){i=s.divmod(t),s=i.quotient;var u=i.remainder;u.isNegative()&&(u=t.minus(u).abs(),s=s.next()),a.push(u.toJSNumber())}return a.push(s.toJSNumber()),{value:a.reverse(),isNegative:n}}function H(e,t){var r=q(e,t);return(r.isNegative?"-":"")+r.value.map(B).join("")}function z(e){if(i(+e)){var t=+e;if(t===c(t))return new n(t);throw new Error("Invalid integer: "+e)}var o="-"===e[0];o&&(e=e.slice(1));var a=e.split(/e/i);if(a.length>2)throw new Error("Invalid integer: "+a.join("e"));if(2===a.length){var s=a[1];if("+"===s[0]&&(s=s.slice(1)),s=+s,s!==c(s)||!i(s))throw new Error("Invalid integer: "+s+" is not a valid exponent.");var l=a[0],d=l.indexOf(".");if(d>=0&&(s-=l.length-d-1,l=l.slice(0,d)+l.slice(d+1)),s<0)throw new Error("Cannot include negative exponent part for integers");l+=new Array(s+1).join("0"),e=l}var p=/^([0-9][0-9]*)$/.test(e);if(!p)throw new Error("Invalid integer: "+e);for(var f=[],h=e.length,_=J,g=h-_;h>0;)f.push(+e.slice(g,h)),g-=_,g<0&&(g=0),h-=_;return u(f),new r(f,o)}function G(e){if(i(e)){if(e!==c(e))throw new Error(e+" is not an integer.");return new n(e)}return z(e.toString())}function V(e){return"number"==typeof e?G(e):"string"==typeof e?z(e):e}var W=1e7,J=7,K=9007199254740992,Q=a(K),Y=Math.log(K);r.prototype=Object.create(t.prototype),n.prototype=Object.create(t.prototype),r.prototype.add=function(e){var t=V(e);if(this.sign!==t.sign)return this.subtract(t.negate());var n=this.value,o=t.value;return t.isSmall?new r(f(n,Math.abs(o)),this.sign):new r(p(n,o),this.sign)},r.prototype.plus=r.prototype.add,n.prototype.add=function(e){var t=V(e),o=this.value;if(o<0!==t.sign)return this.subtract(t.negate());var s=t.value;if(t.isSmall){if(i(o+s))return new n(o+s);s=a(Math.abs(s))}return new r(f(s,Math.abs(o)),o<0)},n.prototype.plus=n.prototype.add,r.prototype.subtract=function(e){var t=V(e);if(this.sign!==t.sign)return this.add(t.negate());var r=this.value,n=t.value;return t.isSmall?g(r,Math.abs(n),this.sign):_(r,n,this.sign)},r.prototype.minus=r.prototype.subtract,n.prototype.subtract=function(e){var t=V(e),r=this.value;if(r<0!==t.sign)return this.add(t.negate());var o=t.value;return t.isSmall?new n(r-o):g(o,Math.abs(r),r>=0)},n.prototype.minus=n.prototype.subtract,r.prototype.negate=function(){return new r(this.value,!this.sign)},n.prototype.negate=function(){var e=this.sign,t=new n(-this.value);return t.sign=!e,t},r.prototype.abs=function(){return new r(this.value,!1)},n.prototype.abs=function(){return new n(Math.abs(this.value))},r.prototype.multiply=function(e){var n,o=V(e),i=this.value,s=o.value,u=this.sign!==o.sign;if(o.isSmall){if(0===s)return t[0];if(1===s)return this;if(s===-1)return this.negate();if(n=Math.abs(s),n<W)return new r(v(i,n),u);s=a(n)}return b(i.length,s.length)?new r(E(i,s),u):new r(y(i,s),u)},r.prototype.times=r.prototype.multiply,n.prototype._multiplyBySmall=function(e){return i(e.value*this.value)?new n(e.value*this.value):w(Math.abs(e.value),a(Math.abs(this.value)),this.sign!==e.sign)},r.prototype._multiplyBySmall=function(e){return 0===e.value?t[0]:1===e.value?this:e.value===-1?this.negate():w(Math.abs(e.value),this.value,this.sign!==e.sign)},n.prototype.multiply=function(e){return V(e)._multiplyBySmall(this)},n.prototype.times=n.prototype.multiply,r.prototype.square=function(){return new r(P(this.value),!1)},n.prototype.square=function(){var e=this.value*this.value;return i(e)?new n(e):new r(P(a(Math.abs(this.value))),!1)},r.prototype.divmod=function(e){var t=O(this,e);return{quotient:t[0],remainder:t[1]}},n.prototype.divmod=r.prototype.divmod,r.prototype.divide=function(e){return O(this,e)[0]},n.prototype.over=n.prototype.divide=r.prototype.over=r.prototype.divide,r.prototype.mod=function(e){return O(this,e)[1]},n.prototype.remainder=n.prototype.mod=r.prototype.remainder=r.prototype.mod,r.prototype.pow=function(e){var r,o,a,s=V(e),u=this.value,l=s.value;if(0===l)return t[1];if(0===u)return t[0];if(1===u)return t[1];if(u===-1)return s.isEven()?t[1]:t[-1];if(s.sign)return t[0];if(!s.isSmall)throw new Error("The exponent "+s.toString()+" is too large.");if(this.isSmall&&i(r=Math.pow(u,l)))return new n(c(r));for(o=this,a=t[1];l&!0&&(a=a.times(o),--l),0!==l;)l/=2,o=o.square();return a},n.prototype.pow=r.prototype.pow,r.prototype.modPow=function(e,r){if(e=V(e),r=V(r),r.isZero())throw new Error("Cannot take modPow with modulus 0");for(var n=t[1],o=this.mod(r);e.isPositive();){if(o.isZero())return t[0];e.isOdd()&&(n=n.multiply(o).mod(r)),e=e.divide(2),o=o.square().mod(r)}return n},n.prototype.modPow=r.prototype.modPow,r.prototype.compareAbs=function(e){var t=V(e),r=this.value,n=t.value;return t.isSmall?1:T(r,n)},n.prototype.compareAbs=function(e){var t=V(e),r=Math.abs(this.value),n=t.value;return t.isSmall?(n=Math.abs(n),r===n?0:r>n?1:-1):-1},r.prototype.compare=function(e){if(e===1/0)return-1;if(e===-(1/0))return 1;var t=V(e),r=this.value,n=t.value;return this.sign!==t.sign?t.sign?1:-1:t.isSmall?this.sign?-1:1:T(r,n)*(this.sign?-1:1)},r.prototype.compareTo=r.prototype.compare,n.prototype.compare=function(e){if(e===1/0)return-1;if(e===-(1/0))return 1;var t=V(e),r=this.value,n=t.value;return t.isSmall?r==n?0:r>n?1:-1:r<0!==t.sign?r<0?-1:1:r<0?1:-1},n.prototype.compareTo=n.prototype.compare,r.prototype.equals=function(e){return 0===this.compare(e)},n.prototype.eq=n.prototype.equals=r.prototype.eq=r.prototype.equals,r.prototype.notEquals=function(e){return 0!==this.compare(e)},n.prototype.neq=n.prototype.notEquals=r.prototype.neq=r.prototype.notEquals,r.prototype.greater=function(e){return this.compare(e)>0},n.prototype.gt=n.prototype.greater=r.prototype.gt=r.prototype.greater,r.prototype.lesser=function(e){return this.compare(e)<0},n.prototype.lt=n.prototype.lesser=r.prototype.lt=r.prototype.lesser,r.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},n.prototype.geq=n.prototype.greaterOrEquals=r.prototype.geq=r.prototype.greaterOrEquals,r.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},n.prototype.leq=n.prototype.lesserOrEquals=r.prototype.leq=r.prototype.lesserOrEquals,r.prototype.isEven=function(){return 0===(1&this.value[0])},n.prototype.isEven=function(){return 0===(1&this.value)},r.prototype.isOdd=function(){return 1===(1&this.value[0])},n.prototype.isOdd=function(){return 1===(1&this.value)},r.prototype.isPositive=function(){return!this.sign},n.prototype.isPositive=function(){return this.value>0},r.prototype.isNegative=function(){return this.sign},n.prototype.isNegative=function(){return this.value<0},r.prototype.isUnit=function(){return!1},n.prototype.isUnit=function(){return 1===Math.abs(this.value)},r.prototype.isZero=function(){return!1},n.prototype.isZero=function(){return 0===this.value},r.prototype.isDivisibleBy=function(e){var r=V(e),n=r.value;return 0!==n&&(1===n||(2===n?this.isEven():this.mod(r).equals(t[0])))},n.prototype.isDivisibleBy=r.prototype.isDivisibleBy,r.prototype.isPrime=function(){var r=x(this);if(r!==e)return r;for(var n,i,a,s,u=this.abs(),l=u.prev(),c=[2,3,5,7,11,13,17,19],d=l;d.isEven();)d=d.divide(2);for(a=0;a<c.length;a++)if(s=o(c[a]).modPow(d,u),!s.equals(t[1])&&!s.equals(l)){for(i=!0,n=d;i&&n.lesser(l);n=n.multiply(2))s=s.square().mod(u),s.equals(l)&&(i=!1);if(i)return!1}return!0},n.prototype.isPrime=r.prototype.isPrime,r.prototype.isProbablePrime=function(t){var r=x(this);if(r!==e)return r;for(var n=this.abs(),i=t===e?5:t,a=0;a<i;a++){var s=o.randBetween(2,n.minus(2));if(!s.modPow(n.prev(),n).isUnit())return!1}return!0},n.prototype.isProbablePrime=r.prototype.isProbablePrime,r.prototype.modInv=function(e){for(var t,r,n,i=o.zero,a=o.one,s=V(e),u=this.abs();!u.equals(o.zero);)t=s.divide(u),r=i,n=s,i=a,s=u,a=r.subtract(t.multiply(a)),u=n.subtract(t.multiply(u));if(!s.equals(1))throw new Error(this.toString()+" and "+e.toString()+" are not co-prime");return i.compare(0)===-1&&(i=i.add(e)),this.isNegative()?i.negate():i},n.prototype.modInv=r.prototype.modInv,r.prototype.next=function(){var e=this.value;return this.sign?g(e,1,this.sign):new r(f(e,1),this.sign)},n.prototype.next=function(){var e=this.value;return e+1<K?new n(e+1):new r(Q,!1)},r.prototype.prev=function(){var e=this.value;return this.sign?new r(f(e,1),!0):g(e,1,this.sign)},n.prototype.prev=function(){var e=this.value;return e-1>-K?new n(e-1):new r(Q,!0)};for(var X=[1];2*X[X.length-1]<=W;)X.push(2*X[X.length-1]);var Z=X.length,$=X[Z-1];r.prototype.shiftLeft=function(e){if(!M(e))throw new Error(String(e)+" is too large for shifting.");if(e=+e,e<0)return this.shiftRight(-e);var t=this;if(t.isZero())return t;for(;e>=Z;)t=t.multiply($),e-=Z-1;return t.multiply(X[e])},n.prototype.shiftLeft=r.prototype.shiftLeft,r.prototype.shiftRight=function(e){var t;if(!M(e))throw new Error(String(e)+" is too large for shifting.");if(e=+e,e<0)return this.shiftLeft(-e);for(var r=this;e>=Z;){if(r.isZero()||r.isNegative()&&r.isUnit())return r;t=O(r,$),r=t[1].isNegative()?t[0].prev():t[0],e-=Z-1}return t=O(r,X[e]),t[1].isNegative()?t[0].prev():t[0]},n.prototype.shiftRight=r.prototype.shiftRight,r.prototype.not=function(){return this.negate().prev()},n.prototype.not=r.prototype.not,r.prototype.and=function(e){return D(this,e,function(e,t){return e&t})},n.prototype.and=r.prototype.and,r.prototype.or=function(e){return D(this,e,function(e,t){return e|t})},n.prototype.or=r.prototype.or,r.prototype.xor=function(e){return D(this,e,function(e,t){return e^t})},n.prototype.xor=r.prototype.xor;var ee=1<<30,te=(W&-W)*(W&-W)|ee;r.prototype.bitLength=function(){var e=this;return e.compareTo(o(0))<0&&(e=e.negate().subtract(o(1))),0===e.compareTo(o(0))?o(0):o(I(e,o(2)).e).add(o(1))},n.prototype.bitLength=r.prototype.bitLength;var re=function(e,t){for(var r,o=e.length,i=Math.abs(t),r=0;r<o;r++){var a=e[r].toLowerCase();if("-"!==a&&/[a-z0-9]/.test(a)){if(/[0-9]/.test(a)&&+a>=i){if("1"===a&&1===i)continue;throw new Error(a+" is not a valid digit in base "+t+".")}if(a.charCodeAt(0)-87>=i)throw new Error(a+" is not a valid digit in base "+t+".")}}if(2<=t&&t<=36&&o<=Y/Math.log(t)){var s=parseInt(e,t);if(isNaN(s))throw new Error(a+" is not a valid digit in base "+t+".");return new n(parseInt(e,t))}t=V(t);var u=[],l="-"===e[0];for(r=l?1:0;r<e.length;r++){var a=e[r].toLowerCase(),c=a.charCodeAt(0);if(48<=c&&c<=57)u.push(V(a));else if(97<=c&&c<=122)u.push(V(a.charCodeAt(0)-87));else{if("<"!==a)throw new Error(a+" is not a valid character");var d=r;do r++;while(">"!==e[r]);u.push(V(e.slice(d+1,r)))}}return j(u,t,l)};r.prototype.toArray=function(e){return q(this,e)},n.prototype.toArray=function(e){return q(this,e)},r.prototype.toString=function(t){if(t===e&&(t=10),10!==t)return H(this,t);for(var r,n=this.value,o=n.length,i=String(n[--o]),a="0000000";--o>=0;)r=String(n[o]),i+=a.slice(r.length)+r;var s=this.sign?"-":"";return s+i},n.prototype.toString=function(t){return t===e&&(t=10),10!=t?H(this,t):String(this.value)},r.prototype.toJSON=n.prototype.toJSON=function(){return this.toString()},r.prototype.valueOf=function(){return parseInt(this.toString(),10)},r.prototype.toJSNumber=r.prototype.valueOf,n.prototype.valueOf=function(){return this.value},n.prototype.toJSNumber=n.prototype.valueOf;for(var ne=0;ne<1e3;ne++)t[ne]=new n(ne),ne>0&&(t[-ne]=new n(-ne));return t.one=t[1],t.zero=t[0],t.minusOne=t[-1],t.max=C,t.min=L,t.gcd=N,t.lcm=F,t.isInstance=function(e){return e instanceof r||e instanceof n},t.randBetween=U,t.fromArray=function(e,t,r){return j(e.map(V),V(t||10),r)},t}();"undefined"!=typeof e&&e.hasOwnProperty("exports")&&(e.exports=o),r=[],n=function(){return o}.apply(t,r),!(void 0!==n&&(e.exports=n))}).call(this,r(10)(e))},function(e,t,r){"use strict";function n(e,t){for(var r=e.byteLength,n=0;n<r;){var o=e.getUint32(n);if(1===o)throw new Error("Large atom size not supported.");0===o&&(o=r-n);var i=e.getUint32(n+4);if(t(i,new DataView(e.buffer,e.byteOffset+n+s,o-s)))break;n+=o}}function o(e,t){void 0===t&&(t=!1);var r=function(e){var t=e.getUint8(0);e.setUint32(12,0),t>0&&e.setUint32(16,0)},o=function(e){n(e,function(e,t){return e===c&&(s(t),!0)})},s=function(e){n(e,function(e,t){return e===d&&(p(t),!0)})},p=function(e){var r,n=e.getUint8(0);t?r=a(0):(r=a(e.getUint32(4)),n>0&&(r=r.shiftLeft(32),r=r.add(e.getUint32(8))),null===h&&(h=r),r=r.subtract(h)),n>0?(e.setUint32(4,r.shiftRight(32).toJSNumber()),e.setUint32(8,r.and(65535).toJSNumber())):e.setUint32(4,r.toJSNumber())},f=i.helpers.arrayBuffer.combine([e]),h=null;return n(new DataView(f.buffer,f.byteOffset,f.byteLength),function(e,t){switch(e){case u:r(t);break;case l:o(t)}return!1}),f}Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(11),s=8,u=1936286840,l=1836019558,c=1953653094,d=1952867444;t.clearMP4InternalTimestamp=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(6),i=r(12),a=n.helpers.deferred.buildDeferred,s=o.helpers.timeRanges.buildTimeRanges,u=n.helpers.Promise,l=n.logger.prefixLogger,c=n.logger.noOpLogger,d=n.helpers.browser.isIE(),p=n.helpers.browser.isSafari(),f='audio/mp4; codecs="mp3"',h="audio/mpeg",_='audio/webm; codecs="opus"',g=n.helpers.browser.getSafariVersion(),y=n.helpers.browser.getChromeVersion(),v=p||!!(y&&y.major<=49),m=!!g&&g.major<10||!!y&&y.major<=49;t.killedError=new Error("MSE killed.");var E=function(){function e(e,t){var r=this.constructor;if(void 0===t&&(t=c),this._sourceBuffer=null,this._initialized=!1,this._initializeDeferred=a(),this._whenIdleDeferred=a(),this._error=null,this._dead=!1,this._eosSignalled=!1,this._pendingActions=[],this._currentAction=null,this._logger=l(t,"MSE"),this._onMediaSourceInit=this._onMediaSourceInit.bind(this),this._onMediaSourceEnded=this._onMediaSourceEnded.bind(this),this._onMediaSourceError=this._onMediaSourceError.bind(this),this._onSourceBufferUpdateEnd=this._onSourceBufferUpdateEnd.bind(this),this._onSourceBufferError=this._onSourceBufferError.bind(this),!r.isSupported(e))throw this._logger.error("Not supported."),new Error("Not supported.");p&&e===f&&(e="audio/mp4"),this._type=e,this._useSegmentsMode=m&&0===e.indexOf("audio/mp4"),this._mediaSource=new MediaSource,this._mediaSource.addEventListener("sourceopen",this._onMediaSourceInit,!1),this._mediaSource.addEventListener("error",this._onMediaSourceError,!1),this._url=URL.createObjectURL(this._mediaSource),this._logger.debug("Created URL.",this._url)}return e.isSupported=function(e){return!d&&"MediaSource"in window&&(!e||!(!p||e!==f)||!(g&&g.major<10&&e===h)&&!(y&&y.major<50&&e===_)&&MediaSource.isTypeSupported(e))},e.prototype.whenInitialized=function(){return this._initializeDeferred.promise},e.prototype.whenIdle=function(){return this._whenIdleDeferred?this._whenIdleDeferred.promise:u.resolve(void 0)},e.prototype.isIdle=function(){return this._dead||!this._whenIdleDeferred},e.prototype.hasInitialized=function(){return this._initialized},e.prototype.getError=function(){return this._error},e.prototype.getUrl=function(){return this._ensureNotDead(),this._url},e.prototype.getBuffered=function(){if(this._ensureNotDead(),!this._sourceBuffer)return[];try{return s(this._sourceBuffer.buffered)}catch(t){var e="Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source.";if("InvalidStateError"===t.name&&t.message===e)return[];throw t}},e.prototype.append=function(e){if(this._ensureNotDead(),this._ensureInitialized(),this._ensureNotEOS(),this._logger.debug("append() called."),v&&0===this._type.indexOf("audio/mp4")){this._logger.debug("Rewriting internal timestamp to 0.");try{e=i.clearMP4InternalTimestamp(e,!this._useSegmentsMode)}catch(e){return this._logger.error("Error rewriting timestamps.",e),this._handleError(e),u.reject(e)}}var t=a();return this._pendingActions.push({type:"append",data:e,deferred:t}),this._performNextAction(),t.promise},e.prototype.remove=function(e){if(0===e.duration)throw new Error("Remove range must have a duration > 0.");this._ensureNotDead(),this._ensureInitialized(),this._ensureNotEOS(),this._logger.debug("remove() called.",e);var t=a();return this._pendingActions.push({type:"remove",range:e,deferred:t}),this._performNextAction(),t.promise},e.prototype.signalEOS=function(){this._ensureNotDead(),this._ensureInitialized(),this._ensureNotEOS(),this._logger.debug("signalEOS() called."),this._eosSignalled=!0;var e=a();return this._pendingActions.push({type:"eos",deferred:e}),this._performNextAction(),e.promise},e.prototype.eosSignalled=function(){return this._eosSignalled},e.prototype.kill=function(){if(!this._dead){if(this._logger.debug("kill() called."),this._dead=!0,this._sourceBuffer){this._sourceBuffer.removeEventListener("updateend",this._onSourceBufferUpdateEnd,!1),this._sourceBuffer.removeEventListener("error",this._onSourceBufferError,!1);try{this._mediaSource.removeSourceBuffer(this._sourceBuffer)}catch(e){this._logger.error("Error from removeSourceBuffer()",e)}}this._mediaSource.removeEventListener("sourceopen",this._onMediaSourceInit,!1),this._mediaSource.removeEventListener("sourceended",this._onMediaSourceEnded,!1),this._mediaSource.removeEventListener("error",this._onMediaSourceError,!1),URL.revokeObjectURL(this._url);var e=this._error||t.killedError,r=this._currentAction?[this._currentAction]:[];r=r.concat(this._pendingActions),r.forEach(function(t){t.deferred.reject(e)}),this._whenIdleDeferred||(this._whenIdleDeferred=a()),this._whenIdleDeferred.reject(e),this._initialized||this._initializeDeferred.reject(e),
23864
+ this._pendingActions.length=0,this._logger.debug("Killed.")}},e.prototype._ensureInitialized=function(){if(!this._initialized)throw new Error("Not initialized yet.")},e.prototype._ensureNotEOS=function(){if(this._eosSignalled)throw new Error("EOS signalled.")},e.prototype._ensureNotDead=function(){if(this._dead)throw new Error("MSE is dead.")},e.prototype._onMediaSourceInit=function(){this._logger.debug("MSE initialized."),this._mediaSource.removeEventListener("sourceopen",this._onMediaSourceInit,!1);try{this._logger.debug("Creating source buffer.",this._type),this._sourceBuffer=this._mediaSource.addSourceBuffer(this._type),this._sourceBuffer.mode=this._useSegmentsMode?"segments":"sequence",this._logger.debug("Using append mode: "+this._sourceBuffer.mode),this._sourceBuffer.addEventListener("updateend",this._onSourceBufferUpdateEnd,!1),this._sourceBuffer.addEventListener("error",this._onSourceBufferError,!1)}catch(e){this._handleError(e)}this._initializeDeferred.resolve(void 0),this._whenIdleDeferred.resolve(void 0),this._initialized=!0,this._performNextAction()},e.prototype._onMediaSourceEnded=function(){this._onSourceBufferUpdateEnd()},e.prototype._onMediaSourceError=function(e){this._handleError(e)},e.prototype._handleError=function(e){this._ensureNotDead(),this._logger.error("Error occurred.",e),this._error=e||new Error("Unknown error."),this.kill()},e.prototype._onSourceBufferUpdateEnd=function(){var e=this._currentAction;return this._logger.debug("Update ended.",this.getBuffered()),e?(this._currentAction=null,e.deferred.resolve(void 0),void this._performNextAction()):void this._handleError(new Error("No action in progress."))},e.prototype._onSourceBufferError=function(e){this._handleError(e)},e.prototype._performNextAction=function(){var e=this._whenIdleDeferred;if(!this._currentAction&&this._sourceBuffer){var t=this._pendingActions.shift();if(!t)return this._logger.debug("No more actions."),void(e&&(this._whenIdleDeferred=null,e.resolve(void 0)));switch(e||(this._whenIdleDeferred=a()),this._currentAction=t,this._logger.debug("Performing next action..."),t.type){case"append":var r=n.TimeRange.getCoverage(this.getBuffered());try{if("segments"===this._sourceBuffer.mode){var o=r.end/1e3;this._logger.debug("Setting timestampOffset because detected safari.",o);try{this._sourceBuffer.timestampOffset=o}catch(e){if(11!==e.code)throw e;this._logger.debug("Failed to set timestampOffset.",e)}}this._logger.debug("Calling appendBuffer()."),this._sourceBuffer.appendBuffer(t.data)}catch(e){this._handleError(e)}break;case"remove":try{var i=t.range;this._logger.debug("Calling remove().",i.start,i.end),this._sourceBuffer.remove(i.start/1e3,i.end/1e3)}catch(e){this._handleError(e)}break;case"eos":try{this._logger.debug("Calling endOfStream()."),this._sourceBuffer.removeEventListener("updateend",this._onSourceBufferUpdateEnd,!1),this._mediaSource.addEventListener("sourceended",this._onMediaSourceEnded,!1),this._mediaSource.endOfStream()}catch(e){this._handleError(e)}}}},e}();t.MSE=E},function(e,t,r){"use strict";function n(e){if(e.hasEnded()){var t=e.getCompleteDuration();if(null===t)throw new Error("Expected playlist duration to be available.");return t}return 1/0}function o(e){var t=s.TransmuxerFactory.retrieveTransmuxers(e),r=g(t,function(t){var r=u.helpers.mimeType.buildMimeTypeFromFormat(t.getOutputFormat(),e);return!!r&&l.MSE.isSupported(r)})||null;if(!r)return null;var n=r.getOutputFormat(),o=u.helpers.mimeType.buildMimeTypeFromFormat(n,e);return o?{transmuxer:r,mimeType:o}:null}var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(7),u=r(6),l=r(13),c=r(9),d=r(5),p=r(4),f=r(3),h=r(2),_=r(1),g=a.helpers.find,y=a.helpers.Promise,v=a.helpers.time.now,m=a.errors.PlayerFatalError,E=a.eventDispatcher.EventDispatcher,b=a.logger.prefixLogger,w=a.helpers.abortableJob.abortedError,P=a.helpers.browser.getSafariVersion(),S=a.helpers.browser.isSafari(),R=a.helpers.browser.isFirefox(),A=a.helpers.browser.isEdge(),O=3e4,T=1e8,x=2e3,M=1e4,D=1e3,k=600,I=50,C=function(e){function t(t,r){var n=e.call(this,r)||this;if(n._onSegmentRequestQueued=new E,n._onSegmentRequestStart=new E,n._onSegmentRetrieved=new E,n._onSegmentRequestFailed=new E,n._onSegmentReady=new E,n._onSegmentAppendQueued=new E,n._onSegmentAppendEnd=new E,n._playlist=null,n._playlistSegmentRetriever=null,n._playlistUpdateJob=null,n._initialPlaylistRetrieveCompleted=!1,n._playlistUpdateTimer=null,n._earliestAllowedNextUpdateTime=v(),n._mse=null,n._simpleMSE=null,n._html5PlayerReady=!1,n._startPositionOffset=0,n._transmuxerAndMimeType=null,n._lastSegmentAppended=null,n._maxBufferLength=null,n._cacheSize=null,n._onFirstSegmentRetrieved=null,n._firstSegmentOffset=0,n._seekAttemptTimer=null,n._seekMetadataEventHandle=null,n._playlistUpdateEventHandle=null,n._playlistDuration=null,n._logger=b(n._logger,"HLSMSEPlayer"),void 0!==r.maxBufferLength&&r.maxBufferLength<0)throw new Error("maxBufferLength cannot be < 0.");if(void 0!==r.memoryCacheSize&&r.memoryCacheSize<0)throw new Error("memoryCacheSize cannot be < 0.");return n.onSegmentRequestQueued=n._onSegmentRequestQueued.getHandle(),n.onSegmentRequestStart=n._onSegmentRequestStart.getHandle(),n.onSegmentRetrieved=n._onSegmentRetrieved.getHandle(),n.onSegmentRequestFailed=n._onSegmentRequestFailed.getHandle(),n.onSegmentReady=n._onSegmentReady.getHandle(),n.onSegmentAppendQueued=n._onSegmentAppendQueued.getHandle(),n.onSegmentAppendEnd=n._onSegmentAppendEnd.getHandle(),n.__descriptor=t,n.__playerDependencies=r,n._queuedPlaylist=t.playlist,n}return i(t,e),t.isFormatSupported=function(e){return!!l.MSE.isSupported()&&!!o(e)},t.prototype.getBufferedTimeRanges=function(){var e=this._playlistSegmentRetriever;return e?a.TimeRange.normalize(e.getSegmentsWithData().map(function(e){return e.segment.getTimeRange()})):[]},t.prototype.getCompleteBufferedTimeRanges=function(){var e=this._playlistSegmentRetriever;return e?a.TimeRange.normalize(e.getSegmentsWithData().filter(function(e){return e.complete}).map(function(e){return e.segment.getTimeRange()})):[]},t.prototype.getMaxBufferLength=function(){return this._maxBufferLength},t.prototype.getBufferController=function(){var e=this;return{setMaxBufferLength:function(t){if(t<0)throw new Error("Max buffer length cannot be < 0.");e._logger.debug("Updating max buffer length.",t),e._maxBufferLength=t,e._playlistSegmentRetriever?e._playlistSegmentRetriever.updateMaxBufferLength(t):e._logger.debug("Cannot update right now. Playlist segment retriever doesn't exist.")}}},t.prototype.switchPlaylist=function(e){return this._logger.debug("Updating playlist."),this._hasInitialized()?(this._playlistSegmentRetriever&&(this._playlistSegmentRetriever.switchPlaylist(null),this._logger.debug("Removed current URL.")),this._disposePlaylist(),void this._setPlaylist(e)):(this._logger.debug("Cannot update right now. Still initializing."),void(this._queuedPlaylist=e))},t.prototype.getMemoryCacheMaxSize=function(){return null!==this._cacheSize?this._cacheSize:T},t.prototype.getMemoryCacheUsage=function(){return this._playlistSegmentRetriever?this._playlistSegmentRetriever.getCacheUsage():0},t.prototype.getMemoryCacheController=function(){var e=this;return{setMaxCacheSize:function(t){if(t<0)throw new Error("Max size cannot be < 0.");e._cacheSize=t,e._playlistSegmentRetriever&&e._playlistSegmentRetriever.updateCacheSize(t)}}},t.prototype._canPlay=function(){if(!l.MSE.isSupported())return this._logger.debug("MSE not supported."),y.resolve(!1);var e=this.__descriptor.segmentFormat,t=o(e);return t?(this._transmuxerAndMimeType=t,y.resolve(!0)):(this._logger.debug("No transmuxer found."),y.resolve(new h.NoTransmuxerError))},t.prototype._getUrlForMediaElement=function(){if(!this._mse)throw new Error("MSE does not exist.");return this._mse.getUrl()},t.prototype._handleDurationUpdates=function(){},t.prototype._signalReady=function(){this._html5PlayerReady=!0,this._initialPlaylistRetrieveCompleted&&e.prototype._signalReady.call(this)},t.prototype._initialize=function(){var t=this.__playerDependencies;if(null===this._maxBufferLength&&(void 0!==t.maxBufferLength?this._maxBufferLength=t.maxBufferLength:this._maxBufferLength=O),this._logger.debug("Initialized max buffer length.",this._maxBufferLength),null===this._cacheSize&&(void 0!==t.memoryCacheSize?this._cacheSize=t.memoryCacheSize:this._cacheSize=T),this._logger.debug("Initialized cache size.",this._cacheSize),e.prototype._initialize.call(this),!this._queuedPlaylist)throw new Error("Playlist should exist.");this._setPlaylist(this._queuedPlaylist),this._queuedPlaylist=null},t.prototype._initMediaElement=function(t,r){this._simpleMSE&&(this._simpleMSE.kill(),this._simpleMSE=null,this._logger.debug("Killed SimpleMSE.")),this._mse&&(this._mse.kill(),this._mse=null,this._logger.debug("Killed MSE.")),null!==this._seekAttemptTimer&&(window.clearTimeout(this._seekAttemptTimer),this._seekAttemptTimer=null,this._logger.debug("Cancelled seek attempt timer.")),this._onFirstSegmentRetrieved=null,this._seekMetadataEventHandle&&(this._seekMetadataEventHandle.remove(),this._seekMetadataEventHandle=null),r?(this._initMSE(),e.prototype._initMediaElement.call(this,t,!0)):e.prototype._initMediaElement.call(this,t,!1)},t.prototype._shouldBeEnded=function(){var t=this._lastSegmentAppended;if(!t||!t.isFinalSegment())return!1;if(!S)return e.prototype._shouldBeEnded.call(this);if(e.prototype._shouldBeEnded.call(this))return!0;if(!this.getMediaElement())return!1;var r=this._duration;return this._stallDetected&&null!==r&&this._getTruePosition()>=r-k},t.prototype._getTruePosition=function(){var e=this.getMediaElement();if(!e)throw new Error("Media element should exist.");return this._startPositionOffset+this._getMediaElementPosition()},t.prototype._handleSeekChange=function(t,r){e.prototype._handleSeekChange.call(this,t,r),this._playlistSegmentRetriever&&(this._logger.debug("Explicitly updating playlist segment retriever, as seek requested."),this._playlistSegmentRetriever.update(),this._findSegmentAndAppendToMSE())},t.prototype._performSeek=function(t,r){var n=this,o=this,i=o._simpleMSE,s=o._mse,u=this.getMediaElement();if(!s)throw new Error("MSE should exist.");if(!u)throw new Error("Media element should exist.");var l=!this._isMediaElementPaused(u);null!==this._seekAttemptTimer&&(window.clearTimeout(this._seekAttemptTimer),this._seekAttemptTimer=null,this._logger.debug("Cancelled previous seek attempt timer.")),this._seekMetadataEventHandle&&(this._seekMetadataEventHandle.remove(),this._seekMetadataEventHandle=null,this._logger.debug("Removed previous loaded metadata event handler.")),i&&i.kill(),s.kill(),this._logger.debug("SimpleMSE and MSE destroyed."),this._startPositionOffset=t;var c=!1;this._onFirstSegmentRetrieved=function(){return c=!0},this._logger.debug("Initializing MSE and SimpleMSE for new position."),this._initMSE();var d=this._mse.getUrl();if(this._logger.debug("Updated media element MSE src.",d),e.prototype._initMediaElement.call(this,u,!0),l){this._logger.debug("Calling play() on media element as it was playing previously.");var p=this._callMediaElementPlay(u);p&&p.catch&&p.catch(function(e){"AbortError"!==e.name&&(n._logger.error("Unexpected play() error.",e),n._triggerError(new m("Exception from calling play() after seek.",e)))})}var f=function(e){(P&&P.major<11||R)&&e<I&&(n._logger.debug("Tweaking offset to fix glitch issue."),e=I);var t=function(){n._startPositionOffset=Math.max(0,n._startPositionOffset-e),n._logger.debug("Updated start position offset.",n._startPositionOffset,e);var t=function(){n._seekAttemptTimer=null,n._logger.debug("Attempting to seek to the required offset.",e);var o=n._mse?n._mse.getBuffered():[];if(!a.TimeRange.rangesContainTime(e,o))return n._logger.debug("Holding seek because not buffered yet.",e,o),void(n._seekAttemptTimer=window.setTimeout(t,50));u.currentTime=e/1e3;var i=1e3*u.currentTime,s=i-e;Math.abs(s)<=100?(n._logger.debug("Seeked to the required offset.",e,i,s),r()):(n._logger.warn("Seek attempt failed. Trying again shortly.",e,i,s),n._seekAttemptTimer=window.setTimeout(t,50))};t()};n._onFirstSegmentRetrieved=null,A||u.readyState===u.HAVE_METADATA?(n._logger.debug("Media element has metadata. Seeking to offset."),t()):(n._logger.debug("Media element has not loaded metadata. Waiting for metadata..."),n._seekMetadataEventHandle=n._listenToOnce("loadedmetadata",function(){n._seekMetadataEventHandle=null,n._logger.debug("Got metadata. Seeking to offset."),t()},{earlyAttach:!0}))};c?(this._logger.debug("First segment already retrieved. Preparing to seek to initial offset."),f(this._firstSegmentOffset)):(this._logger.debug("Waiting for first segment to be retrieved."),this._onFirstSegmentRetrieved=function(){n._logger.debug("First segment retrieved. Preparing to seek to initial offset."),f(n._firstSegmentOffset)})},t.prototype._kill=function(){this._simpleMSE&&(this._logger.debug("Killing SimpleMSE."),this._simpleMSE.kill(),this._simpleMSE=null),this._mse&&(this._logger.debug("Killing MSE."),this._mse.kill(),this._mse=null),this._playlistSegmentRetriever&&(this._logger.debug("Killing playlist segment retriever."),this._playlistSegmentRetriever.kill(),this._playlistSegmentRetriever=null),this._disposePlaylist(),e.prototype._kill.call(this)},t.prototype._disposePlaylist=function(){this._playlistUpdateJob&&(this._logger.debug("Aborting playlist retrieve job."),this._playlistUpdateJob.abort(),this._playlistUpdateJob=null),this._playlistUpdateTimer&&(window.clearTimeout(this._playlistUpdateTimer),this._playlistUpdateTimer=null),this._playlistUpdateEventHandle&&(this._playlistUpdateEventHandle.remove(),this._playlistUpdateEventHandle=null),this._playlist=null},t.prototype._initMSE=function(){var e=this;if(!this._transmuxerAndMimeType)throw new Error("Transmuxer should have been configured.");this._lastSegmentAppended=null;var t=new l.MSE(this._transmuxerAndMimeType.mimeType,this._logger),r=new c.SimpleMSE(t,function(){return e._getSegmentDataToAppendNext()},function(){return e._getMediaElementPosition()},function(t){e._triggerError(new d.AppendError(t))},this._logger);r.onAppendQueued.subscribe(this._onSegmentAppendQueued.dispatch),r.onAppendEnd.subscribe(function(t){if(S){var r=e.getMediaElement();r&&e._isMediaElementPaused(r)&&e.isActuallyPlaying()&&(e._logger.debug("Calling play() on media element because we just appended something and should be playing."),e._callMediaElementPlay(r))}e._onSegmentAppendEnd.dispatch(t)}),this._simpleMSE=r,r.start(),this._mse=t,t.whenInitialized().catch(function(t){t!==l.killedError&&(e._logger.error("Error during mse initialization.",t),e._triggerError(new p.InitializeError(t)))})},t.prototype._getMediaElementPosition=function(){var e=this.getMediaElement();if(!e)throw new Error("No media element.");return 1e3*e.currentTime},t.prototype._whenPlaylistRetrieved=function(){var t=this,r=this._playlist;if(!r)throw new Error("Playlist should have been retrieved.");this._playlistUpdateEventHandle=r.onUpdated.subscribe(function(){t._updateLocalDurationsFromPlaylist(),t._handleDurationChange(),t._schedulePlaylistUpdate()});var o=!this._initialPlaylistRetrieveCompleted;if(o)this._initialPlaylistRetrieveCompleted=!0;else{var i=n(r);if(this._playlistDuration<i)return this._logger.error("The duration from the new playlist was less than the previous one."),void this._triggerError(new _.PlaylistUpdateError("The duration from the new playlist was less than the previous one.",{oldDuration:this._playlistDuration,newDuration:i}))}if(!this._transmuxerAndMimeType)throw new Error("Transmuxer should have been configured.");if(this._playlistSegmentRetriever)this._logger.debug("Switching playlist for playlist segment retriever."),this._playlistSegmentRetriever.switchPlaylist(r);else{var a=this._maxBufferLength;if(null===a)throw new Error("maxBufferLength should have been initiaized by now.");this._logger.debug("Creating playlist segment retriever.");var u=this._cacheSize;if(null===u)throw new Error("cacheSize should be set.");var l=new s.PlaylistSegmentRetriever({playlist:r,getPosition:function(){return t.getPosition()},maxBufferLength:a,cacheSize:u,transmuxer:this._transmuxerAndMimeType.transmuxer,logger:this._logger});l.onSegmentRequestQueued.subscribe(this._onSegmentRequestQueued.dispatch),l.onSegmentRequestStart.subscribe(this._onSegmentRequestStart.dispatch),l.onSegmentRetrieved.subscribe(this._onSegmentRetrieved.dispatch),l.onSegmentRequestFailed.subscribe(this._onSegmentRequestFailed.dispatch),this._playlistSegmentRetriever=l,l.onError.subscribe(function(e){t._logger.error("Error from playlist segment retriever.",e),e instanceof s.retrievalErrors.RetrievalError?t._triggerError(new f.RetrievalError(e)):t._triggerError(new m("Unexpected error when trying to retrieve segment.",e))}),l.onSegmentDataRetrieveStarted.subscribe(function(e){var r=e.segment;t._logger.debug("Segment retrieve started.",r.getEventRepresentation()),t._findSegmentAndAppendToMSE(),t._updateLocalDurationsFromPlaylist(),t._handleDurationChange(),t._onSegmentReady.dispatch({segment:r.getEventRepresentation()})})}this._initialPlaylistRetrieveCompleted=!0,r.hasEnded()||this._schedulePlaylistUpdate(),this._updateLocalDurationsFromPlaylist(),this._update(function(){o&&t._html5PlayerReady&&e.prototype._signalReady.call(t),t._handleDurationChange()})},t.prototype._schedulePlaylistUpdate=function(){var e=this,t=this._playlist;if(!t)throw new Error("Playlist should exist.");if((!this._playlistUpdateJob||this._playlistUpdateJob.hasCompleted())&&(this._playlistUpdateTimer&&(window.clearTimeout(this._playlistUpdateTimer),this._playlistUpdateTimer=null),!t.hasEnded())){var r=this.isPlaying()?t.getDuration()-this.getPosition()-1e4:1/0,n=t.getExpireTime(),o=n?v()-n:1/0,i=Math.max(0,this._earliestAllowedNextUpdateTime-v()),a=Math.max(i,Math.min(r,o,t.getType()===s.PlaylistType.EVENT?M:1/0));a<1/0&&(this._earliestAllowedNextUpdateTime=v()+x,this._playlistUpdateTimer=window.setTimeout(function(){e._playlistUpdateTimer=null;var r=e._playlistUpdateJob=t.update();r.onError(function(t){t!==w&&(e._handlePlaylistUpdateError(t),e._schedulePlaylistUpdate())})},a))}},t.prototype._updateLocalDurationsFromPlaylist=function(){var e=this._playlist;if(!e)throw new Error("Missing playlist.");this._duration=n(e),this._playlistDuration=e.getDuration()},t.prototype._findSegmentAndAppendToMSE=function(){var e=this._simpleMSE;if(e&&e.waitingForSegmentData()){var t=this._getSegmentDataToAppendNext();t&&(this._logger.debug("Providing segment to SimpleMSE.",t.eventRepresentation),e.provideNextSegmentData(t))}},t.prototype._setPlaylist=function(e){var t=this;if(this._playlist)throw new Error("Playlist already exists.");this._playlist=e,this._playlistUpdateJob=this._playlist.update(),this._playlistUpdateJob.onCompletion(function(){t._logger.debug("Playlist retrieved."),t._whenPlaylistRetrieved()}),this._playlistUpdateJob.onError(function(e){e!==w&&t._handlePlaylistUpdateError(e)})},t.prototype._handlePlaylistUpdateError=function(e){this._logger.error("Error when retrieving playlist.",e),e instanceof s.retrievalErrors.RetrievalError?this._triggerError(new f.RetrievalError(e)):this._triggerError(new m("Unexpected error when retrieving playlist.",e))},t.prototype._getSegmentDataToAppendNext=function(){var e=this._lastSegmentAppended;this._logger.debug("Looking for segment to append next.",!!e);var t=this._playlistSegmentRetriever;if(!t)return this._logger.debug("No segment retriever."),null;if(e){var r=this._getSubsequentSegment(e);if(!r)return this._logger.debug("No segment found."),e.isFinalSegment()&&(this._logger.debug("The last segment we appended was the last one in the stream. Signalling EOS."),this._signalEOS()),null;var n=r.segment;return this._logger.debug("Found segment.",n.getEventRepresentation()),this._lastSegmentAppended=n,{data:r.dataRetrieveJob,eventRepresentation:n.getEventRepresentation()}}var o=this.getPosition(),r=g(t.getSegmentsWithData(),function(e){return e.segment.getTimeRange().containsTime(o)});if(!r)return this._logger.debug("No segment found.",o),null;var n=r.segment,i=r.dataRetrieveJob,a=this._firstSegmentOffset=o-n.getTimeRange().start,s=this.getMediaElement();if(!s)throw new Error("Media element should exist.");var u={data:i,eventRepresentation:n.getEventRepresentation()};if(!n.isFinalSegment())for(var l=n.getTimeRange().duration-a;l<D;){var c=this._getSubsequentSegment(n);if(!c)return this._logger.debug("Not enough segments to cover min append duration.",l),null;c.segment.isFinalSegment()?l=1/0:l+=c.segment.getTimeRange().duration}return this._logger.debug("Found initial segment.",n.getEventRepresentation()),this._lastSegmentAppended=n,this._onFirstSegmentRetrieved&&this._onFirstSegmentRetrieved(),u},t.prototype._getSubsequentSegment=function(e){var t=this._playlistSegmentRetriever;if(!t)return this._logger.debug("No segment retriever."),null;var r=t.getSegmentsWithData(),n=r[r.map(function(e){return e.segment.getSequenceNumber()}).indexOf(e.getSequenceNumber())+1];return n&&n.segment.getTimeRange().start===e.getTimeRange().end?n:null},t.prototype._signalEOS=function(){var e=this;this._logger.debug("Signalling EOS."),this._simpleMSE&&(this._simpleMSE.kill(),this._logger.debug("Killed SimpleMSE."),this._simpleMSE=null);var t=this._mse;t&&!t.eosSignalled()&&t.signalEOS().catch(function(r){if(t===e._mse){if("InvalidStateError"===r.name)return void e._logger.error("InvalidStateError occurred when signalling EOS.",r);e._logger.error("Error occurred when signalling EOS.",r),e._triggerError(new d.AppendError(r))}})},t}(u.HTML5PlayerBase);t.HLSMSEPlayer=C},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(14);t.HLSMSEPlayer=n.HLSMSEPlayer;var o=r(8);t.errors=o.errors;var i=r(7);t.retrievalErrors=i.retrievalErrors}])})},function(e,t,r){!function(t,n){e.exports=n(r(2),r(8),r(9))}(window,function(e,t,r){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=38)}([function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.getCode=function(){return"GENERIC"},e}();t.RetrievalError=n},function(e,t,r){"use strict";function n(e,t){return!(e.mimeType&&t.mimeType!==e.mimeType||e.audioCodec&&(!t.audioCodec||t.audioCodec.id!==e.audioCodec.id)||e.videoCodec&&(!t.videoCodec||t.videoCodec.id!==e.videoCodec.id))}Object.defineProperty(t,"__esModule",{value:!0}),t.isPartialMatch=n},function(e,r){e.exports=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5),i=r(21),a={rate:44100,id:3},s=16,u=2,l=a.rate,c=2,d=8;t.MP3ToMP4={getInputFormat:function(){return{mimeType:"audio/mpeg"}},getOutputFormat:function(){return{mimeType:"audio/mp4",audioCodec:{id:"mp3"}}},transmux:function(e){var t=new n.helpers.abortableJob.AbortableJob(function(){function t(){v.close(),m.flush()}function r(r){y=!0;try{t()}catch(e){}p.reject(r),e.abort()}var p=n.helpers.deferred.buildDeferred(),f=new n.eventDispatcher.EventDispatcher,h=[],_=!1,g=null,y=!1,v=new o.MP3Parser,m=new i.MP4Mux({audioTrackId:0,videoTrackId:-1,tracks:[{codecId:c,channels:u,samplerate:a.rate,samplesize:s,timescale:l}]});return m.ondata=function(e){y||(g?(h.push(e),f.dispatch({initData:g,data:e})):g=e)},v.onFrame=function(e){if(!y)try{var t=new Uint8Array(e.length+1),n=c<<4;n|=a.id<<2,n|=(16===s?1:0)<<1,n|=2===u?1:0,t[0]=n,t.set(e,1);var o=0;m.pushPacket(d,t,o)}catch(e){r(e)}},e.onProgressUpdate(function(e){var t=e.data;!_&&e.initData&&(t=n.helpers.arrayBuffer.combine([e.initData,e.data])),_=!0;try{v.push(t)}catch(e){r(e)}}),e.onCompletion(function(e){try{t(),p.resolve(e)}catch(e){r(e)}}),e.onError(r),{result:p.promise,progressUpdates:{onProgressUpdate:f,getProgressSoFar:function(){return h.length?{initData:g,data:n.helpers.arrayBuffer.combine(h)}:null}},abort:function(){y=!0,e.abort(),t()}}});return t.run()}}},function(e,t,r){"use strict";function n(){this.buffer=null,this.bufferSize=0}t.__esModule=!0,t.MP3Parser=n;var o=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],i=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3];n.prototype.push=function(e){var t;if(this.bufferSize>0){var r=e.length+this.bufferSize;if(!this.buffer||this.buffer.length<r){var n=new Uint8Array(r);this.bufferSize>0&&n.set(this.buffer.subarray(0,this.bufferSize)),this.buffer=n}this.buffer.set(e,this.bufferSize),this.bufferSize=r,e=this.buffer,t=r}else t=e.length;for(var o,i=0;i<t&&(o=this._parse(e,i,t))>0;)i+=o;var a=t-i;a>0&&(!this.buffer||this.buffer.length<a?this.buffer=new Uint8Array(e.subarray(i,t)):this.buffer.set(e.subarray(i,t))),this.bufferSize=a},n.prototype._parse=function(e,t,r){if(t+2>r)return-1;if(255===e[t]||224===(224&e[t+1])){if(t+24>r)return-1;var n=e[t+1]>>3&3,a=e[t+1]>>1&3,s=e[t+2]>>4&15,u=e[t+2]>>2&3,l=!!(2&e[t+2]);if(1!==n&&0!==s&&15!==s&&3!==u){var c=3===n?3-a:3===a?3:4,d=1e3*o[14*c+s-1],p=3===n?0:2===n?1:2,f=i[3*p+u],h=l?1:0,_=3===a?(3===n?12:6)*d/f+h<<2:(3===n?144:72)*d/f+h|0;return t+_>r?-1:(this.onFrame&&this.onFrame(new Uint8Array(e.subarray(t,t+_))),_)}}for(var g=t+2;g<r;){if(255===e[g-1]&&224===(224&e[g]))return this.onNoise&&this.onNoise(new Uint8Array(e.subarray(t,g-1))),g-t-1;g++}return-1},n.prototype.close=function(){this.bufferSize>0&&this.onNoise&&this.onNoise(new Uint8Array(this.buffer.subarray(0,this.bufferSize))),this.buffer=null,this.bufferSize=0,this.onClose&&this.onClose()}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PassThrough={getInputFormat:function(){return{}},getOutputFormat:function(){return{}},transmux:function(e){return e}}},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"NO_DECRYPTOR"},t}(o.RetrievalError);t.NoDecryptorError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(t){var r=e.call(this)||this;return r._statusCode=t,r}return n(t,e),t.prototype.getStatusCode=function(){return this._statusCode},t.prototype.getCode=function(){return"UNACCEPTABLE_RESPONSE_STATUS_CODE"},t}(o.RetrievalError);t.UnacceptableResponseStatusCodeError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t,r){this._playlist=e,this._url=t,this._sequenceNumber=r}return e.prototype.getPlaylist=function(){return this._playlist},e.prototype.getUrl=function(){return this._url},e.prototype.getSequenceNumber=function(){return this._sequenceNumber},e}();t.Segment=n},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(t){var r=e.call(this)||this;return r._code=t,r}return n(t,e),t.prototype.getCode=function(){return"OGG_PARSER."+this._code},t}(o.RetrievalError);t.OggParserError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this._url=e}return e.prototype.getUrl=function(){return this._url},e}();t.Playlist=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._playlist=e,this._url=t}return e.prototype.getPlaylist=function(){return this._playlist},e.prototype.getUrl=function(){return this._url},e}();t.Key=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._playlist=e,this._url=t}return e.prototype.getPlaylist=function(){return this._playlist},e.prototype.getUrl=function(){return this._url},e}();t.InitData=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(13),i=r(12),a=r(11),s=r(9);!function(e){e.InitData=o.InitData,e.Key=i.Key,e.Playlist=a.Playlist,e.Segment=s.Segment}(n=t.events||(t.events={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"UNSUPPORTED_ENCRYPTION_ERROR"},t}(o.RetrievalError);t.UnsupportedEncryptionError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(t){var r=e.call(this)||this;return r._details=t,r}return n(t,e),t.prototype.getDetails=function(){return this._details},t.prototype.getCode=function(){return"PLAYLIST_PARSE"},t}(o.RetrievalError);t.PlaylistParseError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(7),i=r(16),a=r(10),s=r(1),u=r(8),l=r(15);!function(e){e.NoDecryptorError=o.NoDecryptorError,e.PlaylistParseError=i.PlaylistParseError,e.OggParserError=a.OggParserError,e.RetrievalError=s.RetrievalError,e.UnacceptableResponseStatusCodeError=u.UnacceptableResponseStatusCodeError,e.UnsupportedEncryptionError=l.UnsupportedEncryptionError}(n=t.retrievalErrors||(t.retrievalErrors={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.MP4ToMP4={getInputFormat:function(){return{mimeType:"audio/mp4"}},getOutputFormat:function(){return{mimeType:"audio/mp4"}},transmux:function(e){var t=new n.helpers.abortableJob.AbortableJob(function(){function t(t){r.reject(t),e.abort()}var r=n.helpers.deferred.buildDeferred(),o=new n.eventDispatcher.EventDispatcher,i=[],a=[],s=new Uint8Array(0),u=null,l=!1,c=function(e){
23865
+ if(e.byteLength<4)return void(s=e);if(null===u){var t=new DataView(e.buffer).getUint32(0);if(1===t)throw new Error("Large atom size not supported.");u=t}if(0!==u&&e.byteLength>=u){var r=new Uint8Array(e.buffer.slice(0,u));a.push(r),s=new Uint8Array(e.buffer.slice(u)),u=null,c(s)}else s=e};return e.onProgressUpdate(function(e){var r=e.data;!l&&e.initData&&(r=n.helpers.arrayBuffer.combine([e.initData,e.data])),l=!0;try{var u=n.helpers.arrayBuffer.combine([s,r]);if(c(u),a.length){var d=n.helpers.arrayBuffer.combine(a);a.splice(0),i.push(d),o.dispatch({data:d})}}catch(e){t(e)}}),e.onCompletion(function(e){try{if(0===u)i.push(s),o.dispatch({data:s});else if(s.byteLength)throw new Error("Part way through an atom.");r.resolve(e)}catch(e){t(e)}}),e.onError(t),{result:r.promise,progressUpdates:{onProgressUpdate:o,getProgressSoFar:function(){return i.length?{data:n.helpers.arrayBuffer.combine(i)}:null}},abort:function(){e.abort()}}});return t.run()}}},function(e,t){e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(3),i=r(19);t.OggOpusToWebm={getInputFormat:function(){return{mimeType:"audio/ogg",audioCodec:{id:"opus"}}},getOutputFormat:function(){return{mimeType:"audio/webm",audioCodec:{id:"opus"}}},transmux:function(e){var t=new n.helpers.abortableJob.AbortableJob(function(){function t(t){p=!0,r.reject(t),e.abort()}var r=n.helpers.deferred.buildDeferred(),a=new n.eventDispatcher.EventDispatcher,s=[],u=null,l=new Uint8Array(0),c=!1,d=null,p=!1;return e.onProgressUpdate(function(e){if(!p){var r=[l,e.data];!c&&e.initData&&(r=[e.initData].concat(r)),c=!0;var f=n.helpers.arrayBuffer.combine(r);try{var h=o.retrievePages(f).pages,_=h.reduce(function(e,t){return e+t.entirePage.byteLength},0);l=new Uint8Array(f.buffer.slice(_));var g=o.retrievePackets(h);if(g.length&&!u){if(g.length<2)throw new Error("Expecting at least 2 opus packets.");var y=i.parseOpusHead(g[0]);y.outputGain>-2&&i.setOutputGain(g[0],-2),u=[g[0],g[1]],g=g.slice(2)}if(g.length&&u){s.push.apply(s,g);var v=i.buildWebm(u.concat(g));d||(d=v.initData),a.dispatch({initData:d,data:v.data})}}catch(e){t(e)}}}),e.onCompletion(function(e){l.byteLength?r.reject(new Error("Still data left in buffer.")):r.resolve(e)}),e.onError(t),{result:r.promise,progressUpdates:{onProgressUpdate:a,getProgressSoFar:function(){if(s.length&&u){var e=i.buildWebm(u.concat(s)).data;return{initData:d,data:e}}return null}},abort:function(){p=!0,e.abort()}}});return t.run()}}},function(e,t,r){"use strict";t.__esModule=!0;var n,o,i=function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)};!function(e){var t;!function(e){function t(e){for(var t=new Uint8Array(4*e.length),r=0,n=0,o=e.length;n<o;n++){var i=e.charCodeAt(n);if(i<=127)t[r++]=i;else{if(55296<=i&&i<=56319){var a=e.charCodeAt(n+1);56320<=a&&a<=57343&&(i=((1023&i)<<10)+(1023&a)+65536,++n)}0!==(4292870144&i)?(t[r++]=248|i>>>24&3,t[r++]=128|i>>>18&63,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i):0!==(4294901760&i)?(t[r++]=240|i>>>18&7,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i):0!==(4294965248&i)?(t[r++]=224|i>>>12&15,t[r++]=128|i>>>6&63,t[r++]=128|63&i):(t[r++]=192|i>>>6&31,t[r++]=128|63&i)}}return t.subarray(0,r)}function r(e){for(var t=0,r="";t<e.length;){var n=255&e[t++];if(n<=127)r+=String.fromCharCode(n);else{var o=192,i=5;do{var a=o>>1|128;if((n&a)===o)break;o=o>>1|128,--i}while(i>=0);if(i<=0)throw new Error("Invalid UTF8 character");for(var s=n&(1<<i)-1,u=5;u>=i;--u){var l=e[t++];if(128!==(192&l))throw new Error("Invalid UTF8 character sequence");s=s<<6|63&l}r+=s>=65536?String.fromCharCode(s-65536>>10&1023|55296,1023&s|56320):String.fromCharCode(s)}}return r}e.utf8decode=t,e.utf8encode=r}(t=e.StringUtilities||(e.StringUtilities={}))}(o||(o={})),function(e){var t;!function(e){function t(e){for(var t=e.length>>1,r=new Uint8Array(t),n=0;n<t;n++)r[n]=parseInt(e.substr(2*n,2),16);return r}function r(e){var t,r=0,n=a.RAW,o=e[r],i=o>>4,d=o>>2&3,p=2&o?16:8,f=1&o?2:1;switch(r++,i){case c:var h=e[r++];n=h,t=1024;break;case l:var _=e[r+1]>>3&3,g=e[r+1]>>1&3;t=1===g?3===_?1152:576:3===g?384:1152}return{codecDescription:u[i],codecId:i,data:e.subarray(r),rate:s[d],size:p,channels:f,samples:t,packetType:n}}function n(e){var t=0,r=e[t]>>4,n=15&e[t];t++;var o={frameType:r,codecId:n,codecDescription:p[n]};switch(n){case h:var i=e[t++];o.packetType=i,o.compositionTime=(e[t]<<24|e[t+1]<<16|e[t+2]<<8)>>8,t+=3;break;case f:o.packetType=_.NALU,o.horizontalOffset=e[t]>>4&15,o.verticalOffset=15&e[t],o.compositionTime=0,t++}return o.data=e.subarray(t),o}function o(e){var t,r,n=[],o=-1,i=-1,a=+e.asGetPublicProperty("duration"),s=e.asGetPublicProperty("audiocodecid");switch(s){case l:case"mp3":t="mp3",r=l;break;case c:case"mp4a":t="mp4a",r=c;break;default:if(!isNaN(s))throw new Error("Unsupported audio codec: "+s);t=null,r=-1}var u,d,p=e.asGetPublicProperty("videocodecid");switch(p){case f:case"vp6f":u="vp6f",d=f;break;case h:case"avc1":u="avc1",d=h;break;default:if(!isNaN(p))throw new Error("Unsupported video codec: "+p);u=null,d=-1}var _=null===t?null:{codecDescription:t,codecId:r,language:"und",timescale:+e.asGetPublicProperty("audiosamplerate")||44100,samplerate:+e.asGetPublicProperty("audiosamplerate")||44100,channels:+e.asGetPublicProperty("audiochannels")||2,samplesize:16},g=null===u?null:{codecDescription:u,codecId:d,language:"und",timescale:6e4,framerate:+e.asGetPublicProperty("videoframerate")||+e.asGetPublicProperty("framerate"),width:+e.asGetPublicProperty("width"),height:+e.asGetPublicProperty("height")},y=e.asGetPublicProperty("trackinfo");if(y)for(var v=0;v<y.length;v++){var m=y[v],E=m.asGetPublicProperty("sampledescription")[0];E.asGetPublicProperty("sampletype")===s?(_.language=m.asGetPublicProperty("language"),_.timescale=+m.asGetPublicProperty("timescale")):E.asGetPublicProperty("sampletype")===p&&(g.language=m.asGetPublicProperty("language"),g.timescale=+m.asGetPublicProperty("timescale"))}return g&&(i=n.length,n.push(g)),_&&(o=n.length,n.push(_)),{tracks:n,duration:a,audioTrackId:o,videoTrackId:i}}function i(e){var t=[];return e.audioTrackId>=0&&t.push({tracks:[e.tracks[e.audioTrackId]],duration:e.duration,audioTrackId:0,videoTrackId:-1}),e.videoTrackId>=0&&t.push({tracks:[e.tracks[e.videoTrackId]],duration:e.duration,audioTrackId:-1,videoTrackId:0}),t}var a,s=[5500,11025,22050,44100],u=["PCM","ADPCM","MP3","PCM le","Nellymouser16","Nellymouser8","Nellymouser","G.711 A-law","G.711 mu-law",null,"AAC","Speex","MP3 8khz"],l=2,c=10;!function(e){e[e.HEADER=0]="HEADER",e[e.RAW=1]="RAW"}(a||(a={}));var d,p=[null,"JPEG","Sorenson","Screen","VP6","VP6 alpha","Screen2","AVC"],f=4,h=7;!function(e){e[e.KEY=1]="KEY",e[e.INNER=2]="INNER",e[e.DISPOSABLE=3]="DISPOSABLE",e[e.GENERATED=4]="GENERATED",e[e.INFO=5]="INFO"}(d||(d={}));var _;!function(e){e[e.HEADER=0]="HEADER",e[e.NALU=1]="NALU",e[e.END=2]="END"}(_||(_={}));var g,y=8,v=9,m=50,E=!0;!function(e){e[e.CAN_GENERATE_HEADER=0]="CAN_GENERATE_HEADER",e[e.NEED_HEADER_DATA=1]="NEED_HEADER_DATA",e[e.MAIN_PACKETS=2]="MAIN_PACKETS"}(g||(g={}));var b=function(){function o(e){var t=this;this.oncodecinfo=function(e){},this.ondata=function(e){throw new Error("MP4Mux.ondata is not set")},this.metadata=e,this.trackStates=this.metadata.tracks.map(function(e,r){var n={trackId:r+1,trackInfo:e,cachedDuration:0,samplesProcessed:0,initializationData:[]};return t.metadata.audioTrackId===r&&(t.audioTrackState=n),t.metadata.videoTrackId===r&&(t.videoTrackState=n),n},this),this._checkIfNeedHeaderData(),this.filePos=0,this.cachedPackets=[],this.chunkIndex=0}return o.prototype.pushPacket=function(e,t,o){switch(this.state===g.CAN_GENERATE_HEADER&&this._tryGenerateHeader(),e){case y:var i=this.audioTrackState,s=r(t);if(!i||i.trackInfo.codecId!==s.codecId)throw new Error("Unexpected audio packet codec: "+s.codecDescription);switch(s.codecId){default:throw new Error("Unsupported audio codec: "+s.codecDescription);case l:break;case c:if(s.packetType===a.HEADER)return void i.initializationData.push(s.data)}this.cachedPackets.push({packet:s,timestamp:o,trackId:i.trackId});break;case v:var u=this.videoTrackState,d=n(t);if(!u||u.trackInfo.codecId!==d.codecId)throw new Error("Unexpected video packet codec: "+d.codecDescription);switch(d.codecId){default:throw new Error("unsupported video codec: "+d.codecDescription);case f:break;case h:if(d.packetType===_.HEADER)return void u.initializationData.push(d.data)}this.cachedPackets.push({packet:d,timestamp:o,trackId:u.trackId});break;default:throw new Error("unknown packet type: "+e)}this.state===g.NEED_HEADER_DATA&&this._tryGenerateHeader(),this.cachedPackets.length>=m&&this.state===g.MAIN_PACKETS&&this._chunk()},o.prototype.flush=function(){this.cachedPackets.length>0&&this._chunk()},o.prototype._checkIfNeedHeaderData=function(){this.trackStates.some(function(e){return e.trackInfo.codecId===c||e.trackInfo.codecId===h})?this.state=g.NEED_HEADER_DATA:this.state=g.CAN_GENERATE_HEADER},o.prototype._tryGenerateHeader=function(){var r=this.trackStates.every(function(e){switch(e.trackInfo.codecId){case c:case h:return e.initializationData.length>0;default:return!0}});if(r){for(var n=["isom"],o=1,i=1,a=[],s=0;s<this.trackStates.length;s++){var u,d=this.trackStates[s],p=d.trackInfo;switch(p.codecId){case c:var _=d.initializationData[0];u=new e.Iso.AudioSampleEntry("mp4a",o,p.channels,p.samplesize,p.samplerate);var y=new Uint8Array(41+_.length);y.set(t("0000000003808080"),0),y[8]=32+_.length,y.set(t("00020004808080"),9),y[16]=18+_.length,y.set(t("40150000000000FA000000000005808080"),17),y[34]=_.length,y.set(_,35),y.set(t("068080800102"),35+_.length),u.otherBoxes=[new e.Iso.RawTag("esds",y)];var v=_[0]>>3;d.mimeTypeCodec="mp4a.40."+v;break;case l:u=new e.Iso.AudioSampleEntry(".mp3",o,p.channels,p.samplesize,p.samplerate),d.mimeTypeCodec="mp3";break;case h:var m=d.initializationData[0];u=new e.Iso.VideoSampleEntry("avc1",i,p.width,p.height),u.otherBoxes=[new e.Iso.RawTag("avcC",m)];var E=m[1]<<16|m[2]<<8|m[3];d.mimeTypeCodec="avc1."+(16777216|E).toString(16).substr(1),n.push("iso2","avc1","mp41");break;case f:u=new e.Iso.VideoSampleEntry("VP6F",i,p.width,p.height),u.otherBoxes=[new e.Iso.RawTag("glbl",t("00"))],d.mimeTypeCodec="avc1.42001E";break;default:throw new Error("not supported track type")}var b,w=e.Iso.TrackHeaderFlags.TRACK_ENABLED|e.Iso.TrackHeaderFlags.TRACK_IN_MOVIE;d===this.audioTrackState?b=new e.Iso.TrackBox(new e.Iso.TrackHeaderBox(w,d.trackId,-1,0,0,1,s),new e.Iso.MediaBox(new e.Iso.MediaHeaderBox(p.timescale,-1,p.language),new e.Iso.HandlerBox("soun","SoundHandler"),new e.Iso.MediaInformationBox(new e.Iso.SoundMediaHeaderBox,new e.Iso.DataInformationBox(new e.Iso.DataReferenceBox([new e.Iso.DataEntryUrlBox(e.Iso.SELF_CONTAINED_DATA_REFERENCE_FLAG)])),new e.Iso.SampleTableBox(new e.Iso.SampleDescriptionBox([u]),new e.Iso.RawTag("stts",t("0000000000000000")),new e.Iso.RawTag("stsc",t("0000000000000000")),new e.Iso.RawTag("stsz",t("000000000000000000000000")),new e.Iso.RawTag("stco",t("0000000000000000")))))):d===this.videoTrackState&&(b=new e.Iso.TrackBox(new e.Iso.TrackHeaderBox(w,d.trackId,-1,p.width,p.height,0,s),new e.Iso.MediaBox(new e.Iso.MediaHeaderBox(p.timescale,-1,p.language),new e.Iso.HandlerBox("vide","VideoHandler"),new e.Iso.MediaInformationBox(new e.Iso.VideoMediaHeaderBox,new e.Iso.DataInformationBox(new e.Iso.DataReferenceBox([new e.Iso.DataEntryUrlBox(e.Iso.SELF_CONTAINED_DATA_REFERENCE_FLAG)])),new e.Iso.SampleTableBox(new e.Iso.SampleDescriptionBox([u]),new e.Iso.RawTag("stts",t("0000000000000000")),new e.Iso.RawTag("stsc",t("0000000000000000")),new e.Iso.RawTag("stsz",t("000000000000000000000000")),new e.Iso.RawTag("stco",t("0000000000000000"))))))),a.push(b)}var P=new e.Iso.MovieExtendsBox(null,[new e.Iso.TrackExtendsBox(1,1,0,0,0),new e.Iso.TrackExtendsBox(2,1,0,0,0)],null),S=new e.Iso.BoxContainerBox("udat",[new e.Iso.MetaBox(new e.Iso.RawTag("hdlr",t("00000000000000006D6469726170706C000000000000000000")),[new e.Iso.RawTag("ilst",t("00000025A9746F6F0000001D6461746100000001000000004C61766635342E36332E313034"))])]),R=new e.Iso.MovieHeaderBox(1e3,0,this.trackStates.length+1),A=new e.Iso.MovieBox(R,a,P,S),O=new e.Iso.FileTypeBox("isom",512,n),T=O.layout(0),x=A.layout(T),M=new Uint8Array(T+x);O.write(M),A.write(M),this.oncodecinfo(this.trackStates.map(function(e){return e.mimeTypeCodec})),this.ondata(M),this.filePos+=M.length,this.state=g.MAIN_PACKETS}},o.prototype._chunk=function(){var t=this.cachedPackets;if(E&&this.videoTrackState){for(var r=t.length-1,n=this.videoTrackState.trackId;r>0&&(t[r].trackId!==n||t[r].packet.frameType!==d.KEY);)r--;r>0&&(t=t.slice(0,r))}if(0!==t.length){for(var o=[],i=0,a=[],s=[],u=0;u<this.trackStates.length;u++){var p=this.trackStates[u],_=p.trackInfo,g=p.trackId,y=t.filter(function(e){return e.trackId===g});if(0!==y.length){var v,m,b,w=new e.Iso.TrackFragmentBaseMediaDecodeTimeBox(p.cachedDuration);switch(s.push(i),_.codecId){case c:case l:b=[];for(var r=0;r<y.length;r++){var P=y[r].packet,S=Math.round(P.samples*_.timescale/_.samplerate);o.push(P.data),i+=P.data.length,b.push({duration:S,size:P.data.length}),p.samplesProcessed+=P.samples}var R=e.Iso.TrackFragmentFlags.DEFAULT_SAMPLE_FLAGS_PRESENT;v=new e.Iso.TrackFragmentHeaderBox(R,g,0,0,0,0,e.Iso.SampleFlags.SAMPLE_DEPENDS_ON_NO_OTHERS);var A=e.Iso.TrackRunFlags.DATA_OFFSET_PRESENT|e.Iso.TrackRunFlags.SAMPLE_DURATION_PRESENT|e.Iso.TrackRunFlags.SAMPLE_SIZE_PRESENT;m=new e.Iso.TrackRunBox(A,b,0,0),p.cachedDuration=Math.round(p.samplesProcessed*_.timescale/_.samplerate);break;case h:case f:b=[];for(var O=p.samplesProcessed,T=O*_.timescale/_.framerate,x=Math.round(T),r=0;r<y.length;r++){var M=y[r].packet;O++;var D=Math.round(O*_.timescale/_.framerate),k=D-x;x=D;var I=Math.round(O*_.timescale/_.framerate+M.compositionTime*_.timescale/1e3);o.push(M.data),i+=M.data.length;var C=M.frameType===d.KEY?e.Iso.SampleFlags.SAMPLE_DEPENDS_ON_NO_OTHERS:e.Iso.SampleFlags.SAMPLE_DEPENDS_ON_OTHER|e.Iso.SampleFlags.SAMPLE_IS_NOT_SYNC;b.push({duration:k,size:M.data.length,flags:C,compositionTimeOffset:I-D})}var R=e.Iso.TrackFragmentFlags.DEFAULT_SAMPLE_FLAGS_PRESENT;v=new e.Iso.TrackFragmentHeaderBox(R,g,0,0,0,0,e.Iso.SampleFlags.SAMPLE_DEPENDS_ON_NO_OTHERS);var A=e.Iso.TrackRunFlags.DATA_OFFSET_PRESENT|e.Iso.TrackRunFlags.SAMPLE_DURATION_PRESENT|e.Iso.TrackRunFlags.SAMPLE_SIZE_PRESENT|e.Iso.TrackRunFlags.SAMPLE_FLAGS_PRESENT|e.Iso.TrackRunFlags.SAMPLE_COMPOSITION_TIME_OFFSET;m=new e.Iso.TrackRunBox(A,b,0,0),p.cachedDuration=x,p.samplesProcessed=O;break;default:throw new Error("Un codec")}var L=new e.Iso.TrackFragmentBox(v,w,m);a.push(L)}}this.cachedPackets.splice(0,t.length);for(var N=new e.Iso.MovieFragmentHeaderBox(++this.chunkIndex),F=new e.Iso.MovieFragmentBox(N,a),U=F.layout(0),j=new e.Iso.MediaDataBox(o),B=j.layout(U),q=U+8,u=0;u<a.length;u++)a[u].run.dataOffset=q+s[u];var H=new Uint8Array(U+B);F.write(H),j.write(H),this.ondata(H),this.filePos+=H.length}},o}();e.MP4Mux=b,e.parseFLVMetadata=o,e.splitMetadata=i}(t=e.MP4||(e.MP4={}))}(n||(n={})),function(e){var t;!function(e){var t;!function(e){function t(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Array.prototype.concat.apply(e,t)}function r(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r}function n(e){return e.charCodeAt(0)<<24|e.charCodeAt(1)<<16|e.charCodeAt(2)<<8|e.charCodeAt(3)}function a(e){return(e-p)/1e3|0}function s(e){return 65536*e|0}function u(e){return 1073741824*e|0}function l(e){return 256*e|0}function c(e){return(31&e.charCodeAt(0))<<10|(31&e.charCodeAt(1))<<5|31&e.charCodeAt(2)}var d=o.StringUtilities.utf8decode,p=-20828448e5,f=[1,0,0,0,1,0,0,0,1],h=[0,0,0],_=function(){function e(e,t){this.boxtype=e,"uuid"===e&&(this.userType=t)}return e.prototype.layout=function(e){this.offset=e;var t=8;return this.userType&&(t+=16),this.size=t,t},e.prototype.write=function(e){return r(e,this.offset,this.size),r(e,this.offset+4,n(this.boxtype)),this.userType?(e.set(this.userType,this.offset+8),24):8},e.prototype.toUint8Array=function(){var e=this.layout(0),t=new Uint8Array(e);return this.write(t),t},e}();e.Box=_;var g=function(e){function t(t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var o=e.call(this,t)||this;return o.version=r,o.flags=n,o}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.version<<24|this.flags),n+4},t}(_);e.FullBox=g;var y=function(e){function t(t,r,n){var o=e.call(this,"ftype")||this;return o.majorBrand=t,o.minorVersion=r,o.compatibleBrands=n,o}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4*(2+this.compatibleBrands.length),this.size},t.prototype.write=function(t){var o=this,i=e.prototype.write.call(this,t);return r(t,this.offset+i,n(this.majorBrand)),r(t,this.offset+i+4,this.minorVersion),i+=8,this.compatibleBrands.forEach(function(e){r(t,o.offset+i,n(e)),i+=4},this),i},t}(_);e.FileTypeBox=y;var v=function(e){function t(t,r){var n=e.call(this,t)||this;return n.children=r,n}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return this.children.forEach(function(e){e&&(r+=e.layout(t+r))}),this.size=r},t.prototype.write=function(t){var r=e.prototype.write.call(this,t);return this.children.forEach(function(e){e&&(r+=e.write(t))}),r},t}(_);e.BoxContainerBox=v;var m=function(e){function r(r,n,o,i){var a=e.call(this,"moov",t([r],n,[o,i]))||this;return a.header=r,a.tracks=n,a.extendsBox=o,a.userData=i,a}return i(r,e),r}(v);e.MovieBox=m;var E=function(e){function t(t,r,n,o,i,a,s,u){void 0===o&&(o=1),void 0===i&&(i=1),void 0===a&&(a=f),void 0===s&&(s=p),void 0===u&&(u=p);var l=e.call(this,"mvhd",0,0)||this;return l.timescale=t,l.duration=r,l.nextTrackId=n,l.rate=o,l.volume=i,l.matrix=a,l.creationTime=s,l.modificationTime=u,l}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+16+4+2+2+8+36+24+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,a(this.creationTime)),r(t,this.offset+n+4,a(this.modificationTime)),r(t,this.offset+n+8,this.timescale),r(t,this.offset+n+12,this.duration),n+=16,r(t,this.offset+n,s(this.rate)),r(t,this.offset+n+4,l(this.volume)<<16),r(t,this.offset+n+8,0),r(t,this.offset+n+12,0),n+=16,r(t,this.offset+n,s(this.matrix[0])),r(t,this.offset+n+4,s(this.matrix[1])),r(t,this.offset+n+8,s(this.matrix[2])),r(t,this.offset+n+12,s(this.matrix[3])),r(t,this.offset+n+16,s(this.matrix[4])),r(t,this.offset+n+20,s(this.matrix[5])),r(t,this.offset+n+24,u(this.matrix[6])),r(t,this.offset+n+28,u(this.matrix[7])),r(t,this.offset+n+32,u(this.matrix[8])),n+=36,r(t,this.offset+n,0),r(t,this.offset+n+4,0),r(t,this.offset+n+8,0),r(t,this.offset+n+12,0),r(t,this.offset+n+16,0),r(t,this.offset+n+20,0),n+=24,r(t,this.offset+n,this.nextTrackId),n+=4},t}(g);e.MovieHeaderBox=E;var b;!function(e){e[e.TRACK_ENABLED=1]="TRACK_ENABLED",e[e.TRACK_IN_MOVIE=2]="TRACK_IN_MOVIE",e[e.TRACK_IN_PREVIEW=4]="TRACK_IN_PREVIEW"}(b=e.TrackHeaderFlags||(e.TrackHeaderFlags={}));var w=function(e){function t(t,r,n,o,i,a,s,u,l,c,d){void 0===s&&(s=0),void 0===u&&(u=0),void 0===l&&(l=f),void 0===c&&(c=p),void 0===d&&(d=p);var h=e.call(this,"tkhd",0,t)||this;return h.trackId=r,h.duration=n,h.width=o,h.height=i,h.volume=a,h.alternateGroup=s,h.layer=u,h.matrix=l,h.creationTime=c,h.modificationTime=d,h}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+20+8+6+2+36+8,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,a(this.creationTime)),r(t,this.offset+n+4,a(this.modificationTime)),r(t,this.offset+n+8,this.trackId),r(t,this.offset+n+12,0),r(t,this.offset+n+16,this.duration),n+=20,r(t,this.offset+n,0),r(t,this.offset+n+4,0),r(t,this.offset+n+8,this.layer<<16|this.alternateGroup),r(t,this.offset+n+12,l(this.volume)<<16),n+=16,r(t,this.offset+n,s(this.matrix[0])),r(t,this.offset+n+4,s(this.matrix[1])),r(t,this.offset+n+8,s(this.matrix[2])),r(t,this.offset+n+12,s(this.matrix[3])),r(t,this.offset+n+16,s(this.matrix[4])),r(t,this.offset+n+20,s(this.matrix[5])),r(t,this.offset+n+24,u(this.matrix[6])),r(t,this.offset+n+28,u(this.matrix[7])),r(t,this.offset+n+32,u(this.matrix[8])),n+=36,r(t,this.offset+n,s(this.width)),r(t,this.offset+n+4,s(this.height)),n+=8},t}(g);e.TrackHeaderBox=w;var P=function(e){function t(t,r,n,o,i){void 0===n&&(n="unk"),void 0===o&&(o=p),void 0===i&&(i=p);var a=e.call(this,"mdhd",0,0)||this;return a.timescale=t,a.duration=r,a.language=n,a.creationTime=o,a.modificationTime=i,a}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+16+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,a(this.creationTime)),r(t,this.offset+n+4,a(this.modificationTime)),r(t,this.offset+n+8,this.timescale),r(t,this.offset+n+12,this.duration),r(t,this.offset+n+16,c(this.language)<<16),n+20},t}(g);e.MediaHeaderBox=P;var S=function(e){function t(t,r){var n=e.call(this,"hdlr",0,0)||this;return n.handlerType=t,n.name=r,n._encodedName=d(n.name),n}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+8+12+(this._encodedName.length+1),this.size},t.prototype.write=function(t){var o=e.prototype.write.call(this,t);return r(t,this.offset+o,0),r(t,this.offset+o+4,n(this.handlerType)),r(t,this.offset+o+8,0),r(t,this.offset+o+12,0),r(t,this.offset+o+16,0),o+=20,t.set(this._encodedName,this.offset+o),t[this.offset+o+this._encodedName.length]=0,o+=this._encodedName.length+1},t}(g);e.HandlerBox=S;var R=function(e){function t(t){void 0===t&&(t=0);var r=e.call(this,"smhd",0,0)||this;return r.balance=t,r}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,l(this.balance)<<16),n+4},t}(g);e.SoundMediaHeaderBox=R;var A=function(e){function t(t,r){void 0===t&&(t=0),void 0===r&&(r=h);var n=e.call(this,"vmhd",0,0)||this;return n.graphicsMode=t,n.opColor=r,n}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+8,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.graphicsMode<<16|this.opColor[0]),r(t,this.offset+n+4,this.opColor[1]<<16|this.opColor[2]),n+8},t}(g);e.VideoMediaHeaderBox=A,e.SELF_CONTAINED_DATA_REFERENCE_FLAG=1;var O=function(t){function r(r,n){void 0===n&&(n=null);var o=t.call(this,"url ",0,r)||this;return o.location=n,r&e.SELF_CONTAINED_DATA_REFERENCE_FLAG||(o._encodedLocation=d(n)),o}return i(r,t),r.prototype.layout=function(e){var r=t.prototype.layout.call(this,e);return this._encodedLocation&&(r+=this._encodedLocation.length+1),this.size=r},r.prototype.write=function(e){var r=t.prototype.write.call(this,e);return this._encodedLocation&&(e.set(this._encodedLocation,this.offset+r),e[this.offset+r+this._encodedLocation.length]=0,r+=this._encodedLocation.length),r},r}(g);e.DataEntryUrlBox=O;var T=function(e){function t(t){var r=e.call(this,"dref",0,0)||this;return r.entries=t,r}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+4;return this.entries.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.entries.length),this.entries.forEach(function(e){n+=e.write(t)}),n},t}(g);e.DataReferenceBox=T;var x=function(e){function t(t){var r=e.call(this,"dinf",[t])||this;return r.dataReference=t,r}return i(t,e),t}(v);e.DataInformationBox=x;var M=function(e){function t(t){var r=e.call(this,"stsd",0,0)||this;return r.entries=t,r}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return r+=4,this.entries.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.entries.length),n+=4,this.entries.forEach(function(e){n+=e.write(t)}),n},t}(g);e.SampleDescriptionBox=M;var D=function(e){function t(t,r,n,o,i){var a=e.call(this,"stbl",[t,r,n,o,i])||this;return a.sampleDescriptions=t,a.timeToSample=r,a.sampleToChunk=n,a.sampleSizes=o,a.chunkOffset=i,a}return i(t,e),t}(v);e.SampleTableBox=D;var k=function(e){function t(t,r,n){var o=e.call(this,"minf",[t,r,n])||this;return o.header=t,o.info=r,o.sampleTable=n,o}return i(t,e),t}(v);e.MediaInformationBox=k;var I=function(e){function t(t,r,n){var o=e.call(this,"mdia",[t,r,n])||this;return o.header=t,o.handler=r,o.info=n,o}return i(t,e),t}(v);e.MediaBox=I;var C=function(e){function t(t,r){var n=e.call(this,"trak",[t,r])||this;return n.header=t,n.media=r,n}return i(t,e),t}(v);e.TrackBox=C;var L=function(e){function t(t,r,n,o,i){var a=e.call(this,"trex",0,0)||this;return a.trackId=t,a.defaultSampleDescriptionIndex=r,a.defaultSampleDuration=n,a.defaultSampleSize=o,a.defaultSampleFlags=i,a}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+20,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.trackId),r(t,this.offset+n+4,this.defaultSampleDescriptionIndex),r(t,this.offset+n+8,this.defaultSampleDuration),r(t,this.offset+n+12,this.defaultSampleSize),r(t,this.offset+n+16,this.defaultSampleFlags),n+20},t}(g);e.TrackExtendsBox=L;var N=function(e){function r(r,n,o){var i=e.call(this,"mvex",t([r],n,[o]))||this;return i.header=r,i.tracDefaults=n,i.levels=o,i}return i(r,e),r}(v);e.MovieExtendsBox=N;var F=function(e){function t(t,r){var n=e.call(this,"meta",0,0)||this;return n.handler=t,n.otherBoxes=r,n}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return r+=this.handler.layout(t+r),this.otherBoxes.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var r=e.prototype.write.call(this,t);return r+=this.handler.write(t),this.otherBoxes.forEach(function(e){r+=e.write(t)}),r},t}(g);e.MetaBox=F;var U=function(e){function t(t){var r=e.call(this,"mfhd",0,0)||this;return r.sequenceNumber=t,r}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.sequenceNumber),n+4},t}(g);e.MovieFragmentHeaderBox=U;var j;!function(e){e[e.BASE_DATA_OFFSET_PRESENT=1]="BASE_DATA_OFFSET_PRESENT",e[e.SAMPLE_DESCRIPTION_INDEX_PRESENT=2]="SAMPLE_DESCRIPTION_INDEX_PRESENT",e[e.DEFAULT_SAMPLE_DURATION_PRESENT=8]="DEFAULT_SAMPLE_DURATION_PRESENT",e[e.DEFAULT_SAMPLE_SIZE_PRESENT=16]="DEFAULT_SAMPLE_SIZE_PRESENT",e[e.DEFAULT_SAMPLE_FLAGS_PRESENT=32]="DEFAULT_SAMPLE_FLAGS_PRESENT"}(j=e.TrackFragmentFlags||(e.TrackFragmentFlags={}));var B=function(e){function t(t,r,n,o,i,a,s){var u=e.call(this,"tfhd",0,t)||this;return u.trackId=r,u.baseDataOffset=n,u.sampleDescriptionIndex=o,u.defaultSampleDuration=i,u.defaultSampleSize=a,u.defaultSampleFlags=s,u}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+4,n=this.flags;return n&j.BASE_DATA_OFFSET_PRESENT&&(r+=8),n&j.SAMPLE_DESCRIPTION_INDEX_PRESENT&&(r+=4),n&j.DEFAULT_SAMPLE_DURATION_PRESENT&&(r+=4),n&j.DEFAULT_SAMPLE_SIZE_PRESENT&&(r+=4),n&j.DEFAULT_SAMPLE_FLAGS_PRESENT&&(r+=4),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t),o=this.flags;return r(t,this.offset+n,this.trackId),n+=4,o&j.BASE_DATA_OFFSET_PRESENT&&(r(t,this.offset+n,0),r(t,this.offset+n+4,this.baseDataOffset),n+=8),o&j.SAMPLE_DESCRIPTION_INDEX_PRESENT&&(r(t,this.offset+n,this.sampleDescriptionIndex),n+=4),o&j.DEFAULT_SAMPLE_DURATION_PRESENT&&(r(t,this.offset+n,this.defaultSampleDuration),n+=4),o&j.DEFAULT_SAMPLE_SIZE_PRESENT&&(r(t,this.offset+n,this.defaultSampleSize),n+=4),o&j.DEFAULT_SAMPLE_FLAGS_PRESENT&&(r(t,this.offset+n,this.defaultSampleFlags),n+=4),n},t}(g);e.TrackFragmentHeaderBox=B;var q=function(e){function t(t){var r=e.call(this,"tfdt",0,0)||this;return r.baseMediaDecodeTime=t,r}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.baseMediaDecodeTime),n+4},t}(g);e.TrackFragmentBaseMediaDecodeTimeBox=q;var H=function(e){function t(t,r,n){var o=e.call(this,"traf",[t,r,n])||this;return o.header=t,o.decodeTime=r,o.run=n,o}return i(t,e),t}(v);e.TrackFragmentBox=H;var z;!function(e){e[e.IS_LEADING_MASK=201326592]="IS_LEADING_MASK",e[e.SAMPLE_DEPENDS_ON_MASK=50331648]="SAMPLE_DEPENDS_ON_MASK",e[e.SAMPLE_DEPENDS_ON_OTHER=16777216]="SAMPLE_DEPENDS_ON_OTHER",e[e.SAMPLE_DEPENDS_ON_NO_OTHERS=33554432]="SAMPLE_DEPENDS_ON_NO_OTHERS",e[e.SAMPLE_IS_DEPENDED_ON_MASK=12582912]="SAMPLE_IS_DEPENDED_ON_MASK",e[e.SAMPLE_HAS_REDUNDANCY_MASK=3145728]="SAMPLE_HAS_REDUNDANCY_MASK",e[e.SAMPLE_PADDING_VALUE_MASK=917504]="SAMPLE_PADDING_VALUE_MASK",e[e.SAMPLE_IS_NOT_SYNC=65536]="SAMPLE_IS_NOT_SYNC",e[e.SAMPLE_DEGRADATION_PRIORITY_MASK=65535]="SAMPLE_DEGRADATION_PRIORITY_MASK"}(z=e.SampleFlags||(e.SampleFlags={}));var G;!function(e){e[e.DATA_OFFSET_PRESENT=1]="DATA_OFFSET_PRESENT",e[e.FIRST_SAMPLE_FLAGS_PRESENT=4]="FIRST_SAMPLE_FLAGS_PRESENT",e[e.SAMPLE_DURATION_PRESENT=256]="SAMPLE_DURATION_PRESENT",e[e.SAMPLE_SIZE_PRESENT=512]="SAMPLE_SIZE_PRESENT",e[e.SAMPLE_FLAGS_PRESENT=1024]="SAMPLE_FLAGS_PRESENT",e[e.SAMPLE_COMPOSITION_TIME_OFFSET=2048]="SAMPLE_COMPOSITION_TIME_OFFSET"}(G=e.TrackRunFlags||(e.TrackRunFlags={}));var V=function(e){function t(t,r,n,o){var i=e.call(this,"trun",1,t)||this;return i.samples=r,i.dataOffset=n,i.firstSampleFlags=o,i}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+4,n=this.samples.length,o=this.flags;return o&G.DATA_OFFSET_PRESENT&&(r+=4),o&G.FIRST_SAMPLE_FLAGS_PRESENT&&(r+=4),o&G.SAMPLE_DURATION_PRESENT&&(r+=4*n),o&G.SAMPLE_SIZE_PRESENT&&(r+=4*n),o&G.SAMPLE_FLAGS_PRESENT&&(r+=4*n),o&G.SAMPLE_COMPOSITION_TIME_OFFSET&&(r+=4*n),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t),o=this.samples.length,i=this.flags;r(t,this.offset+n,o),n+=4,i&G.DATA_OFFSET_PRESENT&&(r(t,this.offset+n,this.dataOffset),n+=4),i&G.FIRST_SAMPLE_FLAGS_PRESENT&&(r(t,this.offset+n,this.firstSampleFlags),n+=4);for(var a=0;a<o;a++){var s=this.samples[a];i&G.SAMPLE_DURATION_PRESENT&&(r(t,this.offset+n,s.duration),n+=4),i&G.SAMPLE_SIZE_PRESENT&&(r(t,this.offset+n,s.size),n+=4),i&G.SAMPLE_FLAGS_PRESENT&&(r(t,this.offset+n,s.flags),n+=4),i&G.SAMPLE_COMPOSITION_TIME_OFFSET&&(r(t,this.offset+n,s.compositionTimeOffset),n+=4)}return n},t}(g);e.TrackRunBox=V;var W=function(e){function r(r,n){var o=e.call(this,"moof",t([r],n))||this;return o.header=r,o.trafs=n,o}return i(r,e),r}(v);e.MovieFragmentBox=W;var J=function(e){function t(t){var r=e.call(this,"mdat")||this;return r.chunks=t,r}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return this.chunks.forEach(function(e){r+=e.length}),this.size=r},t.prototype.write=function(t){var r=this,n=e.prototype.write.call(this,t);return this.chunks.forEach(function(e){t.set(e,r.offset+n),n+=e.length},this),n},t}(_);e.MediaDataBox=J;var K=function(e){function t(t,r){var n=e.call(this,t)||this;return n.dataReferenceIndex=r,n}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+8,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,0),r(t,this.offset+n+4,this.dataReferenceIndex),n+8},t}(_);e.SampleEntry=K;var Q=function(e){function t(t,r,n,o,i,a){void 0===n&&(n=2),void 0===o&&(o=16),void 0===i&&(i=44100),void 0===a&&(a=null);var s=e.call(this,t,r)||this;return s.channelCount=n,s.sampleSize=o,s.sampleRate=i,s.otherBoxes=a,
23866
+ s}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+20;return this.otherBoxes&&this.otherBoxes.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,0),r(t,this.offset+n+4,0),r(t,this.offset+n+8,this.channelCount<<16|this.sampleSize),r(t,this.offset+n+12,0),r(t,this.offset+n+16,this.sampleRate<<16),n+=20,this.otherBoxes&&this.otherBoxes.forEach(function(e){n+=e.write(t)}),n},t}(K);e.AudioSampleEntry=Q,e.COLOR_NO_ALPHA_VIDEO_SAMPLE_DEPTH=24;var Y=function(t){function n(r,n,o,i,a,s,u,l,c,d){void 0===a&&(a=""),void 0===s&&(s=72),void 0===u&&(u=72),void 0===l&&(l=1),void 0===c&&(c=e.COLOR_NO_ALPHA_VIDEO_SAMPLE_DEPTH),void 0===d&&(d=null);var p=t.call(this,r,n)||this;if(p.width=o,p.height=i,p.compressorName=a,p.horizResolution=s,p.vertResolution=u,p.frameCount=l,p.depth=c,p.otherBoxes=d,a.length>31)throw new Error("invalid compressor name");return p}return i(n,t),n.prototype.layout=function(e){var r=t.prototype.layout.call(this,e)+16+12+4+2+32+2+2;return this.otherBoxes&&this.otherBoxes.forEach(function(t){r+=t.layout(e+r)}),this.size=r},n.prototype.write=function(e){var n=t.prototype.write.call(this,e);r(e,this.offset+n,0),r(e,this.offset+n+4,0),r(e,this.offset+n+8,0),r(e,this.offset+n+12,0),n+=16,r(e,this.offset+n,this.width<<16|this.height),r(e,this.offset+n+4,s(this.horizResolution)),r(e,this.offset+n+8,s(this.vertResolution)),n+=12,r(e,this.offset+n,0),r(e,this.offset+n+4,this.frameCount<<16),n+=6,e[this.offset+n]=this.compressorName.length;for(var o=0;o<31;o++)e[this.offset+n+o+1]=o<this.compressorName.length?127&this.compressorName.charCodeAt(o):0;return n+=32,r(e,this.offset+n,this.depth<<16|65535),n+=4,this.otherBoxes&&this.otherBoxes.forEach(function(t){n+=t.write(e)}),n},n}(K);e.VideoSampleEntry=Y;var X=function(e){function t(t,r){var n=e.call(this,t)||this;return n.data=r,n}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+this.data.length,this.size},t.prototype.write=function(t){var r=e.prototype.write.call(this,t);return t.set(this.data,this.offset+r),r+this.data.length},t}(_);e.RawTag=X}(t=e.Iso||(e.Iso={}))}(t=e.MP4||(e.MP4={}))}(n||(n={})),t.MP4Mux=n.MP4.MP4Mux},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(5);t.MP3ToMP3={getInputFormat:function(){return{mimeType:"audio/mpeg"}},getOutputFormat:function(){return{mimeType:"audio/mpeg"}},transmux:function(e){var t=new n.helpers.abortableJob.AbortableJob(function(){function t(){d.close()}function r(r){c=!0;try{t()}catch(e){}i.reject(r),e.abort()}var i=n.helpers.deferred.buildDeferred(),a=new n.eventDispatcher.EventDispatcher,s=[],u=[],l=!1,c=!1,d=new o.MP3Parser;return d.onFrame=function(e){if(!c)try{u.push(e)}catch(e){r(e)}},e.onProgressUpdate(function(e){var t=e.data;!l&&e.initData&&(t=n.helpers.arrayBuffer.combine([e.initData,e.data])),l=!0;try{if(d.push(t),u.length){var o=n.helpers.arrayBuffer.combine(u);s.push(o),u.splice(0),a.dispatch({data:o})}}catch(e){r(e)}}),e.onCompletion(function(e){try{t(),i.resolve(e)}catch(e){r(e)}}),e.onError(r),{result:i.promise,progressUpdates:{onProgressUpdate:a,getProgressSoFar:function(){return s.length?{data:n.helpers.arrayBuffer.combine(s)}:null}},abort:function(){c=!0,e.abort(),t()}}});return t.run()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6),o=r(22),i=r(4),a=r(20),s=r(18),u=[o.MP3ToMP3,s.MP4ToMP4,n.PassThrough,i.MP3ToMP4,a.OggOpusToWebm];t.default=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(23);t.TransmuxerFactory={retrieveTransmuxers:function(e,t){return o.default.filter(function(r){var o=r.getInputFormat(),i=r.getOutputFormat();return(!e||n.isPartialMatch(o,e))&&(!t||n.isPartialMatch(i,t))})},retrieveTransmuxer:function(e,r){return t.TransmuxerFactory.retrieveTransmuxers(e,r)[0]||null}}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){var t=e.byteLength,r=new DataView(e),n=t&&r.getUint8(t-1);if(n){for(var o=t-n,i=new Uint8Array(o),a=0;a<o;a++)i[a]=r.getUint8(a);return i.buffer}return e}t.__esModule=!0,t.removePadding=o;var i=t.AESDecryptor=function(){function e(){n(this,e),this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.initTable()}return e.prototype.uint8ArrayToUint32Array_=function(e){for(var t=new DataView(e),r=new Uint32Array(4),n=0;n<4;n++)r[n]=t.getUint32(4*n);return r},e.prototype.initTable=function(){var e=this.sBox,t=this.invSBox,r=this.subMix,n=r[0],o=r[1],i=r[2],a=r[3],s=this.invSubMix,u=s[0],l=s[1],c=s[2],d=s[3],p=new Uint32Array(256),f=0,h=0,_=0;for(_=0;_<256;_++)_<128?p[_]=_<<1:p[_]=_<<1^283;for(_=0;_<256;_++){var g=h^h<<1^h<<2^h<<3^h<<4;g=g>>>8^255&g^99,e[f]=g,t[g]=f;var y=p[f],v=p[y],m=p[v],E=257*p[g]^16843008*g;n[f]=E<<24|E>>>8,o[f]=E<<16|E>>>16,i[f]=E<<8|E>>>24,a[f]=E,E=16843009*m^65537*v^257*y^16843008*f,u[g]=E<<24|E>>>8,l[g]=E<<16|E>>>16,c[g]=E<<8|E>>>24,d[g]=E,f?(f=y^p[p[p[m^y]]],h^=p[p[h]]):f=h=1}},e.prototype.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,n=0;n<t.length&&r;)r=t[n]===this.key[n],n++;if(!r){this.key=t;var o=this.keySize=t.length;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size="+o);var i=this.ksRows=4*(o+6+1),a=void 0,s=void 0,u=this.keySchedule=new Uint32Array(i),l=this.invKeySchedule=new Uint32Array(i),c=this.sBox,d=this.rcon,p=this.invSubMix,f=p[0],h=p[1],_=p[2],g=p[3],y=void 0,v=void 0;for(a=0;a<i;a++)a<o?y=u[a]=t[a]:(v=y,a%o===0?(v=v<<8|v>>>24,v=c[v>>>24]<<24|c[v>>>16&255]<<16|c[v>>>8&255]<<8|c[255&v],v^=d[a/o|0]<<24):o>6&&a%o===4&&(v=c[v>>>24]<<24|c[v>>>16&255]<<16|c[v>>>8&255]<<8|c[255&v]),u[a]=y=(u[a-o]^v)>>>0);for(s=0;s<i;s++)a=i-s,v=3&s?u[a]:u[a-4],s<4||a<=4?l[s]=v:l[s]=f[c[v>>>24]]^h[c[v>>>16&255]]^_[c[v>>>8&255]]^g[c[255&v]],l[s]=l[s]>>>0}},e.prototype.networkToHostOrderSwap=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},e.prototype.decrypt=function(e,t,r,n){for(var i=this.keySize+6,a=this.invKeySchedule,s=this.invSBox,u=this.invSubMix,l=u[0],c=u[1],d=u[2],p=u[3],f=this.uint8ArrayToUint32Array_(r),h=f[0],_=f[1],g=f[2],y=f[3],v=new Int32Array(e),m=new Int32Array(v.length),E=void 0,b=void 0,w=void 0,P=void 0,S=void 0,R=void 0,A=void 0,O=void 0,T=void 0,x=void 0,M=void 0,D=void 0,k=void 0,I=void 0,C=this.networkToHostOrderSwap;t<v.length;){for(T=C(v[t]),x=C(v[t+1]),M=C(v[t+2]),D=C(v[t+3]),S=T^a[0],R=D^a[1],A=M^a[2],O=x^a[3],k=4,I=1;I<i;I++)E=l[S>>>24]^c[R>>16&255]^d[A>>8&255]^p[255&O]^a[k],b=l[R>>>24]^c[A>>16&255]^d[O>>8&255]^p[255&S]^a[k+1],w=l[A>>>24]^c[O>>16&255]^d[S>>8&255]^p[255&R]^a[k+2],P=l[O>>>24]^c[S>>16&255]^d[R>>8&255]^p[255&A]^a[k+3],S=E,R=b,A=w,O=P,k+=4;E=s[S>>>24]<<24^s[R>>16&255]<<16^s[A>>8&255]<<8^s[255&O]^a[k],b=s[R>>>24]<<24^s[A>>16&255]<<16^s[O>>8&255]<<8^s[255&S]^a[k+1],w=s[A>>>24]<<24^s[O>>16&255]<<16^s[S>>8&255]<<8^s[255&R]^a[k+2],P=s[O>>>24]<<24^s[S>>16&255]<<16^s[R>>8&255]<<8^s[255&A]^a[k+3],k+=3,m[t]=C(E^h),m[t+1]=C(P^_),m[t+2]=C(w^g),m[t+3]=C(b^y),h=T,_=x,g=M,y=D,t+=4}return n?o(m.buffer):m.buffer},e.prototype.destroy=function(){this.key=void 0,this.keySize=void 0,this.ksRows=void 0,this.sBox=void 0,this.invSBox=void 0,this.subMix=void 0,this.invSubMix=void 0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.rcon=void 0},e}();t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(25),i=null,a=16;t.JSCrypto={canDecrypt:function(e){return"AES-CBC"===e.cipher},decrypt:function(e,t){i||(i=new o.AESDecryptor);var r=i,s=new n.helpers.abortableJob.AbortableJob(function(){var i,s=new n.eventDispatcher.EventDispatcher,u=n.helpers.deferred.buildDeferred(),l=[],c=null,d=[],p=0,f=new Uint8Array(t.iv),h=!1;r.expandKey(t.key.buffer);var _=function(e){var t=c;c=new Uint8Array(r.decrypt(e.buffer,0,f.buffer,!1));var n=e.byteLength-a;if(n<0)throw new Error("lastBlockOffset invalid.");for(var o=0;o<a;o++)f[o]=e[n+o];t&&(l.push(t),s.dispatch(t))};return e.onProgressUpdate(function(e){h||(n.helpers.arrayBuffer.forEach(e,function(e){h||(p||(i=new Uint8Array(a)),i[p++]=e,p===a&&(d.push(i),p=0))}),d.length&&(_(n.helpers.arrayBuffer.combine(d)),d=[]))}),e.onCompletion(function(e){if(!h)if(p)u.reject(new Error("Reached end part way through block."));else{if(c){var t=new Uint8Array(o.removePadding(c.buffer));l.push(t),s.dispatch(t)}u.resolve(e)}}),e.onError(u.reject),{result:u.promise,abort:function(){h=!0,e.abort()},progressUpdates:{onProgressUpdate:s,getProgressSoFar:function(){return n.helpers.arrayBuffer.combine(l)}}}});return s.run()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(26),o=[n.JSCrypto];t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(27),i=n.helpers.find;t.DecryptorFactory={retrieveDecryptor:function(e){return i(o.default,function(t){return t.canDecrypt(e)})||null}}},function(e,t,r){"use strict";function n(e){var t=e.encryptionConfig,r=e.downloadAbortableJob,n=e.logger;return new o.helpers.abortableJob.AbortableJob(function(){var e=new o.eventDispatcher.EventDispatcher,s=o.helpers.deferred.buildDeferred(),u=null;if(t&&(n.info("Finding a decryptor..."),u=i.DecryptorFactory.retrieveDecryptor(t),!u))return n.error("Could not find a decryptor."),s.reject(new a.NoDecryptorError),{result:s.promise,progressUpdates:{onProgressUpdate:e,getProgressSoFar:function(){return null}}};var l=r.run(),c=null,d=[];return t&&u?(c=u.decrypt(l,t),c.onProgressUpdate(function(t){d.push(t),e.dispatch(t)}),c.onError(function(e){e!==o.helpers.abortableJob.abortedError&&n.error("Error occurred during decryption.",e),s.reject(e),l.abort()})):l.onProgressUpdate(function(t){d.push(t),e.dispatch(t)}),l.onCompletion(function(){var e=function(){return s.resolve(void 0)};c?c.whenComplete().then(function(){return e()}):e()}),l.onError(s.reject),{result:s.promise,progressUpdates:{onProgressUpdate:e,getProgressSoFar:function(){return d.length?o.helpers.arrayBuffer.combine(d):null}},abort:function(){l.abort(),c&&c.abort()}}})}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(28),a=r(7);t.getSegmentDownloadAndDecryptJob=n},function(e,t,r){"use strict";function n(e){var t=e.delayCalculator,r=e.segmentEventRepresentation,n=e.url,a=e.loader,s=e.onSegmentRequestQueued,u=e.onSegmentRequestStart,l=e.onSegmentRequestFailed,c=e.onSegmentRetrieved,d=e.isResponseCodeAcceptable,p=e.isResponseCodeRetryable,f=e.logger;return new o.helpers.abortableJob.AbortableJob(function(){var e=o.helpers.deferred.buildDeferred(),h=new o.eventDispatcher.EventDispatcher,_=[],g=0,y=o.helpers.retry.retry(t,function(t){var y=t.scheduleRetry,v=!1,m=0;s.dispatch({segment:r}),f.debug("Requesting segment.",n);var E=a.request({url:n});E.onRequestStart(function(){return u.dispatch({segment:r})});var b=function(e){var t=e.byteLength;if(t)if(m+=t,m<=g)f.debug("Already downloaded this part. Skipping...",m,g);else{var r=t-(m-g),n=new Uint8Array(e,r);g=m,_.push(n),h.dispatch(n)}};return E.onProgress(function(t){var o=t.initial,a=t.statusCode,s=t.part;if(o)if(d(a))f.debug("Segment response started.",n,a),b(s);else{var u=null;p(a)?f.debug("Segment response code was not acceptable. Will retry.",n,a):(f.debug("Segment response code was not acceptable.",n,a),u=new i.UnacceptableResponseStatusCodeError(a)),E.abort(),l.dispatch({segment:r,statusCode:a}),u?e.reject(u):(v=!0,y())}else f.debug("Got segment response part.",n,a),b(s)}),E.onResponseReceived(function(t){v||(t?(c.dispatch({segment:r,statusCode:t.statusCode}),e.resolve(void 0)):(f.warn("Segment request timed out.",n),l.dispatch({segment:r,statusCode:null}),y()))}),E.onError(function(t){v||t!==o.helpers.abortableJob.abortedError&&(t instanceof o.loaderErrors.LoaderError?(f.warn("Error from loader. Will retry",n,t),y()):(f.error("Unexpected error when requesting segment.",t),e.reject(t)))}),{onCancel:function(){f.debug("Aborting segment request.",n),E.hasCompleted()||E.abort(),l.dispatch({segment:r,aborted:!0})}}},{onNoMoreRetries:function(){return e.reject(new Error("No more retries for requesting segment."))}}).cancel;return{result:e.promise,progressUpdates:{onProgressUpdate:h,getProgressSoFar:function(){return _.length?o.helpers.arrayBuffer.combine(_):null}},abort:function(){return y()}}})}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(8);t.getSegmentDownloadJob=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.DefaultSegmentParser={getFormat:function(){return{}},parseSegmentData:function(e){return n.helpers.abortableJob.map(function(){return e},{convertProgressUpdate:function(e){return{data:e}},convertResult:function(e){return e}}).run()}}},function(e,t,r){"use strict";function n(e){var t=i.retrievePages(e).pages;if(t.length){var r=i.retrievePackets([t[0]])[0];if(r&&r.first){var n=1,o=t.slice(1).some(function(e,t){var r=!!(1&e.header.type[0]);return t>0&&!r||(n=t+2,!1)}),a=s(t.slice(0,n).map(function(e){return e.entirePage}));return{state:"PRESENT",initData:a,initDataEnded:o}}return{state:"NOT_PRESENT"}}return null}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(3),a=o.helpers.abortableJob.AbortableJob,s=o.helpers.arrayBuffer.combine,u=new o.helpers.SCWeakMap;t.OggOpusSegmentParser={getFormat:function(){return{mimeType:"audio/ogg",audioCodec:{id:"opus"}}},parseSegmentData:function(e,r,i){var l=new a(function(){var a=o.helpers.deferred.buildDeferred(),l=new o.eventDispatcher.EventDispatcher,c=[],d=null,p=null,f=null,h=function(t){a.reject(t),e.abort()},_=function(e){u.set(i,e),l.dispatch({initData:e,data:s(c)})};return e.onProgressUpdate(function(e){if(d&&"PRESENT"===d.state&&d.initDataEnded)c.push(e),l.dispatch({initData:d.initData,data:e});else if(d&&"NOT_PRESENT"===d.state)c.push(e);else{c.push(e);var a=s(c);if(d=n(a))if("NOT_PRESENT"===d.state){var g=u.get(i);r.getSequenceNumber()<=i.getFirstSegmentIndex()?h(new Error("Could not find init data.")):g?(d={state:"PRESENT",initData:g,initDataEnded:!0},_(d.initData)):(p=i.getSegment(i.getFirstSegmentIndex()),p.onCompletion(function(e){var r=f=t.OggOpusSegmentParser.parseSegmentData(o.helpers.abortableJob.map(function(){return e.retrieveData()},{convertProgressUpdate:function(e){return e.initData?o.helpers.arrayBuffer.combine([e.initData,e.data]):e.data},convertResult:function(e){return e}}).run(),e,i);r.onProgressUpdate(function(e){var t=e.initData;if(r.abort(),!t){var n=new Error("OggOpusSegmentParser should always provide init data.");throw h(n),n}d={state:"PRESENT",initData:t,initDataEnded:!0},_(t)}),r.onError(function(e){e!==o.helpers.abortableJob.abortedError&&h(e)})}),p.onError(h))}else if("PRESENT"===d.state&&d.initDataEnded){if(c.splice(0),a.byteLength>d.initData.byteLength){var y=new Uint8Array(a.buffer.slice(d.initData.byteLength));c.push(y)}_(d.initData)}}}),e.onCompletion(function(e){d&&"PRESENT"===d.state&&!d.initDataEnded?(_(d.initData),a.resolve(e)):d&&"PRESENT"===d.state?a.resolve(e):a.reject(new Error("Could not find init data."))}),e.onError(h),{result:a.promise,progressUpdates:{onProgressUpdate:l,getProgressSoFar:function(){return d&&"PRESENT"===d.state&&d.initDataEnded?{initData:d.initData,data:s(c)}:null}},abort:function(){e.abort(),p&&p.abort(),f&&f.abort()}}});return l.run()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(32),o=r(31),i=[n.OggOpusSegmentParser,o.DefaultSegmentParser];t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(2),i=r(33),a=n.helpers.find;t.SegmentParserFactory={retrieveSegmentParser:function(e){var t=a(i.default,function(t){return o.isPartialMatch(t.getFormat(),e)});if(!t)throw new Error("No segment parser found.");return t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(9),i=r(34),a=r(30),s=r(29),u=n.helpers.abortableJob.AbortableJob,l=n.eventDispatcher.EventDispatcher,c=n.logger.noOpLogger,d=function(){function e(e){var t=e.url,r=e.sequenceNumber,d=e.playlist,p=e.timeRange,f=e.encryptionConfig,h=e.initData,_=e.format,g=e.loader,y=e.playlistEventRepresentation,v=e.logger,m=void 0===v?c:v,E=e.delayCalculator,b=void 0===E?n.helpers.retry.buildExponentialDelayCalculator():E,w=e.isResponseCodeAcceptable,P=void 0===w?function(e){return 200===e}:w,S=e.isResponseCodeRetryable,R=void 0===S?function(e){return!(e>=400&&e<500)}:S,A=this;this._onSegmentRequestQueued=new l,this._onSegmentRequestStart=new l,this._onSegmentRetrieved=new l,this._onSegmentRequestFailed=new l,this.onSegmentRequestQueued=this._onSegmentRequestQueued.getHandle(),this.onSegmentRequestStart=this._onSegmentRequestStart.getHandle(),this.onSegmentRetrieved=this._onSegmentRetrieved.getHandle(),this.onSegmentRequestFailed=this._onSegmentRequestFailed.getHandle(),this._sequenceNumber=r,this._playlist=d,this._timeRange=p,this._format=_;var O=this._segmentEventRepresentation=new o.Segment(y,t,r),T=a.getSegmentDownloadJob({delayCalculator:b,segmentEventRepresentation:O,url:t,loader:g,onSegmentRequestQueued:this._onSegmentRequestQueued,onSegmentRequestStart:this._onSegmentRequestStart,onSegmentRequestFailed:this._onSegmentRequestFailed,onSegmentRetrieved:this._onSegmentRetrieved,isResponseCodeAcceptable:P,isResponseCodeRetryable:R,logger:m}),x=s.getSegmentDownloadAndDecryptJob({encryptionConfig:f,downloadAbortableJob:T,logger:m});this._retrieveAbortableJob=new u(function(){var e=i.SegmentParserFactory.retrieveSegmentParser(A._format),t=new l,r=n.helpers.deferred.buildDeferred(),o=e.parseSegmentData(n.helpers.abortableJob.map(function(){return x.run()},{convertProgressUpdate:function(e,t){return t&&h?n.helpers.arrayBuffer.combine([h,e]):e},convertResult:function(e){return e}}).run(),A,A._playlist);return o.onProgressUpdate(t.dispatch,{skipPast:!0}),o.onCompletion(function(){return r.resolve(void 0)}),o.onError(r.reject),{result:r.promise,progressUpdates:{onProgressUpdate:t,getProgressSoFar:o.getProgressSoFar},abort:o.abort}})}return e.prototype.getFormat=function(){return this._format},e.prototype.getSequenceNumber=function(){return this._sequenceNumber},e.prototype.isFinalSegment=function(){var e=this._playlist;return e.hasEnded()&&e.getFirstSegmentIndex()+e.getSegmentCount()-1===this._sequenceNumber},e.prototype.getTimeRange=function(){return this._timeRange},e.prototype.getEventRepresentation=function(){return this._segmentEventRepresentation},e.prototype.retrieveData=function(){var e=this,t=new u(function(){var t=n.helpers.deferred.buildDeferred(),r=new l,o=[],i=e._retrieveAbortableJob.run(),a=void 0;return i.onProgressUpdate(function(e){var t=e.data,n=e.initData;o.length||(a=n),o.push(t),r.dispatch({data:t,initData:a})}),i.onCompletion(function(){t.resolve(void 0)}),i.onError(t.reject),{result:t.promise,progressUpdates:{onProgressUpdate:r,getProgressSoFar:function(){return o.length?{initData:a,data:n.helpers.arrayBuffer.combine(o)}:null}},abort:function(){return i.abort()}}});return t.run()},e}();t.Segment=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(0),i=o.eventDispatcher.EventDispatcher;!function(e){e[e.LIVE=0]="LIVE",e[e.EVENT=1]="EVENT",e[e.VOD=2]="VOD"}(n=t.PlaylistType||(t.PlaylistType={}));var a=function(){function e(){this._onPlaylistRequestQueued=new i,this._onPlaylistRequestStart=new i,this._onPlaylistRetrieved=new i,this._onPlaylistRequestFailed=new i,this._onPlaylistParseStart=new i,this._onPlaylistParseEnd=new i,this._onKeyRequestQueued=new i,this._onKeyRequestStart=new i,this._onKeyRetrieved=new i,this._onKeyRequestFailed=new i,this._onInitDataRequestQueued=new i,this._onInitDataRequestStart=new i,this._onInitDataRetrieved=new i,this._onInitDataRequestFailed=new i,this._onUpdated=new i,this.onPlaylistRequestQueued=this._onPlaylistRequestQueued.getHandle(),this.onPlaylistRequestStart=this._onPlaylistRequestStart.getHandle(),this.onPlaylistRetrieved=this._onPlaylistRetrieved.getHandle(),this.onPlaylistRequestFailed=this._onPlaylistRequestFailed.getHandle(),this.onPlaylistParseStart=this._onPlaylistParseStart.getHandle(),this.onPlaylistParseEnd=this._onPlaylistParseEnd.getHandle(),this.onKeyRequestQueued=this._onKeyRequestQueued.getHandle(),this.onKeyRequestStart=this._onKeyRequestStart.getHandle(),this.onKeyRetrieved=this._onKeyRetrieved.getHandle(),this.onKeyRequestFailed=this._onKeyRequestFailed.getHandle(),this.onInitDataRequestQueued=this._onInitDataRequestQueued.getHandle(),this.onInitDataRequestStart=this._onInitDataRequestStart.getHandle(),this.onInitDataRetrieved=this._onInitDataRetrieved.getHandle(),this.onInitDataRequestFailed=this._onInitDataRequestFailed.getHandle(),this.onUpdated=this._onUpdated.getHandle()}return e.prototype.update=function(){var e=this,t=this._update();return t.onCompletion(function(){return e._onUpdated.dispatch(void 0)}),t},e.prototype.getSegment=function(e){return this.getSegments(e,e+1)[0]},e.prototype.getSegments=function(e,t){var r=this.getSegmentCount(),n=this.getFirstSegmentIndex();if(void 0===t&&(t=n+r),void 0===e&&(e=n),e<n||t<e||t>n+r)throw new Error("Invalid range of segments.");for(var o=[],i=e;i<t;i++)o.push(this._getSegment(i));return o},e}();t.Playlist=a},function(e,t,r){"use strict";function n(e,t,r){var n=e.getTimeRange();return r!==t&&(r>t?n.end>t&&n.start<r:n.end>t||n.start<r)}Object.defineProperty(t,"__esModule",{value:!0});var o,i=r(0),a=r(3),s=r(10),u=r(2),l=i.helpers.find,c=i.eventDispatcher.EventDispatcher,d=i.helpers.abortableJob.abortedError,p=i.logger.prefixLogger,f=i.logger.noOpLogger;!function(e){e[e.RETRIEVING_SEGMENT=0]="RETRIEVING_SEGMENT",e[e.RETRIEVED_SEGMENT=1]="RETRIEVED_SEGMENT",e[e.RETRIEVING_DATA=2]="RETRIEVING_DATA",e[e.COMPLETE=3]="COMPLETE"}(o||(o={}));var h=function(){function e(e){this._onSegmentRequestQueued=new c,this._onSegmentRequestStart=new c,this._onSegmentRetrieved=new c,this._onSegmentRequestFailed=new c,this._onSegmentDataRetrieveStarted=new c,this._onSegmentReady=new c,this._onError=new c,this._segments=[],this._retrievingSegment=null,this._timerId=null,this._dead=!1;var t=e.playlist,r=e.getPosition,n=e.maxBufferLength,o=e.cacheSize,i=e.transmuxer,a=e.logger,s=void 0===a?f:a;if(this._logger=p(s,"PlaylistSegmentRetriever"),t&&!t.hasInitialUpdateCompleted())throw new Error("Playlist retrieve has not completed.");if(n<0)throw new Error("Max buffer length must be > 0.");if(o<0)throw new Error("Cache size must be > 0.");this.onSegmentRequestQueued=this._onSegmentRequestQueued.getHandle(),this.onSegmentRequestStart=this._onSegmentRequestStart.getHandle(),this.onSegmentRetrieved=this._onSegmentRetrieved.getHandle(),this.onSegmentRequestFailed=this._onSegmentRequestFailed.getHandle(),this.onSegmentDataRetrieveStarted=this._onSegmentDataRetrieveStarted.getHandle(),this.onSegmentReady=this._onSegmentReady.getHandle(),this.onError=this._onError.getHandle(),this._playlist=t,this._transmuxer=i,this._getPosition=r,this._maxBufferLength=n,this._cacheSize=o,this.update()}return e.prototype.updateMaxBufferLength=function(e){if(this._ensureNotDead(),e<0)throw new Error("Max buffer length must be > 0.");this._logger.debug("updateMaxBufferLength() called.",e),this._maxBufferLength=e,this.update()},e.prototype.updateCacheSize=function(e){if(this._ensureNotDead(),e<0)throw new Error("Cache size must be > 0.");this._cacheSize=e,this.update()},e.prototype.getCacheSize=function(){return this._cacheSize},e.prototype.getCacheUsage=function(){return this._segments.reduce(function(e,t){return t.state===o.RETRIEVING_DATA||t.state===o.COMPLETE?e+t.size:e},0)},e.prototype.switchPlaylist=function(e){if(this._ensureNotDead(),e&&!e.hasInitialUpdateCompleted())throw new Error("Playlist retrieve has not completed.");this._logger.debug("switchPlaylist() called."),this._abortCurrentRetrieve(),this._playlist=e,this._segments=this._segments.filter(function(e){return e.state===o.COMPLETE}),this.update()},e.prototype.getSegmentsWithData=function(){return this._ensureNotDead(),this._segments.filter(function(e){return e.state===o.RETRIEVING_DATA&&e.size||e.state===o.COMPLETE}).map(function(e){var t=e.segment,r=e.dataRetrieveJob;return{segment:t,dataRetrieveJob:r,complete:e.state===o.COMPLETE}})},e.prototype.update=function(){var e=this;this._ensureNotDead(),this._timerId&&(window.clearTimeout(this._timerId),this._timerId=null);var t=this._getPosition(),r=t,n=0;this._segments.some(function(e){if(e.state!==o.COMPLETE)return!1;var i=e.segment.getTimeRange();return i.containsTime(n)&&(n=i.end),!(i.end<t)&&(i.start>r||(r=i.end,!1))});var i=t+this._maxBufferLength,a=function(){var t=e._playlist;if(t){var o=t.hasEnded()&&r===t.getDuration();if(o)return r=n,t.getDuration()+n<i}return r<i}();if(!a)return this._abortCurrentRetrieve(),this._garbageCollect(t),void this._scheduleNextUpdate();var s=l(this._segments,function(e){if(e.state===o.RETRIEVED_SEGMENT||e.state===o.RETRIEVING_DATA){var t=e.segment.getTimeRange();return t.containsTime(r)}return!1});s?this._retrieveSegmentData(s):this._retrieveSegment(r),this._garbageCollect(t)},e.prototype.kill=function(){this._dead||(this._logger.debug("kill() called."),this._abortCurrentRetrieve(),this._dead=!0,this._timerId&&(this._logger.debug("Cancelling update timer."),window.clearTimeout(this._timerId)),this._segments=[],this._logger.debug("Killed."))},e.prototype._retrieveSegmentData=function(e){var t=this;if(e.state!==o.RETRIEVED_SEGMENT&&e.state!==o.RETRIEVING_DATA)throw new Error("Segment in incorrect state for data to be retrieved.");if(!this._retrievingSegment||this._retrievingSegment.state!==o.RETRIEVING_DATA||e.segment!==this._retrievingSegment.segment){this._abortCurrentRetrieve();var r=i.helpers.abortableJob.map(function(){return t._transmuxer.transmux(e.segment.retrieveData())},{convertResult:function(e){return e},convertProgressUpdate:function(e){return e},abortableJobOpts:{storeResult:!0}}),n=r.run(),u=!1,l=this._retrievingSegment={state:o.RETRIEVING_DATA,dataRetrieveJob:r,dataRetrieveJobHandle:n,segment:e.segment,size:0};this._switchSegment(e,l),n.onProgressUpdate(function(n){var o=l.size,i=o;!u&&n.initData&&(o+=n.initData.byteLength),u=!0,o+=n.data.byteLength,l.size=o,0===i&&o>0&&t._onSegmentDataRetrieveStarted.dispatch({segment:e.segment,dataRetrieveJob:r,complete:!1})}),n.onCompletion(function(){if(t._retrievingSegment=null,l.state!==o.RETRIEVING_DATA)throw new Error("Incorrect retrieval state.");t._switchSegment(l,{state:o.COMPLETE,dataRetrieveJob:l.dataRetrieveJob,dataRetrieveJobHandle:l.dataRetrieveJobHandle,segment:e.segment,size:l.size}),t._logger.debug("Segment retrieve completed.",e.segment.getEventRepresentation()),t.update(),t._onSegmentReady.dispatch({segment:e.segment,complete:!0,dataRetrieveJob:l.dataRetrieveJob})}),n.onError(function(r){r!==d&&(t._logger.error("Error retrieving segment data.",r,e.segment.getEventRepresentation()),t._scheduleNextUpdate(),r instanceof a.OggParserError&&(r=r instanceof a.ChecksumFailedError?new s.OggParserError("CHECKSUM_FAILED"):r instanceof a.NoSegmentsInPageError?new s.OggParserError("NO_SEGMENTS_IN_PAGE"):r instanceof a.PageFromDifferentBitstreamError?new s.OggParserError("PAGE_FROM_DIFFERENT_BITSTREAM"):r instanceof a.PageSequenceNumberDidNotIncrementError?new s.OggParserError("SEQUENCE_NUMBER_DID_NOT_INCREMENT"):r instanceof a.UnexpectedBOSError?new s.OggParserError("UNEXPECTED_BOS"):r instanceof a.UnexpectedEOSError?new s.OggParserError("UNEXPECTED_EOS"):new s.OggParserError("UNKNOWN")),t._onError.dispatch(r))})}},e.prototype._retrieveSegment=function(e){var t=this,r=this._retrievingSegment,n=this._playlist,i=n?n.getSegmentIndexContainingTime(e):null;if(!r||r.state!==o.RETRIEVING_SEGMENT||r.segmentIndex!==i)if(this._abortCurrentRetrieve(),n)if(null===i)this._scheduleNextUpdate();else{var a=n.getSegment(i);this._logger.debug("Retrieving segment.",i),a.onCompletion(function(e){if(t._logger.debug("Retrieved segment.",i),!u.isPartialMatch(t._transmuxer.getInputFormat(),e.getFormat())){var r=new Error("Segment format is not supported by transmuxer.");return t._logger.error("Segment incorrect format.",r),t._scheduleNextUpdate(),void t._onError.dispatch(r)}e.onSegmentRequestQueued.subscribe(t._onSegmentRequestQueued.dispatch),e.onSegmentRequestStart.subscribe(t._onSegmentRequestStart.dispatch),e.onSegmentRetrieved.subscribe(t._onSegmentRetrieved.dispatch),e.onSegmentRequestFailed.subscribe(t._onSegmentRequestFailed.dispatch),t._segments.splice(t._segments.indexOf(s),1);var n=e.getTimeRange(),a=t._segments.length;t._segments.some(function(e,t){return e.state!==o.RETRIEVING_SEGMENT&&e.segment.getTimeRange().start>n.start&&(a=t,!0)}),t._segments.splice(a,0,{state:o.RETRIEVED_SEGMENT,segment:e}),t._retrievingSegment=null,t.update()}),a.onError(function(e){e!==d&&(t._logger.error("Error retrieving segment.",e),t._scheduleNextUpdate(),t._onError.dispatch(e))});var s={state:o.RETRIEVING_SEGMENT,segmentIndex:i,segmentRetrieveJob:a};this._segments.push(s),this._retrievingSegment=s}else this._logger.debug("Cannot retrieve segment as there is no playlist."),this._scheduleNextUpdate()},e.prototype._abortCurrentRetrieve=function(){var e=this._retrievingSegment;e&&(e.state===o.RETRIEVING_SEGMENT?(this._logger.debug("Aborting segment retrieve job."),e.segmentRetrieveJob.abort()):e.state===o.RETRIEVING_DATA&&(this._logger.debug("Aborting segment data retrieve job."),e.dataRetrieveJobHandle.abort(),this._switchSegment(e,{state:o.RETRIEVED_SEGMENT,segment:e.segment})),this._retrievingSegment=null)},e.prototype._switchSegment=function(e,t){var r=this._segments.indexOf(e);if(r===-1)throw new Error("Old segment missing.");this._segments.splice(r,1,t)},e.prototype._garbageCollect=function(e){var t=this._segments,r=this._cacheSize,i=this.getCacheUsage();if(!(i<=r)){var a=this._playlist,s=a&&a.getCompleteDuration(),u=null!==s?s:1/0,l=e+this._maxBufferLength;l>u&&(l-=u,l>=e)||t.filter(function(t){return t.state===o.COMPLETE&&!n(t.segment,e,l)}).map(function(t){var r=t.segment.getTimeRange(),n=r.start,o=Math.min(Math.abs(e-n),n+u-e);return{segment:t,distance:o,size:t.size}}).sort(function(e,t){return t.distance-e.distance}).some(function(e){return i<=r||(t.splice(t.indexOf(e.segment),1),i-=e.size,!1)})}},e.prototype._scheduleNextUpdate=function(){var e=this;this._timerId||(this._timerId=window.setTimeout(function(){e._timerId=null,e.update()},1e3))},e.prototype._ensureNotDead=function(){if(this._dead)throw new Error("Playlist segment retriever has been killed.")},e}();t.PlaylistSegmentRetriever=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(37);t.PlaylistSegmentRetriever=n.PlaylistSegmentRetriever;var o=r(36);t.Playlist=o.Playlist,t.PlaylistType=o.PlaylistType;var i=r(35);t.Segment=i.Segment;var a=r(24);t.TransmuxerFactory=a.TransmuxerFactory;var s=r(4);t.MP3ToMP4Transmuxer=s.MP3ToMP4;var u=r(6);t.PassThroughTransmuxer=u.PassThrough;var l=r(17);t.retrievalErrors=l.retrievalErrors;var c=r(14);t.events=c.events}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=11)}([function(e,t,r){"use strict";
23867
+ Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this._msg=e}return e.prototype.getMsg=function(){return this._msg},e}();t.OggParserError=n},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.IncompletePageError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.NoSegmentsInPageError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.UnexpectedEOSError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.UnexpectedBOSError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.PageSequenceNumberDidNotIncrementError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.PageFromDifferentBitstreamError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.ChecksumFailedError=i},function(e,t,r){"use strict";function n(e){var t=0;return e.forEach(function(e){for(var r=0;r<e.length;r++)t=t<<8^o[t>>24&255^e[r]]}),t>>>0}Object.defineProperty(t,"__esModule",{value:!0});var o=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]);t.calculateCRC=n},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e,t,r){if(void 0===r&&(r=1),t<0||t+r>e.byteLength)throw new Error("extract() out of bounds. "+t+" "+r+" "+e.byteLength);return e.slice(t,t+r)}function o(e,t){return void 0===t&&(t=!0),new DataView(e).getUint32(0,t)}function i(e){for(var t=e.buffer,r=[],n=e.byteOffset,o=!0;n<e.byteOffset+e.byteLength;){var i=new DataView(t,n);try{var s=a(i);r.push(s),n+=s.entirePage.byteLength}catch(e){if(e instanceof g.IncompletePageError){o=!1;break}throw e}}return{pages:r,eos:o}}function a(e){var t=new Uint8Array(e.buffer,e.byteOffset),r=t.byteLength;if(r<E)throw new g.IncompletePageError("Incomplete page.");var i=n(t,26);if(r<E+i[0])throw new g.IncompletePageError("Incomplete page.");var a=n(t,E,i[0]),s={version:n(t,4),type:n(t,5),granulePosition:n(t,6,8),bitstreamSerialNumber:n(t,14,4),pageSequenceNumber:n(t,18,4),checksum:n(t,22,4),pageSegments:i,segmentTable:a},u=[],d=E+i[0];if(a.forEach(function(e){if(r<d+e)throw new g.IncompletePageError("Incomplete page.");u.push(n(t,d,e)),d+=e}),!u.length)throw new _.NoSegmentsInPageError("No segments.");var p=l.calculateCRC([v,s.version,s.type,s.granulePosition,s.bitstreamSerialNumber,s.pageSequenceNumber,m,i,a].concat(u)),f=o(s.checksum.buffer);if(p!==f)throw new c.ChecksumFailedError("Checksum failed.");return{header:s,segments:u,entirePage:n(t,0,d)}}function s(e){if(!e.length)return[];var t=o(e[0].header.bitstreamSerialNumber.buffer),r=-1,n=null,i=[];return e.forEach(function(a,s){if(o(a.header.bitstreamSerialNumber.buffer)!==t)throw new d.PageFromDifferentBitstreamError("Got a page from a different bitstream.");var u=o(a.header.pageSequenceNumber.buffer);if(u<=r)throw new p.PageSequenceNumberDidNotIncrementError("Page sequence number was not greater than the previous one.");var l=u!==r+1;r=u;var c=a.header.type[0],_=!!(1&c),g=!!(2&c);if(g&&s>0)throw new f.UnexpectedBOSError("Got BOS on a page which is not the first.");var v=!!(4&c);if(v&&s!==e.length-1)throw new h.UnexpectedEOSError("Got EOS on a page which is not the last.");var m=0;l&&(n=null);var E=a.segments.length;a.segments.forEach(function(e,t){if(n?n.data=y([n.data,e]):_&&0===t||(n={granulePosition:null,pageSequenceNumber:r,packetOffset:m,discontinuity:l&&0===m,first:g&&0===m,last:!1,data:e},m++),n&&e.byteLength<255){var s=t===E-1;s&&(n.granulePosition=o(a.header.granulePosition.buffer)),n.last=v&&s,i.push(n),n=null}})}),i}Object.defineProperty(t,"__esModule",{value:!0});var u=r(9),l=r(8),c=r(7),d=r(6),p=r(5),f=r(4),h=r(3),_=r(2),g=r(1),y=u.helpers.arrayBuffer.combine,v=new Uint8Array([79,103,103,83]),m=new Uint8Array([0,0,0,0]),E=27;t.retrievePages=i,t.parsePage=a,t.retrievePackets=s},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819,n(r(10));var o=r(0);t.OggParserError=o.OggParserError;var i=r(7);t.ChecksumFailedError=i.ChecksumFailedError;var a=r(2);t.NoSegmentsInPageError=a.NoSegmentsInPageError;var s=r(6);t.PageFromDifferentBitstreamError=s.PageFromDifferentBitstreamError;var u=r(5);t.PageSequenceNumberDidNotIncrementError=u.PageSequenceNumberDidNotIncrementError;var l=r(4);t.UnexpectedBOSError=l.UnexpectedBOSError;var c=r(3);t.UnexpectedEOSError=c.UnexpectedEOSError;var d=r(1);t.IncompletePageError=d.IncompletePageError}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e,t){var r=s(e),n=u(t.byteLength);return a([r,n,t])}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=o.helpers.arrayBuffer,a=i.combine,s=i.numberToUint8Array,u=i.createVintBuffer;t.IDS={EBML:440786851,EBMLVersion:17030,EBMLReadVersion:17143,EBMLMaxIDLength:17138,EBMLMaxSizeLength:17139,DocType:17026,DocTypeVersion:17031,DocTypeReadVersion:17029,Segment:408125543,Info:357149030,Duration:17545,Tracks:374648427,TrackEntry:174,TrackNumber:215,TrackUID:29637,FlagLacing:156,CodecID:134,CodecDelay:22186,SeekPreRoll:22203,TrackType:131,Audio:225,Channels:159,SamplingFrequency:181,CodecPrivate:25506,Cluster:524531317,Timecode:231,SimpleBlock:163},t.encodeElement=n},function(e,t,r){"use strict";function n(e){var t=3&e[0];return 0===t?1:3!==t?2:63&e[1]}function o(e){var t=e[0]>>>3&31;if(t>=f.length)throw new Error("Invalid configuration.");return f[t]}function i(e){if(!e.first)throw new Error("OpusHead is always in the first packet.");var t=e.data,r=new DataView(t.buffer),n=r.getUint8(9),o=r.getUint8(18),i=void 0,a=void 0,s=void 0;if(o>0){i=r.getUint8(18),a=r.getUint8(19),s=[];for(var u=0;u<n;u++)s.push(r.getUint8(20+u))}return{version:r.getUint8(8),channelCount:n,preSkip:r.getUint16(10,!0),inputSampleRate:r.getUint32(12,!0),outputGain:r.getInt16(16,!0)*Math.pow(2,-8),channelMapFamily:o,streamCount:i,twoChannelStreamCount:a,channelMappingTable:s}}function a(e,t){if(t>=128||t<-128)throw new Error("outputGainOverride invalid. It must be >= -128 and < 128.");i(e),new DataView(e.data.buffer).setInt16(16,Math.round(t*Math.pow(2,8)),!0)}function s(e){var t=e[0];if(!t||!t.first)throw new Error("Missing start of stream.");var r=e.slice(2),a=i(t),s=0,u=r.map(function(e){var t=new Uint8Array(4);t[0]=129,new DataView(t.buffer).setInt16(1,s),t[3]=128;var r=n(e.data);return s+=r*o(e.data),l.encodeElement(l.IDS.SimpleBlock,d([t,e.data]))}),c=d([l.encodeElement(l.IDS.EBML,function(){return d([l.encodeElement(l.IDS.EBMLVersion,p(1)),l.encodeElement(l.IDS.EBMLReadVersion,p(1)),l.encodeElement(l.IDS.EBMLMaxIDLength,p(4)),l.encodeElement(l.IDS.EBMLMaxSizeLength,p(8)),l.encodeElement(l.IDS.DocType,new Uint8Array([119,101,98,109])),l.encodeElement(l.IDS.DocTypeVersion,p(1)),l.encodeElement(l.IDS.DocTypeReadVersion,p(2))])}()),l.encodeElement(l.IDS.Segment,function(){return l.encodeElement(l.IDS.Info,function(){return l.encodeElement(l.IDS.Duration,function(){var e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,s),e}())}())}()),l.encodeElement(l.IDS.Tracks,function(){return l.encodeElement(l.IDS.TrackEntry,function(){return d([l.encodeElement(l.IDS.TrackNumber,p(1)),l.encodeElement(l.IDS.TrackUID,p(1)),l.encodeElement(l.IDS.FlagLacing,p(0)),l.encodeElement(l.IDS.CodecID,new Uint8Array([65,95,79,80,85,83])),l.encodeElement(l.IDS.CodecDelay,p(a.preSkip/48e3*1e9)),l.encodeElement(l.IDS.SeekPreRoll,new Uint8Array([4,196,180,0])),l.encodeElement(l.IDS.TrackType,p(2)),l.encodeElement(l.IDS.Audio,function(){return d([l.encodeElement(l.IDS.Channels,p(a.channelCount)),l.encodeElement(l.IDS.SamplingFrequency,new Uint8Array([64,231,112,0,0,0,0,0]))])}()),l.encodeElement(l.IDS.CodecPrivate,t.data)])}())}())]),f=l.encodeElement(l.IDS.Cluster,function(){var e=[l.encodeElement(l.IDS.Timecode,p(0))];return e.push.apply(e,u),d(e)}());return{initData:c,data:f}}Object.defineProperty(t,"__esModule",{value:!0});var u=r(0),l=r(1),c=u.helpers.arrayBuffer,d=c.combine,p=c.numberToUint8Array,f=[10,20,40,60,10,20,40,60,10,20,40,60,10,20,10,20,2.5,5,10,20,2.5,5,10,20,2.5,5,10,20,2.5,5,10,20];t.parseOpusHead=i,t.setOutputGain=a,t.buildWebm=s},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819,n(r(2))}])})},function(e,t,r){!function(t,n){e.exports=n(r(7),r(2))}(window,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";function n(e){return 0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1?e.slice(1,-1):e}function o(e){0===e.indexOf("0x")&&(e=e.substr(2));var t=new Uint16Array(8);if(e.length%4!==0)throw new f("Failed to parse IV (length is not multiple of 4).");for(var r=0;r<e.length;r+=4){var n=parseInt(e.substr(r,4),16);if(isNaN(n))throw new f("Failed to parse hex number in IV string.");t[r/4]=n}return new Uint8Array(t)}function i(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}function a(e){return!(e>=400&&e<500)}function s(e){var t={};O.lastIndex=0;for(var r;null!==(r=O.exec(e));){var o=r[1].trim().toLowerCase(),i=n(r[2].trim());t[o]=i}return t}var u=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var l,c=r(1),d=r(0),p=d.retrievalErrors.UnacceptableResponseStatusCodeError,f=d.retrievalErrors.PlaylistParseError,h=d.retrievalErrors.UnsupportedEncryptionError,_=c.helpers.abortableJob.AbortableJob,g=c.helpers.deferred.buildDeferred,y=c.helpers.cache.buildCache,v=c.helpers.retry,m=v.retry,E=v.buildExponentialDelayCalculator,b=c.helpers.Promise,w=c.helpers.find,P=c.helpers.url,S=c.logger.prefixLogger,R=c.logger.noOpLogger,A=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(MAP):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT(INF): *(\d+(?:\.\d+)?)(?:,(.*))?)|(?:(?!#)()(\S.+))|(?:#EXT-X-(BYTERANGE): *(\d+(?:@\d+(?:\.\d+)?)?)|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g,O=/(.+?)=(.+?)(?:,|$)/g,T=/^\d*(\.\d+)?$/;!function(e){e[e.NONE=0]="NONE",e[e.AES_128=1]="AES_128",e[e.SAMPLE_AES=2]="SAMPLE_AES"}(l||(l={}));var x=function(e){function t(t){var r=t.url,n=t.playlistLoader,o=t.segmentLoader,i=t.keyLoader,s=void 0===i?null:i,u=t.segmentFormat,l=t.logger,f=void 0===l?R:l,h=t.delayCalculator,v=void 0===h?E():h,w=t.keyDelayCalculator,P=void 0===w?E():w,A=t.segmentDelayCalculator,O=t.isPlaylistResponseCodeAcceptable,T=void 0===O?function(e){return 200===e}:O,x=t.isPlaylistResponseCodeRetryable,M=void 0===x?a:x,D=t.isSegmentResponseCodeAcceptable,k=void 0===D?function(e){return 200===e}:D,I=t.isSegmentResponseCodeRetryable,C=void 0===I?a:I,L=t.isKeyResponseCodeAcceptable,N=void 0===L?function(e){return 200===e}:L,F=t.isKeyResponseCodeRetryable,U=void 0===F?a:F,j=e.call(this)||this;return j._keyRetrievalJobsCache=y(),j._initDataRetrievalJobsCache=y(),j._data=null,j._lastUpdateTime=null,j._playlistEventRepresentation=null,j._logger=S(f,"PlaylistHLS"),j._url=r,j._playlistLoader=n,j._segmentLoader=o,j._keyLoader=s,j._segmentFormat=u,j._keyDelayCalculator=P,j._isPlaylistResponseCodeAcceptable=T,j._isPlaylistResponseCodeRetryable=M,j._isSegmentResponseCodeAcceptable=k,j._isSegmentResponseCodeRetryable=C,j._isKeyOrInitDataResponseCodeAcceptable=N,j._isKeyOrInitDataResponseCodeRetryable=U,j._segmentDelayCalculator=A,j._downloadAbortableJob=new _(function(){var e=c.helpers.deferred.buildDeferred(),t=m(v,function(t){var n=t.scheduleRetry,o=new d.events.Playlist(r);j._onPlaylistRequestQueued.dispatch({playlist:o});var i=j._playlistLoader.request({url:r});return i.onRequestStart(function(){j._onPlaylistRequestStart.dispatch({playlist:o})}),j._logger.debug("Requesting playlist.",r),i.onResponseReceived(function(t){if(!t)return j._logger.warn("Playlist request timed out.",r),j._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:null}),void n();var i=t.statusCode;if(j._isPlaylistResponseCodeAcceptable(i)){var a=t.getData();return a?(j._logger.debug("Got playlist response.",r,i),j._onPlaylistRetrieved.dispatch({playlist:o,statusCode:i}),void e.resolve({playlistContent:a,eventRepresentation:o})):(j._logger.warn("Playlist response contained no data.",r,i),j._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:i}),void n())}return j._isPlaylistResponseCodeRetryable(i)?(j._logger.debug("Playlist response code was not acceptable. Will retry.",r,i),j._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:i}),void n()):(j._logger.debug("Playlist response code was not acceptable.",r,i),j._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:i}),void e.reject(new p(i)))}),i.onError(function(t){return t instanceof c.loaderErrors.LoaderError?(j._logger.warn("Error from loader. Will retry",r,t),void n()):void e.reject(t)}),{onCancel:function(){j._logger.debug("Aborting playlist request.",r),i.hasCompleted()||i.abort(),j._onPlaylistRequestFailed.dispatch({playlist:o,aborted:!0})}}},{onNoMoreRetries:function(){return e.reject(new Error("No more retries for requesting playlist."))}}).cancel;return{result:e.promise,abort:function(){return t()}}}),j._updateJob=new _(function(){if(j._data&&j._data.ended)return{result:b.resolve(void 0)};var e=g(),t=j._downloadAbortableJob.run();return t.onCompletion(function(t){var r=t.playlistContent,n=t.eventRepresentation;j._lastUpdateTime=c.helpers.time.now(),j._onPlaylistParseStart.dispatch({playlist:n});try{j._data=j._parsePlaylist(r)}catch(t){return j._logger.error("Error when parsing playlist.",t,r),void e.reject(t)}j._playlistEventRepresentation=n,j._onPlaylistParseEnd.dispatch({playlist:n}),e.resolve(void 0)}),t.onError(e.reject),{result:e.promise,abort:function(){return t.abort()}}}),j}return u(t,e),t.prototype.hasInitialUpdateCompleted=function(){return!!this._data},t.prototype.getType=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.type},t.prototype.getExpireTime=function(){var e=this._data,t=this._lastUpdateTime;if(!e||e.type!==d.PlaylistType.LIVE||null===t)return null;var r=e.segments.reduce(function(e,t){return e+t.timeRange.duration},0);return t+r/2},t.prototype.hasEnded=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.ended},t.prototype.getCompleteDuration=function(){return this._data&&this._data.ended?this._data.totalDuration:null},t.prototype.getDuration=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.totalDuration},t.prototype.getTargetDuration=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.targetDuration},t.prototype.getFirstSegmentIndex=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.mediaSequence},t.prototype.getSegmentCount=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.segments.length},t.prototype.getSegmentIndexContainingTime=function(e){var t=this._data;if(!t)throw new Error("Not loaded yet.");var r=w(t.segments,function(t){return t.timeRange.containsTime(e)});return r?t.mediaSequence+t.segments.indexOf(r):null},t.prototype._update=function(){return this._updateJob.run()},t.prototype._getSegment=function(e){var t=this,r=this._data;if(!r)throw new Error("Not loaded yet.");var n=r.segments[e-r.mediaSequence],o=new _(function(){var r=n.encryptionData,o=t._playlistEventRepresentation;if(!o)throw new Error("Playlist event representation should exist.");var i=t._buildEncryptionConfig(r,e),a=n.initDataUrl?t._retrieveInitData(n.initDataUrl):null,s=i.whenComplete().then(function(r){var i=function(i){return new d.Segment({url:n.url,sequenceNumber:e,playlist:t,timeRange:n.timeRange,format:t._segmentFormat,loader:t._segmentLoader,playlistEventRepresentation:o,logger:t._logger,delayCalculator:t._segmentDelayCalculator,isResponseCodeAcceptable:t._isSegmentResponseCodeAcceptable,isResponseCodeRetryable:t._isSegmentResponseCodeRetryable,encryptionConfig:r,initData:i})};return a?a.whenComplete().then(function(e){return i(e)}):i(void 0)});return{result:s,abort:function(){i.abort(),a&&a.abort()}}});return o.run()},t.prototype._buildEncryptionConfig=function(e,t){var r=this,n=new _(function(){if(e.method===l.NONE)return{result:b.resolve(void 0)};if(e.method!==l.AES_128)return r._logger.error("Unsupported encryption method.",e.method),{result:b.reject(new h)};var n=r._keyLoader;if(!n)return{result:b.reject(new Error("Encryption method not supported as no key loader provided."))};var o=r._retrieveKey(e.keyUrl),a=o.whenComplete().then(function(r){return{cipher:"AES-CBC",key:r,iv:e.iv||i(t)}});return{result:a,abort:function(){return o.abort()}}},{storeResult:!0});return n.run()},t.prototype._retrieveKey=function(e){var t=this,r=this._keyLoader;if(!r)throw new Error("No key loader.");var n=this._playlistEventRepresentation;if(!n)throw new Error("Playlist event representation should exist.");var o=new d.events.Key(n,e);return this._retrieveKeyOrInitData({url:e,loader:r,cache:this._keyRetrievalJobsCache,onRequestQueued:function(){return t._onKeyRequestQueued.dispatch({key:o})},onRequestStart:function(){return t._onKeyRequestStart.dispatch({key:o})},onRequestTimedOut:function(){t._onKeyRequestFailed.dispatch({key:o,statusCode:null})},onRequestFailed:function(e){t._onKeyRequestFailed.dispatch({key:o,statusCode:e})},onRequestAborted:function(){t._onKeyRequestFailed.dispatch({key:o,aborted:!0})},onRetrieved:function(e){t._onKeyRetrieved.dispatch({key:o,statusCode:e})},type:"key"})},t.prototype._retrieveInitData=function(e){var t=this,r=this._playlistEventRepresentation;if(!r)throw new Error("Playlist event representation should exist.");var n=new d.events.InitData(r,e);return this._retrieveKeyOrInitData({url:e,loader:this._segmentLoader,cache:this._initDataRetrievalJobsCache,onRequestQueued:function(){return t._onInitDataRequestQueued.dispatch({initData:n})},onRequestStart:function(){return t._onInitDataRequestStart.dispatch({initData:n})},onRequestTimedOut:function(){t._onInitDataRequestFailed.dispatch({initData:n,statusCode:null})},onRequestFailed:function(e){t._onInitDataRequestFailed.dispatch({initData:n,statusCode:e})},onRequestAborted:function(){t._onInitDataRequestFailed.dispatch({initData:n,aborted:!0})},onRetrieved:function(e){t._onInitDataRetrieved.dispatch({initData:n,statusCode:e})},type:"init data"})},t.prototype._retrieveKeyOrInitData=function(e){var t=this,r=e.url,n=e.loader,o=e.cache,i=e.onRequestQueued,a=e.onRequestStart,s=e.onRequestTimedOut,u=e.onRequestFailed,l=e.onRequestAborted,d=e.onRetrieved,f=e.type,h=o.get(r);return h?this._logger.debug(f+" retrieval already in progress.",r):(h=new _(function(){var e=c.helpers.deferred.buildDeferred(),o=m(t._keyDelayCalculator,function(o){var h=o.scheduleRetry;i();var _=n.request({url:r});return _.onRequestStart(a),t._logger.debug("Retrieving "+f+".",r),_.onResponseReceived(function(n){if(!n)return t._logger.warn(f+" request timed out.",r),s(),void h();var o=n.statusCode;if(t._isKeyOrInitDataResponseCodeAcceptable(o)){var i=n.getData();return i?(t._logger.debug("Got "+f+" response.",r,o),d(o),void e.resolve(new Uint8Array(i))):(t._logger.warn(f+" response contained no data.",r,o),u(o),void h())}return t._isKeyOrInitDataResponseCodeRetryable(o)?(t._logger.warn(f+" response code was not acceptable. Will retry.",r,o),u(o),void h()):(t._logger.warn(f+" response code was not acceptable.",r,o),u(o),void e.reject(new p(o)))}),_.onError(function(n){return n instanceof c.loaderErrors.LoaderError?(t._logger.warn("Error from loader. Will retry",r,n),void h()):void e.reject(n)}),{onCancel:function(){t._logger.debug("Aborting "+f+" request.",r),_.hasCompleted()||_.abort(),l()}}},{onNoMoreRetries:function(){return e.reject(new Error("No more retries for requesting "+f+"."))}}).cancel;return{result:e.promise,abort:function(){return o()}}},{storeResult:!0}),o.set(r,h)),h.run()},t.prototype._parsePlaylist=function(e){var t=this._data,r={version:null,type:d.PlaylistType.LIVE,mediaSequence:null,targetDuration:null,totalDuration:0,ended:!1},n=[],i={method:l.NONE},a=null,u=null;A.lastIndex=0;for(var p,h=0,_=!1;null!==(p=A.exec(e));){var g=p.filter(function(e,t){return 0!==t&&void 0!==e}).map(function(e,t){return 0===t?e.toLowerCase():e}),y=g[0],v=g.slice(1);if(0===h){if("extm3u"!==y)throw new f("First line did not contain EXTM3U tag.")}else{if(!_)switch(y){case"playlist-type":if(r.type!==d.PlaylistType.LIVE)throw new f("Already have playlist type.");switch(v[0].toLowerCase()){case"vod":r.type=d.PlaylistType.VOD;break;case"event":r.type=d.PlaylistType.EVENT;break;default:throw new f("Invalid playlist type.")}break;case"media-sequence":if(null!==r.mediaSequence)throw new f("Already have media sequence number.");var m=parseInt(v[0],10);if(m+""!==v[0])throw new f("Invalid media sequence number.");r.mediaSequence=m;break;case"targetduration":if(null!==r.targetDuration)throw new f("Already have target duration.");var E=parseInt(v[0],10);if(E+""!==v[0]||E<0)throw new f("Invalid target duration.");r.targetDuration=1e3*E;break;case"version":if(null!==r.version)throw new f("Already have version.");var b=parseInt(v[0],10);if(b+""!==v[0])throw new f("Invalid version.");if(b<3)throw new f("HLS version must be 3 or above.");r.version=b;break;default:_=!0}if(_)switch(y){case"key":var w=s(v[0]),S="method"in w?w.method.toLowerCase():null,R="uri"in w?P.buildAbsoluteUrl(this._url,w.uri):null,O="iv"in w?o(w.iv):null;if(!S)throw new f("Missing encryption method.");if(!R&&"none"!==S)throw new f("Missing key url.");switch(S){case"none":if(null!==R)throw new f("Key url not allowed.");if(null!==O)throw new f("IV not allowed.");i={method:l.NONE};break;case"aes-128":if(!R)throw new f("Key url required.");i={method:l.AES_128,keyUrl:R,iv:O};break;case"sample-aes":if(!R)throw new f("Key url required.");i={method:l.SAMPLE_AES,keyUrl:R,iv:O};break;default:throw new f("Unknown encryption method.")}break;case"map":var w=s(v[0]);if(!("uri"in w))throw new f("URI missing from EXT-X-MAP tag.");if("byterange"in w)throw new f("BYTERANGE in EXT-X-MAP tag is currently unsupported.");a=w.uri?P.buildAbsoluteUrl(this._url,w.uri):null;break;case"inf":if(!v[0].match(T))throw new f("Invalid segment duration.");u=1e3*parseFloat(v[0]);break;case"":if(r.ended)throw new f("Already received ENDLIST tag.");if(null===u)throw new f("Not received segment duration.");var x=P.buildAbsoluteUrl(this._url,v[0]);n.push({url:x,timeRange:new c.TimeRange(r.totalDuration,u),initDataUrl:a,encryptionData:i}),r.totalDuration+=u,u=null;break;case"endlist":if(r.ended)throw new f("Already had ENDLIST tag.");r.ended=!0;break;default:this._logger.warn("Unable to parse playlist line.",y)}}h++}var M=r.version,D=r.type,k=r.mediaSequence,I=r.targetDuration,C=r.ended,L=r.totalDuration;if(null===M)throw new f("Missing version.");if(null===I)throw new f("Missing target duration.");if(C&&D===d.PlaylistType.LIVE)throw new f("Cannot be ended if type is LIVE.");if(!C&&D===d.PlaylistType.VOD)throw new f("Must be ended if type is VOD.");if(null===k&&(k=0),t){if(t.type!==D)throw new f("Playlist type has changed since last update.");if(t.type===d.PlaylistType.EVENT&&k!==t.mediaSequence)throw new f("Media sequence number has changed. Not valid for EVENT playlist.");var N=t.segments[k-t.mediaSequence];if(!N)throw new f("Tracking lost. The last segment of the previous playlist is no longer in the new one.");var F=N.timeRange.start;n.forEach(function(e){var t=e.timeRange;e.timeRange=new c.TimeRange(t.start+F,t.duration)}),L+=F}return{version:M,type:D,mediaSequence:k,targetDuration:I,totalDuration:L,ended:C,segments:n}},t}(d.Playlist);t.PlaylistHLS=x},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(2);t.PlaylistHLS=n.PlaylistHLS}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]
23868
+ }instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t,r,n){void 0===r&&(r={}),void 0===n&&(n=2e4);var o=e.call(this)||this;if(o._responseStarted=!1,n<0)throw new Error("Invaid timeout.");o._timeoutTimer=window.setTimeout(function(){return o._onManualTimeout()},n),o._xhr=new XMLHttpRequest,o._xhr.addEventListener("load",function(){return o._onLoad()}),o._xhr.addEventListener("abort",function(){return o._onAbort()}),o._xhr.addEventListener("error",function(e){return o._onError(e)}),o._xhr.addEventListener("timeout",function(){return o._onTimeout()}),o._xhr.addEventListener("loadend",function(){return o._onLoadEnd()}),o._xhr.addEventListener("progress",function(){return o._onProgress()}),o._xhr.open("GET",t,!0),o._xhr.timeout=n;var i=o._getResponseType().some(function(e){return o._xhr.responseType=e,o._xhr.responseType===e});if(!i)throw new Error("Failed setting response type.");return Object.keys(r).forEach(function(e){return o._xhr.setRequestHeader(e,r[e])}),o._signalRequestStart(),o._xhr.send(),o}return n(t,e),t.prototype._abort=function(){this._xhr.abort()},t.prototype._onAbort=function(){this.hasCompleted()||this._onTimeout()},t.prototype._onManualTimeout=function(){this.hasCompleted()||(this._signalTimeout(),this._xhr.abort())},t.prototype._onTimeout=function(){this.hasCompleted()||this._signalTimeout()},t.prototype._onLoad=function(){if(!this.hasCompleted()){if(!this._isChunkedResponse()){var e=this._xhr;this._provideStatusAndHeaders({statusCode:e.status,headers:this._parseHeaders(e.getAllResponseHeaders()||"")},e.response)}this.hasCompleted()||this._finalize()}},t.prototype._onError=function(e){switch(this.getState()){case o.loader.ResponseState.COMPLETED:case o.loader.ResponseState.ERRORED:break;case o.loader.ResponseState.PENDING:if(0===this._xhr.status){this._provideStatusAndHeaders({statusCode:0,headers:{}},this._getEmptyData()),this._finalize();break}default:this._finalize(new o.loaderErrors.LoaderError("An error occurred.",e))}},t.prototype._onLoadEnd=function(){window.clearTimeout(this._timeoutTimer),this.hasCompleted()||this._finalize(new o.loaderErrors.LoaderError("Unexpected error occurred."))},t.prototype._onProgress=function(){if(!this.hasCompleted()){var e=this._xhr;this._isChunkedResponse()&&(this._responseStarted?this._providePart(e.response):(this._responseStarted=!0,this._provideStatusAndHeaders({statusCode:e.status,headers:this._parseHeaders(e.getAllResponseHeaders()||"")},e.response)))}},t.prototype._isChunkedResponse=function(){return"moz-chunked-arraybuffer"===this._xhr.responseType},t.prototype._parseHeaders=function(e){var t={};if(!e)return t;for(var r=e.split("\r\n"),n=0,o=r.length;n<o;n++){var i=r[n],a=i.indexOf(": ");if(a>0){var s=i.substring(0,a).trim(),u=i.substring(a+2);t[s]=u}}return t},t}(o.loader.LoaderRequest);t.LoaderRequest=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=o.helpers.browser.isFirefox(),a=function(e){function t(r,n,i){void 0===n&&(n={}),void 0===i&&(i=2e4);var a=e.call(this)||this;if(!t.isSupported())throw new Error("Not supported.");var s=a._abortController=new AbortController,u=new Request(r,{headers:n,redirect:"follow",signal:s.signal});a._signalRequestStart();var l=a._abortTimer=window.setTimeout(function(){a._signalTimeout(),a._abort()},i),c=fetch(u).then(function(e){var t={};if(e.headers.forEach(function(e,r){return t[e]=r}),a._provideStatusAndHeaders({statusCode:e.status,headers:t},new ArrayBuffer(0)),e.body){var r=e.body.getReader(),n=function(){return r.read().then(function(e){var t=e.done,r=e.value;if(!t&&!a.hasCompleted())return a._providePart(r.buffer),n()})};return n()}return e.arrayBuffer().then(function(e){e&&a._providePart(e)})}).then(function(){a.hasCompleted()||a._finalize()}).catch(function(e){if(!a.hasCompleted()){var t=e instanceof o.loaderErrors.LoaderError?e:new o.loaderErrors.LoaderError(e);a._finalize(t)}});return o.helpers.always(c,function(){return window.clearTimeout(l)}),a}return n(t,e),t.isSupported=function(){return"fetch"in window&&"Request"in window&&"AbortController"in window&&!i},t.prototype._abort=function(){window.clearTimeout(this._abortTimer),this._abortController.abort()},t.prototype._reduceParts=function(e){return o.helpers.arrayBuffer.combine(e.map(function(e){return new Uint8Array(e)})).buffer},t}(o.loader.LoaderRequest);t.ArrayBufferLoaderRequest=a},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(1),a=o.helpers.browser.getFirefoxVersion(),s=a&&a.major>=60?["moz-chunked-arraybuffer","arraybuffer"]:["arraybuffer"],u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._getResponseType=function(){return s},t.prototype._getEmptyData=function(){return new ArrayBuffer(0)},t.prototype._reduceParts=function(e){return o.helpers.arrayBuffer.combine(e.map(function(e){return new Uint8Array(e)})).buffer},t}(i.LoaderRequest);t.ArrayBufferLoaderRequest=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(2),i=function(){function e(e){var t=(void 0===e?{}:e).fetchEnabled,r=void 0===t||t;this._fetchEnabled=r}return e.prototype.request=function(e){var t=e.url,r=e.headers,i=e.timeout;return this._fetchEnabled&&o.ArrayBufferLoaderRequest.isSupported()?new o.ArrayBufferLoaderRequest(t,r,i):new n.ArrayBufferLoaderRequest(t,r,i)},e}();t.ArrayBufferLoader=i,t.arrayBufferLoader=new i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=["text"],a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._getResponseType=function(){return i},t.prototype._getEmptyData=function(){return""},t.prototype._reduceParts=function(e){return e.join("")},t}(o.LoaderRequest);t.StringLoaderRequest=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5);t.stringLoader={request:function(e){var t=e.url,r=e.headers,o=e.timeout;return new n.StringLoaderRequest(t,r,o)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(6);t.stringLoader=n.stringLoader;var o=r(4);t.arrayBufferLoader=o.arrayBufferLoader,t.ArrayBufferLoader=o.ArrayBufferLoader}])})},function(e,t,r){!function(t,n){e.exports=n(r(1),r(2))}(window,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){if(void 0===t&&(t=6e4),this._limit=e,this._period=t,this._jobs=[],this._jobsRunInPeriod=0,e<=0)throw new Error("limit must be > 0.");if(t<=0)throw new Error("period must be > 0.")}return e.prototype.execute=function(e){var t=this,r={job:e};return this._jobs.push(r),this._executeNextJob(),{abort:function(){var e=t._jobs.indexOf(r);e>=0&&t._jobs.splice(e,1)}}},e.prototype._executeNextJob=function(){var e=this;if(this._jobsRunInPeriod<this._limit){var t=this._jobs.shift();t&&(this._jobsRunInPeriod++,window.setTimeout(function(){e._jobsRunInPeriod--,e._executeNextJob()},this._period),t.job())}},e}();t.Limiter=n},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),i=r(1),a=r(0),s=o.helpers.abortableJob.AbortableJob,u=o.helpers.find,l=o.helpers.time,c=300,d=new a.Limiter(c,3e5),p=5e3,f=[i.renditions.encryptedHlsMp3,i.renditions.hlsMp3,i.renditions.encryptedHlsOpus,i.renditions.hlsOpus,i.renditions.httpMp3],h=function(e){function t(t){var r=t.loader,n=t.clientId,o=t.trackId,i=t.secretToken,a=void 0===i?null:i,s=t.requestAuthorization,u=void 0===s?null:s,l=t.excludedRenditions,c=void 0===l?[]:l,d=t.maxBitrate,p=void 0===d?1/0:d,f=t.endpointBaseUrl,h=void 0===f?"https://api.soundcloud.com/":f,_=t.encryptedStreamsEnabled,g=void 0!==_&&_,y=e.call(this)||this;if(y.name="PublicAPI",y._getUrlsJob=null,y._clearResponseTimer=null,!r)throw new Error("loader required.");if("string"!=typeof n)throw new Error("clientId invalid.");if("number"!=typeof o)throw new Error("trackId invalid.");if(null!==a&&"string"!=typeof a)throw new Error("secretToken invalid.");if(null!==u&&"string"!=typeof u)throw new Error("requestAuthorizaton invalid.");if("number"!=typeof p||p<=0)throw new Error("maxBitrate must be > 0.");if("string"!=typeof h)throw new Error("endpointBaseUrl must be > 0.");if("boolean"!=typeof g)throw new Error("encryptedStreamsEnabled invalid.");return y._loader=r,y._clientId=n,y._requestAuthorization=u,y._trackId=o,y._secretToken=a,y._endpointBaseUrl=h,y._encryptedStreamsEnabled=g,y._excludedRenditions=c,y._maxBitrate=p,y}return n(t,e),t.prototype.getTrackId=function(){return this._trackId},t.prototype.excludeRendition=function(e){this._excludedRenditions.indexOf(e)<0&&this._excludedRenditions.push(e)},t.prototype.updateRequestAuthorization=function(e){if(null!==e&&"string"!=typeof e)throw new Error("requestAuthorizaton invalid.");this._requestAuthorization=e},t.prototype.clearCache=function(){this._clearResponseTimer&&(window.clearTimeout(this._clearResponseTimer),this._clearResponseTimer=null),this._getUrlsJob=null},t.prototype.getMaxBitrate=function(){return this._maxBitrate},t.prototype.setMaxBitrate=function(e){if("number"!=typeof e||e<=0)throw new Error("maxBitrate must be > 0.");this._maxBitrate=e},t.prototype.getUrl=function(){var e=this,t=this._maxBitrate,r=this._excludedRenditions,n=new s(function(){var n=o.helpers.deferred.buildDeferred(),a=e._getUrls();return a.onCompletion(function(e){var o=e.urls,i=e.timeRetrieved,a=null;f.filter(function(e){return r.indexOf(e)<0}).some(function(e){var r=o.filter(function(t){return t.rendition===e}).map(function(e){return{url:e.url,bitrate:e.bitrate}}),n=u(r.sort(function(e,t){return t.bitrate-e.bitrate}),function(e){return e.bitrate<=t});return!!n&&(a={success:!0,url:n.url,rendition:e,bitrate:n.bitrate,timeRetrieved:i},!0)}),n.resolve(a)}),a.onError(function(e){e instanceof i.UrlRetrieverError?n.resolve({success:!1,error:e}):n.reject(e)}),{result:n.promise,abort:function(){return a.abort()}}});return n.run()},t.prototype._getUrls=function(){var e=this;return this._getUrlsJob||(this._getUrlsJob=new s(function(){var t=o.helpers.deferred.buildDeferred(),r=null,n=d.execute(function(){var n=e._requestAuthorization?{Authorization:e._requestAuthorization}:{},o=e._endpointBaseUrl+"i1/tracks/"+encodeURI(e._trackId+"")+"/streams?client_id="+encodeURIComponent(e._clientId);e._encryptedStreamsEnabled&&(o+="&with_encrypted_streams=true"),e._secretToken&&(o+="&secret_token="+encodeURIComponent(e._secretToken)),r=e._loader.request({url:o,headers:n});var a=r.getResponse().then(function(e){if(!e)throw new i.UrlRetrieverError("TIMED_OUT",!0);if(200!==e.statusCode)throw new i.UrlRetrieverError("INVALID_STATUS_"+e.statusCode);var t=e.getData();if(!t)throw new i.UrlRetrieverError("NO_DATA");var r=l.now(),n=JSON.parse(t),o=[];return Object.keys(n).map(function(e){var t=e.split("_"),r=t[0],i=t[1],a=t[2],s=parseInt(a,10);if(r&&i&&!isNaN(s)){var l=u(f,function(e){return e.scProtocol===r&&e.scFormat===i});l&&o.push({rendition:l,bitrate:s,url:n[e]})}}),{urls:o,timeRetrieved:r}});a.then(t.resolve,t.reject)});return{result:t.promise,abort:function(){n.abort(),r&&r.abort()}}}),this._clearResponseTimer=window.setTimeout(function(){e._clearResponseTimer=null,e._getUrlsJob=null},p)),this._getUrlsJob.run()},t}(i.BaseStreamUrlRetriever);t.StreamUrlRetriever=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.1.0",t.buildNumber=845;var n=r(3);t.StreamUrlRetriever=n.StreamUrlRetriever}])})}])},function(e,t,r){var n;(function(e,o,i,a){/*!
23869
+ * @overview es6-promise - a tiny implementation of Promises/A+.
23870
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
23871
+ * @license Licensed under MIT license
23872
+ * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
23873
+ * @version 2.3.0
23874
+ */
23875
+ (function(){"use strict";function s(e){return"function"==typeof e||"object"==typeof e&&null!==e}function u(e){return"function"==typeof e}function l(e){return"object"==typeof e&&null!==e}function c(e){K=e}function d(e){Z=e}function p(){var t=e.nextTick,r=e.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);return Array.isArray(r)&&"0"===r[1]&&"10"===r[2]&&(t=o),function(){t(y)}}function f(){return function(){J(y)}}function h(){var e=0,t=new te(y),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function _(){var e=new MessageChannel;return e.port1.onmessage=y,function(){e.port2.postMessage(0)}}function g(){return function(){setTimeout(y,1)}}function y(){for(var e=0;e<X;e+=2){var t=oe[e],r=oe[e+1];t(r),oe[e]=void 0,oe[e+1]=void 0}X=0}function v(){try{var e=r(29);return J=e.runOnLoop||e.runOnContext,f()}catch(e){return g()}}function m(){}function E(){return new TypeError("You cannot resolve a promise with itself")}function b(){return new TypeError("A promises callback cannot return that same promise.")}function w(e){try{return e.then}catch(e){return ue.error=e,ue}}function P(e,t,r,n){try{e.call(t,r,n)}catch(e){return e}}function S(e,t,r){Z(function(e){var n=!1,o=P(r,t,function(r){n||(n=!0,t!==r?O(e,r):x(e,r))},function(t){n||(n=!0,M(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&o&&(n=!0,M(e,o))},e)}function R(e,t){t._state===ae?x(e,t._result):t._state===se?M(e,t._result):D(t,void 0,function(t){O(e,t)},function(t){M(e,t)})}function A(e,t){if(t.constructor===e.constructor)R(e,t);else{var r=w(t);r===ue?M(e,ue.error):void 0===r?x(e,t):u(r)?S(e,t,r):x(e,t)}}function O(e,t){e===t?M(e,E()):s(t)?A(e,t):x(e,t)}function T(e){e._onerror&&e._onerror(e._result),k(e)}function x(e,t){e._state===ie&&(e._result=t,e._state=ae,0!==e._subscribers.length&&Z(k,e))}function M(e,t){e._state===ie&&(e._state=se,e._result=t,Z(T,e))}function D(e,t,r,n){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+ae]=r,o[i+se]=n,0===i&&e._state&&Z(k,e)}function k(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n,o,i=e._result,a=0;a<t.length;a+=3)n=t[a],o=t[a+r],n?L(r,n,o,i):o(i);e._subscribers.length=0}}function I(){this.error=null}function C(e,t){try{return e(t)}catch(e){return le.error=e,le}}function L(e,t,r,n){var o,i,a,s,l=u(r);if(l){if(o=C(r,n),o===le?(s=!0,i=o.error,o=null):a=!0,t===o)return void M(t,b())}else o=n,a=!0;t._state!==ie||(l&&a?O(t,o):s?M(t,i):e===ae?x(t,o):e===se&&M(t,o))}function N(e,t){try{t(function(t){O(e,t)},function(t){M(e,t)})}catch(t){M(e,t)}}function F(e,t){var r=this;r._instanceConstructor=e,r.promise=new e(m),r._validateInput(t)?(r._input=t,r.length=t.length,r._remaining=t.length,r._init(),0===r.length?x(r.promise,r._result):(r.length=r.length||0,r._enumerate(),0===r._remaining&&x(r.promise,r._result))):M(r.promise,r._validationError())}function U(e){return new ce(this,e).promise}function j(e){function t(e){O(o,e)}function r(e){M(o,e)}var n=this,o=new n(m);if(!Y(e))return M(o,new TypeError("You must pass an array to race.")),o;for(var i=e.length,a=0;o._state===ie&&a<i;a++)D(n.resolve(e[a]),void 0,t,r);return o}function B(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(m);return O(r,e),r}function q(e){var t=this,r=new t(m);return M(r,e),r}function H(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function z(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function G(e){this._id=_e++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==e&&(u(e)||H(),this instanceof G||z(),N(this,e))}function V(){var e;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;t&&"[object Promise]"===Object.prototype.toString.call(t.resolve())&&!t.cast||(e.Promise=ge)}var W;W=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var J,K,Q,Y=W,X=0,Z=({}.toString,function(e,t){oe[X]=e,oe[X+1]=t,X+=2,2===X&&(K?K(y):Q())}),$="undefined"!=typeof window?window:void 0,ee=$||{},te=ee.MutationObserver||ee.WebKitMutationObserver,re="undefined"!=typeof e&&"[object process]"==={}.toString.call(e),ne="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,oe=new Array(1e3);Q=re?p():te?h():ne?_():void 0===$?v():g();var ie=void 0,ae=1,se=2,ue=new I,le=new I;F.prototype._validateInput=function(e){return Y(e)},F.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},F.prototype._init=function(){this._result=new Array(this.length)};var ce=F;F.prototype._enumerate=function(){for(var e=this,t=e.length,r=e.promise,n=e._input,o=0;r._state===ie&&o<t;o++)e._eachEntry(n[o],o)},F.prototype._eachEntry=function(e,t){var r=this,n=r._instanceConstructor;l(e)?e.constructor===n&&e._state!==ie?(e._onerror=null,r._settledAt(e._state,t,e._result)):r._willSettleAt(n.resolve(e),t):(r._remaining--,r._result[t]=e)},F.prototype._settledAt=function(e,t,r){var n=this,o=n.promise;o._state===ie&&(n._remaining--,e===se?M(o,r):n._result[t]=r),0===n._remaining&&x(o,n._result)},F.prototype._willSettleAt=function(e,t){var r=this;D(e,void 0,function(e){r._settledAt(ae,t,e)},function(e){r._settledAt(se,t,e)})};var de=U,pe=j,fe=B,he=q,_e=0,ge=G;G.all=de,G.race=pe,G.resolve=fe,G.reject=he,G._setScheduler=c,G._setAsap=d,G._asap=Z,G.prototype={constructor:G,then:function(e,t){var r=this,n=r._state;if(n===ae&&!e||n===se&&!t)return this;var o=new this.constructor(m),i=r._result;if(n){var a=arguments[n-1];Z(function(){L(n,o,a,i)})}else D(r,o,e,t);return o},catch:function(e){return this.then(null,e)}};var ye=V,ve={Promise:ge,polyfill:ye};r(23).amd?(n=function(){return ve}.call(t,r,t,a),!(void 0!==n&&(a.exports=n))):"undefined"!=typeof a&&a.exports?a.exports=ve:"undefined"!=typeof this&&(this.ES6Promise=ve),ye()}).call(this)}).call(t,r(6),r(25).setImmediate,function(){return this}(),r(24)(e))},function(e,t){"use strict";var r={oauth_token:void 0,baseURL:"https://api.soundcloud.com",connectURL:"//connect.soundcloud.com",client_id:void 0,redirect_uri:void 0};e.exports={get:function(e){return r[e]},set:function(e,t){t&&(r[e]=t)}}},function(e,t,r){(function(t){"use strict";var n=r(3),o=r(20),i=r(2).Promise,a=function(e,r,n,o){var a=void 0,s=new i(function(i){var s=t.FormData&&n instanceof FormData;a=new XMLHttpRequest,a.upload&&a.upload.addEventListener("progress",o),a.open(e,r,!0),s||a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.onreadystatechange=function(){4===a.readyState&&i({responseText:a.responseText,request:a})},a.send(n)});return s.request=a,s},s=function(e){var t=e.responseText,r=e.request,n=void 0,o=void 0;try{o=JSON.parse(t)}catch(e){}return o?o.errors&&(n={message:""},o.errors[0]&&o.errors[0].error_message&&(n={message:o.errors[0].error_message})):n=r?{message:"HTTP Error: "+r.status}:{message:"Unknown error"},n&&(n.status=r.status),{json:o,error:n}},u=function e(t,r,n,o){var i=a(t,r,n,o),u=i.then(function(t){var r=t.responseText,n=t.request,o=s({responseText:r,request:n});if(o.json&&"302 - Found"===o.json.status)return e("GET",o.json.location,null);if(200!==n.status&&o.error)throw o.error;return o.json});return u.request=i.request,u},l=function(e,t,r){Object.keys(t).forEach(function(n){r?e.append(n,t[n]):e[n]=t[n]})};e.exports={request:function(e,r){var i=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],a=arguments.length<=3||void 0===arguments[3]?function(){}:arguments[3],s=n.get("oauth_token"),c=n.get("client_id"),d={},p=t.FormData&&i instanceof FormData,f=void 0,h=void 0;return d.format="json",s?d.oauth_token=s:d.client_id=c,l(i,d,p),"GET"!==e&&(f=p?i:o.encode(i),i={oauth_token:s}),r="/"!==r[0]?"/"+r:r,h=""+n.get("baseURL")+r+"?"+o.encode(i),u(e,h,f,a)},oEmbed:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=t.element;delete t.element,t.url=e;var n="https://soundcloud.com/oembed.json?"+o.encode(t);return u("GET",n,null).then(function(e){return r&&e.html&&(r.innerHTML=e.html),e})},upload:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.asset_data||e.file,r=n.get("oauth_token")&&e.title&&t;if(!r)return new i(function(e,t){t({status:0,error_message:"oauth_token needs to be present and title and asset_data / file passed as parameters"})});var o=Object.keys(e),a=new FormData;return o.forEach(function(t){var r=e[t];"file"===t&&(t="asset_data",r=e.file),a.append("track["+t+"]",r)}),this.request("POST","/tracks",a,e.progress)},resolve:function(e){return this.request("GET","/resolve",{url:e,_status_code_map:{302:200}})}}}).call(t,function(){return this}())},function(e,t){"use strict";var r={};e.exports={get:function(e){return r[e]},set:function(e,t){r[e]=t}}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===n||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function a(){_&&f&&(_=!1,f.length?h=f.concat(h):g=-1,h.length&&s())}function s(){if(!_){var e=o(a);_=!0;for(var t=h.length;t;){for(f=h,h=[];++g<t;)f&&f[g].run();g=-1,t=h.length}f=null,_=!1,i(e)}}function u(e,t){this.fun=e,this.array=t}function l(){}var c,d,p=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(e){c=r}try{d="function"==typeof clearTimeout?clearTimeout:n}catch(e){d=n}}();var f,h=[],_=!1,g=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];h.push(new u(e,t)),1!==h.length||_||o(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.prependListener=l,p.prependOnceListener=l,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,r){"use strict";var n=r(22);t.extract=function(e){return e.split("?")[1]||""},t.parse=function(e){return"string"!=typeof e?{}:(e=e.trim().replace(/^(\?|#|&)/,""),e?e.split("&").reduce(function(e,t){var r=t.replace(/\+/g," ").split("="),n=r.shift(),o=r.length>0?r.join("="):void 0;return n=decodeURIComponent(n),o=void 0===o?null:decodeURIComponent(o),e.hasOwnProperty(n)?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o,e},{}):{})},t.stringify=function(e){return e?Object.keys(e).sort().map(function(t){var r=e[t];return Array.isArray(r)?r.sort().map(function(e){return n(t)+"="+n(e)}).join("&"):n(t)+"="+n(r)}).filter(function(e){return e.length>0}).join("&"):""}},function(e,t,r){"use strict";var n=r(7),o=r(5);e.exports={notifyDialog:function(e){var t=n.parse(e.search),r=n.parse(e.hash),i={oauth_token:t.access_token||r.access_token,dialog_id:t.state||r.state,error:t.error||r.error,error_description:t.error_description||r.error_description},a=o.get(i.dialog_id);a&&a.handleConnectResponse(i)}}},function(e,t,r){"use strict";var n=r(3),o=r(11),i=r(2).Promise,a=function(e){return n.set("oauth_token",e.oauth_token),e};e.exports=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=n.get("oauth_token");if(t)return new i(function(e){e({oauth_token:t})});var r={client_id:e.client_id||n.get("client_id"),redirect_uri:e.redirect_uri||n.get("redirect_uri"),response_type:"code_and_token",scope:e.scope||"non-expiring",display:"popup"};if(!r.client_id||!r.redirect_uri)throw new Error("Options client_id and redirect_uri must be passed");var s=new o(r);return s.open().then(a)}},function(e,t,r){"use strict";var n=r(2).Promise;e.exports=function(){var e={};return e.promise=new n(function(t,r){e.resolve=t,e.reject=r}),e}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(10),a=r(5),s=r(12),u=r(7),l="SoundCloud_Dialog",c=function(){return[l,Math.ceil(1e6*Math.random()).toString(16)].join("_")},d=function(e){return"https://soundcloud.com/connect?"+u.stringify(e)},p=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];n(this,e),this.id=c(),this.options=t,this.options.state=this.id,this.width=420,this.height=670,this.deferred=i()}return o(e,[{key:"open",value:function(){var e=d(this.options);return this.popup=s.open(e,this.width,this.height),a.set(this.id,this),this.deferred.promise}},{key:"handleConnectResponse",value:function(e){var t=e.error;t?this.deferred.reject(e):this.deferred.resolve(e),this.popup.close()}}]),e}();e.exports=p},function(e,t){"use strict";e.exports={open:function(e,t,r){var n={},o=void 0;return n.location=1,n.width=t,n.height=r,n.left=window.screenX+(window.outerWidth-t)/2,n.top=window.screenY+(window.outerHeight-r)/2,n.toolbar="no",n.scrollbars="yes",o=Object.keys(n).map(function(e){return e+"="+n[e]}).join(", "),window.open(e,n.name,o)}}},function(e,t,r){"use strict";var n=r(19),o=r(1).MaestroCore,i=o.errors.PlayerFatalError,a=o.State,s=r(1).SCAudio.errors,u=s.NoStreamsError,l=s.NotSupportedError,c=1e3/60;e.exports=function(e){function t(){switch(e.getState()){case a.PLAYING:return"playing";case a.PAUSED:return e.isEnded()?"ended":"paused";case a.DEAD:return e.getFatalError()?"error":"dead";case a.LOADING:default:return"loading"}}function r(){function t(){window.clearTimeout(r),e.isPlaying()&&!e.isEnded()&&(r=window.setTimeout(t,c));var o=e.getPosition();o!==n&&(n=o,s.trigger("time",o))}var r=0,n=null;e.onChange.subscribe(function(e){var n=e.playing,o=e.seeking,i=e.dead;i?window.clearTimeout(r):void 0===n&&void 0===o||t()})}var o=!1;e.onStateChange.subscribe(function(){return s.trigger("state-change",t())}),e.onPlay.subscribe(function(){s.trigger(o?"play-resume":"play-start"),o=!0}),e.onPlayIntent.subscribe(function(){return s.trigger("play")}),e.onPlayRejection.subscribe(function(e){return s.trigger("play-rejection",e)}),e.onPauseIntent.subscribe(function(){return s.trigger("pause")}),e.onSeek.subscribe(function(){return s.trigger("seeked")}),e.onSeekRejection.subscribe(function(e){return s.trigger("seek-rejection",e)}),e.onLoadStart.subscribe(function(){return s.trigger("buffering_start")}),e.onLoadEnd.subscribe(function(){return s.trigger("buffering_end")}),e.onEnded.subscribe(function(){return s.trigger("finish")}),e.onError.subscribe(function(e){e instanceof u?s.trigger("no_streams"):e instanceof l?s.trigger("no_protocol"):e instanceof i&&s.trigger("audio_error")});var s={play:e.play.bind(e),pause:e.pause.bind(e),seek:e.seek.bind(e),getVolume:e.getVolume.bind(e),setVolume:e.setVolume.bind(e),currentTime:e.getPosition.bind(e),getDuration:e.getDuration.bind(e),isBuffering:e.isLoading.bind(e),isPlaying:e.isPlaying.bind(e),isActuallyPlaying:e.isActuallyPlaying.bind(e),isEnded:e.isEnded.bind(e),isDead:e.isDead.bind(e),kill:e.kill.bind(e),hasErrored:function(){return!!e.getFatalError()},getState:t};return n.mixin(s),r(),s}},function(e,t){(function(t){"use strict";var r=t.AudioContext||t.webkitAudioContext,n=null;e.exports=function(){return n?n:n=new r}}).call(t,function(){return this}())},function(e,t){(function(t){"use strict";var r=t.navigator.getUserMedia||t.navigator.webkitGetUserMedia||t.navigator.mozGetUserMedia;e.exports=function(e,n,o){r.call(t.navigator,e,n,o)}}).call(t,function(){return this}())},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=r(14),a=r(15),s=r(2).Promise,u=r(28),l=function(){var e=this,t=this.context;return new s(function(r,n){e.source?e.source instanceof AudioNode?r(e.source):n(new Error("source needs to be an instance of AudioNode")):a({audio:!0},function(n){e.stream=n,e.source=t.createMediaStreamSource(n),r(e.source)}.bind(e),n)})},c=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];n(this,e),this.context=t.context||i(),this._recorder=null,this.source=t.source,this.stream=null}return o(e,[{key:"start",value:function(){var e=this;return l.call(this).then(function(t){return e._recorder=new u(t),e._recorder.record(),t})}},{key:"stop",value:function(){if(this._recorder&&this._recorder.stop(),this.stream)if(this.stream.stop)this.stream.stop();else if(this.stream.getTracks){var e=this.stream.getTracks()[0];e&&e.stop()}}},{key:"getBuffer",value:function(){var e=this;return new s(function(t,r){e._recorder?e._recorder.getBuffer(function(r){var n=e.context.sampleRate,o=e.context.createBuffer(2,r[0].length,n);o.getChannelData(0).set(r[0]),o.getChannelData(1).set(r[1]),t(o)}.bind(e)):r(new Error("Nothing has been recorded yet."))})}},{key:"getWAV",value:function(){var e=this;return new s(function(t,r){e._recorder?e._recorder.exportWAV(function(e){t(e)}):r(new Error("Nothing has been recorded yet."))})}},{key:"play",value:function(){var e=this;return this.getBuffer().then(function(t){var r=e.context.createBufferSource();return r.buffer=t,r.connect(e.context.destination),r.start(0),r})}},{key:"saveAs",value:function(e){return this.getWAV().then(function(t){u.forceDownload(t,e)})}},{key:"delete",value:function(){this._recorder&&(this._recorder.stop(),this._recorder.clear(),this._recorder=null),this.stream&&this.stream.stop()}}]),e}();e.exports=c},function(e,t,r){"use strict";var n=r(4),o=r(3),i=r(13),a=r(1).SCAudio,s=r(1).MaestroCore.logger,u=r(1).SCAudioPublicApiStreamURLRetriever.StreamUrlRetriever,l=r(1).SCAudioControllerHTML5Player.MediaElementManager,c=r(1).SCAudioControllerHTML5Player.HTML5PlayerController,d=r(1).SCAudioControllerHLSMSEPlayer.HLSMSEPlayerController,p=r(1).MaestroLoaders.stringLoader,f=new l("audio",s.noOpLogger);e.exports=function(e,t){var r=t?{secret_token:t}:{};return n.request("GET",e,r).then(function(e){function r(){var r=n+"/tracks/"+encodeURIComponent(e.id)+"/plays?client_id="+encodeURIComponent(l);t&&(r+="&secret_token="+encodeURIComponent(t));var o=new XMLHttpRequest;o.open("POST",r,!0),o.send()}var n=o.get("baseURL"),l=o.get("client_id"),h=o.get("oauth_token"),_=!1,g=new u({clientId:l,secretToken:t,trackId:e.id,requestAuthorization:h?"OAuth "+h:null,loader:p}),y=new a.Player({controllers:[new d(f),new c(f)],streamUrlRetriever:g,getURLOpts:{preview:"SNIP"===e.policy},streamUrlsExpire:!0,mediaSessionEnabled:!0,logger:s.noOpLogger});return y.onPlay.subscribe(function(){_||(_=!0,r())}),y.onEnded.subscribe(function(){y.pause()}),y.onPlayIntent.subscribe(function(){y.isEnded()&&y.seek(0)}),i(y)})},e.exports.activateAudioElement=function(){f.activate()}},function(e,t,r){!function(){function r(){return{keys:Object.keys||function(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("keys() called on a non-object");var t,r=[];for(t in e)e.hasOwnProperty(t)&&(r[r.length]=t);return r},uniqueId:function(e){var t=++s+"";return e?e+t:t},has:function(e,t){return i.call(e,t)},each:function(e,t,r){if(null!=e)if(o&&e.forEach===o)e.forEach(t,r);else if(e.length===+e.length)for(var n=0,i=e.length;n<i;n++)t.call(r,e[n],n,e);else for(var a in e)this.has(e,a)&&t.call(r,e[a],a,e)},once:function(e){var t,r=!1;return function(){return r?t:(r=!0,t=e.apply(this,arguments),e=null,t)}}}}var n,o=Array.prototype.forEach,i=Object.prototype.hasOwnProperty,a=Array.prototype.slice,s=0,u=r();n={on:function(e,t,r){if(!c(this,"on",e,[t,r])||!t)return this;this._events||(this._events={});var n=this._events[e]||(this._events[e]=[]);return n.push({callback:t,context:r,ctx:r||this}),this},once:function(e,t,r){if(!c(this,"once",e,[t,r])||!t)return this;var n=this,o=u.once(function(){n.off(e,o),t.apply(this,arguments)});return o._callback=t,this.on(e,o,r)},off:function(e,t,r){var n,o,i,a,s,l,d,p;if(!this._events||!c(this,"off",e,[t,r]))return this;if(!e&&!t&&!r)return this._events={},this;for(a=e?[e]:u.keys(this._events),s=0,l=a.length;s<l;s++)if(e=a[s],i=this._events[e]){if(this._events[e]=n=[],t||r)for(d=0,p=i.length;d<p;d++)o=i[d],(t&&t!==o.callback&&t!==o.callback._callback||r&&r!==o.context)&&n.push(o);n.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=a.call(arguments,1);if(!c(this,"trigger",e,t))return this;var r=this._events[e],n=this._events.all;return r&&d(r,t),n&&d(n,arguments),this},stopListening:function(e,t,r){var n=this._listeners;if(!n)return this;var o=!t&&!r;"object"==typeof t&&(r=this),e&&((n={})[e._listenerId]=e);for(var i in n)n[i].off(t,r,this),o&&delete this._listeners[i];return this}};var l=/\s+/,c=function(e,t,r,n){if(!r)return!0;if("object"==typeof r){for(var o in r)e[t].apply(e,[o,r[o]].concat(n));return!1}if(l.test(r)){for(var i=r.split(l),a=0,s=i.length;a<s;a++)e[t].apply(e,[i[a]].concat(n));return!1}return!0},d=function(e,t){var r,n=-1,o=e.length,i=t[0],a=t[1],s=t[2];switch(t.length){case 0:for(;++n<o;)(r=e[n]).callback.call(r.ctx);return;case 1:for(;++n<o;)(r=e[n]).callback.call(r.ctx,i);return;case 2:for(;++n<o;)(r=e[n]).callback.call(r.ctx,i,a);return;case 3:for(;++n<o;)(r=e[n]).callback.call(r.ctx,i,a,s);return;default:for(;++n<o;)(r=e[n]).callback.apply(r.ctx,t)}},p={listenTo:"on",listenToOnce:"once"};u.each(p,function(e,t){n[t]=function(t,r,n){var o=this._listeners||(this._listeners={}),i=t._listenerId||(t._listenerId=u.uniqueId("l"));return o[i]=t,"object"==typeof r&&(n=this),t[e](r,n,this),this}}),n.bind=n.on,n.unbind=n.off,n.mixin=function(e){var t=["on","once","off","trigger","stopListening","listenTo","listenToOnce","bind","unbind"];return u.each(t,function(t){e[t]=this[t]},this),e},"undefined"!=typeof e&&e.exports&&(t=e.exports=n),t.BackboneEvents=n}(this)},function(e,t,r){e.exports=r(18)},function(e,t){e.exports={encode:function(e,t){function r(e){return e.filter(function(e){return"string"==typeof e&&e.length}).join("&")}function n(e){var t=Object.keys(e);return d?t.sort():t}function o(e,t){var o=":name[:prop]";return r(n(t).map(function(r){return a(o.replace(/:name/,e).replace(/:prop/,r),t[r])}))}function i(e,t){var n=":name[]";return r(t.map(function(t){return a(n.replace(/:name/,e),t)}))}function a(e,t){var r=/%20/g,n=encodeURIComponent,a=typeof t,s=null;return Array.isArray(t)?s=i(e,t):"string"===a?s=n(e)+"="+u(t):"number"===a?s=n(e)+"="+n(t).replace(r,"+"):"boolean"===a?s=n(e)+"="+t:"object"===a&&(null!==t?s=o(e,t):c||(s=n(e)+"=null")),s}function s(e){return"%"+("0"+e.charCodeAt(0).toString(16)).slice(-2).toUpperCase()}function u(e){return e.replace(/[^ !'()~\*]*/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,s)}var l="object"==typeof t?t:{},c=l.ignorenull||!1,d=l.sorted||!1;return r(n(e).map(function(t){return a(t,e[t])}))}}},function(e,t,r){(function(e,t){!function(e,r){"use strict";function n(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var n={callback:e,args:t};return _[h]=n,f(h),h++}function o(e){delete _[e]}function i(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(r,n)}}function a(e){if(g)setTimeout(a,0,e);else{var t=_[e];if(t){g=!0;try{i(t)}finally{o(e),g=!1}}}}function s(){f=function(e){t.nextTick(function(){a(e)})}}function u(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}function l(){var t="setImmediate$"+Math.random()+"$",r=function(r){r.source===e&&"string"==typeof r.data&&0===r.data.indexOf(t)&&a(+r.data.slice(t.length))};e.addEventListener?e.addEventListener("message",r,!1):e.attachEvent("onmessage",r),f=function(r){e.postMessage(t+r,"*")}}function c(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;a(t)},f=function(t){e.port2.postMessage(t)}}function d(){var e=y.documentElement;f=function(t){var r=y.createElement("script");r.onreadystatechange=function(){a(t),r.onreadystatechange=null,e.removeChild(r),r=null},e.appendChild(r)}}function p(){f=function(e){setTimeout(a,0,e)}}if(!e.setImmediate){var f,h=1,_={},g=!1,y=e.document,v=Object.getPrototypeOf&&Object.getPrototypeOf(e);v=v&&v.setTimeout?v:e,"[object process]"==={}.toString.call(e.process)?s():u()?l():e.MessageChannel?c():y&&"onreadystatechange"in y.createElement("script")?d():p(),v.setImmediate=n,v.clearImmediate=o}}("undefined"==typeof self?"undefined"==typeof e?this:e:self)}).call(t,function(){return this}(),r(6))},function(e,t){"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t,r){(function(e){function n(e,t){this._id=e,this._clearFn=t}var o="undefined"!=typeof e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;t.setTimeout=function(){return new n(i.call(setTimeout,o,arguments),clearTimeout)},t.setInterval=function(){return new n(i.call(setInterval,o,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(o,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},r(21),t.setImmediate="undefined"!=typeof self&&self.setImmediate||"undefined"!=typeof e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||"undefined"!=typeof e&&e.clearImmediate||this&&this.clearImmediate}).call(t,function(){return this}())},function(e,t){var r=window.URL||window.webkitURL;e.exports=function(e,t){try{try{var n;try{var o=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;n=new o,n.append(e),n=n.getBlob()}catch(t){n=new Blob([e])}return new Worker(r.createObjectURL(n))}catch(t){return new Worker("data:application/javascript,"+encodeURIComponent(e))}}catch(e){return new Worker(t)}}},function(e,t,r){e.exports=function(){return r(26)('!function(t){function n(r){if(e[r])return e[r].exports;var a=e[r]={exports:{},id:r,loaded:!1};return t[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n){(function(t){function n(t){h=t.sampleRate,v=t.numChannels,s()}function e(t){for(var n=0;n<v;n++)p[n].push(t[n]);g+=t[0].length}function r(t){for(var n=[],e=0;e<v;e++)n.push(i(p[e],g));if(2===v)var r=f(n[0],n[1]);else var r=n[0];var a=l(r),o=new Blob([a],{type:t});this.postMessage(o)}function a(){for(var t=[],n=0;n<v;n++)t.push(i(p[n],g));this.postMessage(t)}function o(){g=0,p=[],s()}function s(){for(var t=0;t<v;t++)p[t]=[]}function i(t,n){for(var e=new Float32Array(n),r=0,a=0;a<t.length;a++)e.set(t[a],r),r+=t[a].length;return e}function f(t,n){for(var e=t.length+n.length,r=new Float32Array(e),a=0,o=0;a<e;)r[a++]=t[o],r[a++]=n[o],o++;return r}function c(t,n,e){for(var r=0;r<e.length;r++,n+=2){var a=Math.max(-1,Math.min(1,e[r]));t.setInt16(n,a<0?32768*a:32767*a,!0)}}function u(t,n,e){for(var r=0;r<e.length;r++)t.setUint8(n+r,e.charCodeAt(r))}function l(t){var n=new ArrayBuffer(44+2*t.length),e=new DataView(n);return u(e,0,"RIFF"),e.setUint32(4,36+2*t.length,!0),u(e,8,"WAVE"),u(e,12,"fmt "),e.setUint32(16,16,!0),e.setUint16(20,1,!0),e.setUint16(22,v,!0),e.setUint32(24,h,!0),e.setUint32(28,4*h,!0),e.setUint16(32,2*v,!0),e.setUint16(34,16,!0),u(e,36,"data"),e.setUint32(40,2*t.length,!0),c(e,44,t),e}var h,v,g=0,p=[];t.onmessage=function(t){switch(t.data.command){case"init":n(t.data.config);break;case"record":e(t.data.buffer);break;case"exportWAV":r(t.data.type);break;case"getBuffer":a();break;case"clear":o()}}}).call(n,function(){return this}())}]);\n//# sourceMappingURL=9f9aac32c9a7432b5555.worker.js.map',r.p+"9f9aac32c9a7432b5555.worker.js")}},function(e,t,r){var n=r(27),o=function(e,t){var r=t||{},o=r.bufferLen||4096,i=r.numChannels||2;this.context=e.context,this.node=(this.context.createScriptProcessor||this.context.createJavaScriptNode).call(this.context,o,i,i);var a=new n;a.postMessage({command:"init",config:{sampleRate:this.context.sampleRate,numChannels:i}});var s,u=!1;this.node.onaudioprocess=function(e){if(u){for(var t=[],r=0;r<i;r++)t.push(e.inputBuffer.getChannelData(r));a.postMessage({command:"record",buffer:t})}},this.configure=function(e){for(var t in e)e.hasOwnProperty(t)&&(r[t]=e[t])},this.record=function(){u=!0},this.stop=function(){u=!1},this.clear=function(){a.postMessage({command:"clear"})},this.getBuffer=function(e){s=e||r.callback,a.postMessage({command:"getBuffer"})},this.exportWAV=function(e,t){if(s=e||r.callback,t=t||r.type||"audio/wav",!s)throw new Error("Callback not set");a.postMessage({command:"exportWAV",type:t})},a.onmessage=function(e){var t=e.data;s(t)},e.connect(this.node),this.node.connect(this.context.destination)};o.forceDownload=function(e,t){var r=(window.URL||window.webkitURL).createObjectURL(e),n=window.document.createElement("a");n.href=r,n.download=t||"output.wav";var o=document.createEvent("Event");o.initEvent("click",!0,!0),n.dispatchEvent(o)},e.exports=o},function(e,t){}])});
23876
+ //# sourceMappingURL=sdk.js.map
23738
23877
 
23739
23878
  /***/ }),
23740
23879
  /* 172 */