xgplayer 2.31.4 → 2.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/bin/xgplayer.js +0 -0
  3. package/browser/controls/danmu.js +1 -1
  4. package/browser/controls/definition.js +1 -1
  5. package/browser/controls/errorRetry.js +1 -1
  6. package/browser/controls/memoryPlay.js +1 -1
  7. package/browser/controls/miniplayer.js +4 -4
  8. package/browser/controls/nativeTextTrack.js +1 -1
  9. package/browser/controls/pip.js +1 -1
  10. package/browser/controls/progress.js +1 -1
  11. package/browser/core_player.js +1 -1
  12. package/browser/core_player.js.map +1 -1
  13. package/browser/index.js +5 -5
  14. package/browser/index.js.map +1 -1
  15. package/browser/simple_player.js +1 -1
  16. package/browser/simple_player.js.map +1 -1
  17. package/dist/controls/danmu.js +1 -1
  18. package/dist/controls/definition.js +1 -1
  19. package/dist/controls/errorRetry.js +1 -1
  20. package/dist/controls/memoryPlay.js +1 -1
  21. package/dist/controls/miniplayer.js +4 -4
  22. package/dist/controls/nativeTextTrack.js +1 -1
  23. package/dist/controls/pip.js +1 -1
  24. package/dist/controls/progress.js +1 -1
  25. package/dist/core_player.js +12 -7
  26. package/dist/core_player.js.map +1 -1
  27. package/dist/index.js +583 -524
  28. package/dist/index.js.map +1 -1
  29. package/dist/simple_player.js +27 -11
  30. package/dist/simple_player.js.map +1 -1
  31. package/es/controls/danmu.js +1 -1
  32. package/es/controls/definition.js +1 -1
  33. package/es/controls/errorRetry.js +1 -1
  34. package/es/controls/memoryPlay.js +1 -1
  35. package/es/controls/miniplayer.js +4 -4
  36. package/es/controls/nativeTextTrack.js +1 -1
  37. package/es/controls/pip.js +1 -1
  38. package/es/controls/progress.js +1 -1
  39. package/es/core_player.js +1 -1
  40. package/es/core_player.js.map +1 -1
  41. package/es/index.js +7 -7
  42. package/es/index.js.map +1 -1
  43. package/es/simple_player.js +1 -1
  44. package/es/simple_player.js.map +1 -1
  45. package/package.json +2 -2
  46. package/src/controls/memoryPlay.js +4 -1
  47. package/src/controls/pip.js +3 -1
  48. package/src/player.js +6 -6
  49. package/src/proxy.js +3 -0
  50. package/src/skin/controls/definition.js +1 -0
  51. package/src/skin/controls/memoryPlay.js +1 -1
  52. package/src/skin/controls/playNext.js +1 -1
  53. package/src/skin/controls/progress.js +17 -6
  54. package/version.json +1 -1
  55. package/browser/controls.js.map +0 -1
  56. package/browser/player.js.map +0 -1
  57. package/dist/controls.js.map +0 -1
  58. package/dist/player.js.map +0 -1
package/dist/index.js CHANGED
@@ -1221,7 +1221,7 @@ module.exports = exports["default"];
1221
1221
  /* 8 */
1222
1222
  /***/ (function(module) {
1223
1223
 
1224
- module.exports = JSON.parse("{\"version\":\"2.31.4\"}");
1224
+ module.exports = JSON.parse("{\"version\":\"2.32.0\"}");
1225
1225
 
1226
1226
  /***/ }),
1227
1227
  /* 9 */
@@ -1659,12 +1659,12 @@ var Player = function (_Proxy) {
1659
1659
  (0, _allOff2.default)(this);
1660
1660
  }
1661
1661
 
1662
- if (!this.paused) {
1663
- this.pause();
1664
- this.once('pause', destroyFunc);
1665
- } else {
1666
- destroyFunc.call(this);
1667
- }
1662
+ // destroy immediately
1663
+ // Don't use the paused property detection, it doesn't use MediaElement.paused,
1664
+ // so it's not accurate enough. Destroy after waiting for pause event, this
1665
+ // changes the synchronous behavior of destroy api
1666
+ destroyFunc.call(this);
1667
+
1668
1668
  _get(Player.prototype.__proto__ || Object.getPrototypeOf(Player.prototype), 'destroy', this).call(this);
1669
1669
  }
1670
1670
  }, {
@@ -2703,6 +2703,11 @@ var Proxy = function () {
2703
2703
  get: function get() {
2704
2704
  return (0, _util.hasClass)(this.root, 'xgplayer-pip-active');
2705
2705
  }
2706
+ }, {
2707
+ key: 'isMiniPlayer',
2708
+ get: function get() {
2709
+ return (0, _util.hasClass)(this.root, 'xgplayer-miniplayer-active');
2710
+ }
2706
2711
  }]);
2707
2712
 
2708
2713
  return Proxy;
@@ -4730,8 +4735,12 @@ var s_progress = function s_progress() {
4730
4735
  player.config.enableSwipeHandler.call(player);
4731
4736
  });
4732
4737
  };
4733
-
4734
- ['touchstart', 'mousedown'].forEach(function (item) {
4738
+ var events = ['touchstart', 'mousedown'];
4739
+ if (_sniffer2.default.device === 'mobile') {
4740
+ // 解决在移动端触发多次seeking问题
4741
+ events.pop();
4742
+ }
4743
+ events.forEach(function (item) {
4735
4744
  container.addEventListener(item, function (e) {
4736
4745
  if (player.config.disableProgress) return;
4737
4746
  // e.preventDefault()
@@ -4770,6 +4779,7 @@ var s_progress = function s_progress() {
4770
4779
  progress.style.width = w * 100 / containerWidth + '%';
4771
4780
 
4772
4781
  if (player.videoConfig.mediaType === 'video' && !player.dash && !player.config.closeMoveSeek) {
4782
+ console.log('trigger touchmove');
4773
4783
  player.currentTime = Number(now).toFixed(1);
4774
4784
  } else {
4775
4785
  var time = (0, _util.findDom)(player.controls, '.xgplayer-time');
@@ -4795,6 +4805,7 @@ var s_progress = function s_progress() {
4795
4805
  player.emit('focus');
4796
4806
  };
4797
4807
  var up = function up(e) {
4808
+ console.log('up event', e);
4798
4809
  // e.preventDefault()
4799
4810
  e.stopPropagation();
4800
4811
  (0, _util.event)(e);
@@ -4814,6 +4825,7 @@ var s_progress = function s_progress() {
4814
4825
  if (now < 0) now = 0;
4815
4826
  if (player.config.allowSeekPlayed && Number(now).toFixed(1) > player.maxPlayedTime) {} else {
4816
4827
  progress.style.width = w * 100 / containerWidth + '%';
4828
+ console.warn('trigger touchup');
4817
4829
  player.currentTime = Number(now).toFixed(1);
4818
4830
  }
4819
4831
  }
@@ -4823,10 +4835,14 @@ var s_progress = function s_progress() {
4823
4835
  player.emit('focus');
4824
4836
  player.isProgressMoving = false;
4825
4837
  };
4826
- window.addEventListener('mousemove', move);
4838
+ // if (item === 'touchstart') {
4827
4839
  window.addEventListener('touchmove', move, { passive: false });
4828
- window.addEventListener('mouseup', up);
4829
4840
  window.addEventListener('touchend', up);
4841
+ // } else {
4842
+ window.addEventListener('mousemove', move);
4843
+ // console.warn('add envent mouseup')
4844
+ window.addEventListener('mouseup', up);
4845
+ // }
4830
4846
  return true;
4831
4847
  });
4832
4848
  });
@@ -6321,7 +6337,10 @@ Object.defineProperty(exports, "__esModule", {
6321
6337
  var memoryPlay = function memoryPlay() {
6322
6338
  var player = this;
6323
6339
  player.on('memoryPlayStart', function (lastPlayTime) {
6324
- player.currentTime = lastPlayTime;
6340
+ setTimeout(function () {
6341
+ console.log('memoryPlayStart', lastPlayTime, player.readyState, 11);
6342
+ player.currentTime = lastPlayTime;
6343
+ });
6325
6344
  });
6326
6345
  };
6327
6346
 
@@ -6484,7 +6503,7 @@ module.exports = exports['default'];
6484
6503
  /***/ (function(module, exports, __webpack_require__) {
6485
6504
 
6486
6505
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
6487
- * Draggabilly v2.3.0
6506
+ * Draggabilly v2.4.1
6488
6507
  * Make that shiz draggable
6489
6508
  * https://draggabilly.desandro.com
6490
6509
  * MIT license
@@ -7122,7 +7141,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
7122
7141
  /***/ (function(module, exports, __webpack_require__) {
7123
7142
 
7124
7143
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
7125
- * Unidragger v2.3.1
7144
+ * Unidragger v2.4.0
7126
7145
  * Draggable base class
7127
7146
  * MIT license
7128
7147
  */
@@ -7395,7 +7414,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
7395
7414
  /***/ (function(module, exports, __webpack_require__) {
7396
7415
 
7397
7416
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
7398
- * Unipointer v2.3.0
7417
+ * Unipointer v2.4.0
7399
7418
  * base class for doing one thing with pointer event
7400
7419
  * MIT license
7401
7420
  */
@@ -7442,12 +7461,13 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
7442
7461
 
7443
7462
  // default to mouse events
7444
7463
  var startEvent = 'mousedown';
7445
- if (window.PointerEvent) {
7464
+ if ('ontouchstart' in window) {
7465
+ // HACK prefer Touch Events as you can preventDefault on touchstart to
7466
+ // disable scroll in iOS & mobile Chrome metafizzy/flickity#1177
7467
+ startEvent = 'touchstart';
7468
+ } else if (window.PointerEvent) {
7446
7469
  // Pointer Events
7447
7470
  startEvent = 'pointerdown';
7448
- } else if ('ontouchstart' in window) {
7449
- // Touch Events. iOS Safari
7450
- startEvent = 'touchstart';
7451
7471
  }
7452
7472
  elem[bindMethod](startEvent, this);
7453
7473
  };
@@ -7833,10 +7853,12 @@ var pip = function pip() {
7833
7853
  };
7834
7854
 
7835
7855
  player.video.addEventListener('enterpictureinpicture', function (pipWindow) {
7856
+ (0, _util.addClass)(player.root, 'xgplayer-pip-active');
7836
7857
  player.emit('requestPictureInPicture', pipWindow);
7837
7858
  });
7838
7859
 
7839
7860
  player.video.addEventListener('leavepictureinpicture', function () {
7861
+ (0, _util.removeClass)(player.root, 'xgplayer-pip-active');
7840
7862
  player.emit('exitPictureInPicture');
7841
7863
  });
7842
7864
 
@@ -9643,7 +9665,7 @@ module.exports = exports['default'];
9643
9665
  Er = /^\:\:cue/,
9644
9666
  Pr = /^}+$/,
9645
9667
  jr = /^\[Script Info\].*/,
9646
- Mr = [/[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}-->[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}/, /[0-9]{2}:[0-9]{2}\.[0-9]{3}-->[0-9]{2}:[0-9]{2}\.[0-9]{3}/, /[0-9]{2}\.[0-9]{3}-->[0-9]{2}\.[0-9]{3}/],
9668
+ Mr = [/[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,3}:[0-9]{2}:[0-9]{2}\.[0-9]{1,3}/, /[0-9]{1,2}:[0-9]{2}\.[0-9]{1,3}-->[0-9]{1,2}:[0-9]{2}\.[0-9]{1,3}/, /[0-9]{1,2}\.[0-9]{1,3}-->[0-9]{1,2}\.[0-9]{1,3}/],
9647
9669
  Ar = /^Format:\s/,
9648
9670
  Cr = /^Style:\s/,
9649
9671
  Rr = /^Dialogue:\s/,
@@ -10470,6 +10492,7 @@ var s_definition = function s_definition() {
10470
10492
  return a.href === src;
10471
10493
  }
10472
10494
  });
10495
+ console.warn('cursrc:', cursrc, 'src:', src, 'list:', list);
10473
10496
  tmp.push('</ul><p class=\'name\'>' + (cursrc[0] || { name: '' }).name + '</p>');
10474
10497
  var urlInRoot = root.querySelector('.xgplayer-definition');
10475
10498
  if (urlInRoot) {
@@ -11229,6 +11252,7 @@ module.exports = exports['default'];
11229
11252
 
11230
11253
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
11231
11254
 
11255
+ /*! Built @Fri, 02 Sep 2022 13:43:57 GMT */
11232
11256
  !function (e, t) {
11233
11257
  "object" == ( false ? undefined : _typeof(exports)) && "object" == ( false ? undefined : _typeof(module)) ? module.exports = t() : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (t),
11234
11258
  __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
@@ -11259,72 +11283,81 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11259
11283
  }, n.p = "", n(n.s = 4);
11260
11284
  }([function (e, t, n) {
11261
11285
  "use strict";
11262
- Object.defineProperty(t, "__esModule", { value: !0 });var i = { createDom: function createDom() {
11263
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "div",
11264
- t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "",
11265
- n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
11266
- i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "",
11267
- o = document.createElement(e);return o.className = i, o.innerHTML = t, Object.keys(n).forEach(function (t) {
11268
- var i = t,
11269
- r = n[t];"video" === e || "audio" === e ? r && o.setAttribute(i, r) : o.setAttribute(i, r);
11270
- }), o;
11271
- }, hasClass: function hasClass(e, t) {
11272
- return e.classList ? Array.prototype.some.call(e.classList, function (e) {
11273
- return e === t;
11274
- }) : !!e.className.match(new RegExp("(\\s|^)" + t + "(\\s|$)"));
11275
- }, addClass: function addClass(e, t) {
11276
- e.classList ? t.replace(/(^\s+|\s+$)/g, "").split(/\s+/g).forEach(function (t) {
11277
- t && e.classList.add(t);
11278
- }) : i.hasClass(e, t) || (e.className += " " + t);
11279
- }, removeClass: function removeClass(e, t) {
11280
- e.classList ? t.split(/\s+/g).forEach(function (t) {
11281
- e.classList.remove(t);
11282
- }) : i.hasClass(e, t) && t.split(/\s+/g).forEach(function (t) {
11283
- var n = new RegExp("(\\s|^)" + t + "(\\s|$)");e.className = e.className.replace(n, " ");
11284
- });
11285
- }, toggleClass: function toggleClass(e, t) {
11286
- t.split(/\s+/g).forEach(function (t) {
11287
- i.hasClass(e, t) ? i.removeClass(e, t) : i.addClass(e, t);
11288
- });
11289
- }, findDom: function findDom() {
11290
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : document,
11291
- t = arguments[1],
11292
- n = void 0;try {
11293
- n = e.querySelector(t);
11294
- } catch (i) {
11295
- t.startsWith("#") && (n = e.getElementById(t.slice(1)));
11296
- }return n;
11297
- }, deepCopy: function deepCopy(e, t) {
11298
- if ("Object" === i.typeOf(t) && "Object" === i.typeOf(e)) return Object.keys(t).forEach(function (n) {
11299
- "Object" !== i.typeOf(t[n]) || t[n] instanceof Node ? "Array" === i.typeOf(t[n]) ? e[n] = "Array" === i.typeOf(e[n]) ? e[n].concat(t[n]) : t[n] : e[n] = t[n] : e[n] ? i.deepCopy(e[n], t[n]) : e[n] = t[n];
11300
- }), e;
11301
- }, typeOf: function typeOf(e) {
11302
- return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0];
11303
- }, copyDom: function copyDom(e) {
11304
- if (e && 1 === e.nodeType) {
11305
- var t = document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes, function (e) {
11306
- t.setAttribute(e.name, e.value);
11307
- }), e.innerHTML && (t.innerHTML = e.innerHTML), t;
11308
- }return "";
11309
- }, formatTime: function formatTime(e) {
11310
- var t = Math.floor(e);return 1e3 * t + (e - t);
11311
- }, offInDestroy: function offInDestroy(e, t, n, i) {
11286
+ function i(e, t) {
11287
+ return e.classList ? Array.prototype.some.call(e.classList, function (e) {
11288
+ return e === t;
11289
+ }) : !!e.className.match(new RegExp("(\\s|^)" + t + "(\\s|$)"));
11290
+ }function o(e, t) {
11291
+ e.classList ? t.replace(/(^\s+|\s+$)/g, "").split(/\s+/g).forEach(function (t) {
11292
+ t && e.classList.add(t);
11293
+ }) : i(e, t) || (e.className += " " + t);
11294
+ }function r(e, t) {
11295
+ e.classList ? t.split(/\s+/g).forEach(function (t) {
11296
+ e.classList.remove(t);
11297
+ }) : i(e, t) && t.split(/\s+/g).forEach(function (t) {
11298
+ var n = new RegExp("(\\s|^)" + t + "(\\s|$)");e.className = e.className.replace(n, " ");
11299
+ });
11300
+ }function a(e) {
11301
+ return Object.prototype.toString.call(e).match(/([^\s.*]+)(?=]$)/g)[0];
11302
+ }Object.defineProperty(t, "__esModule", { value: !0 }), t.createDom = function () {
11303
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "div",
11304
+ t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "",
11305
+ n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
11306
+ i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "",
11307
+ o = document.createElement(e);return o.className = i, o.innerHTML = t, Object.keys(n).forEach(function (t) {
11308
+ var i = t,
11309
+ r = n[t];"video" === e || "audio" === e ? r && o.setAttribute(i, r) : o.setAttribute(i, r);
11310
+ }), o;
11311
+ }, t.hasClass = i, t.addClass = o, t.removeClass = r, t.toggleClass = function (e, t) {
11312
+ t.split(/\s+/g).forEach(function (t) {
11313
+ i(e, t) ? r(e, t) : o(e, t);
11314
+ });
11315
+ }, t.findDom = function () {
11316
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : document,
11317
+ t = arguments[1],
11318
+ n = void 0;try {
11319
+ n = e.querySelector(t);
11320
+ } catch (i) {
11321
+ t.startsWith("#") && (n = e.getElementById(t.slice(1)));
11322
+ }return n;
11323
+ }, t.deepCopy = function e(t, n) {
11324
+ if ("Object" === a(n) && "Object" === a(t)) return Object.keys(n).forEach(function (i) {
11325
+ "Object" !== a(n[i]) || n[i] instanceof Node ? "Array" === a(n[i]) ? t[i] = "Array" === a(t[i]) ? t[i].concat(n[i]) : n[i] : t[i] = n[i] : t[i] ? e(t[i], n[i]) : t[i] = n[i];
11326
+ }), t;
11327
+ }, t.typeOf = a, t.copyDom = function (e) {
11328
+ if (e && 1 === e.nodeType) {
11329
+ var t = document.createElement(e.tagName);return Array.prototype.forEach.call(e.attributes, function (e) {
11330
+ t.setAttribute(e.name, e.value);
11331
+ }), e.innerHTML && (t.innerHTML = e.innerHTML), t;
11332
+ }return "";
11333
+ }, t.attachEventListener = function (e, t, n, i) {
11334
+ if (i) e.on(t, n), function (e, t, n, i) {
11312
11335
  e.once(i, function o() {
11313
11336
  e.off(t, n), e.off(i, o);
11314
11337
  });
11315
- }, on: function on(e, t, n, o) {
11316
- if (o) e.on(t, n), i.offInDestroy(e, t, n, o);else {
11317
- e.on(t, function i(o) {
11318
- n(o), e.off(t, i);
11319
- });
11320
- }
11321
- }, style: function style(e, t, n) {
11322
- var i = e.style;try {
11323
- i[t] = n;
11324
- } catch (e) {
11325
- i.setProperty(t, n);
11326
- }
11327
- } };t.default = i, e.exports = t.default;
11338
+ }(e, t, n, i);else {
11339
+ e.on(t, function i(o) {
11340
+ n(o), e.off(t, i);
11341
+ });
11342
+ }
11343
+ }, t.styleUtil = function (e, t, n) {
11344
+ var i = e.style;try {
11345
+ i[t] = n;
11346
+ } catch (e) {
11347
+ i.setProperty(t, n);
11348
+ }
11349
+ }, t.isNumber = function (e) {
11350
+ return "number" == typeof e && !Number.isNaN(e);
11351
+ }, t.throttle = function (e, t) {
11352
+ var n = this,
11353
+ i = 0;return function () {
11354
+ for (var o = arguments.length, r = Array(o), a = 0; a < o; a++) {
11355
+ r[a] = arguments[a];
11356
+ }clearTimeout(i), i = setTimeout(function () {
11357
+ return e.apply(n, r);
11358
+ }, t);
11359
+ };
11360
+ };t.hasOwnProperty = Object.prototype.hasOwnProperty;
11328
11361
  }, function (e, t, n) {
11329
11362
  "use strict";
11330
11363
  Object.defineProperty(t, "__esModule", { value: !0 });var i,
@@ -11349,7 +11382,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11349
11382
  }();t.default = s, e.exports = t.default;
11350
11383
  }, function (e, t, n) {
11351
11384
  "use strict";
11352
- var i = n(19)();e.exports = function (e) {
11385
+ var i = n(18)();e.exports = function (e) {
11353
11386
  return e !== i && null !== e;
11354
11387
  };
11355
11388
  }, function (e, t, n) {
@@ -11357,16 +11390,14 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11357
11390
  e.exports = function (e) {
11358
11391
  return null != e;
11359
11392
  };
11360
- }, function (e, t, n) {
11361
- e.exports = n(5);
11362
11393
  }, function (e, t, n) {
11363
11394
  "use strict";
11364
11395
  Object.defineProperty(t, "__esModule", { value: !0 });var i,
11365
- o = n(6),
11396
+ o = n(5),
11366
11397
  r = (i = o) && i.__esModule ? i : { default: i };n(34), t.default = r.default, e.exports = t.default;
11367
11398
  }, function (e, t, n) {
11368
11399
  "use strict";
11369
- Object.defineProperty(t, "__esModule", { value: !0 });var i = function () {
11400
+ Object.defineProperty(t, "__esModule", { value: !0 }), t.DanmuJs = void 0;var i = function () {
11370
11401
  function e(e, t) {
11371
11402
  for (var n = 0; n < t.length; n++) {
11372
11403
  var i = t[n];i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i);
@@ -11375,103 +11406,147 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11375
11406
  return n && e(t.prototype, n), i && e(t, i), t;
11376
11407
  };
11377
11408
  }(),
11378
- o = f(n(7)),
11379
- r = f(n(1)),
11380
- a = f(n(27)),
11381
- s = f(n(31)),
11382
- l = f(n(0)),
11383
- u = n(32),
11384
- c = n(33);function f(e) {
11409
+ o = f(n(6)),
11410
+ r = n(25),
11411
+ a = f(n(1)),
11412
+ s = f(n(27)),
11413
+ l = f(n(32)),
11414
+ u = n(33),
11415
+ c = n(0);function f(e) {
11385
11416
  return e && e.__esModule ? e : { default: e };
11386
11417
  }function h(e, t) {
11387
11418
  if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !t || "object" != (typeof t === "undefined" ? "undefined" : _typeof(t)) && "function" != typeof t ? e : t;
11388
- }var d = function (e) {
11419
+ }var d = t.DanmuJs = function (e) {
11389
11420
  function t(e) {
11390
11421
  !function (e, t) {
11391
11422
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
11392
- }(this, t);var n = h(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));n.setLogger("danmu"), n.logger && n.logger.info("danmu.js version: " + u.version);var i = n;if (i.config = l.default.deepCopy({ overlap: !1, area: { start: 0, end: 1 }, live: !1, comments: [], direction: "r2l", needResizeObserver: !1 }, e), i.hideArr = [], i.domObj = new s.default(), (0, o.default)(i), i.config.comments.forEach(function (e) {
11423
+ }(this, t);var n = h(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)),
11424
+ i = n;i.setLogger("danmu"), i.logger && i.logger.info("danmu.js version: " + r.version);var a = i.config = { overlap: !1, area: { start: 0, end: 1, lines: void 0 }, live: !1, comments: [], direction: "r2l", needResizeObserver: !1, dropStaleComments: !1, channelSize: void 0, maxCommentsLength: void 0, bulletOffset: void 0, interval: 2e3 };if ((0, c.deepCopy)(a, e), (0, o.default)(i), i.hideArr = [], i.domObj = new l.default(), i.freezeId = null, a.comments.forEach(function (e) {
11393
11425
  e.duration = e.duration ? e.duration : 5e3, e.mode || (e.mode = "scroll");
11394
- }), !i.config.container || 1 !== i.config.container.nodeType) return i.emit("error", "container id can't be empty"), !1, h(n, !1);if (i.container = i.config.container, i.config.containerStyle) {
11395
- var r = i.config.containerStyle;Object.keys(r).forEach(function (e) {
11396
- i.container.style[e] = r[e];
11426
+ }), i.container = a.container && 1 === a.container.nodeType ? a.container : null, !i.container) return i.emit("error", "container id can't be empty"), !1, h(n, !1);if (a.containerStyle) {
11427
+ var u = a.containerStyle;Object.keys(u).forEach(function (e) {
11428
+ i.container.style[e] = u[e];
11397
11429
  });
11398
- }return i.live = i.config.live, i.player = i.config.player, i.direction = i.config.direction, l.default.addClass(i.container, "danmu"), i.bulletBtn = new a.default(i), i.isReady = !0, i.emit("ready"), n.logger && n.logger.info("ready"), n.addResizeObserver(), n;
11430
+ }return i.live = a.live, i.player = a.player, i.direction = a.direction, (0, c.addClass)(i.container, "danmu"), i.bulletBtn = new s.default(i), i.main = i.bulletBtn.main, i.isReady = !0, i.emit("ready"), n.logger && n.logger.info("ready"), n.addResizeObserver(), n;
11399
11431
  }return function (e, t) {
11400
11432
  if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (typeof t === "undefined" ? "undefined" : _typeof(t)));e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
11401
11433
  }(t, e), i(t, [{ key: "addResizeObserver", value: function value() {
11402
- var e = this;this.config.needResizeObserver && (0, c.addObserver)(this.container, function () {
11434
+ var e = this;this.config.needResizeObserver && (0, u.addObserver)(this.container, function () {
11403
11435
  e.logger && e.logger.info("needResizeObserver"), e.resize();
11404
11436
  });
11405
11437
  } }, { key: "start", value: function value() {
11406
- this.logger && this.logger.info("start"), this.bulletBtn.main.start();
11438
+ this.logger && this.logger.info("start"), this.main.start();
11407
11439
  } }, { key: "pause", value: function value() {
11408
- this.logger && this.logger.info("pause"), this.bulletBtn.main.pause();
11440
+ this.logger && this.logger.info("pause"), this.main.pause();
11409
11441
  } }, { key: "play", value: function value() {
11410
- this.logger && this.logger.info("play"), this.bulletBtn.main.play();
11442
+ this.logger && this.logger.info("play"), this.main.play();
11411
11443
  } }, { key: "stop", value: function value() {
11412
- this.logger && this.logger.info("stop"), this.bulletBtn.main.stop();
11444
+ this.logger && this.logger.info("stop"), this.main.stop();
11413
11445
  } }, { key: "clear", value: function value() {
11414
- this.logger && this.logger.info("clear"), this.bulletBtn.main.clear();
11446
+ this.logger && this.logger.info("clear"), this.main.clear();
11415
11447
  } }, { key: "destroy", value: function value() {
11416
- for (var e in (0, c.unObserver)(this.container), this.logger && this.logger.info("destroy"), this.stop(), this.bulletBtn.destroy(), this.domObj.destroy(), this) {
11448
+ for (var e in (0, u.unObserver)(this.container), this.logger && this.logger.info("destroy"), this.stop(), this.bulletBtn.destroy(), this.domObj.destroy(), this) {
11417
11449
  delete this[e];
11418
11450
  }this.emit("destroy");
11419
11451
  } }, { key: "sendComment", value: function value(e) {
11420
- this.logger && this.logger.info("sendComment: " + (e.txt || "[DOM Element]")), e.duration || (e.duration = 15e3), e && e.id && e.duration && (e.el || e.txt) && (e.duration = e.duration ? e.duration : 5e3, e.style || (e.style = { opacity: void 0, fontSize: void 0 }), e.style && (this.opacity && this.opacity !== e.style.opacity && (e.style.opacity = this.opacity), this.fontSize && this.fontSize !== e.style.fontSize && (e.style.fontSize = this.fontSize), this.like && (e.like = e.like ? e.like : this.like)), e.prior || e.realTime ? (this.bulletBtn.main.data.unshift(e), e.realTime && (this.bulletBtn.main.readData(), this.bulletBtn.main.dataHandle())) : this.bulletBtn.main.data.push(e));
11452
+ this.logger && this.logger.info("sendComment: " + (e.txt || "[DOM Element]")), e.duration || (e.duration = 15e3), e && e.id && e.duration && (e.el || e.txt) && (e.duration = e.duration ? e.duration : 5e3, e.style || (e.style = { opacity: void 0, fontSize: void 0 }), e.style && (this.opacity && this.opacity !== e.style.opacity && (e.style.opacity = this.opacity), this.fontSize && this.fontSize !== e.style.fontSize && (e.style.fontSize = this.fontSize)), e.prior || e.realTime ? (this.main.data.unshift(e), e.realTime && (this.main.readData(), this.main.dataHandle())) : this.main.data.push(e));
11421
11453
  } }, { key: "setCommentID", value: function value(e, t) {
11422
- var n = this;this.logger && this.logger.info("setCommentID: oldID " + e + " newID " + t);var i = this.container.getBoundingClientRect();e && t && (this.bulletBtn.main.data.some(function (n) {
11454
+ var n = this;this.logger && this.logger.info("setCommentID: oldID " + e + " newID " + t), e && t && (this.main.data.some(function (n) {
11423
11455
  return n.id === e && (n.id = t, !0);
11424
- }), this.bulletBtn.main.queue.some(function (o) {
11425
- return o.id === e && (o.id = t, o.pauseMove(i), "paused" !== n.bulletBtn.main.status && o.startMove(i), !0);
11456
+ }), this.main.queue.some(function (i) {
11457
+ return i.id === e && (i.id = t, i.pauseMove(), "paused" !== n.main.status && i.startMove(), !0);
11426
11458
  }));
11427
11459
  } }, { key: "setCommentDuration", value: function value(e, t) {
11428
- var n = this;this.logger && this.logger.info("setCommentDuration: id " + e + " duration " + t);var i = this.container.getBoundingClientRect();e && t && (t = t || 5e3, this.bulletBtn.main.data.some(function (n) {
11460
+ var n = this;this.logger && this.logger.info("setCommentDuration: id " + e + " duration " + t), e && t && (t = t || 5e3, this.main.data.some(function (n) {
11429
11461
  return n.id === e && (n.duration = t, !0);
11430
- }), this.bulletBtn.main.queue.some(function (o) {
11431
- return o.id === e && (o.duration = t, o.pauseMove(i), "paused" !== n.bulletBtn.main.status && o.startMove(i), !0);
11462
+ }), this.main.queue.some(function (i) {
11463
+ return i.id === e && (i.duration = t, i.pauseMove(), "paused" !== n.main.status && i.startMove(), !0);
11432
11464
  }));
11433
11465
  } }, { key: "setCommentLike", value: function value(e, t) {
11434
- this.logger && this.logger.info("setCommentLike: id " + e + " like " + t);var n = this.container.getBoundingClientRect();this.like = t, e && t && (this.bulletBtn.main.data.some(function (n) {
11466
+ this.logger && this.logger.info("setCommentLike: id " + e + " like " + t), e && t && (this.main.data.some(function (n) {
11435
11467
  return n.id === e && (n.like = t, !0);
11436
- }), this.bulletBtn.main.queue.some(function (i) {
11437
- return i.id === e && (i.pauseMove(n), i.setLikeDom(t.el, t.style), "paused" !== i.danmu.bulletBtn.main.status && i.startMove(n), !0);
11468
+ }), this.main.queue.some(function (n) {
11469
+ return n.id === e && (n.pauseMove(), n.setLikeDom(t.el, t.style), "paused" !== n.danmu.main.status && n.startMove(), !0);
11438
11470
  }));
11439
11471
  } }, { key: "restartComment", value: function value(e) {
11440
- this.logger && this.logger.info("restartComment: id " + e), this.mouseControl = !1;var t = this.container.getBoundingClientRect();e && this.bulletBtn.main.queue.some(function (n) {
11441
- return n.id === e && ("paused" !== n.danmu.bulletBtn.main.status ? n.startMove(t, !0) : n.status = "paused", !0);
11442
- });
11472
+ if (this.logger && this.logger.info("restartComment: id " + e), e) {
11473
+ var t = this.main;if (this._releaseCtrl(e), "closed" === t.status) return;t.queue.some(function (n) {
11474
+ return n.id === e && ("paused" !== t.status ? n.startMove(!0) : n.status = "paused", !0);
11475
+ });
11476
+ }
11477
+ } }, { key: "_releaseCtrl", value: function value(e) {
11478
+ this.freezeId && e == this.freezeId && (this.mouseControl = !1, this.freezeId = null);
11479
+ } }, { key: "_freezeCtrl", value: function value(e) {
11480
+ this.mouseControl = !0, this.freezeId = e;
11443
11481
  } }, { key: "freezeComment", value: function value(e) {
11444
- this.logger && this.logger.info("freezeComment: id " + e), this.mouseControl = !0;var t = this.container.getBoundingClientRect();e && this.bulletBtn.main.queue.some(function (n) {
11445
- return n.id === e && (n.status = "forcedPause", n.pauseMove(t), n.el && n.el.style && l.default.style(n.el, "zIndex", 10), !0);
11446
- });
11482
+ if (this.logger && this.logger.info("freezeComment: id " + e), e) {
11483
+ this._freezeCtrl(e), this.main.queue.some(function (t) {
11484
+ return t.id === e && (t.status = "forcedPause", t.pauseMove(), t.el && t.el.style && (0, c.styleUtil)(t.el, "zIndex", 10), !0);
11485
+ });
11486
+ }
11447
11487
  } }, { key: "removeComment", value: function value(e) {
11448
- this.logger && this.logger.info("removeComment: id " + e), e && (this.bulletBtn.main.queue.some(function (t) {
11449
- return t.id === e && (t.remove(), !0);
11450
- }), this.bulletBtn.main.data = this.bulletBtn.main.data.filter(function (t) {
11451
- return t.id !== e;
11452
- }));
11488
+ if (this.logger && this.logger.info("removeComment: id " + e), e) {
11489
+ this._releaseCtrl(e), this.main.queue.some(function (t) {
11490
+ return t.id === e && (t.remove(), !0);
11491
+ }), this.main.data = this.main.data.filter(function (t) {
11492
+ return t.id !== e;
11493
+ });
11494
+ }
11453
11495
  } }, { key: "updateComments", value: function value(e) {
11454
- var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1];t && (this.bulletBtn.main.data = []), this.bulletBtn.main.data = this.bulletBtn.main.data.concat(e);
11496
+ var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1],
11497
+ n = this.config,
11498
+ i = this.main,
11499
+ o = this.player,
11500
+ r = [],
11501
+ a = 0;if (this.logger && this.logger.info("updateComments: " + e.length + ", isClear " + t), "boolean" == typeof t && t && (i.data = []), i.data = i.data.concat(e), i.sortData(), "number" == typeof n.maxCommentsLength && i.data.length > n.maxCommentsLength) {
11502
+ a = i.data.length - n.maxCommentsLength;for (var s, l = 0; l < a; l++) {
11503
+ (s = i.data[l]).prior && !s.attached_ && r.push(i.data[l]);
11504
+ }
11505
+ } else if (n.dropStaleComments && o && o.currentTime) {
11506
+ var u = Math.floor(1e3 * o.currentTime),
11507
+ c = u - n.interval;if (c > 0) for (var f, h = 0; h < i.data.length; h++) {
11508
+ if ((f = i.data[h]).prior && !f.attached_ && r.push(i.data[h]), f.start > c) {
11509
+ a = h;break;
11510
+ }
11511
+ }a > 0 && (i.data.splice(0, a), i.data = r.concat(i.data));
11512
+ }
11513
+ } }, { key: "willChange", value: function value() {
11514
+ var e = this.container,
11515
+ t = this.main;e.style.willChange = "opacity", t.willChanges.push("contents"), t.queue.forEach(function (e) {
11516
+ e.willChange();
11517
+ });
11518
+ } }, { key: "stopWillChange", value: function value() {
11519
+ this.container.style.willChange = "", this.main.willChanges.splice(0), this.main.queue.forEach(function (e) {
11520
+ e.willChange();
11521
+ });
11455
11522
  } }, { key: "setAllDuration", value: function value() {
11456
11523
  var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "scroll",
11457
- t = arguments[1],
11458
- n = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2];this.logger && this.logger.info("setAllDuration: mode " + e + " duration " + t + " force " + n);var i = this.container.getBoundingClientRect();t && (t = t || 5e3, n && (this.bulletBtn.main.forceDuration = t), this.bulletBtn.main.data.forEach(function (n) {
11459
- e === n.mode && (n.duration = t);
11460
- }), this.bulletBtn.main.queue.forEach(function (n) {
11461
- e === n.mode && (n.duration = t, n.pauseMove(i), "paused" !== n.danmu.bulletBtn.main.status && n.startMove(i));
11524
+ t = this,
11525
+ n = arguments[1],
11526
+ i = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2];this.logger && this.logger.info("setAllDuration: mode " + e + " duration " + n + " force " + i), n && (n = n || 5e3, i && (this.main.forceDuration = n), this.main.data.forEach(function (t) {
11527
+ e === t.mode && (t.duration = n);
11528
+ }), this.main.queue.forEach(function (i) {
11529
+ e === i.mode && (i.duration = n, i.pauseMove(), "paused" !== t.main.status && i.startMove());
11530
+ }));
11531
+ } }, { key: "setPlayRate", value: function value() {
11532
+ var e = this,
11533
+ t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "scroll",
11534
+ n = arguments[1];this.logger && this.logger.info("setPlayRate: " + n), (0, c.isNumber)(n) && n > 0 && (this.main.playRate = n, this.main.queue.forEach(function (n) {
11535
+ t === n.mode && (n.pauseMove(), "paused" !== e.main.status && n.startMove());
11462
11536
  }));
11463
11537
  } }, { key: "setOpacity", value: function value(e) {
11464
11538
  this.logger && this.logger.info("setOpacity: opacity " + e), this.container.style.opacity = e;
11465
11539
  } }, { key: "setFontSize", value: function value(e, t) {
11466
- var n = this;this.logger && this.logger.info("setFontSize: size " + e + " channelSize " + t), this.fontSize = e + "px", e && (this.bulletBtn.main.data.forEach(function (e) {
11540
+ var n = this,
11541
+ i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : { reflow: !0 };this.logger && this.logger.info("setFontSize: size " + e + " channelSize " + t), this.fontSize = e + "px", e && (this.main.data.forEach(function (e) {
11467
11542
  e.style && (e.style.fontSize = n.fontSize);
11468
- }), this.bulletBtn.main.queue.forEach(function (e) {
11543
+ }), this.main.queue.forEach(function (e) {
11469
11544
  e.options.style || (e.options.style = {}), e.options.style.fontSize = n.fontSize, e.setFontSize(n.fontSize), t && (e.top = e.channel_id[0] * t, e.topInit());
11470
- })), t && (this.config.channelSize = t, this.bulletBtn.main.channel.resize(!0));
11545
+ })), t && (this.config.channelSize = t, i.reflow && this.main.channel.resizeSync());
11471
11546
  } }, { key: "setArea", value: function value(e) {
11472
- this.logger && this.logger.info("setArea: area " + e), this.config.area = e, this.bulletBtn.main.channel.resize(!0);
11547
+ this.logger && this.logger.info("setArea: area " + e), this.config.area = e, !1 !== e.reflow && this.main.channel.resizeSync();
11473
11548
  } }, { key: "hide", value: function value() {
11474
- var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "scroll";this.logger && this.logger.info("hide: mode " + e), this.hideArr.indexOf(e) < 0 && this.hideArr.push(e);var t = this.bulletBtn.main.queue.filter(function (t) {
11549
+ var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "scroll";this.logger && this.logger.info("hide: mode " + e), this.hideArr.indexOf(e) < 0 && this.hideArr.push(e);var t = this.main.queue.filter(function (t) {
11475
11550
  return e === t.mode || "color" === e && t.color;
11476
11551
  });t.forEach(function (e) {
11477
11552
  return e.remove();
@@ -11482,8 +11557,14 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11482
11557
  var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "r2l";this.logger && this.logger.info("setDirection: direction " + e), this.emit("changeDirection", e);
11483
11558
  } }, { key: "resize", value: function value() {
11484
11559
  this.logger && this.logger.info("resize"), this.emit("channel_resize");
11560
+ } }, { key: "status", get: function get() {
11561
+ return this.main.status;
11562
+ } }, { key: "state", get: function get() {
11563
+ var e = this.main;return { status: e.status, comments: e.data, bullets: e.queue };
11564
+ } }, { key: "containerPos", get: function get() {
11565
+ return this.main.channel.containerPos;
11485
11566
  } }]), t;
11486
- }(r.default);t.default = d, e.exports = t.default;
11567
+ }(a.default);t.default = d;
11487
11568
  }, function (e, t, n) {
11488
11569
  "use strict";
11489
11570
  var i,
@@ -11493,20 +11574,20 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11493
11574
  s,
11494
11575
  l,
11495
11576
  u,
11496
- c = n(8),
11497
- f = n(25),
11577
+ c = n(7),
11578
+ f = n(24),
11498
11579
  h = Function.prototype.apply,
11499
11580
  d = Function.prototype.call,
11500
- g = Object.create,
11501
- p = Object.defineProperty,
11581
+ p = Object.create,
11582
+ g = Object.defineProperty,
11502
11583
  m = Object.defineProperties,
11503
11584
  v = Object.prototype.hasOwnProperty,
11504
- b = { configurable: !0, enumerable: !1, writable: !0 };o = function o(e, t) {
11585
+ y = { configurable: !0, enumerable: !1, writable: !0 };o = function o(e, t) {
11505
11586
  var _n, o;return f(t), o = this, i.call(this, e, _n = function n() {
11506
11587
  r.call(o, e, _n), h.call(t, this, arguments);
11507
11588
  }), _n.__eeOnceListener__ = t, this;
11508
11589
  }, s = { on: i = function i(e, t) {
11509
- var n;return f(t), v.call(this, "__ee__") ? n = this.__ee__ : (n = b.value = g(null), p(this, "__ee__", b), b.value = null), n[e] ? "object" == _typeof(n[e]) ? n[e].push(t) : n[e] = [n[e], t] : n[e] = t, this;
11590
+ var n;return f(t), v.call(this, "__ee__") ? n = this.__ee__ : (n = y.value = p(null), g(this, "__ee__", y), y.value = null), n[e] ? "object" == _typeof(n[e]) ? n[e].push(t) : n[e] = [n[e], t] : n[e] = t, this;
11510
11591
  }, once: o, off: r = function r(e, t) {
11511
11592
  var n, i, o, r;if (f(t), !v.call(this, "__ee__")) return this;if (!(n = this.__ee__)[e]) return this;if ("object" == _typeof(i = n[e])) for (r = 0; o = i[r]; ++r) {
11512
11593
  o !== t && o.__eeOnceListener__ !== t || (2 === i.length ? n[e] = i[r ? 0 : 1] : i.splice(r, 1));
@@ -11526,29 +11607,29 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11526
11607
  r[t - 1] = arguments[t];
11527
11608
  }h.call(o, this, r);}
11528
11609
  } }, l = { on: c(i), once: c(o), off: c(r), emit: c(a) }, u = m({}, l), e.exports = t = function t(e) {
11529
- return null == e ? g(u) : m(Object(e), l);
11610
+ return null == e ? p(u) : m(Object(e), l);
11530
11611
  }, t.methods = s;
11531
11612
  }, function (e, t, n) {
11532
11613
  "use strict";
11533
11614
  var i = n(3),
11534
- o = n(9),
11535
- r = n(13),
11536
- a = n(21),
11537
- s = n(22);(e.exports = function (e, t) {
11615
+ o = n(8),
11616
+ r = n(12),
11617
+ a = n(20),
11618
+ s = n(21);(e.exports = function (e, t) {
11538
11619
  var n, o, l, u, c;return arguments.length < 2 || "string" != typeof e ? (u = t, t = e, e = null) : u = arguments[2], i(e) ? (n = s.call(e, "c"), o = s.call(e, "e"), l = s.call(e, "w")) : (n = l = !0, o = !1), c = { value: t, configurable: n, enumerable: o, writable: l }, u ? r(a(u), c) : c;
11539
11620
  }).gs = function (e, t, n) {
11540
11621
  var l, u, c, f;return "string" != typeof e ? (c = n, n = t, t = e, e = null) : c = arguments[3], i(t) ? o(t) ? i(n) ? o(n) || (c = n, n = void 0) : n = void 0 : (c = t, t = n = void 0) : t = void 0, i(e) ? (l = s.call(e, "c"), u = s.call(e, "e")) : (l = !0, u = !1), f = { get: t, set: n, configurable: l, enumerable: u }, c ? r(a(c), f) : f;
11541
11622
  };
11542
11623
  }, function (e, t, n) {
11543
11624
  "use strict";
11544
- var i = n(10),
11625
+ var i = n(9),
11545
11626
  o = /^\s*class[\s{/}]/,
11546
11627
  r = Function.prototype.toString;e.exports = function (e) {
11547
11628
  return !!i(e) && !o.test(r.call(e));
11548
11629
  };
11549
11630
  }, function (e, t, n) {
11550
11631
  "use strict";
11551
- var i = n(11);e.exports = function (e) {
11632
+ var i = n(10);e.exports = function (e) {
11552
11633
  if ("function" != typeof e) return !1;if (!hasOwnProperty.call(e, "length")) return !1;try {
11553
11634
  if ("number" != typeof e.length) return !1;if ("function" != typeof e.call) return !1;if ("function" != typeof e.apply) return !1;
11554
11635
  } catch (e) {
@@ -11557,7 +11638,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11557
11638
  };
11558
11639
  }, function (e, t, n) {
11559
11640
  "use strict";
11560
- var i = n(12);e.exports = function (e) {
11641
+ var i = n(11);e.exports = function (e) {
11561
11642
  if (!i(e)) return !1;try {
11562
11643
  return !!e.constructor && e.constructor.prototype === e;
11563
11644
  } catch (e) {
@@ -11572,7 +11653,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11572
11653
  };
11573
11654
  }, function (e, t, n) {
11574
11655
  "use strict";
11575
- e.exports = n(14)() ? Object.assign : n(15);
11656
+ e.exports = n(13)() ? Object.assign : n(14);
11576
11657
  }, function (e, t, n) {
11577
11658
  "use strict";
11578
11659
  e.exports = function () {
@@ -11581,8 +11662,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11581
11662
  };
11582
11663
  }, function (e, t, n) {
11583
11664
  "use strict";
11584
- var i = n(16),
11585
- o = n(20),
11665
+ var i = n(15),
11666
+ o = n(19),
11586
11667
  r = Math.max;e.exports = function (e, t) {
11587
11668
  var n,
11588
11669
  a,
@@ -11599,7 +11680,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11599
11680
  };
11600
11681
  }, function (e, t, n) {
11601
11682
  "use strict";
11602
- e.exports = n(17)() ? Object.keys : n(18);
11683
+ e.exports = n(16)() ? Object.keys : n(17);
11603
11684
  }, function (e, t, n) {
11604
11685
  "use strict";
11605
11686
  e.exports = function () {
@@ -11639,7 +11720,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11639
11720
  };
11640
11721
  }, function (e, t, n) {
11641
11722
  "use strict";
11642
- e.exports = n(23)() ? String.prototype.contains : n(24);
11723
+ e.exports = n(22)() ? String.prototype.contains : n(23);
11643
11724
  }, function (e, t, n) {
11644
11725
  "use strict";
11645
11726
  var i = "razdwatrzy";e.exports = function () {
@@ -11655,6 +11736,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11655
11736
  e.exports = function (e) {
11656
11737
  if ("function" != typeof e) throw new TypeError(e + " is not a function");return e;
11657
11738
  };
11739
+ }, function (e) {
11740
+ e.exports = JSON.parse('{"version":"1.1.1"}');
11658
11741
  }, function (e, t, n) {
11659
11742
  "use strict";
11660
11743
  Object.defineProperty(t, "__esModule", { value: !0 });var i = function () {
@@ -11689,8 +11772,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11689
11772
  };
11690
11773
  }(),
11691
11774
  o = s(n(1)),
11692
- r = s(n(0)),
11693
- a = s(n(28));function s(e) {
11775
+ r = s(n(28)),
11776
+ a = n(0);function s(e) {
11694
11777
  return e && e.__esModule ? e : { default: e };
11695
11778
  }var l = function (e) {
11696
11779
  function t(e) {
@@ -11698,14 +11781,14 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11698
11781
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
11699
11782
  }(this, t);var n = function (e, t) {
11700
11783
  if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !t || "object" != (typeof t === "undefined" ? "undefined" : _typeof(t)) && "function" != typeof t ? e : t;
11701
- }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));return n.setLogger("control"), n.danmu = e, n.main = new a.default(e), e.config.defaultOff || n.main.start(), n;
11784
+ }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));return n.setLogger("control"), n.danmu = e, n.main = new r.default(e), e.config.defaultOff || n.main.start(), n;
11702
11785
  }return function (e, t) {
11703
11786
  if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (typeof t === "undefined" ? "undefined" : _typeof(t)));e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
11704
11787
  }(t, e), i(t, [{ key: "createSwitch", value: function value() {
11705
- var e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];return this.logger && this.logger.info("createSwitch"), this.switchBtn = r.default.createDom("dk-switch", '<span class="txt">弹</span>', {}, "danmu-switch " + (e ? "danmu-switch-active" : "")), this.switchBtn;
11788
+ var e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];return this.logger && this.logger.info("createSwitch"), this.switchBtn = (0, a.createDom)("dk-switch", '<span class="txt">弹</span>', {}, "danmu-switch " + (e ? "danmu-switch-active" : "")), this.switchBtn;
11706
11789
  } }, { key: "destroy", value: function value() {
11707
11790
  for (var e in this.logger && this.logger.info("destroy"), this.main.destroy(), this) {
11708
- delete this[e];
11791
+ a.hasOwnProperty.call(this, e) && delete this[e];
11709
11792
  }
11710
11793
  } }]), t;
11711
11794
  }(o.default);t.default = l, e.exports = t.default;
@@ -11723,7 +11806,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11723
11806
  o = l(n(1)),
11724
11807
  r = l(n(29)),
11725
11808
  a = l(n(30)),
11726
- s = l(n(0));function l(e) {
11809
+ s = n(0);function l(e) {
11727
11810
  return e && e.__esModule ? e : { default: e };
11728
11811
  }var u = function (e) {
11729
11812
  function t(e) {
@@ -11731,80 +11814,97 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11731
11814
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
11732
11815
  }(this, t);var n = function (e, t) {
11733
11816
  if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !t || "object" != (typeof t === "undefined" ? "undefined" : _typeof(t)) && "function" != typeof t ? e : t;
11734
- }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));n.setLogger("main"), n.danmu = e, n.container = e.container, n.channel = new r.default(e), n.data = [].concat(e.config.comments), n.playedData = [], n.queue = [], n.timer = null, n.retryTimer = null, n.retryStatus = "normal", n.interval = e.config.interval || 2e3, n.status = "idle", s.default.on(e, "bullet_remove", n.updateQueue.bind(n), "destroy");var i = n;return s.default.on(n.danmu, "changeDirection", function (e) {
11735
- i.danmu.direction = e;
11817
+ }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));return n.setLogger("main"), n.danmu = e, n.container = e.container, n.channel = new a.default(e), n.data = [].concat(e.config.comments), n.playedData = [], n.queue = [], n.timer = null, n.playRate = 1, n.retryStatus = "normal", n.interval = e.config.interval, n.willChanges = [], n._status = "idle", (0, s.attachEventListener)(e, "bullet_remove", n.updateQueue.bind(n), "destroy"), (0, s.attachEventListener)(e, "changeDirection", function (e) {
11818
+ n.danmu.direction = e;
11736
11819
  }, "destroy"), n.nums = 0, n;
11737
11820
  }return function (e, t) {
11738
11821
  if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (typeof t === "undefined" ? "undefined" : _typeof(t)));e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
11739
- }(t, e), i(t, [{ key: "destroy", value: function value() {
11740
- for (var e in this.logger && this.logger.info("destroy"), clearTimeout(this.dataHandleTimer), this.channel.destroy(), this.data = [], this) {
11822
+ }(t, e), i(t, [{ key: "_cancelDataHandleTimer", value: function value() {
11823
+ this.handleId && (clearTimeout(this.handleId), this.handleId = null), this.handleTimer && (clearTimeout(this.handleTimer), this.handleTimer = null);
11824
+ } }, { key: "destroy", value: function value() {
11825
+ for (var e in this.logger && this.logger.info("destroy"), this._cancelDataHandleTimer(), this.channel.destroy(), this.data = [], this) {
11741
11826
  delete this[e];
11742
11827
  }
11743
11828
  } }, { key: "updateQueue", value: function value(e) {
11744
11829
  this.logger && this.logger.info("updateQueue");var t = this;t.queue.some(function (n, i) {
11745
11830
  return n.id === e.bullet.id && (t.queue.splice(i, 1), !0);
11746
- }), t.data.some(function (t, n) {
11747
- return t.id === e.bullet.id && (t.hasAttached = !1, !0);
11831
+ }), t.data.some(function (t) {
11832
+ return t.id === e.bullet.id && (t.attached_ = !1, !0);
11748
11833
  });
11749
- } }, { key: "init", value: function value(e, t) {
11750
- t.logger && t.logger.info("init"), t || (t = this), t.retryStatus = "normal", t.data.sort(function (e, t) {
11751
- return e.start - t.start;
11752
- });t.retryTimer || function e() {
11753
- "closed" === t.status && "stop" === t.retryStatus || ("playing" === t.status && (t.readData(), t.dataHandle()), "stop" === t.retryStatus && "paused" !== t.status || (t.dataHandleTimer = setTimeout(function () {
11754
- e();
11755
- }, t.interval - 1e3)));
11834
+ } }, { key: "init", value: function value() {
11835
+ var e = this;e.logger && e.logger.info("init"), e.retryStatus = "normal", e.sortData(), function t() {
11836
+ "closed" !== e._status || "stop" !== e.retryStatus ? ("playing" === e._status && (e.readData(), e.dataHandle()), "stop" === e.retryStatus && "paused" !== e._status || (e.handleTimer = setTimeout(function () {
11837
+ e.handleId = requestAnimationFrame(function () {
11838
+ t();
11839
+ });
11840
+ }, 250))) : e._cancelDataHandleTimer();
11756
11841
  }();
11757
11842
  } }, { key: "start", value: function value() {
11758
- this.logger && this.logger.info("start");this.status = "playing", this.queue = [], this.container.innerHTML = "", this.channel.resetWithCb(this.init, this);
11843
+ this.logger && this.logger.info("start");this._status = "playing", this.queue = [], this.container.innerHTML = "", this.channel.reset(), this.init();
11759
11844
  } }, { key: "stop", value: function value() {
11760
- this.logger && this.logger.info("stop");this.status = "closed", this.retryTimer = null, this.retryStatus = "stop", this.channel.reset(), this.queue = [], this.container.innerHTML = "";
11845
+ this.logger && this.logger.info("stop");this._status = "closed", this.retryStatus = "stop", this.queue = [], this.container.innerHTML = "", this.channel.reset();
11761
11846
  } }, { key: "clear", value: function value() {
11762
11847
  this.logger && this.logger.info("clear"), this.channel.reset(), this.data = [], this.queue = [], this.container.innerHTML = "";
11763
11848
  } }, { key: "play", value: function value() {
11764
- var e = this;this.logger && this.logger.info("play"), this.status = "playing";var t = this.channel.channels,
11765
- n = this.danmu.container.getBoundingClientRect();t && t.length > 0 && ["scroll", "top", "bottom"].forEach(function (i) {
11766
- e.queue.forEach(function (e) {
11767
- e.startMove(n), e.resized = !0;
11768
- });for (var o = 0; o < t.length; o++) {
11769
- t[o].queue[i].forEach(function (e) {
11770
- e.resized = !1;
11771
- });
11772
- }
11773
- });
11849
+ var e = this;if ("closed" !== this._status) {
11850
+ this.logger && this.logger.info("play"), this._status = "playing";var t = this.channel.channels;t && t.length > 0 && ["scroll", "top", "bottom"].forEach(function (n) {
11851
+ e.queue.forEach(function (e) {
11852
+ e.startMove(), e.resized = !0;
11853
+ });for (var i = 0; i < t.length; i++) {
11854
+ t[i].queue[n].forEach(function (e) {
11855
+ e.resized = !1;
11856
+ });
11857
+ }
11858
+ });
11859
+ } else this.logger && this.logger.info("play ignored");
11774
11860
  } }, { key: "pause", value: function value() {
11775
- this.logger && this.logger.info("pause"), this.status = "paused";var e = this.channel.channels,
11776
- t = this.danmu.container.getBoundingClientRect();e && e.length > 0 && this.queue.forEach(function (e) {
11777
- e.pauseMove(t);
11778
- });
11861
+ if ("closed" !== this._status) {
11862
+ this.logger && this.logger.info("pause"), this._status = "paused";var e = this.channel.channels;e && e.length > 0 && this.queue.forEach(function (e) {
11863
+ e.pauseMove();
11864
+ });
11865
+ } else this.logger && this.logger.info("pause ignored");
11779
11866
  } }, { key: "dataHandle", value: function value() {
11780
- var e = this;"paused" !== this.status && "closed" !== this.status && e.queue.length && e.queue.forEach(function (t) {
11781
- "waiting" === t.status && t.startMove(e.channel.containerPos);
11867
+ "paused" !== this._status && "closed" !== this._status && this.queue.length && this.queue.forEach(function (e) {
11868
+ "waiting" === e.status && e.startMove();
11782
11869
  });
11783
11870
  } }, { key: "readData", value: function value() {
11784
- var e = this,
11785
- t = this.danmu;if (t.isReady) {
11786
- var n = 0;t.player && t.player.currentTime && (n = s.default.formatTime(t.player.currentTime));var i = void 0,
11787
- o = e.interval,
11788
- r = e.channel,
11789
- l = void 0;t.player ? (l = e.data.filter(function (t) {
11790
- return !t.start && e.danmu.hideArr.indexOf(t.mode) < 0 && (!t.color || e.danmu.hideArr.indexOf("color") < 0) && (t.start = n), e.danmu.hideArr.indexOf(t.mode) < 0 && (!t.color || e.danmu.hideArr.indexOf("color") < 0) && t.start - o <= n && n <= t.start + o;
11791
- }), t.live && (e.data = [])) : 0 === (l = e.data.splice(0, 1)).length && (l = e.playedData.splice(0, 1)), l.length > 0 && l.forEach(function (n) {
11792
- if (e.forceDuration && e.forceDuration != n.duration && (n.duration = e.forceDuration), i = new a.default(t, n), n.hasAttached) {
11793
- for (var o in i.detach(), i) {
11794
- delete i[o];
11795
- }i = null, n.hasAttached = !1, n.noDiscard && (n.prior ? e.data.unshift(n) : e.data.push(n));
11796
- } else if (i.attach(), n.hasAttached = !0, r.addBullet(i).result) e.queue.push(i), e.nums++, i.topInit();else {
11797
- for (var s in i.detach(), i) {
11798
- delete i[s];
11799
- }i = null, n.hasAttached = !1, n.noDiscard && (n.prior ? e.data.unshift(n) : e.data.push(n));
11871
+ if (this.danmu.isReady) {
11872
+ var e = this,
11873
+ t = this.danmu,
11874
+ n = t.player,
11875
+ i = e.interval,
11876
+ o = e.channel,
11877
+ a = void 0,
11878
+ l = void 0;if (n) {
11879
+ var u = n.currentTime ? Math.floor(1e3 * n.currentTime) : 0;l = e.data.filter(function (t) {
11880
+ return !t.start && e.danmu.hideArr.indexOf(t.mode) < 0 && (!t.color || e.danmu.hideArr.indexOf("color") < 0) && (t.start = u), !t.attached_ && e.danmu.hideArr.indexOf(t.mode) < 0 && (!t.color || e.danmu.hideArr.indexOf("color") < 0) && t.start - i <= u && u <= t.start + i;
11881
+ }), t.live && (e.data = []);
11882
+ } else 0 === (l = e.data.splice(0, 1)).length && (l = e.playedData.splice(0, 1));if (l.length > 0) {
11883
+ o.updatePos();var c = 2;e: for (var f, h = 0; h < l.length; h++) {
11884
+ if (f = l[h], e.forceDuration && e.forceDuration != f.duration && (f.duration = e.forceDuration), (a = new r.default(t, f)) && !a.bulletCreateFail) {
11885
+ if (a.attach(), f.attached_ = !0, o.addBullet(a).result) e.queue.push(a), e.nums++, a.topInit(), c = 2;else {
11886
+ for (var d in a.detach(), a) {
11887
+ s.hasOwnProperty.call(a, d) && delete a[d];
11888
+ }if (a = null, f.attached_ = !1, f.noDiscard && (f.prior ? e.data.unshift(f) : e.data.push(f)), 0 === c) break e;c--;
11889
+ }
11890
+ } else {
11891
+ if (0 === c) break e;c--;
11892
+ }
11800
11893
  }
11801
- });
11894
+ }
11802
11895
  }
11896
+ } }, { key: "sortData", value: function value() {
11897
+ this.data.sort(function (e, t) {
11898
+ return (e.start || -1) - (t.start || -1);
11899
+ });
11900
+ } }, { key: "status", get: function get() {
11901
+ return this._status;
11803
11902
  } }]), t;
11804
11903
  }(o.default);t.default = u, e.exports = t.default;
11805
11904
  }, function (e, t, n) {
11806
11905
  "use strict";
11807
- Object.defineProperty(t, "__esModule", { value: !0 });var i = function () {
11906
+ Object.defineProperty(t, "__esModule", { value: !0 }), t.Bullet = void 0;var i,
11907
+ o = function () {
11808
11908
  function e(e, t) {
11809
11909
  for (var n = 0; n < t.length; n++) {
11810
11910
  var i = t[n];i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i);
@@ -11813,86 +11913,125 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11813
11913
  return n && e(t.prototype, n), i && e(t, i), t;
11814
11914
  };
11815
11915
  }(),
11816
- o = a(n(1)),
11817
- r = a(n(0));function a(e) {
11818
- return e && e.__esModule ? e : { default: e };
11819
- }var s = function (e) {
11916
+ r = n(1),
11917
+ a = (i = r) && i.__esModule ? i : { default: i },
11918
+ s = n(0);function l(e, t) {
11919
+ if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !t || "object" != (typeof t === "undefined" ? "undefined" : _typeof(t)) && "function" != typeof t ? e : t;
11920
+ }var u = t.Bullet = function (e) {
11921
+ function t(e, n) {
11922
+ !function (e, t) {
11923
+ if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
11924
+ }(this, t);var i = l(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)),
11925
+ o = i,
11926
+ r = void 0;if (i.setLogger("bullet"), i.danmu = e, i.options = n, i.duration = n.duration, i.id = n.id, i.container = e.container, i.start = n.start, i.prior = n.prior, i.realTime = n.realTime, i.color = n.color, i.bookChannelId = n.bookChannelId, i.direction = e.direction, i.reuseDOM = !0, i.willChanges = [], i.domObj = e.domObj, n.el && 1 === n.el.nodeType) {
11927
+ if (n.el.parentNode) return l(i, { bulletCreateFail: !0 });if (e.config.disableCopyDOM) r = n.el, i.reuseDOM = !1;else {
11928
+ r = i.domObj.use();var a = (0, s.copyDom)(n.el);n.eventListeners && n.eventListeners.length > 0 && n.eventListeners.forEach(function (e) {
11929
+ a.addEventListener(e.event, e.listener, e.useCapture || !1);
11930
+ }), r.appendChild(a);
11931
+ }
11932
+ } else (r = i.domObj.use()).textContent = n.txt;if (i.onChangeDirection = function (e) {
11933
+ o.direction = e;
11934
+ }, i.danmu.on("changeDirection", i.onChangeDirection), n.style) {
11935
+ var u = n.style;Object.keys(u).forEach(function (e) {
11936
+ (0, s.styleUtil)(r, e, u[e]);
11937
+ });
11938
+ }"top" === n.mode || "bottom" === n.mode ? i.mode = n.mode : i.mode = "scroll", i.el = r, n.like && n.like.el && i.setLikeDom(n.like.el, n.like.style), i.status = "waiting";var c = void 0;if ((0, s.isNumber)(e.config.bulletOffset) && e.config.bulletOffset >= 0) c = e.config.bulletOffset;else {
11939
+ var f = e.containerPos;c = f.width / 10 > 100 ? 100 : f.width / 10;
11940
+ }var h = n.realTime ? 0 : Math.floor(Math.random() * c);return i.updateOffset(h), i;
11941
+ }return function (e, t) {
11942
+ if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (typeof t === "undefined" ? "undefined" : _typeof(t)));e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
11943
+ }(t, e), o(t, [{ key: "updateOffset", value: function value(e) {
11944
+ this.random = e, (0, s.styleUtil)(this.el, "left", this.danmu.containerPos.width + e + "px");
11945
+ } }, { key: "attach", value: function value() {
11946
+ var e = this.el;this.container.appendChild(e), this.elPos = e.getBoundingClientRect(), "b2t" === this.direction ? (this.width = this.elPos.height, this.height = this.elPos.width) : (this.width = this.elPos.width, this.height = this.elPos.height), this.moveV && (this.duration = (this.danmu.containerPos.width + this.random + this.width) / this.moveV * 1e3), this.danmu.config && (this.danmu.config.mouseControl && (this.mouseoverFunWrapper = this.mouseoverFun.bind(this), e.addEventListener("mouseover", this.mouseoverFunWrapper, !1)), this.danmu.config.mouseEnterControl && (this.mouseEnterFunWrapper = this.mouseoverFun.bind(this), e.addEventListener("mouseenter", this.mouseEnterFunWrapper, !1))), e.addEventListener("transitionend", this._onTransitionEnd, !1);
11947
+ } }, { key: "detach", value: function value() {
11948
+ var e = this.el;if (e) {
11949
+ var t = this.danmu.config;t && (t.mouseControl && e.removeEventListener("mouseover", this.mouseoverFunWrapper, !1), t.mouseEnterControl && e.removeEventListener("mouseenter", this.mouseEnterFunWrapper, !1)), e.removeEventListener("transitionend", this._onTransitionEnd, !1), e.parentNode && e.parentNode.removeChild(e), this.reuseDOM && this.domObj.unused(e), this.el = null;
11950
+ }this.elPos = void 0, this.danmu.off("changeDirection", this.onChangeDirection);
11951
+ } }, { key: "willChange", value: function value() {
11952
+ var e = this.danmu.main.willChanges.concat(this.willChanges).join();(0, s.styleUtil)(this.el, "willChange", e);
11953
+ } }, { key: "mouseoverFun", value: function value(e) {
11954
+ this.danmu && this.danmu.mouseControl && this.danmu.config.mouseControlPause || "waiting" === this.status || "end" === this.status || this.danmu && this.danmu.emit("bullet_hover", { bullet: this, event: e });
11955
+ } }, { key: "_onTransitionEnd", value: function value() {
11956
+ this.status = "end", this.remove();
11957
+ } }, { key: "topInit", value: function value() {
11958
+ this.logger && this.logger.info("topInit #" + (this.options.txt || "[DOM Element]") + "#"), "b2t" === this.direction ? ((0, s.styleUtil)(this.el, "transformOrigin", "left top"), (0, s.styleUtil)(this.el, "transform", "translateX(-" + this.top + "px) translateY(" + this.danmu.containerPos.height + "px) translateZ(0px) rotate(90deg)"), (0, s.styleUtil)(this.el, "transition", "transform 0s linear 0s")) : (0, s.styleUtil)(this.el, "top", this.top + "px");
11959
+ } }, { key: "pauseMove", value: function value() {
11960
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
11961
+ t = this;if ("paused" !== t.status && ("forcedPause" !== t.status && (this.status = "paused"), t._moveV = void 0, this.el)) if (this.willChange(), "scroll" === this.mode) {
11962
+ var n = t.danmu.containerPos;if (e) {
11963
+ var i = (new Date().getTime() - t.moveTime) / 1e3,
11964
+ o = i * this.moveV,
11965
+ r = 0;r = t.moveMoreS - o >= 0 ? "b2t" === this.direction ? (t.moveMoreS - o) / t.moveContainerHeight * n.height : (t.moveMoreS - o) / t.moveContainerWidth * n.width : t.moveMoreS - o, "b2t" === this.direction ? (0, s.styleUtil)(this.el, "transform", "translateX(-" + this.top + "px) translateY(" + r + "px) translateZ(0px) rotate(90deg)") : (0, s.styleUtil)(this.el, "left", r + "px");
11966
+ } else "b2t" === this.direction ? (0, s.styleUtil)(this.el, "transform", "translateX(-" + this.top + "px) translateY(" + (this.el.getBoundingClientRect().top - n.top) + "px) translateZ(0px) rotate(90deg)") : (0, s.styleUtil)(this.el, "left", this.el.getBoundingClientRect().left - n.left + "px");"b2t" === this.direction || (0, s.styleUtil)(this.el, "transform", "translateX(0px) translateY(0px) translateZ(0px)"), (0, s.styleUtil)(this.el, "transition", "transform 0s linear 0s");
11967
+ } else this.pastDuration && this.startTime ? this.pastDuration = this.pastDuration + new Date().getTime() - this.startTime : this.pastDuration = 1;
11968
+ } }, { key: "startMove", value: function value(e) {
11969
+ if (this.hasMove || (this.danmu.emit("bullet_start", this), this.hasMove = !0), ("forcedPause" !== this.status || e) && this.el && "start" !== this.status) if (this.status = "start", this.willChanges = ["transform", "transition"], this.willChange(), (0, s.styleUtil)(this.el, "backface-visibility", "hidden"), (0, s.styleUtil)(this.el, "perspective", "500em"), "scroll" === this.mode) {
11970
+ var t = this.danmu.containerPos;if ("b2t" === this.direction) {
11971
+ var n = (this.el.getBoundingClientRect().bottom - t.top) / this.moveV;(0, s.styleUtil)(this.el, "transition", "transform " + n + "s linear 0s"), (0, s.styleUtil)(this.el, "transform", "translateX(-" + this.top + "px) translateY(-" + this.height + "px) translateZ(0px) rotate(90deg)"), this.moveTime = new Date().getTime(), this.moveMoreS = this.el.getBoundingClientRect().top - t.top, this.moveContainerHeight = t.height;
11972
+ } else {
11973
+ if (!this.el) return;var i = this.el.getBoundingClientRect(),
11974
+ o = i.right - t.left,
11975
+ r = o / this.moveV;i.right > t.left ? ((0, s.styleUtil)(this.el, "transition", "transform " + r + "s linear 0s"), (0, s.styleUtil)(this.el, "transform", "translateX(-" + o + "px) translateY(0px) translateZ(0px)"), this.moveTime = new Date().getTime(), this.moveMoreS = i.left - t.left, this.moveContainerWidth = t.width) : (this.status = "end", this.remove());
11976
+ }
11977
+ } else (0, s.styleUtil)(this.el, "left", "50%"), (0, s.styleUtil)(this.el, "margin", "0 0 0 -" + this.width / 2 + "px"), this.pastDuration || (this.pastDuration = 1), this.startTime = new Date().getTime();
11978
+ } }, { key: "remove", value: function value() {
11979
+ this.logger && this.logger.info("remove #" + (this.options.txt || "[DOM Element]") + "#");this.pauseMove(), this.el && this.el.parentNode && (this.willChanges = [], this.willChange(), this.detach(), this.options.el && 1 === this.options.el.nodeType && this.danmu.config.disableCopyDOM && (0, s.styleUtil)(this.options.el, "transform", "none"), this.danmu.emit("bullet_remove", { bullet: this }));
11980
+ } }, { key: "setFontSize", value: function value(e) {
11981
+ this.el && (this.el.style.fontSize = e);
11982
+ } }, { key: "setLikeDom", value: function value(e, t) {
11983
+ if (e) {
11984
+ Object.keys(t).forEach(function (n) {
11985
+ e.style[n] = t[n];
11986
+ });if (e.className = "danmu-like", this.el) {
11987
+ var n = this.el.querySelector(".danmu-like");n && this.el.removeChild(n), this.el.innerHTML = "" + this.el.innerHTML + e.outerHTML;
11988
+ }
11989
+ }return e;
11990
+ } }, { key: "moveV", get: function get() {
11991
+ var e = this._moveV;if (!e) {
11992
+ if (this.options.moveV) e = this.options.moveV;else if (this.elPos) {
11993
+ var t = this.danmu.containerPos;e = ("b2t" === this.direction ? t.height + this.height : t.width + this.width) / this.duration * 1e3;
11994
+ }e && (e *= this.danmu.main.playRate, this._moveV = e);
11995
+ }return e;
11996
+ } }]), t;
11997
+ }(a.default);t.default = u;
11998
+ }, function (e, t, n) {
11999
+ "use strict";
12000
+ Object.defineProperty(t, "__esModule", { value: !0 });var i,
12001
+ o = function () {
12002
+ function e(e, t) {
12003
+ for (var n = 0; n < t.length; n++) {
12004
+ var i = t[n];i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i);
12005
+ }
12006
+ }return function (t, n, i) {
12007
+ return n && e(t.prototype, n), i && e(t, i), t;
12008
+ };
12009
+ }(),
12010
+ r = n(1),
12011
+ a = (i = r) && i.__esModule ? i : { default: i },
12012
+ s = n(0),
12013
+ l = n(31);var u = function (e) {
11820
12014
  function t(e) {
11821
12015
  !function (e, t) {
11822
12016
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
11823
12017
  }(this, t);var n = function (e, t) {
11824
12018
  if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !t || "object" != (typeof t === "undefined" ? "undefined" : _typeof(t)) && "function" != typeof t ? e : t;
11825
- }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));n.setLogger("channel"), n.danmu = e, n.reset(!0);var i = n;return r.default.on(n.danmu, "bullet_remove", function (e) {
12019
+ }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)),
12020
+ i = n;return i.setLogger("channel"), i.danmu = e, i.reset(!0), i.direction = e.direction, i.channels = [], i.updatePos(), (0, s.attachEventListener)(n.danmu, "bullet_remove", function (e) {
11826
12021
  i.removeBullet(e.bullet);
11827
- }, "destroy"), n.direction = e.direction, r.default.on(n.danmu, "changeDirection", function (e) {
12022
+ }, "destroy"), (0, s.attachEventListener)(n.danmu, "changeDirection", function (e) {
11828
12023
  i.direction = e;
11829
- }, "destroy"), n.containerPos = n.danmu.container.getBoundingClientRect(), n.containerWidth = n.containerPos.width, n.containerHeight = n.containerPos.height, n.containerLeft = n.containerPos.left, n.containerRight = n.containerPos.right, r.default.on(n.danmu, "channel_resize", function () {
11830
- i.containerPos = i.danmu.container.getBoundingClientRect(), i.resizing || (i.containerWidth = i.containerPos.width, i.containerHeight = i.containerPos.height, i.containerLeft = i.containerPos.left, i.containerRight = i.containerPos.right, i.resize(!0));
12024
+ }, "destroy"), (0, s.attachEventListener)(n.danmu, "channel_resize", function () {
12025
+ i.resize();
11831
12026
  }, "destroy"), n;
11832
12027
  }return function (e, t) {
11833
12028
  if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (typeof t === "undefined" ? "undefined" : _typeof(t)));e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
11834
- }(t, e), i(t, [{ key: "destroy", value: function value() {
11835
- for (var e in this.logger && this.logger.info("destroy"), clearTimeout(this.resizeTimer), this.channels = [], this) {
11836
- delete this[e];
12029
+ }(t, e), o(t, [{ key: "updatePos", value: function value() {
12030
+ var e = this.container.getBoundingClientRect();this.containerPos = e, this.containerWidth = e.width, this.containerHeight = e.height, this.containerTop = e.top, this.containerBottom = e.bottom, this.containerLeft = e.left, this.containerRight = e.right;
12031
+ } }, { key: "destroy", value: function value() {
12032
+ for (var e in this.logger && this.logger.info("destroy"), this.channels.splice(0, this.channels.length), this._cancelResizeTimer(), this) {
12033
+ s.hasOwnProperty.call(this, e) && delete this[e];
11837
12034
  }
11838
- } }, { key: "resize", value: function value() {
11839
- var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];this.logger && this.logger.info("resize");var t = this.danmu.container,
11840
- n = this;n.resizing || (n.resizing = !0, this.resizeTimer = setTimeout(function () {
11841
- n.danmu.bulletBtn.main.data && n.danmu.bulletBtn.main.data.forEach(function (e) {
11842
- e.bookChannelId && (delete e.bookChannelId, n.logger && n.logger.info("resize导致" + e.id + "号优先弹幕预定取消"));
11843
- }), n.logger && n.logger.info("resize导致所有轨道恢复正常使用");var i = t.getBoundingClientRect();n.width = i.width, n.height = i.height, n.danmu.config.area && n.danmu.config.area.start >= 0 && n.danmu.config.area.end >= n.danmu.config.area.start && ("b2t" === n.direction ? n.width = n.width * (n.danmu.config.area.end - n.danmu.config.area.start) : n.height = n.height * (n.danmu.config.area.end - n.danmu.config.area.start)), n.container = t;var o = n.danmu.config.channelSize || (/mobile/gi.test(navigator.userAgent) ? 10 : 12),
11844
- r = void 0;r = "b2t" === n.direction ? Math.floor(n.width / o) : Math.floor(n.height / o);for (var a = [], s = 0; s < r; s++) {
11845
- a[s] = { id: s, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} };
11846
- }if (n.channels && n.channels.length <= a.length) {
11847
- for (var l = function l(t) {
11848
- a[t] = { id: t, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} }, ["scroll", "top"].forEach(function (i) {
11849
- n.channels[t].queue[i].forEach(function (o) {
11850
- o.el && (a[t].queue[i].push(o), o.resized || (o.pauseMove(n.containerPos, e), "paused" !== o.danmu.bulletBtn.main.status && o.startMove(n.containerPos), o.resized = !0));
11851
- });
11852
- }), n.channels[t].queue.bottom.forEach(function (i) {
11853
- if (i.el) {
11854
- if (a[t + a.length - n.channels.length].queue.bottom.push(i), i.channel_id[0] + i.channel_id[1] - 1 === t) {
11855
- var r = [].concat(i.channel_id);i.channel_id = [r[0] - n.channels.length + a.length, r[1]], i.top = i.channel_id[0] * o, n.danmu.config.area && n.danmu.config.area.start && (i.top += n.containerHeight * n.danmu.config.area.start), i.topInit();
11856
- }i.resized || (i.pauseMove(n.containerPos, e), "paused" !== i.danmu.bulletBtn.main.status && i.startMove(n.containerPos), i.resized = !0);
11857
- }
11858
- });
11859
- }, u = 0; u < n.channels.length; u++) {
11860
- l(u);
11861
- }for (var c = function c(e) {
11862
- ["scroll", "top", "bottom"].forEach(function (t) {
11863
- a[e].queue[t].forEach(function (e) {
11864
- e.resized = !1;
11865
- });
11866
- });
11867
- }, f = 0; f < a.length; f++) {
11868
- c(f);
11869
- }n.channels = a, "b2t" === n.direction ? n.channelWidth = o : n.channelHeight = o;
11870
- } else if (n.channels && n.channels.length > a.length) {
11871
- for (var h = function h(t) {
11872
- a[t] = { id: t, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} }, ["scroll", "top", "bottom"].forEach(function (i) {
11873
- if ("top" === i && t > Math.floor(a.length / 2)) ;else if ("bottom" === i && t <= Math.floor(a.length / 2)) ;else {
11874
- var r = "bottom" === i ? t - a.length + n.channels.length : t;n.channels[r].queue[i].forEach(function (s, l) {
11875
- if (s.el) {
11876
- if (a[t].queue[i].push(s), "bottom" === i && s.channel_id[0] + s.channel_id[1] - 1 === r) {
11877
- var u = [].concat(s.channel_id);s.channel_id = [u[0] - n.channels.length + a.length, u[1]], s.top = s.channel_id[0] * o, n.danmu.config.area && n.danmu.config.area.start && (s.top += n.containerHeight * n.danmu.config.area.start), s.topInit();
11878
- }s.pauseMove(n.containerPos, e), "paused" !== s.danmu.bulletBtn.main.status && s.startMove(n.containerPos), s.resized || (s.resized = !0);
11879
- }n.channels[r].queue[i].splice(l, 1);
11880
- });
11881
- }
11882
- });
11883
- }, d = 0; d < a.length; d++) {
11884
- h(d);
11885
- }for (var g = function g(e) {
11886
- ["scroll", "top", "bottom"].forEach(function (t) {
11887
- a[e].queue[t].forEach(function (e) {
11888
- e.resized = !1;
11889
- });
11890
- });
11891
- }, p = 0; p < a.length; p++) {
11892
- g(p);
11893
- }n.channels = a, "b2t" === n.direction ? n.channelWidth = o : n.channelHeight = o;
11894
- }n.resizing = !1;
11895
- }, 10));
11896
12035
  } }, { key: "addBullet", value: function value(e) {
11897
12036
  var t = this,
11898
12037
  n = this.danmu,
@@ -11902,36 +12041,38 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11902
12041
  a = void 0;if ("b2t" === t.direction ? (r = this.channelWidth, a = Math.ceil(e.width / r)) : (o = this.channelHeight, a = Math.ceil(e.height / o)), a > i.length) return { result: !1, message: "exceed channels.length, occupy=" + a + ",channelsSize=" + i.length };for (var s = !0, l = void 0, u = -1, c = 0, f = i.length; c < f; c++) {
11903
12042
  if (i[c].queue[e.mode].some(function (t) {
11904
12043
  return t.id === e.id;
11905
- })) return { result: !1, message: "exsited, channelOrder=" + c + ",danmu_id=" + e.id };
12044
+ })) return { result: !1, message: "exited, channelOrder=" + c + ",danmu_id=" + e.id };
11906
12045
  }if ("scroll" === e.mode) for (var h = 0, d = i.length - a; h <= d; h++) {
11907
- s = !0;for (var g = h; g < h + a; g++) {
11908
- if ((l = i[g]).operating.scroll) {
12046
+ s = !0;for (var p = h; p < h + a; p++) {
12047
+ if ((l = i[p]).operating.scroll) {
11909
12048
  s = !1;break;
11910
12049
  }if (l.bookId.scroll && l.bookId.scroll !== e.id) {
11911
12050
  s = !1;break;
11912
- }l.operating.scroll = !0;var p = l.queue.scroll[0];if (p) {
11913
- var m = p.el.getBoundingClientRect();if ("b2t" === t.direction) {
11914
- if (m.bottom > t.containerPos.bottom) {
12051
+ }l.operating.scroll = !0;var g = l.queue.scroll[0];if (g) {
12052
+ var m = g.el.getBoundingClientRect();if ("b2t" === t.direction) {
12053
+ if (m.bottom >= t.containerPos.bottom) {
11915
12054
  s = !1, l.operating.scroll = !1;break;
11916
12055
  }
11917
- } else if (m.right > t.containerPos.right) {
12056
+ } else if (m.right >= t.containerPos.right) {
11918
12057
  s = !1, l.operating.scroll = !1;break;
11919
- }var v,
12058
+ }var v = void 0,
12059
+ y = g.moveV,
11920
12060
  b = void 0,
11921
- y = void 0,
11922
- w = void 0,
11923
- _ = void 0;if ("b2t" === t.direction ? (y = (m.top - t.containerPos.top + m.height) / (b = (t.containerPos.height + m.height) / p.duration), w = t.containerPos.height, _ = (t.containerPos.height + e.height) / e.duration) : (y = (m.left - t.containerPos.left + m.width) / (b = (t.containerPos.width + m.width) / p.duration), w = t.containerPos.width, _ = (t.containerPos.width + e.width) / e.duration), v = w / _, n.config.bOffset || (n.config.bOffset = 0), b < _ && y + n.config.bOffset > v) {
11924
- s = !1, l.operating.scroll = !1;break;
12061
+ _ = e.moveV,
12062
+ w = void 0;if ("b2t" === t.direction ? (b = (v = m.bottom - t.containerTop) / y, w = t.containerHeight + e.random - v) : (b = (v = m.right - t.containerLeft) / y, w = t.containerWidth + e.random - v), _ > y) {
12063
+ var O = w / (_ - y);if (n.config.bOffset || (n.config.bOffset = 0), b + n.config.bOffset >= O) {
12064
+ var k = b * _ - t.containerPos.width;k > 0 && e.updateOffset(k + (1 + Math.ceil(5 * Math.random())));
12065
+ }
11925
12066
  }
11926
12067
  }l.operating.scroll = !1;
11927
12068
  }if (s) {
11928
12069
  u = h;break;
11929
12070
  }
11930
- } else if ("top" === e.mode) for (var O = 0, k = i.length - a; O <= k; O++) {
11931
- s = !0;for (var x = O; x < O + a; x++) {
11932
- if (x > Math.floor(i.length / 2)) {
12071
+ } else if ("top" === e.mode) for (var x = 0, C = i.length - a; x <= C; x++) {
12072
+ s = !0;for (var j = x; j < x + a; j++) {
12073
+ if (j > Math.floor(i.length / 2)) {
11933
12074
  s = !1;break;
11934
- }if ((l = i[x]).operating[e.mode]) {
12075
+ }if ((l = i[j]).operating[e.mode]) {
11935
12076
  s = !1;break;
11936
12077
  }if ((l.bookId[e.mode] || e.prior) && l.bookId[e.mode] !== e.id) {
11937
12078
  s = !1;break;
@@ -11939,13 +12080,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11939
12080
  s = !1, l.operating[e.mode] = !1;break;
11940
12081
  }l.operating[e.mode] = !1;
11941
12082
  }if (s) {
11942
- u = O;break;
12083
+ u = x;break;
11943
12084
  }
11944
- } else if ("bottom" === e.mode) for (var M = i.length - a; M >= 0; M--) {
11945
- s = !0;for (var C = M; C < M + a; C++) {
11946
- if (C <= Math.floor(i.length / 2)) {
12085
+ } else if ("bottom" === e.mode) for (var E = i.length - a; E >= 0; E--) {
12086
+ s = !0;for (var M = E; M < E + a; M++) {
12087
+ if (M <= Math.floor(i.length / 2)) {
11947
12088
  s = !1;break;
11948
- }if ((l = i[C]).operating[e.mode]) {
12089
+ }if ((l = i[M]).operating[e.mode]) {
11949
12090
  s = !1;break;
11950
12091
  }if ((l.bookId[e.mode] || e.prior) && l.bookId[e.mode] !== e.id) {
11951
12092
  s = !1;break;
@@ -11953,40 +12094,40 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11953
12094
  s = !1, l.operating[e.mode] = !1;break;
11954
12095
  }l.operating[e.mode] = !1;
11955
12096
  }if (s) {
11956
- u = M;break;
12097
+ u = E;break;
11957
12098
  }
11958
12099
  }if (-1 !== u) {
11959
- for (var E = u, j = u + a; E < j; E++) {
11960
- (l = i[E]).operating[e.mode] = !0, l.queue[e.mode].unshift(e), e.prior && (delete l.bookId[e.mode], t.logger && t.logger.info(E + "号轨道恢复正常使用")), l.operating[e.mode] = !1;
12100
+ for (var L = u, T = u + a; L < T; L++) {
12101
+ (l = i[L]).operating[e.mode] = !0, l.queue[e.mode].unshift(e), e.prior && (delete l.bookId[e.mode], t.logger && t.logger.info(L + "号轨道恢复正常使用")), l.operating[e.mode] = !1;
11961
12102
  }if (e.prior) if (t.logger && t.logger.info(e.id + "号优先弹幕运行完毕"), delete e.bookChannelId, n.player) n.bulletBtn.main.data.some(function (t) {
11962
12103
  return t.id === e.id && (delete t.bookChannelId, !0);
11963
12104
  });return e.channel_id = [u, a], "b2t" === t.direction ? (e.top = u * r, t.danmu.config.area && t.danmu.config.area.start && (e.top += t.containerWidth * t.danmu.config.area.start)) : (e.top = u * o, t.danmu.config.area && t.danmu.config.area.start && (e.top += t.containerHeight * t.danmu.config.area.start)), { result: e, message: "success" };
11964
12105
  }if (e.options.realTime) {
11965
- var B = 0,
11966
- T = -1,
11967
- P = null;if (t.danmu.bulletBtn.main.queue.forEach(function (e, n) {
11968
- !e.prior && !e.options.realTime && e.el && e.el.getBoundingClientRect().left > t.containerPos.right && e.start >= B && (B = e.start, T = n, P = e);
11969
- }), P) {
11970
- P.remove(), t.removeBullet(P), t.danmu.bulletBtn.main.queue.splice(T, 1), e.channel_id = P.channel_id;for (var z = P.channel_id[0], S = P.channel_id[0] + P.channel_id[1]; z < S; z++) {
11971
- (l = i[z]).operating[e.mode] = !0, l.queue[e.mode].unshift(e), e.prior && delete l.bookId[e.mode], l.operating[e.mode] = !1;
11972
- }return e.top = P.top, t.danmu.config.area && t.danmu.config.area.start && (e.top += t.containerHeight * t.danmu.config.area.start), { result: e, message: "success" };
12106
+ var P = 0,
12107
+ z = -1,
12108
+ S = null;if (t.danmu.bulletBtn.main.queue.forEach(function (e, n) {
12109
+ !e.prior && !e.options.realTime && e.el && e.el.getBoundingClientRect().left > t.containerPos.right && e.start >= P && (P = e.start, z = n, S = e);
12110
+ }), S) {
12111
+ S.remove(), t.removeBullet(S), t.danmu.bulletBtn.main.queue.splice(z, 1), e.channel_id = S.channel_id;for (var D = S.channel_id[0], I = S.channel_id[0] + S.channel_id[1]; D < I; D++) {
12112
+ (l = i[D]).operating[e.mode] = !0, l.queue[e.mode].unshift(e), e.prior && delete l.bookId[e.mode], l.operating[e.mode] = !1;
12113
+ }return e.top = S.top, t.danmu.config.area && t.danmu.config.area.start && (e.top += t.containerHeight * t.danmu.config.area.start), { result: e, message: "success" };
11973
12114
  }
11974
12115
  }if (e.prior) if (e.bookChannelId || t.danmu.live) {
11975
12116
  if (n.player) n.bulletBtn.main.data.some(function (n) {
11976
12117
  return n.id === e.id && (t.logger && t.logger.info(e.id + "号优先弹幕将于2秒后再次请求注册"), n.start += 2e3, !0);
11977
12118
  });
11978
12119
  } else {
11979
- u = -1;for (var L = 0, D = i.length - a; L <= D; L++) {
11980
- s = !0;for (var q = L; q < L + a; q++) {
11981
- if (i[q].bookId[e.mode]) {
12120
+ u = -1;for (var q = 0, R = i.length - a; q <= R; q++) {
12121
+ s = !0;for (var A = q; A < q + a; A++) {
12122
+ if (i[A].bookId[e.mode]) {
11982
12123
  s = !1;break;
11983
12124
  }
11984
12125
  }if (s) {
11985
- u = L;break;
12126
+ u = q;break;
11986
12127
  }
11987
12128
  }if (-1 !== u) {
11988
- for (var R = u; R < u + a; R++) {
11989
- i[R].bookId[e.mode] = e.id, t.logger && t.logger.info(R + "号轨道被" + e.id + "号优先弹幕预定");
12129
+ for (var U = u; U < u + a; U++) {
12130
+ i[U].bookId[e.mode] = e.id, t.logger && t.logger.info(U + "号轨道被" + e.id + "号优先弹幕预定");
11990
12131
  }if (n.player) n.bulletBtn.main.data.some(function (n) {
11991
12132
  return n.id === e.id && (t.logger && t.logger.info(e.id + "号优先弹幕将于2秒后再次请求注册"), n.start += 2e3, n.bookChannelId = [u, a], t.logger && t.logger.info(e.id + "号优先弹幕预定了" + u + "~" + (u + a - 1) + "号轨道"), !0);
11992
12133
  });
@@ -12000,187 +12141,107 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
12000
12141
  }), a > -1 && i.queue[e.mode].splice(a, 1), i.operating[e.mode] = !1;
12001
12142
  }
12002
12143
  }e.options.loop && this.danmu.bulletBtn.main.playedData.push(e.options);
12003
- } }, { key: "resetArea", value: function value() {
12004
- this.logger && this.logger.info("resetArea");var e = this.danmu.container,
12005
- t = this,
12006
- n = e.getBoundingClientRect();t.width = n.width, t.height = n.height, t.danmu.config.area && t.danmu.config.area.start >= 0 && t.danmu.config.area.end >= t.danmu.config.area.start && ("b2t" === t.direction ? t.width = t.width * (t.danmu.config.area.end - t.danmu.config.area.start) : t.height = t.height * (t.danmu.config.area.end - t.danmu.config.area.start)), t.container = e;var i = t.danmu.config.channelSize || (/mobile/gi.test(navigator.userAgent) ? 10 : 12),
12007
- o = void 0;o = "b2t" === t.direction ? Math.floor(t.width / i) : Math.floor(t.height / i);for (var r = [], a = 0; a < o; a++) {
12008
- r[a] = { id: a, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} };
12009
- }if (t.channels && t.channels.length <= r.length) {
12010
- for (var s = function s(e) {
12011
- r[e] = { id: e, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} }, ["scroll", "top"].forEach(function (n) {
12012
- t.channels[e].queue[n].forEach(function (i) {
12013
- i.el && (r[e].queue[n].push(i), i.resized || (i.pauseMove(t.containerPos, !1), i.startMove(t.containerPos), i.resized = !0));
12144
+ } }, { key: "resizeSync", value: function value() {
12145
+ this.resize(!0);
12146
+ } }, { key: "resize", value: function value() {
12147
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];this.logger && this.logger.info("resize");var t = this;function n() {
12148
+ var e = t.danmu,
12149
+ n = e.container,
12150
+ i = e.config,
12151
+ o = e.bulletBtn,
12152
+ r = void 0;if (t.updatePos(), t._cancelResizeTimer(), o.main.data && o.main.data.forEach(function (e) {
12153
+ e.bookChannelId && (delete e.bookChannelId, t.logger && t.logger.info("resize导致" + e.id + "号优先弹幕预定取消"));
12154
+ }), t.logger && t.logger.info("resize导致所有轨道恢复正常使用"), t.width = t.containerWidth, t.height = t.containerHeight, i.area) {
12155
+ var a = i.area,
12156
+ u = a.lines,
12157
+ c = a.start,
12158
+ f = a.end;(0, l.validAreaLineRule)(u) ? r = u : c >= 0 && f >= c && ("b2t" === t.direction ? t.width = t.width * (f - c) : t.height = t.height * (f - c));
12159
+ }t.container = n;var h = i.channelSize || (/mobile/gi.test(navigator.userAgent) ? 10 : 12);(0, s.isNumber)(r) || (r = "b2t" === t.direction ? Math.floor(t.width / h) : Math.floor(t.height / h));for (var d = [], p = 0; p < r; p++) {
12160
+ d[p] = { id: p, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} };
12161
+ }if (t.channels && t.channels.length <= d.length) {
12162
+ for (var g = function g(e) {
12163
+ d[e] = { id: e, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} }, ["scroll", "top"].forEach(function (n) {
12164
+ t.channels[e].queue[n].forEach(function (t) {
12165
+ t.el && d[e].queue[n].push(t);
12166
+ });
12167
+ }), t.channels[e].queue.bottom.forEach(function (n) {
12168
+ if (n.el && (d[e + d.length - t.channels.length].queue.bottom.push(n), n.channel_id[0] + n.channel_id[1] - 1 === e)) {
12169
+ var i = [].concat(n.channel_id);n.channel_id = [i[0] - t.channels.length + d.length, i[1]], n.top = n.channel_id[0] * h, t.danmu.config.area && t.danmu.config.area.start && (n.top += t.containerHeight * t.danmu.config.area.start), n.topInit();
12170
+ }
12014
12171
  });
12015
- }), t.channels[e].queue.bottom.forEach(function (n) {
12016
- if (n.el) {
12017
- if (r[e + r.length - t.channels.length].queue.bottom.push(n), n.channel_id[0] + n.channel_id[1] - 1 === e) {
12018
- var o = [].concat(n.channel_id);n.channel_id = [o[0] - t.channels.length + r.length, o[1]], n.top = n.channel_id[0] * i, t.danmu.config.area && t.danmu.config.area.start && (n.top += t.containerHeight * t.danmu.config.area.start), n.topInit();
12019
- }n.resized || (n.pauseMove(t.containerPos, !1), n.startMove(t.containerPos), n.resized = !0);
12020
- }
12021
- });
12022
- }, l = 0; l < t.channels.length; l++) {
12023
- s(l);
12024
- }for (var u = function u(e) {
12025
- ["scroll", "top", "bottom"].forEach(function (t) {
12026
- r[e].queue[t].forEach(function (e) {
12027
- e.resized = !1;
12172
+ }, m = 0; m < t.channels.length; m++) {
12173
+ g(m);
12174
+ }for (var v = function v(e) {
12175
+ ["scroll", "top", "bottom"].forEach(function (t) {
12176
+ d[e].queue[t].forEach(function (e) {
12177
+ e.resized = !1;
12178
+ });
12028
12179
  });
12029
- });
12030
- }, c = 0; c < r.length; c++) {
12031
- u(c);
12032
- }t.channels = r, "b2t" === t.direction ? t.channelWidth = i : t.channelHeight = i;
12033
- } else if (t.channels && t.channels.length > r.length) {
12034
- for (var f = function f(e) {
12035
- r[e] = { id: e, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} }, ["scroll", "top", "bottom"].forEach(function (n) {
12036
- if ("top" === n && e > Math.floor(r.length / 2)) ;else if ("bottom" === n && e <= Math.floor(r.length / 2)) ;else {
12037
- var o = "bottom" === n ? e - r.length + t.channels.length : e;t.channels[o].queue[n].forEach(function (a, s) {
12038
- if (a.el) {
12039
- if (r[e].queue[n].push(a), "bottom" === n && a.channel_id[0] + a.channel_id[1] - 1 === o) {
12040
- var l = [].concat(a.channel_id);a.channel_id = [l[0] - t.channels.length + r.length, l[1]], a.top = a.channel_id[0] * i, t.danmu.config.area && t.danmu.config.area.start && (a.top += t.containerHeight * t.danmu.config.area.start), a.topInit();
12041
- }a.resized || (a.pauseMove(t.containerPos, !1), a.startMove(t.containerPos), a.resized = !0);
12042
- }t.channels[o].queue[n].splice(s, 1);
12180
+ }, y = 0; y < d.length; y++) {
12181
+ v(y);
12182
+ }t.channels = d, "b2t" === t.direction ? t.channelWidth = h : t.channelHeight = h;
12183
+ } else if (t.channels && t.channels.length > d.length) {
12184
+ for (var b = function b(e) {
12185
+ d[e] = { id: e, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} }, ["scroll", "top", "bottom"].forEach(function (n) {
12186
+ if ("top" === n && e > Math.floor(d.length / 2)) ;else if ("bottom" === n && e <= Math.floor(d.length / 2)) ;else {
12187
+ var i = "bottom" === n ? e - d.length + t.channels.length : e;t.channels[i].queue[n].forEach(function (o, r) {
12188
+ if (o.el && (d[e].queue[n].push(o), "bottom" === n && o.channel_id[0] + o.channel_id[1] - 1 === i)) {
12189
+ var a = [].concat(o.channel_id);o.channel_id = [a[0] - t.channels.length + d.length, a[1]], o.top = o.channel_id[0] * h, t.danmu.config.area && t.danmu.config.area.start && (o.top += t.containerHeight * t.danmu.config.area.start), o.topInit();
12190
+ }t.channels[i].queue[n].splice(r, 1);
12191
+ });
12192
+ }
12193
+ });
12194
+ }, _ = 0; _ < d.length; _++) {
12195
+ b(_);
12196
+ }for (var w = function w(e) {
12197
+ ["scroll", "top", "bottom"].forEach(function (t) {
12198
+ d[e].queue[t].forEach(function (e) {
12199
+ e.resized = !1;
12043
12200
  });
12044
- }
12045
- });
12046
- }, h = 0; h < r.length; h++) {
12047
- f(h);
12048
- }for (var d = function d(e) {
12049
- ["scroll", "top", "bottom"].forEach(function (t) {
12050
- r[e].queue[t].forEach(function (e) {
12051
- e.resized = !1;
12052
12201
  });
12053
- });
12054
- }, g = 0; g < r.length; g++) {
12055
- d(g);
12056
- }t.channels = r, "b2t" === t.direction ? t.channelWidth = i : t.channelHeight = i;
12057
- }
12202
+ }, O = 0; O < d.length; O++) {
12203
+ w(O);
12204
+ }t.channels = d, "b2t" === t.direction ? t.channelWidth = h : t.channelHeight = h;
12205
+ }t.resizing = !1;
12206
+ }t.resizing || (t.resizing = !0, e ? n() : (this._cancelResizeTimer(), this.resizeId = requestAnimationFrame(n)));
12207
+ } }, { key: "_cancelResizeTimer", value: function value() {
12208
+ this.resizeId && (cancelAnimationFrame(this.resizeId), this.resizeId = null);
12058
12209
  } }, { key: "reset", value: function value() {
12059
- var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];this.logger && this.logger.info("reset");var t = this.danmu.container,
12060
- n = this;function i() {
12061
- var e = t.getBoundingClientRect();n.width = e.width, n.height = e.height, n.danmu.config.area && n.danmu.config.area.start >= 0 && n.danmu.config.area.end >= n.danmu.config.area.start && ("b2t" === n.direction ? n.width = n.width * (n.danmu.config.area.end - n.danmu.config.area.start) : n.height = n.height * (n.danmu.config.area.end - n.danmu.config.area.start)), n.container = t;var i = n.danmu.config.channelSize || (/mobile/gi.test(navigator.userAgent) ? 10 : 12),
12062
- o = void 0;o = "b2t" === n.direction ? Math.floor(n.width / i) : Math.floor(n.height / i);for (var r = [], a = 0; a < o; a++) {
12063
- r[a] = { id: a, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} };
12064
- }n.channels = r, "b2t" === n.direction ? n.channelWidth = i : n.channelHeight = i;
12065
- }n.danmu.bulletBtn && n.danmu.bulletBtn.main && n.danmu.bulletBtn.main.queue.forEach(function (e) {
12066
- e.pauseMove(n.containerPos), e.remove();
12067
- }), n.channels && n.channels.length > 0 && ["scroll", "top", "bottom"].forEach(function (e) {
12068
- for (var t = 0; t < n.channels.length; t++) {
12069
- n.channels[t].queue[e].forEach(function (e) {
12070
- e.pauseMove(n.containerPos), e.remove();
12210
+ var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];this.logger && this.logger.info("reset");var t = this,
12211
+ n = t.danmu,
12212
+ i = n.container,
12213
+ o = n.bulletBtn,
12214
+ r = n.config;function a() {
12215
+ var e = void 0,
12216
+ n = i.getBoundingClientRect();if (t.width = n.width, t.height = n.height, t.resetId && (cancelAnimationFrame(t.resetId), t.resetId = null), r.area) {
12217
+ var o = r.area,
12218
+ a = o.lines,
12219
+ u = o.start,
12220
+ c = o.end;(0, l.validAreaLineRule)(a) ? e = a : u >= 0 && c >= u && ("b2t" === t.direction ? t.width = t.width * (c - u) : t.height = t.height * (c - u));
12221
+ }var f = r.channelSize || (/mobile/gi.test(navigator.userAgent) ? 10 : 12);(0, s.isNumber)(e) || (e = "b2t" === t.direction ? Math.floor(t.width / f) : Math.floor(t.height / f));for (var h = [], d = 0; d < e; d++) {
12222
+ h[d] = { id: d, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} };
12223
+ }t.channels = h, "b2t" === t.direction ? t.channelWidth = f : t.channelHeight = f;
12224
+ }t.container = i, o && o.main && o.main.queue.forEach(function (e) {
12225
+ e.remove();
12226
+ }), t.channels && t.channels.length > 0 && ["scroll", "top", "bottom"].forEach(function (e) {
12227
+ for (var n = 0; n < t.channels.length; n++) {
12228
+ t.channels[n].queue[e].forEach(function (e) {
12229
+ e.remove();
12071
12230
  });
12072
12231
  }
12073
- }), n.danmu.bulletBtn && n.danmu.bulletBtn.main && n.danmu.bulletBtn.main.data && n.danmu.bulletBtn.main.data.forEach(function (e) {
12074
- e.hasAttached = !1;
12075
- }), e ? this.resetTimer = setTimeout(i, 200) : i();
12076
- } }, { key: "resetWithCb", value: function value(e, t) {
12077
- this.logger && this.logger.info("resetWithCb");var n = this.danmu.container,
12078
- i = this;i.channels && i.channels.length > 0 && ["scroll", "top", "bottom"].forEach(function (e) {
12079
- for (var t = 0; t < i.channels.length; t++) {
12080
- i.channels[t].queue[e].forEach(function (e) {
12081
- e.pauseMove(i.containerPos), e.remove();
12082
- });
12083
- }
12084
- });var o = n.getBoundingClientRect();i.width = o.width, i.height = o.height, i.danmu.config.area && i.danmu.config.area.start >= 0 && i.danmu.config.area.end >= i.danmu.config.area.start && ("b2t" === i.direction ? i.width = i.width * (i.danmu.config.area.end - i.danmu.config.area.start) : i.height = i.height * (i.danmu.config.area.end - i.danmu.config.area.start)), i.container = n;var r = i.danmu.config.channelSize || (/mobile/gi.test(navigator.userAgent) ? 10 : 12),
12085
- a = void 0;a = "b2t" === i.direction ? Math.floor(i.width / r) : Math.floor(i.height / r);for (var s = [], l = 0; l < a; l++) {
12086
- s[l] = { id: l, queue: { scroll: [], top: [], bottom: [] }, operating: { scroll: !1, top: !1, bottom: !1 }, bookId: {} };
12087
- }i.channels = s, i.channelHeight = r, e && e(!0, t);
12232
+ }), o && o.main && o.main.data && o.main.data.forEach(function (e) {
12233
+ e.attached_ = !1;
12234
+ }), e ? this.resetId = requestAnimationFrame(a) : a();
12088
12235
  } }]), t;
12089
- }(o.default);t.default = s, e.exports = t.default;
12236
+ }(a.default);t.default = u, e.exports = t.default;
12090
12237
  }, function (e, t, n) {
12091
12238
  "use strict";
12092
- Object.defineProperty(t, "__esModule", { value: !0 });var i = function () {
12093
- function e(e, t) {
12094
- for (var n = 0; n < t.length; n++) {
12095
- var i = t[n];i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i);
12096
- }
12097
- }return function (t, n, i) {
12098
- return n && e(t.prototype, n), i && e(t, i), t;
12099
- };
12100
- }(),
12101
- o = a(n(1)),
12102
- r = a(n(0));function a(e) {
12103
- return e && e.__esModule ? e : { default: e };
12104
- }var s = function (e) {
12105
- function t(e, n) {
12106
- !function (e, t) {
12107
- if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
12108
- }(this, t);var i = function (e, t) {
12109
- if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return !t || "object" != (typeof t === "undefined" ? "undefined" : _typeof(t)) && "function" != typeof t ? e : t;
12110
- }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));i.setLogger("bullet"), i.danmu = e, i.options = n, i.duration = n.duration, i.moveV = n.moveV, i.id = n.id, i.container = e.container, i.start = n.start, i.prior = n.prior, i.color = n.color, i.bookChannelId = n.bookChannelId, i.direction = e.direction;var o = i;i.onChangeDirection = function (e) {
12111
- o.direction = e;
12112
- }, i.danmu.on("changeDirection", i.onChangeDirection);var a = void 0;if (i.domObj = e.domObj, n.el && 1 === n.el.nodeType) {
12113
- a = i.domObj.use();var s = r.default.copyDom(n.el);n.eventListeners && n.eventListeners.length > 0 && n.eventListeners.forEach(function (e) {
12114
- s.addEventListener(e.event, e.listener, e.useCapture || !1);
12115
- }), a.appendChild(s);
12116
- } else (a = i.domObj.use()).textContent = n.txt;if (n.style) {
12117
- var l = n.style;Object.keys(l).forEach(function (e) {
12118
- r.default.style(a, e, l[e]);
12119
- });
12120
- }"top" === n.mode || "bottom" === n.mode ? i.mode = n.mode : i.mode = "scroll", i.el = a, n.like && n.like.el && i.setLikeDom(n.like.el, n.like.style), i.status = "waiting";var u = i.container.getBoundingClientRect(),
12121
- c = Math.floor(Math.random() * (u.width / 10 > 100 ? 200 : u.width / 10));n.realTime && (c = 0);var f = u.width + c + "px";return r.default.style(i.el, "left", f), i.containerPos = u, i;
12122
- }return function (e, t) {
12123
- if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (typeof t === "undefined" ? "undefined" : _typeof(t)));e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
12124
- }(t, e), i(t, [{ key: "attach", value: function value() {
12125
- if (this.container.appendChild(this.el), this.elPos = this.el.getBoundingClientRect(), "b2t" === this.direction ? (this.width = this.elPos.height, this.height = this.elPos.width) : (this.width = this.elPos.width, this.height = this.elPos.height), this.moveV) {
12126
- var e = this.containerPos;this.duration = (e.width + this.width) / this.moveV * 1e3;
12127
- }this.danmu.config && this.danmu.config.mouseControl && (this.mouseoverFunWrapper = this.mouseoverFun.bind(this), this.el.addEventListener("mouseover", this.mouseoverFunWrapper, !1)), this.danmu.config && this.danmu.config.mouseEnterControl && (this.mouseEnterFunWrapper = this.mouseoverFun.bind(this), this.el.addEventListener("mouseenter", this.mouseEnterFunWrapper, !1));
12128
- } }, { key: "mouseoverFun", value: function value(e) {
12129
- this.danmu && this.danmu.mouseControl && this.danmu.config.mouseControlPause || "waiting" === this.status || "end" === this.status || this.danmu && this.danmu.emit("bullet_hover", { bullet: this, event: e });
12130
- } }, { key: "detach", value: function value() {
12131
- this.el && (this.danmu.config && this.danmu.config.mouseControl && this.el.removeEventListener("mouseover", this.mouseoverFunWrapper, !1), this.danmu.config && this.danmu.config.mouseEnterControl && this.el.removeEventListener("mouseenter", this.mouseEnterFunWrapper, !1), this.el.parentNode && this.el.parentNode.removeChild(this.el), this.domObj.unuse(this.el), this.el = null), this.danmu.off("changeDirection", this.onChangeDirection);
12132
- } }, { key: "topInit", value: function value() {
12133
- if (this.logger && this.logger.info("topInit #" + (this.options.txt || "[DOM Element]") + "#"), "b2t" === this.direction) {
12134
- var e = this.containerPos;r.default.style(this.el, "transformOrigin", "left top"), r.default.style(this.el, "transform", "translateX(-" + this.top + "px) translateY(" + e.height + "px) translateZ(0px) rotate(90deg)"), r.default.style(this.el, "transition", "transform 0s linear 0s");
12135
- } else r.default.style(this.el, "top", this.top + "px");
12136
- } }, { key: "pauseMove", value: function value(e) {
12137
- var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];this.logger && this.logger.info("pauseMove #" + (this.options.txt || "[DOM Element]") + "#");var n = this;if ("paused" !== this.status && ("forcedPause" !== n.status && (this.status = "paused"), clearTimeout(n.removeTimer), this.el)) if (r.default.style(this.el, "willChange", "auto"), "scroll" === this.mode) {
12138
- if (t) {
12139
- var i = (new Date().getTime() - n.moveTime) / 1e3,
12140
- o = i * this.moveV,
12141
- a = 0;a = n.moveMoreS - o >= 0 ? "b2t" === this.direction ? (n.moveMoreS - o) / n.moveContainerHeight * e.height : (n.moveMoreS - o) / n.moveContainerWidth * e.width : n.moveMoreS - o, "b2t" === this.direction ? r.default.style(this.el, "transform", "translateX(-" + this.top + "px) translateY(" + a + "px) translateZ(0px) rotate(90deg)") : r.default.style(this.el, "left", a + "px");
12142
- } else "b2t" === this.direction ? r.default.style(this.el, "transform", "translateX(-" + this.top + "px) translateY(" + (this.el.getBoundingClientRect().top - e.top) + "px) translateZ(0px) rotate(90deg)") : r.default.style(this.el, "left", this.el.getBoundingClientRect().left - e.left + "px");"b2t" === this.direction || r.default.style(this.el, "transform", "translateX(0px) translateY(0px) translateZ(0px)"), r.default.style(this.el, "transition", "transform 0s linear 0s");
12143
- } else this.pastDuration && this.startTime ? this.pastDuration = this.pastDuration + new Date().getTime() - this.startTime : this.pastDuration = 1;
12144
- } }, { key: "startMove", value: function value(e, t) {
12145
- this.logger && this.logger.info("startMove #" + (this.options.txt || "[DOM Element]") + "#");var n = this;if (n.hasMove || (n.danmu.emit("bullet_start", n), n.hasMove = !0), ("forcedPause" !== n.status || t) && this.el && "start" !== this.status) if (this.status = "start", r.default.style(this.el, "willChange", "transform"), "scroll" === this.mode) {
12146
- if ("b2t" === this.direction) {
12147
- this.moveV = (e.height + this.height) / this.duration * 1e3;var i = (n.el.getBoundingClientRect().bottom - e.top) / this.moveV;r.default.style(this.el, "transition", "transform " + i + "s linear 0s"), this.startMoveTimer = setTimeout(function () {
12148
- n.el && (r.default.style(n.el, "transform", "translateX(-" + n.top + "px) translateY(-" + n.height + "px) translateZ(0px) rotate(90deg)"), n.moveTime = new Date().getTime(), n.moveMoreS = n.el.getBoundingClientRect().top - e.top, n.moveContainerHeight = e.height, n.removeTimer = setTimeout(l, 1e3 * i));
12149
- }, 20);
12150
- } else {
12151
- var o = this.el.getBoundingClientRect();this.moveV = (e.width + this.width) / this.duration * 1e3;var a = (o.right - e.left) / this.moveV;r.default.style(this.el, "transition", "transform " + a + "s linear 0s"), this.startMoveTimer = setTimeout(function () {
12152
- if (n.el) {
12153
- var t = n.el.getBoundingClientRect(),
12154
- i = (t.right - e.left) / a;t.right > e.left && i > n.moveV - 1 && i < n.moveV + 1 ? (r.default.style(n.el, "transform", "translateX(-" + (t.right - e.left) + "px) translateY(0px) translateZ(0px)"), n.moveTime = new Date().getTime(), n.moveMoreS = t.left - e.left, n.moveContainerWidth = e.width, n.removeTimer = setTimeout(l, 1e3 * a)) : (n.status = "end", n.remove());
12155
- }
12156
- }, 0);
12157
- }
12158
- } else {
12159
- r.default.style(this.el, "left", "50%"), r.default.style(this.el, "margin", "0 0 0 -" + this.width / 2 + "px"), this.pastDuration || (this.pastDuration = 1);var s = this.duration >= this.pastDuration ? this.duration - this.pastDuration : 0;this.removeTimer = setTimeout(l, s), this.startTime = new Date().getTime();
12160
- }function l() {
12161
- if (n.el) if ("scroll" === n.mode) {
12162
- var e = n.containerPos,
12163
- t = n.el.getBoundingClientRect();"b2t" === n.direction ? t && t.bottom <= e.top + 100 ? (n.status = "end", n.remove()) : (n.pauseMove(e), "paused" !== n.danmu.bulletBtn.main.status && n.startMove(e)) : t && t.right <= e.left + 100 ? (n.status = "end", n.remove()) : (n.pauseMove(e), "paused" !== n.danmu.bulletBtn.main.status && n.startMove(e));
12164
- } else n.status = "end", n.remove();
12165
- }
12166
- } }, { key: "remove", value: function value() {
12167
- this.logger && this.logger.info("remove #" + (this.options.txt || "[DOM Element]") + "#");this.removeTimer && clearTimeout(this.removeTimer), this.startMoveTimer && clearTimeout(this.startMoveTimer), this.el && this.el.parentNode && (r.default.style(this.el, "willChange", "auto"), this.detach(), this.danmu.emit("bullet_remove", { bullet: this }));
12168
- } }, { key: "setFontSize", value: function value(e) {
12169
- this.el && (this.el.style.fontSize = e);
12170
- } }, { key: "setLikeDom", value: function value(e, t) {
12171
- if (e) {
12172
- Object.keys(t).forEach(function (n) {
12173
- e.style[n] = t[n];
12174
- });if (e.className = "danmu-like", this.el) {
12175
- var n = this.el.querySelector(".danmu-like");n && this.el.removeChild(n), this.el.innerHTML = "" + this.el.innerHTML + e.outerHTML;
12176
- }
12177
- }return e;
12178
- } }]), t;
12179
- }(o.default);t.default = s, e.exports = t.default;
12239
+ Object.defineProperty(t, "__esModule", { value: !0 }), t.validAreaLineRule = function (e) {
12240
+ return "number" == typeof e && e >= 0 && Number.isInteger(e);
12241
+ };
12180
12242
  }, function (e, t, n) {
12181
12243
  "use strict";
12182
- Object.defineProperty(t, "__esModule", { value: !0 });var i,
12183
- o = function () {
12244
+ Object.defineProperty(t, "__esModule", { value: !0 });var i = function () {
12184
12245
  function e(e, t) {
12185
12246
  for (var n = 0; n < t.length; n++) {
12186
12247
  var i = t[n];i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i);
@@ -12189,19 +12250,18 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
12189
12250
  return n && e(t.prototype, n), i && e(t, i), t;
12190
12251
  };
12191
12252
  }(),
12192
- r = n(0),
12193
- a = (i = r) && i.__esModule ? i : { default: i };var s = function () {
12253
+ o = n(0);var r = function () {
12194
12254
  function e(t) {
12195
12255
  !function (e, t) {
12196
12256
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
12197
12257
  }(this, e), t = { initDOM: function initDOM() {
12198
12258
  return document.createElement("div");
12199
12259
  }, initSize: 10 }, this.init(t);
12200
- }return o(e, [{ key: "init", value: function value(e) {
12260
+ }return i(e, [{ key: "init", value: function value(e) {
12201
12261
  this.idleList = [], this.usingList = [], this._id = 0, this.options = e, this._expand(e.initSize);
12202
12262
  } }, { key: "use", value: function value() {
12203
12263
  this.idleList.length || this._expand(1);var e = this.idleList.shift();return this.usingList.push(e), e;
12204
- } }, { key: "unuse", value: function value(e) {
12264
+ } }, { key: "unused", value: function value(e) {
12205
12265
  var t = this.usingList.indexOf(e);t < 0 || (this.usingList.splice(t, 1), e.innerHTML = "", e.textcontent = "", this.clearElementStyle(e), this.idleList.push(e));
12206
12266
  } }, { key: "_expand", value: function value(e) {
12207
12267
  for (var t = 0; t < e; t++) {
@@ -12213,17 +12273,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
12213
12273
  }for (var t = 0; t < this.usingList.length; t++) {
12214
12274
  this.usingList[t].innerHTML = "", this.usingList[t].textcontent = "", this.clearElementStyle(this.usingList[t]);
12215
12275
  }for (var n in this) {
12216
- delete this[n];
12276
+ o.hasOwnProperty.call(this, n) && delete this[n];
12217
12277
  }
12218
12278
  } }, { key: "clearElementStyle", value: function value(e) {
12219
- var t = "undefined" != typeof window ? window.navigator.userAgent : null;t && (t.indexOf("MSIE ") > -1 || t.indexOf("Trident/") > -1 ? a.default.style(e, "transform", "none") : e.setAttribute("style", ""));
12279
+ var t = "undefined" != typeof window ? window.navigator.userAgent : null;t && (t.indexOf("MSIE ") > -1 || t.indexOf("Trident/") > -1 ? (0, o.styleUtil)(e, "transform", "none") : e.setAttribute("style", ""));
12220
12280
  } }]), e;
12221
- }();t.default = s, e.exports = t.default;
12222
- }, function (e) {
12223
- e.exports = JSON.parse('{"version":"0.5.10"}');
12281
+ }();t.default = r, e.exports = t.default;
12224
12282
  }, function (e, t, n) {
12225
12283
  "use strict";
12226
- Object.defineProperty(t, "__esModule", { value: !0 });var i = function () {
12284
+ Object.defineProperty(t, "__esModule", { value: !0 }), t.destroyObserver = t.unObserver = t.addObserver = void 0;var i = function () {
12227
12285
  function e(e, t) {
12228
12286
  for (var n = 0; n < t.length; n++) {
12229
12287
  var i = t[n];i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i);
@@ -12231,14 +12289,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
12231
12289
  }return function (t, n, i) {
12232
12290
  return n && e(t.prototype, n), i && e(t, i), t;
12233
12291
  };
12234
- }();var o = new (function () {
12292
+ }(),
12293
+ o = n(0);var r = new (function () {
12235
12294
  function e() {
12236
12295
  var t = this;if (function (e, t) {
12237
12296
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
12238
12297
  }(this, e), this.__handlers = [], window.ResizeObserver) try {
12239
- this.observer = new window.ResizeObserver(function (e) {
12240
- var n = new Date().getTime();n - t.timeStampe < 200 || (t.timeStampe = n, t.__trigger(e));
12241
- }), this.timeStampe = new Date().getTime();
12298
+ this.observer = new window.ResizeObserver((0, o.throttle)(function (e) {
12299
+ t.__trigger(e);
12300
+ }, 100));
12242
12301
  } catch (e) {}
12243
12302
  }return i(e, [{ key: "addObserver", value: function value(e, t) {
12244
12303
  if (this.observer) {
@@ -12270,16 +12329,16 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
12270
12329
  });
12271
12330
  } }]), e;
12272
12331
  }())();t.addObserver = function (e, t) {
12273
- o.addObserver(e, t);
12332
+ r.addObserver(e, t);
12274
12333
  }, t.unObserver = function (e, t) {
12275
- o.unObserver(e, t);
12334
+ r.unObserver(e, t);
12276
12335
  }, t.destroyObserver = function (e, t) {
12277
- o.destroyObserver(e, t);
12336
+ r.destroyObserver(e, t);
12278
12337
  };
12279
12338
  }, function (e, t, n) {
12280
12339
  var i = n(35);"string" == typeof i && (i = [[e.i, i, ""]]);var o = { hmr: !0, transform: void 0, insertInto: void 0 };n(37)(i, o);i.locals && (e.exports = i.locals);
12281
12340
  }, function (e, t, n) {
12282
- (e.exports = n(36)(!1)).push([e.i, ".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#ffffff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}\n", ""]);
12341
+ (e.exports = n(36)(!1)).push([e.i, ".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#fff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}", ""]);
12283
12342
  }, function (e, t) {
12284
12343
  e.exports = function (e) {
12285
12344
  var t = [];return t.toString = function () {
@@ -12335,39 +12394,39 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
12335
12394
  o.refs++;for (var a = 0; a < o.parts.length; a++) {
12336
12395
  o.parts[a](i.parts[a]);
12337
12396
  }for (; a < i.parts.length; a++) {
12338
- o.parts.push(y(i.parts[a], t));
12397
+ o.parts.push(b(i.parts[a], t));
12339
12398
  }
12340
12399
  } else {
12341
12400
  var s = [];for (a = 0; a < i.parts.length; a++) {
12342
- s.push(y(i.parts[a], t));
12401
+ s.push(b(i.parts[a], t));
12343
12402
  }r[i.id] = { id: i.id, refs: 1, parts: s };
12344
12403
  }
12345
12404
  }
12346
- }function g(e, t) {
12405
+ }function p(e, t) {
12347
12406
  for (var n = [], i = {}, o = 0; o < e.length; o++) {
12348
12407
  var r = e[o],
12349
12408
  a = t.base ? r[0] + t.base : r[0],
12350
12409
  s = { css: r[1], media: r[2], sourceMap: r[3] };i[a] ? i[a].parts.push(s) : n.push(i[a] = { id: a, parts: [s] });
12351
12410
  }return n;
12352
- }function p(e, t) {
12411
+ }function g(e, t) {
12353
12412
  var n = l(e.insertInto);if (!n) throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i = f[f.length - 1];if ("top" === e.insertAt) i ? i.nextSibling ? n.insertBefore(t, i.nextSibling) : n.appendChild(t) : n.insertBefore(t, n.firstChild), f.push(t);else if ("bottom" === e.insertAt) n.appendChild(t);else {
12354
12413
  if ("object" != _typeof(e.insertAt) || !e.insertAt.before) throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o = l(e.insertInto + " " + e.insertAt.before);n.insertBefore(t, o);
12355
12414
  }
12356
12415
  }function m(e) {
12357
12416
  if (null === e.parentNode) return !1;e.parentNode.removeChild(e);var t = f.indexOf(e);t >= 0 && f.splice(t, 1);
12358
12417
  }function v(e) {
12359
- var t = document.createElement("style");return void 0 === e.attrs.type && (e.attrs.type = "text/css"), b(t, e.attrs), p(e, t), t;
12360
- }function b(e, t) {
12418
+ var t = document.createElement("style");return void 0 === e.attrs.type && (e.attrs.type = "text/css"), y(t, e.attrs), g(e, t), t;
12419
+ }function y(e, t) {
12361
12420
  Object.keys(t).forEach(function (n) {
12362
12421
  e.setAttribute(n, t[n]);
12363
12422
  });
12364
- }function y(e, t) {
12423
+ }function b(e, t) {
12365
12424
  var n, i, o, r;if (t.transform && e.css) {
12366
12425
  if (!(r = t.transform(e.css))) return function () {};e.css = r;
12367
12426
  }if (t.singleton) {
12368
12427
  var a = c++;n = u || (u = v(t)), i = O.bind(null, n, a, !1), o = O.bind(null, n, a, !0);
12369
12428
  } else e.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (n = function (e) {
12370
- var t = document.createElement("link");return void 0 === e.attrs.type && (e.attrs.type = "text/css"), e.attrs.rel = "stylesheet", b(t, e.attrs), p(e, t), t;
12429
+ var t = document.createElement("link");return void 0 === e.attrs.type && (e.attrs.type = "text/css"), e.attrs.rel = "stylesheet", y(t, e.attrs), g(e, t), t;
12371
12430
  }(t), i = x.bind(null, n, t), o = function o() {
12372
12431
  m(n), n.href && URL.revokeObjectURL(n.href);
12373
12432
  }) : (n = v(t), i = k.bind(null, n), o = function o() {
@@ -12378,10 +12437,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
12378
12437
  } else o();
12379
12438
  };
12380
12439
  }e.exports = function (e, t) {
12381
- if ("undefined" != typeof DEBUG && DEBUG && "object" != (typeof document === "undefined" ? "undefined" : _typeof(document))) throw new Error("The style-loader cannot be used in a non-browser environment");(t = t || {}).attrs = "object" == _typeof(t.attrs) ? t.attrs : {}, t.singleton || "boolean" == typeof t.singleton || (t.singleton = a()), t.insertInto || (t.insertInto = "head"), t.insertAt || (t.insertAt = "bottom");var n = g(e, t);return d(n, t), function (e) {
12440
+ if ("undefined" != typeof DEBUG && DEBUG && "object" != (typeof document === "undefined" ? "undefined" : _typeof(document))) throw new Error("The style-loader cannot be used in a non-browser environment");(t = t || {}).attrs = "object" == _typeof(t.attrs) ? t.attrs : {}, t.singleton || "boolean" == typeof t.singleton || (t.singleton = a()), t.insertInto || (t.insertInto = "head"), t.insertAt || (t.insertAt = "bottom");var n = p(e, t);return d(n, t), function (e) {
12382
12441
  for (var i = [], o = 0; o < n.length; o++) {
12383
12442
  var a = n[o];(s = r[a.id]).refs--, i.push(s);
12384
- }e && d(g(e, t), t);for (o = 0; o < i.length; o++) {
12443
+ }e && d(p(e, t), t);for (o = 0; o < i.length; o++) {
12385
12444
  var s;if (0 === (s = i[o]).refs) {
12386
12445
  for (var l = 0; l < s.parts.length; l++) {
12387
12446
  s.parts[l]();
@@ -12389,11 +12448,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
12389
12448
  }
12390
12449
  }
12391
12450
  };
12392
- };var w,
12393
- _ = (w = [], function (e, t) {
12394
- return w[e] = t, w.filter(Boolean).join("\n");
12451
+ };var _,
12452
+ w = (_ = [], function (e, t) {
12453
+ return _[e] = t, _.filter(Boolean).join("\n");
12395
12454
  });function O(e, t, n, i) {
12396
- var o = n ? "" : i.css;if (e.styleSheet) e.styleSheet.cssText = _(t, o);else {
12455
+ var o = n ? "" : i.css;if (e.styleSheet) e.styleSheet.cssText = w(t, o);else {
12397
12456
  var r = document.createTextNode(o),
12398
12457
  a = e.childNodes;a[t] && e.removeChild(a[t]), a.length ? e.insertBefore(r, a[t]) : e.appendChild(r);
12399
12458
  }
@@ -13522,7 +13581,7 @@ var s_memoryPlay = function s_memoryPlay() {
13522
13581
  }, lastPlayTimeHideDelay * 1000);
13523
13582
  }
13524
13583
  };
13525
- player.once('play', handlePlay);
13584
+ player.once('playing', handlePlay);
13526
13585
  player.once('ended', removeFunc);
13527
13586
  };
13528
13587