Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

danmu.js

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

danmu.js - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

2

browser/index.js

@@ -1,2 +0,2 @@

window.DanmuJs=function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={createDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=document.createElement(t);return o.className=i,o.innerHTML=e,Object.keys(n).forEach(function(e){var i=e,r=n[e];"video"===t||"audio"===t?r&&o.setAttribute(i,r):o.setAttribute(i,r)}),o},hasClass:function(t,e){return t.classList?Array.prototype.some.call(t.classList,function(t){return t===e}):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)}):i.hasClass(t,e)||(t.className+=" "+e)},removeClass:function(t,e){t.classList?e.split(/\s+/g).forEach(function(e){t.classList.remove(e)}):i.hasClass(t,e)&&e.split(/\s+/g).forEach(function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")})},toggleClass:function(t,e){e.split(/\s+/g).forEach(function(e){i.hasClass(t,e)?i.removeClass(t,e):i.addClass(t,e)})},findDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(i){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},deepCopy:function(t,e){if("Object"===i.typeOf(e)&&"Object"===i.typeOf(t))return Object.keys(e).forEach(function(n){"Object"!==i.typeOf(e[n])||e[n]instanceof Node?"Array"===i.typeOf(e[n])?t[n]="Array"===i.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?i.deepCopy(t[n],e[n]):t[n]=e[n]}),t},typeOf:function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},copyDom:function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,function(t){e.setAttribute(t.name,t.value)}),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},formatTime:function(t){var e=Math.floor(t);return 1e3*e+(t-e)}};e.default=i,t.exports=e.default},function(t,e,n){"use strict";var i=n(13)();t.exports=function(t){return t!==i&&null!==t}},function(t,e,n){t.exports=n(3)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(4),r=(i=o)&&i.__esModule?i:{default:i};n(25),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(5)),r=s(n(21)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},comments:[],direction:"r2l"},e),this.hideArr=[],(0,o.default)(this);var i=this;if(this.config.comments.forEach(function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")}),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var s=this.config.containerStyle;Object.keys(s).forEach(function(t){i.container.style[t]=s[t]})}this.player=this.config.player,this.direction=this.config.direction,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),["touchend","click","dblclick"].forEach(function(t){n.container.addEventListener(t,function(e){if(e.preventDefault(),e.stopPropagation(),i.player){var n=void 0;document.createEvent?(n=document.createEvent("Event")).initEvent(t,!0,!0):n=new Event(t),i.player.dispatchEvent(n)}},!1)}),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.id=e,!0)}),this.bulletBtn.main.queue.some(function(i){return i.id===t&&(i.id=e,i.pauseMove(n),i.startMove(n),!0)}))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.duration=e,!0)}),this.bulletBtn.main.queue.some(function(i){return i.id===t&&(i.duration=e,i.pauseMove(n),i.startMove(n),!0)}))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach(function(n){t===n.mode&&(n.duration=e)}),this.bulletBtn.main.queue.forEach(function(i){t===i.mode&&(i.duration=e,i.pauseMove(n),i.startMove(n))}))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t),this.bulletBtn.main.queue.filter(function(e){return t===e.mode||"color"===t&&e.color}).forEach(function(t){return t.remove()})}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}},{key:"setDirection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.emit("changeDirection",t)}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";var i,o,r,a,s,c,u,l=n(6),h=n(20),f=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};o=function(t,e){var n,o;return h(e),o=this,i.call(this,t,n=function(){r.call(o,t,n),f.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:i=function(t,e){var n;return h(e),g.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:o,off:r=function(t,e){var n,i,o,r;if(h(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(r=0;o=i[r];++r)o!==e&&o.__eeOnceListener__!==e||(2===i.length?n[t]=i[r?0:1]:i.splice(r,1));else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,i,o,r;if(g.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(o=o.slice(),e=0;i=o[e];++e)f.call(i,this,r)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];f.call(o,this,r)}}},c={on:l(i),once:l(o),off:l(r),emit:l(a)},u=v({},c),t.exports=e=function(t){return null==t?p(u):v(Object(t),c)},e.methods=s},function(t,e,n){"use strict";var i=n(7),o=n(15),r=n(16),a=n(17);(t.exports=function(t,e){var n,r,s,c,u;return arguments.length<2||"string"!=typeof t?(c=e,e=t,t=null):c=arguments[2],null==t?(n=s=!0,r=!1):(n=a.call(t,"c"),r=a.call(t,"e"),s=a.call(t,"w")),u={value:e,configurable:n,enumerable:r,writable:s},c?i(o(c),u):u}).gs=function(t,e,n){var s,c,u,l;return"string"!=typeof t?(u=n,n=e,e=t,t=null):u=arguments[3],null==e?e=void 0:r(e)?null==n?n=void 0:r(n)||(u=n,n=void 0):(u=e,e=n=void 0),null==t?(s=!0,c=!1):(s=a.call(t,"c"),c=a.call(t,"e")),l={get:e,set:n,configurable:s,enumerable:c},u?i(o(u),l):l}},function(t,e,n){"use strict";t.exports=n(8)()?Object.assign:n(9)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var i=n(10),o=n(14),r=Math.max;t.exports=function(t,e){var n,a,s,c=r(arguments.length,2);for(t=Object(o(t)),s=function(i){try{t[i]=e[i]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],i(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(11)()?Object.keys:n(12)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(1),o=Object.keys;t.exports=function(t){return o(i(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var i=n(1);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var i=n(1),o=Array.prototype.forEach,r=Object.create;t.exports=function(t){var e=r(null);return o.call(arguments,function(t){i(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(18)()?String.prototype.contains:n(19)},function(t,e,n){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(t,e,n){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(0)),r=a(n(22));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return i(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=o.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(23)),r=s(n(24)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new o.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this));var n=this;this.danmu.on("changeDirection",function(t){n.danmu.direction=t})}return i(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some(function(n,i){return n.id===t.bullet.id&&(e.queue.splice(i,1),!0)})}},{key:"init",value:function(t,e){e||(e=this),e.data.sort(function(t,e){return t.start-e.start}),e.retryTimer||(e.retryTimer=setInterval(function(){e.readData(),e.dataHandle()},e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.resized||(t.startMove(e),t.resized=!0)});for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.resized=!1})})}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.pauseMove(e)})})}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach(function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)})}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var i=void 0,o=t.interval,s=t.channel,c=void 0;(c=e.player?t.data.filter(function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-o<=n&&n<=e.start+o}):t.data.filter(function(e){return t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)})).length>0&&c.forEach(function(n){(i=new r.default(e,n)).attach(),s.addBullet(i).result?(t.queue.push(i),i.topInit()):i.detach()})}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",function(t){n.removeBullet(t.bullet)}),this.direction=e.direction,this.danmu.on("changeDirection",function(t){n.direction=t}),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval(function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))},50)}return i(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout(function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach(function(t){t.bookChannelId&&delete t.bookChannelId});var i=e.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=e;var o=/mobile/gi.test(navigator.userAgent)?10:12,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++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var c=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach(function(i){n.channels[e].queue[i].forEach(function(o){o.el&&(a[e].queue[i].push(o),o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0))})}),n.channels[e].queue.bottom.forEach(function(i){if(i.el){if(a[e+a.length-n.channels.length].queue.bottom.push(i),i.channel_id[0]+i.channel_id[1]-1===e){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()}i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0)}})},u=0;u<n.channels.length;u++)c(u);for(var l=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},h=0;h<a.length;h++)l(h);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}else if(n.channels&&n.channels.length>a.length){for(var f=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach(function(i){if("top"===i&&e>Math.floor(a.length/2));else if("bottom"===i&&e<=Math.floor(a.length/2));else{var r="bottom"===i?e-a.length+n.channels.length:e;n.channels[r].queue[i].forEach(function(s,c){if(s.el){if(a[e].queue[i].push(s),"bottom"===i&&s.channel_id[0]+s.channel_id[1]-1===r){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()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[i].splice(c,1)})}})},d=0;d<a.length;d++)f(d);for(var p=function(t){["scroll","top","bottom"].forEach(function(e){n.channels[t].queue[e].forEach(function(t){t.pauseMove(n.containerPos),t.remove()})})},m=a.length;m<n.channels.length;m++)p(m);for(var v=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},g=0;g<a.length;g++)v(g);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}},10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,i=void 0,o=void 0,r=void 0;if("b2t"===this.direction?(o=this.channelWidth,r=Math.ceil(t.width/o)):(i=this.channelHeight,r=Math.ceil(t.height/i)),r>n.length)return{result:!1,message:"exceed channels.length, occupy="+r+",channelsSize="+n.length};for(var a=!0,s=void 0,c=-1,u=0,l=n.length;u<l;u++)if(n[u].queue[t.mode].some(function(e){return e.id===t.id}))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var h=0,f=n.length-r;h<=f;h++){a=!0;for(var d=h;d<h+r;d++){if((s=n[d]).operating.scroll){a=!1;break}if((s.bookId.scroll||t.prior)&&s.bookId.scroll!==t.id){a=!1;break}s.operating.scroll=!0;var p=s.queue.scroll[0];if(p){var m=p.el.getBoundingClientRect();if("b2t"===this.direction){if(m.bottom>this.containerPos.bottom){a=!1,s.operating.scroll=!1;break}}else if(m.right>this.containerPos.right){a=!1,s.operating.scroll=!1;break}var v,g=void 0,b=void 0,y=void 0,w=void 0;if("b2t"===this.direction?(b=(m.top-this.containerPos.top+m.height)/(g=(this.containerPos.height+m.height)/p.duration),y=this.containerPos.height,w=(this.containerPos.height+t.height)/t.duration):(b=(m.left-this.containerPos.left+m.width)/(g=(this.containerPos.width+m.width)/p.duration),y=this.containerPos.width,w=(this.containerPos.width+t.width)/t.duration),v=y/w,e.config.bOffset||(e.config.bOffset=0),g<w&&b+e.config.bOffset>v){a=!1,s.operating.scroll=!1;break}}s.operating.scroll=!1}if(a){c=h;break}}else if("top"===t.mode)for(var x=0,k=n.length-r;x<=k;x++){a=!0;for(var _=x;_<x+r;_++){if(_>Math.floor(n.length/2)){a=!1;break}if((s=n[_]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=x;break}}else if("bottom"===t.mode)for(var M=n.length-r;M>=0;M--){a=!0;for(var O=M;O<M+r;O++){if(O<=Math.floor(n.length/2)){a=!1;break}if((s=n[O]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=M;break}}if(-1!==c){for(var C=c,E=c+r;C<E;C++)(s=n[C]).operating[t.mode]=!0,s.queue[t.mode].unshift(t),t.prior&&delete s.bookId[t.mode],s.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(delete e.bookChannelId,!0)});return t.channel_id=[c,r],"b2t"===this.direction?(t.top=c*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerWidth*this.danmu.config.area.start)):(t.top=c*i,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start)),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,!0)})}else{c=-1;for(var T=0,P=n.length-r;T<=P;T++){a=!0;for(var j=T;j<T+r;j++)if(n[j].bookId[t.mode]){a=!1;break}if(a){c=T;break}}if(-1!==c){for(var B=c;B<c+r;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[c,r],!0)})}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=e[o]){i.operating[t.mode]=!0;var a=-1;i.queue[t.mode].some(function(e,n){return e.id===t.id&&(a=n,!0)}),a>-1&&i.queue[t.mode].splice(a,1),i.operating[t.mode]=!1}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach(function(t){t.pauseMove(e.containerPos),t.remove()})}),setTimeout(function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i},200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,i=this;i.channels&&i.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var e=0;e<i.channels.length;e++)i.channels[e].queue[t].forEach(function(t){t.pauseMove(i.containerPos),t.remove()})});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=/mobile/gi.test(navigator.userAgent)?10:12,a=void 0;a="b2t"===i.direction?Math.floor(i.width/r):Math.floor(i.height/r);for(var s=[],c=0;c<a;c++)s[c]={id:c,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};i.channels=s,i.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId,this.direction=e.direction;var i=this;this.danmu.on("changeDirection",function(t){i.direction=t});var o=void 0;if(n.el&&1===n.el.nodeType)o=a.default.copyDom(n.el);else if((o=document.createElement("div")).textContent=n.txt,n.style){var r=n.style;Object.keys(r).forEach(function(t){o.style[t]=r[t]})}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var s=this.container.getBoundingClientRect();this.el.style.left=s.width+"px"}return o(t,[{key:"attach",value:function(){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)}},{key:"detach",value:function(){this.container&&this.el&&this.container.removeChild(this.el),this.el=null}},{key:"topInit",value:function(){if("b2t"===this.direction){var t=this.container.getBoundingClientRect();this.el.style.transformOrigin="left top",this.el.style.transform="translateX(-"+this.top+"px) translateY("+t.height+"px) translateZ(0px) rotate(90deg)",this.el.style.transition="transform 0s linear 0s"}else this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("paused"!==this.status&&(this.status="paused",clearTimeout(this.removeTimer),this.el))if("scroll"===this.mode){if(e){var n=((new Date).getTime()-this.moveTime)/1e3*this.moveV,i=0;i=this.moveMoreS-n>=0?"b2t"===this.direction?(this.moveMoreS-n)/this.moveContainerHeight*t.height:(this.moveMoreS-n)/this.moveContainerWidth*t.width:this.moveMoreS-n,"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+i+"px) translateZ(0px) rotate(90deg)":this.el.style.left=i+"px"}else"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-t.top)+"px) translateZ(0px) rotate(90deg)":this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";"b2t"===this.direction?this.el.style.transition="transform 0s linear 0s":(this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.transition="transform 0s linear 0s")}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start","scroll"===this.mode)if("b2t"===this.direction){this.moveV=(t.height+this.height)/this.duration*1e3;var n=(e.el.getBoundingClientRect().bottom-t.top)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+e.top+"px) translateY(-"+e.height+"px) translateZ(0px) rotate(90deg)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().top-t.top,e.moveContainerHeight=t.height,e.removeTimer=setTimeout(r,1e3*n))},20)}else{this.moveV=(t.width+this.width)/this.duration*1e3;var i=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+i+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(r,1e3*i))},20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(r,o),this.startTime=(new Date).getTime()}function r(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();"b2t"===e.direction?n&&n.bottom<=t.top+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t)):n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){(this.removeTimer&&clearTimeout(this.removeTimer),this.el&&this.el.parentNode)&&(this.el.parentNode.removeChild(this.el),this.el=null,this.danmu.emit("bullet_remove",{bullet:this}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var i=n(26);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(28)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(27)(!1)).push([t.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",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var i,o,r={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),c=null,u=0,l=[],h=n(29);function f(t,e){for(var n=0;n<t.length;n++){var i=t[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(b(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(b(i.parts[a],e));r[i.id]={id:i.id,refs:1,parts:s}}}}function d(t,e){for(var n=[],i={},o=0;o<t.length;o++){var r=t[o],a=e.base?r[0]+e.base:r[0],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]})}return n}function p(t,e){var n=s(t.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=l[l.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.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=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),g(e,t.attrs),p(t,e),e}function g(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,i,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=u++;n=c||(c=v(e)),i=x.bind(null,n,a,!1),o=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),p(t,e),e}(e),i=function(t,e,n){var i=n.css,o=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(i=h(i));o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),o=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=function(t,e){var n=e.css,i=e.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){m(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return f(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}t&&f(d(t,e),e);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete r[s.id]}}}};var y,w=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function x(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=w(e,o);else{var r=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}}]);
window.DanmuJs=function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={createDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=document.createElement(t);return o.className=i,o.innerHTML=e,Object.keys(n).forEach(function(e){var i=e,r=n[e];"video"===t||"audio"===t?r&&o.setAttribute(i,r):o.setAttribute(i,r)}),o},hasClass:function(t,e){return t.classList?Array.prototype.some.call(t.classList,function(t){return t===e}):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)}):i.hasClass(t,e)||(t.className+=" "+e)},removeClass:function(t,e){t.classList?e.split(/\s+/g).forEach(function(e){t.classList.remove(e)}):i.hasClass(t,e)&&e.split(/\s+/g).forEach(function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")})},toggleClass:function(t,e){e.split(/\s+/g).forEach(function(e){i.hasClass(t,e)?i.removeClass(t,e):i.addClass(t,e)})},findDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(i){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},deepCopy:function(t,e){if("Object"===i.typeOf(e)&&"Object"===i.typeOf(t))return Object.keys(e).forEach(function(n){"Object"!==i.typeOf(e[n])||e[n]instanceof Node?"Array"===i.typeOf(e[n])?t[n]="Array"===i.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?i.deepCopy(t[n],e[n]):t[n]=e[n]}),t},typeOf:function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},copyDom:function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,function(t){e.setAttribute(t.name,t.value)}),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},formatTime:function(t){var e=Math.floor(t);return 1e3*e+(t-e)}};e.default=i,t.exports=e.default},function(t,e,n){"use strict";var i=n(13)();t.exports=function(t){return t!==i&&null!==t}},function(t,e,n){t.exports=n(3)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(4),r=(i=o)&&i.__esModule?i:{default:i};n(25),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(5)),r=s(n(21)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},live:!1,comments:[],direction:"r2l"},e),this.hideArr=[],(0,o.default)(this);var i=this;if(this.config.comments.forEach(function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")}),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var s=this.config.containerStyle;Object.keys(s).forEach(function(t){i.container.style[t]=s[t]})}this.live=this.config.live,this.player=this.config.player,this.direction=this.config.direction,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),["touchend","click","dblclick"].forEach(function(t){n.container.addEventListener(t,function(e){if(e.preventDefault(),e.stopPropagation(),i.player){var n=void 0;document.createEvent?(n=document.createEvent("Event")).initEvent(t,!0,!0):n=new Event(t),i.player.dispatchEvent(n)}},!1)}),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.id=e,!0)}),this.bulletBtn.main.queue.some(function(i){return i.id===t&&(i.id=e,i.pauseMove(n),i.startMove(n),!0)}))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.duration=e,!0)}),this.bulletBtn.main.queue.some(function(i){return i.id===t&&(i.duration=e,i.pauseMove(n),i.startMove(n),!0)}))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach(function(n){t===n.mode&&(n.duration=e)}),this.bulletBtn.main.queue.forEach(function(i){t===i.mode&&(i.duration=e,i.pauseMove(n),i.startMove(n))}))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t),this.bulletBtn.main.queue.filter(function(e){return t===e.mode||"color"===t&&e.color}).forEach(function(t){return t.remove()})}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}},{key:"setDirection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.emit("changeDirection",t)}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";var i,o,r,a,s,c,u,l=n(6),h=n(20),f=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};o=function(t,e){var n,o;return h(e),o=this,i.call(this,t,n=function(){r.call(o,t,n),f.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:i=function(t,e){var n;return h(e),g.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:o,off:r=function(t,e){var n,i,o,r;if(h(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(r=0;o=i[r];++r)o!==e&&o.__eeOnceListener__!==e||(2===i.length?n[t]=i[r?0:1]:i.splice(r,1));else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,i,o,r;if(g.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(o=o.slice(),e=0;i=o[e];++e)f.call(i,this,r)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];f.call(o,this,r)}}},c={on:l(i),once:l(o),off:l(r),emit:l(a)},u=v({},c),t.exports=e=function(t){return null==t?p(u):v(Object(t),c)},e.methods=s},function(t,e,n){"use strict";var i=n(7),o=n(15),r=n(16),a=n(17);(t.exports=function(t,e){var n,r,s,c,u;return arguments.length<2||"string"!=typeof t?(c=e,e=t,t=null):c=arguments[2],null==t?(n=s=!0,r=!1):(n=a.call(t,"c"),r=a.call(t,"e"),s=a.call(t,"w")),u={value:e,configurable:n,enumerable:r,writable:s},c?i(o(c),u):u}).gs=function(t,e,n){var s,c,u,l;return"string"!=typeof t?(u=n,n=e,e=t,t=null):u=arguments[3],null==e?e=void 0:r(e)?null==n?n=void 0:r(n)||(u=n,n=void 0):(u=e,e=n=void 0),null==t?(s=!0,c=!1):(s=a.call(t,"c"),c=a.call(t,"e")),l={get:e,set:n,configurable:s,enumerable:c},u?i(o(u),l):l}},function(t,e,n){"use strict";t.exports=n(8)()?Object.assign:n(9)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var i=n(10),o=n(14),r=Math.max;t.exports=function(t,e){var n,a,s,c=r(arguments.length,2);for(t=Object(o(t)),s=function(i){try{t[i]=e[i]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],i(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(11)()?Object.keys:n(12)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(1),o=Object.keys;t.exports=function(t){return o(i(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var i=n(1);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var i=n(1),o=Array.prototype.forEach,r=Object.create;t.exports=function(t){var e=r(null);return o.call(arguments,function(t){i(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(18)()?String.prototype.contains:n(19)},function(t,e,n){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(t,e,n){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(0)),r=a(n(22));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return i(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=o.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(23)),r=s(n(24)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new o.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this));var n=this;this.danmu.on("changeDirection",function(t){n.danmu.direction=t})}return i(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some(function(n,i){return n.id===t.bullet.id&&(e.queue.splice(i,1),!0)})}},{key:"init",value:function(t,e){e||(e=this),e.data.sort(function(t,e){return t.start-e.start}),e.retryTimer||(e.retryTimer=setInterval(function(){e.readData(),e.dataHandle()},e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.resized||(t.startMove(e),t.resized=!0)});for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.resized=!1})})}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.pauseMove(e)})})}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach(function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)})}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var i=void 0,o=t.interval,s=t.channel,c=void 0;e.player?(c=t.data.filter(function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-o<=n&&n<=e.start+o}),e.live&&(t.data=t.data.filter(function(t){return t.start||(t.start=n),t.start>n-3*o}))):c=t.data.filter(function(e){return t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)}),c.length>0&&c.forEach(function(n){(i=new r.default(e,n)).attach(),s.addBullet(i).result?(t.queue.push(i),i.topInit()):i.detach()})}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",function(t){n.removeBullet(t.bullet)}),this.direction=e.direction,this.danmu.on("changeDirection",function(t){n.direction=t}),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval(function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))},50)}return i(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout(function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach(function(t){t.bookChannelId&&delete t.bookChannelId});var i=e.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=e;var o=/mobile/gi.test(navigator.userAgent)?10:12,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++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var c=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach(function(i){n.channels[e].queue[i].forEach(function(o){o.el&&(a[e].queue[i].push(o),o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0))})}),n.channels[e].queue.bottom.forEach(function(i){if(i.el){if(a[e+a.length-n.channels.length].queue.bottom.push(i),i.channel_id[0]+i.channel_id[1]-1===e){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()}i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0)}})},u=0;u<n.channels.length;u++)c(u);for(var l=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},h=0;h<a.length;h++)l(h);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}else if(n.channels&&n.channels.length>a.length){for(var f=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach(function(i){if("top"===i&&e>Math.floor(a.length/2));else if("bottom"===i&&e<=Math.floor(a.length/2));else{var r="bottom"===i?e-a.length+n.channels.length:e;n.channels[r].queue[i].forEach(function(s,c){if(s.el){if(a[e].queue[i].push(s),"bottom"===i&&s.channel_id[0]+s.channel_id[1]-1===r){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()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[i].splice(c,1)})}})},d=0;d<a.length;d++)f(d);for(var p=function(t){["scroll","top","bottom"].forEach(function(e){n.channels[t].queue[e].forEach(function(t){t.pauseMove(n.containerPos),t.remove()})})},m=a.length;m<n.channels.length;m++)p(m);for(var v=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},g=0;g<a.length;g++)v(g);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}},10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,i=void 0,o=void 0,r=void 0;if("b2t"===this.direction?(o=this.channelWidth,r=Math.ceil(t.width/o)):(i=this.channelHeight,r=Math.ceil(t.height/i)),r>n.length)return{result:!1,message:"exceed channels.length, occupy="+r+",channelsSize="+n.length};for(var a=!0,s=void 0,c=-1,u=0,l=n.length;u<l;u++)if(n[u].queue[t.mode].some(function(e){return e.id===t.id}))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var h=0,f=n.length-r;h<=f;h++){a=!0;for(var d=h;d<h+r;d++){if((s=n[d]).operating.scroll){a=!1;break}if((s.bookId.scroll||t.prior)&&s.bookId.scroll!==t.id){a=!1;break}s.operating.scroll=!0;var p=s.queue.scroll[0];if(p){var m=p.el.getBoundingClientRect();if("b2t"===this.direction){if(m.bottom>this.containerPos.bottom){a=!1,s.operating.scroll=!1;break}}else if(m.right>this.containerPos.right){a=!1,s.operating.scroll=!1;break}var v,g=void 0,b=void 0,y=void 0,w=void 0;if("b2t"===this.direction?(b=(m.top-this.containerPos.top+m.height)/(g=(this.containerPos.height+m.height)/p.duration),y=this.containerPos.height,w=(this.containerPos.height+t.height)/t.duration):(b=(m.left-this.containerPos.left+m.width)/(g=(this.containerPos.width+m.width)/p.duration),y=this.containerPos.width,w=(this.containerPos.width+t.width)/t.duration),v=y/w,e.config.bOffset||(e.config.bOffset=0),g<w&&b+e.config.bOffset>v){a=!1,s.operating.scroll=!1;break}}s.operating.scroll=!1}if(a){c=h;break}}else if("top"===t.mode)for(var x=0,k=n.length-r;x<=k;x++){a=!0;for(var _=x;_<x+r;_++){if(_>Math.floor(n.length/2)){a=!1;break}if((s=n[_]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=x;break}}else if("bottom"===t.mode)for(var M=n.length-r;M>=0;M--){a=!0;for(var O=M;O<M+r;O++){if(O<=Math.floor(n.length/2)){a=!1;break}if((s=n[O]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=M;break}}if(-1!==c){for(var C=c,E=c+r;C<E;C++)(s=n[C]).operating[t.mode]=!0,s.queue[t.mode].unshift(t),t.prior&&delete s.bookId[t.mode],s.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(delete e.bookChannelId,!0)});return t.channel_id=[c,r],"b2t"===this.direction?(t.top=c*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerWidth*this.danmu.config.area.start)):(t.top=c*i,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start)),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,!0)})}else{c=-1;for(var T=0,P=n.length-r;T<=P;T++){a=!0;for(var j=T;j<T+r;j++)if(n[j].bookId[t.mode]){a=!1;break}if(a){c=T;break}}if(-1!==c){for(var B=c;B<c+r;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[c,r],!0)})}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=e[o]){i.operating[t.mode]=!0;var a=-1;i.queue[t.mode].some(function(e,n){return e.id===t.id&&(a=n,!0)}),a>-1&&i.queue[t.mode].splice(a,1),i.operating[t.mode]=!1}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach(function(t){t.pauseMove(e.containerPos),t.remove()})}),setTimeout(function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i},200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,i=this;i.channels&&i.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var e=0;e<i.channels.length;e++)i.channels[e].queue[t].forEach(function(t){t.pauseMove(i.containerPos),t.remove()})});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=/mobile/gi.test(navigator.userAgent)?10:12,a=void 0;a="b2t"===i.direction?Math.floor(i.width/r):Math.floor(i.height/r);for(var s=[],c=0;c<a;c++)s[c]={id:c,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};i.channels=s,i.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId,this.direction=e.direction;var i=this;this.danmu.on("changeDirection",function(t){i.direction=t});var o=void 0;if(n.el&&1===n.el.nodeType)o=a.default.copyDom(n.el);else if((o=document.createElement("div")).textContent=n.txt,n.style){var r=n.style;Object.keys(r).forEach(function(t){o.style[t]=r[t]})}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var s=this.container.getBoundingClientRect();this.el.style.left=s.width+"px"}return o(t,[{key:"attach",value:function(){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)}},{key:"detach",value:function(){this.container&&this.el&&this.container.removeChild(this.el);var t=this;this.danmu.off("changeDirection",function(e){t.direction=e}),this.el=null}},{key:"topInit",value:function(){if("b2t"===this.direction){var t=this.container.getBoundingClientRect();this.el.style.transformOrigin="left top",this.el.style.transform="translateX(-"+this.top+"px) translateY("+t.height+"px) translateZ(0px) rotate(90deg)",this.el.style.transition="transform 0s linear 0s"}else this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("paused"!==this.status&&(this.status="paused",clearTimeout(this.removeTimer),this.el))if("scroll"===this.mode){if(e){var n=((new Date).getTime()-this.moveTime)/1e3*this.moveV,i=0;i=this.moveMoreS-n>=0?"b2t"===this.direction?(this.moveMoreS-n)/this.moveContainerHeight*t.height:(this.moveMoreS-n)/this.moveContainerWidth*t.width:this.moveMoreS-n,"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+i+"px) translateZ(0px) rotate(90deg)":this.el.style.left=i+"px"}else"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-t.top)+"px) translateZ(0px) rotate(90deg)":this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";"b2t"===this.direction?this.el.style.transition="transform 0s linear 0s":(this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.transition="transform 0s linear 0s")}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start","scroll"===this.mode)if("b2t"===this.direction){this.moveV=(t.height+this.height)/this.duration*1e3;var n=(e.el.getBoundingClientRect().bottom-t.top)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+e.top+"px) translateY(-"+e.height+"px) translateZ(0px) rotate(90deg)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().top-t.top,e.moveContainerHeight=t.height,e.removeTimer=setTimeout(r,1e3*n))},20)}else{this.moveV=(t.width+this.width)/this.duration*1e3;var i=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+i+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(r,1e3*i))},20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(r,o),this.startTime=(new Date).getTime()}function r(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();"b2t"===e.direction?n&&n.bottom<=t.top+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t)):n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){var t=this;(this.removeTimer&&clearTimeout(this.removeTimer),t.el&&t.el.parentNode)&&(this.danmu.off("changeDirection",function(e){t.direction=e}),t.el.parentNode.removeChild(t.el),t.el=null,t.danmu.emit("bullet_remove",{bullet:t}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var i=n(26);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(28)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(27)(!1)).push([t.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",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var i,o,r={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),c=null,u=0,l=[],h=n(29);function f(t,e){for(var n=0;n<t.length;n++){var i=t[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(b(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(b(i.parts[a],e));r[i.id]={id:i.id,refs:1,parts:s}}}}function d(t,e){for(var n=[],i={},o=0;o<t.length;o++){var r=t[o],a=e.base?r[0]+e.base:r[0],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]})}return n}function p(t,e){var n=s(t.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=l[l.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.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=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),g(e,t.attrs),p(t,e),e}function g(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,i,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=u++;n=c||(c=v(e)),i=x.bind(null,n,a,!1),o=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),p(t,e),e}(e),i=function(t,e,n){var i=n.css,o=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(i=h(i));o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),o=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=function(t,e){var n=e.css,i=e.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){m(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return f(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}t&&f(d(t,e),e);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete r[s.id]}}}};var y,w=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function x(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=w(e,o);else{var r=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}}]);
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["danmu.js"]=e():t["danmu.js"]=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={createDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=document.createElement(t);return o.className=i,o.innerHTML=e,Object.keys(n).forEach(function(e){var i=e,r=n[e];"video"===t||"audio"===t?r&&o.setAttribute(i,r):o.setAttribute(i,r)}),o},hasClass:function(t,e){return t.classList?Array.prototype.some.call(t.classList,function(t){return t===e}):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)}):i.hasClass(t,e)||(t.className+=" "+e)},removeClass:function(t,e){t.classList?e.split(/\s+/g).forEach(function(e){t.classList.remove(e)}):i.hasClass(t,e)&&e.split(/\s+/g).forEach(function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")})},toggleClass:function(t,e){e.split(/\s+/g).forEach(function(e){i.hasClass(t,e)?i.removeClass(t,e):i.addClass(t,e)})},findDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(i){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},deepCopy:function(t,e){if("Object"===i.typeOf(e)&&"Object"===i.typeOf(t))return Object.keys(e).forEach(function(n){"Object"!==i.typeOf(e[n])||e[n]instanceof Node?"Array"===i.typeOf(e[n])?t[n]="Array"===i.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?i.deepCopy(t[n],e[n]):t[n]=e[n]}),t},typeOf:function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},copyDom:function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,function(t){e.setAttribute(t.name,t.value)}),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},formatTime:function(t){var e=Math.floor(t);return 1e3*e+(t-e)}};e.default=i,t.exports=e.default},function(t,e,n){"use strict";var i=n(13)();t.exports=function(t){return t!==i&&null!==t}},function(t,e,n){t.exports=n(3)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(4),r=(i=o)&&i.__esModule?i:{default:i};n(25),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(5)),r=s(n(21)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},comments:[],direction:"r2l"},e),this.hideArr=[],(0,o.default)(this);var i=this;if(this.config.comments.forEach(function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")}),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var s=this.config.containerStyle;Object.keys(s).forEach(function(t){i.container.style[t]=s[t]})}this.player=this.config.player,this.direction=this.config.direction,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),["touchend","click","dblclick"].forEach(function(t){n.container.addEventListener(t,function(e){if(e.preventDefault(),e.stopPropagation(),i.player){var n=void 0;document.createEvent?(n=document.createEvent("Event")).initEvent(t,!0,!0):n=new Event(t),i.player.dispatchEvent(n)}},!1)}),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.id=e,!0)}),this.bulletBtn.main.queue.some(function(i){return i.id===t&&(i.id=e,i.pauseMove(n),i.startMove(n),!0)}))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.duration=e,!0)}),this.bulletBtn.main.queue.some(function(i){return i.id===t&&(i.duration=e,i.pauseMove(n),i.startMove(n),!0)}))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach(function(n){t===n.mode&&(n.duration=e)}),this.bulletBtn.main.queue.forEach(function(i){t===i.mode&&(i.duration=e,i.pauseMove(n),i.startMove(n))}))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t),this.bulletBtn.main.queue.filter(function(e){return t===e.mode||"color"===t&&e.color}).forEach(function(t){return t.remove()})}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}},{key:"setDirection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.emit("changeDirection",t)}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";var i,o,r,a,s,c,u,l=n(6),h=n(20),f=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};o=function(t,e){var n,o;return h(e),o=this,i.call(this,t,n=function(){r.call(o,t,n),f.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:i=function(t,e){var n;return h(e),g.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:o,off:r=function(t,e){var n,i,o,r;if(h(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(r=0;o=i[r];++r)o!==e&&o.__eeOnceListener__!==e||(2===i.length?n[t]=i[r?0:1]:i.splice(r,1));else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,i,o,r;if(g.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(o=o.slice(),e=0;i=o[e];++e)f.call(i,this,r)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];f.call(o,this,r)}}},c={on:l(i),once:l(o),off:l(r),emit:l(a)},u=v({},c),t.exports=e=function(t){return null==t?p(u):v(Object(t),c)},e.methods=s},function(t,e,n){"use strict";var i=n(7),o=n(15),r=n(16),a=n(17);(t.exports=function(t,e){var n,r,s,c,u;return arguments.length<2||"string"!=typeof t?(c=e,e=t,t=null):c=arguments[2],null==t?(n=s=!0,r=!1):(n=a.call(t,"c"),r=a.call(t,"e"),s=a.call(t,"w")),u={value:e,configurable:n,enumerable:r,writable:s},c?i(o(c),u):u}).gs=function(t,e,n){var s,c,u,l;return"string"!=typeof t?(u=n,n=e,e=t,t=null):u=arguments[3],null==e?e=void 0:r(e)?null==n?n=void 0:r(n)||(u=n,n=void 0):(u=e,e=n=void 0),null==t?(s=!0,c=!1):(s=a.call(t,"c"),c=a.call(t,"e")),l={get:e,set:n,configurable:s,enumerable:c},u?i(o(u),l):l}},function(t,e,n){"use strict";t.exports=n(8)()?Object.assign:n(9)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var i=n(10),o=n(14),r=Math.max;t.exports=function(t,e){var n,a,s,c=r(arguments.length,2);for(t=Object(o(t)),s=function(i){try{t[i]=e[i]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],i(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(11)()?Object.keys:n(12)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(1),o=Object.keys;t.exports=function(t){return o(i(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var i=n(1);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var i=n(1),o=Array.prototype.forEach,r=Object.create;t.exports=function(t){var e=r(null);return o.call(arguments,function(t){i(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(18)()?String.prototype.contains:n(19)},function(t,e,n){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(t,e,n){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(0)),r=a(n(22));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return i(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=o.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(23)),r=s(n(24)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new o.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this));var n=this;this.danmu.on("changeDirection",function(t){n.danmu.direction=t})}return i(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some(function(n,i){return n.id===t.bullet.id&&(e.queue.splice(i,1),!0)})}},{key:"init",value:function(t,e){e||(e=this),e.data.sort(function(t,e){return t.start-e.start}),e.retryTimer||(e.retryTimer=setInterval(function(){e.readData(),e.dataHandle()},e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.resized||(t.startMove(e),t.resized=!0)});for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.resized=!1})})}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.pauseMove(e)})})}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach(function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)})}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var i=void 0,o=t.interval,s=t.channel,c=void 0;(c=e.player?t.data.filter(function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-o<=n&&n<=e.start+o}):t.data.filter(function(e){return t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)})).length>0&&c.forEach(function(n){(i=new r.default(e,n)).attach(),s.addBullet(i).result?(t.queue.push(i),i.topInit()):i.detach()})}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",function(t){n.removeBullet(t.bullet)}),this.direction=e.direction,this.danmu.on("changeDirection",function(t){n.direction=t}),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval(function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))},50)}return i(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout(function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach(function(t){t.bookChannelId&&delete t.bookChannelId});var i=e.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=e;var o=/mobile/gi.test(navigator.userAgent)?10:12,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++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var c=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach(function(i){n.channels[e].queue[i].forEach(function(o){o.el&&(a[e].queue[i].push(o),o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0))})}),n.channels[e].queue.bottom.forEach(function(i){if(i.el){if(a[e+a.length-n.channels.length].queue.bottom.push(i),i.channel_id[0]+i.channel_id[1]-1===e){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()}i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0)}})},u=0;u<n.channels.length;u++)c(u);for(var l=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},h=0;h<a.length;h++)l(h);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}else if(n.channels&&n.channels.length>a.length){for(var f=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach(function(i){if("top"===i&&e>Math.floor(a.length/2));else if("bottom"===i&&e<=Math.floor(a.length/2));else{var r="bottom"===i?e-a.length+n.channels.length:e;n.channels[r].queue[i].forEach(function(s,c){if(s.el){if(a[e].queue[i].push(s),"bottom"===i&&s.channel_id[0]+s.channel_id[1]-1===r){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()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[i].splice(c,1)})}})},d=0;d<a.length;d++)f(d);for(var p=function(t){["scroll","top","bottom"].forEach(function(e){n.channels[t].queue[e].forEach(function(t){t.pauseMove(n.containerPos),t.remove()})})},m=a.length;m<n.channels.length;m++)p(m);for(var v=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},g=0;g<a.length;g++)v(g);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}},10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,i=void 0,o=void 0,r=void 0;if("b2t"===this.direction?(o=this.channelWidth,r=Math.ceil(t.width/o)):(i=this.channelHeight,r=Math.ceil(t.height/i)),r>n.length)return{result:!1,message:"exceed channels.length, occupy="+r+",channelsSize="+n.length};for(var a=!0,s=void 0,c=-1,u=0,l=n.length;u<l;u++)if(n[u].queue[t.mode].some(function(e){return e.id===t.id}))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var h=0,f=n.length-r;h<=f;h++){a=!0;for(var d=h;d<h+r;d++){if((s=n[d]).operating.scroll){a=!1;break}if((s.bookId.scroll||t.prior)&&s.bookId.scroll!==t.id){a=!1;break}s.operating.scroll=!0;var p=s.queue.scroll[0];if(p){var m=p.el.getBoundingClientRect();if("b2t"===this.direction){if(m.bottom>this.containerPos.bottom){a=!1,s.operating.scroll=!1;break}}else if(m.right>this.containerPos.right){a=!1,s.operating.scroll=!1;break}var v,g=void 0,b=void 0,y=void 0,w=void 0;if("b2t"===this.direction?(b=(m.top-this.containerPos.top+m.height)/(g=(this.containerPos.height+m.height)/p.duration),y=this.containerPos.height,w=(this.containerPos.height+t.height)/t.duration):(b=(m.left-this.containerPos.left+m.width)/(g=(this.containerPos.width+m.width)/p.duration),y=this.containerPos.width,w=(this.containerPos.width+t.width)/t.duration),v=y/w,e.config.bOffset||(e.config.bOffset=0),g<w&&b+e.config.bOffset>v){a=!1,s.operating.scroll=!1;break}}s.operating.scroll=!1}if(a){c=h;break}}else if("top"===t.mode)for(var x=0,k=n.length-r;x<=k;x++){a=!0;for(var _=x;_<x+r;_++){if(_>Math.floor(n.length/2)){a=!1;break}if((s=n[_]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=x;break}}else if("bottom"===t.mode)for(var M=n.length-r;M>=0;M--){a=!0;for(var O=M;O<M+r;O++){if(O<=Math.floor(n.length/2)){a=!1;break}if((s=n[O]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=M;break}}if(-1!==c){for(var C=c,E=c+r;C<E;C++)(s=n[C]).operating[t.mode]=!0,s.queue[t.mode].unshift(t),t.prior&&delete s.bookId[t.mode],s.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(delete e.bookChannelId,!0)});return t.channel_id=[c,r],"b2t"===this.direction?(t.top=c*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerWidth*this.danmu.config.area.start)):(t.top=c*i,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start)),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,!0)})}else{c=-1;for(var j=0,T=n.length-r;j<=T;j++){a=!0;for(var P=j;P<j+r;P++)if(n[P].bookId[t.mode]){a=!1;break}if(a){c=j;break}}if(-1!==c){for(var B=c;B<c+r;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[c,r],!0)})}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=e[o]){i.operating[t.mode]=!0;var a=-1;i.queue[t.mode].some(function(e,n){return e.id===t.id&&(a=n,!0)}),a>-1&&i.queue[t.mode].splice(a,1),i.operating[t.mode]=!1}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach(function(t){t.pauseMove(e.containerPos),t.remove()})}),setTimeout(function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i},200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,i=this;i.channels&&i.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var e=0;e<i.channels.length;e++)i.channels[e].queue[t].forEach(function(t){t.pauseMove(i.containerPos),t.remove()})});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=/mobile/gi.test(navigator.userAgent)?10:12,a=void 0;a="b2t"===i.direction?Math.floor(i.width/r):Math.floor(i.height/r);for(var s=[],c=0;c<a;c++)s[c]={id:c,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};i.channels=s,i.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId,this.direction=e.direction;var i=this;this.danmu.on("changeDirection",function(t){i.direction=t});var o=void 0;if(n.el&&1===n.el.nodeType)o=a.default.copyDom(n.el);else if((o=document.createElement("div")).textContent=n.txt,n.style){var r=n.style;Object.keys(r).forEach(function(t){o.style[t]=r[t]})}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var s=this.container.getBoundingClientRect();this.el.style.left=s.width+"px"}return o(t,[{key:"attach",value:function(){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)}},{key:"detach",value:function(){this.container&&this.el&&this.container.removeChild(this.el),this.el=null}},{key:"topInit",value:function(){if("b2t"===this.direction){var t=this.container.getBoundingClientRect();this.el.style.transformOrigin="left top",this.el.style.transform="translateX(-"+this.top+"px) translateY("+t.height+"px) translateZ(0px) rotate(90deg)",this.el.style.transition="transform 0s linear 0s"}else this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("paused"!==this.status&&(this.status="paused",clearTimeout(this.removeTimer),this.el))if("scroll"===this.mode){if(e){var n=((new Date).getTime()-this.moveTime)/1e3*this.moveV,i=0;i=this.moveMoreS-n>=0?"b2t"===this.direction?(this.moveMoreS-n)/this.moveContainerHeight*t.height:(this.moveMoreS-n)/this.moveContainerWidth*t.width:this.moveMoreS-n,"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+i+"px) translateZ(0px) rotate(90deg)":this.el.style.left=i+"px"}else"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-t.top)+"px) translateZ(0px) rotate(90deg)":this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";"b2t"===this.direction?this.el.style.transition="transform 0s linear 0s":(this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.transition="transform 0s linear 0s")}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start","scroll"===this.mode)if("b2t"===this.direction){this.moveV=(t.height+this.height)/this.duration*1e3;var n=(e.el.getBoundingClientRect().bottom-t.top)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+e.top+"px) translateY(-"+e.height+"px) translateZ(0px) rotate(90deg)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().top-t.top,e.moveContainerHeight=t.height,e.removeTimer=setTimeout(r,1e3*n))},20)}else{this.moveV=(t.width+this.width)/this.duration*1e3;var i=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+i+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(r,1e3*i))},20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(r,o),this.startTime=(new Date).getTime()}function r(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();"b2t"===e.direction?n&&n.bottom<=t.top+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t)):n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){(this.removeTimer&&clearTimeout(this.removeTimer),this.el&&this.el.parentNode)&&(this.el.parentNode.removeChild(this.el),this.el=null,this.danmu.emit("bullet_remove",{bullet:this}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var i=n(26);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(28)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(27)(!1)).push([t.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",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var i,o,r={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),c=null,u=0,l=[],h=n(29);function f(t,e){for(var n=0;n<t.length;n++){var i=t[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(b(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(b(i.parts[a],e));r[i.id]={id:i.id,refs:1,parts:s}}}}function d(t,e){for(var n=[],i={},o=0;o<t.length;o++){var r=t[o],a=e.base?r[0]+e.base:r[0],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]})}return n}function p(t,e){var n=s(t.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=l[l.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.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=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),g(e,t.attrs),p(t,e),e}function g(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,i,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=u++;n=c||(c=v(e)),i=x.bind(null,n,a,!1),o=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),p(t,e),e}(e),i=function(t,e,n){var i=n.css,o=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(i=h(i));o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),o=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=function(t,e){var n=e.css,i=e.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){m(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return f(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}t&&f(d(t,e),e);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete r[s.id]}}}};var y,w=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function x(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=w(e,o);else{var r=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["danmu.js"]=e():t["danmu.js"]=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={createDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=document.createElement(t);return o.className=i,o.innerHTML=e,Object.keys(n).forEach(function(e){var i=e,r=n[e];"video"===t||"audio"===t?r&&o.setAttribute(i,r):o.setAttribute(i,r)}),o},hasClass:function(t,e){return t.classList?Array.prototype.some.call(t.classList,function(t){return t===e}):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)}):i.hasClass(t,e)||(t.className+=" "+e)},removeClass:function(t,e){t.classList?e.split(/\s+/g).forEach(function(e){t.classList.remove(e)}):i.hasClass(t,e)&&e.split(/\s+/g).forEach(function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")})},toggleClass:function(t,e){e.split(/\s+/g).forEach(function(e){i.hasClass(t,e)?i.removeClass(t,e):i.addClass(t,e)})},findDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(i){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},deepCopy:function(t,e){if("Object"===i.typeOf(e)&&"Object"===i.typeOf(t))return Object.keys(e).forEach(function(n){"Object"!==i.typeOf(e[n])||e[n]instanceof Node?"Array"===i.typeOf(e[n])?t[n]="Array"===i.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?i.deepCopy(t[n],e[n]):t[n]=e[n]}),t},typeOf:function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},copyDom:function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,function(t){e.setAttribute(t.name,t.value)}),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},formatTime:function(t){var e=Math.floor(t);return 1e3*e+(t-e)}};e.default=i,t.exports=e.default},function(t,e,n){"use strict";var i=n(13)();t.exports=function(t){return t!==i&&null!==t}},function(t,e,n){t.exports=n(3)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(4),r=(i=o)&&i.__esModule?i:{default:i};n(25),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(5)),r=s(n(21)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},live:!1,comments:[],direction:"r2l"},e),this.hideArr=[],(0,o.default)(this);var i=this;if(this.config.comments.forEach(function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")}),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var s=this.config.containerStyle;Object.keys(s).forEach(function(t){i.container.style[t]=s[t]})}this.live=this.config.live,this.player=this.config.player,this.direction=this.config.direction,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),["touchend","click","dblclick"].forEach(function(t){n.container.addEventListener(t,function(e){if(e.preventDefault(),e.stopPropagation(),i.player){var n=void 0;document.createEvent?(n=document.createEvent("Event")).initEvent(t,!0,!0):n=new Event(t),i.player.dispatchEvent(n)}},!1)}),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.id=e,!0)}),this.bulletBtn.main.queue.some(function(i){return i.id===t&&(i.id=e,i.pauseMove(n),i.startMove(n),!0)}))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.duration=e,!0)}),this.bulletBtn.main.queue.some(function(i){return i.id===t&&(i.duration=e,i.pauseMove(n),i.startMove(n),!0)}))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach(function(n){t===n.mode&&(n.duration=e)}),this.bulletBtn.main.queue.forEach(function(i){t===i.mode&&(i.duration=e,i.pauseMove(n),i.startMove(n))}))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t),this.bulletBtn.main.queue.filter(function(e){return t===e.mode||"color"===t&&e.color}).forEach(function(t){return t.remove()})}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}},{key:"setDirection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"r2l";this.emit("changeDirection",t)}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";var i,o,r,a,s,c,u,l=n(6),h=n(20),f=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};o=function(t,e){var n,o;return h(e),o=this,i.call(this,t,n=function(){r.call(o,t,n),f.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:i=function(t,e){var n;return h(e),g.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:o,off:r=function(t,e){var n,i,o,r;if(h(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(r=0;o=i[r];++r)o!==e&&o.__eeOnceListener__!==e||(2===i.length?n[t]=i[r?0:1]:i.splice(r,1));else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,i,o,r;if(g.call(this,"__ee__")&&(o=this.__ee__[t]))if("object"==typeof o){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(o=o.slice(),e=0;i=o[e];++e)f.call(i,this,r)}else switch(arguments.length){case 1:d.call(o,this);break;case 2:d.call(o,this,arguments[1]);break;case 3:d.call(o,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];f.call(o,this,r)}}},c={on:l(i),once:l(o),off:l(r),emit:l(a)},u=v({},c),t.exports=e=function(t){return null==t?p(u):v(Object(t),c)},e.methods=s},function(t,e,n){"use strict";var i=n(7),o=n(15),r=n(16),a=n(17);(t.exports=function(t,e){var n,r,s,c,u;return arguments.length<2||"string"!=typeof t?(c=e,e=t,t=null):c=arguments[2],null==t?(n=s=!0,r=!1):(n=a.call(t,"c"),r=a.call(t,"e"),s=a.call(t,"w")),u={value:e,configurable:n,enumerable:r,writable:s},c?i(o(c),u):u}).gs=function(t,e,n){var s,c,u,l;return"string"!=typeof t?(u=n,n=e,e=t,t=null):u=arguments[3],null==e?e=void 0:r(e)?null==n?n=void 0:r(n)||(u=n,n=void 0):(u=e,e=n=void 0),null==t?(s=!0,c=!1):(s=a.call(t,"c"),c=a.call(t,"e")),l={get:e,set:n,configurable:s,enumerable:c},u?i(o(u),l):l}},function(t,e,n){"use strict";t.exports=n(8)()?Object.assign:n(9)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var i=n(10),o=n(14),r=Math.max;t.exports=function(t,e){var n,a,s,c=r(arguments.length,2);for(t=Object(o(t)),s=function(i){try{t[i]=e[i]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],i(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(11)()?Object.keys:n(12)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var i=n(1),o=Object.keys;t.exports=function(t){return o(i(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var i=n(1);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var i=n(1),o=Array.prototype.forEach,r=Object.create;t.exports=function(t){var e=r(null);return o.call(arguments,function(t){i(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(18)()?String.prototype.contains:n(19)},function(t,e,n){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&(!0===i.contains("dwa")&&!1===i.contains("foo"))}},function(t,e,n){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=a(n(0)),r=a(n(22));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return i(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=o.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=s(n(23)),r=s(n(24)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new o.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this));var n=this;this.danmu.on("changeDirection",function(t){n.danmu.direction=t})}return i(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some(function(n,i){return n.id===t.bullet.id&&(e.queue.splice(i,1),!0)})}},{key:"init",value:function(t,e){e||(e=this),e.data.sort(function(t,e){return t.start-e.start}),e.retryTimer||(e.retryTimer=setInterval(function(){e.readData(),e.dataHandle()},e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.resized||(t.startMove(e),t.resized=!0)});for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.resized=!1})})}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.pauseMove(e)})})}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach(function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)})}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var i=void 0,o=t.interval,s=t.channel,c=void 0;e.player?(c=t.data.filter(function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-o<=n&&n<=e.start+o}),e.live&&(t.data=t.data.filter(function(t){return t.start||(t.start=n),t.start>n-3*o}))):c=t.data.filter(function(e){return t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)}),c.length>0&&c.forEach(function(n){(i=new r.default(e,n)).attach(),s.addBullet(i).result?(t.queue.push(i),i.topInit()):i.detach()})}}]),t}();e.default=c,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",function(t){n.removeBullet(t.bullet)}),this.direction=e.direction,this.danmu.on("changeDirection",function(t){n.direction=t}),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval(function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))},50)}return i(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout(function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach(function(t){t.bookChannelId&&delete t.bookChannelId});var i=e.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=e;var o=/mobile/gi.test(navigator.userAgent)?10:12,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++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var c=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach(function(i){n.channels[e].queue[i].forEach(function(o){o.el&&(a[e].queue[i].push(o),o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0))})}),n.channels[e].queue.bottom.forEach(function(i){if(i.el){if(a[e+a.length-n.channels.length].queue.bottom.push(i),i.channel_id[0]+i.channel_id[1]-1===e){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()}i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0)}})},u=0;u<n.channels.length;u++)c(u);for(var l=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},h=0;h<a.length;h++)l(h);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}else if(n.channels&&n.channels.length>a.length){for(var f=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach(function(i){if("top"===i&&e>Math.floor(a.length/2));else if("bottom"===i&&e<=Math.floor(a.length/2));else{var r="bottom"===i?e-a.length+n.channels.length:e;n.channels[r].queue[i].forEach(function(s,c){if(s.el){if(a[e].queue[i].push(s),"bottom"===i&&s.channel_id[0]+s.channel_id[1]-1===r){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()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[i].splice(c,1)})}})},d=0;d<a.length;d++)f(d);for(var p=function(t){["scroll","top","bottom"].forEach(function(e){n.channels[t].queue[e].forEach(function(t){t.pauseMove(n.containerPos),t.remove()})})},m=a.length;m<n.channels.length;m++)p(m);for(var v=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},g=0;g<a.length;g++)v(g);n.channels=a,"b2t"===n.direction?n.channelWidth=o:n.channelHeight=o}},10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,i=void 0,o=void 0,r=void 0;if("b2t"===this.direction?(o=this.channelWidth,r=Math.ceil(t.width/o)):(i=this.channelHeight,r=Math.ceil(t.height/i)),r>n.length)return{result:!1,message:"exceed channels.length, occupy="+r+",channelsSize="+n.length};for(var a=!0,s=void 0,c=-1,u=0,l=n.length;u<l;u++)if(n[u].queue[t.mode].some(function(e){return e.id===t.id}))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var h=0,f=n.length-r;h<=f;h++){a=!0;for(var d=h;d<h+r;d++){if((s=n[d]).operating.scroll){a=!1;break}if((s.bookId.scroll||t.prior)&&s.bookId.scroll!==t.id){a=!1;break}s.operating.scroll=!0;var p=s.queue.scroll[0];if(p){var m=p.el.getBoundingClientRect();if("b2t"===this.direction){if(m.bottom>this.containerPos.bottom){a=!1,s.operating.scroll=!1;break}}else if(m.right>this.containerPos.right){a=!1,s.operating.scroll=!1;break}var v,g=void 0,b=void 0,y=void 0,w=void 0;if("b2t"===this.direction?(b=(m.top-this.containerPos.top+m.height)/(g=(this.containerPos.height+m.height)/p.duration),y=this.containerPos.height,w=(this.containerPos.height+t.height)/t.duration):(b=(m.left-this.containerPos.left+m.width)/(g=(this.containerPos.width+m.width)/p.duration),y=this.containerPos.width,w=(this.containerPos.width+t.width)/t.duration),v=y/w,e.config.bOffset||(e.config.bOffset=0),g<w&&b+e.config.bOffset>v){a=!1,s.operating.scroll=!1;break}}s.operating.scroll=!1}if(a){c=h;break}}else if("top"===t.mode)for(var x=0,k=n.length-r;x<=k;x++){a=!0;for(var _=x;_<x+r;_++){if(_>Math.floor(n.length/2)){a=!1;break}if((s=n[_]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=x;break}}else if("bottom"===t.mode)for(var M=n.length-r;M>=0;M--){a=!0;for(var O=M;O<M+r;O++){if(O<=Math.floor(n.length/2)){a=!1;break}if((s=n[O]).operating[t.mode]){a=!1;break}if((s.bookId[t.mode]||t.prior)&&s.bookId[t.mode]!==t.id){a=!1;break}if(s.operating[t.mode]=!0,s.queue[t.mode].length>0){a=!1,s.operating[t.mode]=!1;break}s.operating[t.mode]=!1}if(a){c=M;break}}if(-1!==c){for(var C=c,E=c+r;C<E;C++)(s=n[C]).operating[t.mode]=!0,s.queue[t.mode].unshift(t),t.prior&&delete s.bookId[t.mode],s.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(delete e.bookChannelId,!0)});return t.channel_id=[c,r],"b2t"===this.direction?(t.top=c*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerWidth*this.danmu.config.area.start)):(t.top=c*i,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start)),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,!0)})}else{c=-1;for(var j=0,T=n.length-r;j<=T;j++){a=!0;for(var P=j;P<j+r;P++)if(n[P].bookId[t.mode]){a=!1;break}if(a){c=j;break}}if(-1!==c){for(var B=c;B<c+r;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[c,r],!0)})}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,i=void 0,o=n[0],r=n[0]+n[1];o<r;o++)if(i=e[o]){i.operating[t.mode]=!0;var a=-1;i.queue[t.mode].some(function(e,n){return e.id===t.id&&(a=n,!0)}),a>-1&&i.queue[t.mode].splice(a,1),i.operating[t.mode]=!1}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach(function(t){t.pauseMove(e.containerPos),t.remove()})}),setTimeout(function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&("b2t"===e.direction?e.width=e.width*(e.danmu.config.area.end-e.danmu.config.area.start):e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;var i=/mobile/gi.test(navigator.userAgent)?10:12,o=void 0;o="b2t"===e.direction?Math.floor(e.width/i):Math.floor(e.height/i);for(var r=[],a=0;a<o;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,"b2t"===e.direction?e.channelWidth=i:e.channelHeight=i},200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,i=this;i.channels&&i.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var e=0;e<i.channels.length;e++)i.channels[e].queue[t].forEach(function(t){t.pauseMove(i.containerPos),t.remove()})});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=/mobile/gi.test(navigator.userAgent)?10:12,a=void 0;a="b2t"===i.direction?Math.floor(i.width/r):Math.floor(i.height/r);for(var s=[],c=0;c<a;c++)s[c]={id:c,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};i.channels=s,i.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=o,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),a=(i=r)&&i.__esModule?i:{default:i};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId,this.direction=e.direction;var i=this;this.danmu.on("changeDirection",function(t){i.direction=t});var o=void 0;if(n.el&&1===n.el.nodeType)o=a.default.copyDom(n.el);else if((o=document.createElement("div")).textContent=n.txt,n.style){var r=n.style;Object.keys(r).forEach(function(t){o.style[t]=r[t]})}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var s=this.container.getBoundingClientRect();this.el.style.left=s.width+"px"}return o(t,[{key:"attach",value:function(){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)}},{key:"detach",value:function(){this.container&&this.el&&this.container.removeChild(this.el);var t=this;this.danmu.off("changeDirection",function(e){t.direction=e}),this.el=null}},{key:"topInit",value:function(){if("b2t"===this.direction){var t=this.container.getBoundingClientRect();this.el.style.transformOrigin="left top",this.el.style.transform="translateX(-"+this.top+"px) translateY("+t.height+"px) translateZ(0px) rotate(90deg)",this.el.style.transition="transform 0s linear 0s"}else this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("paused"!==this.status&&(this.status="paused",clearTimeout(this.removeTimer),this.el))if("scroll"===this.mode){if(e){var n=((new Date).getTime()-this.moveTime)/1e3*this.moveV,i=0;i=this.moveMoreS-n>=0?"b2t"===this.direction?(this.moveMoreS-n)/this.moveContainerHeight*t.height:(this.moveMoreS-n)/this.moveContainerWidth*t.width:this.moveMoreS-n,"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+i+"px) translateZ(0px) rotate(90deg)":this.el.style.left=i+"px"}else"b2t"===this.direction?this.el.style.transform="translateX(-"+this.top+"px) translateY("+(this.el.getBoundingClientRect().top-t.top)+"px) translateZ(0px) rotate(90deg)":this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";"b2t"===this.direction?this.el.style.transition="transform 0s linear 0s":(this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.transition="transform 0s linear 0s")}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start","scroll"===this.mode)if("b2t"===this.direction){this.moveV=(t.height+this.height)/this.duration*1e3;var n=(e.el.getBoundingClientRect().bottom-t.top)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+e.top+"px) translateY(-"+e.height+"px) translateZ(0px) rotate(90deg)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().top-t.top,e.moveContainerHeight=t.height,e.removeTimer=setTimeout(r,1e3*n))},20)}else{this.moveV=(t.width+this.width)/this.duration*1e3;var i=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+i+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(r,1e3*i))},20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(r,o),this.startTime=(new Date).getTime()}function r(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();"b2t"===e.direction?n&&n.bottom<=t.top+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t)):n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){var t=this;(this.removeTimer&&clearTimeout(this.removeTimer),t.el&&t.el.parentNode)&&(this.danmu.off("changeDirection",function(e){t.direction=e}),t.el.parentNode.removeChild(t.el),t.el=null,t.danmu.emit("bullet_remove",{bullet:t}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var i=n(26);"string"==typeof i&&(i=[[t.i,i,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(28)(i,o);i.locals&&(t.exports=i.locals)},function(t,e,n){(t.exports=n(27)(!1)).push([t.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",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=(a=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"});return[n].concat(r).concat([o]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var i,o,r={},a=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=i.apply(this,arguments)),o}),s=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),c=null,u=0,l=[],h=n(29);function f(t,e){for(var n=0;n<t.length;n++){var i=t[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(b(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(b(i.parts[a],e));r[i.id]={id:i.id,refs:1,parts:s}}}}function d(t,e){for(var n=[],i={},o=0;o<t.length;o++){var r=t[o],a=e.base?r[0]+e.base:r[0],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]})}return n}function p(t,e){var n=s(t.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=l[l.length-1];if("top"===t.insertAt)i?i.nextSibling?n.insertBefore(e,i.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.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=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,o)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),g(e,t.attrs),p(t,e),e}function g(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,i,o,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=u++;n=c||(c=v(e)),i=x.bind(null,n,a,!1),o=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),p(t,e),e}(e),i=function(t,e,n){var i=n.css,o=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||r)&&(i=h(i));o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([i],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),o=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),i=function(t,e){var n=e.css,i=e.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){m(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return f(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}t&&f(d(t,e),e);for(o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var c=0;c<s.parts.length;c++)s.parts[c]();delete r[s.id]}}}};var y,w=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function x(t,e,n,i){var o=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=w(e,o);else{var r=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,i=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var o,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(o=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:i+r.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}}])});
//# sourceMappingURL=index.js.map
{
"name": "danmu.js",
"version": "0.0.8",
"version": "0.0.9",
"description": "HTML5 danmu (danmaku) plugin for any DOM element",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -63,2 +63,6 @@ import util from './utils/util'

}
let self = this
this.danmu.off('changeDirection', direction => {
self.direction = direction
})
this.el = null

@@ -220,2 +224,5 @@ }

if (self.el && self.el.parentNode) {
this.danmu.off('changeDirection', direction => {
self.direction = direction
})
let parent = self.el.parentNode

@@ -222,0 +229,0 @@ parent.removeChild(self.el)

@@ -13,2 +13,3 @@ import EventEmitter from 'event-emitter'

},
live: false,
comments: [],

@@ -38,2 +39,3 @@ direction: 'r2l'

}
this.live = this.config.live
this.player = this.config.player

@@ -40,0 +42,0 @@ this.direction = this.config.direction

@@ -134,2 +134,10 @@ import Channel from './channel'

})
if(danmu.live) {
self.data = self.data.filter(item => {
if (!item.start) {
item.start = currentTime
}
return item.start > currentTime - 3 * interval
})
}
} else {

@@ -136,0 +144,0 @@ list = self.data.filter(item => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc