/*! * artplayer-plugin-danmuku.js v5.1.0 * Github: https://github.com/zhw2590582/ArtPlayer * (c) 2017-2024 Harvey Zack * Released under the MIT License. */ !function(e,t,r,n,a){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],s=i.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!s[t]){if(!e[t]){var a="function"==typeof o[n]&&o[n];if(!r&&a)return a(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}d.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},d.cache={};var p=s[t]=new u.Module(t);e[t][0].call(p.exports,d,p,p.exports,this)}return s[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=s,u.parent=i,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return o[n]}}),o[n]=u;for(var c=0;c0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(r){t.id=Date.now(),e.worker.postMessage(t),e.worker.onmessage=function(e){var n=e.data;n.id===t.id&&r(n)}})}},{key:"filter",value:function(e,t){return this.queue.filter(function(t){return t.$state===e}).map(t)}},{key:"getReady",value:function(){var e=this.art.currentTime;return this.queue.filter(function(t){return"ready"===t.$state||"wait"===t.$state&&e+.1>=t.time&&t.time>=e-.1})}},{key:"getEmits",value:function(){var e=this,t=[],r=this.$player.clientWidth,n=this.getLeft(this.$player);return this.filter("emit",function(a){var o=a.$ref.offsetTop,i=e.getLeft(a.$ref)-n,s=a.$ref.clientHeight,l=a.$ref.clientWidth,u=i+l,c=u/a.$restTime,p={};p.top=o,p.left=i,p.height=s,p.width=l,p.right=r-u,p.speed=c,p.distance=u,p.time=a.$restTime,p.mode=a.mode,t.push(p)}),t}},{key:"makeWait",value:function(t){t.$state="wait",t.$ref&&(t.$ref.style.cssText=e.cssText,this.$refs.push(t.$ref),t.$ref=null)}},{key:"update",value:function(){var e=this.utils.setStyles,t=this;return this.timer=window.requestAnimationFrame((0,a._)(function(){var r,n,a,o,i,s,l,c;return(0,u._)(this,function(u){switch(u.label){case 0:if(!(t.art.playing&&!t.isHide))return[3,5];t.filter("emit",function(e){var r=(Date.now()-e.$lastStartTime)/1e3;e.$restTime-=r,e.$lastStartTime=Date.now(),e.$restTime<=0&&t.makeWait(e)}),r=t.getReady(),n=0,u.label=1;case 1:if(!(nt.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);at.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}function u(e,t,r,n){var a,o=arguments.length,i=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(o<3?a(i):o>3?a(t,r,i):a(t,r))||i);return o>3&&i&&Object.defineProperty(t,r,i),i}function c(e,t){return function(r,n){t(r,n,e)}}function p(e,t,r,n,a,o){function i(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,l=n.kind,u="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?n.static?e:e.prototype:null,p=t||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),d=!1,f=r.length-1;f>=0;f--){var h={};for(var m in n)h[m]="access"===m?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(e){if(d)throw TypeError("Cannot add initializers after decoration has completed");o.push(i(e||null))};var y=(0,r[f])("accessor"===l?{get:p.get,set:p.set}:p[u],h);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw TypeError("Object expected");(s=i(y.get))&&(p.get=s),(s=i(y.set))&&(p.set=s),(s=i(y.init))&&a.unshift(s)}else(s=i(y))&&("field"===l?a.unshift(s):p[u]=s)}c&&Object.defineProperty(c,n.name,p),d=!0}function d(e,t,r){for(var n=arguments.length>2,a=0;a0&&a[a.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,o=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i}function k(){for(var e=[],t=0;t1||s(e,t)})})}function s(e,t){try{var r;(r=a[e](t)).value instanceof $?Promise.resolve(r.value.v).then(l,u):c(o[0][2],r)}catch(e){c(o[0][3],e)}}function l(e){s("next",e)}function u(e){s("throw",e)}function c(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function S(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,a){t[n]=e[n]?function(t){return(r=!r)?{value:$(e[n](t)),done:!1}:a?a(t):t}:a}}function D(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=b(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){!function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}(n,a,(t=e[r](t)).done,t.value)})}}}function M(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var F=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function P(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&v(t,e,r);return F(t,e),t}function E(e){return e&&e.__esModule?e:{default:e}}function T(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function A(e,t,r,n,a){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?a.call(e,r):a?a.value=r:t.set(e,r),r}function z(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function I(e,t,r){if(null!=t){var n;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var C="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function H(e){function t(t){e.error=e.hasError?new C(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var a=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(a).then(r,function(e){return t(e),r()})}catch(e){t(e)}}if(e.hasError)throw e.error}()}r.default={__extends:i,__assign:s,__rest:l,__decorate:u,__param:c,__metadata:m,__awaiter:y,__generator:g,__createBinding:v,__exportStar:_,__values:b,__read:x,__spread:k,__spreadArrays:w,__spreadArray:j,__await:$,__asyncGenerator:O,__asyncDelegator:S,__asyncValues:D,__makeTemplateObject:M,__importStar:P,__importDefault:E,__classPrivateFieldGet:T,__classPrivateFieldSet:A,__classPrivateFieldIn:z,__addDisposableResource:I,__disposeResources:H}},{"@swc/helpers/_/_type_of":"felZi","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],felZi:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function a(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}n.defineInteropFlag(r),n.export(r,"_type_of",function(){return a}),n.export(r,"_",function(){return a})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],kMsXR:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"getMode",function(){return i}),n.export(r,"bilibiliDanmuParseFromXml",function(){return s}),n.export(r,"bilibiliDanmuParseFromUrl",function(){return l});var a=e("@swc/helpers/_/_async_to_generator"),o=e("@swc/helpers/_/_ts_generator");function i(e){switch(e){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function s(e){return"string"!=typeof e?[]:Array.from(e.matchAll(RegExp('(?.+?)<\\/d>',"gs"))).map(function(e){var t=e.groups.p.split(",");return t.length>=8?{text:e.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(t[0]),mode:i(Number(t[1])),fontSize:Number(t[2]),color:"#".concat(Number(t[3]).toString(16)),timestamp:Number(t[4]),pool:Number(t[5]),userID:t[6],rowID:Number(t[7])}:null}).filter(Boolean)}function l(e){return u.apply(this,arguments)}function u(){return(u=(0,a._)(function(e){return(0,o._)(this,function(t){switch(t.label){case 0:return[4,fetch(e)];case 1:return[4,t.sent().text()];case 2:return[2,s(t.sent())]}})})).apply(this,arguments)}},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_ts_generator":"6Xyd0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"1gMd5":[function(e,t,r){t.exports='!function(e,r,t,n,o){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof a[n]&&a[n],s=i.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(r,t){if(!s[r]){if(!e[r]){var o="function"==typeof a[n]&&a[n];if(!t&&o)return o(r,!0);if(i)return i(r,!0);if(u&&"string"==typeof r)return u(r);var f=Error("Cannot find module \'"+r+"\'");throw f.code="MODULE_NOT_FOUND",f}c.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},c.cache={};var p=s[r]=new l.Module(r);e[r][0].call(p.exports,c,p,p.exports,this)}return s[r].exports;function c(e){var r=c.resolve(e);return!1===r?{}:l(r)}}l.isParcelRequire=!0,l.Module=function(e){this.id=e,this.bundle=l,this.exports={}},l.modules=e,l.cache=s,l.parent=i,l.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(l,"root",{get:function(){return a[n]}}),a[n]=l;for(var f=0;f=0;p-=1){var c=f[p],_=f[p+1],d=c.top+c.height;if(_.top-d>=r.height)return _.top-r.height}else for(var h=1;h=r.height)return g}for(var j=[],b=1;be.time)})});return w&&w[0]?w[0].top:void 0;case 1:case 2:return}else{switch(r.mode){case 0:j.sort(function(e,r){var t,o,a=(t=Math).min.apply(t,(0,n._)(r.map(function(e){return e.right}))),i=(o=Math).min.apply(o,(0,n._)(e.map(function(e){return e.right})));return a*r.length-i*e.length});break;case 1:case 2:j.sort(function(e,r){var t,o,a=(t=Math).max.apply(t,(0,n._)(r.map(function(e){return e.width})));return(o=Math).max.apply(o,(0,n._)(e.map(function(e){return e.width})))*e.length-a*r.length})}return j[0][0].top}}(r);self.postMessage({top:t,id:r.id})}}},{"@swc/helpers/_/_to_consumable_array":"iwLF0"}],iwLF0:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"_to_consumable_array",function(){return u}),n.export(t,"_",function(){return u});var o=e("./_array_without_holes.js"),a=e("./_iterable_to_array.js"),i=e("./_non_iterable_spread.js"),s=e("./_unsupported_iterable_to_array.js");function u(e){return(0,o._array_without_holes)(e)||(0,a._iterable_to_array)(e)||(0,s._unsupported_iterable_to_array)(e)||(0,i._non_iterable_spread)()}},{"./_array_without_holes.js":"cuL6A","./_iterable_to_array.js":"2thrs","./_non_iterable_spread.js":"a8nO2","./_unsupported_iterable_to_array.js":"5m31D","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],cuL6A:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"_array_without_holes",function(){return a}),n.export(t,"_",function(){return a});var o=e("./_array_like_to_array.js");function a(e){if(Array.isArray(e))return(0,o._array_like_to_array)(e)}},{"./_array_like_to_array.js":"djwRR","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],djwRR:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t\n '.concat(d.default).concat(h.default,'\n\n
\n ').concat(y.default,'\n
\n
\n
\n 按类型屏蔽\n
\n
\n ').concat(b.default).concat(k.default,'\n
滚动
\n
\n
\n ').concat(j.default).concat(O.default,'\n
顶部
\n
\n
\n ').concat(D.default).concat(F.default,'\n
底部
\n
\n
\n
\n
\n
\n ').concat(E.default).concat(A.default,'\n 防止弹幕重叠\n
\n
\n ').concat(E.default).concat(A.default,'\n 同步视频速度\n
\n
\n
\n 不透明度\n
\n
\n
\n
\n 显示区域\n
\n
\n
\n
\n 弹幕字号\n
\n
\n
\n
\n 弹幕速度\n
\n
\n
\n
\n
\n
\n
\n
\n ').concat(v.default,'\n
\n
\n
\n 模式\n
\n
\n ').concat(k.default,'\n
滚动
\n
\n
\n ').concat(O.default,'\n
顶部
\n
\n
\n ').concat(F.default,'\n
底部
\n
\n
\n
\n
\n 颜色\n
\n ').concat(this.COLOR.map(function(e){return'
')}).join(""),'\n
\n
\n
\n
\n
\n\n
发送
\n
\n ')}},{key:"MARGIN",get:function(){return this.option.MARGIN||[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}]}},{key:"SPEED",get:function(){return this.option.SPEED||[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}]}},{key:"COLOR",get:function(){return this.option.COLOR||["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}},{key:"query",value:function(e){return(0,this.utils.query)(e,this.template.$danmuku)}},{key:"setData",value:function(e,t){var r=this.art.template.$player,n=this.template.$mount;r.dataset[e]=t,this.outside&&(n.dataset[e]=t)}},{key:"createTemplate",value:function(){var e=this.utils,t=e.createElement,r=e.tooltip,n=t("div");n.className="artplayer-plugin-danmuku",n.innerHTML=this.TEMPLATE,this.template.$danmuku=n,this.template.$toggle=this.query(".apd-toggle"),r(this.template.$toggle,"弹幕开关"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$styleModes=this.query(".apd-style-mode .apd-modes"),this.template.$colors=this.query(".apd-colors"),this.template.$antiOverlap=this.query(".apd-anti-overlap"),this.template.$syncVideo=this.query(".apd-sync-video"),this.template.$opacitySlider=this.query(".apd-config-opacity .apd-slider"),this.template.$opacityValue=this.query(".apd-config-opacity .apd-value"),this.template.$marginSlider=this.query(".apd-config-margin .apd-slider"),this.template.$marginValue=this.query(".apd-config-margin .apd-value"),this.template.$fontSizeSlider=this.query(".apd-config-fontSize .apd-slider"),this.template.$fontSizeValue=this.query(".apd-config-fontSize .apd-value"),this.template.$speedSlider=this.query(".apd-config-speed .apd-slider"),this.template.$speedValue=this.query(".apd-config-speed .apd-value"),this.template.$input=this.query(".apd-input"),this.template.$send=this.query(".apd-send")}},{key:"createEvents",value:function(){var e=this,t=this.template,r=t.$toggle,n=t.$configModes,a=t.$styleModes,o=t.$colors,i=t.$antiOverlap,l=t.$syncVideo,u=t.$send,c=t.$input;this.art.proxy(r,"click",function(){e.danmuku.config({visible:!e.option.visible}),e.reset()}),this.art.proxy(n,"click",function(t){var r=t.target.closest(".apd-mode");if(r){var n=Number(r.dataset.mode);e.option.modes.includes(n)?e.danmuku.config({modes:e.option.modes.filter(function(e){return e!==n})}):e.danmuku.config({modes:(0,s._)(e.option.modes).concat([n])}),e.reset()}}),this.art.proxy(i,"click",function(){e.danmuku.config({antiOverlap:!e.option.antiOverlap}),e.reset()}),this.art.proxy(l,"click",function(){e.danmuku.config({synchronousPlayback:!e.option.synchronousPlayback}),e.reset()}),this.art.proxy(a,"click",function(t){var r=t.target.closest(".apd-mode");if(r){var n=Number(r.dataset.mode);e.danmuku.config({mode:n}),e.reset()}}),this.art.proxy(o,"click",function(t){var r=t.target.closest(".apd-color");r&&(e.danmuku.config({color:r.dataset.color}),e.reset())}),this.art.proxy(u,"click",function(){return e.emit()}),this.art.proxy(c,"keypress",function(t){"Enter"===t.key&&(t.preventDefault(),e.emit())})}},{key:"createSliders",value:function(){var e=this;this.slider.opacity=this.createSlider({min:0,max:100,steps:[],container:this.template.$opacitySlider,findIndex:function(){return Math.round(100*e.option.opacity)||100},onChange:function(t){e.template.$opacityValue.textContent="".concat(t,"%"),e.danmuku.config({opacity:t/100})}}),this.slider.margin=this.createSlider({min:0,max:3,steps:this.MARGIN,container:this.template.$marginSlider,findIndex:function(){return e.MARGIN.findIndex(function(t){return t.value[0]===e.option.margin[0]&&t.value[1]===e.option.margin[1]})||2},onChange:function(t){var r=e.MARGIN[t];e.template.$marginValue.textContent=r.name,e.danmuku.config({margin:r.value})}}),this.slider.fontSize=this.createSlider({min:1,max:25,steps:[],container:this.template.$fontSizeSlider,findIndex:function(){var t=e.art.template.$player.clientHeight;return"number"==typeof e.option.fontSize?Math.round(e.option.fontSize/t*100)||5:Math.round(e.option.fontSize.replace("%",""))||5},onChange:function(t){e.template.$fontSizeValue.textContent="".concat(t,"%"),e.danmuku.config({fontSize:"".concat(t,"%")})}}),this.slider.speed=this.createSlider({min:0,max:4,steps:this.SPEED,container:this.template.$speedSlider,findIndex:function(){return e.SPEED.findIndex(function(t){return t.value===e.option.speed})||2},onChange:function(t){var r=e.SPEED[t];e.template.$speedValue.textContent=r.name,e.danmuku.config({speed:r.value})}})}},{key:"createSlider",value:function(e){var t=e.min,r=e.max,n=e.container,a=e.findIndex,o=e.onChange,i=e.steps,s=void 0===i?[]:i,l=this.utils,u=l.query,c=l.clamp;n.innerHTML='\n
\n
\n '.concat(s.map(function(){return'
'}).join(""),'\n
\n
\n
\n
\n
\n ').concat(s.map(function(e){return e.hide?"":'
'.concat(e.name,"
")}).join(""),"\n
\n ");var p=u(".apd-slider-dot",n),d=u(".apd-slider-progress",n),f=!1;function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a(),n=c(e,t,r),i=(n-t)/(r-t);p.style.left="".concat(100*i,"%"),0===s.length&&(d.style.width=p.style.left),o(n)}function m(e){var a=n.getBoundingClientRect(),o=a.left,i=a.width;h(Math.round(c(e.clientX-o,0,i)/i*(r-t)+t))}return this.art.proxy(n,"click",function(e){m(e)}),this.art.proxy(n,"mousedown",function(e){f=0===e.button}),this.art.on("document:mousemove",function(e){f&&m(e)}),this.art.on("document:mouseup",function(e){f&&(f=!1,m(e))}),{reset:h}}},{key:"emit",value:function(){var e=this;return(0,a._)(function(){var t,r,n,a;return(0,l._)(this,function(o){switch(o.label){case 0:if(!(r=(t=e.template.$input).value.trim()).length||e.isLock||e.emitting)return[2];n={text:r,mode:e.option.mode,color:e.option.color,time:e.art.currentTime},o.label=1;case 1:return o.trys.push([1,3,,4]),e.emitting=!0,[4,e.option.beforeEmit(n)];case 2:if(a=o.sent(),e.emitting=!1,!0!==a)return[2];return n.border=!0,delete n.time,e.danmuku.emit(n),t.value="",e.lock(),[3,4];case 3:return o.sent(),e.emitting=!1,[3,4];case 4:return[2]}})})()}},{key:"lock",value:function(){var e=this,t=this.utils.addClass,r=this.template.$send;this.isLock=!0;var n=this.option.lockTime;r.innerText=n,t(r,"apd-lock");var a=function(){e.timer=setTimeout(function(){0===n?e.unlock():(n-=1,r.innerText=n,a())},1e3)};a()}},{key:"unlock",value:function(){var e=this.utils.removeClass,t=this.template.$send;clearTimeout(this.timer),this.isLock=!1,t.innerText="发送",e(t,"apd-lock")}},{key:"reset",value:function(){var e=this;this.slider.opacity.reset(),this.slider.margin.reset(),this.slider.fontSize.reset(),this.slider.speed.reset(),this.setData("danmukuVisible",this.option.visible),this.setData("danmukuMode",this.option.mode),this.setData("danmukuColor",this.option.color),this.setData("danmukuMode0",this.option.modes.includes(0)),this.setData("danmukuMode1",this.option.modes.includes(1)),this.setData("danmukuMode2",this.option.modes.includes(2)),this.setData("danmukuAntiOverlap",this.option.antiOverlap),this.setData("danmukuSyncVideo",this.option.synchronousPlayback);var t=this.utils.inverseClass,r=Array.from(this.template.$colors.children).find(function(t){return t.dataset.color===e.option.color.toUpperCase()});r&&t(r,"apd-active")}},{key:"mount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.template.$controlsCenter;e.appendChild(this.template.$danmuku),this.template.$mount=e,this.danmuku.config({mount:e}),this.reset()}}]),e}();if("undefined"!=typeof document){var I="artplayer-plugin-danmuku",C=document.getElementById(I);if(C)C.textContent=c.default;else{var H=document.createElement("style");H.id=I,H.textContent=c.default,document.head.appendChild(H)}}},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_class_call_check":"9iJMm","@swc/helpers/_/_create_class":"21IOT","@swc/helpers/_/_to_consumable_array":"iwLF0","@swc/helpers/_/_ts_generator":"6Xyd0","bundle-text:./style.less":"i8wAr","bundle-text:./img/on.svg":"4mwSI","bundle-text:./img/off.svg":"9bQDs","bundle-text:./img/config.svg":"cciuY","bundle-text:./img/style.svg":"e5G6o","bundle-text:./img/mode_0_off.svg":"fC4yA","bundle-text:./img/mode_0_on.svg":"fUkVg","bundle-text:./img/mode_1_off.svg":"isoJm","bundle-text:./img/mode_1_on.svg":"20nBM","bundle-text:./img/mode_2_off.svg":"6x9CL","bundle-text:./img/mode_2_on.svg":"7GKdL","bundle-text:./img/check_on.svg":"9SCIh","bundle-text:./img/check_off.svg":"6KRxn","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iwLF0:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_to_consumable_array",function(){return l}),n.export(r,"_",function(){return l});var a=e("./_array_without_holes.js"),o=e("./_iterable_to_array.js"),i=e("./_non_iterable_spread.js"),s=e("./_unsupported_iterable_to_array.js");function l(e){return(0,a._array_without_holes)(e)||(0,o._iterable_to_array)(e)||(0,s._unsupported_iterable_to_array)(e)||(0,i._non_iterable_spread)()}},{"./_array_without_holes.js":"cuL6A","./_iterable_to_array.js":"2thrs","./_non_iterable_spread.js":"a8nO2","./_unsupported_iterable_to_array.js":"5m31D","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],cuL6A:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_array_without_holes",function(){return o}),n.export(r,"_",function(){return o});var a=e("./_array_like_to_array.js");function o(e){if(Array.isArray(e))return(0,a._array_like_to_array)(e)}},{"./_array_like_to_array.js":"djwRR","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],djwRR:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r0&&void 0!==arguments[0]?arguments[0]:[];if(l=null,u=null,s.innerHTML="",e.duration&&!e.option.isLive){var f={w:s.offsetWidth,h:s.offsetHeight},h={xMin:0,xMax:f.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*f.h),sampling:Math.floor(f.w/100),smoothing:.2,flattening:.2};"object"==typeof r&&Object.assign(h,r);var m=[];if(Array.isArray(d)&&d.length)m=(0,a._)(d);else for(var y=function(e){var r=t.danmus.filter(function(t){var r=t.time;return r>e*g&&r<=(e+h.sampling)*g}).length;m.push([e,r])},g=e.duration/f.w,v=0;v<=f.w;v+=h.sampling)y(v);if(0!==m.length){var _=m[m.length-1],b=_[0],x=_[1];b!==f.w&&m.push([f.w,x]);for(var k=m.map(function(e){return e[1]}),w=((c=Math).min.apply(c,(0,a._)(k))+(p=Math).max.apply(p,(0,a._)(k)))/2,j=0;jw?1+h.scale:1-h.scale)+h.minHeight}var S=function(e,t,r,n){var a=i(t||e,r||e),s=o.map(Math.cos(a.angle)*h.flattening,0,1,1,0),l=a.angle*s+(n?Math.PI:0),u=a.length*h.smoothing;return[e[0]+Math.cos(l)*u,e[1]+Math.sin(l)*u]},D=function(e,t,r){var n=S(r[t-1],r[t-2],e),a=S(e,r[t-1],r[t+1],!0),o=t===r.length-1?" z":"";return"C ".concat(n[0],",").concat(n[1]," ").concat(a[0],",").concat(a[1]," ").concat(e[0],",").concat(e[1]).concat(o)},M=m.map(function(e){return[o.map(e[0],h.xMin,h.xMax,0,f.w),o.map(e[1],h.yMin,h.yMax,f.h,0)]}).reduce(function(e,t,r,n){return 0===r?"M ".concat(n[n.length-1][0],",").concat(f.h," L ").concat(t[0],",").concat(f.h," L ").concat(t[0],",").concat(t[1]):"".concat(e," ").concat(D(t,r,n))},"");s.innerHTML='\n\n\n\n\n\n\n\n\n\n\n\n '),l=n("#heatmap-start",s),u=n("#heatmap-stop",s),l.setAttribute("offset","".concat(100*e.played,"%")),u.setAttribute("offset","".concat(100*e.played,"%"))}}}e.on("video:timeupdate",function(){l&&u&&(l.setAttribute("offset","".concat(100*e.played,"%")),u.setAttribute("offset","".concat(100*e.played,"%")))}),e.on("setBar",function(e,t){l&&u&&"played"===e&&(l.setAttribute("offset","".concat(100*t,"%")),u.setAttribute("offset","".concat(100*t,"%")))}),e.on("ready",function(){return c()}),e.on("resize",function(){return c()}),e.on("artplayerPluginDanmuku:loaded",function(){return c()}),e.on("artplayerPluginDanmuku:points",function(e){return c(e)})}})}},{"@swc/helpers/_/_to_consumable_array":"iwLF0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}]},["40mNk"],"40mNk","parcelRequire4dc0");