From 774ca866d20e0dc6d6fc53671e8a9064e511b68d Mon Sep 17 00:00:00 2001 From: Harvey Zack Date: Mon, 27 May 2024 12:30:30 +0800 Subject: [PATCH] chore: Update build.js to return compressedHtmlString instead of compressedCssString --- docs/compiled/artplayer-plugin-danmuku.js | 17 ++++++++++++++++- .../compiled/artplayer-plugin-danmuku.legacy.js | 2 +- .../dist/artplayer-plugin-danmuku.js | 17 ++++++++++++++++- .../dist/artplayer-plugin-danmuku.legacy.js | 2 +- scripts/build.js | 2 +- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/docs/compiled/artplayer-plugin-danmuku.js b/docs/compiled/artplayer-plugin-danmuku.js index f5e069f49..847c08dcf 100644 --- a/docs/compiled/artplayer-plugin-danmuku.js +++ b/docs/compiled/artplayer-plugin-danmuku.js @@ -4,4 +4,19 @@ * (c) 2017-2024 Harvey Zack * Released under the MIT License. */ -!function(e,t,i,a,n){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof o[a]&&o[a],l=s.cache||{},r="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,i){if(!l[t]){if(!e[t]){var n="function"==typeof o[a]&&o[a];if(!i&&n)return n(t,!0);if(s)return s(t,!0);if(r&&"string"==typeof t)return r(t);var p=Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}h.resolve=function(i){var a=e[t][1][i];return null!=a?a:i},h.cache={};var u=l[t]=new d.Module(t);e[t][0].call(u.exports,h,u,u.exports,this)}return l[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=s,d.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(d,"root",{get:function(){return o[a]}}),o[a]=d;for(var p=0;pp);var n=e("./danmuku"),o=a.interopDefault(n),s=e("./setting"),l=a.interopDefault(s),r=e("./heatmap"),d=a.interopDefault(r);function p(e){return t=>{let i=new o.default(t,e),a=new l.default(t,i);return i.option.heatmap&&(0,d.default)(t,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}p.icons=l.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=p)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i);var n=e("./bilibili"),o=e("bundle-text:./worker"),s=a.interopDefault(o);class l{constructor(e,t){let{constructor:i,template:a}=e;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(t),this.worker=new Worker(URL.createObjectURL(new Blob([s.default]))),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("destroy",this.destroy),e.on("resize",this.reset),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,maxLength:200,lockTime:5,theme:"dark"}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement",heatmap:"object|boolean",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",maxLength:"number",lockTime:"number",theme:"string"}}static get cssText(){return` user-select:none;position:absolute;white-space:pre;pointer-events:none;perspective:500px;display:inline-block;will-change:transform;font-weight:normal;line-height:1.125;visibility:hidden;font-family:SimHei,"Microsoft JhengHei",Arial,Helvetica,sans-serif;text-shadow:rgb(0,0,0) 1px 0px 1px,rgb(0,0,0) 0px 1px 1px,rgb(0,0,0) 0px -1px 1px,rgb(0,0,0) -1px 0px 1px;`}get isRotate(){return this.art.plugins?.autoOrientation?.state}get marginTop(){let{clamp:e}=this.utils,t=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof t?e(t,0,i):"string"==typeof t&&t.endsWith("%")?e(i*(parseFloat(t)/100),0,i):l.option.margin[0]}get marginBottom(){let{clamp:e}=this.utils,t=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof t?e(t,0,i):"string"==typeof t&&t.endsWith("%")?e(i*(parseFloat(t)/100),0,i):l.option.margin[1]}async load(){let{errorHandle:e}=this.utils;try{"function"==typeof this.option.danmuku?this.danmus=await this.option.danmuku():"function"==typeof this.option.danmuku.then?this.danmus=await this.option.danmuku:"string"==typeof this.option.danmuku?this.danmus=await (0,n.bilibiliDanmuParseFromUrl)(this.option.danmuku):this.danmus=this.option.danmuku,e(Array.isArray(this.danmus),"Danmuku need return an array as result"),this.queue=[],this.$danmuku.innerText="",this.danmus.forEach(e=>this.emit(e)),this.art.emit("artplayerPluginDanmuku:loaded",this.queue)}catch(e){throw this.art.emit("artplayerPluginDanmuku:error",e),e}return this}emit(e){let{clamp:t}=this.utils;return this.validator(e,{text:"string",mode:"?number",color:"?string",time:"?number",border:"?boolean",style:"?object",escape:"?boolean"}),e.text.trim()&&(e.time?e.time=t(e.time,0,1/0):e.time=this.art.currentTime+.5,void 0===e.mode&&(e.mode=this.option.mode),void 0===e.style&&(e.style={}),void 0===e.escape&&(e.escape=!0),void 0===e.color&&(e.color=this.option.color),[0,1,2].includes(e.mode)&&this.option.filter(e)&&this.queue.push({...e,$state:"wait",$ref:null,$restTime:0,$lastStartTime:0})),this}config(e){let{clamp:t}=this.utils,{$controlsCenter:i}=this.art.template;if(this.option=Object.assign({},l.option,this.option,e),this.validator(this.option,l.scheme),this.option.mode=t(this.option.mode,0,2),this.option.speed=t(this.option.speed,1,10),this.option.opacity=t(this.option.opacity,0,1),this.option.lockTime=t(this.option.lockTime,1,60),this.option.maxLength=t(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,e.fontSize){let e=this.getFontSize(this.option.fontSize);e!==this.option.fontSize&&(this.option.fontSize=e,this.reset())}return this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option),this}getLeft(e){let t=e.getBoundingClientRect();return this.isRotate?t.top:t.left}getRef(){let e=this.$refs.pop()||document.createElement("div");return e.style.cssText=l.cssText,e.dataset.mode="",e}getFontSize(e){let{clamp:t}=this.utils,{clientHeight:i}=this.$player;return"number"==typeof e?t(e,12,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),12,i):l.option.fontSize}postMessage(e={}){return new Promise(t=>{e.id=Date.now(),this.worker.postMessage(e),this.worker.onmessage=i=>{let{data:a}=i;a.id===e.id&&t(a)}})}filter(e,t){return this.queue.filter(t=>t.$state===e).map(t)}getReady(){let{currentTime:e}=this.art;return this.queue.filter(t=>"ready"===t.$state||"wait"===t.$state&&e+.1>=t.time&&t.time>=e-.1)}getEmits(){let e=[],{clientWidth:t}=this.$player,i=this.getLeft(this.$player);return this.filter("emit",a=>{let n=a.$ref.offsetTop,o=this.getLeft(a.$ref)-i,s=a.$ref.clientHeight,l=a.$ref.clientWidth,r=o+l,d=r/a.$restTime,p={};p.top=n,p.left=o,p.height=s,p.width=l,p.right=t-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,e.push(p)}),e}makeWait(e){e.$state="wait",e.$ref&&(e.$ref.style.cssText=l.cssText,this.$refs.push(e.$ref),e.$ref=null)}update(){let{setStyles:e}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",e=>{let t=(Date.now()-e.$lastStartTime)/1e3;e.$restTime-=t,e.$lastStartTime=Date.now(),e.$restTime<=0&&this.makeWait(e)});let t=this.getReady();for(let i=0;i{if(t.$state="emit",t.$lastStartTime=Date.now(),0===t.mode){let i=e+t.$ref.clientWidth;t.$ref.style.transform=`translateX(${-i}px)`,t.$ref.style.transition=`transform ${t.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:e}=this.$player;return this.filter("emit",t=>{if(t.$state="stop",0===t.mode){let i=e-(this.getLeft(t.$ref)-this.getLeft(this.$player));t.$ref.style.transform=`translateX(${-i}px)`,t.$ref.style.transition="transform 0s linear 0s"}}),this}stop(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.timer),this.art.emit("artplayerPluginDanmuku:stop"),this}start(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}reset(){return this.queue.forEach(e=>this.makeWait(e)),this}show(){return this.isHide=!1,this.start(),this.$danmuku.style.display="",this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.stop(),this.queue.forEach(e=>this.makeWait(e)),this.$danmuku.style.display="none",this.art.emit("artplayerPluginDanmuku:hide"),this}destroy(){this.stop(),this.worker.terminate(),this.art.off("video:play",this.start),this.art.off("video:playing",this.start),this.art.off("video:pause",this.stop),this.art.off("video:waiting",this.stop),this.art.off("resize",this.reset),this.art.off("destroy",this.destroy),this.art.emit("artplayerPluginDanmuku:destroy")}}i.default=l},{"./bilibili":"f83sx","bundle-text:./worker":"lfIAi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],f83sx:[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");function n(e){switch(e){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function o(e){return"string"!=typeof e?[]:Array.from(e.matchAll(/(?.+?)<\/d>/gs)).map(e=>{let t=e.groups.p.split(",");return t.length>=8?{text:e.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(t[0]),mode:n(Number(t[1])),fontSize:Number(t[2]),color:`#${Number(t[3]).toString(16)}`,timestamp:Number(t[4]),pool:Number(t[5]),userID:t[6],rowID:Number(t[7])}:null}).filter(Boolean)}async function s(e){let t=await fetch(e);return o(await t.text())}a.defineInteropFlag(i),a.export(i,"getMode",()=>n),a.export(i,"bilibiliDanmuParseFromXml",()=>o),a.export(i,"bilibiliDanmuParseFromUrl",()=>s)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,i){i.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},i.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.exportAll=function(e,t){return Object.keys(e).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})}),t},i.export=function(e,t,i){Object.defineProperty(e,t,{enumerable:!0,get:i})}},{}],lfIAi:[function(e,t,i){t.exports='!function(e,t,n,o,i){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof r[o]&&r[o],l=f.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!l[t]){if(!e[t]){var i="function"==typeof r[o]&&r[o];if(!n&&i)return i(t,!0);if(f)return f(t,!0);if(d&&"string"==typeof t)return d(t);var h=Error("Cannot find module \'"+t+"\'");throw h.code="MODULE_NOT_FOUND",h}p.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},p.cache={};var s=l[t]=new u.Module(t);e[t][0].call(s.exports,p,s,s.exports,this)}return l[t].exports;function p(e){var t=p.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=l,u.parent=f,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return r[o]}}),r[o]=u;for(var h=0;h{let{data:t}=e;if(!t.id)return;let n=function({target:e,emits:t,clientWidth:n,clientHeight:o,marginBottom:i,marginTop:r,antiOverlap:f}){let l=o-i,d=t.filter(t=>t.mode===e.mode&&t.top<=l).sort((e,t)=>e.top-t.top);if(0===d.length)return 2===e.mode?l-e.height:r;if(d.unshift({type:"top",top:0,left:0,right:0,height:r,width:n,speed:0,distance:n}),d.push({type:"bottom",top:l,left:0,right:0,height:i,width:n,speed:0,distance:n}),2===e.mode)for(let t=d.length-2;t>=0;t-=1){let n=d[t],o=d[t+1],i=n.top+n.height;if(o.top-i>=e.height)return o.top-e.height}else for(let t=1;t=e.height)return i}let u=[];for(let e=1;et.every(t=>!(nt.time)));return t&&t[0]?t[0].top:void 0}case 1:case 2:return}else{switch(e.mode){case 0:u.sort((e,t)=>{let n=Math.min(...t.map(e=>e.right)),o=Math.min(...e.map(e=>e.right));return n*t.length-o*e.length});break;case 1:case 2:u.sort((e,t)=>{let n=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-n*t.length})}return u[0][0].top}}(t);self.postMessage({top:n,id:t.id})}},{}]},["59OZS"],"59OZS","parcelRequire4dc0");'},{}],lO8OT:[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i);var n=e("bundle-text:./style.less"),o=a.interopDefault(n),s=e("bundle-text:./img/on.svg"),l=a.interopDefault(s),r=e("bundle-text:./img/off.svg"),d=a.interopDefault(r),p=e("bundle-text:./img/config.svg"),u=a.interopDefault(p),h=e("bundle-text:./img/style.svg"),m=a.interopDefault(h),c=e("bundle-text:./img/mode_0_off.svg"),f=a.interopDefault(c),g=e("bundle-text:./img/mode_0_on.svg"),v=a.interopDefault(g),y=e("bundle-text:./img/mode_1_off.svg"),x=a.interopDefault(y),k=e("bundle-text:./img/mode_1_on.svg"),b=a.interopDefault(k),$=e("bundle-text:./img/mode_2_off.svg"),w=a.interopDefault($),M=e("bundle-text:./img/mode_2_on.svg"),E=a.interopDefault(M),z=e("bundle-text:./img/check_on.svg"),D=a.interopDefault(z),F=e("bundle-text:./img/check_off.svg"),S=a.interopDefault(F);if(i.default=class{constructor(e,t){this.art=e,this.danmuku=t,this.utils=e.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=e.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$configModes:null,$styleModes:null,$colors:null,$opacitySlider:null,$opacityValue:null,$marginSlider:null,$marginValue:null,$fontSizeSlider:null,$fontSizeValue:null,$speedSlider:null,$speedValue:null,$input:null,$send:null},this.slider={opacity:null,margin:null,fontSize:null,speed:null},this.emitting=!1,this.isLock=!1,this.timer=null,this.createTemplate(),this.createSliders(),this.createEvents(),this.mount(this.option.mount),e.on("fullscreen",e=>this.onFullscreen(e)),e.on("fullscreenWeb",e=>this.onFullscreen(e))}static get icons(){return{$on:l.default,$off:d.default,$config:u.default,$style:m.default,$mode_0_off:f.default,$mode_0_on:v.default,$mode_1_off:x.default,$mode_1_on:b.default,$mode_2_off:w.default,$mode_2_on:E.default,$check_on:D.default,$check_off:S.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:e}=this;return`
${l.default}${d.default}
${u.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${f.default}${v.default}
\u{6EDA}\u{52A8}
${x.default}${b.default}
\u{9876}\u{90E8}
${w.default}${E.default}
\u{5E95}\u{90E8}
${D.default}${S.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${D.default}${S.default} \u{540C}\u{6B65}\u{89C6}\u{9891}\u{901F}\u{5EA6}
\u{4E0D}\u{900F}\u{660E}\u{5EA6}
\u{672A}\u{77E5}
\u{663E}\u{793A}\u{533A}\u{57DF}
\u{672A}\u{77E5}
\u{5F39}\u{5E55}\u{5B57}\u{53F7}
\u{672A}\u{77E5}
\u{5F39}\u{5E55}\u{901F}\u{5EA6}
\u{672A}\u{77E5}
${m.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${b.default}
\u{9876}\u{90E8}
${E.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(e=>`
`).join("")}
\u{53D1}\u{9001}
`}get MARGIN(){return this.option.MARGIN||[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}]}get SPEED(){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}]}get COLOR(){return this.option.COLOR||["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(e){let{query:t}=this.utils,{$danmuku:i}=this.template;return t(e,i)}setData(e,t){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[e]=t,this.outside&&(a.dataset[e]=t)}createTemplate(){let{createElement:e,tooltip:t}=this.utils,i=e("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),t(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")}createEvents(){let{$toggle:e,$configModes:t,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(e,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(t,"click",e=>{let t=e.target.closest(".apd-mode");if(!t)return;let i=Number(t.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(e=>e!==i)}):this.danmuku.config({modes:[...this.option.modes,i]}),this.reset()}),this.art.proxy(n,"click",()=>{this.danmuku.config({antiOverlap:!this.option.antiOverlap}),this.reset()}),this.art.proxy(o,"click",()=>{this.danmuku.config({synchronousPlayback:!this.option.synchronousPlayback}),this.reset()}),this.art.proxy(i,"click",e=>{let t=e.target.closest(".apd-mode");if(!t)return;let i=Number(t.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",e=>{let t=e.target.closest(".apd-color");t&&(this.danmuku.config({color:t.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",e=>{"Enter"===e.key&&(e.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({min:0,max:100,steps:[],container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:e=>{let{$opacityValue:t}=this.template;t.textContent=`${e}%`;let i=e/100;i!==this.option.opacity&&this.danmuku.config({opacity:i})}}),this.slider.margin=this.createSlider({min:0,max:3,steps:this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.findIndex(e=>e.value[0]===this.option.margin[0]&&e.value[1]===this.option.margin[1]),onChange:e=>{let t=this.MARGIN[e];if(!t)return;let{$marginValue:i}=this.template;i.textContent=t.name;let a=t.value;(a[0]!==this.option.margin[0]||a[1]!==this.option.margin[1])&&this.danmuku.config({margin:a})}}),this.slider.fontSize=this.createSlider({min:1,max:25,steps:[],container:this.template.$fontSizeSlider,findIndex:()=>{let{clientHeight:e}=this.art.template.$player;return Math.round(this.option.fontSize/e*100)},onChange:e=>{let{$fontSizeValue:t}=this.template,{clientHeight:i}=this.art.template.$player;t.textContent=`${e}%`,e!==Math.round(this.option.fontSize/i*100)&&this.danmuku.config({fontSize:`${e}%`})}}),this.slider.speed=this.createSlider({min:0,max:4,steps:this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.findIndex(e=>e.value===this.option.speed),onChange:e=>{let t=this.SPEED[e];if(!t)return;let{$speedValue:i}=this.template;i.textContent=t.name;let a=t.value;a!==this.option.speed&&this.danmuku.config({speed:a})}})}createSlider({min:e,max:t,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l}=this.utils;i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(e=>e.hide?"":`
${e.name}
`).join("")}
`;let r=s(".apd-slider-dot",i),d=s(".apd-slider-progress",i),p=!1;function u(i=a()){if(it)return;let s=(i-e)/(t-e);r.style.left=`${100*s}%`,0===o.length&&(d.style.width=r.style.left),n(i)}function h(a){let{left:n,width:o}=i.getBoundingClientRect();u(Math.round(l(a.clientX-n,0,o)/o*(t-e)+e))}return this.art.proxy(i,"click",e=>{h(e)}),this.art.proxy(i,"mousedown",e=>{p=0===e.button}),this.art.on("document:mousemove",e=>{p&&h(e)}),this.art.on("document:mouseup",e=>{p&&(p=!1,h(e))}),{reset:u}}onFullscreen(e){if(this.outside){let{$danmuku:t,$controlsCenter:i,$mount:a}=this.template;e?i.appendChild(t):a.appendChild(t)}}async emit(){let{$input:e}=this.template,t=e.value.trim();if(!t.length||this.isLock||this.emitting)return;let i={text:t,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let t=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==t)return;i.border=!0,delete i.time,this.danmuku.emit(i),e.value="",this.lock()}catch(e){this.emitting=!1}}lock(){let{addClass:e}=this.utils,{$send:t}=this.template;this.isLock=!0;let i=this.option.lockTime;t.innerText=i,e(t,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(i-=1,t.innerText=i,a())},1e3)};a()}unlock(){let{removeClass:e}=this.utils,{$send:t}=this.template;clearTimeout(this.timer),this.isLock=!1,t.innerText="发送",e(t,"apd-lock")}reset(){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),this.setData("danmukuTheme",this.option.theme);let{inverseClass:e}=this.utils,t=Array.from(this.template.$colors.children).find(e=>e.dataset.color===this.option.color.toUpperCase());t&&e(t,"apd-active")}mount(e=this.template.$controlsCenter){e.appendChild(this.template.$danmuku),this.template.$mount=e,this.reset()}},"undefined"!=typeof document){let e="artplayer-plugin-danmuku",t=document.getElementById(e);if(t)t.textContent=o.default;else{let t=document.createElement("style");t.id=e,t.textContent=o.default,document.head.appendChild(t)}}},{"bundle-text:./style.less":"hViDo","bundle-text:./img/on.svg":"9pjcf","bundle-text:./img/off.svg":"b2dkP","bundle-text:./img/config.svg":"l8tyy","bundle-text:./img/style.svg":"5iZC3","bundle-text:./img/mode_0_off.svg":"i0Vut","bundle-text:./img/mode_0_on.svg":"hOSvZ","bundle-text:./img/mode_1_off.svg":"bOXC3","bundle-text:./img/mode_1_on.svg":"lKuh0","bundle-text:./img/mode_2_off.svg":"eB8W6","bundle-text:./img/mode_2_on.svg":"bpe2E","bundle-text:./img/check_on.svg":"kL9zy","bundle-text:./img/check_off.svg":"22xpM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],hViDo:[function(e,t,i){t.exports='.artplayer-plugin-danmuku{z-index:99;color:#fff;flex-shrink:0;justify-content:center;align-items:center;gap:10px;width:100%;height:32px;font-size:12px;font-weight:300;display:flex;position:relative}.artplayer-plugin-danmuku .apd-icon{cursor:pointer;opacity:.75;fill:#fff;transition:all .2s}.artplayer-plugin-danmuku .apd-icon:hover{opacity:1}.artplayer-plugin-danmuku .apd-config{display:flex;position:relative}.artplayer-plugin-danmuku .apd-config .apd-config-panel{width:320px;padding:10px;display:none;position:absolute;bottom:24px;left:-148px}.artplayer-plugin-danmuku .apd-config .apd-config-panel .apd-config-panel-inner{background-color:#000000d9;border-radius:3px;width:100%;padding:10px}.artplayer-plugin-danmuku .apd-config:hover .apd-config-panel{display:flex}.artplayer-plugin-danmuku .apd-config-mode,.artplayer-plugin-danmuku .apd-config-slider,.artplayer-plugin-danmuku .apd-config-other,.artplayer-plugin-danmuku .apd-style-mode{margin-bottom:15px}.artplayer-plugin-danmuku .apd-modes{align-items:center;gap:20px;margin-top:5px;display:flex}.artplayer-plugin-danmuku .apd-modes .apd-mode{cursor:pointer;text-align:center}.artplayer-plugin-danmuku .apd-modes .apd-mode:hover{color:#00a1d6}.artplayer-plugin-danmuku .apd-config-slider{align-items:center;gap:12px;display:flex}.artplayer-plugin-danmuku .apd-config-slider .apd-value{text-align:right;width:32px}.artplayer-plugin-danmuku .apd-slider{cursor:pointer;flex:1;justify-content:center;align-items:center;height:20px;display:flex;position:relative}.artplayer-plugin-danmuku .apd-slider .apd-slider-line{background-color:#ffffff40;border-radius:3px;width:100%;height:2px;position:relative;overflow:hidden}.artplayer-plugin-danmuku .apd-slider .apd-slider-points{justify-content:space-between;align-items:center;display:flex;position:absolute;inset:0}.artplayer-plugin-danmuku .apd-slider .apd-slider-points .apd-slider-point{background-color:#ffffff80;border-radius:50%;width:2px;height:2px}.artplayer-plugin-danmuku .apd-slider .apd-slider-progress{background-color:#00a1d6;width:0%;height:100%}.artplayer-plugin-danmuku .apd-slider .apd-slider-dot{background-color:#00a1d6;border-radius:50%;width:12px;height:12px;position:absolute;left:0%;transform:translate(-6px)}.artplayer-plugin-danmuku .apd-slider .apd-slider-steps{color:#777;justify-content:space-between;align-items:center;width:calc(100% + 32px);display:flex;position:absolute;bottom:-12px}.artplayer-plugin-danmuku .apd-slider .apd-slider-steps .apd-slider-step{text-align:center;flex-shrink:0;width:36px;scale:.95}.artplayer-plugin-danmuku .apd-config-other{align-items:center;gap:20px;display:flex}.artplayer-plugin-danmuku .apd-config-other .apd-check-off,.artplayer-plugin-danmuku .apd-config-other .apd-check-on{width:16px;height:16px}.artplayer-plugin-danmuku .apd-config-other .apd-other{cursor:pointer;align-items:center;gap:2px;display:flex}.artplayer-plugin-danmuku .apd-config-other .apd-other:hover{color:#00a1d6}.artplayer-plugin-danmuku .apd-emitter{background-color:#ffffff40;border-radius:5px;flex:1;align-items:center;height:100%;display:flex}.artplayer-plugin-danmuku .apd-style{justify-content:center;align-items:center;display:flex;position:relative}.artplayer-plugin-danmuku .apd-style .apd-style-panel{width:200px;padding:10px;display:none;position:absolute;bottom:24px;left:-88px}.artplayer-plugin-danmuku .apd-style .apd-style-panel .apd-style-panel-inner{background-color:#000000d9;border-radius:3px;width:100%;padding:10px}.artplayer-plugin-danmuku .apd-style:hover .apd-style-panel{display:flex}.artplayer-plugin-danmuku .apd-colors{flex-wrap:wrap;gap:8px;margin-top:5px;display:flex}.artplayer-plugin-danmuku .apd-colors .apd-color{cursor:pointer;border-radius:2px;width:16px;height:16px}.artplayer-plugin-danmuku .apd-colors .apd-color.apd-active{border:1px solid #000;box-shadow:0 0 0 1px #fff}.artplayer-plugin-danmuku .apd-input{color:#fff;background-color:#0000;border:none;outline:none;flex:1;width:auto;min-width:0;height:100%;line-height:1}.artplayer-plugin-danmuku .apd-input::placeholder{color:#ffffff80}.artplayer-plugin-danmuku .apd-send{cursor:pointer;text-shadow:none;background-color:#00a1d6;border-top-right-radius:5px;border-bottom-right-radius:5px;flex-shrink:0;justify-content:center;align-items:center;width:60px;height:100%;display:flex}.artplayer-plugin-danmuku .apd-send.apd-lock{cursor:not-allowed;color:#666;background-color:#e7e7e7}.art-fullscreen .artplayer-plugin-danmuku,.art-fullscreen-web .artplayer-plugin-danmuku{gap:16px;height:38px}.art-fullscreen .artplayer-plugin-danmuku .apd-config-icon,.art-fullscreen-web .artplayer-plugin-danmuku .apd-config-icon,.art-fullscreen .artplayer-plugin-danmuku .apd-toggle-off,.art-fullscreen-web .artplayer-plugin-danmuku .apd-toggle-off,.art-fullscreen .artplayer-plugin-danmuku .apd-toggle-on,.art-fullscreen-web .artplayer-plugin-danmuku .apd-toggle-on{width:28px;height:28px}.art-fullscreen .artplayer-plugin-danmuku .apd-emitter,.art-fullscreen-web .artplayer-plugin-danmuku .apd-emitter{flex:none;width:390px}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-icon{fill:#333}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-emitter{background-color:#f1f2f3}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input{color:#000}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:#0000004d}[data-danmuku-visible=false] .apd-toggle-off{display:block}[data-danmuku-visible=false] .apd-toggle-on,[data-danmuku-visible=true] .apd-toggle-off{display:none}[data-danmuku-visible=true] .apd-toggle-on{display:block}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-on{display:none}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-off,[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-on{display:block}[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-off,[data-danmuku-sync-video=false] .apd-sync-video .apd-check-on{display:none}[data-danmuku-sync-video=false] .apd-sync-video .apd-check-off,[data-danmuku-sync-video=true] .apd-sync-video .apd-check-on{display:block}[data-danmuku-sync-video=true] .apd-sync-video .apd-check-off{display:none}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-off{display:block}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-on{display:none}[data-danmuku-mode0=false] .art-danmuku [data-mode="0"]{opacity:0!important}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-off{display:none}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-on{display:block}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"]{color:#00a1d6}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"] path{fill:#00a1d6}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-off{display:block}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-on{display:none}[data-danmuku-mode1=false] .art-danmuku [data-mode="1"]{opacity:0!important}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-off{display:none}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-on{display:block}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"]{color:#00a1d6}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"] path{fill:#00a1d6}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-off{display:block}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-on{display:none}[data-danmuku-mode2=false] .art-danmuku [data-mode="2"]{opacity:0!important}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-off{display:none}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-on{display:block}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"]{color:#00a1d6}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"] path{fill:#00a1d6}'},{}],"9pjcf":[function(e,t,i){t.exports=''},{}],b2dkP:[function(e,t,i){t.exports=''},{}],l8tyy:[function(e,t,i){t.exports=''},{}],"5iZC3":[function(e,t,i){t.exports=''},{}],i0Vut:[function(e,t,i){t.exports=''},{}],hOSvZ:[function(e,t,i){t.exports=''},{}],bOXC3:[function(e,t,i){t.exports=''},{}],lKuh0:[function(e,t,i){t.exports=''},{}],eB8W6:[function(e,t,i){t.exports=''},{}],bpe2E:[function(e,t,i){t.exports=''},{}],kL9zy:[function(e,t,i){t.exports=''},{}],"22xpM":[function(e,t,i){t.exports=''},{}],"8AxLD":[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i),a.export(i,"default",()=>s);let n={map:(e,t,i,a,n)=>(e-t)*(n-a)/(i-t)+a,range(e,t,i){let a=Math.round(e/i)*i;return Array.from({length:Math.floor((t-e)/i)},(e,t)=>t*i+a)}},o=(e,t)=>{let i=t[0]-e[0],a=t[1]-e[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function s(e,t,i){let{query:a}=e.constructor.utils;e.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(s){let l=null,r=null;function d(d=[]){if(l=null,r=null,s.innerHTML="",!e.duration||e.option.isLive)return;let p={w:s.offsetWidth,h:s.offsetHeight},u={xMin:0,xMax:p.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*p.h),sampling:Math.floor(p.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(u,i);let h=[];if(Array.isArray(d)&&d.length)h=[...d];else{let i=e.duration/p.w;for(let e=0;e<=p.w;e+=u.sampling){let a=t.danmus.filter(({time:t})=>t>e*i&&t<=(e+u.sampling)*i).length;h.push([e,a])}}if(0===h.length)return;let m=h[h.length-1],c=m[0],f=m[1];c!==p.w&&h.push([p.w,f]);let g=h.map(e=>e[1]),v=(Math.min(...g)+Math.max(...g))/2;for(let e=0;ev?1+u.scale:1-u.scale)+u.minHeight}let y=(e,t,i,a)=>{let s=o(t||e,i||e),l=n.map(Math.cos(s.angle)*u.flattening,0,1,1,0),r=s.angle*l+(a?Math.PI:0),d=s.length*u.smoothing;return[e[0]+Math.cos(r)*d,e[1]+Math.sin(r)*d]},x=(e,t,i)=>{let a=y(i[t-1],i[t-2],e),n=y(e,i[t-1],i[t+1],!0),o=t===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${e[0]},${e[1]}${o}`},k=h.map(e=>[n.map(e[0],u.xMin,u.xMax,0,p.w),n.map(e[1],u.yMin,u.yMax,p.h,0)]).reduce((e,t,i,a)=>0===i?`M ${a[a.length-1][0]},${p.h} L ${t[0]},${p.h} L ${t[0]},${t[1]}`:`${e} ${x(t,i,a)}`,"");s.innerHTML=``,l=a("#heatmap-start",s),r=a("#heatmap-stop",s),l.setAttribute("offset",`${100*e.played}%`),r.setAttribute("offset",`${100*e.played}%`)}e.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*e.played}%`),r.setAttribute("offset",`${100*e.played}%`))}),e.on("setBar",(e,t)=>{l&&r&&"played"===e&&(l.setAttribute("offset",`${100*t}%`),r.setAttribute("offset",`${100*t}%`))}),e.on("ready",()=>d()),e.on("resize",()=>d()),e.on("artplayerPluginDanmuku:loaded",()=>d()),e.on("artplayerPluginDanmuku:points",e=>d(e))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["bgm6t"],"bgm6t","parcelRequire4dc0"); \ No newline at end of file +!function(e,t,i,a,n){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof o[a]&&o[a],l=s.cache||{},r="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,i){if(!l[t]){if(!e[t]){var n="function"==typeof o[a]&&o[a];if(!i&&n)return n(t,!0);if(s)return s(t,!0);if(r&&"string"==typeof t)return r(t);var p=Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}h.resolve=function(i){var a=e[t][1][i];return null!=a?a:i},h.cache={};var u=l[t]=new d.Module(t);e[t][0].call(u.exports,h,u,u.exports,this)}return l[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=s,d.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(d,"root",{get:function(){return o[a]}}),o[a]=d;for(var p=0;pp);var n=e("./danmuku"),o=a.interopDefault(n),s=e("./setting"),l=a.interopDefault(s),r=e("./heatmap"),d=a.interopDefault(r);function p(e){return t=>{let i=new o.default(t,e),a=new l.default(t,i);return i.option.heatmap&&(0,d.default)(t,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}p.icons=l.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=p)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i);var n=e("./bilibili"),o=e("bundle-text:./worker"),s=a.interopDefault(o);class l{constructor(e,t){let{constructor:i,template:a}=e;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(t),this.worker=new Worker(URL.createObjectURL(new Blob([s.default]))),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("destroy",this.destroy),e.on("resize",this.reset),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,maxLength:200,lockTime:5,theme:"dark"}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement",heatmap:"object|boolean",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",maxLength:"number",lockTime:"number",theme:"string"}}static get cssText(){return` + user-select: none; + position: absolute; + white-space: pre; + pointer-events: none; + perspective: 500px; + display: inline-block; + will-change: transform; + font-weight: normal; + line-height: 1.125; + visibility: hidden; + font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif; + text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px; + `}get isRotate(){return this.art.plugins?.autoOrientation?.state}get marginTop(){let{clamp:e}=this.utils,t=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof t?e(t,0,i):"string"==typeof t&&t.endsWith("%")?e(i*(parseFloat(t)/100),0,i):l.option.margin[0]}get marginBottom(){let{clamp:e}=this.utils,t=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof t?e(t,0,i):"string"==typeof t&&t.endsWith("%")?e(i*(parseFloat(t)/100),0,i):l.option.margin[1]}async load(){let{errorHandle:e}=this.utils;try{"function"==typeof this.option.danmuku?this.danmus=await this.option.danmuku():"function"==typeof this.option.danmuku.then?this.danmus=await this.option.danmuku:"string"==typeof this.option.danmuku?this.danmus=await (0,n.bilibiliDanmuParseFromUrl)(this.option.danmuku):this.danmus=this.option.danmuku,e(Array.isArray(this.danmus),"Danmuku need return an array as result"),this.queue=[],this.$danmuku.innerText="",this.danmus.forEach(e=>this.emit(e)),this.art.emit("artplayerPluginDanmuku:loaded",this.queue)}catch(e){throw this.art.emit("artplayerPluginDanmuku:error",e),e}return this}emit(e){let{clamp:t}=this.utils;return this.validator(e,{text:"string",mode:"?number",color:"?string",time:"?number",border:"?boolean",style:"?object",escape:"?boolean"}),e.text.trim()&&(e.time?e.time=t(e.time,0,1/0):e.time=this.art.currentTime+.5,void 0===e.mode&&(e.mode=this.option.mode),void 0===e.style&&(e.style={}),void 0===e.escape&&(e.escape=!0),void 0===e.color&&(e.color=this.option.color),[0,1,2].includes(e.mode)&&this.option.filter(e)&&this.queue.push({...e,$state:"wait",$ref:null,$restTime:0,$lastStartTime:0})),this}config(e){let{clamp:t}=this.utils,{$controlsCenter:i}=this.art.template;if(this.option=Object.assign({},l.option,this.option,e),this.validator(this.option,l.scheme),this.option.mode=t(this.option.mode,0,2),this.option.speed=t(this.option.speed,1,10),this.option.opacity=t(this.option.opacity,0,1),this.option.lockTime=t(this.option.lockTime,1,60),this.option.maxLength=t(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,e.fontSize){let e=this.getFontSize(this.option.fontSize);e!==this.option.fontSize&&(this.option.fontSize=e,this.reset())}return this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option),this}getLeft(e){let t=e.getBoundingClientRect();return this.isRotate?t.top:t.left}getRef(){let e=this.$refs.pop()||document.createElement("div");return e.style.cssText=l.cssText,e.dataset.mode="",e}getFontSize(e){let{clamp:t}=this.utils,{clientHeight:i}=this.$player;return"number"==typeof e?t(e,12,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),12,i):l.option.fontSize}postMessage(e={}){return new Promise(t=>{e.id=Date.now(),this.worker.postMessage(e),this.worker.onmessage=i=>{let{data:a}=i;a.id===e.id&&t(a)}})}filter(e,t){return this.queue.filter(t=>t.$state===e).map(t)}getReady(){let{currentTime:e}=this.art;return this.queue.filter(t=>"ready"===t.$state||"wait"===t.$state&&e+.1>=t.time&&t.time>=e-.1)}getEmits(){let e=[],{clientWidth:t}=this.$player,i=this.getLeft(this.$player);return this.filter("emit",a=>{let n=a.$ref.offsetTop,o=this.getLeft(a.$ref)-i,s=a.$ref.clientHeight,l=a.$ref.clientWidth,r=o+l,d=r/a.$restTime,p={};p.top=n,p.left=o,p.height=s,p.width=l,p.right=t-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,e.push(p)}),e}makeWait(e){e.$state="wait",e.$ref&&(e.$ref.style.cssText=l.cssText,this.$refs.push(e.$ref),e.$ref=null)}update(){let{setStyles:e}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",e=>{let t=(Date.now()-e.$lastStartTime)/1e3;e.$restTime-=t,e.$lastStartTime=Date.now(),e.$restTime<=0&&this.makeWait(e)});let t=this.getReady();for(let i=0;i{if(t.$state="emit",t.$lastStartTime=Date.now(),0===t.mode){let i=e+t.$ref.clientWidth;t.$ref.style.transform=`translateX(${-i}px)`,t.$ref.style.transition=`transform ${t.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:e}=this.$player;return this.filter("emit",t=>{if(t.$state="stop",0===t.mode){let i=e-(this.getLeft(t.$ref)-this.getLeft(this.$player));t.$ref.style.transform=`translateX(${-i}px)`,t.$ref.style.transition="transform 0s linear 0s"}}),this}stop(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.timer),this.art.emit("artplayerPluginDanmuku:stop"),this}start(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}reset(){return this.queue.forEach(e=>this.makeWait(e)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.start(),this.$danmuku.style.display="",this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.stop(),this.queue.forEach(e=>this.makeWait(e)),this.$danmuku.style.display="none",this.art.emit("artplayerPluginDanmuku:hide"),this}destroy(){this.stop(),this.worker.terminate(),this.art.off("video:play",this.start),this.art.off("video:playing",this.start),this.art.off("video:pause",this.stop),this.art.off("video:waiting",this.stop),this.art.off("resize",this.reset),this.art.off("destroy",this.destroy),this.art.emit("artplayerPluginDanmuku:destroy")}}i.default=l},{"./bilibili":"f83sx","bundle-text:./worker":"lfIAi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],f83sx:[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");function n(e){switch(e){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function o(e){return"string"!=typeof e?[]:Array.from(e.matchAll(/(?.+?)<\/d>/gs)).map(e=>{let t=e.groups.p.split(",");return t.length>=8?{text:e.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(t[0]),mode:n(Number(t[1])),fontSize:Number(t[2]),color:`#${Number(t[3]).toString(16)}`,timestamp:Number(t[4]),pool:Number(t[5]),userID:t[6],rowID:Number(t[7])}:null}).filter(Boolean)}async function s(e){let t=await fetch(e);return o(await t.text())}a.defineInteropFlag(i),a.export(i,"getMode",()=>n),a.export(i,"bilibiliDanmuParseFromXml",()=>o),a.export(i,"bilibiliDanmuParseFromUrl",()=>s)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,i){i.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},i.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.exportAll=function(e,t){return Object.keys(e).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})}),t},i.export=function(e,t,i){Object.defineProperty(e,t,{enumerable:!0,get:i})}},{}],lfIAi:[function(e,t,i){t.exports='!function(e,t,n,o,i){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof r[o]&&r[o],l=f.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!l[t]){if(!e[t]){var i="function"==typeof r[o]&&r[o];if(!n&&i)return i(t,!0);if(f)return f(t,!0);if(d&&"string"==typeof t)return d(t);var h=Error("Cannot find module \'"+t+"\'");throw h.code="MODULE_NOT_FOUND",h}p.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},p.cache={};var s=l[t]=new u.Module(t);e[t][0].call(s.exports,p,s,s.exports,this)}return l[t].exports;function p(e){var t=p.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=l,u.parent=f,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return r[o]}}),r[o]=u;for(var h=0;h{let{data:t}=e;if(!t.id)return;let n=function({target:e,emits:t,clientWidth:n,clientHeight:o,marginBottom:i,marginTop:r,antiOverlap:f}){let l=o-i,d=t.filter(t=>t.mode===e.mode&&t.top<=l).sort((e,t)=>e.top-t.top);if(0===d.length)return 2===e.mode?l-e.height:r;if(d.unshift({type:"top",top:0,left:0,right:0,height:r,width:n,speed:0,distance:n}),d.push({type:"bottom",top:l,left:0,right:0,height:i,width:n,speed:0,distance:n}),2===e.mode)for(let t=d.length-2;t>=0;t-=1){let n=d[t],o=d[t+1],i=n.top+n.height;if(o.top-i>=e.height)return o.top-e.height}else for(let t=1;t=e.height)return i}let u=[];for(let e=1;et.every(t=>!(nt.time)));return t&&t[0]?t[0].top:void 0}case 1:case 2:return}else{switch(e.mode){case 0:u.sort((e,t)=>{let n=Math.min(...t.map(e=>e.right)),o=Math.min(...e.map(e=>e.right));return n*t.length-o*e.length});break;case 1:case 2:u.sort((e,t)=>{let n=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-n*t.length})}return u[0][0].top}}(t);self.postMessage({top:n,id:t.id})}},{}]},["59OZS"],"59OZS","parcelRequire4dc0");'},{}],lO8OT:[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i);var n=e("bundle-text:./style.less"),o=a.interopDefault(n),s=e("bundle-text:./img/on.svg"),l=a.interopDefault(s),r=e("bundle-text:./img/off.svg"),d=a.interopDefault(r),p=e("bundle-text:./img/config.svg"),u=a.interopDefault(p),h=e("bundle-text:./img/style.svg"),m=a.interopDefault(h),c=e("bundle-text:./img/mode_0_off.svg"),f=a.interopDefault(c),g=e("bundle-text:./img/mode_0_on.svg"),v=a.interopDefault(g),y=e("bundle-text:./img/mode_1_off.svg"),x=a.interopDefault(y),k=e("bundle-text:./img/mode_1_on.svg"),b=a.interopDefault(k),$=e("bundle-text:./img/mode_2_off.svg"),w=a.interopDefault($),M=e("bundle-text:./img/mode_2_on.svg"),E=a.interopDefault(M),z=e("bundle-text:./img/check_on.svg"),D=a.interopDefault(z),F=e("bundle-text:./img/check_off.svg"),S=a.interopDefault(F);if(i.default=class{constructor(e,t){this.art=e,this.danmuku=t,this.utils=e.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=e.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$configModes:null,$styleModes:null,$colors:null,$opacitySlider:null,$opacityValue:null,$marginSlider:null,$marginValue:null,$fontSizeSlider:null,$fontSizeValue:null,$speedSlider:null,$speedValue:null,$input:null,$send:null},this.slider={opacity:null,margin:null,fontSize:null,speed:null},this.emitting=!1,this.isLock=!1,this.timer=null,this.createTemplate(),this.createSliders(),this.createEvents(),this.mount(this.option.mount),e.on("fullscreen",e=>this.onFullscreen(e)),e.on("fullscreenWeb",e=>this.onFullscreen(e))}static get icons(){return{$on:l.default,$off:d.default,$config:u.default,$style:m.default,$mode_0_off:f.default,$mode_0_on:v.default,$mode_1_off:x.default,$mode_1_on:b.default,$mode_2_off:w.default,$mode_2_on:E.default,$check_on:D.default,$check_off:S.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:e}=this;return`
${l.default}${d.default}
${u.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${f.default}${v.default}
\u{6EDA}\u{52A8}
${x.default}${b.default}
\u{9876}\u{90E8}
${w.default}${E.default}
\u{5E95}\u{90E8}
${D.default}${S.default} + \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${D.default}${S.default} + \u{540C}\u{6B65}\u{89C6}\u{9891}\u{901F}\u{5EA6}
\u{4E0D}\u{900F}\u{660E}\u{5EA6}
\u{672A}\u{77E5}
\u{663E}\u{793A}\u{533A}\u{57DF}
\u{672A}\u{77E5}
\u{5F39}\u{5E55}\u{5B57}\u{53F7}
\u{672A}\u{77E5}
\u{5F39}\u{5E55}\u{901F}\u{5EA6}
\u{672A}\u{77E5}
${m.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${b.default}
\u{9876}\u{90E8}
${E.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(e=>`
`).join("")}
\u{53D1}\u{9001}
`}get MARGIN(){return this.option.MARGIN||[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}]}get SPEED(){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}]}get COLOR(){return this.option.COLOR||["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(e){let{query:t}=this.utils,{$danmuku:i}=this.template;return t(e,i)}setData(e,t){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[e]=t,this.outside&&(a.dataset[e]=t)}createTemplate(){let{createElement:e,tooltip:t}=this.utils,i=e("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),t(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")}createEvents(){let{$toggle:e,$configModes:t,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(e,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(t,"click",e=>{let t=e.target.closest(".apd-mode");if(!t)return;let i=Number(t.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(e=>e!==i)}):this.danmuku.config({modes:[...this.option.modes,i]}),this.reset()}),this.art.proxy(n,"click",()=>{this.danmuku.config({antiOverlap:!this.option.antiOverlap}),this.reset()}),this.art.proxy(o,"click",()=>{this.danmuku.config({synchronousPlayback:!this.option.synchronousPlayback}),this.reset()}),this.art.proxy(i,"click",e=>{let t=e.target.closest(".apd-mode");if(!t)return;let i=Number(t.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",e=>{let t=e.target.closest(".apd-color");t&&(this.danmuku.config({color:t.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",e=>{"Enter"===e.key&&(e.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({min:0,max:100,steps:[],container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:e=>{let{$opacityValue:t}=this.template;t.textContent=`${e}%`;let i=e/100;i!==this.option.opacity&&this.danmuku.config({opacity:i})}}),this.slider.margin=this.createSlider({min:0,max:3,steps:this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.findIndex(e=>e.value[0]===this.option.margin[0]&&e.value[1]===this.option.margin[1]),onChange:e=>{let t=this.MARGIN[e];if(!t)return;let{$marginValue:i}=this.template;i.textContent=t.name;let a=t.value;(a[0]!==this.option.margin[0]||a[1]!==this.option.margin[1])&&this.danmuku.config({margin:a})}}),this.slider.fontSize=this.createSlider({min:1,max:25,steps:[],container:this.template.$fontSizeSlider,findIndex:()=>{let{clientHeight:e}=this.art.template.$player;return Math.round(this.option.fontSize/e*100)},onChange:e=>{let{$fontSizeValue:t}=this.template,{clientHeight:i}=this.art.template.$player;t.textContent=`${e}%`,e!==Math.round(this.option.fontSize/i*100)&&this.danmuku.config({fontSize:`${e}%`})}}),this.slider.speed=this.createSlider({min:0,max:4,steps:this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.findIndex(e=>e.value===this.option.speed),onChange:e=>{let t=this.SPEED[e];if(!t)return;let{$speedValue:i}=this.template;i.textContent=t.name;let a=t.value;a!==this.option.speed&&this.danmuku.config({speed:a})}})}createSlider({min:e,max:t,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l}=this.utils;i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(e=>e.hide?"":`
${e.name}
`).join("")}
`;let r=s(".apd-slider-dot",i),d=s(".apd-slider-progress",i),p=!1;function u(i=a()){if(it)return;let s=(i-e)/(t-e);r.style.left=`${100*s}%`,0===o.length&&(d.style.width=r.style.left),n(i)}function h(a){let{left:n,width:o}=i.getBoundingClientRect();u(Math.round(l(a.clientX-n,0,o)/o*(t-e)+e))}return this.art.proxy(i,"click",e=>{h(e)}),this.art.proxy(i,"mousedown",e=>{p=0===e.button}),this.art.on("document:mousemove",e=>{p&&h(e)}),this.art.on("document:mouseup",e=>{p&&(p=!1,h(e))}),{reset:u}}onFullscreen(e){if(this.outside){let{$danmuku:t,$controlsCenter:i,$mount:a}=this.template;e?i.appendChild(t):a.appendChild(t)}}async emit(){let{$input:e}=this.template,t=e.value.trim();if(!t.length||this.isLock||this.emitting)return;let i={text:t,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let t=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==t)return;i.border=!0,delete i.time,this.danmuku.emit(i),e.value="",this.lock()}catch(e){this.emitting=!1}}lock(){let{addClass:e}=this.utils,{$send:t}=this.template;this.isLock=!0;let i=this.option.lockTime;t.innerText=i,e(t,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(i-=1,t.innerText=i,a())},1e3)};a()}unlock(){let{removeClass:e}=this.utils,{$send:t}=this.template;clearTimeout(this.timer),this.isLock=!1,t.innerText="发送",e(t,"apd-lock")}reset(){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),this.setData("danmukuTheme",this.option.theme);let{inverseClass:e}=this.utils,t=Array.from(this.template.$colors.children).find(e=>e.dataset.color===this.option.color.toUpperCase());t&&e(t,"apd-active")}mount(e=this.template.$controlsCenter){e.appendChild(this.template.$danmuku),this.template.$mount=e,this.reset()}},"undefined"!=typeof document){let e="artplayer-plugin-danmuku",t=document.getElementById(e);if(t)t.textContent=o.default;else{let t=document.createElement("style");t.id=e,t.textContent=o.default,document.head.appendChild(t)}}},{"bundle-text:./style.less":"hViDo","bundle-text:./img/on.svg":"9pjcf","bundle-text:./img/off.svg":"b2dkP","bundle-text:./img/config.svg":"l8tyy","bundle-text:./img/style.svg":"5iZC3","bundle-text:./img/mode_0_off.svg":"i0Vut","bundle-text:./img/mode_0_on.svg":"hOSvZ","bundle-text:./img/mode_1_off.svg":"bOXC3","bundle-text:./img/mode_1_on.svg":"lKuh0","bundle-text:./img/mode_2_off.svg":"eB8W6","bundle-text:./img/mode_2_on.svg":"bpe2E","bundle-text:./img/check_on.svg":"kL9zy","bundle-text:./img/check_off.svg":"22xpM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],hViDo:[function(e,t,i){t.exports='.artplayer-plugin-danmuku{z-index:99;color:#fff;flex-shrink:0;justify-content:center;align-items:center;gap:10px;width:100%;height:32px;font-size:12px;font-weight:300;display:flex;position:relative}.artplayer-plugin-danmuku .apd-icon{cursor:pointer;opacity:.75;fill:#fff;transition:all .2s}.artplayer-plugin-danmuku .apd-icon:hover{opacity:1}.artplayer-plugin-danmuku .apd-config{display:flex;position:relative}.artplayer-plugin-danmuku .apd-config .apd-config-panel{width:320px;padding:10px;display:none;position:absolute;bottom:24px;left:-148px}.artplayer-plugin-danmuku .apd-config .apd-config-panel .apd-config-panel-inner{background-color:#000000d9;border-radius:3px;width:100%;padding:10px}.artplayer-plugin-danmuku .apd-config:hover .apd-config-panel{display:flex}.artplayer-plugin-danmuku .apd-config-mode,.artplayer-plugin-danmuku .apd-config-slider,.artplayer-plugin-danmuku .apd-config-other,.artplayer-plugin-danmuku .apd-style-mode{margin-bottom:15px}.artplayer-plugin-danmuku .apd-modes{align-items:center;gap:20px;margin-top:5px;display:flex}.artplayer-plugin-danmuku .apd-modes .apd-mode{cursor:pointer;text-align:center}.artplayer-plugin-danmuku .apd-modes .apd-mode:hover{color:#00a1d6}.artplayer-plugin-danmuku .apd-config-slider{align-items:center;gap:12px;display:flex}.artplayer-plugin-danmuku .apd-config-slider .apd-value{text-align:right;width:32px}.artplayer-plugin-danmuku .apd-slider{cursor:pointer;flex:1;justify-content:center;align-items:center;height:20px;display:flex;position:relative}.artplayer-plugin-danmuku .apd-slider .apd-slider-line{background-color:#ffffff40;border-radius:3px;width:100%;height:2px;position:relative;overflow:hidden}.artplayer-plugin-danmuku .apd-slider .apd-slider-points{justify-content:space-between;align-items:center;display:flex;position:absolute;inset:0}.artplayer-plugin-danmuku .apd-slider .apd-slider-points .apd-slider-point{background-color:#ffffff80;border-radius:50%;width:2px;height:2px}.artplayer-plugin-danmuku .apd-slider .apd-slider-progress{background-color:#00a1d6;width:0%;height:100%}.artplayer-plugin-danmuku .apd-slider .apd-slider-dot{background-color:#00a1d6;border-radius:50%;width:12px;height:12px;position:absolute;left:0%;transform:translate(-6px)}.artplayer-plugin-danmuku .apd-slider .apd-slider-steps{color:#777;justify-content:space-between;align-items:center;width:calc(100% + 32px);display:flex;position:absolute;bottom:-12px}.artplayer-plugin-danmuku .apd-slider .apd-slider-steps .apd-slider-step{text-align:center;flex-shrink:0;width:36px;scale:.95}.artplayer-plugin-danmuku .apd-config-other{align-items:center;gap:20px;display:flex}.artplayer-plugin-danmuku .apd-config-other .apd-check-off,.artplayer-plugin-danmuku .apd-config-other .apd-check-on{width:16px;height:16px}.artplayer-plugin-danmuku .apd-config-other .apd-other{cursor:pointer;align-items:center;gap:2px;display:flex}.artplayer-plugin-danmuku .apd-config-other .apd-other:hover{color:#00a1d6}.artplayer-plugin-danmuku .apd-emitter{background-color:#ffffff40;border-radius:5px;flex:1;align-items:center;height:100%;display:flex}.artplayer-plugin-danmuku .apd-style{justify-content:center;align-items:center;display:flex;position:relative}.artplayer-plugin-danmuku .apd-style .apd-style-panel{width:200px;padding:10px;display:none;position:absolute;bottom:24px;left:-88px}.artplayer-plugin-danmuku .apd-style .apd-style-panel .apd-style-panel-inner{background-color:#000000d9;border-radius:3px;width:100%;padding:10px}.artplayer-plugin-danmuku .apd-style:hover .apd-style-panel{display:flex}.artplayer-plugin-danmuku .apd-colors{flex-wrap:wrap;gap:8px;margin-top:5px;display:flex}.artplayer-plugin-danmuku .apd-colors .apd-color{cursor:pointer;border-radius:2px;width:16px;height:16px}.artplayer-plugin-danmuku .apd-colors .apd-color.apd-active{border:1px solid #000;box-shadow:0 0 0 1px #fff}.artplayer-plugin-danmuku .apd-input{color:#fff;background-color:#0000;border:none;outline:none;flex:1;width:auto;min-width:0;height:100%;line-height:1}.artplayer-plugin-danmuku .apd-input::placeholder{color:#ffffff80}.artplayer-plugin-danmuku .apd-send{cursor:pointer;text-shadow:none;background-color:#00a1d6;border-top-right-radius:5px;border-bottom-right-radius:5px;flex-shrink:0;justify-content:center;align-items:center;width:60px;height:100%;display:flex}.artplayer-plugin-danmuku .apd-send.apd-lock{cursor:not-allowed;color:#666;background-color:#e7e7e7}.art-controls-center .apd-emitter{flex:none;width:260px}.art-fullscreen .artplayer-plugin-danmuku,.art-fullscreen-web .artplayer-plugin-danmuku{gap:16px;height:38px}.art-fullscreen .artplayer-plugin-danmuku .apd-config-icon,.art-fullscreen-web .artplayer-plugin-danmuku .apd-config-icon,.art-fullscreen .artplayer-plugin-danmuku .apd-toggle-off,.art-fullscreen-web .artplayer-plugin-danmuku .apd-toggle-off,.art-fullscreen .artplayer-plugin-danmuku .apd-toggle-on,.art-fullscreen-web .artplayer-plugin-danmuku .apd-toggle-on{width:28px;height:28px}.art-fullscreen .artplayer-plugin-danmuku .apd-emitter,.art-fullscreen-web .artplayer-plugin-danmuku .apd-emitter{flex:none;width:400px}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-icon{fill:#333}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-emitter{background-color:#f1f2f3}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input{color:#000}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:#0000004d}[data-danmuku-visible=false] .apd-toggle-off{display:block}[data-danmuku-visible=false] .apd-toggle-on,[data-danmuku-visible=true] .apd-toggle-off{display:none}[data-danmuku-visible=true] .apd-toggle-on{display:block}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-on{display:none}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-off,[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-on{display:block}[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-off,[data-danmuku-sync-video=false] .apd-sync-video .apd-check-on{display:none}[data-danmuku-sync-video=false] .apd-sync-video .apd-check-off,[data-danmuku-sync-video=true] .apd-sync-video .apd-check-on{display:block}[data-danmuku-sync-video=true] .apd-sync-video .apd-check-off{display:none}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-off{display:block}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-on{display:none}[data-danmuku-mode0=false] .art-danmuku [data-mode="0"]{opacity:0!important}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-off{display:none}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-on{display:block}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"]{color:#00a1d6}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"] path{fill:#00a1d6}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-off{display:block}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-on{display:none}[data-danmuku-mode1=false] .art-danmuku [data-mode="1"]{opacity:0!important}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-off{display:none}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-on{display:block}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"]{color:#00a1d6}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"] path{fill:#00a1d6}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-off{display:block}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-on{display:none}[data-danmuku-mode2=false] .art-danmuku [data-mode="2"]{opacity:0!important}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-off{display:none}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-on{display:block}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"]{color:#00a1d6}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"] path{fill:#00a1d6}'},{}],"9pjcf":[function(e,t,i){t.exports=''},{}],b2dkP:[function(e,t,i){t.exports=''},{}],l8tyy:[function(e,t,i){t.exports=''},{}],"5iZC3":[function(e,t,i){t.exports=''},{}],i0Vut:[function(e,t,i){t.exports=''},{}],hOSvZ:[function(e,t,i){t.exports=''},{}],bOXC3:[function(e,t,i){t.exports=''},{}],lKuh0:[function(e,t,i){t.exports=''},{}],eB8W6:[function(e,t,i){t.exports=''},{}],bpe2E:[function(e,t,i){t.exports=''},{}],kL9zy:[function(e,t,i){t.exports=''},{}],"22xpM":[function(e,t,i){t.exports=''},{}],"8AxLD":[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i),a.export(i,"default",()=>s);let n={map:(e,t,i,a,n)=>(e-t)*(n-a)/(i-t)+a,range(e,t,i){let a=Math.round(e/i)*i;return Array.from({length:Math.floor((t-e)/i)},(e,t)=>t*i+a)}},o=(e,t)=>{let i=t[0]-e[0],a=t[1]-e[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function s(e,t,i){let{query:a}=e.constructor.utils;e.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(s){let l=null,r=null;function d(d=[]){if(l=null,r=null,s.innerHTML="",!e.duration||e.option.isLive)return;let p={w:s.offsetWidth,h:s.offsetHeight},u={xMin:0,xMax:p.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*p.h),sampling:Math.floor(p.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(u,i);let h=[];if(Array.isArray(d)&&d.length)h=[...d];else{let i=e.duration/p.w;for(let e=0;e<=p.w;e+=u.sampling){let a=t.danmus.filter(({time:t})=>t>e*i&&t<=(e+u.sampling)*i).length;h.push([e,a])}}if(0===h.length)return;let m=h[h.length-1],c=m[0],f=m[1];c!==p.w&&h.push([p.w,f]);let g=h.map(e=>e[1]),v=(Math.min(...g)+Math.max(...g))/2;for(let e=0;ev?1+u.scale:1-u.scale)+u.minHeight}let y=(e,t,i,a)=>{let s=o(t||e,i||e),l=n.map(Math.cos(s.angle)*u.flattening,0,1,1,0),r=s.angle*l+(a?Math.PI:0),d=s.length*u.smoothing;return[e[0]+Math.cos(r)*d,e[1]+Math.sin(r)*d]},x=(e,t,i)=>{let a=y(i[t-1],i[t-2],e),n=y(e,i[t-1],i[t+1],!0),o=t===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${e[0]},${e[1]}${o}`},k=h.map(e=>[n.map(e[0],u.xMin,u.xMax,0,p.w),n.map(e[1],u.yMin,u.yMax,p.h,0)]).reduce((e,t,i,a)=>0===i?`M ${a[a.length-1][0]},${p.h} L ${t[0]},${p.h} L ${t[0]},${t[1]}`:`${e} ${x(t,i,a)}`,"");s.innerHTML=``,l=a("#heatmap-start",s),r=a("#heatmap-stop",s),l.setAttribute("offset",`${100*e.played}%`),r.setAttribute("offset",`${100*e.played}%`)}e.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*e.played}%`),r.setAttribute("offset",`${100*e.played}%`))}),e.on("setBar",(e,t)=>{l&&r&&"played"===e&&(l.setAttribute("offset",`${100*t}%`),r.setAttribute("offset",`${100*t}%`))}),e.on("ready",()=>d()),e.on("resize",()=>d()),e.on("artplayerPluginDanmuku:loaded",()=>d()),e.on("artplayerPluginDanmuku:points",e=>d(e))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["bgm6t"],"bgm6t","parcelRequire4dc0"); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-danmuku.legacy.js b/docs/compiled/artplayer-plugin-danmuku.legacy.js index ef9f2e9a4..f091a1a3b 100644 --- a/docs/compiled/artplayer-plugin-danmuku.legacy.js +++ b/docs/compiled/artplayer-plugin-danmuku.legacy.js @@ -4,4 +4,4 @@ * (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 O(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 z(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 A(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:S,__asyncDelegator:O,__asyncValues:D,__makeTemplateObject:M,__importStar:P,__importDefault:E,__classPrivateFieldGet:T,__classPrivateFieldSet:z,__classPrivateFieldIn:A,__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(S.default,'\n
顶部
\n
\n
\n ').concat(D.default).concat(F.default,'\n
底部
\n
\n
\n
\n
\n
\n ').concat(E.default).concat(z.default,'\n 防止弹幕重叠\n
\n
\n ').concat(E.default).concat(z.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(S.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)},onChange:function(t){e.template.$opacityValue.textContent="".concat(t,"%");var r=t/100;r!==e.option.opacity&&e.danmuku.config({opacity:r})}}),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]})},onChange:function(t){var r=e.MARGIN[t];if(r){e.template.$marginValue.textContent=r.name;var n=r.value;(n[0]!==e.option.margin[0]||n[1]!==e.option.margin[1])&&e.danmuku.config({margin:n})}}}),this.slider.fontSize=this.createSlider({min:1,max:25,steps:[],container:this.template.$fontSizeSlider,findIndex:function(){var t=e.art.template.$player.clientHeight;return Math.round(e.option.fontSize/t*100)},onChange:function(t){var r=e.template.$fontSizeValue,n=e.art.template.$player.clientHeight;r.textContent="".concat(t,"%"),t!==Math.round(e.option.fontSize/n*100)&&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})},onChange:function(t){var r=e.SPEED[t];if(r){e.template.$speedValue.textContent=r.name;var n=r.value;n!==e.option.speed&&e.danmuku.config({speed:n})}}})}},{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();if(!(er)){var n=(e-t)/(r-t);p.style.left="".concat(100*n,"%"),0===s.length&&(d.style.width=p.style.left),o(e)}}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:"onFullscreen",value:function(e){if(this.outside){var t=this.template,r=t.$danmuku,n=t.$controlsCenter,a=t.$mount;e?n.appendChild(r):a.appendChild(r)}}},{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),this.setData("danmukuTheme",this.option.theme);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.reset()}}],[{key:"icons",get:function(){return{$on:d.default,$off:h.default,$config:y.default,$style:v.default,$mode_0_off:b.default,$mode_0_on:k.default,$mode_1_off:j.default,$mode_1_on:S.default,$mode_2_off:D.default,$mode_2_on:F.default,$check_on:E.default,$check_off:z.default}}}]),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);r.artplayer-plugin-danmuku .apd-icon{fill:#333}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-emitter{background-color:#f1f2f3}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input{color:#000}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:rgba(0,0,0,.3)}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:rgba(0,0,0,.3)}[data-danmuku-visible=false] .apd-toggle-off{display:block}[data-danmuku-visible=false] .apd-toggle-on,[data-danmuku-visible=true] .apd-toggle-off{display:none}[data-danmuku-visible=true] .apd-toggle-on{display:block}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-on{display:none}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-off,[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-on{display:block}[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-off,[data-danmuku-sync-video=false] .apd-sync-video .apd-check-on{display:none}[data-danmuku-sync-video=false] .apd-sync-video .apd-check-off,[data-danmuku-sync-video=true] .apd-sync-video .apd-check-on{display:block}[data-danmuku-sync-video=true] .apd-sync-video .apd-check-off{display:none}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-off{display:block}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-on{display:none}[data-danmuku-mode0=false] .art-danmuku [data-mode="0"]{opacity:0!important}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-off{display:none}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-on{display:block}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"]{color:#00a1d6}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"] path{fill:#00a1d6}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-off{display:block}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-on{display:none}[data-danmuku-mode1=false] .art-danmuku [data-mode="1"]{opacity:0!important}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-off{display:none}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-on{display:block}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"]{color:#00a1d6}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"] path{fill:#00a1d6}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-off{display:block}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-on{display:none}[data-danmuku-mode2=false] .art-danmuku [data-mode="2"]{opacity:0!important}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-off{display:none}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-on{display:block}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"]{color:#00a1d6}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"] path{fill:#00a1d6}'},{}],"4mwSI":[function(e,t,r){t.exports=''},{}],"9bQDs":[function(e,t,r){t.exports=''},{}],cciuY:[function(e,t,r){t.exports=''},{}],e5G6o:[function(e,t,r){t.exports=''},{}],fC4yA:[function(e,t,r){t.exports=''},{}],fUkVg:[function(e,t,r){t.exports=''},{}],isoJm:[function(e,t,r){t.exports=''},{}],"20nBM":[function(e,t,r){t.exports=''},{}],"6x9CL":[function(e,t,r){t.exports=''},{}],"7GKdL":[function(e,t,r){t.exports=''},{}],"9SCIh":[function(e,t,r){t.exports=''},{}],"6KRxn":[function(e,t,r){t.exports=''},{}],dXFn2:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return s});var a=e("@swc/helpers/_/_to_consumable_array"),o={map:function(e,t,r,n,a){return(e-t)*(a-n)/(r-t)+n}},i=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return{length:Math.sqrt(Math.pow(r,2)+Math.pow(n,2)),angle:Math.atan2(n,r)}};function s(e,t,r){var n=e.constructor.utils.query;e.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted:function(s){var l=null,u=null;function c(){var c,p,d=arguments.length>0&&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 O=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=O(r[t-1],r[t-2],e),a=O(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"); \ No newline at end of file +!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 O(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 z(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 A(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:S,__asyncDelegator:O,__asyncValues:D,__makeTemplateObject:M,__importStar:P,__importDefault:E,__classPrivateFieldGet:T,__classPrivateFieldSet:z,__classPrivateFieldIn:A,__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(S.default,'\n
顶部
\n
\n
\n ').concat(D.default).concat(F.default,'\n
底部
\n
\n
\n
\n
\n
\n ').concat(E.default).concat(z.default,'\n 防止弹幕重叠\n
\n
\n ').concat(E.default).concat(z.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(S.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)},onChange:function(t){e.template.$opacityValue.textContent="".concat(t,"%");var r=t/100;r!==e.option.opacity&&e.danmuku.config({opacity:r})}}),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]})},onChange:function(t){var r=e.MARGIN[t];if(r){e.template.$marginValue.textContent=r.name;var n=r.value;(n[0]!==e.option.margin[0]||n[1]!==e.option.margin[1])&&e.danmuku.config({margin:n})}}}),this.slider.fontSize=this.createSlider({min:1,max:25,steps:[],container:this.template.$fontSizeSlider,findIndex:function(){var t=e.art.template.$player.clientHeight;return Math.round(e.option.fontSize/t*100)},onChange:function(t){var r=e.template.$fontSizeValue,n=e.art.template.$player.clientHeight;r.textContent="".concat(t,"%"),t!==Math.round(e.option.fontSize/n*100)&&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})},onChange:function(t){var r=e.SPEED[t];if(r){e.template.$speedValue.textContent=r.name;var n=r.value;n!==e.option.speed&&e.danmuku.config({speed:n})}}})}},{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();if(!(er)){var n=(e-t)/(r-t);p.style.left="".concat(100*n,"%"),0===s.length&&(d.style.width=p.style.left),o(e)}}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:"onFullscreen",value:function(e){if(this.outside){var t=this.template,r=t.$danmuku,n=t.$controlsCenter,a=t.$mount;e?n.appendChild(r):a.appendChild(r)}}},{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),this.setData("danmukuTheme",this.option.theme);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.reset()}}],[{key:"icons",get:function(){return{$on:d.default,$off:h.default,$config:y.default,$style:v.default,$mode_0_off:b.default,$mode_0_on:k.default,$mode_1_off:j.default,$mode_1_on:S.default,$mode_2_off:D.default,$mode_2_on:F.default,$check_on:E.default,$check_off:z.default}}}]),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);r.artplayer-plugin-danmuku .apd-icon{fill:#333}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-emitter{background-color:#f1f2f3}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input{color:#000}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:rgba(0,0,0,.3)}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:rgba(0,0,0,.3)}[data-danmuku-visible=false] .apd-toggle-off{display:block}[data-danmuku-visible=false] .apd-toggle-on,[data-danmuku-visible=true] .apd-toggle-off{display:none}[data-danmuku-visible=true] .apd-toggle-on{display:block}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-on{display:none}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-off,[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-on{display:block}[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-off,[data-danmuku-sync-video=false] .apd-sync-video .apd-check-on{display:none}[data-danmuku-sync-video=false] .apd-sync-video .apd-check-off,[data-danmuku-sync-video=true] .apd-sync-video .apd-check-on{display:block}[data-danmuku-sync-video=true] .apd-sync-video .apd-check-off{display:none}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-off{display:block}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-on{display:none}[data-danmuku-mode0=false] .art-danmuku [data-mode="0"]{opacity:0!important}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-off{display:none}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-on{display:block}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"]{color:#00a1d6}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"] path{fill:#00a1d6}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-off{display:block}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-on{display:none}[data-danmuku-mode1=false] .art-danmuku [data-mode="1"]{opacity:0!important}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-off{display:none}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-on{display:block}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"]{color:#00a1d6}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"] path{fill:#00a1d6}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-off{display:block}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-on{display:none}[data-danmuku-mode2=false] .art-danmuku [data-mode="2"]{opacity:0!important}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-off{display:none}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-on{display:block}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"]{color:#00a1d6}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"] path{fill:#00a1d6}'},{}],"4mwSI":[function(e,t,r){t.exports=''},{}],"9bQDs":[function(e,t,r){t.exports=''},{}],cciuY:[function(e,t,r){t.exports=''},{}],e5G6o:[function(e,t,r){t.exports=''},{}],fC4yA:[function(e,t,r){t.exports=''},{}],fUkVg:[function(e,t,r){t.exports=''},{}],isoJm:[function(e,t,r){t.exports=''},{}],"20nBM":[function(e,t,r){t.exports=''},{}],"6x9CL":[function(e,t,r){t.exports=''},{}],"7GKdL":[function(e,t,r){t.exports=''},{}],"9SCIh":[function(e,t,r){t.exports=''},{}],"6KRxn":[function(e,t,r){t.exports=''},{}],dXFn2:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return s});var a=e("@swc/helpers/_/_to_consumable_array"),o={map:function(e,t,r,n,a){return(e-t)*(a-n)/(r-t)+n}},i=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return{length:Math.sqrt(Math.pow(r,2)+Math.pow(n,2)),angle:Math.atan2(n,r)}};function s(e,t,r){var n=e.constructor.utils.query;e.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted:function(s){var l=null,u=null;function c(){var c,p,d=arguments.length>0&&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 O=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=O(r[t-1],r[t-2],e),a=O(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"); \ No newline at end of file diff --git a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js index f5e069f49..847c08dcf 100644 --- a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js +++ b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js @@ -4,4 +4,19 @@ * (c) 2017-2024 Harvey Zack * Released under the MIT License. */ -!function(e,t,i,a,n){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof o[a]&&o[a],l=s.cache||{},r="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,i){if(!l[t]){if(!e[t]){var n="function"==typeof o[a]&&o[a];if(!i&&n)return n(t,!0);if(s)return s(t,!0);if(r&&"string"==typeof t)return r(t);var p=Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}h.resolve=function(i){var a=e[t][1][i];return null!=a?a:i},h.cache={};var u=l[t]=new d.Module(t);e[t][0].call(u.exports,h,u,u.exports,this)}return l[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=s,d.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(d,"root",{get:function(){return o[a]}}),o[a]=d;for(var p=0;pp);var n=e("./danmuku"),o=a.interopDefault(n),s=e("./setting"),l=a.interopDefault(s),r=e("./heatmap"),d=a.interopDefault(r);function p(e){return t=>{let i=new o.default(t,e),a=new l.default(t,i);return i.option.heatmap&&(0,d.default)(t,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}p.icons=l.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=p)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i);var n=e("./bilibili"),o=e("bundle-text:./worker"),s=a.interopDefault(o);class l{constructor(e,t){let{constructor:i,template:a}=e;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(t),this.worker=new Worker(URL.createObjectURL(new Blob([s.default]))),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("destroy",this.destroy),e.on("resize",this.reset),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,maxLength:200,lockTime:5,theme:"dark"}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement",heatmap:"object|boolean",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",maxLength:"number",lockTime:"number",theme:"string"}}static get cssText(){return` user-select:none;position:absolute;white-space:pre;pointer-events:none;perspective:500px;display:inline-block;will-change:transform;font-weight:normal;line-height:1.125;visibility:hidden;font-family:SimHei,"Microsoft JhengHei",Arial,Helvetica,sans-serif;text-shadow:rgb(0,0,0) 1px 0px 1px,rgb(0,0,0) 0px 1px 1px,rgb(0,0,0) 0px -1px 1px,rgb(0,0,0) -1px 0px 1px;`}get isRotate(){return this.art.plugins?.autoOrientation?.state}get marginTop(){let{clamp:e}=this.utils,t=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof t?e(t,0,i):"string"==typeof t&&t.endsWith("%")?e(i*(parseFloat(t)/100),0,i):l.option.margin[0]}get marginBottom(){let{clamp:e}=this.utils,t=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof t?e(t,0,i):"string"==typeof t&&t.endsWith("%")?e(i*(parseFloat(t)/100),0,i):l.option.margin[1]}async load(){let{errorHandle:e}=this.utils;try{"function"==typeof this.option.danmuku?this.danmus=await this.option.danmuku():"function"==typeof this.option.danmuku.then?this.danmus=await this.option.danmuku:"string"==typeof this.option.danmuku?this.danmus=await (0,n.bilibiliDanmuParseFromUrl)(this.option.danmuku):this.danmus=this.option.danmuku,e(Array.isArray(this.danmus),"Danmuku need return an array as result"),this.queue=[],this.$danmuku.innerText="",this.danmus.forEach(e=>this.emit(e)),this.art.emit("artplayerPluginDanmuku:loaded",this.queue)}catch(e){throw this.art.emit("artplayerPluginDanmuku:error",e),e}return this}emit(e){let{clamp:t}=this.utils;return this.validator(e,{text:"string",mode:"?number",color:"?string",time:"?number",border:"?boolean",style:"?object",escape:"?boolean"}),e.text.trim()&&(e.time?e.time=t(e.time,0,1/0):e.time=this.art.currentTime+.5,void 0===e.mode&&(e.mode=this.option.mode),void 0===e.style&&(e.style={}),void 0===e.escape&&(e.escape=!0),void 0===e.color&&(e.color=this.option.color),[0,1,2].includes(e.mode)&&this.option.filter(e)&&this.queue.push({...e,$state:"wait",$ref:null,$restTime:0,$lastStartTime:0})),this}config(e){let{clamp:t}=this.utils,{$controlsCenter:i}=this.art.template;if(this.option=Object.assign({},l.option,this.option,e),this.validator(this.option,l.scheme),this.option.mode=t(this.option.mode,0,2),this.option.speed=t(this.option.speed,1,10),this.option.opacity=t(this.option.opacity,0,1),this.option.lockTime=t(this.option.lockTime,1,60),this.option.maxLength=t(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,e.fontSize){let e=this.getFontSize(this.option.fontSize);e!==this.option.fontSize&&(this.option.fontSize=e,this.reset())}return this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option),this}getLeft(e){let t=e.getBoundingClientRect();return this.isRotate?t.top:t.left}getRef(){let e=this.$refs.pop()||document.createElement("div");return e.style.cssText=l.cssText,e.dataset.mode="",e}getFontSize(e){let{clamp:t}=this.utils,{clientHeight:i}=this.$player;return"number"==typeof e?t(e,12,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),12,i):l.option.fontSize}postMessage(e={}){return new Promise(t=>{e.id=Date.now(),this.worker.postMessage(e),this.worker.onmessage=i=>{let{data:a}=i;a.id===e.id&&t(a)}})}filter(e,t){return this.queue.filter(t=>t.$state===e).map(t)}getReady(){let{currentTime:e}=this.art;return this.queue.filter(t=>"ready"===t.$state||"wait"===t.$state&&e+.1>=t.time&&t.time>=e-.1)}getEmits(){let e=[],{clientWidth:t}=this.$player,i=this.getLeft(this.$player);return this.filter("emit",a=>{let n=a.$ref.offsetTop,o=this.getLeft(a.$ref)-i,s=a.$ref.clientHeight,l=a.$ref.clientWidth,r=o+l,d=r/a.$restTime,p={};p.top=n,p.left=o,p.height=s,p.width=l,p.right=t-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,e.push(p)}),e}makeWait(e){e.$state="wait",e.$ref&&(e.$ref.style.cssText=l.cssText,this.$refs.push(e.$ref),e.$ref=null)}update(){let{setStyles:e}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",e=>{let t=(Date.now()-e.$lastStartTime)/1e3;e.$restTime-=t,e.$lastStartTime=Date.now(),e.$restTime<=0&&this.makeWait(e)});let t=this.getReady();for(let i=0;i{if(t.$state="emit",t.$lastStartTime=Date.now(),0===t.mode){let i=e+t.$ref.clientWidth;t.$ref.style.transform=`translateX(${-i}px)`,t.$ref.style.transition=`transform ${t.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:e}=this.$player;return this.filter("emit",t=>{if(t.$state="stop",0===t.mode){let i=e-(this.getLeft(t.$ref)-this.getLeft(this.$player));t.$ref.style.transform=`translateX(${-i}px)`,t.$ref.style.transition="transform 0s linear 0s"}}),this}stop(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.timer),this.art.emit("artplayerPluginDanmuku:stop"),this}start(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}reset(){return this.queue.forEach(e=>this.makeWait(e)),this}show(){return this.isHide=!1,this.start(),this.$danmuku.style.display="",this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.stop(),this.queue.forEach(e=>this.makeWait(e)),this.$danmuku.style.display="none",this.art.emit("artplayerPluginDanmuku:hide"),this}destroy(){this.stop(),this.worker.terminate(),this.art.off("video:play",this.start),this.art.off("video:playing",this.start),this.art.off("video:pause",this.stop),this.art.off("video:waiting",this.stop),this.art.off("resize",this.reset),this.art.off("destroy",this.destroy),this.art.emit("artplayerPluginDanmuku:destroy")}}i.default=l},{"./bilibili":"f83sx","bundle-text:./worker":"lfIAi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],f83sx:[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");function n(e){switch(e){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function o(e){return"string"!=typeof e?[]:Array.from(e.matchAll(/(?.+?)<\/d>/gs)).map(e=>{let t=e.groups.p.split(",");return t.length>=8?{text:e.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(t[0]),mode:n(Number(t[1])),fontSize:Number(t[2]),color:`#${Number(t[3]).toString(16)}`,timestamp:Number(t[4]),pool:Number(t[5]),userID:t[6],rowID:Number(t[7])}:null}).filter(Boolean)}async function s(e){let t=await fetch(e);return o(await t.text())}a.defineInteropFlag(i),a.export(i,"getMode",()=>n),a.export(i,"bilibiliDanmuParseFromXml",()=>o),a.export(i,"bilibiliDanmuParseFromUrl",()=>s)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,i){i.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},i.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.exportAll=function(e,t){return Object.keys(e).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})}),t},i.export=function(e,t,i){Object.defineProperty(e,t,{enumerable:!0,get:i})}},{}],lfIAi:[function(e,t,i){t.exports='!function(e,t,n,o,i){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof r[o]&&r[o],l=f.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!l[t]){if(!e[t]){var i="function"==typeof r[o]&&r[o];if(!n&&i)return i(t,!0);if(f)return f(t,!0);if(d&&"string"==typeof t)return d(t);var h=Error("Cannot find module \'"+t+"\'");throw h.code="MODULE_NOT_FOUND",h}p.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},p.cache={};var s=l[t]=new u.Module(t);e[t][0].call(s.exports,p,s,s.exports,this)}return l[t].exports;function p(e){var t=p.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=l,u.parent=f,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return r[o]}}),r[o]=u;for(var h=0;h{let{data:t}=e;if(!t.id)return;let n=function({target:e,emits:t,clientWidth:n,clientHeight:o,marginBottom:i,marginTop:r,antiOverlap:f}){let l=o-i,d=t.filter(t=>t.mode===e.mode&&t.top<=l).sort((e,t)=>e.top-t.top);if(0===d.length)return 2===e.mode?l-e.height:r;if(d.unshift({type:"top",top:0,left:0,right:0,height:r,width:n,speed:0,distance:n}),d.push({type:"bottom",top:l,left:0,right:0,height:i,width:n,speed:0,distance:n}),2===e.mode)for(let t=d.length-2;t>=0;t-=1){let n=d[t],o=d[t+1],i=n.top+n.height;if(o.top-i>=e.height)return o.top-e.height}else for(let t=1;t=e.height)return i}let u=[];for(let e=1;et.every(t=>!(nt.time)));return t&&t[0]?t[0].top:void 0}case 1:case 2:return}else{switch(e.mode){case 0:u.sort((e,t)=>{let n=Math.min(...t.map(e=>e.right)),o=Math.min(...e.map(e=>e.right));return n*t.length-o*e.length});break;case 1:case 2:u.sort((e,t)=>{let n=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-n*t.length})}return u[0][0].top}}(t);self.postMessage({top:n,id:t.id})}},{}]},["59OZS"],"59OZS","parcelRequire4dc0");'},{}],lO8OT:[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i);var n=e("bundle-text:./style.less"),o=a.interopDefault(n),s=e("bundle-text:./img/on.svg"),l=a.interopDefault(s),r=e("bundle-text:./img/off.svg"),d=a.interopDefault(r),p=e("bundle-text:./img/config.svg"),u=a.interopDefault(p),h=e("bundle-text:./img/style.svg"),m=a.interopDefault(h),c=e("bundle-text:./img/mode_0_off.svg"),f=a.interopDefault(c),g=e("bundle-text:./img/mode_0_on.svg"),v=a.interopDefault(g),y=e("bundle-text:./img/mode_1_off.svg"),x=a.interopDefault(y),k=e("bundle-text:./img/mode_1_on.svg"),b=a.interopDefault(k),$=e("bundle-text:./img/mode_2_off.svg"),w=a.interopDefault($),M=e("bundle-text:./img/mode_2_on.svg"),E=a.interopDefault(M),z=e("bundle-text:./img/check_on.svg"),D=a.interopDefault(z),F=e("bundle-text:./img/check_off.svg"),S=a.interopDefault(F);if(i.default=class{constructor(e,t){this.art=e,this.danmuku=t,this.utils=e.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=e.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$configModes:null,$styleModes:null,$colors:null,$opacitySlider:null,$opacityValue:null,$marginSlider:null,$marginValue:null,$fontSizeSlider:null,$fontSizeValue:null,$speedSlider:null,$speedValue:null,$input:null,$send:null},this.slider={opacity:null,margin:null,fontSize:null,speed:null},this.emitting=!1,this.isLock=!1,this.timer=null,this.createTemplate(),this.createSliders(),this.createEvents(),this.mount(this.option.mount),e.on("fullscreen",e=>this.onFullscreen(e)),e.on("fullscreenWeb",e=>this.onFullscreen(e))}static get icons(){return{$on:l.default,$off:d.default,$config:u.default,$style:m.default,$mode_0_off:f.default,$mode_0_on:v.default,$mode_1_off:x.default,$mode_1_on:b.default,$mode_2_off:w.default,$mode_2_on:E.default,$check_on:D.default,$check_off:S.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:e}=this;return`
${l.default}${d.default}
${u.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${f.default}${v.default}
\u{6EDA}\u{52A8}
${x.default}${b.default}
\u{9876}\u{90E8}
${w.default}${E.default}
\u{5E95}\u{90E8}
${D.default}${S.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${D.default}${S.default} \u{540C}\u{6B65}\u{89C6}\u{9891}\u{901F}\u{5EA6}
\u{4E0D}\u{900F}\u{660E}\u{5EA6}
\u{672A}\u{77E5}
\u{663E}\u{793A}\u{533A}\u{57DF}
\u{672A}\u{77E5}
\u{5F39}\u{5E55}\u{5B57}\u{53F7}
\u{672A}\u{77E5}
\u{5F39}\u{5E55}\u{901F}\u{5EA6}
\u{672A}\u{77E5}
${m.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${b.default}
\u{9876}\u{90E8}
${E.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(e=>`
`).join("")}
\u{53D1}\u{9001}
`}get MARGIN(){return this.option.MARGIN||[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}]}get SPEED(){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}]}get COLOR(){return this.option.COLOR||["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(e){let{query:t}=this.utils,{$danmuku:i}=this.template;return t(e,i)}setData(e,t){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[e]=t,this.outside&&(a.dataset[e]=t)}createTemplate(){let{createElement:e,tooltip:t}=this.utils,i=e("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),t(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")}createEvents(){let{$toggle:e,$configModes:t,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(e,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(t,"click",e=>{let t=e.target.closest(".apd-mode");if(!t)return;let i=Number(t.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(e=>e!==i)}):this.danmuku.config({modes:[...this.option.modes,i]}),this.reset()}),this.art.proxy(n,"click",()=>{this.danmuku.config({antiOverlap:!this.option.antiOverlap}),this.reset()}),this.art.proxy(o,"click",()=>{this.danmuku.config({synchronousPlayback:!this.option.synchronousPlayback}),this.reset()}),this.art.proxy(i,"click",e=>{let t=e.target.closest(".apd-mode");if(!t)return;let i=Number(t.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",e=>{let t=e.target.closest(".apd-color");t&&(this.danmuku.config({color:t.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",e=>{"Enter"===e.key&&(e.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({min:0,max:100,steps:[],container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:e=>{let{$opacityValue:t}=this.template;t.textContent=`${e}%`;let i=e/100;i!==this.option.opacity&&this.danmuku.config({opacity:i})}}),this.slider.margin=this.createSlider({min:0,max:3,steps:this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.findIndex(e=>e.value[0]===this.option.margin[0]&&e.value[1]===this.option.margin[1]),onChange:e=>{let t=this.MARGIN[e];if(!t)return;let{$marginValue:i}=this.template;i.textContent=t.name;let a=t.value;(a[0]!==this.option.margin[0]||a[1]!==this.option.margin[1])&&this.danmuku.config({margin:a})}}),this.slider.fontSize=this.createSlider({min:1,max:25,steps:[],container:this.template.$fontSizeSlider,findIndex:()=>{let{clientHeight:e}=this.art.template.$player;return Math.round(this.option.fontSize/e*100)},onChange:e=>{let{$fontSizeValue:t}=this.template,{clientHeight:i}=this.art.template.$player;t.textContent=`${e}%`,e!==Math.round(this.option.fontSize/i*100)&&this.danmuku.config({fontSize:`${e}%`})}}),this.slider.speed=this.createSlider({min:0,max:4,steps:this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.findIndex(e=>e.value===this.option.speed),onChange:e=>{let t=this.SPEED[e];if(!t)return;let{$speedValue:i}=this.template;i.textContent=t.name;let a=t.value;a!==this.option.speed&&this.danmuku.config({speed:a})}})}createSlider({min:e,max:t,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l}=this.utils;i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(e=>e.hide?"":`
${e.name}
`).join("")}
`;let r=s(".apd-slider-dot",i),d=s(".apd-slider-progress",i),p=!1;function u(i=a()){if(it)return;let s=(i-e)/(t-e);r.style.left=`${100*s}%`,0===o.length&&(d.style.width=r.style.left),n(i)}function h(a){let{left:n,width:o}=i.getBoundingClientRect();u(Math.round(l(a.clientX-n,0,o)/o*(t-e)+e))}return this.art.proxy(i,"click",e=>{h(e)}),this.art.proxy(i,"mousedown",e=>{p=0===e.button}),this.art.on("document:mousemove",e=>{p&&h(e)}),this.art.on("document:mouseup",e=>{p&&(p=!1,h(e))}),{reset:u}}onFullscreen(e){if(this.outside){let{$danmuku:t,$controlsCenter:i,$mount:a}=this.template;e?i.appendChild(t):a.appendChild(t)}}async emit(){let{$input:e}=this.template,t=e.value.trim();if(!t.length||this.isLock||this.emitting)return;let i={text:t,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let t=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==t)return;i.border=!0,delete i.time,this.danmuku.emit(i),e.value="",this.lock()}catch(e){this.emitting=!1}}lock(){let{addClass:e}=this.utils,{$send:t}=this.template;this.isLock=!0;let i=this.option.lockTime;t.innerText=i,e(t,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(i-=1,t.innerText=i,a())},1e3)};a()}unlock(){let{removeClass:e}=this.utils,{$send:t}=this.template;clearTimeout(this.timer),this.isLock=!1,t.innerText="发送",e(t,"apd-lock")}reset(){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),this.setData("danmukuTheme",this.option.theme);let{inverseClass:e}=this.utils,t=Array.from(this.template.$colors.children).find(e=>e.dataset.color===this.option.color.toUpperCase());t&&e(t,"apd-active")}mount(e=this.template.$controlsCenter){e.appendChild(this.template.$danmuku),this.template.$mount=e,this.reset()}},"undefined"!=typeof document){let e="artplayer-plugin-danmuku",t=document.getElementById(e);if(t)t.textContent=o.default;else{let t=document.createElement("style");t.id=e,t.textContent=o.default,document.head.appendChild(t)}}},{"bundle-text:./style.less":"hViDo","bundle-text:./img/on.svg":"9pjcf","bundle-text:./img/off.svg":"b2dkP","bundle-text:./img/config.svg":"l8tyy","bundle-text:./img/style.svg":"5iZC3","bundle-text:./img/mode_0_off.svg":"i0Vut","bundle-text:./img/mode_0_on.svg":"hOSvZ","bundle-text:./img/mode_1_off.svg":"bOXC3","bundle-text:./img/mode_1_on.svg":"lKuh0","bundle-text:./img/mode_2_off.svg":"eB8W6","bundle-text:./img/mode_2_on.svg":"bpe2E","bundle-text:./img/check_on.svg":"kL9zy","bundle-text:./img/check_off.svg":"22xpM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],hViDo:[function(e,t,i){t.exports='.artplayer-plugin-danmuku{z-index:99;color:#fff;flex-shrink:0;justify-content:center;align-items:center;gap:10px;width:100%;height:32px;font-size:12px;font-weight:300;display:flex;position:relative}.artplayer-plugin-danmuku .apd-icon{cursor:pointer;opacity:.75;fill:#fff;transition:all .2s}.artplayer-plugin-danmuku .apd-icon:hover{opacity:1}.artplayer-plugin-danmuku .apd-config{display:flex;position:relative}.artplayer-plugin-danmuku .apd-config .apd-config-panel{width:320px;padding:10px;display:none;position:absolute;bottom:24px;left:-148px}.artplayer-plugin-danmuku .apd-config .apd-config-panel .apd-config-panel-inner{background-color:#000000d9;border-radius:3px;width:100%;padding:10px}.artplayer-plugin-danmuku .apd-config:hover .apd-config-panel{display:flex}.artplayer-plugin-danmuku .apd-config-mode,.artplayer-plugin-danmuku .apd-config-slider,.artplayer-plugin-danmuku .apd-config-other,.artplayer-plugin-danmuku .apd-style-mode{margin-bottom:15px}.artplayer-plugin-danmuku .apd-modes{align-items:center;gap:20px;margin-top:5px;display:flex}.artplayer-plugin-danmuku .apd-modes .apd-mode{cursor:pointer;text-align:center}.artplayer-plugin-danmuku .apd-modes .apd-mode:hover{color:#00a1d6}.artplayer-plugin-danmuku .apd-config-slider{align-items:center;gap:12px;display:flex}.artplayer-plugin-danmuku .apd-config-slider .apd-value{text-align:right;width:32px}.artplayer-plugin-danmuku .apd-slider{cursor:pointer;flex:1;justify-content:center;align-items:center;height:20px;display:flex;position:relative}.artplayer-plugin-danmuku .apd-slider .apd-slider-line{background-color:#ffffff40;border-radius:3px;width:100%;height:2px;position:relative;overflow:hidden}.artplayer-plugin-danmuku .apd-slider .apd-slider-points{justify-content:space-between;align-items:center;display:flex;position:absolute;inset:0}.artplayer-plugin-danmuku .apd-slider .apd-slider-points .apd-slider-point{background-color:#ffffff80;border-radius:50%;width:2px;height:2px}.artplayer-plugin-danmuku .apd-slider .apd-slider-progress{background-color:#00a1d6;width:0%;height:100%}.artplayer-plugin-danmuku .apd-slider .apd-slider-dot{background-color:#00a1d6;border-radius:50%;width:12px;height:12px;position:absolute;left:0%;transform:translate(-6px)}.artplayer-plugin-danmuku .apd-slider .apd-slider-steps{color:#777;justify-content:space-between;align-items:center;width:calc(100% + 32px);display:flex;position:absolute;bottom:-12px}.artplayer-plugin-danmuku .apd-slider .apd-slider-steps .apd-slider-step{text-align:center;flex-shrink:0;width:36px;scale:.95}.artplayer-plugin-danmuku .apd-config-other{align-items:center;gap:20px;display:flex}.artplayer-plugin-danmuku .apd-config-other .apd-check-off,.artplayer-plugin-danmuku .apd-config-other .apd-check-on{width:16px;height:16px}.artplayer-plugin-danmuku .apd-config-other .apd-other{cursor:pointer;align-items:center;gap:2px;display:flex}.artplayer-plugin-danmuku .apd-config-other .apd-other:hover{color:#00a1d6}.artplayer-plugin-danmuku .apd-emitter{background-color:#ffffff40;border-radius:5px;flex:1;align-items:center;height:100%;display:flex}.artplayer-plugin-danmuku .apd-style{justify-content:center;align-items:center;display:flex;position:relative}.artplayer-plugin-danmuku .apd-style .apd-style-panel{width:200px;padding:10px;display:none;position:absolute;bottom:24px;left:-88px}.artplayer-plugin-danmuku .apd-style .apd-style-panel .apd-style-panel-inner{background-color:#000000d9;border-radius:3px;width:100%;padding:10px}.artplayer-plugin-danmuku .apd-style:hover .apd-style-panel{display:flex}.artplayer-plugin-danmuku .apd-colors{flex-wrap:wrap;gap:8px;margin-top:5px;display:flex}.artplayer-plugin-danmuku .apd-colors .apd-color{cursor:pointer;border-radius:2px;width:16px;height:16px}.artplayer-plugin-danmuku .apd-colors .apd-color.apd-active{border:1px solid #000;box-shadow:0 0 0 1px #fff}.artplayer-plugin-danmuku .apd-input{color:#fff;background-color:#0000;border:none;outline:none;flex:1;width:auto;min-width:0;height:100%;line-height:1}.artplayer-plugin-danmuku .apd-input::placeholder{color:#ffffff80}.artplayer-plugin-danmuku .apd-send{cursor:pointer;text-shadow:none;background-color:#00a1d6;border-top-right-radius:5px;border-bottom-right-radius:5px;flex-shrink:0;justify-content:center;align-items:center;width:60px;height:100%;display:flex}.artplayer-plugin-danmuku .apd-send.apd-lock{cursor:not-allowed;color:#666;background-color:#e7e7e7}.art-fullscreen .artplayer-plugin-danmuku,.art-fullscreen-web .artplayer-plugin-danmuku{gap:16px;height:38px}.art-fullscreen .artplayer-plugin-danmuku .apd-config-icon,.art-fullscreen-web .artplayer-plugin-danmuku .apd-config-icon,.art-fullscreen .artplayer-plugin-danmuku .apd-toggle-off,.art-fullscreen-web .artplayer-plugin-danmuku .apd-toggle-off,.art-fullscreen .artplayer-plugin-danmuku .apd-toggle-on,.art-fullscreen-web .artplayer-plugin-danmuku .apd-toggle-on{width:28px;height:28px}.art-fullscreen .artplayer-plugin-danmuku .apd-emitter,.art-fullscreen-web .artplayer-plugin-danmuku .apd-emitter{flex:none;width:390px}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-icon{fill:#333}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-emitter{background-color:#f1f2f3}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input{color:#000}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:#0000004d}[data-danmuku-visible=false] .apd-toggle-off{display:block}[data-danmuku-visible=false] .apd-toggle-on,[data-danmuku-visible=true] .apd-toggle-off{display:none}[data-danmuku-visible=true] .apd-toggle-on{display:block}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-on{display:none}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-off,[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-on{display:block}[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-off,[data-danmuku-sync-video=false] .apd-sync-video .apd-check-on{display:none}[data-danmuku-sync-video=false] .apd-sync-video .apd-check-off,[data-danmuku-sync-video=true] .apd-sync-video .apd-check-on{display:block}[data-danmuku-sync-video=true] .apd-sync-video .apd-check-off{display:none}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-off{display:block}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-on{display:none}[data-danmuku-mode0=false] .art-danmuku [data-mode="0"]{opacity:0!important}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-off{display:none}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-on{display:block}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"]{color:#00a1d6}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"] path{fill:#00a1d6}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-off{display:block}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-on{display:none}[data-danmuku-mode1=false] .art-danmuku [data-mode="1"]{opacity:0!important}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-off{display:none}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-on{display:block}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"]{color:#00a1d6}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"] path{fill:#00a1d6}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-off{display:block}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-on{display:none}[data-danmuku-mode2=false] .art-danmuku [data-mode="2"]{opacity:0!important}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-off{display:none}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-on{display:block}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"]{color:#00a1d6}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"] path{fill:#00a1d6}'},{}],"9pjcf":[function(e,t,i){t.exports=''},{}],b2dkP:[function(e,t,i){t.exports=''},{}],l8tyy:[function(e,t,i){t.exports=''},{}],"5iZC3":[function(e,t,i){t.exports=''},{}],i0Vut:[function(e,t,i){t.exports=''},{}],hOSvZ:[function(e,t,i){t.exports=''},{}],bOXC3:[function(e,t,i){t.exports=''},{}],lKuh0:[function(e,t,i){t.exports=''},{}],eB8W6:[function(e,t,i){t.exports=''},{}],bpe2E:[function(e,t,i){t.exports=''},{}],kL9zy:[function(e,t,i){t.exports=''},{}],"22xpM":[function(e,t,i){t.exports=''},{}],"8AxLD":[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i),a.export(i,"default",()=>s);let n={map:(e,t,i,a,n)=>(e-t)*(n-a)/(i-t)+a,range(e,t,i){let a=Math.round(e/i)*i;return Array.from({length:Math.floor((t-e)/i)},(e,t)=>t*i+a)}},o=(e,t)=>{let i=t[0]-e[0],a=t[1]-e[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function s(e,t,i){let{query:a}=e.constructor.utils;e.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(s){let l=null,r=null;function d(d=[]){if(l=null,r=null,s.innerHTML="",!e.duration||e.option.isLive)return;let p={w:s.offsetWidth,h:s.offsetHeight},u={xMin:0,xMax:p.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*p.h),sampling:Math.floor(p.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(u,i);let h=[];if(Array.isArray(d)&&d.length)h=[...d];else{let i=e.duration/p.w;for(let e=0;e<=p.w;e+=u.sampling){let a=t.danmus.filter(({time:t})=>t>e*i&&t<=(e+u.sampling)*i).length;h.push([e,a])}}if(0===h.length)return;let m=h[h.length-1],c=m[0],f=m[1];c!==p.w&&h.push([p.w,f]);let g=h.map(e=>e[1]),v=(Math.min(...g)+Math.max(...g))/2;for(let e=0;ev?1+u.scale:1-u.scale)+u.minHeight}let y=(e,t,i,a)=>{let s=o(t||e,i||e),l=n.map(Math.cos(s.angle)*u.flattening,0,1,1,0),r=s.angle*l+(a?Math.PI:0),d=s.length*u.smoothing;return[e[0]+Math.cos(r)*d,e[1]+Math.sin(r)*d]},x=(e,t,i)=>{let a=y(i[t-1],i[t-2],e),n=y(e,i[t-1],i[t+1],!0),o=t===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${e[0]},${e[1]}${o}`},k=h.map(e=>[n.map(e[0],u.xMin,u.xMax,0,p.w),n.map(e[1],u.yMin,u.yMax,p.h,0)]).reduce((e,t,i,a)=>0===i?`M ${a[a.length-1][0]},${p.h} L ${t[0]},${p.h} L ${t[0]},${t[1]}`:`${e} ${x(t,i,a)}`,"");s.innerHTML=``,l=a("#heatmap-start",s),r=a("#heatmap-stop",s),l.setAttribute("offset",`${100*e.played}%`),r.setAttribute("offset",`${100*e.played}%`)}e.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*e.played}%`),r.setAttribute("offset",`${100*e.played}%`))}),e.on("setBar",(e,t)=>{l&&r&&"played"===e&&(l.setAttribute("offset",`${100*t}%`),r.setAttribute("offset",`${100*t}%`))}),e.on("ready",()=>d()),e.on("resize",()=>d()),e.on("artplayerPluginDanmuku:loaded",()=>d()),e.on("artplayerPluginDanmuku:points",e=>d(e))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["bgm6t"],"bgm6t","parcelRequire4dc0"); \ No newline at end of file +!function(e,t,i,a,n){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof o[a]&&o[a],l=s.cache||{},r="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,i){if(!l[t]){if(!e[t]){var n="function"==typeof o[a]&&o[a];if(!i&&n)return n(t,!0);if(s)return s(t,!0);if(r&&"string"==typeof t)return r(t);var p=Error("Cannot find module '"+t+"'");throw p.code="MODULE_NOT_FOUND",p}h.resolve=function(i){var a=e[t][1][i];return null!=a?a:i},h.cache={};var u=l[t]=new d.Module(t);e[t][0].call(u.exports,h,u,u.exports,this)}return l[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=s,d.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(d,"root",{get:function(){return o[a]}}),o[a]=d;for(var p=0;pp);var n=e("./danmuku"),o=a.interopDefault(n),s=e("./setting"),l=a.interopDefault(s),r=e("./heatmap"),d=a.interopDefault(r);function p(e){return t=>{let i=new o.default(t,e),a=new l.default(t,i);return i.option.heatmap&&(0,d.default)(t,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}p.icons=l.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=p)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i);var n=e("./bilibili"),o=e("bundle-text:./worker"),s=a.interopDefault(o);class l{constructor(e,t){let{constructor:i,template:a}=e;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(t),this.worker=new Worker(URL.createObjectURL(new Blob([s.default]))),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("destroy",this.destroy),e.on("resize",this.reset),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,maxLength:200,lockTime:5,theme:"dark"}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement",heatmap:"object|boolean",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",maxLength:"number",lockTime:"number",theme:"string"}}static get cssText(){return` + user-select: none; + position: absolute; + white-space: pre; + pointer-events: none; + perspective: 500px; + display: inline-block; + will-change: transform; + font-weight: normal; + line-height: 1.125; + visibility: hidden; + font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif; + text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px; + `}get isRotate(){return this.art.plugins?.autoOrientation?.state}get marginTop(){let{clamp:e}=this.utils,t=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof t?e(t,0,i):"string"==typeof t&&t.endsWith("%")?e(i*(parseFloat(t)/100),0,i):l.option.margin[0]}get marginBottom(){let{clamp:e}=this.utils,t=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof t?e(t,0,i):"string"==typeof t&&t.endsWith("%")?e(i*(parseFloat(t)/100),0,i):l.option.margin[1]}async load(){let{errorHandle:e}=this.utils;try{"function"==typeof this.option.danmuku?this.danmus=await this.option.danmuku():"function"==typeof this.option.danmuku.then?this.danmus=await this.option.danmuku:"string"==typeof this.option.danmuku?this.danmus=await (0,n.bilibiliDanmuParseFromUrl)(this.option.danmuku):this.danmus=this.option.danmuku,e(Array.isArray(this.danmus),"Danmuku need return an array as result"),this.queue=[],this.$danmuku.innerText="",this.danmus.forEach(e=>this.emit(e)),this.art.emit("artplayerPluginDanmuku:loaded",this.queue)}catch(e){throw this.art.emit("artplayerPluginDanmuku:error",e),e}return this}emit(e){let{clamp:t}=this.utils;return this.validator(e,{text:"string",mode:"?number",color:"?string",time:"?number",border:"?boolean",style:"?object",escape:"?boolean"}),e.text.trim()&&(e.time?e.time=t(e.time,0,1/0):e.time=this.art.currentTime+.5,void 0===e.mode&&(e.mode=this.option.mode),void 0===e.style&&(e.style={}),void 0===e.escape&&(e.escape=!0),void 0===e.color&&(e.color=this.option.color),[0,1,2].includes(e.mode)&&this.option.filter(e)&&this.queue.push({...e,$state:"wait",$ref:null,$restTime:0,$lastStartTime:0})),this}config(e){let{clamp:t}=this.utils,{$controlsCenter:i}=this.art.template;if(this.option=Object.assign({},l.option,this.option,e),this.validator(this.option,l.scheme),this.option.mode=t(this.option.mode,0,2),this.option.speed=t(this.option.speed,1,10),this.option.opacity=t(this.option.opacity,0,1),this.option.lockTime=t(this.option.lockTime,1,60),this.option.maxLength=t(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,e.fontSize){let e=this.getFontSize(this.option.fontSize);e!==this.option.fontSize&&(this.option.fontSize=e,this.reset())}return this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option),this}getLeft(e){let t=e.getBoundingClientRect();return this.isRotate?t.top:t.left}getRef(){let e=this.$refs.pop()||document.createElement("div");return e.style.cssText=l.cssText,e.dataset.mode="",e}getFontSize(e){let{clamp:t}=this.utils,{clientHeight:i}=this.$player;return"number"==typeof e?t(e,12,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),12,i):l.option.fontSize}postMessage(e={}){return new Promise(t=>{e.id=Date.now(),this.worker.postMessage(e),this.worker.onmessage=i=>{let{data:a}=i;a.id===e.id&&t(a)}})}filter(e,t){return this.queue.filter(t=>t.$state===e).map(t)}getReady(){let{currentTime:e}=this.art;return this.queue.filter(t=>"ready"===t.$state||"wait"===t.$state&&e+.1>=t.time&&t.time>=e-.1)}getEmits(){let e=[],{clientWidth:t}=this.$player,i=this.getLeft(this.$player);return this.filter("emit",a=>{let n=a.$ref.offsetTop,o=this.getLeft(a.$ref)-i,s=a.$ref.clientHeight,l=a.$ref.clientWidth,r=o+l,d=r/a.$restTime,p={};p.top=n,p.left=o,p.height=s,p.width=l,p.right=t-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,e.push(p)}),e}makeWait(e){e.$state="wait",e.$ref&&(e.$ref.style.cssText=l.cssText,this.$refs.push(e.$ref),e.$ref=null)}update(){let{setStyles:e}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",e=>{let t=(Date.now()-e.$lastStartTime)/1e3;e.$restTime-=t,e.$lastStartTime=Date.now(),e.$restTime<=0&&this.makeWait(e)});let t=this.getReady();for(let i=0;i{if(t.$state="emit",t.$lastStartTime=Date.now(),0===t.mode){let i=e+t.$ref.clientWidth;t.$ref.style.transform=`translateX(${-i}px)`,t.$ref.style.transition=`transform ${t.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:e}=this.$player;return this.filter("emit",t=>{if(t.$state="stop",0===t.mode){let i=e-(this.getLeft(t.$ref)-this.getLeft(this.$player));t.$ref.style.transform=`translateX(${-i}px)`,t.$ref.style.transition="transform 0s linear 0s"}}),this}stop(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.timer),this.art.emit("artplayerPluginDanmuku:stop"),this}start(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}reset(){return this.queue.forEach(e=>this.makeWait(e)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.start(),this.$danmuku.style.display="",this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.stop(),this.queue.forEach(e=>this.makeWait(e)),this.$danmuku.style.display="none",this.art.emit("artplayerPluginDanmuku:hide"),this}destroy(){this.stop(),this.worker.terminate(),this.art.off("video:play",this.start),this.art.off("video:playing",this.start),this.art.off("video:pause",this.stop),this.art.off("video:waiting",this.stop),this.art.off("resize",this.reset),this.art.off("destroy",this.destroy),this.art.emit("artplayerPluginDanmuku:destroy")}}i.default=l},{"./bilibili":"f83sx","bundle-text:./worker":"lfIAi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],f83sx:[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");function n(e){switch(e){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function o(e){return"string"!=typeof e?[]:Array.from(e.matchAll(/(?.+?)<\/d>/gs)).map(e=>{let t=e.groups.p.split(",");return t.length>=8?{text:e.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(t[0]),mode:n(Number(t[1])),fontSize:Number(t[2]),color:`#${Number(t[3]).toString(16)}`,timestamp:Number(t[4]),pool:Number(t[5]),userID:t[6],rowID:Number(t[7])}:null}).filter(Boolean)}async function s(e){let t=await fetch(e);return o(await t.text())}a.defineInteropFlag(i),a.export(i,"getMode",()=>n),a.export(i,"bilibiliDanmuParseFromXml",()=>o),a.export(i,"bilibiliDanmuParseFromUrl",()=>s)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,i){i.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},i.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.exportAll=function(e,t){return Object.keys(e).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[i]}})}),t},i.export=function(e,t,i){Object.defineProperty(e,t,{enumerable:!0,get:i})}},{}],lfIAi:[function(e,t,i){t.exports='!function(e,t,n,o,i){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof r[o]&&r[o],l=f.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!l[t]){if(!e[t]){var i="function"==typeof r[o]&&r[o];if(!n&&i)return i(t,!0);if(f)return f(t,!0);if(d&&"string"==typeof t)return d(t);var h=Error("Cannot find module \'"+t+"\'");throw h.code="MODULE_NOT_FOUND",h}p.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},p.cache={};var s=l[t]=new u.Module(t);e[t][0].call(s.exports,p,s,s.exports,this)}return l[t].exports;function p(e){var t=p.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=l,u.parent=f,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return r[o]}}),r[o]=u;for(var h=0;h{let{data:t}=e;if(!t.id)return;let n=function({target:e,emits:t,clientWidth:n,clientHeight:o,marginBottom:i,marginTop:r,antiOverlap:f}){let l=o-i,d=t.filter(t=>t.mode===e.mode&&t.top<=l).sort((e,t)=>e.top-t.top);if(0===d.length)return 2===e.mode?l-e.height:r;if(d.unshift({type:"top",top:0,left:0,right:0,height:r,width:n,speed:0,distance:n}),d.push({type:"bottom",top:l,left:0,right:0,height:i,width:n,speed:0,distance:n}),2===e.mode)for(let t=d.length-2;t>=0;t-=1){let n=d[t],o=d[t+1],i=n.top+n.height;if(o.top-i>=e.height)return o.top-e.height}else for(let t=1;t=e.height)return i}let u=[];for(let e=1;et.every(t=>!(nt.time)));return t&&t[0]?t[0].top:void 0}case 1:case 2:return}else{switch(e.mode){case 0:u.sort((e,t)=>{let n=Math.min(...t.map(e=>e.right)),o=Math.min(...e.map(e=>e.right));return n*t.length-o*e.length});break;case 1:case 2:u.sort((e,t)=>{let n=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-n*t.length})}return u[0][0].top}}(t);self.postMessage({top:n,id:t.id})}},{}]},["59OZS"],"59OZS","parcelRequire4dc0");'},{}],lO8OT:[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i);var n=e("bundle-text:./style.less"),o=a.interopDefault(n),s=e("bundle-text:./img/on.svg"),l=a.interopDefault(s),r=e("bundle-text:./img/off.svg"),d=a.interopDefault(r),p=e("bundle-text:./img/config.svg"),u=a.interopDefault(p),h=e("bundle-text:./img/style.svg"),m=a.interopDefault(h),c=e("bundle-text:./img/mode_0_off.svg"),f=a.interopDefault(c),g=e("bundle-text:./img/mode_0_on.svg"),v=a.interopDefault(g),y=e("bundle-text:./img/mode_1_off.svg"),x=a.interopDefault(y),k=e("bundle-text:./img/mode_1_on.svg"),b=a.interopDefault(k),$=e("bundle-text:./img/mode_2_off.svg"),w=a.interopDefault($),M=e("bundle-text:./img/mode_2_on.svg"),E=a.interopDefault(M),z=e("bundle-text:./img/check_on.svg"),D=a.interopDefault(z),F=e("bundle-text:./img/check_off.svg"),S=a.interopDefault(F);if(i.default=class{constructor(e,t){this.art=e,this.danmuku=t,this.utils=e.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=e.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$configModes:null,$styleModes:null,$colors:null,$opacitySlider:null,$opacityValue:null,$marginSlider:null,$marginValue:null,$fontSizeSlider:null,$fontSizeValue:null,$speedSlider:null,$speedValue:null,$input:null,$send:null},this.slider={opacity:null,margin:null,fontSize:null,speed:null},this.emitting=!1,this.isLock=!1,this.timer=null,this.createTemplate(),this.createSliders(),this.createEvents(),this.mount(this.option.mount),e.on("fullscreen",e=>this.onFullscreen(e)),e.on("fullscreenWeb",e=>this.onFullscreen(e))}static get icons(){return{$on:l.default,$off:d.default,$config:u.default,$style:m.default,$mode_0_off:f.default,$mode_0_on:v.default,$mode_1_off:x.default,$mode_1_on:b.default,$mode_2_off:w.default,$mode_2_on:E.default,$check_on:D.default,$check_off:S.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:e}=this;return`
${l.default}${d.default}
${u.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${f.default}${v.default}
\u{6EDA}\u{52A8}
${x.default}${b.default}
\u{9876}\u{90E8}
${w.default}${E.default}
\u{5E95}\u{90E8}
${D.default}${S.default} + \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${D.default}${S.default} + \u{540C}\u{6B65}\u{89C6}\u{9891}\u{901F}\u{5EA6}
\u{4E0D}\u{900F}\u{660E}\u{5EA6}
\u{672A}\u{77E5}
\u{663E}\u{793A}\u{533A}\u{57DF}
\u{672A}\u{77E5}
\u{5F39}\u{5E55}\u{5B57}\u{53F7}
\u{672A}\u{77E5}
\u{5F39}\u{5E55}\u{901F}\u{5EA6}
\u{672A}\u{77E5}
${m.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${b.default}
\u{9876}\u{90E8}
${E.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(e=>`
`).join("")}
\u{53D1}\u{9001}
`}get MARGIN(){return this.option.MARGIN||[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}]}get SPEED(){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}]}get COLOR(){return this.option.COLOR||["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(e){let{query:t}=this.utils,{$danmuku:i}=this.template;return t(e,i)}setData(e,t){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[e]=t,this.outside&&(a.dataset[e]=t)}createTemplate(){let{createElement:e,tooltip:t}=this.utils,i=e("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),t(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")}createEvents(){let{$toggle:e,$configModes:t,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(e,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(t,"click",e=>{let t=e.target.closest(".apd-mode");if(!t)return;let i=Number(t.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(e=>e!==i)}):this.danmuku.config({modes:[...this.option.modes,i]}),this.reset()}),this.art.proxy(n,"click",()=>{this.danmuku.config({antiOverlap:!this.option.antiOverlap}),this.reset()}),this.art.proxy(o,"click",()=>{this.danmuku.config({synchronousPlayback:!this.option.synchronousPlayback}),this.reset()}),this.art.proxy(i,"click",e=>{let t=e.target.closest(".apd-mode");if(!t)return;let i=Number(t.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",e=>{let t=e.target.closest(".apd-color");t&&(this.danmuku.config({color:t.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",e=>{"Enter"===e.key&&(e.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({min:0,max:100,steps:[],container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:e=>{let{$opacityValue:t}=this.template;t.textContent=`${e}%`;let i=e/100;i!==this.option.opacity&&this.danmuku.config({opacity:i})}}),this.slider.margin=this.createSlider({min:0,max:3,steps:this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.findIndex(e=>e.value[0]===this.option.margin[0]&&e.value[1]===this.option.margin[1]),onChange:e=>{let t=this.MARGIN[e];if(!t)return;let{$marginValue:i}=this.template;i.textContent=t.name;let a=t.value;(a[0]!==this.option.margin[0]||a[1]!==this.option.margin[1])&&this.danmuku.config({margin:a})}}),this.slider.fontSize=this.createSlider({min:1,max:25,steps:[],container:this.template.$fontSizeSlider,findIndex:()=>{let{clientHeight:e}=this.art.template.$player;return Math.round(this.option.fontSize/e*100)},onChange:e=>{let{$fontSizeValue:t}=this.template,{clientHeight:i}=this.art.template.$player;t.textContent=`${e}%`,e!==Math.round(this.option.fontSize/i*100)&&this.danmuku.config({fontSize:`${e}%`})}}),this.slider.speed=this.createSlider({min:0,max:4,steps:this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.findIndex(e=>e.value===this.option.speed),onChange:e=>{let t=this.SPEED[e];if(!t)return;let{$speedValue:i}=this.template;i.textContent=t.name;let a=t.value;a!==this.option.speed&&this.danmuku.config({speed:a})}})}createSlider({min:e,max:t,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l}=this.utils;i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(e=>e.hide?"":`
${e.name}
`).join("")}
`;let r=s(".apd-slider-dot",i),d=s(".apd-slider-progress",i),p=!1;function u(i=a()){if(it)return;let s=(i-e)/(t-e);r.style.left=`${100*s}%`,0===o.length&&(d.style.width=r.style.left),n(i)}function h(a){let{left:n,width:o}=i.getBoundingClientRect();u(Math.round(l(a.clientX-n,0,o)/o*(t-e)+e))}return this.art.proxy(i,"click",e=>{h(e)}),this.art.proxy(i,"mousedown",e=>{p=0===e.button}),this.art.on("document:mousemove",e=>{p&&h(e)}),this.art.on("document:mouseup",e=>{p&&(p=!1,h(e))}),{reset:u}}onFullscreen(e){if(this.outside){let{$danmuku:t,$controlsCenter:i,$mount:a}=this.template;e?i.appendChild(t):a.appendChild(t)}}async emit(){let{$input:e}=this.template,t=e.value.trim();if(!t.length||this.isLock||this.emitting)return;let i={text:t,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let t=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==t)return;i.border=!0,delete i.time,this.danmuku.emit(i),e.value="",this.lock()}catch(e){this.emitting=!1}}lock(){let{addClass:e}=this.utils,{$send:t}=this.template;this.isLock=!0;let i=this.option.lockTime;t.innerText=i,e(t,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(i-=1,t.innerText=i,a())},1e3)};a()}unlock(){let{removeClass:e}=this.utils,{$send:t}=this.template;clearTimeout(this.timer),this.isLock=!1,t.innerText="发送",e(t,"apd-lock")}reset(){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),this.setData("danmukuTheme",this.option.theme);let{inverseClass:e}=this.utils,t=Array.from(this.template.$colors.children).find(e=>e.dataset.color===this.option.color.toUpperCase());t&&e(t,"apd-active")}mount(e=this.template.$controlsCenter){e.appendChild(this.template.$danmuku),this.template.$mount=e,this.reset()}},"undefined"!=typeof document){let e="artplayer-plugin-danmuku",t=document.getElementById(e);if(t)t.textContent=o.default;else{let t=document.createElement("style");t.id=e,t.textContent=o.default,document.head.appendChild(t)}}},{"bundle-text:./style.less":"hViDo","bundle-text:./img/on.svg":"9pjcf","bundle-text:./img/off.svg":"b2dkP","bundle-text:./img/config.svg":"l8tyy","bundle-text:./img/style.svg":"5iZC3","bundle-text:./img/mode_0_off.svg":"i0Vut","bundle-text:./img/mode_0_on.svg":"hOSvZ","bundle-text:./img/mode_1_off.svg":"bOXC3","bundle-text:./img/mode_1_on.svg":"lKuh0","bundle-text:./img/mode_2_off.svg":"eB8W6","bundle-text:./img/mode_2_on.svg":"bpe2E","bundle-text:./img/check_on.svg":"kL9zy","bundle-text:./img/check_off.svg":"22xpM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],hViDo:[function(e,t,i){t.exports='.artplayer-plugin-danmuku{z-index:99;color:#fff;flex-shrink:0;justify-content:center;align-items:center;gap:10px;width:100%;height:32px;font-size:12px;font-weight:300;display:flex;position:relative}.artplayer-plugin-danmuku .apd-icon{cursor:pointer;opacity:.75;fill:#fff;transition:all .2s}.artplayer-plugin-danmuku .apd-icon:hover{opacity:1}.artplayer-plugin-danmuku .apd-config{display:flex;position:relative}.artplayer-plugin-danmuku .apd-config .apd-config-panel{width:320px;padding:10px;display:none;position:absolute;bottom:24px;left:-148px}.artplayer-plugin-danmuku .apd-config .apd-config-panel .apd-config-panel-inner{background-color:#000000d9;border-radius:3px;width:100%;padding:10px}.artplayer-plugin-danmuku .apd-config:hover .apd-config-panel{display:flex}.artplayer-plugin-danmuku .apd-config-mode,.artplayer-plugin-danmuku .apd-config-slider,.artplayer-plugin-danmuku .apd-config-other,.artplayer-plugin-danmuku .apd-style-mode{margin-bottom:15px}.artplayer-plugin-danmuku .apd-modes{align-items:center;gap:20px;margin-top:5px;display:flex}.artplayer-plugin-danmuku .apd-modes .apd-mode{cursor:pointer;text-align:center}.artplayer-plugin-danmuku .apd-modes .apd-mode:hover{color:#00a1d6}.artplayer-plugin-danmuku .apd-config-slider{align-items:center;gap:12px;display:flex}.artplayer-plugin-danmuku .apd-config-slider .apd-value{text-align:right;width:32px}.artplayer-plugin-danmuku .apd-slider{cursor:pointer;flex:1;justify-content:center;align-items:center;height:20px;display:flex;position:relative}.artplayer-plugin-danmuku .apd-slider .apd-slider-line{background-color:#ffffff40;border-radius:3px;width:100%;height:2px;position:relative;overflow:hidden}.artplayer-plugin-danmuku .apd-slider .apd-slider-points{justify-content:space-between;align-items:center;display:flex;position:absolute;inset:0}.artplayer-plugin-danmuku .apd-slider .apd-slider-points .apd-slider-point{background-color:#ffffff80;border-radius:50%;width:2px;height:2px}.artplayer-plugin-danmuku .apd-slider .apd-slider-progress{background-color:#00a1d6;width:0%;height:100%}.artplayer-plugin-danmuku .apd-slider .apd-slider-dot{background-color:#00a1d6;border-radius:50%;width:12px;height:12px;position:absolute;left:0%;transform:translate(-6px)}.artplayer-plugin-danmuku .apd-slider .apd-slider-steps{color:#777;justify-content:space-between;align-items:center;width:calc(100% + 32px);display:flex;position:absolute;bottom:-12px}.artplayer-plugin-danmuku .apd-slider .apd-slider-steps .apd-slider-step{text-align:center;flex-shrink:0;width:36px;scale:.95}.artplayer-plugin-danmuku .apd-config-other{align-items:center;gap:20px;display:flex}.artplayer-plugin-danmuku .apd-config-other .apd-check-off,.artplayer-plugin-danmuku .apd-config-other .apd-check-on{width:16px;height:16px}.artplayer-plugin-danmuku .apd-config-other .apd-other{cursor:pointer;align-items:center;gap:2px;display:flex}.artplayer-plugin-danmuku .apd-config-other .apd-other:hover{color:#00a1d6}.artplayer-plugin-danmuku .apd-emitter{background-color:#ffffff40;border-radius:5px;flex:1;align-items:center;height:100%;display:flex}.artplayer-plugin-danmuku .apd-style{justify-content:center;align-items:center;display:flex;position:relative}.artplayer-plugin-danmuku .apd-style .apd-style-panel{width:200px;padding:10px;display:none;position:absolute;bottom:24px;left:-88px}.artplayer-plugin-danmuku .apd-style .apd-style-panel .apd-style-panel-inner{background-color:#000000d9;border-radius:3px;width:100%;padding:10px}.artplayer-plugin-danmuku .apd-style:hover .apd-style-panel{display:flex}.artplayer-plugin-danmuku .apd-colors{flex-wrap:wrap;gap:8px;margin-top:5px;display:flex}.artplayer-plugin-danmuku .apd-colors .apd-color{cursor:pointer;border-radius:2px;width:16px;height:16px}.artplayer-plugin-danmuku .apd-colors .apd-color.apd-active{border:1px solid #000;box-shadow:0 0 0 1px #fff}.artplayer-plugin-danmuku .apd-input{color:#fff;background-color:#0000;border:none;outline:none;flex:1;width:auto;min-width:0;height:100%;line-height:1}.artplayer-plugin-danmuku .apd-input::placeholder{color:#ffffff80}.artplayer-plugin-danmuku .apd-send{cursor:pointer;text-shadow:none;background-color:#00a1d6;border-top-right-radius:5px;border-bottom-right-radius:5px;flex-shrink:0;justify-content:center;align-items:center;width:60px;height:100%;display:flex}.artplayer-plugin-danmuku .apd-send.apd-lock{cursor:not-allowed;color:#666;background-color:#e7e7e7}.art-controls-center .apd-emitter{flex:none;width:260px}.art-fullscreen .artplayer-plugin-danmuku,.art-fullscreen-web .artplayer-plugin-danmuku{gap:16px;height:38px}.art-fullscreen .artplayer-plugin-danmuku .apd-config-icon,.art-fullscreen-web .artplayer-plugin-danmuku .apd-config-icon,.art-fullscreen .artplayer-plugin-danmuku .apd-toggle-off,.art-fullscreen-web .artplayer-plugin-danmuku .apd-toggle-off,.art-fullscreen .artplayer-plugin-danmuku .apd-toggle-on,.art-fullscreen-web .artplayer-plugin-danmuku .apd-toggle-on{width:28px;height:28px}.art-fullscreen .artplayer-plugin-danmuku .apd-emitter,.art-fullscreen-web .artplayer-plugin-danmuku .apd-emitter{flex:none;width:400px}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-icon{fill:#333}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-emitter{background-color:#f1f2f3}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input{color:#000}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:#0000004d}[data-danmuku-visible=false] .apd-toggle-off{display:block}[data-danmuku-visible=false] .apd-toggle-on,[data-danmuku-visible=true] .apd-toggle-off{display:none}[data-danmuku-visible=true] .apd-toggle-on{display:block}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-on{display:none}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-off,[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-on{display:block}[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-off,[data-danmuku-sync-video=false] .apd-sync-video .apd-check-on{display:none}[data-danmuku-sync-video=false] .apd-sync-video .apd-check-off,[data-danmuku-sync-video=true] .apd-sync-video .apd-check-on{display:block}[data-danmuku-sync-video=true] .apd-sync-video .apd-check-off{display:none}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-off{display:block}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-on{display:none}[data-danmuku-mode0=false] .art-danmuku [data-mode="0"]{opacity:0!important}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-off{display:none}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-on{display:block}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"]{color:#00a1d6}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"] path{fill:#00a1d6}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-off{display:block}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-on{display:none}[data-danmuku-mode1=false] .art-danmuku [data-mode="1"]{opacity:0!important}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-off{display:none}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-on{display:block}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"]{color:#00a1d6}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"] path{fill:#00a1d6}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-off{display:block}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-on{display:none}[data-danmuku-mode2=false] .art-danmuku [data-mode="2"]{opacity:0!important}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-off{display:none}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-on{display:block}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"]{color:#00a1d6}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"] path{fill:#00a1d6}'},{}],"9pjcf":[function(e,t,i){t.exports=''},{}],b2dkP:[function(e,t,i){t.exports=''},{}],l8tyy:[function(e,t,i){t.exports=''},{}],"5iZC3":[function(e,t,i){t.exports=''},{}],i0Vut:[function(e,t,i){t.exports=''},{}],hOSvZ:[function(e,t,i){t.exports=''},{}],bOXC3:[function(e,t,i){t.exports=''},{}],lKuh0:[function(e,t,i){t.exports=''},{}],eB8W6:[function(e,t,i){t.exports=''},{}],bpe2E:[function(e,t,i){t.exports=''},{}],kL9zy:[function(e,t,i){t.exports=''},{}],"22xpM":[function(e,t,i){t.exports=''},{}],"8AxLD":[function(e,t,i){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(i),a.export(i,"default",()=>s);let n={map:(e,t,i,a,n)=>(e-t)*(n-a)/(i-t)+a,range(e,t,i){let a=Math.round(e/i)*i;return Array.from({length:Math.floor((t-e)/i)},(e,t)=>t*i+a)}},o=(e,t)=>{let i=t[0]-e[0],a=t[1]-e[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function s(e,t,i){let{query:a}=e.constructor.utils;e.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(s){let l=null,r=null;function d(d=[]){if(l=null,r=null,s.innerHTML="",!e.duration||e.option.isLive)return;let p={w:s.offsetWidth,h:s.offsetHeight},u={xMin:0,xMax:p.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*p.h),sampling:Math.floor(p.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(u,i);let h=[];if(Array.isArray(d)&&d.length)h=[...d];else{let i=e.duration/p.w;for(let e=0;e<=p.w;e+=u.sampling){let a=t.danmus.filter(({time:t})=>t>e*i&&t<=(e+u.sampling)*i).length;h.push([e,a])}}if(0===h.length)return;let m=h[h.length-1],c=m[0],f=m[1];c!==p.w&&h.push([p.w,f]);let g=h.map(e=>e[1]),v=(Math.min(...g)+Math.max(...g))/2;for(let e=0;ev?1+u.scale:1-u.scale)+u.minHeight}let y=(e,t,i,a)=>{let s=o(t||e,i||e),l=n.map(Math.cos(s.angle)*u.flattening,0,1,1,0),r=s.angle*l+(a?Math.PI:0),d=s.length*u.smoothing;return[e[0]+Math.cos(r)*d,e[1]+Math.sin(r)*d]},x=(e,t,i)=>{let a=y(i[t-1],i[t-2],e),n=y(e,i[t-1],i[t+1],!0),o=t===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${e[0]},${e[1]}${o}`},k=h.map(e=>[n.map(e[0],u.xMin,u.xMax,0,p.w),n.map(e[1],u.yMin,u.yMax,p.h,0)]).reduce((e,t,i,a)=>0===i?`M ${a[a.length-1][0]},${p.h} L ${t[0]},${p.h} L ${t[0]},${t[1]}`:`${e} ${x(t,i,a)}`,"");s.innerHTML=``,l=a("#heatmap-start",s),r=a("#heatmap-stop",s),l.setAttribute("offset",`${100*e.played}%`),r.setAttribute("offset",`${100*e.played}%`)}e.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*e.played}%`),r.setAttribute("offset",`${100*e.played}%`))}),e.on("setBar",(e,t)=>{l&&r&&"played"===e&&(l.setAttribute("offset",`${100*t}%`),r.setAttribute("offset",`${100*t}%`))}),e.on("ready",()=>d()),e.on("resize",()=>d()),e.on("artplayerPluginDanmuku:loaded",()=>d()),e.on("artplayerPluginDanmuku:points",e=>d(e))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["bgm6t"],"bgm6t","parcelRequire4dc0"); \ No newline at end of file diff --git a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.legacy.js b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.legacy.js index ef9f2e9a4..f091a1a3b 100644 --- a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.legacy.js +++ b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.legacy.js @@ -4,4 +4,4 @@ * (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 O(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 z(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 A(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:S,__asyncDelegator:O,__asyncValues:D,__makeTemplateObject:M,__importStar:P,__importDefault:E,__classPrivateFieldGet:T,__classPrivateFieldSet:z,__classPrivateFieldIn:A,__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(S.default,'\n
顶部
\n
\n
\n ').concat(D.default).concat(F.default,'\n
底部
\n
\n
\n
\n
\n
\n ').concat(E.default).concat(z.default,'\n 防止弹幕重叠\n
\n
\n ').concat(E.default).concat(z.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(S.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)},onChange:function(t){e.template.$opacityValue.textContent="".concat(t,"%");var r=t/100;r!==e.option.opacity&&e.danmuku.config({opacity:r})}}),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]})},onChange:function(t){var r=e.MARGIN[t];if(r){e.template.$marginValue.textContent=r.name;var n=r.value;(n[0]!==e.option.margin[0]||n[1]!==e.option.margin[1])&&e.danmuku.config({margin:n})}}}),this.slider.fontSize=this.createSlider({min:1,max:25,steps:[],container:this.template.$fontSizeSlider,findIndex:function(){var t=e.art.template.$player.clientHeight;return Math.round(e.option.fontSize/t*100)},onChange:function(t){var r=e.template.$fontSizeValue,n=e.art.template.$player.clientHeight;r.textContent="".concat(t,"%"),t!==Math.round(e.option.fontSize/n*100)&&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})},onChange:function(t){var r=e.SPEED[t];if(r){e.template.$speedValue.textContent=r.name;var n=r.value;n!==e.option.speed&&e.danmuku.config({speed:n})}}})}},{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();if(!(er)){var n=(e-t)/(r-t);p.style.left="".concat(100*n,"%"),0===s.length&&(d.style.width=p.style.left),o(e)}}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:"onFullscreen",value:function(e){if(this.outside){var t=this.template,r=t.$danmuku,n=t.$controlsCenter,a=t.$mount;e?n.appendChild(r):a.appendChild(r)}}},{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),this.setData("danmukuTheme",this.option.theme);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.reset()}}],[{key:"icons",get:function(){return{$on:d.default,$off:h.default,$config:y.default,$style:v.default,$mode_0_off:b.default,$mode_0_on:k.default,$mode_1_off:j.default,$mode_1_on:S.default,$mode_2_off:D.default,$mode_2_on:F.default,$check_on:E.default,$check_off:z.default}}}]),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);r.artplayer-plugin-danmuku .apd-icon{fill:#333}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-emitter{background-color:#f1f2f3}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input{color:#000}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:rgba(0,0,0,.3)}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:rgba(0,0,0,.3)}[data-danmuku-visible=false] .apd-toggle-off{display:block}[data-danmuku-visible=false] .apd-toggle-on,[data-danmuku-visible=true] .apd-toggle-off{display:none}[data-danmuku-visible=true] .apd-toggle-on{display:block}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-on{display:none}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-off,[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-on{display:block}[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-off,[data-danmuku-sync-video=false] .apd-sync-video .apd-check-on{display:none}[data-danmuku-sync-video=false] .apd-sync-video .apd-check-off,[data-danmuku-sync-video=true] .apd-sync-video .apd-check-on{display:block}[data-danmuku-sync-video=true] .apd-sync-video .apd-check-off{display:none}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-off{display:block}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-on{display:none}[data-danmuku-mode0=false] .art-danmuku [data-mode="0"]{opacity:0!important}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-off{display:none}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-on{display:block}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"]{color:#00a1d6}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"] path{fill:#00a1d6}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-off{display:block}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-on{display:none}[data-danmuku-mode1=false] .art-danmuku [data-mode="1"]{opacity:0!important}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-off{display:none}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-on{display:block}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"]{color:#00a1d6}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"] path{fill:#00a1d6}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-off{display:block}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-on{display:none}[data-danmuku-mode2=false] .art-danmuku [data-mode="2"]{opacity:0!important}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-off{display:none}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-on{display:block}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"]{color:#00a1d6}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"] path{fill:#00a1d6}'},{}],"4mwSI":[function(e,t,r){t.exports=''},{}],"9bQDs":[function(e,t,r){t.exports=''},{}],cciuY:[function(e,t,r){t.exports=''},{}],e5G6o:[function(e,t,r){t.exports=''},{}],fC4yA:[function(e,t,r){t.exports=''},{}],fUkVg:[function(e,t,r){t.exports=''},{}],isoJm:[function(e,t,r){t.exports=''},{}],"20nBM":[function(e,t,r){t.exports=''},{}],"6x9CL":[function(e,t,r){t.exports=''},{}],"7GKdL":[function(e,t,r){t.exports=''},{}],"9SCIh":[function(e,t,r){t.exports=''},{}],"6KRxn":[function(e,t,r){t.exports=''},{}],dXFn2:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return s});var a=e("@swc/helpers/_/_to_consumable_array"),o={map:function(e,t,r,n,a){return(e-t)*(a-n)/(r-t)+n}},i=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return{length:Math.sqrt(Math.pow(r,2)+Math.pow(n,2)),angle:Math.atan2(n,r)}};function s(e,t,r){var n=e.constructor.utils.query;e.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted:function(s){var l=null,u=null;function c(){var c,p,d=arguments.length>0&&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 O=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=O(r[t-1],r[t-2],e),a=O(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"); \ No newline at end of file +!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 O(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 z(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 A(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:S,__asyncDelegator:O,__asyncValues:D,__makeTemplateObject:M,__importStar:P,__importDefault:E,__classPrivateFieldGet:T,__classPrivateFieldSet:z,__classPrivateFieldIn:A,__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(S.default,'\n
顶部
\n
\n
\n ').concat(D.default).concat(F.default,'\n
底部
\n
\n
\n
\n
\n
\n ').concat(E.default).concat(z.default,'\n 防止弹幕重叠\n
\n
\n ').concat(E.default).concat(z.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(S.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)},onChange:function(t){e.template.$opacityValue.textContent="".concat(t,"%");var r=t/100;r!==e.option.opacity&&e.danmuku.config({opacity:r})}}),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]})},onChange:function(t){var r=e.MARGIN[t];if(r){e.template.$marginValue.textContent=r.name;var n=r.value;(n[0]!==e.option.margin[0]||n[1]!==e.option.margin[1])&&e.danmuku.config({margin:n})}}}),this.slider.fontSize=this.createSlider({min:1,max:25,steps:[],container:this.template.$fontSizeSlider,findIndex:function(){var t=e.art.template.$player.clientHeight;return Math.round(e.option.fontSize/t*100)},onChange:function(t){var r=e.template.$fontSizeValue,n=e.art.template.$player.clientHeight;r.textContent="".concat(t,"%"),t!==Math.round(e.option.fontSize/n*100)&&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})},onChange:function(t){var r=e.SPEED[t];if(r){e.template.$speedValue.textContent=r.name;var n=r.value;n!==e.option.speed&&e.danmuku.config({speed:n})}}})}},{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();if(!(er)){var n=(e-t)/(r-t);p.style.left="".concat(100*n,"%"),0===s.length&&(d.style.width=p.style.left),o(e)}}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:"onFullscreen",value:function(e){if(this.outside){var t=this.template,r=t.$danmuku,n=t.$controlsCenter,a=t.$mount;e?n.appendChild(r):a.appendChild(r)}}},{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),this.setData("danmukuTheme",this.option.theme);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.reset()}}],[{key:"icons",get:function(){return{$on:d.default,$off:h.default,$config:y.default,$style:v.default,$mode_0_off:b.default,$mode_0_on:k.default,$mode_1_off:j.default,$mode_1_on:S.default,$mode_2_off:D.default,$mode_2_on:F.default,$check_on:E.default,$check_off:z.default}}}]),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);r.artplayer-plugin-danmuku .apd-icon{fill:#333}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-emitter{background-color:#f1f2f3}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input{color:#000}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:rgba(0,0,0,.3)}[data-danmuku-theme=light]>.artplayer-plugin-danmuku .apd-input::placeholder{color:rgba(0,0,0,.3)}[data-danmuku-visible=false] .apd-toggle-off{display:block}[data-danmuku-visible=false] .apd-toggle-on,[data-danmuku-visible=true] .apd-toggle-off{display:none}[data-danmuku-visible=true] .apd-toggle-on{display:block}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-on{display:none}[data-danmuku-anti-overlap=false] .apd-anti-overlap .apd-check-off,[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-on{display:block}[data-danmuku-anti-overlap=true] .apd-anti-overlap .apd-check-off,[data-danmuku-sync-video=false] .apd-sync-video .apd-check-on{display:none}[data-danmuku-sync-video=false] .apd-sync-video .apd-check-off,[data-danmuku-sync-video=true] .apd-sync-video .apd-check-on{display:block}[data-danmuku-sync-video=true] .apd-sync-video .apd-check-off{display:none}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-off{display:block}[data-danmuku-mode0=false] .apd-config-mode .apd-mode-0-on{display:none}[data-danmuku-mode0=false] .art-danmuku [data-mode="0"]{opacity:0!important}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-off{display:none}[data-danmuku-mode0=true] .apd-config-mode .apd-mode-0-on{display:block}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"]{color:#00a1d6}[data-danmuku-mode="0"] .apd-style-mode [data-mode="0"] path{fill:#00a1d6}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-off{display:block}[data-danmuku-mode1=false] .apd-config-mode .apd-mode-1-on{display:none}[data-danmuku-mode1=false] .art-danmuku [data-mode="1"]{opacity:0!important}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-off{display:none}[data-danmuku-mode1=true] .apd-config-mode .apd-mode-1-on{display:block}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"]{color:#00a1d6}[data-danmuku-mode="1"] .apd-style-mode [data-mode="1"] path{fill:#00a1d6}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-off{display:block}[data-danmuku-mode2=false] .apd-config-mode .apd-mode-2-on{display:none}[data-danmuku-mode2=false] .art-danmuku [data-mode="2"]{opacity:0!important}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-off{display:none}[data-danmuku-mode2=true] .apd-config-mode .apd-mode-2-on{display:block}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"]{color:#00a1d6}[data-danmuku-mode="2"] .apd-style-mode [data-mode="2"] path{fill:#00a1d6}'},{}],"4mwSI":[function(e,t,r){t.exports=''},{}],"9bQDs":[function(e,t,r){t.exports=''},{}],cciuY:[function(e,t,r){t.exports=''},{}],e5G6o:[function(e,t,r){t.exports=''},{}],fC4yA:[function(e,t,r){t.exports=''},{}],fUkVg:[function(e,t,r){t.exports=''},{}],isoJm:[function(e,t,r){t.exports=''},{}],"20nBM":[function(e,t,r){t.exports=''},{}],"6x9CL":[function(e,t,r){t.exports=''},{}],"7GKdL":[function(e,t,r){t.exports=''},{}],"9SCIh":[function(e,t,r){t.exports=''},{}],"6KRxn":[function(e,t,r){t.exports=''},{}],dXFn2:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return s});var a=e("@swc/helpers/_/_to_consumable_array"),o={map:function(e,t,r,n,a){return(e-t)*(a-n)/(r-t)+n}},i=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return{length:Math.sqrt(Math.pow(r,2)+Math.pow(n,2)),angle:Math.atan2(n,r)}};function s(e,t,r){var n=e.constructor.utils.query;e.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted:function(s){var l=null,u=null;function c(){var c,p,d=arguments.length>0&&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 O=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=O(r[t-1],r[t-2],e),a=O(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"); \ No newline at end of file diff --git a/scripts/build.js b/scripts/build.js index 8eb2d090b..9da455da3 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -14,7 +14,7 @@ function compressString(input) { .replace(/\s*([:;,])\s*/g, '$1') .replace(/\s+/g, ' ') .trim(); - return compressedCssString; + return compressedHtmlString; } async function build(name, targetName) {