From 84bc5a85bcb4e684e91865206555b05e99d86a9c Mon Sep 17 00:00:00 2001 From: Harvey Zack Date: Sat, 5 Jul 2025 16:04:21 +0800 Subject: [PATCH] Refactor code structure for improved readability and maintainability --- docs/compiled/artplayer-plugin-danmuku.esm.js | 2 +- docs/compiled/artplayer-plugin-danmuku.esm.js.map | 2 +- docs/compiled/artplayer-plugin-danmuku.js | 2 +- docs/compiled/artplayer-plugin-danmuku.legacy.js | 2 +- .../dist/artplayer-plugin-danmuku.esm.js | 2 +- .../dist/artplayer-plugin-danmuku.esm.js.map | 2 +- .../artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js | 2 +- .../dist/artplayer-plugin-danmuku.legacy.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/compiled/artplayer-plugin-danmuku.esm.js b/docs/compiled/artplayer-plugin-danmuku.esm.js index 88577f6fc..949f2f507 100644 --- a/docs/compiled/artplayer-plugin-danmuku.esm.js +++ b/docs/compiled/artplayer-plugin-danmuku.esm.js @@ -5,5 +5,5 @@ * (c) 2017-2025 Harvey Zack * Released under the MIT License. */ -!function(t,e,i,a,n,o,s,l){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof r[a]&&r[a],p=d.i||{},u=d.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof r[a]&&r[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var l=u[e]=new m.Module(e);t[e][0].call(l.exports,p,l,l.exports,r)}return u[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return r[a]}}),r[a]=m;for(var c=0;cu);var o=t("./danmuku"),s=n.interopDefault(o),l=t("./setting"),r=n.interopDefault(l),d=t("./heatmap"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,r.default)(e,i);return i.option.heatmap&&(0,p.default)(e,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}}}}u.icons=r.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"6C7g0","./setting":"90QKZ","./heatmap":"h2ayY","@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],"6C7g0":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("./bilibili"),s=t("bundle-text:./worker"),l=n.interopDefault(s);class r{constructor(t,e){let{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e);let n=new Blob([l.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),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,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}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|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}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:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[1]}get fontSize(){let{clamp:t}=this.utils,{clientHeight:e}=this.$player,i=this.option.fontSize;return"number"==typeof i?Math.round(t(i,12,e)):"string"==typeof i&&i.endsWith("%")?Math.round(t(e*(parseFloat(i)/100),12,e)):r.option.fontSize}get $ref(){let t=this.$refs.pop()||document.createElement("div");return t.style.cssText=r.cssText,t.dataset.mode="",t.className="",t}get readys(){let{currentTime:t}=this.art,e=[];return this.filter("ready",t=>e.push(t)),this.filter("wait",i=>{t+.1>=i.time&&i.time>=t-.1&&e.push(i)}),e}get visibles(){let t=[],{clientWidth:e}=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=e-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,t.push(p)}),t}get speed(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}async load(t){let{errorHandle:e}=this.utils,i=[],a=t||this.option.danmuku;try{"function"==typeof a?i=await a():a instanceof Promise?i=await a:"string"==typeof a?i=await (0,o.bilibiliDanmuParseFromUrl)(a):Array.isArray(a)&&(i=a),e(Array.isArray(i),"Danmuku need return an array as result"),void 0===t&&(this.reset(),this.queue=[],this.states={wait:[],ready:[],emit:[],stop:[]},this.$refs=[],this.$danmuku.innerText="");for(let t=0;tJSON.stringify(this.option[e])!==JSON.stringify(t[e]))&&(this.option=Object.assign({},r.option,this.option,t),this.validator(this.option,r.scheme),this.option.mode=e(this.option.mode,0,2),this.option.speed=e(this.option.speed,1,10),this.option.opacity=e(this.option.opacity,0,1),this.option.lockTime=e(this.option.lockTime,1,60),this.option.maxLength=e(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}postMessage(t={}){return new Promise(e=>{t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:a}=i;a.id===t.id&&e(a)}})}filter(t,e){let i=this.states[t]||[];for(let t=0;te!==t),t.$state=e,t.$ref&&(t.$ref.dataset.state=e),this.states[e].push(t)}makeWait(t){this.setState(t,"wait"),t.$ref&&(t.$ref.style.cssText=r.cssText,t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}update(){let{setStyles:t}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let e=this.readys;for(let i=0;i{0===e.mode&&(e.$ref.style.left=`${t}px`)}),this.filter("emit",e=>{if(e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.left=`${t}px`,e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}})}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(this.setState(e,"emit"),e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(this.setState(e,"stop"),0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$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(t=>this.makeWait(t)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.$danmuku.style.opacity=1,this.option.visible=!0,this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.$danmuku.style.opacity=0,this.option.visible=!1,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=r},{"./bilibili":"8WBpY","bundle-text:./worker":"8UAYg","@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],"8WBpY":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function o(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function s(t){if("string"!=typeof t)return[];let e=new RegExp(/(?.+?)<\/d>/gs);return Array.from(t.matchAll(e)).map(t=>{let e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:o(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null}).filter(Boolean)}function l({data:t}){let{xml:e,id:i}=t;if(!i||!e)return;let a=s(e);self.postMessage({danmus:a,id:i})}function r(t){return new Promise(async e=>{let i=await fetch(t),a=await i.text();try{let t=function(){let t=new Blob([` ${o.toString()} ${s.toString()} onmessage = ${l.toString()} `],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}();t.onmessage=i=>{let{danmus:a,id:n}=i.data;n&&a&&(e(a),t.terminate())},t.postMessage({xml:a,id:Date.now()})}catch(t){e(s(a))}})}n.defineInteropFlag(i),n.export(i,"bilibiliDanmuParseFromUrl",()=>r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],"5lQoW":[function(t,e,i,a){i.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},i.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.exportAll=function(t,e){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e},i.export=function(t,e,i){Object.defineProperty(t,e,{enumerable:!0,get:i})}},{}],"8UAYg":[function(t,e,i,a){e.exports='!function(e,t,i,r,o,n,l,d){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof f[r]&&f[r],p=u.i||{},s=u.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!s[t]){if(!e[t]){if(o[t])return o[t];var n="function"==typeof f[r]&&f[r];if(!i&&n)return n(t,!0);if(u)return u(t,!0);if(h&&"string"==typeof t)return h(t);var l=Error("Cannot find module \'"+t+"\'");throw l.code="MODULE_NOT_FOUND",l}p.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},p.cache={};var d=s[t]=new a.Module(t);e[t][0].call(d.exports,p,d,d.exports,f)}return s[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=h,this.exports={}},a.modules=e,a.cache=s,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=p,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return f[r]}}),f[r]=a;for(var c=0;ct.mode===e.mode&&t.top<=d).sort((e,t)=>e.top-t.top);if(0===f.length)if(2===e.mode)return d-e.height;else return n;if(f.unshift({type:"top",top:0,left:0,right:0,height:n,width:i,speed:0,distance:i}),f.push({type:"bottom",top:d,left:0,right:0,height:o,width:i,speed:0,distance:i}),2===e.mode)for(let t=f.length-2;t>=0;t-=1){let i=f[t],r=f[t+1],o=i.top+i.height;if(r.top-o>=e.height)return r.top-e.height}else for(let t=1;t=e.height)return o}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),r=Math.min(...e.map(e=>e.right));return i*t.length-r*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},["4KwZ6"],"4KwZ6","parcelRequire4dc0",{});let{"*":e}=parcelRequire4dc0("4KwZ6");export{e as default};'},{}],"90QKZ":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./style.less"),s=n.interopDefault(o),l=t("bundle-text:./img/on.svg"),r=n.interopDefault(l),d=t("bundle-text:./img/off.svg"),p=n.interopDefault(d),u=t("bundle-text:./img/config.svg"),h=n.interopDefault(u),m=t("bundle-text:./img/style.svg"),c=n.interopDefault(m),f=t("bundle-text:./img/mode_0_off.svg"),g=n.interopDefault(f),y=t("bundle-text:./img/mode_0_on.svg"),v=n.interopDefault(y),x=t("bundle-text:./img/mode_1_off.svg"),k=n.interopDefault(x),b=t("bundle-text:./img/mode_1_on.svg"),$=n.interopDefault(b),w=t("bundle-text:./img/mode_2_off.svg"),M=n.interopDefault(w),E=t("bundle-text:./img/mode_2_on.svg"),S=n.interopDefault(E),D=t("bundle-text:./img/check_on.svg"),A=n.interopDefault(D),z=t("bundle-text:./img/check_off.svg"),F=n.interopDefault(z);if(i.default=class{constructor(t,e){this.art=t,this.danmuku=e,this.utils=t.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=t.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$config:null,$configPanel:null,$configModes:null,$style:null,$stylePanel: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),t.on("resize",()=>this.resize()),t.on("fullscreen",t=>this.onFullscreen(t)),t.on("fullscreenWeb",t=>this.onFullscreen(t)),t.proxy(this.template.$config,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$config,$panel:this.template.$configPanel})}),t.proxy(this.template.$style,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$style,$panel:this.template.$stylePanel})})}static get icons(){return{$on:r.default,$off:p.default,$config:h.default,$style:c.default,$mode_0_off:g.default,$mode_0_on:v.default,$mode_1_off:k.default,$mode_1_on:$.default,$mode_2_off:M.default,$mode_2_on:S.default,$check_on:A.default,$check_off:F.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:t}=this;return`
${r.default}${p.default}
${h.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${g.default}${v.default}
\u{6EDA}\u{52A8}
${k.default}${$.default}
\u{9876}\u{90E8}
${M.default}${S.default}
\u{5E95}\u{90E8}
${A.default}${F.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${A.default}${F.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}
${c.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${$.default}
\u{9876}\u{90E8}
${S.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(t=>`
`).join("")}
\u{53D1}\u{9001}
`}get OPACITY(){return{min:0,max:100,steps:[],...this.option.OPACITY}}get FONT_SIZE(){return{min:12,max:120,steps:[],...this.option.FONT_SIZE}}get MARGIN(){return{min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}],...this.option.MARGIN}}get SPEED(){return{min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}],...this.option.SPEED}}get COLOR(){return this.option.COLOR.length?this.option.COLOR:["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(t){let{query:e}=this.utils,{$danmuku:i}=this.template;return e(t,i)}append(t,e){let{append:i}=this.utils;[...t.children].some(t=>t===e)||i(t,e)}setData(t,e){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[t]=e,this.outside&&(a.dataset[t]=e)}createTemplate(){let{createElement:t,tooltip:e}=this.utils,i=t("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");let{$toggle:a}=this.template;this.art.on("artplayerPluginDanmuku:show",()=>{e(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",()=>{e(a,"打开弹幕")})}createEvents(){let{$toggle:t,$configModes:e,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(t,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(e,"click",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(t=>t!==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",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",t=>{let e=t.target.closest(".apd-color");e&&(this.danmuku.config({color:e.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({...this.OPACITY,container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:t=>{let{$opacityValue:e}=this.template;e.textContent=`${t}%`,this.danmuku.config({opacity:t/100})}}),this.slider.margin=this.createSlider({...this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.steps.findIndex(t=>t.value[0]===this.option.margin[0]&&t.value[1]===this.option.margin[1]),onChange:t=>{let e=this.MARGIN.steps[t];if(!e)return;let{$marginValue:i}=this.template;i.textContent=e.name,this.danmuku.config({margin:e.value})}}),this.slider.fontSize=this.createSlider({...this.FONT_SIZE,container:this.template.$fontSizeSlider,findIndex:()=>this.danmuku.fontSize,onChange:t=>{let{$fontSizeValue:e}=this.template;e.textContent=`${t}px`,t!==this.danmuku.fontSize&&this.danmuku.config({fontSize:t})}}),this.slider.speed=this.createSlider({...this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.steps.findIndex(t=>t.value===this.option.speed),onChange:t=>{let e=this.SPEED.steps[t];if(!e)return;let{$speedValue:i}=this.template;i.textContent=e.name,this.danmuku.config({speed:e.value})}})}createSlider({min:t,max:e,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l,setStyle:r}=this.utils;r(i,"touch-action","none"),i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(t=>t.hide?"":`
${t.name}
`).join("")}
`;let d=s(".apd-slider-dot",i),p=s(".apd-slider-progress",i),u=!1;function h(i=a()){if(ie)return;let s=(i-t)/(e-t);d.style.left=`${100*s}%`,0===o.length&&(p.style.width=d.style.left),n(i)}function m(a){let{top:n,height:o,left:s,width:r}=i.getBoundingClientRect();this.art.isRotate?h(Math.round(l(a.clientY-n,0,o)/o*(e-t)+t)):h(Math.round(l(a.clientX-s,0,r)/r*(e-t)+t))}return this.art.proxy(i,"click",t=>{m.call(this,t)}),this.art.proxy(i,"pointerdown",t=>{u=0===t.button}),this.art.proxy(document,"pointermove",t=>{u&&m.call(this,t)}),this.art.proxy(document,"pointerup",t=>{u&&(u=!1,m.call(this,t))}),{reset:h}}onFullscreen(t){let{$danmuku:e,$controlsCenter:i,$mount:a}=this.template;this.outside?t?this.append(i,e):this.append(a,e):this.append(i,e)}onMouseEnter({$control:t,$panel:e}){let{$player:i}=this.art.template,a=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=i.getBoundingClientRect(),s=n.width/2-a.width/2,l=o.left-(a.left-s),r=a.right+s-o.right;l>0?e.style.left=`${-s+l}px`:r>0?e.style.left=`${-s-r}px`:e.style.left=`${-s}px`}async emit(){let{$input:t}=this.template,e=t.value.trim();if(!e.length||this.isLock||this.emitting)return;let i={text:e,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let e=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==e)return;i.border=!0,delete i.time,this.danmuku.emit(i),t.value="",this.lock()}catch(t){this.emitting=!1}}lock(){let{addClass:t}=this.utils,{$send:e}=this.template;this.isLock=!0;let i=this.option.lockTime;e.innerText=i,t(e,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(e.innerText=i-=1,a())},1e3)};a()}unlock(){let{removeClass:t}=this.utils,{$send:e}=this.template;clearTimeout(this.timer),this.isLock=!1,e.innerText="发送",t(e,"apd-lock")}resize(){if(this.outside||this.art.fullscreen||this.art.fullscreenWeb)return;let{$player:t,$controlsCenter:e}=this.art.template,{$danmuku:i}=this.template;this.art.widtht.dataset.color===this.option.color.toUpperCase());n&&t(n,"apd-active"),e(i,this.option.visible?"关闭弹幕":"打开弹幕"),this.resize()}mount(t){let{errorHandle:e}=this.utils,i="string"==typeof t?document.querySelector(t):t;e(i,`Can not find the mount point: ${t}`),this.append(i,this.template.$danmuku),this.template.$mount=i,this.reset()}},"undefined"!=typeof document){let t="artplayer-plugin-danmuku",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=s.default}},{"bundle-text:./style.less":"dHTK8","bundle-text:./img/on.svg":"5XkVj","bundle-text:./img/off.svg":"3WiJz","bundle-text:./img/config.svg":"DK7bp","bundle-text:./img/style.svg":"h2xX3","bundle-text:./img/mode_0_off.svg":"fp5qd","bundle-text:./img/mode_0_on.svg":"fYNQe","bundle-text:./img/mode_1_off.svg":"gQMgY","bundle-text:./img/mode_1_on.svg":"5E8Hg","bundle-text:./img/mode_2_off.svg":"89iSb","bundle-text:./img/mode_2_on.svg":"2YEb0","bundle-text:./img/check_on.svg":"iQql8","bundle-text:./img/check_off.svg":"4tC1X","@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],dHTK8:[function(t,e,i,a){e.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}'},{}],"5XkVj":[function(t,e,i,a){e.exports=''},{}],"3WiJz":[function(t,e,i,a){e.exports=''},{}],DK7bp:[function(t,e,i,a){e.exports=''},{}],h2xX3:[function(t,e,i,a){e.exports=''},{}],fp5qd:[function(t,e,i,a){e.exports=''},{}],fYNQe:[function(t,e,i,a){e.exports=''},{}],gQMgY:[function(t,e,i,a){e.exports=''},{}],"5E8Hg":[function(t,e,i,a){e.exports=''},{}],"89iSb":[function(t,e,i,a){e.exports=''},{}],"2YEb0":[function(t,e,i,a){e.exports=''},{}],iQql8:[function(t,e,i,a){e.exports=''},{}],"4tC1X":[function(t,e,i,a){e.exports=''},{}],h2ayY:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>l);let o={map:(t,e,i,a,n)=>(t-e)*(n-a)/(i-e)+a,range(t,e,i){let a=Math.round(t/i)*i;return Array.from({length:Math.floor((e-t)/i)},(t,e)=>e*i+a)}},s=(t,e)=>{let i=e[0]-t[0],a=e[1]-t[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function l(t,e,i){let{query:a}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(n){let l=null,r=null;function d(p=[]){if(l=null,r=null,n.innerHTML="",!t.duration||t.option.isLive)return;let u={w:n.offsetWidth,h:n.offsetHeight},h={xMin:0,xMax:u.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*u.h),sampling:Math.floor(u.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(h,i);let m=[];if(Array.isArray(p)&&p.length)m=[...p];else{let i=t.duration/u.w;for(let t=0;t<=u.w;t+=h.sampling){let a=e.queue.filter(({time:e})=>e>t*i&&e<=(t+h.sampling)*i).length;m.push([t,a])}}if(0===m.length)return;let c=m[m.length-1],f=c[0],g=c[1];f!==u.w&&m.push([u.w,g]);let y=m.map(t=>t[1]),v=(Math.min(...y)+Math.max(...y))/2;for(let t=0;tv?1+h.scale:1-h.scale)+h.minHeight}let x=(t,e,i,a)=>{let n=s(e||t,i||t),l=o.map(Math.cos(n.angle)*h.flattening,0,1,1,0),r=n.angle*l+(a?Math.PI:0),d=n.length*h.smoothing;return[t[0]+Math.cos(r)*d,t[1]+Math.sin(r)*d]},k=(t,e,i)=>{let a=x(i[e-1],i[e-2],t),n=x(t,i[e-1],i[e+1],!0),o=e===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${t[0]},${t[1]}${o}`},b=m.map(t=>[o.map(t[0],h.xMin,h.xMax,0,u.w),o.map(t[1],h.yMin,h.yMax,u.h,0)]).reduce((t,e,i,a)=>0===i?`M ${a[a.length-1][0]},${u.h} L ${e[0]},${u.h} L ${e[0]},${e[1]}`:`${t} ${k(e,i,a)}`,"");n.innerHTML=``,l=a("#heatmap-start",n),r=a("#heatmap-stop",n),l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{l&&r&&"played"===t&&(l.setAttribute("offset",`${100*e}%`),r.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>d()),t.on("resize",()=>d()),t.on("artplayerPluginDanmuku:loaded",()=>d()),t.on("artplayerPluginDanmuku:points",t=>d(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}]},["6ZbtA"],"6ZbtA","parcelRequire4dc0",{});let{default:t}=parcelRequire4dc0("6ZbtA");export{t as default}; +!function(t,e,i,a,n,o,s,l){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof r[a]&&r[a],p=d.i||{},u=d.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof r[a]&&r[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var l=u[e]=new m.Module(e);t[e][0].call(l.exports,p,l,l.exports,r)}return u[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return r[a]}}),r[a]=m;for(var c=0;cu);var o=t("./danmuku"),s=n.interopDefault(o),l=t("./setting"),r=n.interopDefault(l),d=t("./heatmap"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,r.default)(e,i);return i.option.heatmap&&(0,p.default)(e,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}}}}u.icons=r.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"3UaSK","./setting":"jUZBE","./heatmap":"kCWvn","@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],"3UaSK":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("./bilibili"),s=t("bundle-text:./worker"),l=n.interopDefault(s);class r{constructor(t,e){let{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0);let n=new Blob([l.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),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,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}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|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}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:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[1]}get fontSize(){let{clamp:t}=this.utils,{clientHeight:e}=this.$player,i=this.option.fontSize;return"number"==typeof i?Math.round(t(i,12,e)):"string"==typeof i&&i.endsWith("%")?Math.round(t(e*(parseFloat(i)/100),12,e)):r.option.fontSize}get $ref(){let t=this.$refs.pop()||document.createElement("div");return t.style.cssText=r.cssText,t.dataset.mode="",t.className="",t}get readys(){let{currentTime:t}=this.art,e=[];return this.filter("ready",t=>e.push(t)),this.filter("wait",i=>{t+.1>=i.time&&i.time>=t-.1&&e.push(i)}),e}get visibles(){let t=[],{clientWidth:e}=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=e-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,t.push(p)}),t}get speed(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}async load(t){let{errorHandle:e}=this.utils,i=[],a=t||this.option.danmuku;try{"function"==typeof a?i=await a():a instanceof Promise?i=await a:"string"==typeof a?i=await (0,o.bilibiliDanmuParseFromUrl)(a):Array.isArray(a)&&(i=a),e(Array.isArray(i),"Danmuku need return an array as result"),void 0===t&&(this.reset(),this.queue=[],this.states={wait:[],ready:[],emit:[],stop:[]},this.$refs=[],this.$danmuku.innerText="");for(let t=0;tJSON.stringify(this.option[e])!==JSON.stringify(t[e]))||e)&&(this.option=Object.assign({},r.option,this.option,t),this.validator(this.option,r.scheme),this.option.mode=i(this.option.mode,0,2),this.option.speed=i(this.option.speed,1,10),this.option.opacity=i(this.option.opacity,0,1),this.option.lockTime=i(this.option.lockTime,1,60),this.option.maxLength=i(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||a,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}postMessage(t={}){return new Promise(e=>{t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:a}=i;a.id===t.id&&e(a)}})}filter(t,e){let i=this.states[t]||[];for(let t=0;te!==t),t.$state=e,t.$ref&&(t.$ref.dataset.state=e),this.states[e].push(t)}makeWait(t){this.setState(t,"wait"),t.$ref&&(t.$ref.style.cssText=r.cssText,t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}update(){let{setStyles:t}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let e=this.readys;for(let i=0;i{0===e.mode&&(e.$ref.style.left=`${t}px`)}),this.filter("emit",e=>{if(e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.left=`${t}px`,e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}})}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(this.setState(e,"emit"),e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(this.setState(e,"stop"),0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$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(t=>this.makeWait(t)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.$danmuku.style.opacity=1,this.option.visible=!0,this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.$danmuku.style.opacity=0,this.option.visible=!1,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=r},{"./bilibili":"lLE5f","bundle-text:./worker":"2to4T","@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],lLE5f:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function o(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function s(t){if("string"!=typeof t)return[];let e=new RegExp(/(?.+?)<\/d>/gs);return Array.from(t.matchAll(e)).map(t=>{let e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:o(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null}).filter(Boolean)}function l({data:t}){let{xml:e,id:i}=t;if(!i||!e)return;let a=s(e);self.postMessage({danmus:a,id:i})}function r(t){return new Promise(async e=>{let i=await fetch(t),a=await i.text();try{let t=function(){let t=new Blob([` ${o.toString()} ${s.toString()} onmessage = ${l.toString()} `],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}();t.onmessage=i=>{let{danmus:a,id:n}=i.data;n&&a&&(e(a),t.terminate())},t.postMessage({xml:a,id:Date.now()})}catch(t){e(s(a))}})}n.defineInteropFlag(i),n.export(i,"bilibiliDanmuParseFromUrl",()=>r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],w4pLy:[function(t,e,i,a){i.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},i.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.exportAll=function(t,e){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e},i.export=function(t,e,i){Object.defineProperty(t,e,{enumerable:!0,get:i})}},{}],"2to4T":[function(t,e,i,a){e.exports='!function(e,t,i,r,o,n,d,f){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof l[r]&&l[r],h=u.i||{},p=u.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!p[t]){if(!e[t]){if(o[t])return o[t];var n="function"==typeof l[r]&&l[r];if(!i&&n)return n(t,!0);if(u)return u(t,!0);if(s&&"string"==typeof t)return s(t);var d=Error("Cannot find module \'"+t+"\'");throw d.code="MODULE_NOT_FOUND",d}h.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},h.cache={};var f=p[t]=new a.Module(t);e[t][0].call(f.exports,h,f,f.exports,l)}return p[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=s,this.exports={}},a.modules=e,a.cache=p,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=h,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return l[r]}}),l[r]=a;for(var c=0;ct.mode===e.mode&&t.top<=f).sort((e,t)=>e.top-t.top);if(0===l.length)if(2===e.mode)return f-e.height;else return n;if(l.unshift({type:"top",top:0,left:0,right:0,height:n,width:i,speed:0,distance:i}),l.push({type:"bottom",top:f,left:0,right:0,height:o,width:i,speed:0,distance:i}),2===e.mode)for(let t=l.length-2;t>=0;t-=1){let i=l[t],r=l[t+1],o=i.top+i.height;if(r.top-o>=e.height)return r.top-e.height}else for(let t=1;t=e.height)return o}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),r=Math.min(...e.map(e=>e.right));return i*t.length-r*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},["dETh6"],"dETh6","parcelRequire93cf",{});let{"*":e}=parcelRequire93cf("dETh6");export{e as default};'},{}],jUZBE:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./style.less"),s=n.interopDefault(o),l=t("bundle-text:./img/on.svg"),r=n.interopDefault(l),d=t("bundle-text:./img/off.svg"),p=n.interopDefault(d),u=t("bundle-text:./img/config.svg"),h=n.interopDefault(u),m=t("bundle-text:./img/style.svg"),c=n.interopDefault(m),f=t("bundle-text:./img/mode_0_off.svg"),g=n.interopDefault(f),y=t("bundle-text:./img/mode_0_on.svg"),v=n.interopDefault(y),x=t("bundle-text:./img/mode_1_off.svg"),k=n.interopDefault(x),$=t("bundle-text:./img/mode_1_on.svg"),b=n.interopDefault($),w=t("bundle-text:./img/mode_2_off.svg"),E=n.interopDefault(w),M=t("bundle-text:./img/mode_2_on.svg"),D=n.interopDefault(M),S=t("bundle-text:./img/check_on.svg"),F=n.interopDefault(S),T=t("bundle-text:./img/check_off.svg"),A=n.interopDefault(T);if(i.default=class{constructor(t,e){this.art=t,this.danmuku=e,this.utils=t.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=t.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$config:null,$configPanel:null,$configModes:null,$style:null,$stylePanel: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),t.on("resize",()=>this.resize()),t.on("fullscreen",t=>this.onFullscreen(t)),t.on("fullscreenWeb",t=>this.onFullscreen(t)),t.proxy(this.template.$config,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$config,$panel:this.template.$configPanel})}),t.proxy(this.template.$style,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$style,$panel:this.template.$stylePanel})})}static get icons(){return{$on:r.default,$off:p.default,$config:h.default,$style:c.default,$mode_0_off:g.default,$mode_0_on:v.default,$mode_1_off:k.default,$mode_1_on:b.default,$mode_2_off:E.default,$mode_2_on:D.default,$check_on:F.default,$check_off:A.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:t}=this;return`
${r.default}${p.default}
${h.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${g.default}${v.default}
\u{6EDA}\u{52A8}
${k.default}${b.default}
\u{9876}\u{90E8}
${E.default}${D.default}
\u{5E95}\u{90E8}
${F.default}${A.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${F.default}${A.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}
${c.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${b.default}
\u{9876}\u{90E8}
${D.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(t=>`
`).join("")}
\u{53D1}\u{9001}
`}get OPACITY(){return{min:0,max:100,steps:[],...this.option.OPACITY}}get FONT_SIZE(){return{min:12,max:120,steps:[],...this.option.FONT_SIZE}}get MARGIN(){return{min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}],...this.option.MARGIN}}get SPEED(){return{min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}],...this.option.SPEED}}get COLOR(){return this.option.COLOR.length?this.option.COLOR:["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(t){let{query:e}=this.utils,{$danmuku:i}=this.template;return e(t,i)}append(t,e){let{append:i}=this.utils;[...t.children].some(t=>t===e)||i(t,e)}setData(t,e){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[t]=e,this.outside&&(a.dataset[t]=e)}createTemplate(){let{createElement:t,tooltip:e}=this.utils,i=t("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");let{$toggle:a}=this.template;this.art.on("artplayerPluginDanmuku:show",()=>{e(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",()=>{e(a,"打开弹幕")})}createEvents(){let{$toggle:t,$configModes:e,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(t,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(e,"click",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(t=>t!==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",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",t=>{let e=t.target.closest(".apd-color");e&&(this.danmuku.config({color:e.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({...this.OPACITY,container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:t=>{let{$opacityValue:e}=this.template;e.textContent=`${t}%`,this.danmuku.config({opacity:t/100})}}),this.slider.margin=this.createSlider({...this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.steps.findIndex(t=>t.value[0]===this.option.margin[0]&&t.value[1]===this.option.margin[1]),onChange:t=>{let e=this.MARGIN.steps[t];if(!e)return;let{$marginValue:i}=this.template;i.textContent=e.name,this.danmuku.config({margin:e.value})}}),this.slider.fontSize=this.createSlider({...this.FONT_SIZE,container:this.template.$fontSizeSlider,findIndex:()=>this.danmuku.fontSize,onChange:t=>{let{$fontSizeValue:e}=this.template;e.textContent=`${t}px`,t!==this.danmuku.fontSize&&this.danmuku.config({fontSize:t})}}),this.slider.speed=this.createSlider({...this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.steps.findIndex(t=>t.value===this.option.speed),onChange:t=>{let e=this.SPEED.steps[t];if(!e)return;let{$speedValue:i}=this.template;i.textContent=e.name,this.danmuku.config({speed:e.value})}})}createSlider({min:t,max:e,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l,setStyle:r}=this.utils;r(i,"touch-action","none"),i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(t=>t.hide?"":`
${t.name}
`).join("")}
`;let d=s(".apd-slider-dot",i),p=s(".apd-slider-progress",i),u=!1;function h(i=a()){if(ie)return;let s=(i-t)/(e-t);d.style.left=`${100*s}%`,0===o.length&&(p.style.width=d.style.left),n(i)}function m(a){let{top:n,height:o,left:s,width:r}=i.getBoundingClientRect();this.art.isRotate?h(Math.round(l(a.clientY-n,0,o)/o*(e-t)+t)):h(Math.round(l(a.clientX-s,0,r)/r*(e-t)+t))}return this.art.proxy(i,"click",t=>{m.call(this,t)}),this.art.proxy(i,"pointerdown",t=>{u=0===t.button}),this.art.proxy(document,"pointermove",t=>{u&&m.call(this,t)}),this.art.proxy(document,"pointerup",t=>{u&&(u=!1,m.call(this,t))}),{reset:h}}onFullscreen(t){let{$danmuku:e,$controlsCenter:i,$mount:a}=this.template;this.outside?t?this.append(i,e):this.append(a,e):this.append(i,e)}onMouseEnter({$control:t,$panel:e}){let{$player:i}=this.art.template,a=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=i.getBoundingClientRect(),s=n.width/2-a.width/2,l=o.left-(a.left-s),r=a.right+s-o.right;l>0?e.style.left=`${-s+l}px`:r>0?e.style.left=`${-s-r}px`:e.style.left=`${-s}px`}async emit(){let{$input:t}=this.template,e=t.value.trim();if(!e.length||this.isLock||this.emitting)return;let i={text:e,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let e=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==e)return;i.border=!0,delete i.time,this.danmuku.emit(i),t.value="",this.lock()}catch(t){this.emitting=!1}}lock(){let{addClass:t}=this.utils,{$send:e}=this.template;this.isLock=!0;let i=this.option.lockTime;e.innerText=i,t(e,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(e.innerText=i-=1,a())},1e3)};a()}unlock(){let{removeClass:t}=this.utils,{$send:e}=this.template;clearTimeout(this.timer),this.isLock=!1,e.innerText="发送",t(e,"apd-lock")}resize(){if(this.outside||this.art.fullscreen||this.art.fullscreenWeb)return;let{$player:t,$controlsCenter:e}=this.art.template,{$danmuku:i}=this.template;this.art.widtht.dataset.color===this.option.color.toUpperCase());n&&t(n,"apd-active"),e(i,this.option.visible?"关闭弹幕":"打开弹幕"),this.resize()}mount(t){let{errorHandle:e}=this.utils,i="string"==typeof t?document.querySelector(t):t;e(i,`Can not find the mount point: ${t}`),this.append(i,this.template.$danmuku),this.template.$mount=i,this.reset()}},"undefined"!=typeof document){let t="artplayer-plugin-danmuku",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=s.default}},{"bundle-text:./style.less":"lDhE1","bundle-text:./img/on.svg":"eIVgK","bundle-text:./img/off.svg":"ikaFC","bundle-text:./img/config.svg":"4rX4v","bundle-text:./img/style.svg":"7QZb5","bundle-text:./img/mode_0_off.svg":"emfRo","bundle-text:./img/mode_0_on.svg":"hgDUE","bundle-text:./img/mode_1_off.svg":"c2dTL","bundle-text:./img/mode_1_on.svg":"gDNkp","bundle-text:./img/mode_2_off.svg":"04dKo","bundle-text:./img/mode_2_on.svg":"dT4Rc","bundle-text:./img/check_on.svg":"l7wFs","bundle-text:./img/check_off.svg":"2rFnr","@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],lDhE1:[function(t,e,i,a){e.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}'},{}],eIVgK:[function(t,e,i,a){e.exports=''},{}],ikaFC:[function(t,e,i,a){e.exports=''},{}],"4rX4v":[function(t,e,i,a){e.exports=''},{}],"7QZb5":[function(t,e,i,a){e.exports=''},{}],emfRo:[function(t,e,i,a){e.exports=''},{}],hgDUE:[function(t,e,i,a){e.exports=''},{}],c2dTL:[function(t,e,i,a){e.exports=''},{}],gDNkp:[function(t,e,i,a){e.exports=''},{}],"04dKo":[function(t,e,i,a){e.exports=''},{}],dT4Rc:[function(t,e,i,a){e.exports=''},{}],l7wFs:[function(t,e,i,a){e.exports=''},{}],"2rFnr":[function(t,e,i,a){e.exports=''},{}],kCWvn:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>l);let o={map:(t,e,i,a,n)=>(t-e)*(n-a)/(i-e)+a,range(t,e,i){let a=Math.round(t/i)*i;return Array.from({length:Math.floor((e-t)/i)},(t,e)=>e*i+a)}},s=(t,e)=>{let i=e[0]-t[0],a=e[1]-t[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function l(t,e,i){let{query:a}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(n){let l=null,r=null;function d(p=[]){if(l=null,r=null,n.innerHTML="",!t.duration||t.option.isLive)return;let u={w:n.offsetWidth,h:n.offsetHeight},h={xMin:0,xMax:u.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*u.h),sampling:Math.floor(u.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(h,i);let m=[];if(Array.isArray(p)&&p.length)m=[...p];else{let i=t.duration/u.w;for(let t=0;t<=u.w;t+=h.sampling){let a=e.queue.filter(({time:e})=>e>t*i&&e<=(t+h.sampling)*i).length;m.push([t,a])}}if(0===m.length)return;let c=m[m.length-1],f=c[0],g=c[1];f!==u.w&&m.push([u.w,g]);let y=m.map(t=>t[1]),v=(Math.min(...y)+Math.max(...y))/2;for(let t=0;tv?1+h.scale:1-h.scale)+h.minHeight}let x=(t,e,i,a)=>{let n=s(e||t,i||t),l=o.map(Math.cos(n.angle)*h.flattening,0,1,1,0),r=n.angle*l+(a?Math.PI:0),d=n.length*h.smoothing;return[t[0]+Math.cos(r)*d,t[1]+Math.sin(r)*d]},k=(t,e,i)=>{let a=x(i[e-1],i[e-2],t),n=x(t,i[e-1],i[e+1],!0),o=e===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${t[0]},${t[1]}${o}`},$=m.map(t=>[o.map(t[0],h.xMin,h.xMax,0,u.w),o.map(t[1],h.yMin,h.yMax,u.h,0)]).reduce((t,e,i,a)=>0===i?`M ${a[a.length-1][0]},${u.h} L ${e[0]},${u.h} L ${e[0]},${e[1]}`:`${t} ${k(e,i,a)}`,"");n.innerHTML=``,l=a("#heatmap-start",n),r=a("#heatmap-stop",n),l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{l&&r&&"played"===t&&(l.setAttribute("offset",`${100*e}%`),r.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>d()),t.on("resize",()=>d()),t.on("artplayerPluginDanmuku:loaded",()=>d()),t.on("artplayerPluginDanmuku:points",t=>d(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}]},["4omrA"],"4omrA","parcelRequire93cf",{});let{default:t}=parcelRequire93cf("4omrA");export{t as default}; //# sourceMappingURL=artplayer-plugin-danmuku.esm.js.map \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-danmuku.esm.js.map b/docs/compiled/artplayer-plugin-danmuku.esm.js.map index fc051d379..3520a25b0 100644 --- a/docs/compiled/artplayer-plugin-danmuku.esm.js.map +++ b/docs/comp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er-plugin-danmuku/src/index.js","packages/artplayer-plugin-danmuku/src/danmuku.js","packages/artplayer-plugin-danmuku/src/bilibili.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-d75e4ef33e90ad74.js","packages/artplayer-plugin-danmuku/src/setting.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-d4507e9bfc00ded0.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-3f382cbac81656d4.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-2eccf06bbefc75d0.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-966493d38fa25693.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-17da0f3cb542825d.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-e438774eb5592ca2.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-f628b445d36caf1f.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-df73f5e9e2ab004b.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-1de8ba84e2efbede.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-9ccdc626e87ba3ee.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-9a7360dad8cdbe5b.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-75df9b67e4ad9f34.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-b1f4705e590c7693.js","packages/artplayer-plugin-danmuku/src/heatmap.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (\n modules,\n entry,\n mainEntry,\n parcelRequireName,\n externals,\n distDir,\n publicUrl,\n devServer\n) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var importMap = previousRequire.i || {};\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof module.require === 'function' &&\n module.require.bind(module);\n\n function newRequire(name, jumped) {\n if (!cache[name]) {\n if (!modules[name]) {\n if (externals[name]) {\n return externals[name];\n }\n // if we cannot find the module within our internal map or\n // cache jump to the current global require ie. the last bundle\n // that was added to the page.\n var currentRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n if (!jumped && currentRequire) {\n return currentRequire(name, true);\n }\n\n // If there are other bundles on this page the require from the\n // previous one is saved to 'previousRequire'. Repeat this as\n // many times as there are bundles until the module is found or\n // we exhaust the require chain.\n if (previousRequire) {\n return previousRequire(name, true);\n }\n\n // Try the node require function if it exists.\n if (nodeRequire && typeof name === 'string') {\n return nodeRequire(name);\n }\n\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n }\n\n localRequire.resolve = resolve;\n localRequire.cache = {};\n\n var module = (cache[name] = new newRequire.Module(name));\n\n modules[name][0].call(\n module.exports,\n localRequire,\n module,\n module.exports,\n globalObject\n );\n }\n\n return cache[name].exports;\n\n function localRequire(x) {\n var res = localRequire.resolve(x);\n return res === false ? {} : newRequire(res);\n }\n\n function resolve(x) {\n var id = modules[name][1][x];\n return id != null ? id : x;\n }\n }\n\n function Module(moduleName) {\n this.id = moduleName;\n this.bundle = newRequire;\n this.require = nodeRequire;\n this.exports = {};\n }\n\n newRequire.isParcelRequire = true;\n newRequire.Module = Module;\n newRequire.modules = modules;\n newRequire.cache = cache;\n newRequire.parent = previousRequire;\n newRequire.distDir = distDir;\n newRequire.publicUrl = publicUrl;\n newRequire.devServer = devServer;\n newRequire.i = importMap;\n newRequire.register = function (id, exports) {\n modules[id] = [\n function (require, module) {\n module.exports = exports;\n },\n {},\n ];\n };\n\n // Only insert newRequire.load when it is actually used.\n // The code in this file is linted against ES5, so dynamic import is not allowed.\n // INSERT_LOAD_HERE\n\n Object.defineProperty(newRequire, 'root', {\n get: function () {\n return globalObject[parcelRequireName];\n },\n });\n\n globalObject[parcelRequireName] = newRequire;\n\n for (var i = 0; i < entry.length; i++) {\n newRequire(entry[i]);\n }\n\n if (mainEntry) {\n // Expose entry point to Node, AMD or browser globals\n // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js\n var mainExports = newRequire(mainEntry);\n\n // CommonJS\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n module.exports = mainExports;\n\n // RequireJS\n } else if (typeof define === 'function' && define.amd) {\n define(function () {\n return mainExports;\n });\n }\n }\n})({\"6ZbtA\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>artplayerPluginDanmuku);\nvar _danmuku = require(\"./danmuku\");\nvar _danmukuDefault = parcelHelpers.interopDefault(_danmuku);\nvar _setting = require(\"./setting\");\nvar _settingDefault = parcelHelpers.interopDefault(_setting);\nvar _heatmap = require(\"./heatmap\");\nvar _heatmapDefault = parcelHelpers.interopDefault(_heatmap);\nfunction artplayerPluginDanmuku(option) {\n return (art)=>{\n const danmuku = new (0, _danmukuDefault.default)(art, option);\n const setting = new (0, _settingDefault.default)(art, danmuku);\n if (danmuku.option.heatmap) (0, _heatmapDefault.default)(art, danmuku, danmuku.option.heatmap);\n return {\n name: 'artplayerPluginDanmuku',\n emit: danmuku.emit.bind(danmuku),\n load: danmuku.load.bind(danmuku),\n config: danmuku.config.bind(danmuku),\n hide: danmuku.hide.bind(danmuku),\n show: danmuku.show.bind(danmuku),\n reset: danmuku.reset.bind(danmuku),\n mount: setting.mount.bind(setting),\n get option () {\n return danmuku.option;\n },\n get isHide () {\n return danmuku.isHide;\n },\n get isStop () {\n return danmuku.isStop;\n }\n };\n };\n}\nartplayerPluginDanmuku.icons = (0, _settingDefault.default).icons;\nif (typeof window !== 'undefined') window['artplayerPluginDanmuku'] = artplayerPluginDanmuku;\n\n},{\"./danmuku\":\"6C7g0\",\"./setting\":\"90QKZ\",\"./heatmap\":\"h2ayY\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"6C7g0\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nvar _bilibili = require(\"./bilibili\");\nvar _worker = require(\"bundle-text:./worker\");\nvar _workerDefault = parcelHelpers.interopDefault(_worker);\nclass Danmuku {\n constructor(art, option){\n const { constructor, template } = art;\n this.utils = constructor.utils; // 工具库\n this.validator = constructor.validator; // 配置校验器\n this.$danmuku = template.$danmuku; // 弹幕层容器\n this.$player = template.$player; // 播放器容器\n this.art = art;\n this.queue = []; // 实际弹幕队列\n this.$refs = []; // 弹幕DOM节点池\n this.isStop = false; // 是否停止\n this.isHide = false; // 是否隐藏\n this.timer = null; // 定时器\n this.index = 0; // 弹幕索引\n // 格式化后的配置项\n this.option = Danmuku.option;\n // 弹幕状态池\n this.states = {\n wait: [],\n ready: [],\n emit: [],\n stop: []\n };\n // 初始化配置\n this.config(option);\n // 创建 Web Worker, 用于计算弹幕的 top 值\n const workerText2 = (0, _workerDefault.default).replace('export{e as default};', '');\n const blob = new Blob([\n workerText2\n ], {\n type: 'application/javascript'\n });\n this.worker = new Worker(URL.createObjectURL(blob));\n // 绑定公用事件\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.reset = this.reset.bind(this);\n this.resize = this.resize.bind(this);\n this.destroy = this.destroy.bind(this);\n // 监听事件\n art.on('video:play', this.start);\n art.on('video:playing', this.start);\n art.on('video:pause', this.stop);\n art.on('video:waiting', this.stop);\n art.on('destroy', this.destroy);\n art.on('resize', this.resize);\n // 开始加载弹幕\n this.load();\n }\n // 默认配置\n static get option() {\n return {\n danmuku: [],\n speed: 5,\n margin: [\n 10,\n '25%'\n ],\n opacity: 1,\n color: '#FFFFFF',\n mode: 0,\n modes: [\n 0,\n 1,\n 2\n ],\n fontSize: 25,\n antiOverlap: true,\n synchronousPlayback: false,\n mount: undefined,\n heatmap: false,\n width: 512,\n points: [],\n filter: ()=>true,\n beforeEmit: ()=>true,\n beforeVisible: ()=>true,\n visible: true,\n emitter: true,\n maxLength: 200,\n lockTime: 5,\n theme: 'dark',\n OPACITY: {},\n FONT_SIZE: {},\n MARGIN: {},\n SPEED: {},\n COLOR: []\n };\n }\n // 配置校验\n static get scheme() {\n return {\n danmuku: 'array|function|string',\n speed: 'number',\n margin: 'array',\n opacity: 'number',\n color: 'string',\n mode: 'number',\n modes: 'array',\n fontSize: 'number|string',\n antiOverlap: 'boolean',\n synchronousPlayback: 'boolean',\n mount: '?htmldivelement|string',\n heatmap: 'object|boolean',\n width: 'number',\n points: 'array',\n filter: 'function',\n beforeEmit: 'function',\n beforeVisible: 'function',\n visible: 'boolean',\n emitter: 'boolean',\n maxLength: 'number',\n lockTime: 'number',\n theme: 'string',\n OPACITY: 'object',\n FONT_SIZE: 'object',\n MARGIN: 'object',\n SPEED: 'object',\n COLOR: 'array'\n };\n }\n // 初始弹幕样式\n static get cssText() {\n return `\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, \"Microsoft JhengHei\", Arial, Helvetica, sans-serif;\n 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;\n `;\n }\n // 是否在移动端使用了自动旋屏,会影响弹幕的left和top值\n get isRotate() {\n return this.art.plugins?.autoOrientation?.state;\n }\n // 计算上空白边距\n get marginTop() {\n const { clamp } = this.utils;\n const value = this.option.margin[0];\n const { clientHeight } = this.$player;\n if (typeof value === 'number') return clamp(value, 0, clientHeight);\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n return Danmuku.option.margin[0];\n }\n // 计算下空白边距\n get marginBottom() {\n const { clamp } = this.utils;\n const value = this.option.margin[1];\n const { clientHeight } = this.$player;\n if (typeof value === 'number') return clamp(value, 0, clientHeight);\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n return Danmuku.option.margin[1];\n }\n // 计算弹幕字体大小\n get fontSize() {\n const { clamp } = this.utils;\n const { clientHeight } = this.$player;\n const fontSize = this.option.fontSize;\n if (typeof fontSize === 'number') return Math.round(clamp(fontSize, 12, clientHeight));\n if (typeof fontSize === 'string' && fontSize.endsWith('%')) {\n const ratio = parseFloat(fontSize) / 100;\n return Math.round(clamp(clientHeight * ratio, 12, clientHeight));\n }\n return Danmuku.option.fontSize;\n }\n // 获取弹幕DOM节点\n get $ref() {\n const $ref = this.$refs.pop() || document.createElement('div');\n $ref.style.cssText = Danmuku.cssText;\n $ref.dataset.mode = '';\n $ref.className = '';\n return $ref;\n }\n // 获取准备好发送的弹幕\n get readys() {\n const { currentTime } = this.art;\n const result = [];\n // 有的是ready状态:之前因为弹幕太多而暂停发送的弹幕\n this.filter('ready', (danmu)=>result.push(danmu));\n // 有的是wait状态:符合时间范围的弹幕\n this.filter('wait', (danmu)=>{\n if (currentTime + 0.1 >= danmu.time && danmu.time >= currentTime - 0.1) result.push(danmu);\n });\n return result;\n }\n // 可见的弹幕的数据,用于计算下一个弹幕的top值\n get visibles() {\n const result = [];\n const { clientWidth } = this.$player;\n const clientLeft = this.getLeft(this.$player);\n this.filter('emit', (danmu)=>{\n const top = danmu.$ref.offsetTop;\n const left = this.getLeft(danmu.$ref) - clientLeft;\n const height = danmu.$ref.clientHeight;\n const width = danmu.$ref.clientWidth;\n const distance = left + width;\n const right = clientWidth - distance;\n const speed = distance / danmu.$restTime;\n const emit = {};\n emit.top = top;\n emit.left = left;\n emit.height = height;\n emit.width = width;\n emit.right = right;\n emit.speed = speed;\n emit.distance = distance;\n emit.time = danmu.$restTime;\n emit.mode = danmu.mode;\n result.push(emit);\n });\n return result;\n }\n // 计算弹幕速度\n get speed() {\n return this.option.synchronousPlayback && this.art.playbackRate ? this.option.speed / Number(this.art.playbackRate) : this.option.speed;\n }\n // 加载弹幕\n async load(danmuku) {\n const { errorHandle } = this.utils;\n let danmus = [];\n const target = danmuku || this.option.danmuku;\n try {\n if (typeof target === 'function') danmus = await target(); // 异步函数获取\n else if (target instanceof Promise) danmus = await target; // 从 Promise 对象获取\n else if (typeof target === 'string') danmus = await (0, _bilibili.bilibiliDanmuParseFromUrl)(target); // 从B站xml链接解析\n else if (Array.isArray(target)) danmus = target; // 直接传入数组\n errorHandle(Array.isArray(danmus), 'Danmuku need return an array as result');\n // 假如没有传入弹幕参数,则清空弹幕,否则追加弹幕\n if (danmuku === undefined) {\n this.reset(); // 重置弹幕\n this.queue = []; // 清空弹幕队列\n this.states = {\n wait: [],\n ready: [],\n emit: [],\n stop: []\n }; // 清空弹幕状态池\n this.$refs = []; // 清空弹幕DOM节点池\n this.$danmuku.innerText = ''; // 清空弹幕层\n }\n // 逐个验证原始弹幕并转换到弹幕队列\n for(let index = 0; index < danmus.length; index++){\n const danmu = danmus[index];\n await this.emit(danmu);\n }\n this.art.emit('artplayerPluginDanmuku:loaded', this.queue);\n } catch (error) {\n this.art.emit('artplayerPluginDanmuku:error', error);\n throw error;\n }\n return this;\n }\n // 把原始弹幕转换到弹幕队列\n async emit(danmu) {\n const { clamp } = this.utils;\n this.validator(danmu, {\n text: 'string',\n mode: '?number',\n color: '?string',\n time: '?number',\n border: '?boolean',\n style: '?object'\n });\n // 弹幕文本为空则直接忽略\n if (!danmu.text.trim()) return this;\n // 设置弹幕时间,如果没有则默认为当前时间加 0.5 秒\n if (danmu.time) danmu.time = clamp(danmu.time, 0, Infinity);\n else danmu.time = this.art.currentTime + 0.5;\n // 设置弹幕模式,如果没有则默认为全局配置\n if (danmu.mode === undefined) danmu.mode = this.option.mode;\n // 设置弹幕单独样式,如果没有则默认为空对象\n if (danmu.style === undefined) danmu.style = {};\n // 设置弹幕颜色,如果没有则默认为全局配置\n if (danmu.color === undefined) danmu.color = this.option.color;\n // 弹幕模式只能是 0, 1, 2\n if (![\n 0,\n 1,\n 2\n ].includes(danmu.mode)) return this;\n // 自定义弹幕过滤函数\n if (!this.option.filter(danmu)) return this;\n // 添加自定义属性\n const item = {\n ...danmu,\n $state: 'wait',\n $id: this.index++,\n $ref: null,\n $restTime: 0,\n $lastStartTime: 0\n };\n // 转换为wait状态\n this.setState(item, 'wait');\n // 添加到实际弹幕队列\n this.queue.push(item);\n // 弹幕有四个状态:\n // - wait: 弹幕还未开始显示,没有被添加到 DOM 中\n // - ready: 弹幕准备好显示,没有被添加到 DOM 中\n // - emit: 弹幕正在显示,已经被添加到 DOM 中\n // - stop: 弹幕正在停止显示,已经被添加到 DOM 中\n return this;\n }\n // 动态配置\n config(option) {\n const { clamp } = this.utils;\n const { $controlsCenter } = this.art.template;\n // 判断配置项是否有变化\n const changed = Object.keys(option).some((key)=>JSON.stringify(this.option[key]) !== JSON.stringify(option[key]));\n // 没有变化则直接返回\n if (!changed) return this;\n // 更新配置项\n this.option = Object.assign({}, Danmuku.option, this.option, option);\n this.validator(this.option, Danmuku.scheme);\n this.option.mode = clamp(this.option.mode, 0, 2);\n this.option.speed = clamp(this.option.speed, 1, 10);\n this.option.opacity = clamp(this.option.opacity, 0, 1);\n this.option.lockTime = clamp(this.option.lockTime, 1, 60);\n this.option.maxLength = clamp(this.option.maxLength, 1, 1000);\n this.option.mount = this.option.mount || $controlsCenter;\n // 动态配置有字体大小,需要重新渲染\n if (option.fontSize) this.reset();\n // 通过配置项控制弹幕的显示和隐藏\n if (this.option.visible) this.show();\n else this.hide();\n this.art.emit('artplayerPluginDanmuku:config', this.option);\n return this;\n }\n // 计算DOM的left值,受到旋屏影响\n getLeft($ref) {\n const rect = $ref.getBoundingClientRect();\n return this.isRotate ? rect.top : rect.left;\n }\n // 复杂运算交给 Web Worker 处理\n postMessage(message = {}) {\n return new Promise((resolve)=>{\n message.id = Date.now(); // 生成唯一标识\n this.worker.postMessage(message);\n this.worker.onmessage = (event)=>{\n const { data } = event;\n // 判断是否是当前的消息\n if (data.id === message.id) resolve(data);\n };\n });\n }\n // 根据状态获取弹幕\n filter(state, callback) {\n const danmus = this.states[state] || [];\n for(let index = 0; index < danmus.length; index++)callback(danmus[index]);\n return danmus;\n }\n // 设置弹幕状态\n setState(danmu, state) {\n // 从原状态池中删除\n this.states[danmu.$state] = this.states[danmu.$state].filter((item)=>item !== danmu);\n // 设置新状态\n danmu.$state = state;\n // 设置DOM节点状态\n if (danmu.$ref) danmu.$ref.dataset.state = state;\n // 添加到新状态池中\n this.states[state].push(danmu);\n }\n // 重置弹幕到wait状态,回收弹幕DOM节点\n makeWait(danmu) {\n this.setState(danmu, 'wait');\n if (danmu.$ref) {\n danmu.$ref.style.cssText = Danmuku.cssText;\n danmu.$ref.style.visibility = 'hidden';\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = 'translateX(0px)';\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n // 实时更新弹幕\n update() {\n const { setStyles } = this.utils;\n this.timer = window.requestAnimationFrame(async ()=>{\n if (this.art.playing && !this.isHide) {\n // 实时计算弹幕的剩余显示时间\n this.filter('emit', (danmu)=>{\n const emitTime = (Date.now() - danmu.$lastStartTime) / 1000;\n danmu.$restTime -= emitTime;\n danmu.$lastStartTime = Date.now();\n // 超过时间即重置弹幕\n if (danmu.$restTime <= 0) this.makeWait(danmu);\n });\n // 获取准备好发送的弹幕,可能包含ready和wait状态的弹幕\n const readys = this.readys;\n for(let index = 0; index < readys.length; index++){\n const danmu = readys[index];\n // 弹幕发送前的过滤器\n const state = await this.option.beforeVisible(danmu);\n if (state) {\n const { clientWidth, clientHeight } = this.$player;\n danmu.$ref = this.$ref; // 获取弹幕DOM节点\n danmu.$ref.innerText = danmu.text; // 设置弹幕文本\n // 提前添加到弹幕层中,用于计算top值\n this.$danmuku.appendChild(danmu.$ref);\n // 设置初始弹幕样式\n danmu.$ref.style.opacity = this.option.opacity;\n danmu.$ref.style.fontSize = `${this.fontSize}px`;\n danmu.$ref.style.color = danmu.color;\n danmu.$ref.style.border = danmu.border ? `1px solid ${danmu.color}` : null;\n danmu.$ref.style.backgroundColor = danmu.border ? 'rgb(0 0 0 / 50%)' : null;\n // 设置单独弹幕样式\n setStyles(danmu.$ref, danmu.style);\n // 记录弹幕时间戳\n danmu.$lastStartTime = Date.now();\n // 计算弹幕剩余时间\n danmu.$restTime = this.speed;\n // 计算弹幕滚动的距离\n const distance = clientWidth + danmu.$ref.clientWidth;\n // 计算弹幕的top值\n const { result: top } = await this.postMessage({\n type: 'getDanmuTop',\n target: {\n mode: danmu.mode,\n height: danmu.$ref.clientHeight,\n speed: distance / danmu.$restTime\n },\n visibles: this.visibles,\n antiOverlap: this.option.antiOverlap,\n clientWidth: clientWidth,\n clientHeight: clientHeight,\n marginBottom: this.marginBottom,\n marginTop: this.marginTop\n });\n if (danmu.$ref) {\n if (!this.isStop && top !== undefined) {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$ref.style.top = `${top}px`;\n danmu.$ref.style.visibility = 'visible';\n danmu.$ref.dataset.mode = danmu.mode; // CSS控制模式的显示和隐藏\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n case 1:\n // falls through\n case 2:\n danmu.$ref.style.left = '50%';\n danmu.$ref.style.marginLeft = `-${danmu.$ref.clientWidth / 2}px`;\n break;\n default:\n break;\n }\n this.art.emit('artplayerPluginDanmuku:visible', danmu);\n } else {\n // 假如弹幕已经停止或者没有 top 值,则重置弹幕为ready状态,回收弹幕DOM节点,等待下次发送\n this.setState(danmu, 'ready');\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n }\n }\n }\n // 递归调用\n if (!this.isStop) this.update();\n });\n return this;\n }\n // 重置正在显示的弹幕: stop/emit 状态的弹幕\n resize() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu)=>{\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n break;\n default:\n break;\n }\n });\n this.filter('emit', (danmu)=>{\n danmu.$lastStartTime = Date.now();\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n }\n // 继续弹幕\n continue() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu)=>{\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$lastStartTime = Date.now();\n switch(danmu.mode){\n // 继续滚动的弹幕\n case 0:\n {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n return this;\n }\n // 暂停弹幕\n suspend() {\n const { clientWidth } = this.$player;\n this.filter('emit', (danmu)=>{\n this.setState(danmu, 'stop'); // 转换为stop状态\n switch(danmu.mode){\n // 停止滚动的弹幕\n case 0:\n {\n const translateX = clientWidth - (this.getLeft(danmu.$ref) - this.getLeft(this.$player));\n danmu.$ref.style.transform = `translateX(${-translateX}px)`;\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n break;\n }\n default:\n break;\n }\n });\n return this;\n }\n stop() {\n this.isStop = true;\n this.suspend();\n window.cancelAnimationFrame(this.timer);\n this.art.emit('artplayerPluginDanmuku:stop');\n return this;\n }\n start() {\n this.isStop = false;\n this.continue();\n this.update();\n this.art.emit('artplayerPluginDanmuku:start');\n return this;\n }\n reset() {\n this.queue.forEach((danmu)=>this.makeWait(danmu));\n this.art.emit('artplayerPluginDanmuku:reset');\n return this;\n }\n show() {\n this.isHide = false;\n this.$danmuku.style.opacity = 1;\n this.option.visible = true;\n this.art.emit('artplayerPluginDanmuku:show');\n return this;\n }\n hide() {\n this.isHide = true;\n this.$danmuku.style.opacity = 0;\n this.option.visible = false;\n this.art.emit('artplayerPluginDanmuku:hide');\n return this;\n }\n destroy() {\n this.stop();\n this.worker.terminate();\n this.art.off('video:play', this.start);\n this.art.off('video:playing', this.start);\n this.art.off('video:pause', this.stop);\n this.art.off('video:waiting', this.stop);\n this.art.off('resize', this.reset);\n this.art.off('destroy', this.destroy);\n this.art.emit('artplayerPluginDanmuku:destroy');\n }\n}\nexports.default = Danmuku;\n\n},{\"./bilibili\":\"8WBpY\",\"bundle-text:./worker\":\"8UAYg\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"8WBpY\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"bilibiliDanmuParseFromUrl\", ()=>bilibiliDanmuParseFromUrl);\nfunction getMode(key) {\n switch(key){\n case 1:\n case 2:\n case 3:\n return 0;\n case 4:\n return 2;\n case 5:\n return 1;\n default:\n return 0;\n }\n}\nfunction bilibiliDanmuParseFromXml(xmlString) {\n if (typeof xmlString !== 'string') return [];\n const reg = new RegExp(/.+?)\"(?: .*?)?>(?.+?)<\\/d>/gs);\n const matches = xmlString.matchAll(reg);\n return Array.from(matches).map((match)=>{\n const attr = match.groups.p.split(',');\n if (attr.length >= 8) {\n const text = match.groups.text.trim().replaceAll('"', '\"').replaceAll(''', \"'\").replaceAll('<', '<').replaceAll('>', '>').replaceAll('&', '&');\n return {\n text,\n time: Number(attr[0]),\n mode: getMode(Number(attr[1])),\n fontSize: Number(attr[2]),\n color: `#${Number(attr[3]).toString(16)}`,\n timestamp: Number(attr[4]),\n pool: Number(attr[5]),\n userID: attr[6],\n rowID: Number(attr[7])\n };\n } else return null;\n }).filter(Boolean);\n}\nfunction onmessage({ data }) {\n const { xml, id } = data;\n if (!id || !xml) return;\n const danmus = bilibiliDanmuParseFromXml(xml);\n self.postMessage({\n danmus,\n id\n });\n}\nfunction createWorker() {\n const workerText = `\n ${getMode.toString()}\n ${bilibiliDanmuParseFromXml.toString()}\n onmessage = ${onmessage.toString()}\n `;\n const blob = new Blob([\n workerText\n ], {\n type: 'application/javascript'\n });\n return new Worker(URL.createObjectURL(blob));\n}\nfunction bilibiliDanmuParseFromUrl(url) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve)=>{\n const res = await fetch(url);\n const xml = await res.text();\n try {\n const worker = createWorker();\n worker.onmessage = (event)=>{\n const { danmus, id } = event.data;\n if (!id || !danmus) return;\n resolve(danmus);\n worker.terminate();\n };\n worker.postMessage({\n xml,\n id: Date.now()\n });\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n const danmus = bilibiliDanmuParseFromXml(xml);\n resolve(danmus);\n }\n });\n}\n\n},{\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"5lQoW\":[function(require,module,exports,__globalThis) {\nexports.interopDefault = function(a) {\n return a && a.__esModule ? a : {\n default: a\n };\n};\nexports.defineInteropFlag = function(a) {\n Object.defineProperty(a, '__esModule', {\n value: true\n });\n};\nexports.exportAll = function(source, dest) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return;\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function() {\n return source[key];\n }\n });\n });\n return dest;\n};\nexports.export = function(dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get\n });\n};\n\n},{}],\"8UAYg\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"!function(e,t,i,r,o,n,l,d){var f=\\\"undefined\\\"!=typeof globalThis?globalThis:\\\"undefined\\\"!=typeof self?self:\\\"undefined\\\"!=typeof window?window:\\\"undefined\\\"!=typeof global?global:{},u=\\\"function\\\"==typeof f[r]&&f[r],p=u.i||{},s=u.cache||{},h=\\\"undefined\\\"!=typeof module&&\\\"function\\\"==typeof module.require&&module.require.bind(module);function a(t,i){if(!s[t]){if(!e[t]){if(o[t])return o[t];var n=\\\"function\\\"==typeof f[r]&&f[r];if(!i&&n)return n(t,!0);if(u)return u(t,!0);if(h&&\\\"string\\\"==typeof t)return h(t);var l=Error(\\\"Cannot find module '\\\"+t+\\\"'\\\");throw l.code=\\\"MODULE_NOT_FOUND\\\",l}p.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},p.cache={};var d=s[t]=new a.Module(t);e[t][0].call(d.exports,p,d,d.exports,f)}return s[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=h,this.exports={}},a.modules=e,a.cache=s,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=p,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,\\\"root\\\",{get:function(){return f[r]}}),f[r]=a;for(var c=0;ct.mode===e.mode&&t.top<=d).sort((e,t)=>e.top-t.top);if(0===f.length)if(2===e.mode)return d-e.height;else return n;if(f.unshift({type:\\\"top\\\",top:0,left:0,right:0,height:n,width:i,speed:0,distance:i}),f.push({type:\\\"bottom\\\",top:d,left:0,right:0,height:o,width:i,speed:0,distance:i}),2===e.mode)for(let t=f.length-2;t>=0;t-=1){let i=f[t],r=f[t+1],o=i.top+i.height;if(r.top-o>=e.height)return r.top-e.height}else for(let t=1;t=e.height)return o}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),r=Math.min(...e.map(e=>e.right));return i*t.length-r*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},[\\\"4KwZ6\\\"],\\\"4KwZ6\\\",\\\"parcelRequire4dc0\\\",{});let{\\\"*\\\":e}=parcelRequire4dc0(\\\"4KwZ6\\\");export{e as default};\";\n\n},{}],\"90QKZ\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nvar _styleLess = require(\"bundle-text:./style.less\");\nvar _styleLessDefault = parcelHelpers.interopDefault(_styleLess);\nvar _onSvg = require(\"bundle-text:./img/on.svg\");\nvar _onSvgDefault = parcelHelpers.interopDefault(_onSvg);\nvar _offSvg = require(\"bundle-text:./img/off.svg\");\nvar _offSvgDefault = parcelHelpers.interopDefault(_offSvg);\nvar _configSvg = require(\"bundle-text:./img/config.svg\");\nvar _configSvgDefault = parcelHelpers.interopDefault(_configSvg);\nvar _styleSvg = require(\"bundle-text:./img/style.svg\");\nvar _styleSvgDefault = parcelHelpers.interopDefault(_styleSvg);\nvar _mode0OffSvg = require(\"bundle-text:./img/mode_0_off.svg\");\nvar _mode0OffSvgDefault = parcelHelpers.interopDefault(_mode0OffSvg);\nvar _mode0OnSvg = require(\"bundle-text:./img/mode_0_on.svg\");\nvar _mode0OnSvgDefault = parcelHelpers.interopDefault(_mode0OnSvg);\nvar _mode1OffSvg = require(\"bundle-text:./img/mode_1_off.svg\");\nvar _mode1OffSvgDefault = parcelHelpers.interopDefault(_mode1OffSvg);\nvar _mode1OnSvg = require(\"bundle-text:./img/mode_1_on.svg\");\nvar _mode1OnSvgDefault = parcelHelpers.interopDefault(_mode1OnSvg);\nvar _mode2OffSvg = require(\"bundle-text:./img/mode_2_off.svg\");\nvar _mode2OffSvgDefault = parcelHelpers.interopDefault(_mode2OffSvg);\nvar _mode2OnSvg = require(\"bundle-text:./img/mode_2_on.svg\");\nvar _mode2OnSvgDefault = parcelHelpers.interopDefault(_mode2OnSvg);\nvar _checkOnSvg = require(\"bundle-text:./img/check_on.svg\");\nvar _checkOnSvgDefault = parcelHelpers.interopDefault(_checkOnSvg);\nvar _checkOffSvg = require(\"bundle-text:./img/check_off.svg\");\nvar _checkOffSvgDefault = parcelHelpers.interopDefault(_checkOffSvg);\nclass Setting {\n constructor(art, danmuku){\n this.art = art;\n this.danmuku = danmuku;\n this.utils = art.constructor.utils;\n const { setStyle } = this.utils;\n const { $controlsCenter } = art.template;\n setStyle($controlsCenter, 'display', 'flex');\n this.template = {\n $controlsCenter,\n $mount: $controlsCenter,\n $danmuku: null,\n $toggle: null,\n $config: null,\n $configPanel: null,\n $configModes: null,\n $style: null,\n $stylePanel: null,\n $styleModes: null,\n $colors: null,\n $opacitySlider: null,\n $opacityValue: null,\n $marginSlider: null,\n $marginValue: null,\n $fontSizeSlider: null,\n $fontSizeValue: null,\n $speedSlider: null,\n $speedValue: null,\n $input: null,\n $send: null\n };\n this.slider = {\n opacity: null,\n margin: null,\n fontSize: null,\n speed: null\n };\n this.emitting = false;\n this.isLock = false;\n this.timer = null;\n this.createTemplate();\n this.createSliders();\n this.createEvents();\n this.mount(this.option.mount);\n art.on('resize', ()=>this.resize());\n art.on('fullscreen', (state)=>this.onFullscreen(state));\n art.on('fullscreenWeb', (state)=>this.onFullscreen(state));\n art.proxy(this.template.$config, 'mouseenter', ()=>{\n this.onMouseEnter({\n $control: this.template.$config,\n $panel: this.template.$configPanel\n });\n });\n art.proxy(this.template.$style, 'mouseenter', ()=>{\n this.onMouseEnter({\n $control: this.template.$style,\n $panel: this.template.$stylePanel\n });\n });\n }\n static get icons() {\n return {\n $on: (0, _onSvgDefault.default),\n $off: (0, _offSvgDefault.default),\n $config: (0, _configSvgDefault.default),\n $style: (0, _styleSvgDefault.default),\n $mode_0_off: (0, _mode0OffSvgDefault.default),\n $mode_0_on: (0, _mode0OnSvgDefault.default),\n $mode_1_off: (0, _mode1OffSvgDefault.default),\n $mode_1_on: (0, _mode1OnSvgDefault.default),\n $mode_2_off: (0, _mode2OffSvgDefault.default),\n $mode_2_on: (0, _mode2OnSvgDefault.default),\n $check_on: (0, _checkOnSvgDefault.default),\n $check_off: (0, _checkOffSvgDefault.default)\n };\n }\n get option() {\n return this.danmuku.option;\n }\n get outside() {\n return this.template.$mount !== this.template.$controlsCenter;\n }\n get TEMPLATE() {\n const { option } = this;\n return `\n
\n ${0, _onSvgDefault.default}${0, _offSvgDefault.default}\n
\n
\n ${0, _configSvgDefault.default}\n
\n
\n
\n \\u{6309}\\u{7C7B}\\u{578B}\\u{5C4F}\\u{853D}\n
\n
\n ${0, _mode0OffSvgDefault.default}${0, _mode0OnSvgDefault.default}\n
\\u{6EDA}\\u{52A8}
\n
\n
\n ${0, _mode1OffSvgDefault.default}${0, _mode1OnSvgDefault.default}\n
\\u{9876}\\u{90E8}
\n
\n
\n ${0, _mode2OffSvgDefault.default}${0, _mode2OnSvgDefault.default}\n
\\u{5E95}\\u{90E8}
\n
\n
\n
\n
\n
\n ${0, _checkOnSvgDefault.default}${0, _checkOffSvgDefault.default}\n \\u{9632}\\u{6B62}\\u{5F39}\\u{5E55}\\u{91CD}\\u{53E0}\n
\n
\n ${0, _checkOnSvgDefault.default}${0, _checkOffSvgDefault.default}\n \\u{540C}\\u{6B65}\\u{89C6}\\u{9891}\\u{901F}\\u{5EA6}\n
\n
\n
\n \\u{4E0D}\\u{900F}\\u{660E}\\u{5EA6}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{663E}\\u{793A}\\u{533A}\\u{57DF}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{5F39}\\u{5E55}\\u{5B57}\\u{53F7}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{5F39}\\u{5E55}\\u{901F}\\u{5EA6}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n
\n
\n
\n
\n ${0, _styleSvgDefault.default}\n
\n
\n
\n \\u{6A21}\\u{5F0F}\n
\n
\n ${0, _mode0OnSvgDefault.default}\n
\\u{6EDA}\\u{52A8}
\n
\n
\n ${0, _mode1OnSvgDefault.default}\n
\\u{9876}\\u{90E8}
\n
\n
\n ${0, _mode2OnSvgDefault.default}\n
\\u{5E95}\\u{90E8}
\n
\n
\n
\n
\n \\u{989C}\\u{8272}\n
\n ${this.COLOR.map((color)=>`
`).join('')}\n
\n
\n
\n
\n
\n \n
\\u{53D1}\\u{9001}
\n
\n `;\n }\n get OPACITY() {\n return {\n min: 0,\n max: 100,\n steps: [],\n ...this.option.OPACITY\n };\n }\n get FONT_SIZE() {\n return {\n min: 12,\n max: 120,\n steps: [],\n ...this.option.FONT_SIZE\n };\n }\n get MARGIN() {\n return {\n min: 0,\n max: 3,\n steps: [\n {\n name: '1/4',\n value: [\n 10,\n '75%'\n ]\n },\n {\n name: \"\\u534A\\u5C4F\",\n value: [\n 10,\n '50%'\n ]\n },\n {\n name: '3/4',\n value: [\n 10,\n '25%'\n ]\n },\n {\n name: \"\\u6EE1\\u5C4F\",\n value: [\n 10,\n 10\n ]\n }\n ],\n ...this.option.MARGIN\n };\n }\n get SPEED() {\n return {\n min: 0,\n max: 4,\n steps: [\n {\n name: \"\\u6781\\u6162\",\n value: 10\n },\n {\n name: \"\\u8F83\\u6162\",\n value: 7.5,\n hide: true\n },\n {\n name: \"\\u9002\\u4E2D\",\n value: 5\n },\n {\n name: \"\\u8F83\\u5FEB\",\n value: 2.5,\n hide: true\n },\n {\n name: \"\\u6781\\u5FEB\",\n value: 1\n }\n ],\n ...this.option.SPEED\n };\n }\n get COLOR() {\n return this.option.COLOR.length ? this.option.COLOR : [\n '#FE0302',\n '#FF7204',\n '#FFAA02',\n '#FFD302',\n '#FFFF00',\n '#A0EE00',\n '#00CD00',\n '#019899',\n '#4266BE',\n '#89D5FF',\n '#CC0273',\n '#222222',\n '#9B9B9B',\n '#FFFFFF'\n ];\n }\n query(selector) {\n const { query } = this.utils;\n const { $danmuku } = this.template;\n return query(selector, $danmuku);\n }\n append(el, target) {\n const { append } = this.utils;\n const children = [\n ...el.children\n ];\n if (children.some((item)=>item === target)) return;\n append(el, target);\n }\n setData(key, value) {\n const { $player } = this.art.template;\n const { $mount } = this.template;\n $player.dataset[key] = value;\n if (this.outside) $mount.dataset[key] = value;\n }\n createTemplate() {\n const { createElement, tooltip } = this.utils;\n const $danmuku = createElement('div');\n $danmuku.className = 'artplayer-plugin-danmuku';\n $danmuku.innerHTML = this.TEMPLATE;\n this.template.$danmuku = $danmuku;\n this.template.$toggle = this.query('.apd-toggle');\n this.template.$config = this.query('.apd-config');\n this.template.$configPanel = this.query('.apd-config-panel');\n this.template.$configModes = this.query('.apd-config-mode .apd-modes');\n this.template.$style = this.query('.apd-style');\n this.template.$stylePanel = this.query('.apd-style-panel');\n this.template.$styleModes = this.query('.apd-style-mode .apd-modes');\n this.template.$colors = this.query('.apd-colors');\n this.template.$antiOverlap = this.query('.apd-anti-overlap');\n this.template.$syncVideo = this.query('.apd-sync-video');\n this.template.$opacitySlider = this.query('.apd-config-opacity .apd-slider');\n this.template.$opacityValue = this.query('.apd-config-opacity .apd-value');\n this.template.$marginSlider = this.query('.apd-config-margin .apd-slider');\n this.template.$marginValue = this.query('.apd-config-margin .apd-value');\n this.template.$fontSizeSlider = this.query('.apd-config-fontSize .apd-slider');\n this.template.$fontSizeValue = this.query('.apd-config-fontSize .apd-value');\n this.template.$speedSlider = this.query('.apd-config-speed .apd-slider');\n this.template.$speedValue = this.query('.apd-config-speed .apd-value');\n this.template.$input = this.query('.apd-input');\n this.template.$send = this.query('.apd-send');\n const { $toggle } = this.template;\n this.art.on('artplayerPluginDanmuku:show', ()=>{\n tooltip($toggle, \"\\u5173\\u95ED\\u5F39\\u5E55\");\n });\n this.art.on('artplayerPluginDanmuku:hide', ()=>{\n tooltip($toggle, \"\\u6253\\u5F00\\u5F39\\u5E55\");\n });\n }\n createEvents() {\n const { $toggle, $configModes, $styleModes, $colors, $antiOverlap, $syncVideo, $send, $input } = this.template;\n this.art.proxy($toggle, 'click', ()=>{\n this.danmuku.config({\n visible: !this.option.visible\n });\n this.reset();\n });\n this.art.proxy($configModes, 'click', (event)=>{\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n if (this.option.modes.includes(mode)) this.danmuku.config({\n modes: this.option.modes.filter((m)=>m !== mode)\n });\n else this.danmuku.config({\n modes: [\n ...this.option.modes,\n mode\n ]\n });\n this.reset();\n });\n this.art.proxy($antiOverlap, 'click', ()=>{\n this.danmuku.config({\n antiOverlap: !this.option.antiOverlap\n });\n this.reset();\n });\n this.art.proxy($syncVideo, 'click', ()=>{\n this.danmuku.config({\n synchronousPlayback: !this.option.synchronousPlayback\n });\n this.reset();\n });\n this.art.proxy($styleModes, 'click', (event)=>{\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n this.danmuku.config({\n mode: mode\n });\n this.reset();\n });\n this.art.proxy($colors, 'click', (event)=>{\n const $color = event.target.closest('.apd-color');\n if (!$color) return;\n this.danmuku.config({\n color: $color.dataset.color\n });\n this.reset();\n });\n this.art.proxy($send, 'click', ()=>this.emit());\n this.art.proxy($input, 'keypress', (event)=>{\n if (event.key === 'Enter') {\n event.preventDefault();\n this.emit();\n }\n });\n }\n createSliders() {\n this.slider.opacity = this.createSlider({\n ...this.OPACITY,\n container: this.template.$opacitySlider,\n findIndex: ()=>{\n return Math.round(this.option.opacity * 100);\n },\n onChange: (index)=>{\n const { $opacityValue } = this.template;\n $opacityValue.textContent = `${index}%`;\n this.danmuku.config({\n opacity: index / 100\n });\n }\n });\n this.slider.margin = this.createSlider({\n ...this.MARGIN,\n container: this.template.$marginSlider,\n findIndex: ()=>{\n return this.MARGIN.steps.findIndex((item)=>item.value[0] === this.option.margin[0] && item.value[1] === this.option.margin[1]);\n },\n onChange: (index)=>{\n const margin = this.MARGIN.steps[index];\n if (!margin) return;\n const { $marginValue } = this.template;\n $marginValue.textContent = margin.name;\n this.danmuku.config({\n margin: margin.value\n });\n }\n });\n this.slider.fontSize = this.createSlider({\n ...this.FONT_SIZE,\n container: this.template.$fontSizeSlider,\n findIndex: ()=>{\n return this.danmuku.fontSize;\n },\n onChange: (index)=>{\n const { $fontSizeValue } = this.template;\n $fontSizeValue.textContent = `${index}px`;\n if (index === this.danmuku.fontSize) return;\n this.danmuku.config({\n fontSize: index\n });\n }\n });\n this.slider.speed = this.createSlider({\n ...this.SPEED,\n container: this.template.$speedSlider,\n findIndex: ()=>{\n return this.SPEED.steps.findIndex((item)=>item.value === this.option.speed);\n },\n onChange: (index)=>{\n const speed = this.SPEED.steps[index];\n if (!speed) return;\n const { $speedValue } = this.template;\n $speedValue.textContent = speed.name;\n this.danmuku.config({\n speed: speed.value\n });\n }\n });\n }\n createSlider({ min, max, container, findIndex, onChange, steps = [] }) {\n const { query, clamp, setStyle } = this.utils;\n setStyle(container, 'touch-action', 'none');\n container.innerHTML = `\n
\n
\n ${steps.map(()=>`
`).join('')}\n
\n
\n
\n
\n
\n ${steps.map((step)=>step.hide ? '' : `
${step.name}
`).join('')}\n
\n `;\n const $dot = query('.apd-slider-dot', container);\n const $progress = query('.apd-slider-progress', container);\n let isDroging = false;\n function reset(index = findIndex()) {\n if (index < min || index > max) return;\n const percentage = (index - min) / (max - min);\n $dot.style.left = `${percentage * 100}%`;\n if (steps.length === 0) $progress.style.width = $dot.style.left;\n onChange(index);\n }\n function updateLeft(event) {\n const { top, height, left, width } = container.getBoundingClientRect();\n if (this.art.isRotate) {\n const value = clamp(event.clientY - top, 0, height);\n const index = Math.round(value / height * (max - min) + min);\n reset(index);\n } else {\n const value = clamp(event.clientX - left, 0, width);\n const index = Math.round(value / width * (max - min) + min);\n reset(index);\n }\n }\n this.art.proxy(container, 'click', (event)=>{\n updateLeft.call(this, event);\n });\n this.art.proxy(container, 'pointerdown', (event)=>{\n isDroging = event.button === 0;\n });\n this.art.proxy(document, 'pointermove', (event)=>{\n if (isDroging) updateLeft.call(this, event);\n });\n this.art.proxy(document, 'pointerup', (event)=>{\n if (isDroging) {\n isDroging = false;\n updateLeft.call(this, event);\n }\n });\n return {\n reset\n };\n }\n onFullscreen(state) {\n const { $danmuku, $controlsCenter, $mount } = this.template;\n if (this.outside) {\n if (state) this.append($controlsCenter, $danmuku);\n else this.append($mount, $danmuku);\n } else this.append($controlsCenter, $danmuku);\n }\n onMouseEnter({ $control, $panel }) {\n const { $player } = this.art.template;\n const controlRect = $control.getBoundingClientRect();\n const panelRect = $panel.getBoundingClientRect();\n const playerRect = $player.getBoundingClientRect();\n const half = panelRect.width / 2 - controlRect.width / 2;\n const left = playerRect.left - (controlRect.left - half);\n const right = controlRect.right + half - playerRect.right;\n if (left > 0) $panel.style.left = `${-half + left}px`;\n else if (right > 0) $panel.style.left = `${-half - right}px`;\n else $panel.style.left = `${-half}px`;\n }\n async emit() {\n const { $input } = this.template;\n const text = $input.value.trim();\n if (!text.length) return;\n if (this.isLock) return;\n if (this.emitting) return;\n const danmu = {\n text: text,\n mode: this.option.mode,\n color: this.option.color,\n time: this.art.currentTime\n };\n try {\n this.emitting = true;\n const state = await this.option.beforeEmit(danmu);\n this.emitting = false;\n if (state !== true) return;\n danmu.border = true;\n delete danmu.time;\n this.danmuku.emit(danmu);\n $input.value = '';\n this.lock();\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n this.emitting = false;\n }\n }\n lock() {\n const { addClass } = this.utils;\n const { $send } = this.template;\n this.isLock = true;\n let time = this.option.lockTime;\n $send.innerText = time;\n addClass($send, 'apd-lock');\n const loop = ()=>{\n this.timer = setTimeout(()=>{\n if (time === 0) this.unlock();\n else {\n time -= 1;\n $send.innerText = time;\n loop();\n }\n }, 1000);\n };\n loop();\n }\n unlock() {\n const { removeClass } = this.utils;\n const { $send } = this.template;\n clearTimeout(this.timer);\n this.isLock = false;\n $send.innerText = \"\\u53D1\\u9001\";\n removeClass($send, 'apd-lock');\n }\n resize() {\n if (this.outside) return;\n if (this.art.fullscreen) return;\n if (this.art.fullscreenWeb) return;\n const { $player, $controlsCenter } = this.art.template;\n const { $danmuku } = this.template;\n if (this.art.width < this.option.width) this.append($player, $danmuku);\n else this.append($controlsCenter, $danmuku);\n }\n reset() {\n const { inverseClass, tooltip } = this.utils;\n const { $toggle, $colors } = this.template;\n this.slider.opacity.reset();\n this.slider.margin.reset();\n this.slider.fontSize.reset();\n this.slider.speed.reset();\n this.setData('danmukuVisible', this.option.visible);\n this.setData('danmukuMode', this.option.mode);\n this.setData('danmukuColor', this.option.color);\n this.setData('danmukuMode0', this.option.modes.includes(0));\n this.setData('danmukuMode1', this.option.modes.includes(1));\n this.setData('danmukuMode2', this.option.modes.includes(2));\n this.setData('danmukuAntiOverlap', this.option.antiOverlap);\n this.setData('danmukuSyncVideo', this.option.synchronousPlayback);\n this.setData('danmukuTheme', this.option.theme);\n this.setData('danmukuEmitter', this.option.emitter);\n const colors = $colors.children;\n const $color = Array.from(colors).find((item)=>item.dataset.color === this.option.color.toUpperCase());\n $color && inverseClass($color, 'apd-active');\n tooltip($toggle, this.option.visible ? \"\\u5173\\u95ED\\u5F39\\u5E55\" : \"\\u6253\\u5F00\\u5F39\\u5E55\");\n this.resize();\n }\n mount(target) {\n const { errorHandle } = this.utils;\n const $el = typeof target === 'string' ? document.querySelector(target) : target;\n errorHandle($el, `Can not find the mount point: ${target}`);\n this.append($el, this.template.$danmuku);\n this.template.$mount = $el;\n this.reset();\n }\n}\nexports.default = Setting;\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-danmuku';\n let $style = document.getElementById(id);\n if (!$style) {\n $style = document.createElement('style');\n $style.id = id;\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', ()=>{\n document.head.appendChild($style);\n });\n else (document.head || document.documentElement).appendChild($style);\n }\n $style.textContent = (0, _styleLessDefault.default);\n}\n\n},{\"bundle-text:./style.less\":\"dHTK8\",\"bundle-text:./img/on.svg\":\"5XkVj\",\"bundle-text:./img/off.svg\":\"3WiJz\",\"bundle-text:./img/config.svg\":\"DK7bp\",\"bundle-text:./img/style.svg\":\"h2xX3\",\"bundle-text:./img/mode_0_off.svg\":\"fp5qd\",\"bundle-text:./img/mode_0_on.svg\":\"fYNQe\",\"bundle-text:./img/mode_1_off.svg\":\"gQMgY\",\"bundle-text:./img/mode_1_on.svg\":\"5E8Hg\",\"bundle-text:./img/mode_2_off.svg\":\"89iSb\",\"bundle-text:./img/mode_2_on.svg\":\"2YEb0\",\"bundle-text:./img/check_on.svg\":\"iQql8\",\"bundle-text:./img/check_off.svg\":\"4tC1X\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"dHTK8\":[function(require,module,exports,__globalThis) {\nmodule.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}\";\n\n},{}],\"5XkVj\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"3WiJz\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"DK7bp\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"h2xX3\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"fp5qd\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"fYNQe\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"gQMgY\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"5E8Hg\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"89iSb\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"2YEb0\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"iQql8\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"4tC1X\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"h2ayY\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>heatmap);\nconst lib = {\n map (value, inMin, inMax, outMin, outMax) {\n return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n },\n range (start, end, tick) {\n const s = Math.round(start / tick) * tick;\n return Array.from({\n length: Math.floor((end - start) / tick)\n }, (v, k)=>{\n return k * tick + s;\n });\n }\n};\nconst line = (pointA, pointB)=>{\n const lengthX = pointB[0] - pointA[0];\n const lengthY = pointB[1] - pointA[1];\n return {\n length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),\n angle: Math.atan2(lengthY, lengthX)\n };\n};\nfunction heatmap(art, danmuku, option) {\n const { query } = art.constructor.utils;\n art.controls.add({\n name: 'heatmap',\n position: 'top',\n html: '',\n style: {\n position: 'absolute',\n top: '-100px',\n left: '0px',\n right: '0px',\n height: '100px',\n width: '100%',\n pointerEvents: 'none'\n },\n mounted ($heatmap) {\n let $start = null;\n let $stop = null;\n function update(arg = []) {\n $start = null;\n $stop = null;\n $heatmap.innerHTML = '';\n if (!art.duration || art.option.isLive) return;\n const svg = {\n w: $heatmap.offsetWidth,\n h: $heatmap.offsetHeight\n };\n const options = {\n xMin: 0,\n xMax: svg.w,\n yMin: 0,\n yMax: 128,\n scale: 0.25,\n opacity: 0.2,\n minHeight: Math.floor(svg.h * 0.05),\n sampling: Math.floor(svg.w / 100),\n smoothing: 0.2,\n flattening: 0.2\n };\n if (typeof option === 'object') Object.assign(options, option);\n let points = [];\n if (Array.isArray(arg) && arg.length) points = [\n ...arg\n ];\n else {\n const gap = art.duration / svg.w;\n for(let x = 0; x <= svg.w; x += options.sampling){\n const y = danmuku.queue.filter(({ time })=>time > x * gap && time <= (x + options.sampling) * gap).length;\n points.push([\n x,\n y\n ]);\n }\n }\n if (points.length === 0) return;\n const lastPoint = points[points.length - 1];\n const lastX = lastPoint[0];\n const lastY = lastPoint[1];\n if (lastX !== svg.w) points.push([\n svg.w,\n lastY\n ]);\n const yPoints = points.map((point)=>point[1]);\n const yMin = Math.min(...yPoints);\n const yMax = Math.max(...yPoints);\n const yMid = (yMin + yMax) / 2;\n for(let i = 0; i < points.length; i++){\n const point = points[i];\n const y = point[1];\n point[1] = y * (y > yMid ? 1 + options.scale : 1 - options.scale) + options.minHeight;\n }\n const controlPoint = (current, previous, next, reverse)=>{\n const p = previous || current;\n const n = next || current;\n const o = line(p, n);\n const flat = lib.map(Math.cos(o.angle) * options.flattening, 0, 1, 1, 0);\n const angle = o.angle * flat + (reverse ? Math.PI : 0);\n const length = o.length * options.smoothing;\n const x = current[0] + Math.cos(angle) * length;\n const y = current[1] + Math.sin(angle) * length;\n return [\n x,\n y\n ];\n };\n const bezierCommand = (point, i, a)=>{\n const cps = controlPoint(a[i - 1], a[i - 2], point);\n const cpe = controlPoint(point, a[i - 1], a[i + 1], true);\n const close = i === a.length - 1 ? ' z' : '';\n return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}${close}`;\n };\n const pointsPositions = points.map((e)=>{\n const x = lib.map(e[0], options.xMin, options.xMax, 0, svg.w);\n const y = lib.map(e[1], options.yMin, options.yMax, svg.h, 0);\n return [\n x,\n y\n ];\n });\n const pathD = pointsPositions.reduce((acc, e, i, a)=>i === 0 ? `M ${a[a.length - 1][0]},${svg.h} L ${e[0]},${svg.h} L ${e[0]},${e[1]}` : `${acc} ${bezierCommand(e, i, a)}`, '');\n $heatmap.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n `;\n $start = query('#heatmap-start', $heatmap);\n $stop = query('#heatmap-stop', $heatmap);\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n art.on('video:timeupdate', ()=>{\n if ($start && $stop) {\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n });\n art.on('setBar', (type, percentage)=>{\n if ($start && $stop && type === 'played') {\n $start.setAttribute('offset', `${percentage * 100}%`);\n $stop.setAttribute('offset', `${percentage * 100}%`);\n }\n });\n art.on('ready', ()=>update());\n art.on('resize', ()=>update());\n art.on('artplayerPluginDanmuku:loaded', ()=>update());\n art.on('artplayerPluginDanmuku:points', (points)=>update(points));\n }\n });\n}\n\n},{\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}]},[\"6ZbtA\"], \"6ZbtA\", \"parcelRequire4dc0\", {})\nlet {default: _default, } = parcelRequire4dc0(\"6ZbtA\");\nexport {_default as default, };\n\n//# sourceMappingURL=index.js.map\n","import Danmuku from './danmuku';\nimport Setting from './setting';\nimport heatmap from './heatmap';\n\nexport default function artplayerPluginDanmuku(option) {\n return (art) => {\n const danmuku = new Danmuku(art, option);\n const setting = new Setting(art, danmuku);\n\n if (danmuku.option.heatmap) {\n heatmap(art, danmuku, danmuku.option.heatmap);\n }\n\n return {\n name: 'artplayerPluginDanmuku',\n emit: danmuku.emit.bind(danmuku),\n load: danmuku.load.bind(danmuku),\n config: danmuku.config.bind(danmuku),\n hide: danmuku.hide.bind(danmuku),\n show: danmuku.show.bind(danmuku),\n reset: danmuku.reset.bind(danmuku),\n mount: setting.mount.bind(setting),\n get option() {\n return danmuku.option;\n },\n get isHide() {\n return danmuku.isHide;\n },\n get isStop() {\n return danmuku.isStop;\n },\n };\n };\n}\n\nartplayerPluginDanmuku.icons = Setting.icons;\n\nif (typeof window !== 'undefined') {\n window['artplayerPluginDanmuku'] = artplayerPluginDanmuku;\n}\n","import { bilibiliDanmuParseFromUrl } from './bilibili';\nimport workerText from 'bundle-text:./worker';\n\nexport default class Danmuku {\n constructor(art, option) {\n const { constructor, template } = art;\n\n this.utils = constructor.utils; // 工具库\n this.validator = constructor.validator; // 配置校验器\n this.$danmuku = template.$danmuku; // 弹幕层容器\n this.$player = template.$player; // 播放器容器\n\n this.art = art;\n this.queue = []; // 实际弹幕队列\n this.$refs = []; // 弹幕DOM节点池\n this.isStop = false; // 是否停止\n this.isHide = false; // 是否隐藏\n this.timer = null; // 定时器\n this.index = 0; // 弹幕索引\n\n // 格式化后的配置项\n this.option = Danmuku.option;\n\n // 弹幕状态池\n this.states = { wait: [], ready: [], emit: [], stop: [] };\n\n // 初始化配置\n this.config(option);\n\n // 创建 Web Worker, 用于计算弹幕的 top 值\n const workerText2 = workerText.replace('export{e as default};', '');\n const blob = new Blob([workerText2], { type: 'application/javascript' });\n this.worker = new Worker(URL.createObjectURL(blob));\n\n // 绑定公用事件\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.reset = this.reset.bind(this);\n this.resize = this.resize.bind(this);\n this.destroy = this.destroy.bind(this);\n\n // 监听事件\n art.on('video:play', this.start);\n art.on('video:playing', this.start);\n art.on('video:pause', this.stop);\n art.on('video:waiting', this.stop);\n art.on('destroy', this.destroy);\n art.on('resize', this.resize);\n\n // 开始加载弹幕\n this.load();\n }\n\n // 默认配置\n static get option() {\n return {\n danmuku: [], // 弹幕数据\n speed: 5, // 弹幕持续时间,范围在[1 ~ 10]\n margin: [10, '25%'], // 弹幕上下边距,支持像素数字和百分比\n opacity: 1, // 弹幕透明度,范围在[0 ~ 1]\n color: '#FFFFFF', // 默认弹幕颜色,可以被单独弹幕项覆盖\n mode: 0, // 默认弹幕模式: 0: 滚动,1: 顶部,2: 底部\n modes: [0, 1, 2], // 弹幕可见的模式\n fontSize: 25, // 弹幕字体大小,支持像素数字和百分比\n antiOverlap: true, // 弹幕是否防重叠\n synchronousPlayback: false, // 是否同步播放速度\n mount: undefined, // 弹幕发射器挂载点, 默认为播放器控制栏中部\n heatmap: false, // 是否开启热力图\n width: 512, // 当播放器宽度小于此值时,弹幕发射器置于播放器底部\n points: [], // 热力图数据\n filter: () => true, // 弹幕载入前的过滤器,只支持返回布尔值\n beforeEmit: () => true, // 弹幕发送前的过滤器,支持返回 Promise\n beforeVisible: () => true, // 弹幕显示前的过滤器,支持返回 Promise\n visible: true, // 弹幕层是否可见\n emitter: true, // 是否开启弹幕发射器\n maxLength: 200, // 弹幕输入框最大长度, 范围在[1 ~ 1000]\n lockTime: 5, // 输入框锁定时间,范围在[1 ~ 60]\n theme: 'dark', // 弹幕主题,支持 dark 和 light,只在自定义挂载时生效\n OPACITY: {}, // 不透明度配置项\n FONT_SIZE: {}, // 弹幕字号配置项\n MARGIN: {}, // 显示区域配置项\n SPEED: {}, // 弹幕速度配置项\n COLOR: [], // 颜色列表配置项\n };\n }\n\n // 配置校验\n static get scheme() {\n return {\n danmuku: 'array|function|string',\n speed: 'number',\n margin: 'array',\n opacity: 'number',\n color: 'string',\n mode: 'number',\n modes: 'array',\n fontSize: 'number|string',\n antiOverlap: 'boolean',\n synchronousPlayback: 'boolean',\n mount: '?htmldivelement|string',\n heatmap: 'object|boolean',\n width: 'number',\n points: 'array',\n filter: 'function',\n beforeEmit: 'function',\n beforeVisible: 'function',\n visible: 'boolean',\n emitter: 'boolean',\n maxLength: 'number',\n lockTime: 'number',\n theme: 'string',\n OPACITY: 'object',\n FONT_SIZE: 'object',\n MARGIN: 'object',\n SPEED: 'object',\n COLOR: 'array',\n };\n }\n\n // 初始弹幕样式\n static get cssText() {\n return `\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, \"Microsoft JhengHei\", Arial, Helvetica, sans-serif;\n 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;\n `;\n }\n\n // 是否在移动端使用了自动旋屏,会影响弹幕的left和top值\n get isRotate() {\n return this.art.plugins?.autoOrientation?.state;\n }\n\n // 计算上空白边距\n get marginTop() {\n const { clamp } = this.utils;\n const value = this.option.margin[0];\n const { clientHeight } = this.$player;\n\n if (typeof value === 'number') {\n return clamp(value, 0, clientHeight);\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n\n return Danmuku.option.margin[0];\n }\n\n // 计算下空白边距\n get marginBottom() {\n const { clamp } = this.utils;\n const value = this.option.margin[1];\n const { clientHeight } = this.$player;\n\n if (typeof value === 'number') {\n return clamp(value, 0, clientHeight);\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n\n return Danmuku.option.margin[1];\n }\n\n // 计算弹幕字体大小\n get fontSize() {\n const { clamp } = this.utils;\n const { clientHeight } = this.$player;\n\n const fontSize = this.option.fontSize;\n\n if (typeof fontSize === 'number') {\n return Math.round(clamp(fontSize, 12, clientHeight));\n }\n\n if (typeof fontSize === 'string' && fontSize.endsWith('%')) {\n const ratio = parseFloat(fontSize) / 100;\n return Math.round(clamp(clientHeight * ratio, 12, clientHeight));\n }\n\n return Danmuku.option.fontSize;\n }\n\n // 获取弹幕DOM节点\n get $ref() {\n const $ref = this.$refs.pop() || document.createElement('div');\n $ref.style.cssText = Danmuku.cssText;\n $ref.dataset.mode = '';\n $ref.className = '';\n return $ref;\n }\n\n // 获取准备好发送的弹幕\n get readys() {\n const { currentTime } = this.art;\n\n const result = [];\n\n // 有的是ready状态:之前因为弹幕太多而暂停发送的弹幕\n this.filter('ready', (danmu) => result.push(danmu));\n\n // 有的是wait状态:符合时间范围的弹幕\n this.filter('wait', (danmu) => {\n if (currentTime + 0.1 >= danmu.time && danmu.time >= currentTime - 0.1) {\n result.push(danmu);\n }\n });\n\n return result;\n }\n\n // 可见的弹幕的数据,用于计算下一个弹幕的top值\n get visibles() {\n const result = [];\n const { clientWidth } = this.$player;\n const clientLeft = this.getLeft(this.$player);\n\n this.filter('emit', (danmu) => {\n const top = danmu.$ref.offsetTop;\n const left = this.getLeft(danmu.$ref) - clientLeft;\n const height = danmu.$ref.clientHeight;\n const width = danmu.$ref.clientWidth;\n const distance = left + width;\n const right = clientWidth - distance;\n const speed = distance / danmu.$restTime;\n\n const emit = {};\n emit.top = top;\n emit.left = left;\n emit.height = height;\n emit.width = width;\n emit.right = right;\n emit.speed = speed;\n emit.distance = distance;\n emit.time = danmu.$restTime;\n emit.mode = danmu.mode;\n\n result.push(emit);\n });\n\n return result;\n }\n\n // 计算弹幕速度\n get speed() {\n return this.option.synchronousPlayback && this.art.playbackRate\n ? this.option.speed / Number(this.art.playbackRate)\n : this.option.speed;\n }\n\n // 加载弹幕\n async load(danmuku) {\n const { errorHandle } = this.utils;\n\n let danmus = [];\n const target = danmuku || this.option.danmuku;\n\n try {\n if (typeof target === 'function') {\n danmus = await target(); // 异步函数获取\n } else if (target instanceof Promise) {\n danmus = await target; // 从 Promise 对象获取\n } else if (typeof target === 'string') {\n danmus = await bilibiliDanmuParseFromUrl(target); // 从B站xml链接解析\n } else if (Array.isArray(target)) {\n danmus = target; // 直接传入数组\n }\n\n errorHandle(Array.isArray(danmus), 'Danmuku need return an array as result');\n\n // 假如没有传入弹幕参数,则清空弹幕,否则追加弹幕\n if (danmuku === undefined) {\n this.reset(); // 重置弹幕\n this.queue = []; // 清空弹幕队列\n this.states = { wait: [], ready: [], emit: [], stop: [] }; // 清空弹幕状态池\n this.$refs = []; // 清空弹幕DOM节点池\n this.$danmuku.innerText = ''; // 清空弹幕层\n }\n\n // 逐个验证原始弹幕并转换到弹幕队列\n for (let index = 0; index < danmus.length; index++) {\n const danmu = danmus[index];\n await this.emit(danmu);\n }\n\n this.art.emit('artplayerPluginDanmuku:loaded', this.queue);\n } catch (error) {\n this.art.emit('artplayerPluginDanmuku:error', error);\n throw error;\n }\n\n return this;\n }\n\n // 把原始弹幕转换到弹幕队列\n async emit(danmu) {\n const { clamp } = this.utils;\n\n this.validator(danmu, {\n text: 'string', // 弹幕文本\n mode: '?number', // 弹幕模式: 0: 滚动,1: 顶部,2: 底部\n color: '?string', // 弹幕颜色\n time: '?number', // 弹幕时间\n border: '?boolean', // 弹幕是否有边框\n style: '?object', // 弹幕额外样式\n });\n\n // 弹幕文本为空则直接忽略\n if (!danmu.text.trim()) return this;\n\n // 设置弹幕时间,如果没有则默认为当前时间加 0.5 秒\n if (danmu.time) {\n danmu.time = clamp(danmu.time, 0, Infinity);\n } else {\n danmu.time = this.art.currentTime + 0.5;\n }\n\n // 设置弹幕模式,如果没有则默认为全局配置\n if (danmu.mode === undefined) {\n danmu.mode = this.option.mode;\n }\n\n // 设置弹幕单独样式,如果没有则默认为空对象\n if (danmu.style === undefined) {\n danmu.style = {};\n }\n\n // 设置弹幕颜色,如果没有则默认为全局配置\n if (danmu.color === undefined) {\n danmu.color = this.option.color;\n }\n\n // 弹幕模式只能是 0, 1, 2\n if (![0, 1, 2].includes(danmu.mode)) return this;\n\n // 自定义弹幕过滤函数\n if (!this.option.filter(danmu)) return this;\n\n // 添加自定义属性\n const item = {\n ...danmu,\n $state: 'wait', // 弹幕初始状态\n $id: this.index++, // 弹幕唯一标识\n $ref: null, // 弹幕 DOM 节点\n $restTime: 0, // 弹幕剩余时间\n $lastStartTime: 0, // 弹幕上次开始时间\n };\n\n // 转换为wait状态\n this.setState(item, 'wait');\n\n // 添加到实际弹幕队列\n this.queue.push(item);\n\n // 弹幕有四个状态:\n // - wait: 弹幕还未开始显示,没有被添加到 DOM 中\n // - ready: 弹幕准备好显示,没有被添加到 DOM 中\n // - emit: 弹幕正在显示,已经被添加到 DOM 中\n // - stop: 弹幕正在停止显示,已经被添加到 DOM 中\n\n return this;\n }\n\n // 动态配置\n config(option) {\n const { clamp } = this.utils;\n const { $controlsCenter } = this.art.template;\n\n // 判断配置项是否有变化\n const changed = Object.keys(option).some(\n (key) => JSON.stringify(this.option[key]) !== JSON.stringify(option[key]),\n );\n\n // 没有变化则直接返回\n if (!changed) return this;\n\n // 更新配置项\n this.option = Object.assign({}, Danmuku.option, this.option, option);\n this.validator(this.option, Danmuku.scheme);\n\n this.option.mode = clamp(this.option.mode, 0, 2);\n this.option.speed = clamp(this.option.speed, 1, 10);\n this.option.opacity = clamp(this.option.opacity, 0, 1);\n this.option.lockTime = clamp(this.option.lockTime, 1, 60);\n this.option.maxLength = clamp(this.option.maxLength, 1, 1000);\n this.option.mount = this.option.mount || $controlsCenter;\n\n // 动态配置有字体大小,需要重新渲染\n if (option.fontSize) {\n this.reset();\n }\n\n // 通过配置项控制弹幕的显示和隐藏\n if (this.option.visible) {\n this.show();\n } else {\n this.hide();\n }\n\n this.art.emit('artplayerPluginDanmuku:config', this.option);\n\n return this;\n }\n\n // 计算DOM的left值,受到旋屏影响\n getLeft($ref) {\n const rect = $ref.getBoundingClientRect();\n return this.isRotate ? rect.top : rect.left;\n }\n\n // 复杂运算交给 Web Worker 处理\n postMessage(message = {}) {\n return new Promise((resolve) => {\n message.id = Date.now(); // 生成唯一标识\n this.worker.postMessage(message);\n this.worker.onmessage = (event) => {\n const { data } = event;\n // 判断是否是当前的消息\n if (data.id === message.id) {\n resolve(data);\n }\n };\n });\n }\n\n // 根据状态获取弹幕\n filter(state, callback) {\n const danmus = this.states[state] || [];\n for (let index = 0; index < danmus.length; index++) {\n callback(danmus[index]);\n }\n return danmus;\n }\n\n // 设置弹幕状态\n setState(danmu, state) {\n // 从原状态池中删除\n this.states[danmu.$state] = this.states[danmu.$state].filter((item) => item !== danmu);\n\n // 设置新状态\n danmu.$state = state;\n\n // 设置DOM节点状态\n if (danmu.$ref) {\n danmu.$ref.dataset.state = state;\n }\n\n // 添加到新状态池中\n this.states[state].push(danmu);\n }\n\n // 重置弹幕到wait状态,回收弹幕DOM节点\n makeWait(danmu) {\n this.setState(danmu, 'wait');\n if (danmu.$ref) {\n danmu.$ref.style.cssText = Danmuku.cssText;\n danmu.$ref.style.visibility = 'hidden';\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = 'translateX(0px)';\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n\n // 实时更新弹幕\n update() {\n const { setStyles } = this.utils;\n\n this.timer = window.requestAnimationFrame(async () => {\n if (this.art.playing && !this.isHide) {\n // 实时计算弹幕的剩余显示时间\n this.filter('emit', (danmu) => {\n const emitTime = (Date.now() - danmu.$lastStartTime) / 1000;\n danmu.$restTime -= emitTime;\n danmu.$lastStartTime = Date.now();\n // 超过时间即重置弹幕\n if (danmu.$restTime <= 0) {\n this.makeWait(danmu);\n }\n });\n\n // 获取准备好发送的弹幕,可能包含ready和wait状态的弹幕\n const readys = this.readys;\n\n for (let index = 0; index < readys.length; index++) {\n const danmu = readys[index];\n\n // 弹幕发送前的过滤器\n const state = await this.option.beforeVisible(danmu);\n\n if (state) {\n const { clientWidth, clientHeight } = this.$player;\n danmu.$ref = this.$ref; // 获取弹幕DOM节点\n danmu.$ref.innerText = danmu.text; // 设置弹幕文本\n\n // 提前添加到弹幕层中,用于计算top值\n this.$danmuku.appendChild(danmu.$ref);\n\n // 设置初始弹幕样式\n danmu.$ref.style.opacity = this.option.opacity;\n danmu.$ref.style.fontSize = `${this.fontSize}px`;\n danmu.$ref.style.color = danmu.color;\n danmu.$ref.style.border = danmu.border ? `1px solid ${danmu.color}` : null;\n danmu.$ref.style.backgroundColor = danmu.border ? 'rgb(0 0 0 / 50%)' : null;\n\n // 设置单独弹幕样式\n setStyles(danmu.$ref, danmu.style);\n\n // 记录弹幕时间戳\n danmu.$lastStartTime = Date.now();\n\n // 计算弹幕剩余时间\n danmu.$restTime = this.speed;\n\n // 计算弹幕滚动的距离\n const distance = clientWidth + danmu.$ref.clientWidth;\n\n // 计算弹幕的top值\n const { result: top } = await this.postMessage({\n type: 'getDanmuTop',\n target: {\n mode: danmu.mode,\n height: danmu.$ref.clientHeight,\n speed: distance / danmu.$restTime,\n }, // 当前弹幕信息\n visibles: this.visibles, // 可见的弹幕的数据\n antiOverlap: this.option.antiOverlap,\n clientWidth: clientWidth,\n clientHeight: clientHeight,\n marginBottom: this.marginBottom,\n marginTop: this.marginTop,\n });\n\n if (danmu.$ref) {\n if (!this.isStop && top !== undefined) {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$ref.style.top = `${top}px`;\n danmu.$ref.style.visibility = 'visible';\n danmu.$ref.dataset.mode = danmu.mode; // CSS控制模式的显示和隐藏\n\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0: {\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n case 1:\n // falls through\n case 2:\n danmu.$ref.style.left = '50%';\n danmu.$ref.style.marginLeft = `-${danmu.$ref.clientWidth / 2}px`;\n break;\n default:\n break;\n }\n\n this.art.emit('artplayerPluginDanmuku:visible', danmu);\n } else {\n // 假如弹幕已经停止或者没有 top 值,则重置弹幕为ready状态,回收弹幕DOM节点,等待下次发送\n this.setState(danmu, 'ready');\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n }\n }\n }\n\n // 递归调用\n if (!this.isStop) {\n this.update();\n }\n });\n return this;\n }\n\n // 重置正在显示的弹幕: stop/emit 状态的弹幕\n resize() {\n const { clientWidth } = this.$player;\n\n this.filter('stop', (danmu) => {\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n break;\n default:\n break;\n }\n });\n\n this.filter('emit', (danmu) => {\n danmu.$lastStartTime = Date.now();\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0: {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n }\n\n // 继续弹幕\n continue() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu) => {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$lastStartTime = Date.now();\n switch (danmu.mode) {\n // 继续滚动的弹幕\n case 0: {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n\n return this;\n }\n\n // 暂停弹幕\n suspend() {\n const { clientWidth } = this.$player;\n this.filter('emit', (danmu) => {\n this.setState(danmu, 'stop'); // 转换为stop状态\n switch (danmu.mode) {\n // 停止滚动的弹幕\n case 0: {\n const translateX = clientWidth - (this.getLeft(danmu.$ref) - this.getLeft(this.$player));\n danmu.$ref.style.transform = `translateX(${-translateX}px)`;\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n break;\n }\n default:\n break;\n }\n });\n\n return this;\n }\n\n stop() {\n this.isStop = true;\n this.suspend();\n window.cancelAnimationFrame(this.timer);\n this.art.emit('artplayerPluginDanmuku:stop');\n return this;\n }\n\n start() {\n this.isStop = false;\n this.continue();\n this.update();\n this.art.emit('artplayerPluginDanmuku:start');\n return this;\n }\n\n reset() {\n this.queue.forEach((danmu) => this.makeWait(danmu));\n this.art.emit('artplayerPluginDanmuku:reset');\n return this;\n }\n\n show() {\n this.isHide = false;\n this.$danmuku.style.opacity = 1;\n this.option.visible = true;\n this.art.emit('artplayerPluginDanmuku:show');\n return this;\n }\n\n hide() {\n this.isHide = true;\n this.$danmuku.style.opacity = 0;\n this.option.visible = false;\n this.art.emit('artplayerPluginDanmuku:hide');\n return this;\n }\n\n destroy() {\n this.stop();\n this.worker.terminate();\n this.art.off('video:play', this.start);\n this.art.off('video:playing', this.start);\n this.art.off('video:pause', this.stop);\n this.art.off('video:waiting', this.stop);\n this.art.off('resize', this.reset);\n this.art.off('destroy', this.destroy);\n this.art.emit('artplayerPluginDanmuku:destroy');\n }\n}\n","function getMode(key) {\n switch (key) {\n case 1:\n case 2:\n case 3:\n return 0;\n case 4:\n return 2;\n case 5:\n return 1;\n default:\n return 0;\n }\n}\n\nfunction bilibiliDanmuParseFromXml(xmlString) {\n if (typeof xmlString !== 'string') return [];\n const reg = new RegExp(/.+?)\"(?: .*?)?>(?.+?)<\\/d>/gs);\n const matches = xmlString.matchAll(reg);\n return Array.from(matches)\n .map((match) => {\n const attr = match.groups.p.split(',');\n if (attr.length >= 8) {\n const text = match.groups.text\n .trim()\n .replaceAll('"', '\"')\n .replaceAll(''', \"'\")\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n .replaceAll('&', '&');\n\n return {\n text,\n time: Number(attr[0]),\n mode: getMode(Number(attr[1])),\n fontSize: Number(attr[2]),\n color: `#${Number(attr[3]).toString(16)}`,\n timestamp: Number(attr[4]),\n pool: Number(attr[5]),\n userID: attr[6],\n rowID: Number(attr[7]),\n };\n } else {\n return null;\n }\n })\n .filter(Boolean);\n}\n\nfunction onmessage({ data }) {\n const { xml, id } = data;\n if (!id || !xml) return;\n const danmus = bilibiliDanmuParseFromXml(xml);\n self.postMessage({ danmus, id });\n}\n\nfunction createWorker() {\n const workerText = `\n ${getMode.toString()}\n ${bilibiliDanmuParseFromXml.toString()}\n onmessage = ${onmessage.toString()}\n `;\n const blob = new Blob([workerText], { type: 'application/javascript' });\n return new Worker(URL.createObjectURL(blob));\n}\n\nexport function bilibiliDanmuParseFromUrl(url) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve) => {\n const res = await fetch(url);\n const xml = await res.text();\n\n try {\n const worker = createWorker();\n worker.onmessage = (event) => {\n const { danmus, id } = event.data;\n if (!id || !danmus) return;\n resolve(danmus);\n worker.terminate();\n };\n worker.postMessage({ xml, id: Date.now() });\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n const danmus = bilibiliDanmuParseFromXml(xml);\n resolve(danmus);\n }\n });\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n","module.exports = \"dd7efcb5fd87c1c0\";","import style from 'bundle-text:./style.less';\nimport $on from 'bundle-text:./img/on.svg';\nimport $off from 'bundle-text:./img/off.svg';\nimport $config from 'bundle-text:./img/config.svg';\nimport $style from 'bundle-text:./img/style.svg';\nimport $mode_0_off from 'bundle-text:./img/mode_0_off.svg';\nimport $mode_0_on from 'bundle-text:./img/mode_0_on.svg';\nimport $mode_1_off from 'bundle-text:./img/mode_1_off.svg';\nimport $mode_1_on from 'bundle-text:./img/mode_1_on.svg';\nimport $mode_2_off from 'bundle-text:./img/mode_2_off.svg';\nimport $mode_2_on from 'bundle-text:./img/mode_2_on.svg';\nimport $check_on from 'bundle-text:./img/check_on.svg';\nimport $check_off from 'bundle-text:./img/check_off.svg';\n\nexport default class Setting {\n constructor(art, danmuku) {\n this.art = art;\n this.danmuku = danmuku;\n this.utils = art.constructor.utils;\n\n const { setStyle } = this.utils;\n const { $controlsCenter } = art.template;\n setStyle($controlsCenter, 'display', 'flex');\n\n this.template = {\n $controlsCenter,\n $mount: $controlsCenter,\n $danmuku: null,\n $toggle: null,\n $config: null,\n $configPanel: null,\n $configModes: null,\n $style: null,\n $stylePanel: null,\n $styleModes: null,\n $colors: null,\n $opacitySlider: null,\n $opacityValue: null,\n $marginSlider: null,\n $marginValue: null,\n $fontSizeSlider: null,\n $fontSizeValue: null,\n $speedSlider: null,\n $speedValue: null,\n $input: null,\n $send: null,\n };\n\n this.slider = {\n opacity: null,\n margin: null,\n fontSize: null,\n speed: null,\n };\n\n this.emitting = false;\n this.isLock = false;\n this.timer = null;\n\n this.createTemplate();\n this.createSliders();\n this.createEvents();\n\n this.mount(this.option.mount);\n\n art.on('resize', () => this.resize());\n art.on('fullscreen', (state) => this.onFullscreen(state));\n art.on('fullscreenWeb', (state) => this.onFullscreen(state));\n\n art.proxy(this.template.$config, 'mouseenter', () => {\n this.onMouseEnter({\n $control: this.template.$config,\n $panel: this.template.$configPanel,\n });\n });\n\n art.proxy(this.template.$style, 'mouseenter', () => {\n this.onMouseEnter({\n $control: this.template.$style,\n $panel: this.template.$stylePanel,\n });\n });\n }\n\n static get icons() {\n return {\n $on,\n $off,\n $config,\n $style,\n $mode_0_off,\n $mode_0_on,\n $mode_1_off,\n $mode_1_on,\n $mode_2_off,\n $mode_2_on,\n $check_on,\n $check_off,\n };\n }\n\n get option() {\n return this.danmuku.option;\n }\n\n get outside() {\n return this.template.$mount !== this.template.$controlsCenter;\n }\n\n get TEMPLATE() {\n const { option } = this;\n return `\n
\n ${$on}${$off}\n
\n
\n ${$config}\n
\n
\n
\n 按类型屏蔽\n
\n
\n ${$mode_0_off}${$mode_0_on}\n
滚动
\n
\n
\n ${$mode_1_off}${$mode_1_on}\n
顶部
\n
\n
\n ${$mode_2_off}${$mode_2_on}\n
底部
\n
\n
\n
\n
\n
\n ${$check_on}${$check_off}\n 防止弹幕重叠\n
\n
\n ${$check_on}${$check_off}\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 ${$style}\n
\n
\n
\n 模式\n
\n
\n ${$mode_0_on}\n
滚动
\n
\n
\n ${$mode_1_on}\n
顶部
\n
\n
\n ${$mode_2_on}\n
底部
\n
\n
\n
\n
\n 颜色\n
\n ${this.COLOR.map((color) => `
`).join('')}\n
\n
\n
\n
\n
\n \n
发送
\n
\n `;\n }\n\n get OPACITY() {\n return {\n min: 0,\n max: 100,\n steps: [],\n ...this.option.OPACITY,\n };\n }\n\n get FONT_SIZE() {\n return {\n min: 12,\n max: 120,\n steps: [],\n ...this.option.FONT_SIZE,\n };\n }\n\n get MARGIN() {\n return {\n min: 0,\n max: 3,\n steps: [\n {\n name: '1/4',\n value: [10, '75%'],\n },\n {\n name: '半屏',\n value: [10, '50%'],\n },\n {\n name: '3/4',\n value: [10, '25%'],\n },\n {\n name: '满屏',\n value: [10, 10],\n },\n ],\n ...this.option.MARGIN,\n };\n }\n\n get SPEED() {\n return {\n min: 0,\n max: 4,\n steps: [\n {\n name: '极慢',\n value: 10,\n },\n {\n name: '较慢',\n value: 7.5,\n hide: true,\n },\n {\n name: '适中',\n value: 5,\n },\n {\n name: '较快',\n value: 2.5,\n hide: true,\n },\n {\n name: '极快',\n value: 1,\n },\n ],\n ...this.option.SPEED,\n };\n }\n\n get COLOR() {\n return this.option.COLOR.length\n ? this.option.COLOR\n : [\n '#FE0302',\n '#FF7204',\n '#FFAA02',\n '#FFD302',\n '#FFFF00',\n '#A0EE00',\n '#00CD00',\n '#019899',\n '#4266BE',\n '#89D5FF',\n '#CC0273',\n '#222222',\n '#9B9B9B',\n '#FFFFFF',\n ];\n }\n\n query(selector) {\n const { query } = this.utils;\n const { $danmuku } = this.template;\n return query(selector, $danmuku);\n }\n\n append(el, target) {\n const { append } = this.utils;\n const children = [...el.children];\n if (children.some((item) => item === target)) return;\n append(el, target);\n }\n\n setData(key, value) {\n const { $player } = this.art.template;\n const { $mount } = this.template;\n $player.dataset[key] = value;\n if (this.outside) {\n $mount.dataset[key] = value;\n }\n }\n\n createTemplate() {\n const { createElement, tooltip } = this.utils;\n\n const $danmuku = createElement('div');\n $danmuku.className = 'artplayer-plugin-danmuku';\n $danmuku.innerHTML = this.TEMPLATE;\n\n this.template.$danmuku = $danmuku;\n this.template.$toggle = this.query('.apd-toggle');\n this.template.$config = this.query('.apd-config');\n this.template.$configPanel = this.query('.apd-config-panel');\n this.template.$configModes = this.query('.apd-config-mode .apd-modes');\n this.template.$style = this.query('.apd-style');\n this.template.$stylePanel = this.query('.apd-style-panel');\n this.template.$styleModes = this.query('.apd-style-mode .apd-modes');\n this.template.$colors = this.query('.apd-colors');\n this.template.$antiOverlap = this.query('.apd-anti-overlap');\n this.template.$syncVideo = this.query('.apd-sync-video');\n this.template.$opacitySlider = this.query('.apd-config-opacity .apd-slider');\n this.template.$opacityValue = this.query('.apd-config-opacity .apd-value');\n this.template.$marginSlider = this.query('.apd-config-margin .apd-slider');\n this.template.$marginValue = this.query('.apd-config-margin .apd-value');\n this.template.$fontSizeSlider = this.query('.apd-config-fontSize .apd-slider');\n this.template.$fontSizeValue = this.query('.apd-config-fontSize .apd-value');\n this.template.$speedSlider = this.query('.apd-config-speed .apd-slider');\n this.template.$speedValue = this.query('.apd-config-speed .apd-value');\n this.template.$input = this.query('.apd-input');\n this.template.$send = this.query('.apd-send');\n\n const { $toggle } = this.template;\n\n this.art.on('artplayerPluginDanmuku:show', () => {\n tooltip($toggle, '关闭弹幕');\n });\n\n this.art.on('artplayerPluginDanmuku:hide', () => {\n tooltip($toggle, '打开弹幕');\n });\n }\n\n createEvents() {\n const { $toggle, $configModes, $styleModes, $colors, $antiOverlap, $syncVideo, $send, $input } = this.template;\n\n this.art.proxy($toggle, 'click', () => {\n this.danmuku.config({\n visible: !this.option.visible,\n });\n this.reset();\n });\n\n this.art.proxy($configModes, 'click', (event) => {\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n if (this.option.modes.includes(mode)) {\n this.danmuku.config({\n modes: this.option.modes.filter((m) => m !== mode),\n });\n } else {\n this.danmuku.config({\n modes: [...this.option.modes, mode],\n });\n }\n this.reset();\n });\n\n this.art.proxy($antiOverlap, 'click', () => {\n this.danmuku.config({\n antiOverlap: !this.option.antiOverlap,\n });\n this.reset();\n });\n\n this.art.proxy($syncVideo, 'click', () => {\n this.danmuku.config({\n synchronousPlayback: !this.option.synchronousPlayback,\n });\n this.reset();\n });\n\n this.art.proxy($styleModes, 'click', (event) => {\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n this.danmuku.config({\n mode: mode,\n });\n this.reset();\n });\n\n this.art.proxy($colors, 'click', (event) => {\n const $color = event.target.closest('.apd-color');\n if (!$color) return;\n this.danmuku.config({\n color: $color.dataset.color,\n });\n this.reset();\n });\n\n this.art.proxy($send, 'click', () => this.emit());\n\n this.art.proxy($input, 'keypress', (event) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.emit();\n }\n });\n }\n\n createSliders() {\n this.slider.opacity = this.createSlider({\n ...this.OPACITY,\n container: this.template.$opacitySlider,\n findIndex: () => {\n return Math.round(this.option.opacity * 100);\n },\n onChange: (index) => {\n const { $opacityValue } = this.template;\n $opacityValue.textContent = `${index}%`;\n this.danmuku.config({\n opacity: index / 100,\n });\n },\n });\n\n this.slider.margin = this.createSlider({\n ...this.MARGIN,\n container: this.template.$marginSlider,\n findIndex: () => {\n return this.MARGIN.steps.findIndex(\n (item) => item.value[0] === this.option.margin[0] && item.value[1] === this.option.margin[1],\n );\n },\n onChange: (index) => {\n const margin = this.MARGIN.steps[index];\n if (!margin) return;\n const { $marginValue } = this.template;\n $marginValue.textContent = margin.name;\n this.danmuku.config({\n margin: margin.value,\n });\n },\n });\n\n this.slider.fontSize = this.createSlider({\n ...this.FONT_SIZE,\n container: this.template.$fontSizeSlider,\n findIndex: () => {\n return this.danmuku.fontSize;\n },\n onChange: (index) => {\n const { $fontSizeValue } = this.template;\n $fontSizeValue.textContent = `${index}px`;\n if (index === this.danmuku.fontSize) return;\n this.danmuku.config({\n fontSize: index,\n });\n },\n });\n\n this.slider.speed = this.createSlider({\n ...this.SPEED,\n container: this.template.$speedSlider,\n findIndex: () => {\n return this.SPEED.steps.findIndex((item) => item.value === this.option.speed);\n },\n onChange: (index) => {\n const speed = this.SPEED.steps[index];\n if (!speed) return;\n const { $speedValue } = this.template;\n $speedValue.textContent = speed.name;\n this.danmuku.config({\n speed: speed.value,\n });\n },\n });\n }\n\n createSlider({ min, max, container, findIndex, onChange, steps = [] }) {\n const { query, clamp, setStyle } = this.utils;\n\n setStyle(container, 'touch-action', 'none');\n\n container.innerHTML = `\n
\n
\n ${steps.map(() => `
`).join('')}\n
\n
\n
\n
\n
\n ${steps.map((step) => (step.hide ? '' : `
${step.name}
`)).join('')}\n
\n `;\n\n const $dot = query('.apd-slider-dot', container);\n const $progress = query('.apd-slider-progress', container);\n\n let isDroging = false;\n\n function reset(index = findIndex()) {\n if (index < min || index > max) return;\n const percentage = (index - min) / (max - min);\n $dot.style.left = `${percentage * 100}%`;\n if (steps.length === 0) {\n $progress.style.width = $dot.style.left;\n }\n onChange(index);\n }\n\n function updateLeft(event) {\n const { top, height, left, width } = container.getBoundingClientRect();\n if (this.art.isRotate) {\n const value = clamp(event.clientY - top, 0, height);\n const index = Math.round((value / height) * (max - min) + min);\n reset(index);\n } else {\n const value = clamp(event.clientX - left, 0, width);\n const index = Math.round((value / width) * (max - min) + min);\n reset(index);\n }\n }\n\n this.art.proxy(container, 'click', (event) => {\n updateLeft.call(this, event);\n });\n\n this.art.proxy(container, 'pointerdown', (event) => {\n isDroging = event.button === 0;\n });\n\n this.art.proxy(document, 'pointermove', (event) => {\n if (isDroging) {\n updateLeft.call(this, event);\n }\n });\n\n this.art.proxy(document, 'pointerup', (event) => {\n if (isDroging) {\n isDroging = false;\n updateLeft.call(this, event);\n }\n });\n\n return { reset };\n }\n\n onFullscreen(state) {\n const { $danmuku, $controlsCenter, $mount } = this.template;\n if (this.outside) {\n if (state) {\n this.append($controlsCenter, $danmuku);\n } else {\n this.append($mount, $danmuku);\n }\n } else {\n this.append($controlsCenter, $danmuku);\n }\n }\n\n onMouseEnter({ $control, $panel }) {\n const { $player } = this.art.template;\n const controlRect = $control.getBoundingClientRect();\n const panelRect = $panel.getBoundingClientRect();\n const playerRect = $player.getBoundingClientRect();\n\n const half = panelRect.width / 2 - controlRect.width / 2;\n const left = playerRect.left - (controlRect.left - half);\n const right = controlRect.right + half - playerRect.right;\n\n if (left > 0) {\n $panel.style.left = `${-half + left}px`;\n } else if (right > 0) {\n $panel.style.left = `${-half - right}px`;\n } else {\n $panel.style.left = `${-half}px`;\n }\n }\n\n async emit() {\n const { $input } = this.template;\n\n const text = $input.value.trim();\n if (!text.length) return;\n if (this.isLock) return;\n if (this.emitting) return;\n\n const danmu = {\n text: text,\n mode: this.option.mode,\n color: this.option.color,\n time: this.art.currentTime,\n };\n\n try {\n this.emitting = true;\n const state = await this.option.beforeEmit(danmu);\n this.emitting = false;\n\n if (state !== true) return;\n\n danmu.border = true;\n delete danmu.time;\n this.danmuku.emit(danmu);\n $input.value = '';\n\n this.lock();\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n this.emitting = false;\n }\n }\n\n lock() {\n const { addClass } = this.utils;\n const { $send } = this.template;\n\n this.isLock = true;\n let time = this.option.lockTime;\n $send.innerText = time;\n addClass($send, 'apd-lock');\n\n const loop = () => {\n this.timer = setTimeout(() => {\n if (time === 0) {\n this.unlock();\n } else {\n time -= 1;\n $send.innerText = time;\n loop();\n }\n }, 1000);\n };\n\n loop();\n }\n\n unlock() {\n const { removeClass } = this.utils;\n const { $send } = this.template;\n clearTimeout(this.timer);\n this.isLock = false;\n $send.innerText = '发送';\n removeClass($send, 'apd-lock');\n }\n\n resize() {\n if (this.outside) return;\n if (this.art.fullscreen) return;\n if (this.art.fullscreenWeb) return;\n const { $player, $controlsCenter } = this.art.template;\n const { $danmuku } = this.template;\n if (this.art.width < this.option.width) {\n this.append($player, $danmuku);\n } else {\n this.append($controlsCenter, $danmuku);\n }\n }\n\n reset() {\n const { inverseClass, tooltip } = this.utils;\n const { $toggle, $colors } = this.template;\n\n this.slider.opacity.reset();\n this.slider.margin.reset();\n this.slider.fontSize.reset();\n this.slider.speed.reset();\n\n this.setData('danmukuVisible', this.option.visible);\n this.setData('danmukuMode', this.option.mode);\n this.setData('danmukuColor', this.option.color);\n this.setData('danmukuMode0', this.option.modes.includes(0));\n this.setData('danmukuMode1', this.option.modes.includes(1));\n this.setData('danmukuMode2', this.option.modes.includes(2));\n this.setData('danmukuAntiOverlap', this.option.antiOverlap);\n this.setData('danmukuSyncVideo', this.option.synchronousPlayback);\n this.setData('danmukuTheme', this.option.theme);\n this.setData('danmukuEmitter', this.option.emitter);\n\n const colors = $colors.children;\n const $color = Array.from(colors).find((item) => item.dataset.color === this.option.color.toUpperCase());\n $color && inverseClass($color, 'apd-active');\n\n tooltip($toggle, this.option.visible ? '关闭弹幕' : '打开弹幕');\n\n this.resize();\n }\n\n mount(target) {\n const { errorHandle } = this.utils;\n const $el = typeof target === 'string' ? document.querySelector(target) : target;\n errorHandle($el, `Can not find the mount point: ${target}`);\n this.append($el, this.template.$danmuku);\n this.template.$mount = $el;\n this.reset();\n }\n}\n\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-danmuku';\n let $style = document.getElementById(id);\n if (!$style) {\n $style = document.createElement('style');\n $style.id = id;\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild($style);\n });\n } else {\n (document.head || document.documentElement).appendChild($style);\n }\n }\n $style.textContent = style;\n}\n","module.exports = \"95fd45dd2fe5c5a5\";","module.exports = \"c6881a3522f2fe2a\";","module.exports = \"4e92064d88d9e604\";","module.exports = \"49c14b4dbf213408\";","module.exports = \"5050154cc04e750f\";","module.exports = \"a0f690bca27acdee\";","module.exports = \"70b07d4e4796c39f\";","module.exports = \"bffb346eb331a03f\";","module.exports = \"ade441db0e7be833\";","module.exports = \"8acc265c0fe9e947\";","module.exports = \"d374f135d6d7b8db\";","module.exports = \"8e2849d281974e34\";","module.exports = \"0616b3f5e6434b38\";","const lib = {\n map(value, inMin, inMax, outMin, outMax) {\n return ((value - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;\n },\n range(start, end, tick) {\n const s = Math.round(start / tick) * tick;\n return Array.from(\n {\n length: Math.floor((end - start) / tick),\n },\n (v, k) => {\n return k * tick + s;\n },\n );\n },\n};\n\nconst line = (pointA, pointB) => {\n const lengthX = pointB[0] - pointA[0];\n const lengthY = pointB[1] - pointA[1];\n return {\n length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),\n angle: Math.atan2(lengthY, lengthX),\n };\n};\n\nexport default function heatmap(art, danmuku, option) {\n const { query } = art.constructor.utils;\n\n art.controls.add({\n name: 'heatmap',\n position: 'top',\n html: '',\n style: {\n position: 'absolute',\n top: '-100px',\n left: '0px',\n right: '0px',\n height: '100px',\n width: '100%',\n pointerEvents: 'none',\n },\n mounted($heatmap) {\n let $start = null;\n let $stop = null;\n\n function update(arg = []) {\n $start = null;\n $stop = null;\n $heatmap.innerHTML = '';\n\n if (!art.duration || art.option.isLive) return;\n\n const svg = {\n w: $heatmap.offsetWidth,\n h: $heatmap.offsetHeight,\n };\n\n const options = {\n xMin: 0,\n xMax: svg.w,\n yMin: 0,\n yMax: 128,\n scale: 0.25,\n opacity: 0.2,\n minHeight: Math.floor(svg.h * 0.05),\n sampling: Math.floor(svg.w / 100),\n smoothing: 0.2,\n flattening: 0.2,\n };\n\n if (typeof option === 'object') {\n Object.assign(options, option);\n }\n\n let points = [];\n\n if (Array.isArray(arg) && arg.length) {\n points = [...arg];\n } else {\n const gap = art.duration / svg.w;\n for (let x = 0; x <= svg.w; x += options.sampling) {\n const y = danmuku.queue.filter(\n ({ time }) => time > x * gap && time <= (x + options.sampling) * gap,\n ).length;\n points.push([x, y]);\n }\n }\n\n if (points.length === 0) return;\n\n const lastPoint = points[points.length - 1];\n const lastX = lastPoint[0];\n const lastY = lastPoint[1];\n if (lastX !== svg.w) {\n points.push([svg.w, lastY]);\n }\n\n const yPoints = points.map((point) => point[1]);\n const yMin = Math.min(...yPoints);\n const yMax = Math.max(...yPoints);\n const yMid = (yMin + yMax) / 2;\n\n for (let i = 0; i < points.length; i++) {\n const point = points[i];\n const y = point[1];\n point[1] = y * (y > yMid ? 1 + options.scale : 1 - options.scale) + options.minHeight;\n }\n\n const controlPoint = (current, previous, next, reverse) => {\n const p = previous || current;\n const n = next || current;\n const o = line(p, n);\n const flat = lib.map(Math.cos(o.angle) * options.flattening, 0, 1, 1, 0);\n const angle = o.angle * flat + (reverse ? Math.PI : 0);\n const length = o.length * options.smoothing;\n const x = current[0] + Math.cos(angle) * length;\n const y = current[1] + Math.sin(angle) * length;\n return [x, y];\n };\n\n const bezierCommand = (point, i, a) => {\n const cps = controlPoint(a[i - 1], a[i - 2], point);\n const cpe = controlPoint(point, a[i - 1], a[i + 1], true);\n const close = i === a.length - 1 ? ' z' : '';\n return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}${close}`;\n };\n\n const pointsPositions = points.map((e) => {\n const x = lib.map(e[0], options.xMin, options.xMax, 0, svg.w);\n const y = lib.map(e[1], options.yMin, options.yMax, svg.h, 0);\n return [x, y];\n });\n\n const pathD = pointsPositions.reduce(\n (acc, e, i, a) =>\n i === 0\n ? `M ${a[a.length - 1][0]},${svg.h} L ${e[0]},${svg.h} L ${e[0]},${e[1]}`\n : `${acc} ${bezierCommand(e, i, a)}`,\n '',\n );\n\n $heatmap.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n `;\n\n $start = query('#heatmap-start', $heatmap);\n $stop = query('#heatmap-stop', $heatmap);\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n\n art.on('video:timeupdate', () => {\n if ($start && $stop) {\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n });\n\n art.on('setBar', (type, percentage) => {\n if ($start && $stop && type === 'played') {\n $start.setAttribute('offset', `${percentage * 100}%`);\n $stop.setAttribute('offset', `${percentage * 100}%`);\n }\n });\n\n art.on('ready', () => update());\n art.on('resize', () => update());\n art.on('artplayerPluginDanmuku:loaded', () => update());\n art.on('artplayerPluginDanmuku:points', (points) => update(points));\n },\n });\n}\n"],"names":["modules","entry","mainEntry","parcelRequireName","externals","distDir","publicUrl","devServer","globalObject","globalThis","self","window","global","previousRequire","importMap","i","cache","nodeRequire","module","require","bind","newRequire","name","jumped","currentRequire","err","Error","code","localRequire","resolve","x","id","Module","call","exports","res","isParcelRequire","moduleName","bundle","parent","register","Object","defineProperty","get","length","mainExports","define","amd","__globalThis","parcelHelpers","defineInteropFlag","export","artplayerPluginDanmuku","_danmuku","_danmukuDefault","interopDefault","_setting","_settingDefault","_heatmap","_heatmapDefault","option","art","danmuku","default","setting","heatmap","emit","load","config","hide","show","reset","mount","isHide","isStop","icons","_bilibili","_worker","_workerDefault","Danmuku","constructor","template","utils","validator","$danmuku","$player","queue","$refs","timer","index","states","wait","ready","stop","blob","Blob","replace","type","worker","Worker","URL","createObjectURL","start","resize","destroy","on","speed","margin","opacity","color","mode","modes","fontSize","antiOverlap","synchronousPlayback","undefined","width","points","filter","beforeEmit","beforeVisible","visible","emitter","maxLength","lockTime","theme","OPACITY","FONT_SIZE","MARGIN","SPEED","COLOR","scheme","cssText","isRotate","plugins","autoOrientation","state","marginTop","clamp","value","clientHeight","endsWith","parseFloat","marginBottom","Math","round","$ref","pop","document","createElement","style","dataset","className","readys","currentTime","result","danmu","push","time","visibles","clientWidth","clientLeft","getLeft","top","offsetTop","left","height","distance","$restTime","right","playbackRate","Number","errorHandle","danmus","target","Promise","bilibiliDanmuParseFromUrl","Array","isArray","innerText","error","text","border","trim","Infinity","includes","item","$state","$id","$lastStartTime","setState","$controlsCenter","keys","some","key","JSON","stringify","assign","rect","getBoundingClientRect","postMessage","message","Date","now","onmessage","event","data","callback","makeWait","visibility","marginLeft","transform","transition","update","setStyles","requestAnimationFrame","playing","emitTime","appendChild","backgroundColor","continue","suspend","translateX","cancelAnimationFrame","forEach","terminate","off","getMode","bilibiliDanmuParseFromXml","xmlString","reg","RegExp","from","matchAll","map","match","attr","groups","p","split","replaceAll","toString","timestamp","pool","userID","rowID","Boolean","xml","url","fetch","createWorker","a","__esModule","exportAll","source","dest","prototype","hasOwnProperty","enumerable","destName","_styleLess","_styleLessDefault","_onSvg","_onSvgDefault","_offSvg","_offSvgDefault","_configSvg","_configSvgDefault","_styleSvg","_styleSvgDefault","_mode0OffSvg","_mode0OffSvgDefault","_mode0OnSvg","_mode0OnSvgDefault","_mode1OffSvg","_mode1OffSvgDefault","_mode1OnSvg","_mode1OnSvgDefault","_mode2OffSvg","_mode2OffSvgDefault","_mode2OnSvg","_mode2OnSvgDefault","_checkOnSvg","_checkOnSvgDefault","_checkOffSvg","_checkOffSvgDefault","setStyle","$mount","$toggle","$config","$configPanel","$configModes","$style","$stylePanel","$styleModes","$colors","$opacitySlider","$opacityValue","$marginSlider","$marginValue","$fontSizeSlider","$fontSizeValue","$speedSlider","$speedValue","$input","$send","slider","emitting","isLock","createTemplate","createSliders","createEvents","onFullscreen","proxy","onMouseEnter","$control","$panel","$on","$off","$mode_0_off","$mode_0_on","$mode_1_off","$mode_1_on","$mode_2_off","$mode_2_on","$check_on","$check_off","outside","TEMPLATE","join","min","max","steps","query","selector","append","el","children","setData","tooltip","innerHTML","$antiOverlap","$syncVideo","$mode","closest","m","$color","preventDefault","createSlider","container","findIndex","onChange","textContent","step","$dot","$progress","isDroging","percentage","updateLeft","clientY","clientX","button","controlRect","panelRect","playerRect","half","lock","addClass","loop","setTimeout","unlock","removeClass","clearTimeout","fullscreen","fullscreenWeb","inverseClass","find","toUpperCase","$el","querySelector","getElementById","readyState","addEventListener","head","documentElement","lib","inMin","inMax","outMin","outMax","range","end","tick","s","floor","v","k","line","pointA","pointB","lengthX","lengthY","sqrt","pow","angle","atan2","controls","add","position","html","pointerEvents","mounted","$heatmap","$start","$stop","arg","duration","isLive","svg","w","offsetWidth","h","offsetHeight","options","xMin","xMax","yMin","yMax","scale","minHeight","sampling","smoothing","flattening","gap","y","lastPoint","lastX","lastY","yPoints","point","yMid","controlPoint","current","previous","next","reverse","o","flat","cos","PI","sin","bezierCommand","cps","cpe","close","pathD","pointsPositions","e","reduce","acc","setAttribute","played","_default","parcelRequire4dc0"],"version":3,"file":"index.js.map"} \ No newline at end of file +{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,A,Y,O,C,C,E,E,C,C,E,C,E,E,C,E,C,E,E,E,K,E,C,E,E,A,a,O,Q,A,Y,O,O,O,E,O,O,C,I,C,Q,S,E,C,C,C,E,G,C,C,C,E,C,C,G,C,C,C,E,C,C,G,C,C,E,C,O,C,C,E,C,I,E,A,Y,O,C,C,E,E,C,C,E,C,G,C,G,E,O,E,E,C,G,G,E,O,E,E,C,G,G,G,A,U,O,E,O,E,G,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,O,C,S,C,E,I,E,C,C,E,C,E,C,E,C,O,A,M,E,E,C,E,E,K,C,C,E,I,E,C,C,E,C,I,E,M,C,G,C,C,E,C,E,C,I,C,E,O,C,E,E,E,O,C,E,C,O,C,C,E,C,O,C,S,E,C,E,I,E,E,O,C,G,M,A,C,I,E,C,E,E,E,C,C,E,e,C,C,E,E,M,C,S,C,E,I,C,E,C,E,I,C,M,C,E,I,C,O,C,E,I,C,O,C,C,C,E,E,O,C,E,E,K,C,E,E,M,C,E,E,O,C,K,E,E,S,C,K,E,E,S,C,K,E,E,C,C,E,E,Q,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AC,SAAU,CAAC,EAAM,KAChB,GAAU,GAAS,AAAS,WAAT,IACnB,EAAO,YAAY,CAAC,SAAU,CAAA,EAAG,AAAa,IAAb,EAAiB,CAAC,CAAC,EACpD,EAAM,YAAY,CAAC,SAAU,CAAA,EAAG,AAAa,IAAb,EAAiB,CAAC,CAAC,EAE3D,GAEA,EAAI,EAAE,CAAC,QAAS,IAAM,KACtB,EAAI,EAAE,CAAC,SAAU,IAAM,KACvB,EAAI,EAAE,CAAC,gCAAiC,IAAM,KAC9C,EAAI,EAAE,CAAC,gCAAiC,AAAC,GAAW,EAAO,GAC/D,CACJ,EACJ,C,E,C,iD,O,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["","src/index.js","src/danmuku.js","src/bilibili.js","../../node_modules/@parcel/transformer-js/src/esmodule-helpers.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-2b9af4c751c9af0f.js","src/setting.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-dccb0d3065212e9e.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-d85a064dfde0d678.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-73f5a0f2cfb429eb.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-5c3216007e3a5d58.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-12ba311be953b248.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-de9c7e9efb8cb601.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-77d567d1f7edd248.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-cc88bf1e36f735fd.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-8a845466dee64975.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-5f8d4f0b11c9856f.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-9fdca1abf90117b8.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-6bb3abce7399b265.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-0a27f24766a5efcc.js","src/heatmap.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (\n modules,\n entry,\n mainEntry,\n parcelRequireName,\n externals,\n distDir,\n publicUrl,\n devServer\n) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var importMap = previousRequire.i || {};\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof module.require === 'function' &&\n module.require.bind(module);\n\n function newRequire(name, jumped) {\n if (!cache[name]) {\n if (!modules[name]) {\n if (externals[name]) {\n return externals[name];\n }\n // if we cannot find the module within our internal map or\n // cache jump to the current global require ie. the last bundle\n // that was added to the page.\n var currentRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n if (!jumped && currentRequire) {\n return currentRequire(name, true);\n }\n\n // If there are other bundles on this page the require from the\n // previous one is saved to 'previousRequire'. Repeat this as\n // many times as there are bundles until the module is found or\n // we exhaust the require chain.\n if (previousRequire) {\n return previousRequire(name, true);\n }\n\n // Try the node require function if it exists.\n if (nodeRequire && typeof name === 'string') {\n return nodeRequire(name);\n }\n\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n }\n\n localRequire.resolve = resolve;\n localRequire.cache = {};\n\n var module = (cache[name] = new newRequire.Module(name));\n\n modules[name][0].call(\n module.exports,\n localRequire,\n module,\n module.exports,\n globalObject\n );\n }\n\n return cache[name].exports;\n\n function localRequire(x) {\n var res = localRequire.resolve(x);\n return res === false ? {} : newRequire(res);\n }\n\n function resolve(x) {\n var id = modules[name][1][x];\n return id != null ? id : x;\n }\n }\n\n function Module(moduleName) {\n this.id = moduleName;\n this.bundle = newRequire;\n this.require = nodeRequire;\n this.exports = {};\n }\n\n newRequire.isParcelRequire = true;\n newRequire.Module = Module;\n newRequire.modules = modules;\n newRequire.cache = cache;\n newRequire.parent = previousRequire;\n newRequire.distDir = distDir;\n newRequire.publicUrl = publicUrl;\n newRequire.devServer = devServer;\n newRequire.i = importMap;\n newRequire.register = function (id, exports) {\n modules[id] = [\n function (require, module) {\n module.exports = exports;\n },\n {},\n ];\n };\n\n // Only insert newRequire.load when it is actually used.\n // The code in this file is linted against ES5, so dynamic import is not allowed.\n // INSERT_LOAD_HERE\n\n Object.defineProperty(newRequire, 'root', {\n get: function () {\n return globalObject[parcelRequireName];\n },\n });\n\n globalObject[parcelRequireName] = newRequire;\n\n for (var i = 0; i < entry.length; i++) {\n newRequire(entry[i]);\n }\n\n if (mainEntry) {\n // Expose entry point to Node, AMD or browser globals\n // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js\n var mainExports = newRequire(mainEntry);\n\n // CommonJS\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n module.exports = mainExports;\n\n // RequireJS\n } else if (typeof define === 'function' && define.amd) {\n define(function () {\n return mainExports;\n });\n }\n }\n})({\"4omrA\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>artplayerPluginDanmuku);\nvar _danmuku = require(\"./danmuku\");\nvar _danmukuDefault = parcelHelpers.interopDefault(_danmuku);\nvar _setting = require(\"./setting\");\nvar _settingDefault = parcelHelpers.interopDefault(_setting);\nvar _heatmap = require(\"./heatmap\");\nvar _heatmapDefault = parcelHelpers.interopDefault(_heatmap);\nfunction artplayerPluginDanmuku(option) {\n return (art)=>{\n const danmuku = new (0, _danmukuDefault.default)(art, option);\n const setting = new (0, _settingDefault.default)(art, danmuku);\n if (danmuku.option.heatmap) (0, _heatmapDefault.default)(art, danmuku, danmuku.option.heatmap);\n return {\n name: 'artplayerPluginDanmuku',\n emit: danmuku.emit.bind(danmuku),\n load: danmuku.load.bind(danmuku),\n config: danmuku.config.bind(danmuku),\n hide: danmuku.hide.bind(danmuku),\n show: danmuku.show.bind(danmuku),\n reset: danmuku.reset.bind(danmuku),\n mount: setting.mount.bind(setting),\n get option () {\n return danmuku.option;\n },\n get isHide () {\n return danmuku.isHide;\n },\n get isStop () {\n return danmuku.isStop;\n }\n };\n };\n}\nartplayerPluginDanmuku.icons = (0, _settingDefault.default).icons;\nif (typeof window !== 'undefined') window['artplayerPluginDanmuku'] = artplayerPluginDanmuku;\n\n},{\"./danmuku\":\"3UaSK\",\"./setting\":\"jUZBE\",\"./heatmap\":\"kCWvn\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}],\"3UaSK\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nvar _bilibili = require(\"./bilibili\");\nvar _worker = require(\"bundle-text:./worker\");\nvar _workerDefault = parcelHelpers.interopDefault(_worker);\nclass Danmuku {\n constructor(art, option){\n const { constructor, template } = art;\n this.utils = constructor.utils; // 工具库\n this.validator = constructor.validator; // 配置校验器\n this.$danmuku = template.$danmuku; // 弹幕层容器\n this.$player = template.$player; // 播放器容器\n this.art = art;\n this.queue = []; // 实际弹幕队列\n this.$refs = []; // 弹幕DOM节点池\n this.isStop = false; // 是否停止\n this.isHide = false; // 是否隐藏\n this.timer = null; // 定时器\n this.index = 0; // 弹幕索引\n // 格式化后的配置项\n this.option = Danmuku.option;\n // 弹幕状态池\n this.states = {\n wait: [],\n ready: [],\n emit: [],\n stop: []\n };\n // 初始化配置\n this.config(option, true);\n // 创建 Web Worker, 用于计算弹幕的 top 值\n const workerText2 = (0, _workerDefault.default).replace('export{e as default};', '');\n const blob = new Blob([\n workerText2\n ], {\n type: 'application/javascript'\n });\n this.worker = new Worker(URL.createObjectURL(blob));\n // 绑定公用事件\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.reset = this.reset.bind(this);\n this.resize = this.resize.bind(this);\n this.destroy = this.destroy.bind(this);\n // 监听事件\n art.on('video:play', this.start);\n art.on('video:playing', this.start);\n art.on('video:pause', this.stop);\n art.on('video:waiting', this.stop);\n art.on('destroy', this.destroy);\n art.on('resize', this.resize);\n // 开始加载弹幕\n this.load();\n }\n // 默认配置\n static get option() {\n return {\n danmuku: [],\n speed: 5,\n margin: [\n 10,\n '25%'\n ],\n opacity: 1,\n color: '#FFFFFF',\n mode: 0,\n modes: [\n 0,\n 1,\n 2\n ],\n fontSize: 25,\n antiOverlap: true,\n synchronousPlayback: false,\n mount: undefined,\n heatmap: false,\n width: 512,\n points: [],\n filter: ()=>true,\n beforeEmit: ()=>true,\n beforeVisible: ()=>true,\n visible: true,\n emitter: true,\n maxLength: 200,\n lockTime: 5,\n theme: 'dark',\n OPACITY: {},\n FONT_SIZE: {},\n MARGIN: {},\n SPEED: {},\n COLOR: []\n };\n }\n // 配置校验\n static get scheme() {\n return {\n danmuku: 'array|function|string',\n speed: 'number',\n margin: 'array',\n opacity: 'number',\n color: 'string',\n mode: 'number',\n modes: 'array',\n fontSize: 'number|string',\n antiOverlap: 'boolean',\n synchronousPlayback: 'boolean',\n mount: '?htmldivelement|string',\n heatmap: 'object|boolean',\n width: 'number',\n points: 'array',\n filter: 'function',\n beforeEmit: 'function',\n beforeVisible: 'function',\n visible: 'boolean',\n emitter: 'boolean',\n maxLength: 'number',\n lockTime: 'number',\n theme: 'string',\n OPACITY: 'object',\n FONT_SIZE: 'object',\n MARGIN: 'object',\n SPEED: 'object',\n COLOR: 'array'\n };\n }\n // 初始弹幕样式\n static get cssText() {\n return `\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, \"Microsoft JhengHei\", Arial, Helvetica, sans-serif;\n 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;\n `;\n }\n // 是否在移动端使用了自动旋屏,会影响弹幕的left和top值\n get isRotate() {\n return this.art.plugins?.autoOrientation?.state;\n }\n // 计算上空白边距\n get marginTop() {\n const { clamp } = this.utils;\n const value = this.option.margin[0];\n const { clientHeight } = this.$player;\n if (typeof value === 'number') return clamp(value, 0, clientHeight);\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n return Danmuku.option.margin[0];\n }\n // 计算下空白边距\n get marginBottom() {\n const { clamp } = this.utils;\n const value = this.option.margin[1];\n const { clientHeight } = this.$player;\n if (typeof value === 'number') return clamp(value, 0, clientHeight);\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n return Danmuku.option.margin[1];\n }\n // 计算弹幕字体大小\n get fontSize() {\n const { clamp } = this.utils;\n const { clientHeight } = this.$player;\n const fontSize = this.option.fontSize;\n if (typeof fontSize === 'number') return Math.round(clamp(fontSize, 12, clientHeight));\n if (typeof fontSize === 'string' && fontSize.endsWith('%')) {\n const ratio = parseFloat(fontSize) / 100;\n return Math.round(clamp(clientHeight * ratio, 12, clientHeight));\n }\n return Danmuku.option.fontSize;\n }\n // 获取弹幕DOM节点\n get $ref() {\n const $ref = this.$refs.pop() || document.createElement('div');\n $ref.style.cssText = Danmuku.cssText;\n $ref.dataset.mode = '';\n $ref.className = '';\n return $ref;\n }\n // 获取准备好发送的弹幕\n get readys() {\n const { currentTime } = this.art;\n const result = [];\n // 有的是ready状态:之前因为弹幕太多而暂停发送的弹幕\n this.filter('ready', (danmu)=>result.push(danmu));\n // 有的是wait状态:符合时间范围的弹幕\n this.filter('wait', (danmu)=>{\n if (currentTime + 0.1 >= danmu.time && danmu.time >= currentTime - 0.1) result.push(danmu);\n });\n return result;\n }\n // 可见的弹幕的数据,用于计算下一个弹幕的top值\n get visibles() {\n const result = [];\n const { clientWidth } = this.$player;\n const clientLeft = this.getLeft(this.$player);\n this.filter('emit', (danmu)=>{\n const top = danmu.$ref.offsetTop;\n const left = this.getLeft(danmu.$ref) - clientLeft;\n const height = danmu.$ref.clientHeight;\n const width = danmu.$ref.clientWidth;\n const distance = left + width;\n const right = clientWidth - distance;\n const speed = distance / danmu.$restTime;\n const emit = {};\n emit.top = top;\n emit.left = left;\n emit.height = height;\n emit.width = width;\n emit.right = right;\n emit.speed = speed;\n emit.distance = distance;\n emit.time = danmu.$restTime;\n emit.mode = danmu.mode;\n result.push(emit);\n });\n return result;\n }\n // 计算弹幕速度\n get speed() {\n return this.option.synchronousPlayback && this.art.playbackRate ? this.option.speed / Number(this.art.playbackRate) : this.option.speed;\n }\n // 加载弹幕\n async load(danmuku) {\n const { errorHandle } = this.utils;\n let danmus = [];\n const target = danmuku || this.option.danmuku;\n try {\n if (typeof target === 'function') danmus = await target(); // 异步函数获取\n else if (target instanceof Promise) danmus = await target; // 从 Promise 对象获取\n else if (typeof target === 'string') danmus = await (0, _bilibili.bilibiliDanmuParseFromUrl)(target); // 从B站xml链接解析\n else if (Array.isArray(target)) danmus = target; // 直接传入数组\n errorHandle(Array.isArray(danmus), 'Danmuku need return an array as result');\n // 假如没有传入弹幕参数,则清空弹幕,否则追加弹幕\n if (danmuku === undefined) {\n this.reset(); // 重置弹幕\n this.queue = []; // 清空弹幕队列\n this.states = {\n wait: [],\n ready: [],\n emit: [],\n stop: []\n }; // 清空弹幕状态池\n this.$refs = []; // 清空弹幕DOM节点池\n this.$danmuku.innerText = ''; // 清空弹幕层\n }\n // 逐个验证原始弹幕并转换到弹幕队列\n for(let index = 0; index < danmus.length; index++){\n const danmu = danmus[index];\n await this.emit(danmu);\n }\n this.art.emit('artplayerPluginDanmuku:loaded', this.queue);\n } catch (error) {\n this.art.emit('artplayerPluginDanmuku:error', error);\n throw error;\n }\n return this;\n }\n // 把原始弹幕转换到弹幕队列\n async emit(danmu) {\n const { clamp } = this.utils;\n this.validator(danmu, {\n text: 'string',\n mode: '?number',\n color: '?string',\n time: '?number',\n border: '?boolean',\n style: '?object'\n });\n // 弹幕文本为空则直接忽略\n if (!danmu.text.trim()) return this;\n // 设置弹幕时间,如果没有则默认为当前时间加 0.5 秒\n if (danmu.time) danmu.time = clamp(danmu.time, 0, Infinity);\n else danmu.time = this.art.currentTime + 0.5;\n // 设置弹幕模式,如果没有则默认为全局配置\n if (danmu.mode === undefined) danmu.mode = this.option.mode;\n // 设置弹幕单独样式,如果没有则默认为空对象\n if (danmu.style === undefined) danmu.style = {};\n // 设置弹幕颜色,如果没有则默认为全局配置\n if (danmu.color === undefined) danmu.color = this.option.color;\n // 弹幕模式只能是 0, 1, 2\n if (![\n 0,\n 1,\n 2\n ].includes(danmu.mode)) return this;\n // 自定义弹幕过滤函数\n if (!this.option.filter(danmu)) return this;\n // 添加自定义属性\n const item = {\n ...danmu,\n $state: 'wait',\n $id: this.index++,\n $ref: null,\n $restTime: 0,\n $lastStartTime: 0\n };\n // 转换为wait状态\n this.setState(item, 'wait');\n // 添加到实际弹幕队列\n this.queue.push(item);\n // 弹幕有四个状态:\n // - wait: 弹幕还未开始显示,没有被添加到 DOM 中\n // - ready: 弹幕准备好显示,没有被添加到 DOM 中\n // - emit: 弹幕正在显示,已经被添加到 DOM 中\n // - stop: 弹幕正在停止显示,已经被添加到 DOM 中\n return this;\n }\n // 动态配置\n config(option, isInit = false) {\n const { clamp } = this.utils;\n const { $controlsCenter } = this.art.template;\n // 判断配置项是否有变化\n const changed = Object.keys(option).some((key)=>JSON.stringify(this.option[key]) !== JSON.stringify(option[key]));\n // 没有变化则直接返回\n if (!changed && !isInit) return this;\n // 更新配置项\n this.option = Object.assign({}, Danmuku.option, this.option, option);\n this.validator(this.option, Danmuku.scheme);\n this.option.mode = clamp(this.option.mode, 0, 2);\n this.option.speed = clamp(this.option.speed, 1, 10);\n this.option.opacity = clamp(this.option.opacity, 0, 1);\n this.option.lockTime = clamp(this.option.lockTime, 1, 60);\n this.option.maxLength = clamp(this.option.maxLength, 1, 1000);\n this.option.mount = this.option.mount || $controlsCenter;\n // 动态配置有字体大小,需要重新渲染\n if (option.fontSize) this.reset();\n // 通过配置项控制弹幕的显示和隐藏\n if (this.option.visible) this.show();\n else this.hide();\n this.art.emit('artplayerPluginDanmuku:config', this.option);\n return this;\n }\n // 计算DOM的left值,受到旋屏影响\n getLeft($ref) {\n const rect = $ref.getBoundingClientRect();\n return this.isRotate ? rect.top : rect.left;\n }\n // 复杂运算交给 Web Worker 处理\n postMessage(message = {}) {\n return new Promise((resolve)=>{\n message.id = Date.now(); // 生成唯一标识\n this.worker.postMessage(message);\n this.worker.onmessage = (event)=>{\n const { data } = event;\n // 判断是否是当前的消息\n if (data.id === message.id) resolve(data);\n };\n });\n }\n // 根据状态获取弹幕\n filter(state, callback) {\n const danmus = this.states[state] || [];\n for(let index = 0; index < danmus.length; index++)callback(danmus[index]);\n return danmus;\n }\n // 设置弹幕状态\n setState(danmu, state) {\n // 从原状态池中删除\n this.states[danmu.$state] = this.states[danmu.$state].filter((item)=>item !== danmu);\n // 设置新状态\n danmu.$state = state;\n // 设置DOM节点状态\n if (danmu.$ref) danmu.$ref.dataset.state = state;\n // 添加到新状态池中\n this.states[state].push(danmu);\n }\n // 重置弹幕到wait状态,回收弹幕DOM节点\n makeWait(danmu) {\n this.setState(danmu, 'wait');\n if (danmu.$ref) {\n danmu.$ref.style.cssText = Danmuku.cssText;\n danmu.$ref.style.visibility = 'hidden';\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = 'translateX(0px)';\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n // 实时更新弹幕\n update() {\n const { setStyles } = this.utils;\n this.timer = window.requestAnimationFrame(async ()=>{\n if (this.art.playing && !this.isHide) {\n // 实时计算弹幕的剩余显示时间\n this.filter('emit', (danmu)=>{\n const emitTime = (Date.now() - danmu.$lastStartTime) / 1000;\n danmu.$restTime -= emitTime;\n danmu.$lastStartTime = Date.now();\n // 超过时间即重置弹幕\n if (danmu.$restTime <= 0) this.makeWait(danmu);\n });\n // 获取准备好发送的弹幕,可能包含ready和wait状态的弹幕\n const readys = this.readys;\n for(let index = 0; index < readys.length; index++){\n const danmu = readys[index];\n // 弹幕发送前的过滤器\n const state = await this.option.beforeVisible(danmu);\n if (state) {\n const { clientWidth, clientHeight } = this.$player;\n danmu.$ref = this.$ref; // 获取弹幕DOM节点\n danmu.$ref.innerText = danmu.text; // 设置弹幕文本\n // 提前添加到弹幕层中,用于计算top值\n this.$danmuku.appendChild(danmu.$ref);\n // 设置初始弹幕样式\n danmu.$ref.style.opacity = this.option.opacity;\n danmu.$ref.style.fontSize = `${this.fontSize}px`;\n danmu.$ref.style.color = danmu.color;\n danmu.$ref.style.border = danmu.border ? `1px solid ${danmu.color}` : null;\n danmu.$ref.style.backgroundColor = danmu.border ? 'rgb(0 0 0 / 50%)' : null;\n // 设置单独弹幕样式\n setStyles(danmu.$ref, danmu.style);\n // 记录弹幕时间戳\n danmu.$lastStartTime = Date.now();\n // 计算弹幕剩余时间\n danmu.$restTime = this.speed;\n // 计算弹幕滚动的距离\n const distance = clientWidth + danmu.$ref.clientWidth;\n // 计算弹幕的top值\n const { result: top } = await this.postMessage({\n type: 'getDanmuTop',\n target: {\n mode: danmu.mode,\n height: danmu.$ref.clientHeight,\n speed: distance / danmu.$restTime\n },\n visibles: this.visibles,\n antiOverlap: this.option.antiOverlap,\n clientWidth: clientWidth,\n clientHeight: clientHeight,\n marginBottom: this.marginBottom,\n marginTop: this.marginTop\n });\n if (danmu.$ref) {\n if (!this.isStop && top !== undefined) {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$ref.style.top = `${top}px`;\n danmu.$ref.style.visibility = 'visible';\n danmu.$ref.dataset.mode = danmu.mode; // CSS控制模式的显示和隐藏\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n case 1:\n // falls through\n case 2:\n danmu.$ref.style.left = '50%';\n danmu.$ref.style.marginLeft = `-${danmu.$ref.clientWidth / 2}px`;\n break;\n default:\n break;\n }\n this.art.emit('artplayerPluginDanmuku:visible', danmu);\n } else {\n // 假如弹幕已经停止或者没有 top 值,则重置弹幕为ready状态,回收弹幕DOM节点,等待下次发送\n this.setState(danmu, 'ready');\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n }\n }\n }\n // 递归调用\n if (!this.isStop) this.update();\n });\n return this;\n }\n // 重置正在显示的弹幕: stop/emit 状态的弹幕\n resize() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu)=>{\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n break;\n default:\n break;\n }\n });\n this.filter('emit', (danmu)=>{\n danmu.$lastStartTime = Date.now();\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n }\n // 继续弹幕\n continue() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu)=>{\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$lastStartTime = Date.now();\n switch(danmu.mode){\n // 继续滚动的弹幕\n case 0:\n {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n return this;\n }\n // 暂停弹幕\n suspend() {\n const { clientWidth } = this.$player;\n this.filter('emit', (danmu)=>{\n this.setState(danmu, 'stop'); // 转换为stop状态\n switch(danmu.mode){\n // 停止滚动的弹幕\n case 0:\n {\n const translateX = clientWidth - (this.getLeft(danmu.$ref) - this.getLeft(this.$player));\n danmu.$ref.style.transform = `translateX(${-translateX}px)`;\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n break;\n }\n default:\n break;\n }\n });\n return this;\n }\n stop() {\n this.isStop = true;\n this.suspend();\n window.cancelAnimationFrame(this.timer);\n this.art.emit('artplayerPluginDanmuku:stop');\n return this;\n }\n start() {\n this.isStop = false;\n this.continue();\n this.update();\n this.art.emit('artplayerPluginDanmuku:start');\n return this;\n }\n reset() {\n this.queue.forEach((danmu)=>this.makeWait(danmu));\n this.art.emit('artplayerPluginDanmuku:reset');\n return this;\n }\n show() {\n this.isHide = false;\n this.$danmuku.style.opacity = 1;\n this.option.visible = true;\n this.art.emit('artplayerPluginDanmuku:show');\n return this;\n }\n hide() {\n this.isHide = true;\n this.$danmuku.style.opacity = 0;\n this.option.visible = false;\n this.art.emit('artplayerPluginDanmuku:hide');\n return this;\n }\n destroy() {\n this.stop();\n this.worker.terminate();\n this.art.off('video:play', this.start);\n this.art.off('video:playing', this.start);\n this.art.off('video:pause', this.stop);\n this.art.off('video:waiting', this.stop);\n this.art.off('resize', this.reset);\n this.art.off('destroy', this.destroy);\n this.art.emit('artplayerPluginDanmuku:destroy');\n }\n}\nexports.default = Danmuku;\n\n},{\"./bilibili\":\"lLE5f\",\"bundle-text:./worker\":\"2to4T\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}],\"lLE5f\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"bilibiliDanmuParseFromUrl\", ()=>bilibiliDanmuParseFromUrl);\nfunction getMode(key) {\n switch(key){\n case 1:\n case 2:\n case 3:\n return 0;\n case 4:\n return 2;\n case 5:\n return 1;\n default:\n return 0;\n }\n}\nfunction bilibiliDanmuParseFromXml(xmlString) {\n if (typeof xmlString !== 'string') return [];\n const reg = new RegExp(/.+?)\"(?: .*?)?>(?.+?)<\\/d>/gs);\n const matches = xmlString.matchAll(reg);\n return Array.from(matches).map((match)=>{\n const attr = match.groups.p.split(',');\n if (attr.length >= 8) {\n const text = match.groups.text.trim().replaceAll('"', '\"').replaceAll(''', \"'\").replaceAll('<', '<').replaceAll('>', '>').replaceAll('&', '&');\n return {\n text,\n time: Number(attr[0]),\n mode: getMode(Number(attr[1])),\n fontSize: Number(attr[2]),\n color: `#${Number(attr[3]).toString(16)}`,\n timestamp: Number(attr[4]),\n pool: Number(attr[5]),\n userID: attr[6],\n rowID: Number(attr[7])\n };\n } else return null;\n }).filter(Boolean);\n}\nfunction onmessage({ data }) {\n const { xml, id } = data;\n if (!id || !xml) return;\n const danmus = bilibiliDanmuParseFromXml(xml);\n self.postMessage({\n danmus,\n id\n });\n}\nfunction createWorker() {\n const workerText = `\n ${getMode.toString()}\n ${bilibiliDanmuParseFromXml.toString()}\n onmessage = ${onmessage.toString()}\n `;\n const blob = new Blob([\n workerText\n ], {\n type: 'application/javascript'\n });\n return new Worker(URL.createObjectURL(blob));\n}\nfunction bilibiliDanmuParseFromUrl(url) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve)=>{\n const res = await fetch(url);\n const xml = await res.text();\n try {\n const worker = createWorker();\n worker.onmessage = (event)=>{\n const { danmus, id } = event.data;\n if (!id || !danmus) return;\n resolve(danmus);\n worker.terminate();\n };\n worker.postMessage({\n xml,\n id: Date.now()\n });\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n const danmus = bilibiliDanmuParseFromXml(xml);\n resolve(danmus);\n }\n });\n}\n\n},{\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}],\"w4pLy\":[function(require,module,exports,__globalThis) {\nexports.interopDefault = function(a) {\n return a && a.__esModule ? a : {\n default: a\n };\n};\nexports.defineInteropFlag = function(a) {\n Object.defineProperty(a, '__esModule', {\n value: true\n });\n};\nexports.exportAll = function(source, dest) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return;\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function() {\n return source[key];\n }\n });\n });\n return dest;\n};\nexports.export = function(dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get\n });\n};\n\n},{}],\"2to4T\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"!function(e,t,i,r,o,n,d,f){var l=\\\"undefined\\\"!=typeof globalThis?globalThis:\\\"undefined\\\"!=typeof self?self:\\\"undefined\\\"!=typeof window?window:\\\"undefined\\\"!=typeof global?global:{},u=\\\"function\\\"==typeof l[r]&&l[r],h=u.i||{},p=u.cache||{},s=\\\"undefined\\\"!=typeof module&&\\\"function\\\"==typeof module.require&&module.require.bind(module);function a(t,i){if(!p[t]){if(!e[t]){if(o[t])return o[t];var n=\\\"function\\\"==typeof l[r]&&l[r];if(!i&&n)return n(t,!0);if(u)return u(t,!0);if(s&&\\\"string\\\"==typeof t)return s(t);var d=Error(\\\"Cannot find module '\\\"+t+\\\"'\\\");throw d.code=\\\"MODULE_NOT_FOUND\\\",d}h.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},h.cache={};var f=p[t]=new a.Module(t);e[t][0].call(f.exports,h,f,f.exports,l)}return p[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=s,this.exports={}},a.modules=e,a.cache=p,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=h,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,\\\"root\\\",{get:function(){return l[r]}}),l[r]=a;for(var c=0;ct.mode===e.mode&&t.top<=f).sort((e,t)=>e.top-t.top);if(0===l.length)if(2===e.mode)return f-e.height;else return n;if(l.unshift({type:\\\"top\\\",top:0,left:0,right:0,height:n,width:i,speed:0,distance:i}),l.push({type:\\\"bottom\\\",top:f,left:0,right:0,height:o,width:i,speed:0,distance:i}),2===e.mode)for(let t=l.length-2;t>=0;t-=1){let i=l[t],r=l[t+1],o=i.top+i.height;if(r.top-o>=e.height)return r.top-e.height}else for(let t=1;t=e.height)return o}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),r=Math.min(...e.map(e=>e.right));return i*t.length-r*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},[\\\"dETh6\\\"],\\\"dETh6\\\",\\\"parcelRequire93cf\\\",{});let{\\\"*\\\":e}=parcelRequire93cf(\\\"dETh6\\\");export{e as default};\";\n\n},{}],\"jUZBE\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nvar _styleLess = require(\"bundle-text:./style.less\");\nvar _styleLessDefault = parcelHelpers.interopDefault(_styleLess);\nvar _onSvg = require(\"bundle-text:./img/on.svg\");\nvar _onSvgDefault = parcelHelpers.interopDefault(_onSvg);\nvar _offSvg = require(\"bundle-text:./img/off.svg\");\nvar _offSvgDefault = parcelHelpers.interopDefault(_offSvg);\nvar _configSvg = require(\"bundle-text:./img/config.svg\");\nvar _configSvgDefault = parcelHelpers.interopDefault(_configSvg);\nvar _styleSvg = require(\"bundle-text:./img/style.svg\");\nvar _styleSvgDefault = parcelHelpers.interopDefault(_styleSvg);\nvar _mode0OffSvg = require(\"bundle-text:./img/mode_0_off.svg\");\nvar _mode0OffSvgDefault = parcelHelpers.interopDefault(_mode0OffSvg);\nvar _mode0OnSvg = require(\"bundle-text:./img/mode_0_on.svg\");\nvar _mode0OnSvgDefault = parcelHelpers.interopDefault(_mode0OnSvg);\nvar _mode1OffSvg = require(\"bundle-text:./img/mode_1_off.svg\");\nvar _mode1OffSvgDefault = parcelHelpers.interopDefault(_mode1OffSvg);\nvar _mode1OnSvg = require(\"bundle-text:./img/mode_1_on.svg\");\nvar _mode1OnSvgDefault = parcelHelpers.interopDefault(_mode1OnSvg);\nvar _mode2OffSvg = require(\"bundle-text:./img/mode_2_off.svg\");\nvar _mode2OffSvgDefault = parcelHelpers.interopDefault(_mode2OffSvg);\nvar _mode2OnSvg = require(\"bundle-text:./img/mode_2_on.svg\");\nvar _mode2OnSvgDefault = parcelHelpers.interopDefault(_mode2OnSvg);\nvar _checkOnSvg = require(\"bundle-text:./img/check_on.svg\");\nvar _checkOnSvgDefault = parcelHelpers.interopDefault(_checkOnSvg);\nvar _checkOffSvg = require(\"bundle-text:./img/check_off.svg\");\nvar _checkOffSvgDefault = parcelHelpers.interopDefault(_checkOffSvg);\nclass Setting {\n constructor(art, danmuku){\n this.art = art;\n this.danmuku = danmuku;\n this.utils = art.constructor.utils;\n const { setStyle } = this.utils;\n const { $controlsCenter } = art.template;\n setStyle($controlsCenter, 'display', 'flex');\n this.template = {\n $controlsCenter,\n $mount: $controlsCenter,\n $danmuku: null,\n $toggle: null,\n $config: null,\n $configPanel: null,\n $configModes: null,\n $style: null,\n $stylePanel: null,\n $styleModes: null,\n $colors: null,\n $opacitySlider: null,\n $opacityValue: null,\n $marginSlider: null,\n $marginValue: null,\n $fontSizeSlider: null,\n $fontSizeValue: null,\n $speedSlider: null,\n $speedValue: null,\n $input: null,\n $send: null\n };\n this.slider = {\n opacity: null,\n margin: null,\n fontSize: null,\n speed: null\n };\n this.emitting = false;\n this.isLock = false;\n this.timer = null;\n this.createTemplate();\n this.createSliders();\n this.createEvents();\n this.mount(this.option.mount);\n art.on('resize', ()=>this.resize());\n art.on('fullscreen', (state)=>this.onFullscreen(state));\n art.on('fullscreenWeb', (state)=>this.onFullscreen(state));\n art.proxy(this.template.$config, 'mouseenter', ()=>{\n this.onMouseEnter({\n $control: this.template.$config,\n $panel: this.template.$configPanel\n });\n });\n art.proxy(this.template.$style, 'mouseenter', ()=>{\n this.onMouseEnter({\n $control: this.template.$style,\n $panel: this.template.$stylePanel\n });\n });\n }\n static get icons() {\n return {\n $on: (0, _onSvgDefault.default),\n $off: (0, _offSvgDefault.default),\n $config: (0, _configSvgDefault.default),\n $style: (0, _styleSvgDefault.default),\n $mode_0_off: (0, _mode0OffSvgDefault.default),\n $mode_0_on: (0, _mode0OnSvgDefault.default),\n $mode_1_off: (0, _mode1OffSvgDefault.default),\n $mode_1_on: (0, _mode1OnSvgDefault.default),\n $mode_2_off: (0, _mode2OffSvgDefault.default),\n $mode_2_on: (0, _mode2OnSvgDefault.default),\n $check_on: (0, _checkOnSvgDefault.default),\n $check_off: (0, _checkOffSvgDefault.default)\n };\n }\n get option() {\n return this.danmuku.option;\n }\n get outside() {\n return this.template.$mount !== this.template.$controlsCenter;\n }\n get TEMPLATE() {\n const { option } = this;\n return `\n
\n ${0, _onSvgDefault.default}${0, _offSvgDefault.default}\n
\n
\n ${0, _configSvgDefault.default}\n
\n
\n
\n \\u{6309}\\u{7C7B}\\u{578B}\\u{5C4F}\\u{853D}\n
\n
\n ${0, _mode0OffSvgDefault.default}${0, _mode0OnSvgDefault.default}\n
\\u{6EDA}\\u{52A8}
\n
\n
\n ${0, _mode1OffSvgDefault.default}${0, _mode1OnSvgDefault.default}\n
\\u{9876}\\u{90E8}
\n
\n
\n ${0, _mode2OffSvgDefault.default}${0, _mode2OnSvgDefault.default}\n
\\u{5E95}\\u{90E8}
\n
\n
\n
\n
\n
\n ${0, _checkOnSvgDefault.default}${0, _checkOffSvgDefault.default}\n \\u{9632}\\u{6B62}\\u{5F39}\\u{5E55}\\u{91CD}\\u{53E0}\n
\n
\n ${0, _checkOnSvgDefault.default}${0, _checkOffSvgDefault.default}\n \\u{540C}\\u{6B65}\\u{89C6}\\u{9891}\\u{901F}\\u{5EA6}\n
\n
\n
\n \\u{4E0D}\\u{900F}\\u{660E}\\u{5EA6}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{663E}\\u{793A}\\u{533A}\\u{57DF}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{5F39}\\u{5E55}\\u{5B57}\\u{53F7}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{5F39}\\u{5E55}\\u{901F}\\u{5EA6}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n
\n
\n
\n
\n ${0, _styleSvgDefault.default}\n
\n
\n
\n \\u{6A21}\\u{5F0F}\n
\n
\n ${0, _mode0OnSvgDefault.default}\n
\\u{6EDA}\\u{52A8}
\n
\n
\n ${0, _mode1OnSvgDefault.default}\n
\\u{9876}\\u{90E8}
\n
\n
\n ${0, _mode2OnSvgDefault.default}\n
\\u{5E95}\\u{90E8}
\n
\n
\n
\n
\n \\u{989C}\\u{8272}\n
\n ${this.COLOR.map((color)=>`
`).join('')}\n
\n
\n
\n
\n
\n \n
\\u{53D1}\\u{9001}
\n
\n `;\n }\n get OPACITY() {\n return {\n min: 0,\n max: 100,\n steps: [],\n ...this.option.OPACITY\n };\n }\n get FONT_SIZE() {\n return {\n min: 12,\n max: 120,\n steps: [],\n ...this.option.FONT_SIZE\n };\n }\n get MARGIN() {\n return {\n min: 0,\n max: 3,\n steps: [\n {\n name: '1/4',\n value: [\n 10,\n '75%'\n ]\n },\n {\n name: \"\\u534A\\u5C4F\",\n value: [\n 10,\n '50%'\n ]\n },\n {\n name: '3/4',\n value: [\n 10,\n '25%'\n ]\n },\n {\n name: \"\\u6EE1\\u5C4F\",\n value: [\n 10,\n 10\n ]\n }\n ],\n ...this.option.MARGIN\n };\n }\n get SPEED() {\n return {\n min: 0,\n max: 4,\n steps: [\n {\n name: \"\\u6781\\u6162\",\n value: 10\n },\n {\n name: \"\\u8F83\\u6162\",\n value: 7.5,\n hide: true\n },\n {\n name: \"\\u9002\\u4E2D\",\n value: 5\n },\n {\n name: \"\\u8F83\\u5FEB\",\n value: 2.5,\n hide: true\n },\n {\n name: \"\\u6781\\u5FEB\",\n value: 1\n }\n ],\n ...this.option.SPEED\n };\n }\n get COLOR() {\n return this.option.COLOR.length ? this.option.COLOR : [\n '#FE0302',\n '#FF7204',\n '#FFAA02',\n '#FFD302',\n '#FFFF00',\n '#A0EE00',\n '#00CD00',\n '#019899',\n '#4266BE',\n '#89D5FF',\n '#CC0273',\n '#222222',\n '#9B9B9B',\n '#FFFFFF'\n ];\n }\n query(selector) {\n const { query } = this.utils;\n const { $danmuku } = this.template;\n return query(selector, $danmuku);\n }\n append(el, target) {\n const { append } = this.utils;\n const children = [\n ...el.children\n ];\n if (children.some((item)=>item === target)) return;\n append(el, target);\n }\n setData(key, value) {\n const { $player } = this.art.template;\n const { $mount } = this.template;\n $player.dataset[key] = value;\n if (this.outside) $mount.dataset[key] = value;\n }\n createTemplate() {\n const { createElement, tooltip } = this.utils;\n const $danmuku = createElement('div');\n $danmuku.className = 'artplayer-plugin-danmuku';\n $danmuku.innerHTML = this.TEMPLATE;\n this.template.$danmuku = $danmuku;\n this.template.$toggle = this.query('.apd-toggle');\n this.template.$config = this.query('.apd-config');\n this.template.$configPanel = this.query('.apd-config-panel');\n this.template.$configModes = this.query('.apd-config-mode .apd-modes');\n this.template.$style = this.query('.apd-style');\n this.template.$stylePanel = this.query('.apd-style-panel');\n this.template.$styleModes = this.query('.apd-style-mode .apd-modes');\n this.template.$colors = this.query('.apd-colors');\n this.template.$antiOverlap = this.query('.apd-anti-overlap');\n this.template.$syncVideo = this.query('.apd-sync-video');\n this.template.$opacitySlider = this.query('.apd-config-opacity .apd-slider');\n this.template.$opacityValue = this.query('.apd-config-opacity .apd-value');\n this.template.$marginSlider = this.query('.apd-config-margin .apd-slider');\n this.template.$marginValue = this.query('.apd-config-margin .apd-value');\n this.template.$fontSizeSlider = this.query('.apd-config-fontSize .apd-slider');\n this.template.$fontSizeValue = this.query('.apd-config-fontSize .apd-value');\n this.template.$speedSlider = this.query('.apd-config-speed .apd-slider');\n this.template.$speedValue = this.query('.apd-config-speed .apd-value');\n this.template.$input = this.query('.apd-input');\n this.template.$send = this.query('.apd-send');\n const { $toggle } = this.template;\n this.art.on('artplayerPluginDanmuku:show', ()=>{\n tooltip($toggle, \"\\u5173\\u95ED\\u5F39\\u5E55\");\n });\n this.art.on('artplayerPluginDanmuku:hide', ()=>{\n tooltip($toggle, \"\\u6253\\u5F00\\u5F39\\u5E55\");\n });\n }\n createEvents() {\n const { $toggle, $configModes, $styleModes, $colors, $antiOverlap, $syncVideo, $send, $input } = this.template;\n this.art.proxy($toggle, 'click', ()=>{\n this.danmuku.config({\n visible: !this.option.visible\n });\n this.reset();\n });\n this.art.proxy($configModes, 'click', (event)=>{\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n if (this.option.modes.includes(mode)) this.danmuku.config({\n modes: this.option.modes.filter((m)=>m !== mode)\n });\n else this.danmuku.config({\n modes: [\n ...this.option.modes,\n mode\n ]\n });\n this.reset();\n });\n this.art.proxy($antiOverlap, 'click', ()=>{\n this.danmuku.config({\n antiOverlap: !this.option.antiOverlap\n });\n this.reset();\n });\n this.art.proxy($syncVideo, 'click', ()=>{\n this.danmuku.config({\n synchronousPlayback: !this.option.synchronousPlayback\n });\n this.reset();\n });\n this.art.proxy($styleModes, 'click', (event)=>{\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n this.danmuku.config({\n mode: mode\n });\n this.reset();\n });\n this.art.proxy($colors, 'click', (event)=>{\n const $color = event.target.closest('.apd-color');\n if (!$color) return;\n this.danmuku.config({\n color: $color.dataset.color\n });\n this.reset();\n });\n this.art.proxy($send, 'click', ()=>this.emit());\n this.art.proxy($input, 'keypress', (event)=>{\n if (event.key === 'Enter') {\n event.preventDefault();\n this.emit();\n }\n });\n }\n createSliders() {\n this.slider.opacity = this.createSlider({\n ...this.OPACITY,\n container: this.template.$opacitySlider,\n findIndex: ()=>{\n return Math.round(this.option.opacity * 100);\n },\n onChange: (index)=>{\n const { $opacityValue } = this.template;\n $opacityValue.textContent = `${index}%`;\n this.danmuku.config({\n opacity: index / 100\n });\n }\n });\n this.slider.margin = this.createSlider({\n ...this.MARGIN,\n container: this.template.$marginSlider,\n findIndex: ()=>{\n return this.MARGIN.steps.findIndex((item)=>item.value[0] === this.option.margin[0] && item.value[1] === this.option.margin[1]);\n },\n onChange: (index)=>{\n const margin = this.MARGIN.steps[index];\n if (!margin) return;\n const { $marginValue } = this.template;\n $marginValue.textContent = margin.name;\n this.danmuku.config({\n margin: margin.value\n });\n }\n });\n this.slider.fontSize = this.createSlider({\n ...this.FONT_SIZE,\n container: this.template.$fontSizeSlider,\n findIndex: ()=>{\n return this.danmuku.fontSize;\n },\n onChange: (index)=>{\n const { $fontSizeValue } = this.template;\n $fontSizeValue.textContent = `${index}px`;\n if (index === this.danmuku.fontSize) return;\n this.danmuku.config({\n fontSize: index\n });\n }\n });\n this.slider.speed = this.createSlider({\n ...this.SPEED,\n container: this.template.$speedSlider,\n findIndex: ()=>{\n return this.SPEED.steps.findIndex((item)=>item.value === this.option.speed);\n },\n onChange: (index)=>{\n const speed = this.SPEED.steps[index];\n if (!speed) return;\n const { $speedValue } = this.template;\n $speedValue.textContent = speed.name;\n this.danmuku.config({\n speed: speed.value\n });\n }\n });\n }\n createSlider({ min, max, container, findIndex, onChange, steps = [] }) {\n const { query, clamp, setStyle } = this.utils;\n setStyle(container, 'touch-action', 'none');\n container.innerHTML = `\n
\n
\n ${steps.map(()=>`
`).join('')}\n
\n
\n
\n
\n
\n ${steps.map((step)=>step.hide ? '' : `
${step.name}
`).join('')}\n
\n `;\n const $dot = query('.apd-slider-dot', container);\n const $progress = query('.apd-slider-progress', container);\n let isDroging = false;\n function reset(index = findIndex()) {\n if (index < min || index > max) return;\n const percentage = (index - min) / (max - min);\n $dot.style.left = `${percentage * 100}%`;\n if (steps.length === 0) $progress.style.width = $dot.style.left;\n onChange(index);\n }\n function updateLeft(event) {\n const { top, height, left, width } = container.getBoundingClientRect();\n if (this.art.isRotate) {\n const value = clamp(event.clientY - top, 0, height);\n const index = Math.round(value / height * (max - min) + min);\n reset(index);\n } else {\n const value = clamp(event.clientX - left, 0, width);\n const index = Math.round(value / width * (max - min) + min);\n reset(index);\n }\n }\n this.art.proxy(container, 'click', (event)=>{\n updateLeft.call(this, event);\n });\n this.art.proxy(container, 'pointerdown', (event)=>{\n isDroging = event.button === 0;\n });\n this.art.proxy(document, 'pointermove', (event)=>{\n if (isDroging) updateLeft.call(this, event);\n });\n this.art.proxy(document, 'pointerup', (event)=>{\n if (isDroging) {\n isDroging = false;\n updateLeft.call(this, event);\n }\n });\n return {\n reset\n };\n }\n onFullscreen(state) {\n const { $danmuku, $controlsCenter, $mount } = this.template;\n if (this.outside) {\n if (state) this.append($controlsCenter, $danmuku);\n else this.append($mount, $danmuku);\n } else this.append($controlsCenter, $danmuku);\n }\n onMouseEnter({ $control, $panel }) {\n const { $player } = this.art.template;\n const controlRect = $control.getBoundingClientRect();\n const panelRect = $panel.getBoundingClientRect();\n const playerRect = $player.getBoundingClientRect();\n const half = panelRect.width / 2 - controlRect.width / 2;\n const left = playerRect.left - (controlRect.left - half);\n const right = controlRect.right + half - playerRect.right;\n if (left > 0) $panel.style.left = `${-half + left}px`;\n else if (right > 0) $panel.style.left = `${-half - right}px`;\n else $panel.style.left = `${-half}px`;\n }\n async emit() {\n const { $input } = this.template;\n const text = $input.value.trim();\n if (!text.length) return;\n if (this.isLock) return;\n if (this.emitting) return;\n const danmu = {\n text: text,\n mode: this.option.mode,\n color: this.option.color,\n time: this.art.currentTime\n };\n try {\n this.emitting = true;\n const state = await this.option.beforeEmit(danmu);\n this.emitting = false;\n if (state !== true) return;\n danmu.border = true;\n delete danmu.time;\n this.danmuku.emit(danmu);\n $input.value = '';\n this.lock();\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n this.emitting = false;\n }\n }\n lock() {\n const { addClass } = this.utils;\n const { $send } = this.template;\n this.isLock = true;\n let time = this.option.lockTime;\n $send.innerText = time;\n addClass($send, 'apd-lock');\n const loop = ()=>{\n this.timer = setTimeout(()=>{\n if (time === 0) this.unlock();\n else {\n time -= 1;\n $send.innerText = time;\n loop();\n }\n }, 1000);\n };\n loop();\n }\n unlock() {\n const { removeClass } = this.utils;\n const { $send } = this.template;\n clearTimeout(this.timer);\n this.isLock = false;\n $send.innerText = \"\\u53D1\\u9001\";\n removeClass($send, 'apd-lock');\n }\n resize() {\n if (this.outside) return;\n if (this.art.fullscreen) return;\n if (this.art.fullscreenWeb) return;\n const { $player, $controlsCenter } = this.art.template;\n const { $danmuku } = this.template;\n if (this.art.width < this.option.width) this.append($player, $danmuku);\n else this.append($controlsCenter, $danmuku);\n }\n reset() {\n const { inverseClass, tooltip } = this.utils;\n const { $toggle, $colors } = this.template;\n this.slider.opacity.reset();\n this.slider.margin.reset();\n this.slider.fontSize.reset();\n this.slider.speed.reset();\n this.setData('danmukuVisible', this.option.visible);\n this.setData('danmukuMode', this.option.mode);\n this.setData('danmukuColor', this.option.color);\n this.setData('danmukuMode0', this.option.modes.includes(0));\n this.setData('danmukuMode1', this.option.modes.includes(1));\n this.setData('danmukuMode2', this.option.modes.includes(2));\n this.setData('danmukuAntiOverlap', this.option.antiOverlap);\n this.setData('danmukuSyncVideo', this.option.synchronousPlayback);\n this.setData('danmukuTheme', this.option.theme);\n this.setData('danmukuEmitter', this.option.emitter);\n const colors = $colors.children;\n const $color = Array.from(colors).find((item)=>item.dataset.color === this.option.color.toUpperCase());\n $color && inverseClass($color, 'apd-active');\n tooltip($toggle, this.option.visible ? \"\\u5173\\u95ED\\u5F39\\u5E55\" : \"\\u6253\\u5F00\\u5F39\\u5E55\");\n this.resize();\n }\n mount(target) {\n const { errorHandle } = this.utils;\n const $el = typeof target === 'string' ? document.querySelector(target) : target;\n errorHandle($el, `Can not find the mount point: ${target}`);\n this.append($el, this.template.$danmuku);\n this.template.$mount = $el;\n this.reset();\n }\n}\nexports.default = Setting;\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-danmuku';\n let $style = document.getElementById(id);\n if (!$style) {\n $style = document.createElement('style');\n $style.id = id;\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', ()=>{\n document.head.appendChild($style);\n });\n else (document.head || document.documentElement).appendChild($style);\n }\n $style.textContent = (0, _styleLessDefault.default);\n}\n\n},{\"bundle-text:./style.less\":\"lDhE1\",\"bundle-text:./img/on.svg\":\"eIVgK\",\"bundle-text:./img/off.svg\":\"ikaFC\",\"bundle-text:./img/config.svg\":\"4rX4v\",\"bundle-text:./img/style.svg\":\"7QZb5\",\"bundle-text:./img/mode_0_off.svg\":\"emfRo\",\"bundle-text:./img/mode_0_on.svg\":\"hgDUE\",\"bundle-text:./img/mode_1_off.svg\":\"c2dTL\",\"bundle-text:./img/mode_1_on.svg\":\"gDNkp\",\"bundle-text:./img/mode_2_off.svg\":\"04dKo\",\"bundle-text:./img/mode_2_on.svg\":\"dT4Rc\",\"bundle-text:./img/check_on.svg\":\"l7wFs\",\"bundle-text:./img/check_off.svg\":\"2rFnr\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}],\"lDhE1\":[function(require,module,exports,__globalThis) {\nmodule.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}\";\n\n},{}],\"eIVgK\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"ikaFC\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"4rX4v\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"7QZb5\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"emfRo\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"hgDUE\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"c2dTL\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"gDNkp\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"04dKo\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"dT4Rc\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"l7wFs\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"2rFnr\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"kCWvn\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>heatmap);\nconst lib = {\n map (value, inMin, inMax, outMin, outMax) {\n return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n },\n range (start, end, tick) {\n const s = Math.round(start / tick) * tick;\n return Array.from({\n length: Math.floor((end - start) / tick)\n }, (v, k)=>{\n return k * tick + s;\n });\n }\n};\nconst line = (pointA, pointB)=>{\n const lengthX = pointB[0] - pointA[0];\n const lengthY = pointB[1] - pointA[1];\n return {\n length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),\n angle: Math.atan2(lengthY, lengthX)\n };\n};\nfunction heatmap(art, danmuku, option) {\n const { query } = art.constructor.utils;\n art.controls.add({\n name: 'heatmap',\n position: 'top',\n html: '',\n style: {\n position: 'absolute',\n top: '-100px',\n left: '0px',\n right: '0px',\n height: '100px',\n width: '100%',\n pointerEvents: 'none'\n },\n mounted ($heatmap) {\n let $start = null;\n let $stop = null;\n function update(arg = []) {\n $start = null;\n $stop = null;\n $heatmap.innerHTML = '';\n if (!art.duration || art.option.isLive) return;\n const svg = {\n w: $heatmap.offsetWidth,\n h: $heatmap.offsetHeight\n };\n const options = {\n xMin: 0,\n xMax: svg.w,\n yMin: 0,\n yMax: 128,\n scale: 0.25,\n opacity: 0.2,\n minHeight: Math.floor(svg.h * 0.05),\n sampling: Math.floor(svg.w / 100),\n smoothing: 0.2,\n flattening: 0.2\n };\n if (typeof option === 'object') Object.assign(options, option);\n let points = [];\n if (Array.isArray(arg) && arg.length) points = [\n ...arg\n ];\n else {\n const gap = art.duration / svg.w;\n for(let x = 0; x <= svg.w; x += options.sampling){\n const y = danmuku.queue.filter(({ time })=>time > x * gap && time <= (x + options.sampling) * gap).length;\n points.push([\n x,\n y\n ]);\n }\n }\n if (points.length === 0) return;\n const lastPoint = points[points.length - 1];\n const lastX = lastPoint[0];\n const lastY = lastPoint[1];\n if (lastX !== svg.w) points.push([\n svg.w,\n lastY\n ]);\n const yPoints = points.map((point)=>point[1]);\n const yMin = Math.min(...yPoints);\n const yMax = Math.max(...yPoints);\n const yMid = (yMin + yMax) / 2;\n for(let i = 0; i < points.length; i++){\n const point = points[i];\n const y = point[1];\n point[1] = y * (y > yMid ? 1 + options.scale : 1 - options.scale) + options.minHeight;\n }\n const controlPoint = (current, previous, next, reverse)=>{\n const p = previous || current;\n const n = next || current;\n const o = line(p, n);\n const flat = lib.map(Math.cos(o.angle) * options.flattening, 0, 1, 1, 0);\n const angle = o.angle * flat + (reverse ? Math.PI : 0);\n const length = o.length * options.smoothing;\n const x = current[0] + Math.cos(angle) * length;\n const y = current[1] + Math.sin(angle) * length;\n return [\n x,\n y\n ];\n };\n const bezierCommand = (point, i, a)=>{\n const cps = controlPoint(a[i - 1], a[i - 2], point);\n const cpe = controlPoint(point, a[i - 1], a[i + 1], true);\n const close = i === a.length - 1 ? ' z' : '';\n return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}${close}`;\n };\n const pointsPositions = points.map((e)=>{\n const x = lib.map(e[0], options.xMin, options.xMax, 0, svg.w);\n const y = lib.map(e[1], options.yMin, options.yMax, svg.h, 0);\n return [\n x,\n y\n ];\n });\n const pathD = pointsPositions.reduce((acc, e, i, a)=>i === 0 ? `M ${a[a.length - 1][0]},${svg.h} L ${e[0]},${svg.h} L ${e[0]},${e[1]}` : `${acc} ${bezierCommand(e, i, a)}`, '');\n $heatmap.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n `;\n $start = query('#heatmap-start', $heatmap);\n $stop = query('#heatmap-stop', $heatmap);\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n art.on('video:timeupdate', ()=>{\n if ($start && $stop) {\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n });\n art.on('setBar', (type, percentage)=>{\n if ($start && $stop && type === 'played') {\n $start.setAttribute('offset', `${percentage * 100}%`);\n $stop.setAttribute('offset', `${percentage * 100}%`);\n }\n });\n art.on('ready', ()=>update());\n art.on('resize', ()=>update());\n art.on('artplayerPluginDanmuku:loaded', ()=>update());\n art.on('artplayerPluginDanmuku:points', (points)=>update(points));\n }\n });\n}\n\n},{\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}]},[\"4omrA\"], \"4omrA\", \"parcelRequire93cf\", {})\nlet {default: _default, } = parcelRequire93cf(\"4omrA\");\nexport {_default as default, };\n\n//# sourceMappingURL=index.js.map\n","import Danmuku from './danmuku';\nimport Setting from './setting';\nimport heatmap from './heatmap';\n\nexport default function artplayerPluginDanmuku(option) {\n return (art) => {\n const danmuku = new Danmuku(art, option);\n const setting = new Setting(art, danmuku);\n\n if (danmuku.option.heatmap) {\n heatmap(art, danmuku, danmuku.option.heatmap);\n }\n\n return {\n name: 'artplayerPluginDanmuku',\n emit: danmuku.emit.bind(danmuku),\n load: danmuku.load.bind(danmuku),\n config: danmuku.config.bind(danmuku),\n hide: danmuku.hide.bind(danmuku),\n show: danmuku.show.bind(danmuku),\n reset: danmuku.reset.bind(danmuku),\n mount: setting.mount.bind(setting),\n get option() {\n return danmuku.option;\n },\n get isHide() {\n return danmuku.isHide;\n },\n get isStop() {\n return danmuku.isStop;\n },\n };\n };\n}\n\nartplayerPluginDanmuku.icons = Setting.icons;\n\nif (typeof window !== 'undefined') {\n window['artplayerPluginDanmuku'] = artplayerPluginDanmuku;\n}\n","import { bilibiliDanmuParseFromUrl } from './bilibili';\nimport workerText from 'bundle-text:./worker';\n\nexport default class Danmuku {\n constructor(art, option) {\n const { constructor, template } = art;\n\n this.utils = constructor.utils; // 工具库\n this.validator = constructor.validator; // 配置校验器\n this.$danmuku = template.$danmuku; // 弹幕层容器\n this.$player = template.$player; // 播放器容器\n\n this.art = art;\n this.queue = []; // 实际弹幕队列\n this.$refs = []; // 弹幕DOM节点池\n this.isStop = false; // 是否停止\n this.isHide = false; // 是否隐藏\n this.timer = null; // 定时器\n this.index = 0; // 弹幕索引\n\n // 格式化后的配置项\n this.option = Danmuku.option;\n\n // 弹幕状态池\n this.states = { wait: [], ready: [], emit: [], stop: [] };\n\n // 初始化配置\n this.config(option, true);\n\n // 创建 Web Worker, 用于计算弹幕的 top 值\n const workerText2 = workerText.replace('export{e as default};', '');\n const blob = new Blob([workerText2], { type: 'application/javascript' });\n this.worker = new Worker(URL.createObjectURL(blob));\n\n // 绑定公用事件\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.reset = this.reset.bind(this);\n this.resize = this.resize.bind(this);\n this.destroy = this.destroy.bind(this);\n\n // 监听事件\n art.on('video:play', this.start);\n art.on('video:playing', this.start);\n art.on('video:pause', this.stop);\n art.on('video:waiting', this.stop);\n art.on('destroy', this.destroy);\n art.on('resize', this.resize);\n\n // 开始加载弹幕\n this.load();\n }\n\n // 默认配置\n static get option() {\n return {\n danmuku: [], // 弹幕数据\n speed: 5, // 弹幕持续时间,范围在[1 ~ 10]\n margin: [10, '25%'], // 弹幕上下边距,支持像素数字和百分比\n opacity: 1, // 弹幕透明度,范围在[0 ~ 1]\n color: '#FFFFFF', // 默认弹幕颜色,可以被单独弹幕项覆盖\n mode: 0, // 默认弹幕模式: 0: 滚动,1: 顶部,2: 底部\n modes: [0, 1, 2], // 弹幕可见的模式\n fontSize: 25, // 弹幕字体大小,支持像素数字和百分比\n antiOverlap: true, // 弹幕是否防重叠\n synchronousPlayback: false, // 是否同步播放速度\n mount: undefined, // 弹幕发射器挂载点, 默认为播放器控制栏中部\n heatmap: false, // 是否开启热力图\n width: 512, // 当播放器宽度小于此值时,弹幕发射器置于播放器底部\n points: [], // 热力图数据\n filter: () => true, // 弹幕载入前的过滤器,只支持返回布尔值\n beforeEmit: () => true, // 弹幕发送前的过滤器,支持返回 Promise\n beforeVisible: () => true, // 弹幕显示前的过滤器,支持返回 Promise\n visible: true, // 弹幕层是否可见\n emitter: true, // 是否开启弹幕发射器\n maxLength: 200, // 弹幕输入框最大长度, 范围在[1 ~ 1000]\n lockTime: 5, // 输入框锁定时间,范围在[1 ~ 60]\n theme: 'dark', // 弹幕主题,支持 dark 和 light,只在自定义挂载时生效\n OPACITY: {}, // 不透明度配置项\n FONT_SIZE: {}, // 弹幕字号配置项\n MARGIN: {}, // 显示区域配置项\n SPEED: {}, // 弹幕速度配置项\n COLOR: [], // 颜色列表配置项\n };\n }\n\n // 配置校验\n static get scheme() {\n return {\n danmuku: 'array|function|string',\n speed: 'number',\n margin: 'array',\n opacity: 'number',\n color: 'string',\n mode: 'number',\n modes: 'array',\n fontSize: 'number|string',\n antiOverlap: 'boolean',\n synchronousPlayback: 'boolean',\n mount: '?htmldivelement|string',\n heatmap: 'object|boolean',\n width: 'number',\n points: 'array',\n filter: 'function',\n beforeEmit: 'function',\n beforeVisible: 'function',\n visible: 'boolean',\n emitter: 'boolean',\n maxLength: 'number',\n lockTime: 'number',\n theme: 'string',\n OPACITY: 'object',\n FONT_SIZE: 'object',\n MARGIN: 'object',\n SPEED: 'object',\n COLOR: 'array',\n };\n }\n\n // 初始弹幕样式\n static get cssText() {\n return `\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, \"Microsoft JhengHei\", Arial, Helvetica, sans-serif;\n 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;\n `;\n }\n\n // 是否在移动端使用了自动旋屏,会影响弹幕的left和top值\n get isRotate() {\n return this.art.plugins?.autoOrientation?.state;\n }\n\n // 计算上空白边距\n get marginTop() {\n const { clamp } = this.utils;\n const value = this.option.margin[0];\n const { clientHeight } = this.$player;\n\n if (typeof value === 'number') {\n return clamp(value, 0, clientHeight);\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n\n return Danmuku.option.margin[0];\n }\n\n // 计算下空白边距\n get marginBottom() {\n const { clamp } = this.utils;\n const value = this.option.margin[1];\n const { clientHeight } = this.$player;\n\n if (typeof value === 'number') {\n return clamp(value, 0, clientHeight);\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n\n return Danmuku.option.margin[1];\n }\n\n // 计算弹幕字体大小\n get fontSize() {\n const { clamp } = this.utils;\n const { clientHeight } = this.$player;\n\n const fontSize = this.option.fontSize;\n\n if (typeof fontSize === 'number') {\n return Math.round(clamp(fontSize, 12, clientHeight));\n }\n\n if (typeof fontSize === 'string' && fontSize.endsWith('%')) {\n const ratio = parseFloat(fontSize) / 100;\n return Math.round(clamp(clientHeight * ratio, 12, clientHeight));\n }\n\n return Danmuku.option.fontSize;\n }\n\n // 获取弹幕DOM节点\n get $ref() {\n const $ref = this.$refs.pop() || document.createElement('div');\n $ref.style.cssText = Danmuku.cssText;\n $ref.dataset.mode = '';\n $ref.className = '';\n return $ref;\n }\n\n // 获取准备好发送的弹幕\n get readys() {\n const { currentTime } = this.art;\n\n const result = [];\n\n // 有的是ready状态:之前因为弹幕太多而暂停发送的弹幕\n this.filter('ready', (danmu) => result.push(danmu));\n\n // 有的是wait状态:符合时间范围的弹幕\n this.filter('wait', (danmu) => {\n if (currentTime + 0.1 >= danmu.time && danmu.time >= currentTime - 0.1) {\n result.push(danmu);\n }\n });\n\n return result;\n }\n\n // 可见的弹幕的数据,用于计算下一个弹幕的top值\n get visibles() {\n const result = [];\n const { clientWidth } = this.$player;\n const clientLeft = this.getLeft(this.$player);\n\n this.filter('emit', (danmu) => {\n const top = danmu.$ref.offsetTop;\n const left = this.getLeft(danmu.$ref) - clientLeft;\n const height = danmu.$ref.clientHeight;\n const width = danmu.$ref.clientWidth;\n const distance = left + width;\n const right = clientWidth - distance;\n const speed = distance / danmu.$restTime;\n\n const emit = {};\n emit.top = top;\n emit.left = left;\n emit.height = height;\n emit.width = width;\n emit.right = right;\n emit.speed = speed;\n emit.distance = distance;\n emit.time = danmu.$restTime;\n emit.mode = danmu.mode;\n\n result.push(emit);\n });\n\n return result;\n }\n\n // 计算弹幕速度\n get speed() {\n return this.option.synchronousPlayback && this.art.playbackRate\n ? this.option.speed / Number(this.art.playbackRate)\n : this.option.speed;\n }\n\n // 加载弹幕\n async load(danmuku) {\n const { errorHandle } = this.utils;\n\n let danmus = [];\n const target = danmuku || this.option.danmuku;\n\n try {\n if (typeof target === 'function') {\n danmus = await target(); // 异步函数获取\n } else if (target instanceof Promise) {\n danmus = await target; // 从 Promise 对象获取\n } else if (typeof target === 'string') {\n danmus = await bilibiliDanmuParseFromUrl(target); // 从B站xml链接解析\n } else if (Array.isArray(target)) {\n danmus = target; // 直接传入数组\n }\n\n errorHandle(Array.isArray(danmus), 'Danmuku need return an array as result');\n\n // 假如没有传入弹幕参数,则清空弹幕,否则追加弹幕\n if (danmuku === undefined) {\n this.reset(); // 重置弹幕\n this.queue = []; // 清空弹幕队列\n this.states = { wait: [], ready: [], emit: [], stop: [] }; // 清空弹幕状态池\n this.$refs = []; // 清空弹幕DOM节点池\n this.$danmuku.innerText = ''; // 清空弹幕层\n }\n\n // 逐个验证原始弹幕并转换到弹幕队列\n for (let index = 0; index < danmus.length; index++) {\n const danmu = danmus[index];\n await this.emit(danmu);\n }\n\n this.art.emit('artplayerPluginDanmuku:loaded', this.queue);\n } catch (error) {\n this.art.emit('artplayerPluginDanmuku:error', error);\n throw error;\n }\n\n return this;\n }\n\n // 把原始弹幕转换到弹幕队列\n async emit(danmu) {\n const { clamp } = this.utils;\n\n this.validator(danmu, {\n text: 'string', // 弹幕文本\n mode: '?number', // 弹幕模式: 0: 滚动,1: 顶部,2: 底部\n color: '?string', // 弹幕颜色\n time: '?number', // 弹幕时间\n border: '?boolean', // 弹幕是否有边框\n style: '?object', // 弹幕额外样式\n });\n\n // 弹幕文本为空则直接忽略\n if (!danmu.text.trim()) return this;\n\n // 设置弹幕时间,如果没有则默认为当前时间加 0.5 秒\n if (danmu.time) {\n danmu.time = clamp(danmu.time, 0, Infinity);\n } else {\n danmu.time = this.art.currentTime + 0.5;\n }\n\n // 设置弹幕模式,如果没有则默认为全局配置\n if (danmu.mode === undefined) {\n danmu.mode = this.option.mode;\n }\n\n // 设置弹幕单独样式,如果没有则默认为空对象\n if (danmu.style === undefined) {\n danmu.style = {};\n }\n\n // 设置弹幕颜色,如果没有则默认为全局配置\n if (danmu.color === undefined) {\n danmu.color = this.option.color;\n }\n\n // 弹幕模式只能是 0, 1, 2\n if (![0, 1, 2].includes(danmu.mode)) return this;\n\n // 自定义弹幕过滤函数\n if (!this.option.filter(danmu)) return this;\n\n // 添加自定义属性\n const item = {\n ...danmu,\n $state: 'wait', // 弹幕初始状态\n $id: this.index++, // 弹幕唯一标识\n $ref: null, // 弹幕 DOM 节点\n $restTime: 0, // 弹幕剩余时间\n $lastStartTime: 0, // 弹幕上次开始时间\n };\n\n // 转换为wait状态\n this.setState(item, 'wait');\n\n // 添加到实际弹幕队列\n this.queue.push(item);\n\n // 弹幕有四个状态:\n // - wait: 弹幕还未开始显示,没有被添加到 DOM 中\n // - ready: 弹幕准备好显示,没有被添加到 DOM 中\n // - emit: 弹幕正在显示,已经被添加到 DOM 中\n // - stop: 弹幕正在停止显示,已经被添加到 DOM 中\n\n return this;\n }\n\n // 动态配置\n config(option, isInit = false) {\n const { clamp } = this.utils;\n const { $controlsCenter } = this.art.template;\n\n // 判断配置项是否有变化\n const changed = Object.keys(option).some(\n (key) => JSON.stringify(this.option[key]) !== JSON.stringify(option[key]),\n );\n\n // 没有变化则直接返回\n if (!changed && !isInit) return this;\n\n // 更新配置项\n this.option = Object.assign({}, Danmuku.option, this.option, option);\n this.validator(this.option, Danmuku.scheme);\n\n this.option.mode = clamp(this.option.mode, 0, 2);\n this.option.speed = clamp(this.option.speed, 1, 10);\n this.option.opacity = clamp(this.option.opacity, 0, 1);\n this.option.lockTime = clamp(this.option.lockTime, 1, 60);\n this.option.maxLength = clamp(this.option.maxLength, 1, 1000);\n this.option.mount = this.option.mount || $controlsCenter;\n\n // 动态配置有字体大小,需要重新渲染\n if (option.fontSize) {\n this.reset();\n }\n\n // 通过配置项控制弹幕的显示和隐藏\n if (this.option.visible) {\n this.show();\n } else {\n this.hide();\n }\n\n this.art.emit('artplayerPluginDanmuku:config', this.option);\n\n return this;\n }\n\n // 计算DOM的left值,受到旋屏影响\n getLeft($ref) {\n const rect = $ref.getBoundingClientRect();\n return this.isRotate ? rect.top : rect.left;\n }\n\n // 复杂运算交给 Web Worker 处理\n postMessage(message = {}) {\n return new Promise((resolve) => {\n message.id = Date.now(); // 生成唯一标识\n this.worker.postMessage(message);\n this.worker.onmessage = (event) => {\n const { data } = event;\n // 判断是否是当前的消息\n if (data.id === message.id) {\n resolve(data);\n }\n };\n });\n }\n\n // 根据状态获取弹幕\n filter(state, callback) {\n const danmus = this.states[state] || [];\n for (let index = 0; index < danmus.length; index++) {\n callback(danmus[index]);\n }\n return danmus;\n }\n\n // 设置弹幕状态\n setState(danmu, state) {\n // 从原状态池中删除\n this.states[danmu.$state] = this.states[danmu.$state].filter((item) => item !== danmu);\n\n // 设置新状态\n danmu.$state = state;\n\n // 设置DOM节点状态\n if (danmu.$ref) {\n danmu.$ref.dataset.state = state;\n }\n\n // 添加到新状态池中\n this.states[state].push(danmu);\n }\n\n // 重置弹幕到wait状态,回收弹幕DOM节点\n makeWait(danmu) {\n this.setState(danmu, 'wait');\n if (danmu.$ref) {\n danmu.$ref.style.cssText = Danmuku.cssText;\n danmu.$ref.style.visibility = 'hidden';\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = 'translateX(0px)';\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n\n // 实时更新弹幕\n update() {\n const { setStyles } = this.utils;\n\n this.timer = window.requestAnimationFrame(async () => {\n if (this.art.playing && !this.isHide) {\n // 实时计算弹幕的剩余显示时间\n this.filter('emit', (danmu) => {\n const emitTime = (Date.now() - danmu.$lastStartTime) / 1000;\n danmu.$restTime -= emitTime;\n danmu.$lastStartTime = Date.now();\n // 超过时间即重置弹幕\n if (danmu.$restTime <= 0) {\n this.makeWait(danmu);\n }\n });\n\n // 获取准备好发送的弹幕,可能包含ready和wait状态的弹幕\n const readys = this.readys;\n\n for (let index = 0; index < readys.length; index++) {\n const danmu = readys[index];\n\n // 弹幕发送前的过滤器\n const state = await this.option.beforeVisible(danmu);\n\n if (state) {\n const { clientWidth, clientHeight } = this.$player;\n danmu.$ref = this.$ref; // 获取弹幕DOM节点\n danmu.$ref.innerText = danmu.text; // 设置弹幕文本\n\n // 提前添加到弹幕层中,用于计算top值\n this.$danmuku.appendChild(danmu.$ref);\n\n // 设置初始弹幕样式\n danmu.$ref.style.opacity = this.option.opacity;\n danmu.$ref.style.fontSize = `${this.fontSize}px`;\n danmu.$ref.style.color = danmu.color;\n danmu.$ref.style.border = danmu.border ? `1px solid ${danmu.color}` : null;\n danmu.$ref.style.backgroundColor = danmu.border ? 'rgb(0 0 0 / 50%)' : null;\n\n // 设置单独弹幕样式\n setStyles(danmu.$ref, danmu.style);\n\n // 记录弹幕时间戳\n danmu.$lastStartTime = Date.now();\n\n // 计算弹幕剩余时间\n danmu.$restTime = this.speed;\n\n // 计算弹幕滚动的距离\n const distance = clientWidth + danmu.$ref.clientWidth;\n\n // 计算弹幕的top值\n const { result: top } = await this.postMessage({\n type: 'getDanmuTop',\n target: {\n mode: danmu.mode,\n height: danmu.$ref.clientHeight,\n speed: distance / danmu.$restTime,\n }, // 当前弹幕信息\n visibles: this.visibles, // 可见的弹幕的数据\n antiOverlap: this.option.antiOverlap,\n clientWidth: clientWidth,\n clientHeight: clientHeight,\n marginBottom: this.marginBottom,\n marginTop: this.marginTop,\n });\n\n if (danmu.$ref) {\n if (!this.isStop && top !== undefined) {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$ref.style.top = `${top}px`;\n danmu.$ref.style.visibility = 'visible';\n danmu.$ref.dataset.mode = danmu.mode; // CSS控制模式的显示和隐藏\n\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0: {\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n case 1:\n // falls through\n case 2:\n danmu.$ref.style.left = '50%';\n danmu.$ref.style.marginLeft = `-${danmu.$ref.clientWidth / 2}px`;\n break;\n default:\n break;\n }\n\n this.art.emit('artplayerPluginDanmuku:visible', danmu);\n } else {\n // 假如弹幕已经停止或者没有 top 值,则重置弹幕为ready状态,回收弹幕DOM节点,等待下次发送\n this.setState(danmu, 'ready');\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n }\n }\n }\n\n // 递归调用\n if (!this.isStop) {\n this.update();\n }\n });\n return this;\n }\n\n // 重置正在显示的弹幕: stop/emit 状态的弹幕\n resize() {\n const { clientWidth } = this.$player;\n\n this.filter('stop', (danmu) => {\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n break;\n default:\n break;\n }\n });\n\n this.filter('emit', (danmu) => {\n danmu.$lastStartTime = Date.now();\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0: {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n }\n\n // 继续弹幕\n continue() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu) => {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$lastStartTime = Date.now();\n switch (danmu.mode) {\n // 继续滚动的弹幕\n case 0: {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n\n return this;\n }\n\n // 暂停弹幕\n suspend() {\n const { clientWidth } = this.$player;\n this.filter('emit', (danmu) => {\n this.setState(danmu, 'stop'); // 转换为stop状态\n switch (danmu.mode) {\n // 停止滚动的弹幕\n case 0: {\n const translateX = clientWidth - (this.getLeft(danmu.$ref) - this.getLeft(this.$player));\n danmu.$ref.style.transform = `translateX(${-translateX}px)`;\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n break;\n }\n default:\n break;\n }\n });\n\n return this;\n }\n\n stop() {\n this.isStop = true;\n this.suspend();\n window.cancelAnimationFrame(this.timer);\n this.art.emit('artplayerPluginDanmuku:stop');\n return this;\n }\n\n start() {\n this.isStop = false;\n this.continue();\n this.update();\n this.art.emit('artplayerPluginDanmuku:start');\n return this;\n }\n\n reset() {\n this.queue.forEach((danmu) => this.makeWait(danmu));\n this.art.emit('artplayerPluginDanmuku:reset');\n return this;\n }\n\n show() {\n this.isHide = false;\n this.$danmuku.style.opacity = 1;\n this.option.visible = true;\n this.art.emit('artplayerPluginDanmuku:show');\n return this;\n }\n\n hide() {\n this.isHide = true;\n this.$danmuku.style.opacity = 0;\n this.option.visible = false;\n this.art.emit('artplayerPluginDanmuku:hide');\n return this;\n }\n\n destroy() {\n this.stop();\n this.worker.terminate();\n this.art.off('video:play', this.start);\n this.art.off('video:playing', this.start);\n this.art.off('video:pause', this.stop);\n this.art.off('video:waiting', this.stop);\n this.art.off('resize', this.reset);\n this.art.off('destroy', this.destroy);\n this.art.emit('artplayerPluginDanmuku:destroy');\n }\n}\n","function getMode(key) {\n switch (key) {\n case 1:\n case 2:\n case 3:\n return 0;\n case 4:\n return 2;\n case 5:\n return 1;\n default:\n return 0;\n }\n}\n\nfunction bilibiliDanmuParseFromXml(xmlString) {\n if (typeof xmlString !== 'string') return [];\n const reg = new RegExp(/.+?)\"(?: .*?)?>(?.+?)<\\/d>/gs);\n const matches = xmlString.matchAll(reg);\n return Array.from(matches)\n .map((match) => {\n const attr = match.groups.p.split(',');\n if (attr.length >= 8) {\n const text = match.groups.text\n .trim()\n .replaceAll('"', '\"')\n .replaceAll(''', \"'\")\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n .replaceAll('&', '&');\n\n return {\n text,\n time: Number(attr[0]),\n mode: getMode(Number(attr[1])),\n fontSize: Number(attr[2]),\n color: `#${Number(attr[3]).toString(16)}`,\n timestamp: Number(attr[4]),\n pool: Number(attr[5]),\n userID: attr[6],\n rowID: Number(attr[7]),\n };\n } else {\n return null;\n }\n })\n .filter(Boolean);\n}\n\nfunction onmessage({ data }) {\n const { xml, id } = data;\n if (!id || !xml) return;\n const danmus = bilibiliDanmuParseFromXml(xml);\n self.postMessage({ danmus, id });\n}\n\nfunction createWorker() {\n const workerText = `\n ${getMode.toString()}\n ${bilibiliDanmuParseFromXml.toString()}\n onmessage = ${onmessage.toString()}\n `;\n const blob = new Blob([workerText], { type: 'application/javascript' });\n return new Worker(URL.createObjectURL(blob));\n}\n\nexport function bilibiliDanmuParseFromUrl(url) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve) => {\n const res = await fetch(url);\n const xml = await res.text();\n\n try {\n const worker = createWorker();\n worker.onmessage = (event) => {\n const { danmus, id } = event.data;\n if (!id || !danmus) return;\n resolve(danmus);\n worker.terminate();\n };\n worker.postMessage({ xml, id: Date.now() });\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n const danmus = bilibiliDanmuParseFromXml(xml);\n resolve(danmus);\n }\n });\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n","module.exports = \"c420afa03d5d12c1\";","import style from 'bundle-text:./style.less';\nimport $on from 'bundle-text:./img/on.svg';\nimport $off from 'bundle-text:./img/off.svg';\nimport $config from 'bundle-text:./img/config.svg';\nimport $style from 'bundle-text:./img/style.svg';\nimport $mode_0_off from 'bundle-text:./img/mode_0_off.svg';\nimport $mode_0_on from 'bundle-text:./img/mode_0_on.svg';\nimport $mode_1_off from 'bundle-text:./img/mode_1_off.svg';\nimport $mode_1_on from 'bundle-text:./img/mode_1_on.svg';\nimport $mode_2_off from 'bundle-text:./img/mode_2_off.svg';\nimport $mode_2_on from 'bundle-text:./img/mode_2_on.svg';\nimport $check_on from 'bundle-text:./img/check_on.svg';\nimport $check_off from 'bundle-text:./img/check_off.svg';\n\nexport default class Setting {\n constructor(art, danmuku) {\n this.art = art;\n this.danmuku = danmuku;\n this.utils = art.constructor.utils;\n\n const { setStyle } = this.utils;\n const { $controlsCenter } = art.template;\n setStyle($controlsCenter, 'display', 'flex');\n\n this.template = {\n $controlsCenter,\n $mount: $controlsCenter,\n $danmuku: null,\n $toggle: null,\n $config: null,\n $configPanel: null,\n $configModes: null,\n $style: null,\n $stylePanel: null,\n $styleModes: null,\n $colors: null,\n $opacitySlider: null,\n $opacityValue: null,\n $marginSlider: null,\n $marginValue: null,\n $fontSizeSlider: null,\n $fontSizeValue: null,\n $speedSlider: null,\n $speedValue: null,\n $input: null,\n $send: null,\n };\n\n this.slider = {\n opacity: null,\n margin: null,\n fontSize: null,\n speed: null,\n };\n\n this.emitting = false;\n this.isLock = false;\n this.timer = null;\n\n this.createTemplate();\n this.createSliders();\n this.createEvents();\n\n this.mount(this.option.mount);\n\n art.on('resize', () => this.resize());\n art.on('fullscreen', (state) => this.onFullscreen(state));\n art.on('fullscreenWeb', (state) => this.onFullscreen(state));\n\n art.proxy(this.template.$config, 'mouseenter', () => {\n this.onMouseEnter({\n $control: this.template.$config,\n $panel: this.template.$configPanel,\n });\n });\n\n art.proxy(this.template.$style, 'mouseenter', () => {\n this.onMouseEnter({\n $control: this.template.$style,\n $panel: this.template.$stylePanel,\n });\n });\n }\n\n static get icons() {\n return {\n $on,\n $off,\n $config,\n $style,\n $mode_0_off,\n $mode_0_on,\n $mode_1_off,\n $mode_1_on,\n $mode_2_off,\n $mode_2_on,\n $check_on,\n $check_off,\n };\n }\n\n get option() {\n return this.danmuku.option;\n }\n\n get outside() {\n return this.template.$mount !== this.template.$controlsCenter;\n }\n\n get TEMPLATE() {\n const { option } = this;\n return `\n
\n ${$on}${$off}\n
\n
\n ${$config}\n
\n
\n
\n 按类型屏蔽\n
\n
\n ${$mode_0_off}${$mode_0_on}\n
滚动
\n
\n
\n ${$mode_1_off}${$mode_1_on}\n
顶部
\n
\n
\n ${$mode_2_off}${$mode_2_on}\n
底部
\n
\n
\n
\n
\n
\n ${$check_on}${$check_off}\n 防止弹幕重叠\n
\n
\n ${$check_on}${$check_off}\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 ${$style}\n
\n
\n
\n 模式\n
\n
\n ${$mode_0_on}\n
滚动
\n
\n
\n ${$mode_1_on}\n
顶部
\n
\n
\n ${$mode_2_on}\n
底部
\n
\n
\n
\n
\n 颜色\n
\n ${this.COLOR.map((color) => `
`).join('')}\n
\n
\n
\n
\n
\n \n
发送
\n
\n `;\n }\n\n get OPACITY() {\n return {\n min: 0,\n max: 100,\n steps: [],\n ...this.option.OPACITY,\n };\n }\n\n get FONT_SIZE() {\n return {\n min: 12,\n max: 120,\n steps: [],\n ...this.option.FONT_SIZE,\n };\n }\n\n get MARGIN() {\n return {\n min: 0,\n max: 3,\n steps: [\n {\n name: '1/4',\n value: [10, '75%'],\n },\n {\n name: '半屏',\n value: [10, '50%'],\n },\n {\n name: '3/4',\n value: [10, '25%'],\n },\n {\n name: '满屏',\n value: [10, 10],\n },\n ],\n ...this.option.MARGIN,\n };\n }\n\n get SPEED() {\n return {\n min: 0,\n max: 4,\n steps: [\n {\n name: '极慢',\n value: 10,\n },\n {\n name: '较慢',\n value: 7.5,\n hide: true,\n },\n {\n name: '适中',\n value: 5,\n },\n {\n name: '较快',\n value: 2.5,\n hide: true,\n },\n {\n name: '极快',\n value: 1,\n },\n ],\n ...this.option.SPEED,\n };\n }\n\n get COLOR() {\n return this.option.COLOR.length\n ? this.option.COLOR\n : [\n '#FE0302',\n '#FF7204',\n '#FFAA02',\n '#FFD302',\n '#FFFF00',\n '#A0EE00',\n '#00CD00',\n '#019899',\n '#4266BE',\n '#89D5FF',\n '#CC0273',\n '#222222',\n '#9B9B9B',\n '#FFFFFF',\n ];\n }\n\n query(selector) {\n const { query } = this.utils;\n const { $danmuku } = this.template;\n return query(selector, $danmuku);\n }\n\n append(el, target) {\n const { append } = this.utils;\n const children = [...el.children];\n if (children.some((item) => item === target)) return;\n append(el, target);\n }\n\n setData(key, value) {\n const { $player } = this.art.template;\n const { $mount } = this.template;\n $player.dataset[key] = value;\n if (this.outside) {\n $mount.dataset[key] = value;\n }\n }\n\n createTemplate() {\n const { createElement, tooltip } = this.utils;\n\n const $danmuku = createElement('div');\n $danmuku.className = 'artplayer-plugin-danmuku';\n $danmuku.innerHTML = this.TEMPLATE;\n\n this.template.$danmuku = $danmuku;\n this.template.$toggle = this.query('.apd-toggle');\n this.template.$config = this.query('.apd-config');\n this.template.$configPanel = this.query('.apd-config-panel');\n this.template.$configModes = this.query('.apd-config-mode .apd-modes');\n this.template.$style = this.query('.apd-style');\n this.template.$stylePanel = this.query('.apd-style-panel');\n this.template.$styleModes = this.query('.apd-style-mode .apd-modes');\n this.template.$colors = this.query('.apd-colors');\n this.template.$antiOverlap = this.query('.apd-anti-overlap');\n this.template.$syncVideo = this.query('.apd-sync-video');\n this.template.$opacitySlider = this.query('.apd-config-opacity .apd-slider');\n this.template.$opacityValue = this.query('.apd-config-opacity .apd-value');\n this.template.$marginSlider = this.query('.apd-config-margin .apd-slider');\n this.template.$marginValue = this.query('.apd-config-margin .apd-value');\n this.template.$fontSizeSlider = this.query('.apd-config-fontSize .apd-slider');\n this.template.$fontSizeValue = this.query('.apd-config-fontSize .apd-value');\n this.template.$speedSlider = this.query('.apd-config-speed .apd-slider');\n this.template.$speedValue = this.query('.apd-config-speed .apd-value');\n this.template.$input = this.query('.apd-input');\n this.template.$send = this.query('.apd-send');\n\n const { $toggle } = this.template;\n\n this.art.on('artplayerPluginDanmuku:show', () => {\n tooltip($toggle, '关闭弹幕');\n });\n\n this.art.on('artplayerPluginDanmuku:hide', () => {\n tooltip($toggle, '打开弹幕');\n });\n }\n\n createEvents() {\n const { $toggle, $configModes, $styleModes, $colors, $antiOverlap, $syncVideo, $send, $input } = this.template;\n\n this.art.proxy($toggle, 'click', () => {\n this.danmuku.config({\n visible: !this.option.visible,\n });\n this.reset();\n });\n\n this.art.proxy($configModes, 'click', (event) => {\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n if (this.option.modes.includes(mode)) {\n this.danmuku.config({\n modes: this.option.modes.filter((m) => m !== mode),\n });\n } else {\n this.danmuku.config({\n modes: [...this.option.modes, mode],\n });\n }\n this.reset();\n });\n\n this.art.proxy($antiOverlap, 'click', () => {\n this.danmuku.config({\n antiOverlap: !this.option.antiOverlap,\n });\n this.reset();\n });\n\n this.art.proxy($syncVideo, 'click', () => {\n this.danmuku.config({\n synchronousPlayback: !this.option.synchronousPlayback,\n });\n this.reset();\n });\n\n this.art.proxy($styleModes, 'click', (event) => {\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n this.danmuku.config({\n mode: mode,\n });\n this.reset();\n });\n\n this.art.proxy($colors, 'click', (event) => {\n const $color = event.target.closest('.apd-color');\n if (!$color) return;\n this.danmuku.config({\n color: $color.dataset.color,\n });\n this.reset();\n });\n\n this.art.proxy($send, 'click', () => this.emit());\n\n this.art.proxy($input, 'keypress', (event) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.emit();\n }\n });\n }\n\n createSliders() {\n this.slider.opacity = this.createSlider({\n ...this.OPACITY,\n container: this.template.$opacitySlider,\n findIndex: () => {\n return Math.round(this.option.opacity * 100);\n },\n onChange: (index) => {\n const { $opacityValue } = this.template;\n $opacityValue.textContent = `${index}%`;\n this.danmuku.config({\n opacity: index / 100,\n });\n },\n });\n\n this.slider.margin = this.createSlider({\n ...this.MARGIN,\n container: this.template.$marginSlider,\n findIndex: () => {\n return this.MARGIN.steps.findIndex(\n (item) => item.value[0] === this.option.margin[0] && item.value[1] === this.option.margin[1],\n );\n },\n onChange: (index) => {\n const margin = this.MARGIN.steps[index];\n if (!margin) return;\n const { $marginValue } = this.template;\n $marginValue.textContent = margin.name;\n this.danmuku.config({\n margin: margin.value,\n });\n },\n });\n\n this.slider.fontSize = this.createSlider({\n ...this.FONT_SIZE,\n container: this.template.$fontSizeSlider,\n findIndex: () => {\n return this.danmuku.fontSize;\n },\n onChange: (index) => {\n const { $fontSizeValue } = this.template;\n $fontSizeValue.textContent = `${index}px`;\n if (index === this.danmuku.fontSize) return;\n this.danmuku.config({\n fontSize: index,\n });\n },\n });\n\n this.slider.speed = this.createSlider({\n ...this.SPEED,\n container: this.template.$speedSlider,\n findIndex: () => {\n return this.SPEED.steps.findIndex((item) => item.value === this.option.speed);\n },\n onChange: (index) => {\n const speed = this.SPEED.steps[index];\n if (!speed) return;\n const { $speedValue } = this.template;\n $speedValue.textContent = speed.name;\n this.danmuku.config({\n speed: speed.value,\n });\n },\n });\n }\n\n createSlider({ min, max, container, findIndex, onChange, steps = [] }) {\n const { query, clamp, setStyle } = this.utils;\n\n setStyle(container, 'touch-action', 'none');\n\n container.innerHTML = `\n
\n
\n ${steps.map(() => `
`).join('')}\n
\n
\n
\n
\n
\n ${steps.map((step) => (step.hide ? '' : `
${step.name}
`)).join('')}\n
\n `;\n\n const $dot = query('.apd-slider-dot', container);\n const $progress = query('.apd-slider-progress', container);\n\n let isDroging = false;\n\n function reset(index = findIndex()) {\n if (index < min || index > max) return;\n const percentage = (index - min) / (max - min);\n $dot.style.left = `${percentage * 100}%`;\n if (steps.length === 0) {\n $progress.style.width = $dot.style.left;\n }\n onChange(index);\n }\n\n function updateLeft(event) {\n const { top, height, left, width } = container.getBoundingClientRect();\n if (this.art.isRotate) {\n const value = clamp(event.clientY - top, 0, height);\n const index = Math.round((value / height) * (max - min) + min);\n reset(index);\n } else {\n const value = clamp(event.clientX - left, 0, width);\n const index = Math.round((value / width) * (max - min) + min);\n reset(index);\n }\n }\n\n this.art.proxy(container, 'click', (event) => {\n updateLeft.call(this, event);\n });\n\n this.art.proxy(container, 'pointerdown', (event) => {\n isDroging = event.button === 0;\n });\n\n this.art.proxy(document, 'pointermove', (event) => {\n if (isDroging) {\n updateLeft.call(this, event);\n }\n });\n\n this.art.proxy(document, 'pointerup', (event) => {\n if (isDroging) {\n isDroging = false;\n updateLeft.call(this, event);\n }\n });\n\n return { reset };\n }\n\n onFullscreen(state) {\n const { $danmuku, $controlsCenter, $mount } = this.template;\n if (this.outside) {\n if (state) {\n this.append($controlsCenter, $danmuku);\n } else {\n this.append($mount, $danmuku);\n }\n } else {\n this.append($controlsCenter, $danmuku);\n }\n }\n\n onMouseEnter({ $control, $panel }) {\n const { $player } = this.art.template;\n const controlRect = $control.getBoundingClientRect();\n const panelRect = $panel.getBoundingClientRect();\n const playerRect = $player.getBoundingClientRect();\n\n const half = panelRect.width / 2 - controlRect.width / 2;\n const left = playerRect.left - (controlRect.left - half);\n const right = controlRect.right + half - playerRect.right;\n\n if (left > 0) {\n $panel.style.left = `${-half + left}px`;\n } else if (right > 0) {\n $panel.style.left = `${-half - right}px`;\n } else {\n $panel.style.left = `${-half}px`;\n }\n }\n\n async emit() {\n const { $input } = this.template;\n\n const text = $input.value.trim();\n if (!text.length) return;\n if (this.isLock) return;\n if (this.emitting) return;\n\n const danmu = {\n text: text,\n mode: this.option.mode,\n color: this.option.color,\n time: this.art.currentTime,\n };\n\n try {\n this.emitting = true;\n const state = await this.option.beforeEmit(danmu);\n this.emitting = false;\n\n if (state !== true) return;\n\n danmu.border = true;\n delete danmu.time;\n this.danmuku.emit(danmu);\n $input.value = '';\n\n this.lock();\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n this.emitting = false;\n }\n }\n\n lock() {\n const { addClass } = this.utils;\n const { $send } = this.template;\n\n this.isLock = true;\n let time = this.option.lockTime;\n $send.innerText = time;\n addClass($send, 'apd-lock');\n\n const loop = () => {\n this.timer = setTimeout(() => {\n if (time === 0) {\n this.unlock();\n } else {\n time -= 1;\n $send.innerText = time;\n loop();\n }\n }, 1000);\n };\n\n loop();\n }\n\n unlock() {\n const { removeClass } = this.utils;\n const { $send } = this.template;\n clearTimeout(this.timer);\n this.isLock = false;\n $send.innerText = '发送';\n removeClass($send, 'apd-lock');\n }\n\n resize() {\n if (this.outside) return;\n if (this.art.fullscreen) return;\n if (this.art.fullscreenWeb) return;\n const { $player, $controlsCenter } = this.art.template;\n const { $danmuku } = this.template;\n if (this.art.width < this.option.width) {\n this.append($player, $danmuku);\n } else {\n this.append($controlsCenter, $danmuku);\n }\n }\n\n reset() {\n const { inverseClass, tooltip } = this.utils;\n const { $toggle, $colors } = this.template;\n\n this.slider.opacity.reset();\n this.slider.margin.reset();\n this.slider.fontSize.reset();\n this.slider.speed.reset();\n\n this.setData('danmukuVisible', this.option.visible);\n this.setData('danmukuMode', this.option.mode);\n this.setData('danmukuColor', this.option.color);\n this.setData('danmukuMode0', this.option.modes.includes(0));\n this.setData('danmukuMode1', this.option.modes.includes(1));\n this.setData('danmukuMode2', this.option.modes.includes(2));\n this.setData('danmukuAntiOverlap', this.option.antiOverlap);\n this.setData('danmukuSyncVideo', this.option.synchronousPlayback);\n this.setData('danmukuTheme', this.option.theme);\n this.setData('danmukuEmitter', this.option.emitter);\n\n const colors = $colors.children;\n const $color = Array.from(colors).find((item) => item.dataset.color === this.option.color.toUpperCase());\n $color && inverseClass($color, 'apd-active');\n\n tooltip($toggle, this.option.visible ? '关闭弹幕' : '打开弹幕');\n\n this.resize();\n }\n\n mount(target) {\n const { errorHandle } = this.utils;\n const $el = typeof target === 'string' ? document.querySelector(target) : target;\n errorHandle($el, `Can not find the mount point: ${target}`);\n this.append($el, this.template.$danmuku);\n this.template.$mount = $el;\n this.reset();\n }\n}\n\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-danmuku';\n let $style = document.getElementById(id);\n if (!$style) {\n $style = document.createElement('style');\n $style.id = id;\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild($style);\n });\n } else {\n (document.head || document.documentElement).appendChild($style);\n }\n }\n $style.textContent = style;\n}\n","module.exports = \"bc5428a5075ddaba\";","module.exports = \"bf1932cb468b3021\";","module.exports = \"b74dc3080b6cd7eb\";","module.exports = \"e1f7929fc7eb56f5\";","module.exports = \"83a1c89d2b4d7383\";","module.exports = \"401f250f3293e528\";","module.exports = \"a27f224d3e9c5a81\";","module.exports = \"ec9f79d2c4c498de\";","module.exports = \"8bc1f3138bababa6\";","module.exports = \"b60ab50237bcbef4\";","module.exports = \"19bca7c1e3731c0a\";","module.exports = \"e3b49968901c24db\";","module.exports = \"f01b6a0cef3c915e\";","const lib = {\n map(value, inMin, inMax, outMin, outMax) {\n return ((value - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;\n },\n range(start, end, tick) {\n const s = Math.round(start / tick) * tick;\n return Array.from(\n {\n length: Math.floor((end - start) / tick),\n },\n (v, k) => {\n return k * tick + s;\n },\n );\n },\n};\n\nconst line = (pointA, pointB) => {\n const lengthX = pointB[0] - pointA[0];\n const lengthY = pointB[1] - pointA[1];\n return {\n length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),\n angle: Math.atan2(lengthY, lengthX),\n };\n};\n\nexport default function heatmap(art, danmuku, option) {\n const { query } = art.constructor.utils;\n\n art.controls.add({\n name: 'heatmap',\n position: 'top',\n html: '',\n style: {\n position: 'absolute',\n top: '-100px',\n left: '0px',\n right: '0px',\n height: '100px',\n width: '100%',\n pointerEvents: 'none',\n },\n mounted($heatmap) {\n let $start = null;\n let $stop = null;\n\n function update(arg = []) {\n $start = null;\n $stop = null;\n $heatmap.innerHTML = '';\n\n if (!art.duration || art.option.isLive) return;\n\n const svg = {\n w: $heatmap.offsetWidth,\n h: $heatmap.offsetHeight,\n };\n\n const options = {\n xMin: 0,\n xMax: svg.w,\n yMin: 0,\n yMax: 128,\n scale: 0.25,\n opacity: 0.2,\n minHeight: Math.floor(svg.h * 0.05),\n sampling: Math.floor(svg.w / 100),\n smoothing: 0.2,\n flattening: 0.2,\n };\n\n if (typeof option === 'object') {\n Object.assign(options, option);\n }\n\n let points = [];\n\n if (Array.isArray(arg) && arg.length) {\n points = [...arg];\n } else {\n const gap = art.duration / svg.w;\n for (let x = 0; x <= svg.w; x += options.sampling) {\n const y = danmuku.queue.filter(\n ({ time }) => time > x * gap && time <= (x + options.sampling) * gap,\n ).length;\n points.push([x, y]);\n }\n }\n\n if (points.length === 0) return;\n\n const lastPoint = points[points.length - 1];\n const lastX = lastPoint[0];\n const lastY = lastPoint[1];\n if (lastX !== svg.w) {\n points.push([svg.w, lastY]);\n }\n\n const yPoints = points.map((point) => point[1]);\n const yMin = Math.min(...yPoints);\n const yMax = Math.max(...yPoints);\n const yMid = (yMin + yMax) / 2;\n\n for (let i = 0; i < points.length; i++) {\n const point = points[i];\n const y = point[1];\n point[1] = y * (y > yMid ? 1 + options.scale : 1 - options.scale) + options.minHeight;\n }\n\n const controlPoint = (current, previous, next, reverse) => {\n const p = previous || current;\n const n = next || current;\n const o = line(p, n);\n const flat = lib.map(Math.cos(o.angle) * options.flattening, 0, 1, 1, 0);\n const angle = o.angle * flat + (reverse ? Math.PI : 0);\n const length = o.length * options.smoothing;\n const x = current[0] + Math.cos(angle) * length;\n const y = current[1] + Math.sin(angle) * length;\n return [x, y];\n };\n\n const bezierCommand = (point, i, a) => {\n const cps = controlPoint(a[i - 1], a[i - 2], point);\n const cpe = controlPoint(point, a[i - 1], a[i + 1], true);\n const close = i === a.length - 1 ? ' z' : '';\n return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}${close}`;\n };\n\n const pointsPositions = points.map((e) => {\n const x = lib.map(e[0], options.xMin, options.xMax, 0, svg.w);\n const y = lib.map(e[1], options.yMin, options.yMax, svg.h, 0);\n return [x, y];\n });\n\n const pathD = pointsPositions.reduce(\n (acc, e, i, a) =>\n i === 0\n ? `M ${a[a.length - 1][0]},${svg.h} L ${e[0]},${svg.h} L ${e[0]},${e[1]}`\n : `${acc} ${bezierCommand(e, i, a)}`,\n '',\n );\n\n $heatmap.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n `;\n\n $start = query('#heatmap-start', $heatmap);\n $stop = query('#heatmap-stop', $heatmap);\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n\n art.on('video:timeupdate', () => {\n if ($start && $stop) {\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n });\n\n art.on('setBar', (type, percentage) => {\n if ($start && $stop && type === 'played') {\n $start.setAttribute('offset', `${percentage * 100}%`);\n $stop.setAttribute('offset', `${percentage * 100}%`);\n }\n });\n\n art.on('ready', () => update());\n art.on('resize', () => update());\n art.on('artplayerPluginDanmuku:loaded', () => update());\n art.on('artplayerPluginDanmuku:points', (points) => update(points));\n },\n });\n}\n"],"names":["modules","entry","mainEntry","parcelRequireName","externals","distDir","publicUrl","devServer","globalObject","globalThis","self","window","global","previousRequire","importMap","i","cache","nodeRequire","module","require","bind","newRequire","name","jumped","currentRequire","err","Error","code","localRequire","resolve","x","id","Module","call","exports","res","isParcelRequire","moduleName","bundle","parent","register","Object","defineProperty","get","length","mainExports","define","amd","__globalThis","parcelHelpers","defineInteropFlag","export","artplayerPluginDanmuku","_danmuku","_danmukuDefault","interopDefault","_setting","_settingDefault","_heatmap","_heatmapDefault","option","art","danmuku","default","setting","heatmap","emit","load","config","hide","show","reset","mount","isHide","isStop","icons","_bilibili","_worker","_workerDefault","Danmuku","constructor","template","utils","validator","$danmuku","$player","queue","$refs","timer","index","states","wait","ready","stop","blob","Blob","replace","type","worker","Worker","URL","createObjectURL","start","resize","destroy","on","speed","margin","opacity","color","mode","modes","fontSize","antiOverlap","synchronousPlayback","undefined","width","points","filter","beforeEmit","beforeVisible","visible","emitter","maxLength","lockTime","theme","OPACITY","FONT_SIZE","MARGIN","SPEED","COLOR","scheme","cssText","isRotate","plugins","autoOrientation","state","marginTop","clamp","value","clientHeight","endsWith","parseFloat","marginBottom","Math","round","$ref","pop","document","createElement","style","dataset","className","readys","currentTime","result","danmu","push","time","visibles","clientWidth","clientLeft","getLeft","top","offsetTop","left","height","distance","$restTime","right","playbackRate","Number","errorHandle","danmus","target","Promise","bilibiliDanmuParseFromUrl","Array","isArray","innerText","error","text","border","trim","Infinity","includes","item","$state","$id","$lastStartTime","setState","isInit","$controlsCenter","keys","some","key","JSON","stringify","assign","rect","getBoundingClientRect","postMessage","message","Date","now","onmessage","event","data","callback","makeWait","visibility","marginLeft","transform","transition","update","setStyles","requestAnimationFrame","playing","emitTime","appendChild","backgroundColor","continue","suspend","translateX","cancelAnimationFrame","forEach","terminate","off","getMode","bilibiliDanmuParseFromXml","xmlString","reg","RegExp","from","matchAll","map","match","attr","groups","p","split","replaceAll","toString","timestamp","pool","userID","rowID","Boolean","xml","url","fetch","createWorker","a","__esModule","exportAll","source","dest","prototype","hasOwnProperty","enumerable","destName","_styleLess","_styleLessDefault","_onSvg","_onSvgDefault","_offSvg","_offSvgDefault","_configSvg","_configSvgDefault","_styleSvg","_styleSvgDefault","_mode0OffSvg","_mode0OffSvgDefault","_mode0OnSvg","_mode0OnSvgDefault","_mode1OffSvg","_mode1OffSvgDefault","_mode1OnSvg","_mode1OnSvgDefault","_mode2OffSvg","_mode2OffSvgDefault","_mode2OnSvg","_mode2OnSvgDefault","_checkOnSvg","_checkOnSvgDefault","_checkOffSvg","_checkOffSvgDefault","setStyle","$mount","$toggle","$config","$configPanel","$configModes","$style","$stylePanel","$styleModes","$colors","$opacitySlider","$opacityValue","$marginSlider","$marginValue","$fontSizeSlider","$fontSizeValue","$speedSlider","$speedValue","$input","$send","slider","emitting","isLock","createTemplate","createSliders","createEvents","onFullscreen","proxy","onMouseEnter","$control","$panel","$on","$off","$mode_0_off","$mode_0_on","$mode_1_off","$mode_1_on","$mode_2_off","$mode_2_on","$check_on","$check_off","outside","TEMPLATE","join","min","max","steps","query","selector","append","el","children","setData","tooltip","innerHTML","$antiOverlap","$syncVideo","$mode","closest","m","$color","preventDefault","createSlider","container","findIndex","onChange","textContent","step","$dot","$progress","isDroging","percentage","updateLeft","clientY","clientX","button","controlRect","panelRect","playerRect","half","lock","addClass","loop","setTimeout","unlock","removeClass","clearTimeout","fullscreen","fullscreenWeb","inverseClass","find","toUpperCase","$el","querySelector","getElementById","readyState","addEventListener","head","documentElement","lib","inMin","inMax","outMin","outMax","range","end","tick","s","floor","v","k","line","pointA","pointB","lengthX","lengthY","sqrt","pow","angle","atan2","controls","add","position","html","pointerEvents","mounted","$heatmap","$start","$stop","arg","duration","isLive","svg","w","offsetWidth","h","offsetHeight","options","xMin","xMax","yMin","yMax","scale","minHeight","sampling","smoothing","flattening","gap","y","lastPoint","lastX","lastY","yPoints","point","yMid","controlPoint","current","previous","next","reverse","o","flat","cos","PI","sin","bezierCommand","cps","cpe","close","pathD","pointsPositions","e","reduce","acc","setAttribute","played","_default","parcelRequire93cf"],"version":3,"file":"index.js.map"} \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-danmuku.js b/docs/compiled/artplayer-plugin-danmuku.js index dbcaec203..ef47ca3a4 100644 --- a/docs/compiled/artplayer-plugin-danmuku.js +++ b/docs/compiled/artplayer-plugin-danmuku.js @@ -5,4 +5,4 @@ * (c) 2017-2025 Harvey Zack * Released under the MIT License. */ -!function(t,e,i,a,n,o,s,l){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof r[a]&&r[a],p=d.i||{},u=d.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof r[a]&&r[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var l=u[e]=new m.Module(e);t[e][0].call(l.exports,p,l,l.exports,r)}return u[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return r[a]}}),r[a]=m;for(var c=0;cu);var o=t("./danmuku"),s=n.interopDefault(o),l=t("./setting"),r=n.interopDefault(l),d=t("./heatmap"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,r.default)(e,i);return i.option.heatmap&&(0,p.default)(e,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}}}}u.icons=r.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"g81Wu","./setting":"ho690","./heatmap":"hjtgU","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],g81Wu:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("./bilibili"),s=t("bundle-text:./worker"),l=n.interopDefault(s);class r{constructor(t,e){let{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e);let n=new Blob([l.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),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,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}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|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}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:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[1]}get fontSize(){let{clamp:t}=this.utils,{clientHeight:e}=this.$player,i=this.option.fontSize;return"number"==typeof i?Math.round(t(i,12,e)):"string"==typeof i&&i.endsWith("%")?Math.round(t(e*(parseFloat(i)/100),12,e)):r.option.fontSize}get $ref(){let t=this.$refs.pop()||document.createElement("div");return t.style.cssText=r.cssText,t.dataset.mode="",t.className="",t}get readys(){let{currentTime:t}=this.art,e=[];return this.filter("ready",t=>e.push(t)),this.filter("wait",i=>{t+.1>=i.time&&i.time>=t-.1&&e.push(i)}),e}get visibles(){let t=[],{clientWidth:e}=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=e-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,t.push(p)}),t}get speed(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}async load(t){let{errorHandle:e}=this.utils,i=[],a=t||this.option.danmuku;try{"function"==typeof a?i=await a():a instanceof Promise?i=await a:"string"==typeof a?i=await (0,o.bilibiliDanmuParseFromUrl)(a):Array.isArray(a)&&(i=a),e(Array.isArray(i),"Danmuku need return an array as result"),void 0===t&&(this.reset(),this.queue=[],this.states={wait:[],ready:[],emit:[],stop:[]},this.$refs=[],this.$danmuku.innerText="");for(let t=0;tJSON.stringify(this.option[e])!==JSON.stringify(t[e]))&&(this.option=Object.assign({},r.option,this.option,t),this.validator(this.option,r.scheme),this.option.mode=e(this.option.mode,0,2),this.option.speed=e(this.option.speed,1,10),this.option.opacity=e(this.option.opacity,0,1),this.option.lockTime=e(this.option.lockTime,1,60),this.option.maxLength=e(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}postMessage(t={}){return new Promise(e=>{t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:a}=i;a.id===t.id&&e(a)}})}filter(t,e){let i=this.states[t]||[];for(let t=0;te!==t),t.$state=e,t.$ref&&(t.$ref.dataset.state=e),this.states[e].push(t)}makeWait(t){this.setState(t,"wait"),t.$ref&&(t.$ref.style.cssText=r.cssText,t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}update(){let{setStyles:t}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let e=this.readys;for(let i=0;i{0===e.mode&&(e.$ref.style.left=`${t}px`)}),this.filter("emit",e=>{if(e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.left=`${t}px`,e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}})}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(this.setState(e,"emit"),e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(this.setState(e,"stop"),0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$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(t=>this.makeWait(t)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.$danmuku.style.opacity=1,this.option.visible=!0,this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.$danmuku.style.opacity=0,this.option.visible=!1,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=r},{"./bilibili":"jICn4","bundle-text:./worker":"cK8sH","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],jICn4:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function o(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function s(t){if("string"!=typeof t)return[];let e=new RegExp(/(?.+?)<\/d>/gs);return Array.from(t.matchAll(e)).map(t=>{let e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:o(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null}).filter(Boolean)}function l({data:t}){let{xml:e,id:i}=t;if(!i||!e)return;let a=s(e);self.postMessage({danmus:a,id:i})}function r(t){return new Promise(async e=>{let i=await fetch(t),a=await i.text();try{let t=function(){let t=new Blob([` ${o.toString()} ${s.toString()} onmessage = ${l.toString()} `],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}();t.onmessage=i=>{let{danmus:a,id:n}=i.data;n&&a&&(e(a),t.terminate())},t.postMessage({xml:a,id:Date.now()})}catch(t){e(s(a))}})}n.defineInteropFlag(i),n.export(i,"bilibiliDanmuParseFromUrl",()=>r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(t,e,i,a){i.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},i.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.exportAll=function(t,e){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e},i.export=function(t,e,i){Object.defineProperty(t,e,{enumerable:!0,get:i})}},{}],cK8sH:[function(t,e,i,a){e.exports='!function(e,t,i,o,n,r,f,d){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof l[o]&&l[o],p=u.i||{},h=u.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!h[t]){if(!e[t]){if(n[t])return n[t];var r="function"==typeof l[o]&&l[o];if(!i&&r)return r(t,!0);if(u)return u(t,!0);if(s&&"string"==typeof t)return s(t);var f=Error("Cannot find module \'"+t+"\'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(i){var o=e[t][1][i];return null!=o?o:i},p.cache={};var d=h[t]=new a.Module(t);e[t][0].call(d.exports,p,d,d.exports,l)}return h[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=s,this.exports={}},a.modules=e,a.cache=h,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=p,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return l[o]}}),l[o]=a;for(var c=0;ct.mode===e.mode&&t.top<=d).sort((e,t)=>e.top-t.top);if(0===l.length)if(2===e.mode)return d-e.height;else return r;if(l.unshift({type:"top",top:0,left:0,right:0,height:r,width:i,speed:0,distance:i}),l.push({type:"bottom",top:d,left:0,right:0,height:n,width:i,speed:0,distance:i}),2===e.mode)for(let t=l.length-2;t>=0;t-=1){let i=l[t],o=l[t+1],n=i.top+i.height;if(o.top-n>=e.height)return o.top-e.height}else for(let t=1;t=e.height)return n}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),o=Math.min(...e.map(e=>e.right));return i*t.length-o*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:n})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},["fpBtQ"],"fpBtQ","parcelRequire4dc0",{});'},{}],ho690:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./style.less"),s=n.interopDefault(o),l=t("bundle-text:./img/on.svg"),r=n.interopDefault(l),d=t("bundle-text:./img/off.svg"),p=n.interopDefault(d),u=t("bundle-text:./img/config.svg"),h=n.interopDefault(u),m=t("bundle-text:./img/style.svg"),c=n.interopDefault(m),f=t("bundle-text:./img/mode_0_off.svg"),g=n.interopDefault(f),y=t("bundle-text:./img/mode_0_on.svg"),v=n.interopDefault(y),x=t("bundle-text:./img/mode_1_off.svg"),k=n.interopDefault(x),b=t("bundle-text:./img/mode_1_on.svg"),$=n.interopDefault(b),w=t("bundle-text:./img/mode_2_off.svg"),M=n.interopDefault(w),E=t("bundle-text:./img/mode_2_on.svg"),D=n.interopDefault(E),S=t("bundle-text:./img/check_on.svg"),F=n.interopDefault(S),A=t("bundle-text:./img/check_off.svg"),z=n.interopDefault(A);if(i.default=class{constructor(t,e){this.art=t,this.danmuku=e,this.utils=t.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=t.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$config:null,$configPanel:null,$configModes:null,$style:null,$stylePanel: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),t.on("resize",()=>this.resize()),t.on("fullscreen",t=>this.onFullscreen(t)),t.on("fullscreenWeb",t=>this.onFullscreen(t)),t.proxy(this.template.$config,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$config,$panel:this.template.$configPanel})}),t.proxy(this.template.$style,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$style,$panel:this.template.$stylePanel})})}static get icons(){return{$on:r.default,$off:p.default,$config:h.default,$style:c.default,$mode_0_off:g.default,$mode_0_on:v.default,$mode_1_off:k.default,$mode_1_on:$.default,$mode_2_off:M.default,$mode_2_on:D.default,$check_on:F.default,$check_off:z.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:t}=this;return`
${r.default}${p.default}
${h.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${g.default}${v.default}
\u{6EDA}\u{52A8}
${k.default}${$.default}
\u{9876}\u{90E8}
${M.default}${D.default}
\u{5E95}\u{90E8}
${F.default}${z.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${F.default}${z.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}
${c.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${$.default}
\u{9876}\u{90E8}
${D.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(t=>`
`).join("")}
\u{53D1}\u{9001}
`}get OPACITY(){return{min:0,max:100,steps:[],...this.option.OPACITY}}get FONT_SIZE(){return{min:12,max:120,steps:[],...this.option.FONT_SIZE}}get MARGIN(){return{min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}],...this.option.MARGIN}}get SPEED(){return{min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}],...this.option.SPEED}}get COLOR(){return this.option.COLOR.length?this.option.COLOR:["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(t){let{query:e}=this.utils,{$danmuku:i}=this.template;return e(t,i)}append(t,e){let{append:i}=this.utils;[...t.children].some(t=>t===e)||i(t,e)}setData(t,e){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[t]=e,this.outside&&(a.dataset[t]=e)}createTemplate(){let{createElement:t,tooltip:e}=this.utils,i=t("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");let{$toggle:a}=this.template;this.art.on("artplayerPluginDanmuku:show",()=>{e(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",()=>{e(a,"打开弹幕")})}createEvents(){let{$toggle:t,$configModes:e,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(t,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(e,"click",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(t=>t!==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",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",t=>{let e=t.target.closest(".apd-color");e&&(this.danmuku.config({color:e.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({...this.OPACITY,container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:t=>{let{$opacityValue:e}=this.template;e.textContent=`${t}%`,this.danmuku.config({opacity:t/100})}}),this.slider.margin=this.createSlider({...this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.steps.findIndex(t=>t.value[0]===this.option.margin[0]&&t.value[1]===this.option.margin[1]),onChange:t=>{let e=this.MARGIN.steps[t];if(!e)return;let{$marginValue:i}=this.template;i.textContent=e.name,this.danmuku.config({margin:e.value})}}),this.slider.fontSize=this.createSlider({...this.FONT_SIZE,container:this.template.$fontSizeSlider,findIndex:()=>this.danmuku.fontSize,onChange:t=>{let{$fontSizeValue:e}=this.template;e.textContent=`${t}px`,t!==this.danmuku.fontSize&&this.danmuku.config({fontSize:t})}}),this.slider.speed=this.createSlider({...this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.steps.findIndex(t=>t.value===this.option.speed),onChange:t=>{let e=this.SPEED.steps[t];if(!e)return;let{$speedValue:i}=this.template;i.textContent=e.name,this.danmuku.config({speed:e.value})}})}createSlider({min:t,max:e,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l,setStyle:r}=this.utils;r(i,"touch-action","none"),i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(t=>t.hide?"":`
${t.name}
`).join("")}
`;let d=s(".apd-slider-dot",i),p=s(".apd-slider-progress",i),u=!1;function h(i=a()){if(ie)return;let s=(i-t)/(e-t);d.style.left=`${100*s}%`,0===o.length&&(p.style.width=d.style.left),n(i)}function m(a){let{top:n,height:o,left:s,width:r}=i.getBoundingClientRect();this.art.isRotate?h(Math.round(l(a.clientY-n,0,o)/o*(e-t)+t)):h(Math.round(l(a.clientX-s,0,r)/r*(e-t)+t))}return this.art.proxy(i,"click",t=>{m.call(this,t)}),this.art.proxy(i,"pointerdown",t=>{u=0===t.button}),this.art.proxy(document,"pointermove",t=>{u&&m.call(this,t)}),this.art.proxy(document,"pointerup",t=>{u&&(u=!1,m.call(this,t))}),{reset:h}}onFullscreen(t){let{$danmuku:e,$controlsCenter:i,$mount:a}=this.template;this.outside?t?this.append(i,e):this.append(a,e):this.append(i,e)}onMouseEnter({$control:t,$panel:e}){let{$player:i}=this.art.template,a=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=i.getBoundingClientRect(),s=n.width/2-a.width/2,l=o.left-(a.left-s),r=a.right+s-o.right;l>0?e.style.left=`${-s+l}px`:r>0?e.style.left=`${-s-r}px`:e.style.left=`${-s}px`}async emit(){let{$input:t}=this.template,e=t.value.trim();if(!e.length||this.isLock||this.emitting)return;let i={text:e,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let e=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==e)return;i.border=!0,delete i.time,this.danmuku.emit(i),t.value="",this.lock()}catch(t){this.emitting=!1}}lock(){let{addClass:t}=this.utils,{$send:e}=this.template;this.isLock=!0;let i=this.option.lockTime;e.innerText=i,t(e,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(e.innerText=i-=1,a())},1e3)};a()}unlock(){let{removeClass:t}=this.utils,{$send:e}=this.template;clearTimeout(this.timer),this.isLock=!1,e.innerText="发送",t(e,"apd-lock")}resize(){if(this.outside||this.art.fullscreen||this.art.fullscreenWeb)return;let{$player:t,$controlsCenter:e}=this.art.template,{$danmuku:i}=this.template;this.art.widtht.dataset.color===this.option.color.toUpperCase());n&&t(n,"apd-active"),e(i,this.option.visible?"关闭弹幕":"打开弹幕"),this.resize()}mount(t){let{errorHandle:e}=this.utils,i="string"==typeof t?document.querySelector(t):t;e(i,`Can not find the mount point: ${t}`),this.append(i,this.template.$danmuku),this.template.$mount=i,this.reset()}},"undefined"!=typeof document){let t="artplayer-plugin-danmuku",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=s.default}},{"bundle-text:./style.less":"e4L1w","bundle-text:./img/on.svg":"2h5UL","bundle-text:./img/off.svg":"bMJJY","bundle-text:./img/config.svg":"jqR46","bundle-text:./img/style.svg":"9tkqu","bundle-text:./img/mode_0_off.svg":"fFoDs","bundle-text:./img/mode_0_on.svg":"hkEt9","bundle-text:./img/mode_1_off.svg":"3n5ax","bundle-text:./img/mode_1_on.svg":"hJjtU","bundle-text:./img/mode_2_off.svg":"dWW5U","bundle-text:./img/mode_2_on.svg":"1QGuJ","bundle-text:./img/check_on.svg":"9EUUq","bundle-text:./img/check_off.svg":"gf3jX","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],e4L1w:[function(t,e,i,a){e.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}'},{}],"2h5UL":[function(t,e,i,a){e.exports=''},{}],bMJJY:[function(t,e,i,a){e.exports=''},{}],jqR46:[function(t,e,i,a){e.exports=''},{}],"9tkqu":[function(t,e,i,a){e.exports=''},{}],fFoDs:[function(t,e,i,a){e.exports=''},{}],hkEt9:[function(t,e,i,a){e.exports=''},{}],"3n5ax":[function(t,e,i,a){e.exports=''},{}],hJjtU:[function(t,e,i,a){e.exports=''},{}],dWW5U:[function(t,e,i,a){e.exports=''},{}],"1QGuJ":[function(t,e,i,a){e.exports=''},{}],"9EUUq":[function(t,e,i,a){e.exports=''},{}],gf3jX:[function(t,e,i,a){e.exports=''},{}],hjtgU:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>l);let o={map:(t,e,i,a,n)=>(t-e)*(n-a)/(i-e)+a,range(t,e,i){let a=Math.round(t/i)*i;return Array.from({length:Math.floor((e-t)/i)},(t,e)=>e*i+a)}},s=(t,e)=>{let i=e[0]-t[0],a=e[1]-t[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function l(t,e,i){let{query:a}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(n){let l=null,r=null;function d(p=[]){if(l=null,r=null,n.innerHTML="",!t.duration||t.option.isLive)return;let u={w:n.offsetWidth,h:n.offsetHeight},h={xMin:0,xMax:u.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*u.h),sampling:Math.floor(u.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(h,i);let m=[];if(Array.isArray(p)&&p.length)m=[...p];else{let i=t.duration/u.w;for(let t=0;t<=u.w;t+=h.sampling){let a=e.queue.filter(({time:e})=>e>t*i&&e<=(t+h.sampling)*i).length;m.push([t,a])}}if(0===m.length)return;let c=m[m.length-1],f=c[0],g=c[1];f!==u.w&&m.push([u.w,g]);let y=m.map(t=>t[1]),v=(Math.min(...y)+Math.max(...y))/2;for(let t=0;tv?1+h.scale:1-h.scale)+h.minHeight}let x=(t,e,i,a)=>{let n=s(e||t,i||t),l=o.map(Math.cos(n.angle)*h.flattening,0,1,1,0),r=n.angle*l+(a?Math.PI:0),d=n.length*h.smoothing;return[t[0]+Math.cos(r)*d,t[1]+Math.sin(r)*d]},k=(t,e,i)=>{let a=x(i[e-1],i[e-2],t),n=x(t,i[e-1],i[e+1],!0),o=e===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${t[0]},${t[1]}${o}`},b=m.map(t=>[o.map(t[0],h.xMin,h.xMax,0,u.w),o.map(t[1],h.yMin,h.yMax,u.h,0)]).reduce((t,e,i,a)=>0===i?`M ${a[a.length-1][0]},${u.h} L ${e[0]},${u.h} L ${e[0]},${e[1]}`:`${t} ${k(e,i,a)}`,"");n.innerHTML=``,l=a("#heatmap-start",n),r=a("#heatmap-stop",n),l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{l&&r&&"played"===t&&(l.setAttribute("offset",`${100*e}%`),r.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>d()),t.on("resize",()=>d()),t.on("artplayerPluginDanmuku:loaded",()=>d()),t.on("artplayerPluginDanmuku:points",t=>d(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}]},["666Ok"],"666Ok","parcelRequire4dc0",{}); \ No newline at end of file +!function(t,e,i,a,n,o,s,l){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof r[a]&&r[a],p=d.i||{},u=d.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof r[a]&&r[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var l=u[e]=new m.Module(e);t[e][0].call(l.exports,p,l,l.exports,r)}return u[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return r[a]}}),r[a]=m;for(var c=0;cu);var o=t("./danmuku"),s=n.interopDefault(o),l=t("./setting"),r=n.interopDefault(l),d=t("./heatmap"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,r.default)(e,i);return i.option.heatmap&&(0,p.default)(e,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}}}}u.icons=r.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"3oV1P","./setting":"ddE7h","./heatmap":"falVu","@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],"3oV1P":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("./bilibili"),s=t("bundle-text:./worker"),l=n.interopDefault(s);class r{constructor(t,e){let{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0);let n=new Blob([l.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),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,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}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|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}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:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[1]}get fontSize(){let{clamp:t}=this.utils,{clientHeight:e}=this.$player,i=this.option.fontSize;return"number"==typeof i?Math.round(t(i,12,e)):"string"==typeof i&&i.endsWith("%")?Math.round(t(e*(parseFloat(i)/100),12,e)):r.option.fontSize}get $ref(){let t=this.$refs.pop()||document.createElement("div");return t.style.cssText=r.cssText,t.dataset.mode="",t.className="",t}get readys(){let{currentTime:t}=this.art,e=[];return this.filter("ready",t=>e.push(t)),this.filter("wait",i=>{t+.1>=i.time&&i.time>=t-.1&&e.push(i)}),e}get visibles(){let t=[],{clientWidth:e}=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=e-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,t.push(p)}),t}get speed(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}async load(t){let{errorHandle:e}=this.utils,i=[],a=t||this.option.danmuku;try{"function"==typeof a?i=await a():a instanceof Promise?i=await a:"string"==typeof a?i=await (0,o.bilibiliDanmuParseFromUrl)(a):Array.isArray(a)&&(i=a),e(Array.isArray(i),"Danmuku need return an array as result"),void 0===t&&(this.reset(),this.queue=[],this.states={wait:[],ready:[],emit:[],stop:[]},this.$refs=[],this.$danmuku.innerText="");for(let t=0;tJSON.stringify(this.option[e])!==JSON.stringify(t[e]))||e)&&(this.option=Object.assign({},r.option,this.option,t),this.validator(this.option,r.scheme),this.option.mode=i(this.option.mode,0,2),this.option.speed=i(this.option.speed,1,10),this.option.opacity=i(this.option.opacity,0,1),this.option.lockTime=i(this.option.lockTime,1,60),this.option.maxLength=i(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||a,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}postMessage(t={}){return new Promise(e=>{t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:a}=i;a.id===t.id&&e(a)}})}filter(t,e){let i=this.states[t]||[];for(let t=0;te!==t),t.$state=e,t.$ref&&(t.$ref.dataset.state=e),this.states[e].push(t)}makeWait(t){this.setState(t,"wait"),t.$ref&&(t.$ref.style.cssText=r.cssText,t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}update(){let{setStyles:t}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let e=this.readys;for(let i=0;i{0===e.mode&&(e.$ref.style.left=`${t}px`)}),this.filter("emit",e=>{if(e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.left=`${t}px`,e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}})}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(this.setState(e,"emit"),e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(this.setState(e,"stop"),0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$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(t=>this.makeWait(t)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.$danmuku.style.opacity=1,this.option.visible=!0,this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.$danmuku.style.opacity=0,this.option.visible=!1,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=r},{"./bilibili":"4KZjR","bundle-text:./worker":"4Jmn3","@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],"4KZjR":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function o(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function s(t){if("string"!=typeof t)return[];let e=new RegExp(/(?.+?)<\/d>/gs);return Array.from(t.matchAll(e)).map(t=>{let e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:o(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null}).filter(Boolean)}function l({data:t}){let{xml:e,id:i}=t;if(!i||!e)return;let a=s(e);self.postMessage({danmus:a,id:i})}function r(t){return new Promise(async e=>{let i=await fetch(t),a=await i.text();try{let t=function(){let t=new Blob([` ${o.toString()} ${s.toString()} onmessage = ${l.toString()} `],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}();t.onmessage=i=>{let{danmus:a,id:n}=i.data;n&&a&&(e(a),t.terminate())},t.postMessage({xml:a,id:Date.now()})}catch(t){e(s(a))}})}n.defineInteropFlag(i),n.export(i,"bilibiliDanmuParseFromUrl",()=>r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],"7o2zS":[function(t,e,i,a){i.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},i.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.exportAll=function(t,e){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e},i.export=function(t,e,i){Object.defineProperty(t,e,{enumerable:!0,get:i})}},{}],"4Jmn3":[function(t,e,i,a){e.exports='!function(e,t,i,o,n,r,f,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof d[o]&&d[o],h=u.i||{},p=u.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!p[t]){if(!e[t]){if(n[t])return n[t];var r="function"==typeof d[o]&&d[o];if(!i&&r)return r(t,!0);if(u)return u(t,!0);if(s&&"string"==typeof t)return s(t);var f=Error("Cannot find module \'"+t+"\'");throw f.code="MODULE_NOT_FOUND",f}h.resolve=function(i){var o=e[t][1][i];return null!=o?o:i},h.cache={};var l=p[t]=new a.Module(t);e[t][0].call(l.exports,h,l,l.exports,d)}return p[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=s,this.exports={}},a.modules=e,a.cache=p,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=h,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return d[o]}}),d[o]=a;for(var c=0;ct.mode===e.mode&&t.top<=l).sort((e,t)=>e.top-t.top);if(0===d.length)if(2===e.mode)return l-e.height;else return r;if(d.unshift({type:"top",top:0,left:0,right:0,height:r,width:i,speed:0,distance:i}),d.push({type:"bottom",top:l,left:0,right:0,height:n,width:i,speed:0,distance:i}),2===e.mode)for(let t=d.length-2;t>=0;t-=1){let i=d[t],o=d[t+1],n=i.top+i.height;if(o.top-n>=e.height)return o.top-e.height}else for(let t=1;t=e.height)return n}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),o=Math.min(...e.map(e=>e.right));return i*t.length-o*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:n})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},["3DCG7"],"3DCG7","parcelRequire93cf",{});'},{}],ddE7h:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./style.less"),s=n.interopDefault(o),l=t("bundle-text:./img/on.svg"),r=n.interopDefault(l),d=t("bundle-text:./img/off.svg"),p=n.interopDefault(d),u=t("bundle-text:./img/config.svg"),h=n.interopDefault(u),m=t("bundle-text:./img/style.svg"),c=n.interopDefault(m),f=t("bundle-text:./img/mode_0_off.svg"),g=n.interopDefault(f),y=t("bundle-text:./img/mode_0_on.svg"),v=n.interopDefault(y),x=t("bundle-text:./img/mode_1_off.svg"),k=n.interopDefault(x),$=t("bundle-text:./img/mode_1_on.svg"),b=n.interopDefault($),w=t("bundle-text:./img/mode_2_off.svg"),E=n.interopDefault(w),M=t("bundle-text:./img/mode_2_on.svg"),S=n.interopDefault(M),D=t("bundle-text:./img/check_on.svg"),z=n.interopDefault(D),F=t("bundle-text:./img/check_off.svg"),A=n.interopDefault(F);if(i.default=class{constructor(t,e){this.art=t,this.danmuku=e,this.utils=t.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=t.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$config:null,$configPanel:null,$configModes:null,$style:null,$stylePanel: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),t.on("resize",()=>this.resize()),t.on("fullscreen",t=>this.onFullscreen(t)),t.on("fullscreenWeb",t=>this.onFullscreen(t)),t.proxy(this.template.$config,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$config,$panel:this.template.$configPanel})}),t.proxy(this.template.$style,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$style,$panel:this.template.$stylePanel})})}static get icons(){return{$on:r.default,$off:p.default,$config:h.default,$style:c.default,$mode_0_off:g.default,$mode_0_on:v.default,$mode_1_off:k.default,$mode_1_on:b.default,$mode_2_off:E.default,$mode_2_on:S.default,$check_on:z.default,$check_off:A.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:t}=this;return`
${r.default}${p.default}
${h.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${g.default}${v.default}
\u{6EDA}\u{52A8}
${k.default}${b.default}
\u{9876}\u{90E8}
${E.default}${S.default}
\u{5E95}\u{90E8}
${z.default}${A.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${z.default}${A.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}
${c.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${b.default}
\u{9876}\u{90E8}
${S.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(t=>`
`).join("")}
\u{53D1}\u{9001}
`}get OPACITY(){return{min:0,max:100,steps:[],...this.option.OPACITY}}get FONT_SIZE(){return{min:12,max:120,steps:[],...this.option.FONT_SIZE}}get MARGIN(){return{min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}],...this.option.MARGIN}}get SPEED(){return{min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}],...this.option.SPEED}}get COLOR(){return this.option.COLOR.length?this.option.COLOR:["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(t){let{query:e}=this.utils,{$danmuku:i}=this.template;return e(t,i)}append(t,e){let{append:i}=this.utils;[...t.children].some(t=>t===e)||i(t,e)}setData(t,e){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[t]=e,this.outside&&(a.dataset[t]=e)}createTemplate(){let{createElement:t,tooltip:e}=this.utils,i=t("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");let{$toggle:a}=this.template;this.art.on("artplayerPluginDanmuku:show",()=>{e(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",()=>{e(a,"打开弹幕")})}createEvents(){let{$toggle:t,$configModes:e,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(t,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(e,"click",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(t=>t!==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",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",t=>{let e=t.target.closest(".apd-color");e&&(this.danmuku.config({color:e.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({...this.OPACITY,container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:t=>{let{$opacityValue:e}=this.template;e.textContent=`${t}%`,this.danmuku.config({opacity:t/100})}}),this.slider.margin=this.createSlider({...this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.steps.findIndex(t=>t.value[0]===this.option.margin[0]&&t.value[1]===this.option.margin[1]),onChange:t=>{let e=this.MARGIN.steps[t];if(!e)return;let{$marginValue:i}=this.template;i.textContent=e.name,this.danmuku.config({margin:e.value})}}),this.slider.fontSize=this.createSlider({...this.FONT_SIZE,container:this.template.$fontSizeSlider,findIndex:()=>this.danmuku.fontSize,onChange:t=>{let{$fontSizeValue:e}=this.template;e.textContent=`${t}px`,t!==this.danmuku.fontSize&&this.danmuku.config({fontSize:t})}}),this.slider.speed=this.createSlider({...this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.steps.findIndex(t=>t.value===this.option.speed),onChange:t=>{let e=this.SPEED.steps[t];if(!e)return;let{$speedValue:i}=this.template;i.textContent=e.name,this.danmuku.config({speed:e.value})}})}createSlider({min:t,max:e,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l,setStyle:r}=this.utils;r(i,"touch-action","none"),i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(t=>t.hide?"":`
${t.name}
`).join("")}
`;let d=s(".apd-slider-dot",i),p=s(".apd-slider-progress",i),u=!1;function h(i=a()){if(ie)return;let s=(i-t)/(e-t);d.style.left=`${100*s}%`,0===o.length&&(p.style.width=d.style.left),n(i)}function m(a){let{top:n,height:o,left:s,width:r}=i.getBoundingClientRect();this.art.isRotate?h(Math.round(l(a.clientY-n,0,o)/o*(e-t)+t)):h(Math.round(l(a.clientX-s,0,r)/r*(e-t)+t))}return this.art.proxy(i,"click",t=>{m.call(this,t)}),this.art.proxy(i,"pointerdown",t=>{u=0===t.button}),this.art.proxy(document,"pointermove",t=>{u&&m.call(this,t)}),this.art.proxy(document,"pointerup",t=>{u&&(u=!1,m.call(this,t))}),{reset:h}}onFullscreen(t){let{$danmuku:e,$controlsCenter:i,$mount:a}=this.template;this.outside?t?this.append(i,e):this.append(a,e):this.append(i,e)}onMouseEnter({$control:t,$panel:e}){let{$player:i}=this.art.template,a=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=i.getBoundingClientRect(),s=n.width/2-a.width/2,l=o.left-(a.left-s),r=a.right+s-o.right;l>0?e.style.left=`${-s+l}px`:r>0?e.style.left=`${-s-r}px`:e.style.left=`${-s}px`}async emit(){let{$input:t}=this.template,e=t.value.trim();if(!e.length||this.isLock||this.emitting)return;let i={text:e,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let e=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==e)return;i.border=!0,delete i.time,this.danmuku.emit(i),t.value="",this.lock()}catch(t){this.emitting=!1}}lock(){let{addClass:t}=this.utils,{$send:e}=this.template;this.isLock=!0;let i=this.option.lockTime;e.innerText=i,t(e,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(e.innerText=i-=1,a())},1e3)};a()}unlock(){let{removeClass:t}=this.utils,{$send:e}=this.template;clearTimeout(this.timer),this.isLock=!1,e.innerText="发送",t(e,"apd-lock")}resize(){if(this.outside||this.art.fullscreen||this.art.fullscreenWeb)return;let{$player:t,$controlsCenter:e}=this.art.template,{$danmuku:i}=this.template;this.art.widtht.dataset.color===this.option.color.toUpperCase());n&&t(n,"apd-active"),e(i,this.option.visible?"关闭弹幕":"打开弹幕"),this.resize()}mount(t){let{errorHandle:e}=this.utils,i="string"==typeof t?document.querySelector(t):t;e(i,`Can not find the mount point: ${t}`),this.append(i,this.template.$danmuku),this.template.$mount=i,this.reset()}},"undefined"!=typeof document){let t="artplayer-plugin-danmuku",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=s.default}},{"bundle-text:./style.less":"jaQAo","bundle-text:./img/on.svg":"86CEd","bundle-text:./img/off.svg":"3FcnK","bundle-text:./img/config.svg":"j1vhO","bundle-text:./img/style.svg":"jmfTi","bundle-text:./img/mode_0_off.svg":"ffHqV","bundle-text:./img/mode_0_on.svg":"eGfex","bundle-text:./img/mode_1_off.svg":"77326","bundle-text:./img/mode_1_on.svg":"6P4nN","bundle-text:./img/mode_2_off.svg":"cBcwx","bundle-text:./img/mode_2_on.svg":"i6KC4","bundle-text:./img/check_on.svg":"2H4K5","bundle-text:./img/check_off.svg":"4JI0m","@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],jaQAo:[function(t,e,i,a){e.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}'},{}],"86CEd":[function(t,e,i,a){e.exports=''},{}],"3FcnK":[function(t,e,i,a){e.exports=''},{}],j1vhO:[function(t,e,i,a){e.exports=''},{}],jmfTi:[function(t,e,i,a){e.exports=''},{}],ffHqV:[function(t,e,i,a){e.exports=''},{}],eGfex:[function(t,e,i,a){e.exports=''},{}],77326:[function(t,e,i,a){e.exports=''},{}],"6P4nN":[function(t,e,i,a){e.exports=''},{}],cBcwx:[function(t,e,i,a){e.exports=''},{}],i6KC4:[function(t,e,i,a){e.exports=''},{}],"2H4K5":[function(t,e,i,a){e.exports=''},{}],"4JI0m":[function(t,e,i,a){e.exports=''},{}],falVu:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>l);let o={map:(t,e,i,a,n)=>(t-e)*(n-a)/(i-e)+a,range(t,e,i){let a=Math.round(t/i)*i;return Array.from({length:Math.floor((e-t)/i)},(t,e)=>e*i+a)}},s=(t,e)=>{let i=e[0]-t[0],a=e[1]-t[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function l(t,e,i){let{query:a}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(n){let l=null,r=null;function d(p=[]){if(l=null,r=null,n.innerHTML="",!t.duration||t.option.isLive)return;let u={w:n.offsetWidth,h:n.offsetHeight},h={xMin:0,xMax:u.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*u.h),sampling:Math.floor(u.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(h,i);let m=[];if(Array.isArray(p)&&p.length)m=[...p];else{let i=t.duration/u.w;for(let t=0;t<=u.w;t+=h.sampling){let a=e.queue.filter(({time:e})=>e>t*i&&e<=(t+h.sampling)*i).length;m.push([t,a])}}if(0===m.length)return;let c=m[m.length-1],f=c[0],g=c[1];f!==u.w&&m.push([u.w,g]);let y=m.map(t=>t[1]),v=(Math.min(...y)+Math.max(...y))/2;for(let t=0;tv?1+h.scale:1-h.scale)+h.minHeight}let x=(t,e,i,a)=>{let n=s(e||t,i||t),l=o.map(Math.cos(n.angle)*h.flattening,0,1,1,0),r=n.angle*l+(a?Math.PI:0),d=n.length*h.smoothing;return[t[0]+Math.cos(r)*d,t[1]+Math.sin(r)*d]},k=(t,e,i)=>{let a=x(i[e-1],i[e-2],t),n=x(t,i[e-1],i[e+1],!0),o=e===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${t[0]},${t[1]}${o}`},$=m.map(t=>[o.map(t[0],h.xMin,h.xMax,0,u.w),o.map(t[1],h.yMin,h.yMax,u.h,0)]).reduce((t,e,i,a)=>0===i?`M ${a[a.length-1][0]},${u.h} L ${e[0]},${u.h} L ${e[0]},${e[1]}`:`${t} ${k(e,i,a)}`,"");n.innerHTML=``,l=a("#heatmap-start",n),r=a("#heatmap-stop",n),l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{l&&r&&"played"===t&&(l.setAttribute("offset",`${100*e}%`),r.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>d()),t.on("resize",()=>d()),t.on("artplayerPluginDanmuku:loaded",()=>d()),t.on("artplayerPluginDanmuku:points",t=>d(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}]},["jz4E5"],"jz4E5","parcelRequire93cf",{}); \ 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 8b35c2087..d26a49466 100644 --- a/docs/compiled/artplayer-plugin-danmuku.legacy.js +++ b/docs/compiled/artplayer-plugin-danmuku.legacy.js @@ -5,4 +5,4 @@ * (c) 2017-2025 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,r,a,i,o,s){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof l[r]&&l[r],c=u.i||{},d=u.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!d[t]){if(!e[t]){if(a[t])return a[t];var i="function"==typeof l[r]&&l[r];if(!n&&i)return i(t,!0);if(u)return u(t,!0);if(p&&"string"==typeof t)return p(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}c.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},c.cache={};var s=d[t]=new f.Module(t);e[t][0].call(s.exports,c,s,s.exports,l)}return d[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=p,this.exports={}},f.modules=e,f.cache=d,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var h=0;h=n.time&&n.time>=e-.1&&t.push(n)}),t}},{key:"visibles",get:function(){var e=this,t=[],n=this.$player.clientWidth,r=this.getLeft(this.$player);return this.filter("emit",function(a){var i=a.$ref.offsetTop,o=e.getLeft(a.$ref)-r,s=a.$ref.clientHeight,l=a.$ref.clientWidth,u=o+l,c=u/a.$restTime,d={};d.top=i,d.left=o,d.height=s,d.width=l,d.right=n-u,d.speed=c,d.distance=u,d.time=a.$restTime,d.mode=a.mode,t.push(d)}),t}},{key:"speed",get:function(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}},{key:"load",value:function(e){var t=this;return(0,i._)(function(){var n,r,a,i,o,s;return(0,c._)(this,function(l){switch(l.label){case 0:n=t.utils.errorHandle,r=[],a=e||t.option.danmuku,l.label=1;case 1:if(l.trys.push([1,13,,14]),"function"!=typeof a)return[3,3];return[4,a()];case 2:case 4:case 6:return r=l.sent(),[3,8];case 3:if(!(a instanceof Promise))return[3,5];return[4,a];case 5:if("string"!=typeof a)return[3,7];return[4,(0,d.bilibiliDanmuParseFromUrl)(a)];case 7:Array.isArray(a)&&(r=a),l.label=8;case 8:n(Array.isArray(r),"Danmuku need return an array as result"),void 0===e&&(t.reset(),t.queue=[],t.states={wait:[],ready:[],emit:[],stop:[]},t.$refs=[],t.$danmuku.innerText=""),i=0,l.label=9;case 9:if(!(i0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(n){t.id=Date.now(),e.worker.postMessage(t),e.worker.onmessage=function(e){var r=e.data;r.id===t.id&&n(r)}})}},{key:"filter",value:function(e,t){for(var n=this.states[e]||[],r=0;rt.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);at.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function c(e,t,n,r){var a,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(s=(o<3?a(s):o>3?a(t,n,s):a(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function d(e,t){return function(n,r){t(n,r,e)}}function p(e,t,n,r,a,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var l,u=r.kind,c="getter"===u?"get":"setter"===u?"set":"value",d=!t&&e?r.static?e:e.prototype:null,p=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),f=!1,h=n.length-1;h>=0;h--){var m={};for(var y in r)m[y]="access"===y?{}:r[y];for(var y in r.access)m.access[y]=r.access[y];m.addInitializer=function(e){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var g=(0,n[h])("accessor"===u?{get:p.get,set:p.set}:p[c],m);if("accessor"===u){if(void 0===g)continue;if(null===g||(void 0===g?"undefined":(0,i._)(g))!=="object")throw TypeError("Object expected");(l=s(g.get))&&(p.get=l),(l=s(g.set))&&(p.set=l),(l=s(g.init))&&a.unshift(l)}else(l=s(g))&&("field"===u?a.unshift(l):p[c]=l)}d&&Object.defineProperty(d,r.name,p),f=!0}function f(e,t,n){for(var r=arguments.length>2,a=0;a0&&a[a.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return o}function w(){for(var e=[],t=0;t1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{var n;(n=a[e](t)).value instanceof S?Promise.resolve(n.value.v).then(l,u):c(i[0][2],n)}catch(e){c(i[0][3],e)}}function l(e){s("next",e)}function u(e){s("throw",e)}function c(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function M(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,a){t[r]=e[r]?function(t){return(n=!n)?{value:S(e[r](t)),done:!1}:a?a(t):t}:a}}function P(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=x(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,a){var i,o,s;i=r,o=a,s=(t=e[n](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:s})},o)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var D=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},T=function(e){return(T=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t})(e)};function A(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=T(e),r=0;r(?.+?)<\\/d>',"gs"));return Array.from(e.matchAll(t)).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:s(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 u(e){var t=e.data,n=t.xml,r=t.id;if(r&&n){var a=l(n);self.postMessage({danmus:a,id:r})}}function c(e){var t;return new Promise((t=(0,i._)(function(t){var n,r;return(0,o._)(this,function(a){switch(a.label){case 0:return[4,fetch(e)];case 1:return[4,a.sent().text()];case 2:n=a.sent();try{var i;i=new Blob(["\n ".concat(s.toString(),"\n ").concat(l.toString(),"\n onmessage = ").concat(u.toString(),"\n ")],{type:"application/javascript"}),(r=new Worker(URL.createObjectURL(i))).onmessage=function(e){var n=e.data,a=n.danmus;n.id&&a&&(t(a),r.terminate())},r.postMessage({xml:n,id:Date.now()})}catch(e){t(l(n))}return[2]}})}),function(e){return t.apply(this,arguments)}))}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],eJQ5w:[function(e,t,n,r){t.exports='!function(e,t,r,n,i,o,f,u){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof a[n]&&a[n],s=c.i||{},d=c.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!d[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof a[n]&&a[n];if(!r&&o)return o(t,!0);if(c)return c(t,!0);if(l&&"string"==typeof t)return l(t);var f=Error("Cannot find module \'"+t+"\'");throw f.code="MODULE_NOT_FOUND",f}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var u=d[t]=new p.Module(t);e[t][0].call(u.exports,s,u,u.exports,a)}return d[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=l,this.exports={}},p.modules=e,p.cache=d,p.parent=c,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[n]}}),a[n]=p;for(var h=0;h=0;d-=1){var l=s[d],p=s[d+1],h=l.top+l.height;if(p.top-h>=t.height)return p.top-t.height}else for(var m=1;m=t.height)return v}for(var y=[],_=1;_e.time))})});return A&&A[0]?A[0].top:void 0;case 1:case 2:return}else{switch(t.mode){case 0:y.sort(function(e,t){var r,n,o=(r=Math).min.apply(r,(0,i._)(t.map(function(e){return e.right}))),f=(n=Math).min.apply(n,(0,i._)(e.map(function(e){return e.right})));return o*t.length-f*e.length});break;case 1:case 2:y.sort(function(e,t){var r,n,o=(r=Math).max.apply(r,(0,i._)(t.map(function(e){return e.width})));return(n=Math).max.apply(n,(0,i._)(e.map(function(e){return e.width})))*e.length-o*t.length})}return y[0][0].top}}onmessage=function(e){var t=e.data;if(t.id&&t.type){var r=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:r,id:t.id})}}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6"}],i81N6:[function(e,t,r,n){"use strict";var i=e("d402183024004bc7"),o=e("3209e2b12672cd18"),f=e("fc58adb8f1bff142"),u=e("5e213dc122a10171");r._=function(e){return i._(e)||o._(e)||u._(e)||f._()}},{d402183024004bc7:"hfQG0","3209e2b12672cd18":"fQrlQ",fc58adb8f1bff142:"fWabh","5e213dc122a10171":"fh7mx"}],hfQG0:[function(e,t,r,n){"use strict";var i=e("5bd5b10bf87fc8e");r._=function(e){if(Array.isArray(e))return i._(e)}},{"5bd5b10bf87fc8e":"1WOAB"}],"1WOAB":[function(e,t,r,n){"use strict";r._=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r\n '.concat(m.default).concat(g.default,'\n\n
\n ').concat(b.default,'\n
\n
\n
\n 按类型屏蔽\n
\n
\n ').concat(w.default).concat($.default,'\n
滚动
\n
\n
\n ').concat(O.default).concat(P.default,'\n
顶部
\n
\n
\n ').concat(D.default).concat(A.default,'\n
底部
\n
\n
\n
\n
\n
\n ').concat(F.default).concat(C.default,'\n 防止弹幕重叠\n
\n
\n ').concat(F.default).concat(C.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(x.default,'\n
\n
\n
\n 模式\n
\n
\n ').concat($.default,'\n
滚动
\n
\n
\n ').concat(P.default,'\n
顶部
\n
\n
\n ').concat(A.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:"OPACITY",get:function(){return(0,l._)({min:0,max:100,steps:[]},this.option.OPACITY)}},{key:"FONT_SIZE",get:function(){return(0,l._)({min:12,max:120,steps:[]},this.option.FONT_SIZE)}},{key:"MARGIN",get:function(){return(0,l._)({min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}]},this.option.MARGIN)}},{key:"SPEED",get:function(){return(0,l._)({min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}]},this.option.SPEED)}},{key:"COLOR",get:function(){return this.option.COLOR.length?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:"append",value:function(e,t){var n=this.utils.append;(0,c._)(e.children).some(function(e){return e===t})||n(e,t)}},{key:"setData",value:function(e,t){var n=this.art.template.$player,r=this.template.$mount;n.dataset[e]=t,this.outside&&(r.dataset[e]=t)}},{key:"createTemplate",value:function(){var e=this.utils,t=e.createElement,n=e.tooltip,r=t("div");r.className="artplayer-plugin-danmuku",r.innerHTML=this.TEMPLATE,this.template.$danmuku=r,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");var a=this.template.$toggle;this.art.on("artplayerPluginDanmuku:show",function(){n(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",function(){n(a,"打开弹幕")})}},{key:"createEvents",value:function(){var e=this,t=this.template,n=t.$toggle,r=t.$configModes,a=t.$styleModes,i=t.$colors,o=t.$antiOverlap,s=t.$syncVideo,l=t.$send,u=t.$input;this.art.proxy(n,"click",function(){e.danmuku.config({visible:!e.option.visible}),e.reset()}),this.art.proxy(r,"click",function(t){var n=t.target.closest(".apd-mode");if(n){var r=Number(n.dataset.mode);e.option.modes.includes(r)?e.danmuku.config({modes:e.option.modes.filter(function(e){return e!==r})}):e.danmuku.config({modes:(0,c._)(e.option.modes).concat([r])}),e.reset()}}),this.art.proxy(o,"click",function(){e.danmuku.config({antiOverlap:!e.option.antiOverlap}),e.reset()}),this.art.proxy(s,"click",function(){e.danmuku.config({synchronousPlayback:!e.option.synchronousPlayback}),e.reset()}),this.art.proxy(a,"click",function(t){var n=t.target.closest(".apd-mode");if(n){var r=Number(n.dataset.mode);e.danmuku.config({mode:r}),e.reset()}}),this.art.proxy(i,"click",function(t){var n=t.target.closest(".apd-color");n&&(e.danmuku.config({color:n.dataset.color}),e.reset())}),this.art.proxy(l,"click",function(){return e.emit()}),this.art.proxy(u,"keypress",function(t){"Enter"===t.key&&(t.preventDefault(),e.emit())})}},{key:"createSliders",value:function(){var e=this;this.slider.opacity=this.createSlider((0,u._)((0,l._)({},this.OPACITY),{container:this.template.$opacitySlider,findIndex:function(){return Math.round(100*e.option.opacity)},onChange:function(t){e.template.$opacityValue.textContent="".concat(t,"%"),e.danmuku.config({opacity:t/100})}})),this.slider.margin=this.createSlider((0,u._)((0,l._)({},this.MARGIN),{container:this.template.$marginSlider,findIndex:function(){return e.MARGIN.steps.findIndex(function(t){return t.value[0]===e.option.margin[0]&&t.value[1]===e.option.margin[1]})},onChange:function(t){var n=e.MARGIN.steps[t];n&&(e.template.$marginValue.textContent=n.name,e.danmuku.config({margin:n.value}))}})),this.slider.fontSize=this.createSlider((0,u._)((0,l._)({},this.FONT_SIZE),{container:this.template.$fontSizeSlider,findIndex:function(){return e.danmuku.fontSize},onChange:function(t){e.template.$fontSizeValue.textContent="".concat(t,"px"),t!==e.danmuku.fontSize&&e.danmuku.config({fontSize:t})}})),this.slider.speed=this.createSlider((0,u._)((0,l._)({},this.SPEED),{container:this.template.$speedSlider,findIndex:function(){return e.SPEED.steps.findIndex(function(t){return t.value===e.option.speed})},onChange:function(t){var n=e.SPEED.steps[t];n&&(e.template.$speedValue.textContent=n.name,e.danmuku.config({speed:n.value}))}}))}},{key:"createSlider",value:function(e){var t=this,n=e.min,r=e.max,a=e.container,i=e.findIndex,o=e.onChange,s=e.steps,l=void 0===s?[]:s,u=this.utils,c=u.query,d=u.clamp;(0,u.setStyle)(a,"touch-action","none"),a.innerHTML='\n
\n
\n '.concat(l.map(function(){return'
'}).join(""),'\n
\n
\n
\n
\n
\n ').concat(l.map(function(e){return e.hide?"":'
'.concat(e.name,"
")}).join(""),"\n
\n ");var p=c(".apd-slider-dot",a),f=c(".apd-slider-progress",a),h=!1;function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i();if(!(er)){var t=(e-n)/(r-n);p.style.left="".concat(100*t,"%"),0===l.length&&(f.style.width=p.style.left),o(e)}}function y(e){var t=a.getBoundingClientRect(),i=t.top,o=t.height,s=t.left,l=t.width;this.art.isRotate?m(Math.round(d(e.clientY-i,0,o)/o*(r-n)+n)):m(Math.round(d(e.clientX-s,0,l)/l*(r-n)+n))}return this.art.proxy(a,"click",function(e){y.call(t,e)}),this.art.proxy(a,"pointerdown",function(e){h=0===e.button}),this.art.proxy(document,"pointermove",function(e){h&&y.call(t,e)}),this.art.proxy(document,"pointerup",function(e){h&&(h=!1,y.call(t,e))}),{reset:m}}},{key:"onFullscreen",value:function(e){var t=this.template,n=t.$danmuku,r=t.$controlsCenter,a=t.$mount;this.outside?e?this.append(r,n):this.append(a,n):this.append(r,n)}},{key:"onMouseEnter",value:function(e){var t=e.$control,n=e.$panel,r=this.art.template.$player,a=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.getBoundingClientRect(),s=i.width/2-a.width/2,l=o.left-(a.left-s),u=a.right+s-o.right;l>0?n.style.left="".concat(-s+l,"px"):u>0?n.style.left="".concat(-s-u,"px"):n.style.left="".concat(-s,"px")}},{key:"emit",value:function(){var e=this;return(0,i._)(function(){var t,n,r,a;return(0,d._)(this,function(i){switch(i.label){case 0:if(!(n=(t=e.template.$input).value.trim()).length||e.isLock||e.emitting)return[2];r={text:n,mode:e.option.mode,color:e.option.color,time:e.art.currentTime},i.label=1;case 1:return i.trys.push([1,3,,4]),e.emitting=!0,[4,e.option.beforeEmit(r)];case 2:if(a=i.sent(),e.emitting=!1,!0!==a)return[2];return r.border=!0,delete r.time,e.danmuku.emit(r),t.value="",e.lock(),[3,4];case 3:return i.sent(),e.emitting=!1,[3,4];case 4:return[2]}})})()}},{key:"lock",value:function(){var e=this,t=this.utils.addClass,n=this.template.$send;this.isLock=!0;var r=this.option.lockTime;n.innerText=r,t(n,"apd-lock");var a=function(){e.timer=setTimeout(function(){0===r?e.unlock():(n.innerText=r-=1,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:"resize",value:function(){if(!this.outside&&!this.art.fullscreen&&!this.art.fullscreenWeb){var e=this.art.template,t=e.$player,n=e.$controlsCenter,r=this.template.$danmuku;this.art.widthe.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[];if(u=null,c=null,a.innerHTML="",e.duration&&!e.option.isLive){var h={w:a.offsetWidth,h:a.offsetHeight},m={xMin:0,xMax:h.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*h.h),sampling:Math.floor(h.w/100),smoothing:.2,flattening:.2};(void 0===n?"undefined":(0,o._)(n))==="object"&&Object.assign(m,n);var y=[];if(Array.isArray(f)&&f.length)y=(0,i._)(f);else for(var g=function(e){var n=t.queue.filter(function(t){var n=t.time;return n>e*v&&n<=(e+m.sampling)*v}).length;y.push([e,n])},v=e.duration/h.w,b=0;b<=h.w;b+=m.sampling)g(b);if(0!==y.length){var _=y[y.length-1],x=_[0],k=_[1];x!==h.w&&y.push([h.w,k]);for(var w=y.map(function(e){return e[1]}),j=((d=Math).min.apply(d,(0,i._)(w))+(p=Math).max.apply(p,(0,i._)(w)))/2,$=0;$j?1+m.scale:1-m.scale)+m.minHeight}var M=function(e,t,n,r){var a=l(t||e,n||e),i=s.map(Math.cos(a.angle)*m.flattening,0,1,1,0),o=a.angle*i+(r?Math.PI:0),u=a.length*m.smoothing;return[e[0]+Math.cos(o)*u,e[1]+Math.sin(o)*u]},P=function(e,t,n){var r=M(n[t-1],n[t-2],e),a=M(e,n[t-1],n[t+1],!0),i=t===n.length-1?" z":"";return"C ".concat(r[0],",").concat(r[1]," ").concat(a[0],",").concat(a[1]," ").concat(e[0],",").concat(e[1]).concat(i)},E=y.map(function(e){return[s.map(e[0],m.xMin,m.xMax,0,h.w),s.map(e[1],m.yMin,m.yMax,h.h,0)]}).reduce(function(e,t,n,r){return 0===n?"M ".concat(r[r.length-1][0],",").concat(h.h," L ").concat(t[0],",").concat(h.h," L ").concat(t[0],",").concat(t[1]):"".concat(e," ").concat(P(t,n,r))},"");a.innerHTML='\n\n\n\n\n\n\n\n\n\n\n\n '),u=r("#heatmap-start",a),c=r("#heatmap-stop",a),u.setAttribute("offset","".concat(100*e.played,"%")),c.setAttribute("offset","".concat(100*e.played,"%"))}}}e.on("video:timeupdate",function(){u&&c&&(u.setAttribute("offset","".concat(100*e.played,"%")),c.setAttribute("offset","".concat(100*e.played,"%")))}),e.on("setBar",function(e,t){u&&c&&"played"===e&&(u.setAttribute("offset","".concat(100*t,"%")),c.setAttribute("offset","".concat(100*t,"%")))}),e.on("ready",function(){return d()}),e.on("resize",function(){return d()}),e.on("artplayerPluginDanmuku:loaded",function(){return d()}),e.on("artplayerPluginDanmuku:points",function(e){return d(e)})}})}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}]},["l3CkF"],"l3CkF","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,n,r,a,i,o,s){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof l[r]&&l[r],c=u.i||{},d=u.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!d[t]){if(!e[t]){if(a[t])return a[t];var i="function"==typeof l[r]&&l[r];if(!n&&i)return i(t,!0);if(u)return u(t,!0);if(p&&"string"==typeof t)return p(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}c.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},c.cache={};var s=d[t]=new f.Module(t);e[t][0].call(s.exports,c,s,s.exports,l)}return d[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=p,this.exports={}},f.modules=e,f.cache=d,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var h=0;h=n.time&&n.time>=e-.1&&t.push(n)}),t}},{key:"visibles",get:function(){var e=this,t=[],n=this.$player.clientWidth,r=this.getLeft(this.$player);return this.filter("emit",function(a){var i=a.$ref.offsetTop,o=e.getLeft(a.$ref)-r,s=a.$ref.clientHeight,l=a.$ref.clientWidth,u=o+l,c=u/a.$restTime,d={};d.top=i,d.left=o,d.height=s,d.width=l,d.right=n-u,d.speed=c,d.distance=u,d.time=a.$restTime,d.mode=a.mode,t.push(d)}),t}},{key:"speed",get:function(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}},{key:"load",value:function(e){var t=this;return(0,i._)(function(){var n,r,a,i,o,s;return(0,c._)(this,function(l){switch(l.label){case 0:n=t.utils.errorHandle,r=[],a=e||t.option.danmuku,l.label=1;case 1:if(l.trys.push([1,13,,14]),"function"!=typeof a)return[3,3];return[4,a()];case 2:case 4:case 6:return r=l.sent(),[3,8];case 3:if(!(a instanceof Promise))return[3,5];return[4,a];case 5:if("string"!=typeof a)return[3,7];return[4,(0,d.bilibiliDanmuParseFromUrl)(a)];case 7:Array.isArray(a)&&(r=a),l.label=8;case 8:n(Array.isArray(r),"Danmuku need return an array as result"),void 0===e&&(t.reset(),t.queue=[],t.states={wait:[],ready:[],emit:[],stop:[]},t.$refs=[],t.$danmuku.innerText=""),i=0,l.label=9;case 9:if(!(i1&&void 0!==arguments[1]&&arguments[1],a=this.utils.clamp,i=this.art.template.$controlsCenter;return(Object.keys(t).some(function(e){return JSON.stringify(n.option[e])!==JSON.stringify(t[e])})||r)&&(this.option=Object.assign({},e.option,this.option,t),this.validator(this.option,e.scheme),this.option.mode=a(this.option.mode,0,2),this.option.speed=a(this.option.speed,1,10),this.option.opacity=a(this.option.opacity,0,1),this.option.lockTime=a(this.option.lockTime,1,60),this.option.maxLength=a(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}},{key:"getLeft",value:function(e){var t=e.getBoundingClientRect();return this.isRotate?t.top:t.left}},{key:"postMessage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(n){t.id=Date.now(),e.worker.postMessage(t),e.worker.onmessage=function(e){var r=e.data;r.id===t.id&&n(r)}})}},{key:"filter",value:function(e,t){for(var n=this.states[e]||[],r=0;rt.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);at.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function c(e,t,n,r){var a,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(s=(o<3?a(s):o>3?a(t,n,s):a(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function d(e,t){return function(n,r){t(n,r,e)}}function p(e,t,n,r,a,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var l,u=r.kind,c="getter"===u?"get":"setter"===u?"set":"value",d=!t&&e?r.static?e:e.prototype:null,p=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),f=!1,h=n.length-1;h>=0;h--){var m={};for(var g in r)m[g]="access"===g?{}:r[g];for(var g in r.access)m.access[g]=r.access[g];m.addInitializer=function(e){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var y=(0,n[h])("accessor"===u?{get:p.get,set:p.set}:p[c],m);if("accessor"===u){if(void 0===y)continue;if(null===y||(void 0===y?"undefined":(0,i._)(y))!=="object")throw TypeError("Object expected");(l=s(y.get))&&(p.get=l),(l=s(y.set))&&(p.set=l),(l=s(y.init))&&a.unshift(l)}else(l=s(y))&&("field"===u?a.unshift(l):p[c]=l)}d&&Object.defineProperty(d,r.name,p),f=!0}function f(e,t,n){for(var r=arguments.length>2,a=0;a0&&a[a.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return o}function w(){for(var e=[],t=0;t1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{var n;(n=a[e](t)).value instanceof S?Promise.resolve(n.value.v).then(l,u):c(i[0][2],n)}catch(e){c(i[0][3],e)}}function l(e){s("next",e)}function u(e){s("throw",e)}function c(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function E(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,a){t[r]=e[r]?function(t){return(n=!n)?{value:S(e[r](t)),done:!1}:a?a(t):t}:a}}function M(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=x(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,a){var i,o,s;i=r,o=a,s=(t=e[n](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:s})},o)})}}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},D=function(e){return(D=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t})(e)};function z(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=D(e),r=0;r(?.+?)<\\/d>',"gs"));return Array.from(e.matchAll(t)).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:s(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 u(e){var t=e.data,n=t.xml,r=t.id;if(r&&n){var a=l(n);self.postMessage({danmus:a,id:r})}}function c(e){var t;return new Promise((t=(0,i._)(function(t){var n,r;return(0,o._)(this,function(a){switch(a.label){case 0:return[4,fetch(e)];case 1:return[4,a.sent().text()];case 2:n=a.sent();try{var i;i=new Blob(["\n ".concat(s.toString(),"\n ").concat(l.toString(),"\n onmessage = ").concat(u.toString(),"\n ")],{type:"application/javascript"}),(r=new Worker(URL.createObjectURL(i))).onmessage=function(e){var n=e.data,a=n.danmus;n.id&&a&&(t(a),r.terminate())},r.postMessage({xml:n,id:Date.now()})}catch(e){t(l(n))}return[2]}})}),function(e){return t.apply(this,arguments)}))}},{"@swc/helpers/cjs/_async_to_generator.cjs":"4ElRo","@swc/helpers/cjs/_ts_generator.cjs":"a4h1C","@parcel/transformer-js/src/esmodule-helpers.js":"ihnSZ"}],"3dTMr":[function(e,t,n,r){t.exports='!function(e,t,r,n,i,o,a,u){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof f[n]&&f[n],s=c.i||{},d=c.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!d[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof f[n]&&f[n];if(!r&&o)return o(t,!0);if(c)return c(t,!0);if(l&&"string"==typeof t)return l(t);var a=Error("Cannot find module \'"+t+"\'");throw a.code="MODULE_NOT_FOUND",a}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var u=d[t]=new p.Module(t);e[t][0].call(u.exports,s,u,u.exports,f)}return d[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=l,this.exports={}},p.modules=e,p.cache=d,p.parent=c,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return f[n]}}),f[n]=p;for(var h=0;h=0;d-=1){var l=s[d],p=s[d+1],h=l.top+l.height;if(p.top-h>=t.height)return p.top-t.height}else for(var g=1;g=t.height)return b}for(var y=[],_=1;_e.time))})});return M&&M[0]?M[0].top:void 0;case 1:case 2:return}else{switch(t.mode){case 0:y.sort(function(e,t){var r,n,o=(r=Math).min.apply(r,(0,i._)(t.map(function(e){return e.right}))),a=(n=Math).min.apply(n,(0,i._)(e.map(function(e){return e.right})));return o*t.length-a*e.length});break;case 1:case 2:y.sort(function(e,t){var r,n,o=(r=Math).max.apply(r,(0,i._)(t.map(function(e){return e.width})));return(n=Math).max.apply(n,(0,i._)(e.map(function(e){return e.width})))*e.length-o*t.length})}return y[0][0].top}}onmessage=function(e){var t=e.data;if(t.id&&t.type){var r=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:r,id:t.id})}}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"1LaMX"}],"1LaMX":[function(e,t,r,n){"use strict";var i=e("39b649abd35ac2e2"),o=e("8428e13fa0ef5403"),a=e("8d50a6b373b717fa"),u=e("3c184cf684436bb9");r._=function(e){return i._(e)||o._(e)||u._(e)||a._()}},{"39b649abd35ac2e2":"i3OgW","8428e13fa0ef5403":"5CLcV","8d50a6b373b717fa":"cpcPX","3c184cf684436bb9":"ikxEb"}],i3OgW:[function(e,t,r,n){"use strict";var i=e("ec82543f1393b568");r._=function(e){if(Array.isArray(e))return i._(e)}},{ec82543f1393b568:"8HLaN"}],"8HLaN":[function(e,t,r,n){"use strict";r._=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r\n '.concat(m.default).concat(y.default,'\n\n
\n ').concat(b.default,'\n
\n
\n
\n 按类型屏蔽\n
\n
\n ').concat(w.default).concat($.default,'\n
滚动
\n
\n
\n ').concat(O.default).concat(M.default,'\n
顶部
\n
\n
\n ').concat(T.default).concat(z.default,'\n
底部
\n
\n
\n
\n
\n
\n ').concat(F.default).concat(q.default,'\n 防止弹幕重叠\n
\n
\n ').concat(F.default).concat(q.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(x.default,'\n
\n
\n
\n 模式\n
\n
\n ').concat($.default,'\n
滚动
\n
\n
\n ').concat(M.default,'\n
顶部
\n
\n
\n ').concat(z.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:"OPACITY",get:function(){return(0,l._)({min:0,max:100,steps:[]},this.option.OPACITY)}},{key:"FONT_SIZE",get:function(){return(0,l._)({min:12,max:120,steps:[]},this.option.FONT_SIZE)}},{key:"MARGIN",get:function(){return(0,l._)({min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}]},this.option.MARGIN)}},{key:"SPEED",get:function(){return(0,l._)({min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}]},this.option.SPEED)}},{key:"COLOR",get:function(){return this.option.COLOR.length?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:"append",value:function(e,t){var n=this.utils.append;(0,c._)(e.children).some(function(e){return e===t})||n(e,t)}},{key:"setData",value:function(e,t){var n=this.art.template.$player,r=this.template.$mount;n.dataset[e]=t,this.outside&&(r.dataset[e]=t)}},{key:"createTemplate",value:function(){var e=this.utils,t=e.createElement,n=e.tooltip,r=t("div");r.className="artplayer-plugin-danmuku",r.innerHTML=this.TEMPLATE,this.template.$danmuku=r,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");var a=this.template.$toggle;this.art.on("artplayerPluginDanmuku:show",function(){n(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",function(){n(a,"打开弹幕")})}},{key:"createEvents",value:function(){var e=this,t=this.template,n=t.$toggle,r=t.$configModes,a=t.$styleModes,i=t.$colors,o=t.$antiOverlap,s=t.$syncVideo,l=t.$send,u=t.$input;this.art.proxy(n,"click",function(){e.danmuku.config({visible:!e.option.visible}),e.reset()}),this.art.proxy(r,"click",function(t){var n=t.target.closest(".apd-mode");if(n){var r=Number(n.dataset.mode);e.option.modes.includes(r)?e.danmuku.config({modes:e.option.modes.filter(function(e){return e!==r})}):e.danmuku.config({modes:(0,c._)(e.option.modes).concat([r])}),e.reset()}}),this.art.proxy(o,"click",function(){e.danmuku.config({antiOverlap:!e.option.antiOverlap}),e.reset()}),this.art.proxy(s,"click",function(){e.danmuku.config({synchronousPlayback:!e.option.synchronousPlayback}),e.reset()}),this.art.proxy(a,"click",function(t){var n=t.target.closest(".apd-mode");if(n){var r=Number(n.dataset.mode);e.danmuku.config({mode:r}),e.reset()}}),this.art.proxy(i,"click",function(t){var n=t.target.closest(".apd-color");n&&(e.danmuku.config({color:n.dataset.color}),e.reset())}),this.art.proxy(l,"click",function(){return e.emit()}),this.art.proxy(u,"keypress",function(t){"Enter"===t.key&&(t.preventDefault(),e.emit())})}},{key:"createSliders",value:function(){var e=this;this.slider.opacity=this.createSlider((0,u._)((0,l._)({},this.OPACITY),{container:this.template.$opacitySlider,findIndex:function(){return Math.round(100*e.option.opacity)},onChange:function(t){e.template.$opacityValue.textContent="".concat(t,"%"),e.danmuku.config({opacity:t/100})}})),this.slider.margin=this.createSlider((0,u._)((0,l._)({},this.MARGIN),{container:this.template.$marginSlider,findIndex:function(){return e.MARGIN.steps.findIndex(function(t){return t.value[0]===e.option.margin[0]&&t.value[1]===e.option.margin[1]})},onChange:function(t){var n=e.MARGIN.steps[t];n&&(e.template.$marginValue.textContent=n.name,e.danmuku.config({margin:n.value}))}})),this.slider.fontSize=this.createSlider((0,u._)((0,l._)({},this.FONT_SIZE),{container:this.template.$fontSizeSlider,findIndex:function(){return e.danmuku.fontSize},onChange:function(t){e.template.$fontSizeValue.textContent="".concat(t,"px"),t!==e.danmuku.fontSize&&e.danmuku.config({fontSize:t})}})),this.slider.speed=this.createSlider((0,u._)((0,l._)({},this.SPEED),{container:this.template.$speedSlider,findIndex:function(){return e.SPEED.steps.findIndex(function(t){return t.value===e.option.speed})},onChange:function(t){var n=e.SPEED.steps[t];n&&(e.template.$speedValue.textContent=n.name,e.danmuku.config({speed:n.value}))}}))}},{key:"createSlider",value:function(e){var t=this,n=e.min,r=e.max,a=e.container,i=e.findIndex,o=e.onChange,s=e.steps,l=void 0===s?[]:s,u=this.utils,c=u.query,d=u.clamp;(0,u.setStyle)(a,"touch-action","none"),a.innerHTML='\n
\n
\n '.concat(l.map(function(){return'
'}).join(""),'\n
\n
\n
\n
\n
\n ').concat(l.map(function(e){return e.hide?"":'
'.concat(e.name,"
")}).join(""),"\n
\n ");var p=c(".apd-slider-dot",a),f=c(".apd-slider-progress",a),h=!1;function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i();if(!(er)){var t=(e-n)/(r-n);p.style.left="".concat(100*t,"%"),0===l.length&&(f.style.width=p.style.left),o(e)}}function g(e){var t=a.getBoundingClientRect(),i=t.top,o=t.height,s=t.left,l=t.width;this.art.isRotate?m(Math.round(d(e.clientY-i,0,o)/o*(r-n)+n)):m(Math.round(d(e.clientX-s,0,l)/l*(r-n)+n))}return this.art.proxy(a,"click",function(e){g.call(t,e)}),this.art.proxy(a,"pointerdown",function(e){h=0===e.button}),this.art.proxy(document,"pointermove",function(e){h&&g.call(t,e)}),this.art.proxy(document,"pointerup",function(e){h&&(h=!1,g.call(t,e))}),{reset:m}}},{key:"onFullscreen",value:function(e){var t=this.template,n=t.$danmuku,r=t.$controlsCenter,a=t.$mount;this.outside?e?this.append(r,n):this.append(a,n):this.append(r,n)}},{key:"onMouseEnter",value:function(e){var t=e.$control,n=e.$panel,r=this.art.template.$player,a=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.getBoundingClientRect(),s=i.width/2-a.width/2,l=o.left-(a.left-s),u=a.right+s-o.right;l>0?n.style.left="".concat(-s+l,"px"):u>0?n.style.left="".concat(-s-u,"px"):n.style.left="".concat(-s,"px")}},{key:"emit",value:function(){var e=this;return(0,i._)(function(){var t,n,r,a;return(0,d._)(this,function(i){switch(i.label){case 0:if(!(n=(t=e.template.$input).value.trim()).length||e.isLock||e.emitting)return[2];r={text:n,mode:e.option.mode,color:e.option.color,time:e.art.currentTime},i.label=1;case 1:return i.trys.push([1,3,,4]),e.emitting=!0,[4,e.option.beforeEmit(r)];case 2:if(a=i.sent(),e.emitting=!1,!0!==a)return[2];return r.border=!0,delete r.time,e.danmuku.emit(r),t.value="",e.lock(),[3,4];case 3:return i.sent(),e.emitting=!1,[3,4];case 4:return[2]}})})()}},{key:"lock",value:function(){var e=this,t=this.utils.addClass,n=this.template.$send;this.isLock=!0;var r=this.option.lockTime;n.innerText=r,t(n,"apd-lock");var a=function(){e.timer=setTimeout(function(){0===r?e.unlock():(n.innerText=r-=1,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:"resize",value:function(){if(!this.outside&&!this.art.fullscreen&&!this.art.fullscreenWeb){var e=this.art.template,t=e.$player,n=e.$controlsCenter,r=this.template.$danmuku;this.art.widthe.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[];if(u=null,c=null,a.innerHTML="",e.duration&&!e.option.isLive){var h={w:a.offsetWidth,h:a.offsetHeight},m={xMin:0,xMax:h.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*h.h),sampling:Math.floor(h.w/100),smoothing:.2,flattening:.2};(void 0===n?"undefined":(0,o._)(n))==="object"&&Object.assign(m,n);var g=[];if(Array.isArray(f)&&f.length)g=(0,i._)(f);else for(var y=function(e){var n=t.queue.filter(function(t){var n=t.time;return n>e*v&&n<=(e+m.sampling)*v}).length;g.push([e,n])},v=e.duration/h.w,b=0;b<=h.w;b+=m.sampling)y(b);if(0!==g.length){var _=g[g.length-1],x=_[0],k=_[1];x!==h.w&&g.push([h.w,k]);for(var w=g.map(function(e){return e[1]}),j=((d=Math).min.apply(d,(0,i._)(w))+(p=Math).max.apply(p,(0,i._)(w)))/2,$=0;$j?1+m.scale:1-m.scale)+m.minHeight}var E=function(e,t,n,r){var a=l(t||e,n||e),i=s.map(Math.cos(a.angle)*m.flattening,0,1,1,0),o=a.angle*i+(r?Math.PI:0),u=a.length*m.smoothing;return[e[0]+Math.cos(o)*u,e[1]+Math.sin(o)*u]},M=function(e,t,n){var r=E(n[t-1],n[t-2],e),a=E(e,n[t-1],n[t+1],!0),i=t===n.length-1?" z":"";return"C ".concat(r[0],",").concat(r[1]," ").concat(a[0],",").concat(a[1]," ").concat(e[0],",").concat(e[1]).concat(i)},P=g.map(function(e){return[s.map(e[0],m.xMin,m.xMax,0,h.w),s.map(e[1],m.yMin,m.yMax,h.h,0)]}).reduce(function(e,t,n,r){return 0===n?"M ".concat(r[r.length-1][0],",").concat(h.h," L ").concat(t[0],",").concat(h.h," L ").concat(t[0],",").concat(t[1]):"".concat(e," ").concat(M(t,n,r))},"");a.innerHTML='\n\n\n\n\n\n\n\n\n\n\n\n '),u=r("#heatmap-start",a),c=r("#heatmap-stop",a),u.setAttribute("offset","".concat(100*e.played,"%")),c.setAttribute("offset","".concat(100*e.played,"%"))}}}e.on("video:timeupdate",function(){u&&c&&(u.setAttribute("offset","".concat(100*e.played,"%")),c.setAttribute("offset","".concat(100*e.played,"%")))}),e.on("setBar",function(e,t){u&&c&&"played"===e&&(u.setAttribute("offset","".concat(100*t,"%")),c.setAttribute("offset","".concat(100*t,"%")))}),e.on("ready",function(){return d()}),e.on("resize",function(){return d()}),e.on("artplayerPluginDanmuku:loaded",function(){return d()}),e.on("artplayerPluginDanmuku:points",function(e){return d(e)})}})}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"1LaMX","@swc/helpers/cjs/_type_of.cjs":"9vrOw","@parcel/transformer-js/src/esmodule-helpers.js":"ihnSZ"}]},["bzF6W"],"bzF6W","parcelRequire93cf",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js index 88577f6fc..949f2f507 100644 --- a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js +++ b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js @@ -5,5 +5,5 @@ * (c) 2017-2025 Harvey Zack * Released under the MIT License. */ -!function(t,e,i,a,n,o,s,l){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof r[a]&&r[a],p=d.i||{},u=d.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof r[a]&&r[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var l=u[e]=new m.Module(e);t[e][0].call(l.exports,p,l,l.exports,r)}return u[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return r[a]}}),r[a]=m;for(var c=0;cu);var o=t("./danmuku"),s=n.interopDefault(o),l=t("./setting"),r=n.interopDefault(l),d=t("./heatmap"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,r.default)(e,i);return i.option.heatmap&&(0,p.default)(e,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}}}}u.icons=r.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"6C7g0","./setting":"90QKZ","./heatmap":"h2ayY","@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],"6C7g0":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("./bilibili"),s=t("bundle-text:./worker"),l=n.interopDefault(s);class r{constructor(t,e){let{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e);let n=new Blob([l.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),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,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}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|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}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:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[1]}get fontSize(){let{clamp:t}=this.utils,{clientHeight:e}=this.$player,i=this.option.fontSize;return"number"==typeof i?Math.round(t(i,12,e)):"string"==typeof i&&i.endsWith("%")?Math.round(t(e*(parseFloat(i)/100),12,e)):r.option.fontSize}get $ref(){let t=this.$refs.pop()||document.createElement("div");return t.style.cssText=r.cssText,t.dataset.mode="",t.className="",t}get readys(){let{currentTime:t}=this.art,e=[];return this.filter("ready",t=>e.push(t)),this.filter("wait",i=>{t+.1>=i.time&&i.time>=t-.1&&e.push(i)}),e}get visibles(){let t=[],{clientWidth:e}=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=e-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,t.push(p)}),t}get speed(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}async load(t){let{errorHandle:e}=this.utils,i=[],a=t||this.option.danmuku;try{"function"==typeof a?i=await a():a instanceof Promise?i=await a:"string"==typeof a?i=await (0,o.bilibiliDanmuParseFromUrl)(a):Array.isArray(a)&&(i=a),e(Array.isArray(i),"Danmuku need return an array as result"),void 0===t&&(this.reset(),this.queue=[],this.states={wait:[],ready:[],emit:[],stop:[]},this.$refs=[],this.$danmuku.innerText="");for(let t=0;tJSON.stringify(this.option[e])!==JSON.stringify(t[e]))&&(this.option=Object.assign({},r.option,this.option,t),this.validator(this.option,r.scheme),this.option.mode=e(this.option.mode,0,2),this.option.speed=e(this.option.speed,1,10),this.option.opacity=e(this.option.opacity,0,1),this.option.lockTime=e(this.option.lockTime,1,60),this.option.maxLength=e(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}postMessage(t={}){return new Promise(e=>{t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:a}=i;a.id===t.id&&e(a)}})}filter(t,e){let i=this.states[t]||[];for(let t=0;te!==t),t.$state=e,t.$ref&&(t.$ref.dataset.state=e),this.states[e].push(t)}makeWait(t){this.setState(t,"wait"),t.$ref&&(t.$ref.style.cssText=r.cssText,t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}update(){let{setStyles:t}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let e=this.readys;for(let i=0;i{0===e.mode&&(e.$ref.style.left=`${t}px`)}),this.filter("emit",e=>{if(e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.left=`${t}px`,e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}})}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(this.setState(e,"emit"),e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(this.setState(e,"stop"),0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$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(t=>this.makeWait(t)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.$danmuku.style.opacity=1,this.option.visible=!0,this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.$danmuku.style.opacity=0,this.option.visible=!1,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=r},{"./bilibili":"8WBpY","bundle-text:./worker":"8UAYg","@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],"8WBpY":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function o(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function s(t){if("string"!=typeof t)return[];let e=new RegExp(/(?.+?)<\/d>/gs);return Array.from(t.matchAll(e)).map(t=>{let e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:o(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null}).filter(Boolean)}function l({data:t}){let{xml:e,id:i}=t;if(!i||!e)return;let a=s(e);self.postMessage({danmus:a,id:i})}function r(t){return new Promise(async e=>{let i=await fetch(t),a=await i.text();try{let t=function(){let t=new Blob([` ${o.toString()} ${s.toString()} onmessage = ${l.toString()} `],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}();t.onmessage=i=>{let{danmus:a,id:n}=i.data;n&&a&&(e(a),t.terminate())},t.postMessage({xml:a,id:Date.now()})}catch(t){e(s(a))}})}n.defineInteropFlag(i),n.export(i,"bilibiliDanmuParseFromUrl",()=>r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],"5lQoW":[function(t,e,i,a){i.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},i.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.exportAll=function(t,e){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e},i.export=function(t,e,i){Object.defineProperty(t,e,{enumerable:!0,get:i})}},{}],"8UAYg":[function(t,e,i,a){e.exports='!function(e,t,i,r,o,n,l,d){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof f[r]&&f[r],p=u.i||{},s=u.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!s[t]){if(!e[t]){if(o[t])return o[t];var n="function"==typeof f[r]&&f[r];if(!i&&n)return n(t,!0);if(u)return u(t,!0);if(h&&"string"==typeof t)return h(t);var l=Error("Cannot find module \'"+t+"\'");throw l.code="MODULE_NOT_FOUND",l}p.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},p.cache={};var d=s[t]=new a.Module(t);e[t][0].call(d.exports,p,d,d.exports,f)}return s[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=h,this.exports={}},a.modules=e,a.cache=s,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=p,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return f[r]}}),f[r]=a;for(var c=0;ct.mode===e.mode&&t.top<=d).sort((e,t)=>e.top-t.top);if(0===f.length)if(2===e.mode)return d-e.height;else return n;if(f.unshift({type:"top",top:0,left:0,right:0,height:n,width:i,speed:0,distance:i}),f.push({type:"bottom",top:d,left:0,right:0,height:o,width:i,speed:0,distance:i}),2===e.mode)for(let t=f.length-2;t>=0;t-=1){let i=f[t],r=f[t+1],o=i.top+i.height;if(r.top-o>=e.height)return r.top-e.height}else for(let t=1;t=e.height)return o}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),r=Math.min(...e.map(e=>e.right));return i*t.length-r*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},["4KwZ6"],"4KwZ6","parcelRequire4dc0",{});let{"*":e}=parcelRequire4dc0("4KwZ6");export{e as default};'},{}],"90QKZ":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./style.less"),s=n.interopDefault(o),l=t("bundle-text:./img/on.svg"),r=n.interopDefault(l),d=t("bundle-text:./img/off.svg"),p=n.interopDefault(d),u=t("bundle-text:./img/config.svg"),h=n.interopDefault(u),m=t("bundle-text:./img/style.svg"),c=n.interopDefault(m),f=t("bundle-text:./img/mode_0_off.svg"),g=n.interopDefault(f),y=t("bundle-text:./img/mode_0_on.svg"),v=n.interopDefault(y),x=t("bundle-text:./img/mode_1_off.svg"),k=n.interopDefault(x),b=t("bundle-text:./img/mode_1_on.svg"),$=n.interopDefault(b),w=t("bundle-text:./img/mode_2_off.svg"),M=n.interopDefault(w),E=t("bundle-text:./img/mode_2_on.svg"),S=n.interopDefault(E),D=t("bundle-text:./img/check_on.svg"),A=n.interopDefault(D),z=t("bundle-text:./img/check_off.svg"),F=n.interopDefault(z);if(i.default=class{constructor(t,e){this.art=t,this.danmuku=e,this.utils=t.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=t.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$config:null,$configPanel:null,$configModes:null,$style:null,$stylePanel: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),t.on("resize",()=>this.resize()),t.on("fullscreen",t=>this.onFullscreen(t)),t.on("fullscreenWeb",t=>this.onFullscreen(t)),t.proxy(this.template.$config,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$config,$panel:this.template.$configPanel})}),t.proxy(this.template.$style,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$style,$panel:this.template.$stylePanel})})}static get icons(){return{$on:r.default,$off:p.default,$config:h.default,$style:c.default,$mode_0_off:g.default,$mode_0_on:v.default,$mode_1_off:k.default,$mode_1_on:$.default,$mode_2_off:M.default,$mode_2_on:S.default,$check_on:A.default,$check_off:F.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:t}=this;return`
${r.default}${p.default}
${h.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${g.default}${v.default}
\u{6EDA}\u{52A8}
${k.default}${$.default}
\u{9876}\u{90E8}
${M.default}${S.default}
\u{5E95}\u{90E8}
${A.default}${F.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${A.default}${F.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}
${c.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${$.default}
\u{9876}\u{90E8}
${S.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(t=>`
`).join("")}
\u{53D1}\u{9001}
`}get OPACITY(){return{min:0,max:100,steps:[],...this.option.OPACITY}}get FONT_SIZE(){return{min:12,max:120,steps:[],...this.option.FONT_SIZE}}get MARGIN(){return{min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}],...this.option.MARGIN}}get SPEED(){return{min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}],...this.option.SPEED}}get COLOR(){return this.option.COLOR.length?this.option.COLOR:["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(t){let{query:e}=this.utils,{$danmuku:i}=this.template;return e(t,i)}append(t,e){let{append:i}=this.utils;[...t.children].some(t=>t===e)||i(t,e)}setData(t,e){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[t]=e,this.outside&&(a.dataset[t]=e)}createTemplate(){let{createElement:t,tooltip:e}=this.utils,i=t("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");let{$toggle:a}=this.template;this.art.on("artplayerPluginDanmuku:show",()=>{e(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",()=>{e(a,"打开弹幕")})}createEvents(){let{$toggle:t,$configModes:e,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(t,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(e,"click",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(t=>t!==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",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",t=>{let e=t.target.closest(".apd-color");e&&(this.danmuku.config({color:e.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({...this.OPACITY,container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:t=>{let{$opacityValue:e}=this.template;e.textContent=`${t}%`,this.danmuku.config({opacity:t/100})}}),this.slider.margin=this.createSlider({...this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.steps.findIndex(t=>t.value[0]===this.option.margin[0]&&t.value[1]===this.option.margin[1]),onChange:t=>{let e=this.MARGIN.steps[t];if(!e)return;let{$marginValue:i}=this.template;i.textContent=e.name,this.danmuku.config({margin:e.value})}}),this.slider.fontSize=this.createSlider({...this.FONT_SIZE,container:this.template.$fontSizeSlider,findIndex:()=>this.danmuku.fontSize,onChange:t=>{let{$fontSizeValue:e}=this.template;e.textContent=`${t}px`,t!==this.danmuku.fontSize&&this.danmuku.config({fontSize:t})}}),this.slider.speed=this.createSlider({...this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.steps.findIndex(t=>t.value===this.option.speed),onChange:t=>{let e=this.SPEED.steps[t];if(!e)return;let{$speedValue:i}=this.template;i.textContent=e.name,this.danmuku.config({speed:e.value})}})}createSlider({min:t,max:e,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l,setStyle:r}=this.utils;r(i,"touch-action","none"),i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(t=>t.hide?"":`
${t.name}
`).join("")}
`;let d=s(".apd-slider-dot",i),p=s(".apd-slider-progress",i),u=!1;function h(i=a()){if(ie)return;let s=(i-t)/(e-t);d.style.left=`${100*s}%`,0===o.length&&(p.style.width=d.style.left),n(i)}function m(a){let{top:n,height:o,left:s,width:r}=i.getBoundingClientRect();this.art.isRotate?h(Math.round(l(a.clientY-n,0,o)/o*(e-t)+t)):h(Math.round(l(a.clientX-s,0,r)/r*(e-t)+t))}return this.art.proxy(i,"click",t=>{m.call(this,t)}),this.art.proxy(i,"pointerdown",t=>{u=0===t.button}),this.art.proxy(document,"pointermove",t=>{u&&m.call(this,t)}),this.art.proxy(document,"pointerup",t=>{u&&(u=!1,m.call(this,t))}),{reset:h}}onFullscreen(t){let{$danmuku:e,$controlsCenter:i,$mount:a}=this.template;this.outside?t?this.append(i,e):this.append(a,e):this.append(i,e)}onMouseEnter({$control:t,$panel:e}){let{$player:i}=this.art.template,a=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=i.getBoundingClientRect(),s=n.width/2-a.width/2,l=o.left-(a.left-s),r=a.right+s-o.right;l>0?e.style.left=`${-s+l}px`:r>0?e.style.left=`${-s-r}px`:e.style.left=`${-s}px`}async emit(){let{$input:t}=this.template,e=t.value.trim();if(!e.length||this.isLock||this.emitting)return;let i={text:e,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let e=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==e)return;i.border=!0,delete i.time,this.danmuku.emit(i),t.value="",this.lock()}catch(t){this.emitting=!1}}lock(){let{addClass:t}=this.utils,{$send:e}=this.template;this.isLock=!0;let i=this.option.lockTime;e.innerText=i,t(e,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(e.innerText=i-=1,a())},1e3)};a()}unlock(){let{removeClass:t}=this.utils,{$send:e}=this.template;clearTimeout(this.timer),this.isLock=!1,e.innerText="发送",t(e,"apd-lock")}resize(){if(this.outside||this.art.fullscreen||this.art.fullscreenWeb)return;let{$player:t,$controlsCenter:e}=this.art.template,{$danmuku:i}=this.template;this.art.widtht.dataset.color===this.option.color.toUpperCase());n&&t(n,"apd-active"),e(i,this.option.visible?"关闭弹幕":"打开弹幕"),this.resize()}mount(t){let{errorHandle:e}=this.utils,i="string"==typeof t?document.querySelector(t):t;e(i,`Can not find the mount point: ${t}`),this.append(i,this.template.$danmuku),this.template.$mount=i,this.reset()}},"undefined"!=typeof document){let t="artplayer-plugin-danmuku",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=s.default}},{"bundle-text:./style.less":"dHTK8","bundle-text:./img/on.svg":"5XkVj","bundle-text:./img/off.svg":"3WiJz","bundle-text:./img/config.svg":"DK7bp","bundle-text:./img/style.svg":"h2xX3","bundle-text:./img/mode_0_off.svg":"fp5qd","bundle-text:./img/mode_0_on.svg":"fYNQe","bundle-text:./img/mode_1_off.svg":"gQMgY","bundle-text:./img/mode_1_on.svg":"5E8Hg","bundle-text:./img/mode_2_off.svg":"89iSb","bundle-text:./img/mode_2_on.svg":"2YEb0","bundle-text:./img/check_on.svg":"iQql8","bundle-text:./img/check_off.svg":"4tC1X","@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],dHTK8:[function(t,e,i,a){e.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}'},{}],"5XkVj":[function(t,e,i,a){e.exports=''},{}],"3WiJz":[function(t,e,i,a){e.exports=''},{}],DK7bp:[function(t,e,i,a){e.exports=''},{}],h2xX3:[function(t,e,i,a){e.exports=''},{}],fp5qd:[function(t,e,i,a){e.exports=''},{}],fYNQe:[function(t,e,i,a){e.exports=''},{}],gQMgY:[function(t,e,i,a){e.exports=''},{}],"5E8Hg":[function(t,e,i,a){e.exports=''},{}],"89iSb":[function(t,e,i,a){e.exports=''},{}],"2YEb0":[function(t,e,i,a){e.exports=''},{}],iQql8:[function(t,e,i,a){e.exports=''},{}],"4tC1X":[function(t,e,i,a){e.exports=''},{}],h2ayY:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>l);let o={map:(t,e,i,a,n)=>(t-e)*(n-a)/(i-e)+a,range(t,e,i){let a=Math.round(t/i)*i;return Array.from({length:Math.floor((e-t)/i)},(t,e)=>e*i+a)}},s=(t,e)=>{let i=e[0]-t[0],a=e[1]-t[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function l(t,e,i){let{query:a}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(n){let l=null,r=null;function d(p=[]){if(l=null,r=null,n.innerHTML="",!t.duration||t.option.isLive)return;let u={w:n.offsetWidth,h:n.offsetHeight},h={xMin:0,xMax:u.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*u.h),sampling:Math.floor(u.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(h,i);let m=[];if(Array.isArray(p)&&p.length)m=[...p];else{let i=t.duration/u.w;for(let t=0;t<=u.w;t+=h.sampling){let a=e.queue.filter(({time:e})=>e>t*i&&e<=(t+h.sampling)*i).length;m.push([t,a])}}if(0===m.length)return;let c=m[m.length-1],f=c[0],g=c[1];f!==u.w&&m.push([u.w,g]);let y=m.map(t=>t[1]),v=(Math.min(...y)+Math.max(...y))/2;for(let t=0;tv?1+h.scale:1-h.scale)+h.minHeight}let x=(t,e,i,a)=>{let n=s(e||t,i||t),l=o.map(Math.cos(n.angle)*h.flattening,0,1,1,0),r=n.angle*l+(a?Math.PI:0),d=n.length*h.smoothing;return[t[0]+Math.cos(r)*d,t[1]+Math.sin(r)*d]},k=(t,e,i)=>{let a=x(i[e-1],i[e-2],t),n=x(t,i[e-1],i[e+1],!0),o=e===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${t[0]},${t[1]}${o}`},b=m.map(t=>[o.map(t[0],h.xMin,h.xMax,0,u.w),o.map(t[1],h.yMin,h.yMax,u.h,0)]).reduce((t,e,i,a)=>0===i?`M ${a[a.length-1][0]},${u.h} L ${e[0]},${u.h} L ${e[0]},${e[1]}`:`${t} ${k(e,i,a)}`,"");n.innerHTML=``,l=a("#heatmap-start",n),r=a("#heatmap-stop",n),l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{l&&r&&"played"===t&&(l.setAttribute("offset",`${100*e}%`),r.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>d()),t.on("resize",()=>d()),t.on("artplayerPluginDanmuku:loaded",()=>d()),t.on("artplayerPluginDanmuku:points",t=>d(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}]},["6ZbtA"],"6ZbtA","parcelRequire4dc0",{});let{default:t}=parcelRequire4dc0("6ZbtA");export{t as default}; +!function(t,e,i,a,n,o,s,l){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof r[a]&&r[a],p=d.i||{},u=d.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof r[a]&&r[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var l=u[e]=new m.Module(e);t[e][0].call(l.exports,p,l,l.exports,r)}return u[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return r[a]}}),r[a]=m;for(var c=0;cu);var o=t("./danmuku"),s=n.interopDefault(o),l=t("./setting"),r=n.interopDefault(l),d=t("./heatmap"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,r.default)(e,i);return i.option.heatmap&&(0,p.default)(e,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}}}}u.icons=r.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"3UaSK","./setting":"jUZBE","./heatmap":"kCWvn","@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],"3UaSK":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("./bilibili"),s=t("bundle-text:./worker"),l=n.interopDefault(s);class r{constructor(t,e){let{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0);let n=new Blob([l.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),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,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}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|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}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:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[1]}get fontSize(){let{clamp:t}=this.utils,{clientHeight:e}=this.$player,i=this.option.fontSize;return"number"==typeof i?Math.round(t(i,12,e)):"string"==typeof i&&i.endsWith("%")?Math.round(t(e*(parseFloat(i)/100),12,e)):r.option.fontSize}get $ref(){let t=this.$refs.pop()||document.createElement("div");return t.style.cssText=r.cssText,t.dataset.mode="",t.className="",t}get readys(){let{currentTime:t}=this.art,e=[];return this.filter("ready",t=>e.push(t)),this.filter("wait",i=>{t+.1>=i.time&&i.time>=t-.1&&e.push(i)}),e}get visibles(){let t=[],{clientWidth:e}=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=e-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,t.push(p)}),t}get speed(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}async load(t){let{errorHandle:e}=this.utils,i=[],a=t||this.option.danmuku;try{"function"==typeof a?i=await a():a instanceof Promise?i=await a:"string"==typeof a?i=await (0,o.bilibiliDanmuParseFromUrl)(a):Array.isArray(a)&&(i=a),e(Array.isArray(i),"Danmuku need return an array as result"),void 0===t&&(this.reset(),this.queue=[],this.states={wait:[],ready:[],emit:[],stop:[]},this.$refs=[],this.$danmuku.innerText="");for(let t=0;tJSON.stringify(this.option[e])!==JSON.stringify(t[e]))||e)&&(this.option=Object.assign({},r.option,this.option,t),this.validator(this.option,r.scheme),this.option.mode=i(this.option.mode,0,2),this.option.speed=i(this.option.speed,1,10),this.option.opacity=i(this.option.opacity,0,1),this.option.lockTime=i(this.option.lockTime,1,60),this.option.maxLength=i(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||a,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}postMessage(t={}){return new Promise(e=>{t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:a}=i;a.id===t.id&&e(a)}})}filter(t,e){let i=this.states[t]||[];for(let t=0;te!==t),t.$state=e,t.$ref&&(t.$ref.dataset.state=e),this.states[e].push(t)}makeWait(t){this.setState(t,"wait"),t.$ref&&(t.$ref.style.cssText=r.cssText,t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}update(){let{setStyles:t}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let e=this.readys;for(let i=0;i{0===e.mode&&(e.$ref.style.left=`${t}px`)}),this.filter("emit",e=>{if(e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.left=`${t}px`,e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}})}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(this.setState(e,"emit"),e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(this.setState(e,"stop"),0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$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(t=>this.makeWait(t)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.$danmuku.style.opacity=1,this.option.visible=!0,this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.$danmuku.style.opacity=0,this.option.visible=!1,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=r},{"./bilibili":"lLE5f","bundle-text:./worker":"2to4T","@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],lLE5f:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function o(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function s(t){if("string"!=typeof t)return[];let e=new RegExp(/(?.+?)<\/d>/gs);return Array.from(t.matchAll(e)).map(t=>{let e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:o(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null}).filter(Boolean)}function l({data:t}){let{xml:e,id:i}=t;if(!i||!e)return;let a=s(e);self.postMessage({danmus:a,id:i})}function r(t){return new Promise(async e=>{let i=await fetch(t),a=await i.text();try{let t=function(){let t=new Blob([` ${o.toString()} ${s.toString()} onmessage = ${l.toString()} `],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}();t.onmessage=i=>{let{danmus:a,id:n}=i.data;n&&a&&(e(a),t.terminate())},t.postMessage({xml:a,id:Date.now()})}catch(t){e(s(a))}})}n.defineInteropFlag(i),n.export(i,"bilibiliDanmuParseFromUrl",()=>r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],w4pLy:[function(t,e,i,a){i.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},i.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.exportAll=function(t,e){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e},i.export=function(t,e,i){Object.defineProperty(t,e,{enumerable:!0,get:i})}},{}],"2to4T":[function(t,e,i,a){e.exports='!function(e,t,i,r,o,n,d,f){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof l[r]&&l[r],h=u.i||{},p=u.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!p[t]){if(!e[t]){if(o[t])return o[t];var n="function"==typeof l[r]&&l[r];if(!i&&n)return n(t,!0);if(u)return u(t,!0);if(s&&"string"==typeof t)return s(t);var d=Error("Cannot find module \'"+t+"\'");throw d.code="MODULE_NOT_FOUND",d}h.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},h.cache={};var f=p[t]=new a.Module(t);e[t][0].call(f.exports,h,f,f.exports,l)}return p[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=s,this.exports={}},a.modules=e,a.cache=p,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=h,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return l[r]}}),l[r]=a;for(var c=0;ct.mode===e.mode&&t.top<=f).sort((e,t)=>e.top-t.top);if(0===l.length)if(2===e.mode)return f-e.height;else return n;if(l.unshift({type:"top",top:0,left:0,right:0,height:n,width:i,speed:0,distance:i}),l.push({type:"bottom",top:f,left:0,right:0,height:o,width:i,speed:0,distance:i}),2===e.mode)for(let t=l.length-2;t>=0;t-=1){let i=l[t],r=l[t+1],o=i.top+i.height;if(r.top-o>=e.height)return r.top-e.height}else for(let t=1;t=e.height)return o}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),r=Math.min(...e.map(e=>e.right));return i*t.length-r*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},["dETh6"],"dETh6","parcelRequire93cf",{});let{"*":e}=parcelRequire93cf("dETh6");export{e as default};'},{}],jUZBE:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./style.less"),s=n.interopDefault(o),l=t("bundle-text:./img/on.svg"),r=n.interopDefault(l),d=t("bundle-text:./img/off.svg"),p=n.interopDefault(d),u=t("bundle-text:./img/config.svg"),h=n.interopDefault(u),m=t("bundle-text:./img/style.svg"),c=n.interopDefault(m),f=t("bundle-text:./img/mode_0_off.svg"),g=n.interopDefault(f),y=t("bundle-text:./img/mode_0_on.svg"),v=n.interopDefault(y),x=t("bundle-text:./img/mode_1_off.svg"),k=n.interopDefault(x),$=t("bundle-text:./img/mode_1_on.svg"),b=n.interopDefault($),w=t("bundle-text:./img/mode_2_off.svg"),E=n.interopDefault(w),M=t("bundle-text:./img/mode_2_on.svg"),D=n.interopDefault(M),S=t("bundle-text:./img/check_on.svg"),F=n.interopDefault(S),T=t("bundle-text:./img/check_off.svg"),A=n.interopDefault(T);if(i.default=class{constructor(t,e){this.art=t,this.danmuku=e,this.utils=t.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=t.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$config:null,$configPanel:null,$configModes:null,$style:null,$stylePanel: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),t.on("resize",()=>this.resize()),t.on("fullscreen",t=>this.onFullscreen(t)),t.on("fullscreenWeb",t=>this.onFullscreen(t)),t.proxy(this.template.$config,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$config,$panel:this.template.$configPanel})}),t.proxy(this.template.$style,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$style,$panel:this.template.$stylePanel})})}static get icons(){return{$on:r.default,$off:p.default,$config:h.default,$style:c.default,$mode_0_off:g.default,$mode_0_on:v.default,$mode_1_off:k.default,$mode_1_on:b.default,$mode_2_off:E.default,$mode_2_on:D.default,$check_on:F.default,$check_off:A.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:t}=this;return`
${r.default}${p.default}
${h.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${g.default}${v.default}
\u{6EDA}\u{52A8}
${k.default}${b.default}
\u{9876}\u{90E8}
${E.default}${D.default}
\u{5E95}\u{90E8}
${F.default}${A.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${F.default}${A.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}
${c.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${b.default}
\u{9876}\u{90E8}
${D.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(t=>`
`).join("")}
\u{53D1}\u{9001}
`}get OPACITY(){return{min:0,max:100,steps:[],...this.option.OPACITY}}get FONT_SIZE(){return{min:12,max:120,steps:[],...this.option.FONT_SIZE}}get MARGIN(){return{min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}],...this.option.MARGIN}}get SPEED(){return{min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}],...this.option.SPEED}}get COLOR(){return this.option.COLOR.length?this.option.COLOR:["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(t){let{query:e}=this.utils,{$danmuku:i}=this.template;return e(t,i)}append(t,e){let{append:i}=this.utils;[...t.children].some(t=>t===e)||i(t,e)}setData(t,e){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[t]=e,this.outside&&(a.dataset[t]=e)}createTemplate(){let{createElement:t,tooltip:e}=this.utils,i=t("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");let{$toggle:a}=this.template;this.art.on("artplayerPluginDanmuku:show",()=>{e(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",()=>{e(a,"打开弹幕")})}createEvents(){let{$toggle:t,$configModes:e,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(t,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(e,"click",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(t=>t!==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",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",t=>{let e=t.target.closest(".apd-color");e&&(this.danmuku.config({color:e.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({...this.OPACITY,container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:t=>{let{$opacityValue:e}=this.template;e.textContent=`${t}%`,this.danmuku.config({opacity:t/100})}}),this.slider.margin=this.createSlider({...this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.steps.findIndex(t=>t.value[0]===this.option.margin[0]&&t.value[1]===this.option.margin[1]),onChange:t=>{let e=this.MARGIN.steps[t];if(!e)return;let{$marginValue:i}=this.template;i.textContent=e.name,this.danmuku.config({margin:e.value})}}),this.slider.fontSize=this.createSlider({...this.FONT_SIZE,container:this.template.$fontSizeSlider,findIndex:()=>this.danmuku.fontSize,onChange:t=>{let{$fontSizeValue:e}=this.template;e.textContent=`${t}px`,t!==this.danmuku.fontSize&&this.danmuku.config({fontSize:t})}}),this.slider.speed=this.createSlider({...this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.steps.findIndex(t=>t.value===this.option.speed),onChange:t=>{let e=this.SPEED.steps[t];if(!e)return;let{$speedValue:i}=this.template;i.textContent=e.name,this.danmuku.config({speed:e.value})}})}createSlider({min:t,max:e,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l,setStyle:r}=this.utils;r(i,"touch-action","none"),i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(t=>t.hide?"":`
${t.name}
`).join("")}
`;let d=s(".apd-slider-dot",i),p=s(".apd-slider-progress",i),u=!1;function h(i=a()){if(ie)return;let s=(i-t)/(e-t);d.style.left=`${100*s}%`,0===o.length&&(p.style.width=d.style.left),n(i)}function m(a){let{top:n,height:o,left:s,width:r}=i.getBoundingClientRect();this.art.isRotate?h(Math.round(l(a.clientY-n,0,o)/o*(e-t)+t)):h(Math.round(l(a.clientX-s,0,r)/r*(e-t)+t))}return this.art.proxy(i,"click",t=>{m.call(this,t)}),this.art.proxy(i,"pointerdown",t=>{u=0===t.button}),this.art.proxy(document,"pointermove",t=>{u&&m.call(this,t)}),this.art.proxy(document,"pointerup",t=>{u&&(u=!1,m.call(this,t))}),{reset:h}}onFullscreen(t){let{$danmuku:e,$controlsCenter:i,$mount:a}=this.template;this.outside?t?this.append(i,e):this.append(a,e):this.append(i,e)}onMouseEnter({$control:t,$panel:e}){let{$player:i}=this.art.template,a=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=i.getBoundingClientRect(),s=n.width/2-a.width/2,l=o.left-(a.left-s),r=a.right+s-o.right;l>0?e.style.left=`${-s+l}px`:r>0?e.style.left=`${-s-r}px`:e.style.left=`${-s}px`}async emit(){let{$input:t}=this.template,e=t.value.trim();if(!e.length||this.isLock||this.emitting)return;let i={text:e,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let e=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==e)return;i.border=!0,delete i.time,this.danmuku.emit(i),t.value="",this.lock()}catch(t){this.emitting=!1}}lock(){let{addClass:t}=this.utils,{$send:e}=this.template;this.isLock=!0;let i=this.option.lockTime;e.innerText=i,t(e,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(e.innerText=i-=1,a())},1e3)};a()}unlock(){let{removeClass:t}=this.utils,{$send:e}=this.template;clearTimeout(this.timer),this.isLock=!1,e.innerText="发送",t(e,"apd-lock")}resize(){if(this.outside||this.art.fullscreen||this.art.fullscreenWeb)return;let{$player:t,$controlsCenter:e}=this.art.template,{$danmuku:i}=this.template;this.art.widtht.dataset.color===this.option.color.toUpperCase());n&&t(n,"apd-active"),e(i,this.option.visible?"关闭弹幕":"打开弹幕"),this.resize()}mount(t){let{errorHandle:e}=this.utils,i="string"==typeof t?document.querySelector(t):t;e(i,`Can not find the mount point: ${t}`),this.append(i,this.template.$danmuku),this.template.$mount=i,this.reset()}},"undefined"!=typeof document){let t="artplayer-plugin-danmuku",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=s.default}},{"bundle-text:./style.less":"lDhE1","bundle-text:./img/on.svg":"eIVgK","bundle-text:./img/off.svg":"ikaFC","bundle-text:./img/config.svg":"4rX4v","bundle-text:./img/style.svg":"7QZb5","bundle-text:./img/mode_0_off.svg":"emfRo","bundle-text:./img/mode_0_on.svg":"hgDUE","bundle-text:./img/mode_1_off.svg":"c2dTL","bundle-text:./img/mode_1_on.svg":"gDNkp","bundle-text:./img/mode_2_off.svg":"04dKo","bundle-text:./img/mode_2_on.svg":"dT4Rc","bundle-text:./img/check_on.svg":"l7wFs","bundle-text:./img/check_off.svg":"2rFnr","@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],lDhE1:[function(t,e,i,a){e.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}'},{}],eIVgK:[function(t,e,i,a){e.exports=''},{}],ikaFC:[function(t,e,i,a){e.exports=''},{}],"4rX4v":[function(t,e,i,a){e.exports=''},{}],"7QZb5":[function(t,e,i,a){e.exports=''},{}],emfRo:[function(t,e,i,a){e.exports=''},{}],hgDUE:[function(t,e,i,a){e.exports=''},{}],c2dTL:[function(t,e,i,a){e.exports=''},{}],gDNkp:[function(t,e,i,a){e.exports=''},{}],"04dKo":[function(t,e,i,a){e.exports=''},{}],dT4Rc:[function(t,e,i,a){e.exports=''},{}],l7wFs:[function(t,e,i,a){e.exports=''},{}],"2rFnr":[function(t,e,i,a){e.exports=''},{}],kCWvn:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>l);let o={map:(t,e,i,a,n)=>(t-e)*(n-a)/(i-e)+a,range(t,e,i){let a=Math.round(t/i)*i;return Array.from({length:Math.floor((e-t)/i)},(t,e)=>e*i+a)}},s=(t,e)=>{let i=e[0]-t[0],a=e[1]-t[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function l(t,e,i){let{query:a}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(n){let l=null,r=null;function d(p=[]){if(l=null,r=null,n.innerHTML="",!t.duration||t.option.isLive)return;let u={w:n.offsetWidth,h:n.offsetHeight},h={xMin:0,xMax:u.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*u.h),sampling:Math.floor(u.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(h,i);let m=[];if(Array.isArray(p)&&p.length)m=[...p];else{let i=t.duration/u.w;for(let t=0;t<=u.w;t+=h.sampling){let a=e.queue.filter(({time:e})=>e>t*i&&e<=(t+h.sampling)*i).length;m.push([t,a])}}if(0===m.length)return;let c=m[m.length-1],f=c[0],g=c[1];f!==u.w&&m.push([u.w,g]);let y=m.map(t=>t[1]),v=(Math.min(...y)+Math.max(...y))/2;for(let t=0;tv?1+h.scale:1-h.scale)+h.minHeight}let x=(t,e,i,a)=>{let n=s(e||t,i||t),l=o.map(Math.cos(n.angle)*h.flattening,0,1,1,0),r=n.angle*l+(a?Math.PI:0),d=n.length*h.smoothing;return[t[0]+Math.cos(r)*d,t[1]+Math.sin(r)*d]},k=(t,e,i)=>{let a=x(i[e-1],i[e-2],t),n=x(t,i[e-1],i[e+1],!0),o=e===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${t[0]},${t[1]}${o}`},$=m.map(t=>[o.map(t[0],h.xMin,h.xMax,0,u.w),o.map(t[1],h.yMin,h.yMax,u.h,0)]).reduce((t,e,i,a)=>0===i?`M ${a[a.length-1][0]},${u.h} L ${e[0]},${u.h} L ${e[0]},${e[1]}`:`${t} ${k(e,i,a)}`,"");n.innerHTML=``,l=a("#heatmap-start",n),r=a("#heatmap-stop",n),l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{l&&r&&"played"===t&&(l.setAttribute("offset",`${100*e}%`),r.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>d()),t.on("resize",()=>d()),t.on("artplayerPluginDanmuku:loaded",()=>d()),t.on("artplayerPluginDanmuku:points",t=>d(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}]},["4omrA"],"4omrA","parcelRequire93cf",{});let{default:t}=parcelRequire93cf("4omrA");export{t as default}; //# sourceMappingURL=artplayer-plugin-danmuku.esm.js.map \ No newline at end of file diff --git a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js.map b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js.map index fc051d379..3520a25b0 100644 --- a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js.map +++ b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.esm.js.map @@ -1 +1 @@ -{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,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C,CAAC,EAAE,EAAI,CAAC,CAAC;A;A;AAG2C,kGAAA,EAAE,EAAQ,OAAO,CAAC;AAClB,kGAAA,EAAE,EAAQ,OAAO,CAAC;A;A;A;A;AAKvD,6DAAA,EAAE,EAAM;A;AAErD,gBAAA,CAAC,CAED,EAAS,EAAM,iBAAkB,GACjC,EAAQ,EAAM,gBAAiB,GAC/B,EAAO,YAAY,CAAC,SAAU,CAAA,EAAG,AAAa,IAAb,EAAI,MAAM,CAAO,CAAC,CAAC,EACpD,EAAM,YAAY,CAAC,SAAU,CAAA,EAAG,AAAa,IAAb,EAAI,MAAM,CAAO,CAAC,CAAC,CACvD,CAEA,EAAI,EAAE,CAAC,mBAAoB,KACnB,GAAU,IACV,EAAO,YAAY,CAAC,SAAU,CAAA,EAAG,AAAa,IAAb,EAAI,MAAM,CAAO,CAAC,CAAC,EACpD,EAAM,YAAY,CAAC,SAAU,CAAA,EAAG,AAAa,IAAb,EAAI,MAAM,CAAO,CAAC,CAAC,EAE3D,GAEA,EAAI,EAAE,CAAC,SAAU,CAAC,EAAM,KAChB,GAAU,GAAS,AAAS,WAAT,IACnB,EAAO,YAAY,CAAC,SAAU,CAAA,EAAG,AAAa,IAAb,EAAiB,CAAC,CAAC,EACpD,EAAM,YAAY,CAAC,SAAU,CAAA,EAAG,AAAa,IAAb,EAAiB,CAAC,CAAC,EAE3D,GAEA,EAAI,EAAE,CAAC,QAAS,IAAM,KACtB,EAAI,EAAE,CAAC,SAAU,IAAM,KACvB,EAAI,EAAE,CAAC,gCAAiC,IAAM,KAC9C,EAAI,EAAE,CAAC,gCAAiC,AAAC,GAAW,EAAO,GAC/D,CACJ,EACJ,C,E,C,iD,O,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["","packages/artplayer-plugin-danmuku/src/index.js","packages/artplayer-plugin-danmuku/src/danmuku.js","packages/artplayer-plugin-danmuku/src/bilibili.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-d75e4ef33e90ad74.js","packages/artplayer-plugin-danmuku/src/setting.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-d4507e9bfc00ded0.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-3f382cbac81656d4.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-2eccf06bbefc75d0.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-966493d38fa25693.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-17da0f3cb542825d.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-e438774eb5592ca2.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-f628b445d36caf1f.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-df73f5e9e2ab004b.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-1de8ba84e2efbede.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-9ccdc626e87ba3ee.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-9a7360dad8cdbe5b.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-75df9b67e4ad9f34.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-b1f4705e590c7693.js","packages/artplayer-plugin-danmuku/src/heatmap.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (\n modules,\n entry,\n mainEntry,\n parcelRequireName,\n externals,\n distDir,\n publicUrl,\n devServer\n) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var importMap = previousRequire.i || {};\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof module.require === 'function' &&\n module.require.bind(module);\n\n function newRequire(name, jumped) {\n if (!cache[name]) {\n if (!modules[name]) {\n if (externals[name]) {\n return externals[name];\n }\n // if we cannot find the module within our internal map or\n // cache jump to the current global require ie. the last bundle\n // that was added to the page.\n var currentRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n if (!jumped && currentRequire) {\n return currentRequire(name, true);\n }\n\n // If there are other bundles on this page the require from the\n // previous one is saved to 'previousRequire'. Repeat this as\n // many times as there are bundles until the module is found or\n // we exhaust the require chain.\n if (previousRequire) {\n return previousRequire(name, true);\n }\n\n // Try the node require function if it exists.\n if (nodeRequire && typeof name === 'string') {\n return nodeRequire(name);\n }\n\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n }\n\n localRequire.resolve = resolve;\n localRequire.cache = {};\n\n var module = (cache[name] = new newRequire.Module(name));\n\n modules[name][0].call(\n module.exports,\n localRequire,\n module,\n module.exports,\n globalObject\n );\n }\n\n return cache[name].exports;\n\n function localRequire(x) {\n var res = localRequire.resolve(x);\n return res === false ? {} : newRequire(res);\n }\n\n function resolve(x) {\n var id = modules[name][1][x];\n return id != null ? id : x;\n }\n }\n\n function Module(moduleName) {\n this.id = moduleName;\n this.bundle = newRequire;\n this.require = nodeRequire;\n this.exports = {};\n }\n\n newRequire.isParcelRequire = true;\n newRequire.Module = Module;\n newRequire.modules = modules;\n newRequire.cache = cache;\n newRequire.parent = previousRequire;\n newRequire.distDir = distDir;\n newRequire.publicUrl = publicUrl;\n newRequire.devServer = devServer;\n newRequire.i = importMap;\n newRequire.register = function (id, exports) {\n modules[id] = [\n function (require, module) {\n module.exports = exports;\n },\n {},\n ];\n };\n\n // Only insert newRequire.load when it is actually used.\n // The code in this file is linted against ES5, so dynamic import is not allowed.\n // INSERT_LOAD_HERE\n\n Object.defineProperty(newRequire, 'root', {\n get: function () {\n return globalObject[parcelRequireName];\n },\n });\n\n globalObject[parcelRequireName] = newRequire;\n\n for (var i = 0; i < entry.length; i++) {\n newRequire(entry[i]);\n }\n\n if (mainEntry) {\n // Expose entry point to Node, AMD or browser globals\n // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js\n var mainExports = newRequire(mainEntry);\n\n // CommonJS\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n module.exports = mainExports;\n\n // RequireJS\n } else if (typeof define === 'function' && define.amd) {\n define(function () {\n return mainExports;\n });\n }\n }\n})({\"6ZbtA\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>artplayerPluginDanmuku);\nvar _danmuku = require(\"./danmuku\");\nvar _danmukuDefault = parcelHelpers.interopDefault(_danmuku);\nvar _setting = require(\"./setting\");\nvar _settingDefault = parcelHelpers.interopDefault(_setting);\nvar _heatmap = require(\"./heatmap\");\nvar _heatmapDefault = parcelHelpers.interopDefault(_heatmap);\nfunction artplayerPluginDanmuku(option) {\n return (art)=>{\n const danmuku = new (0, _danmukuDefault.default)(art, option);\n const setting = new (0, _settingDefault.default)(art, danmuku);\n if (danmuku.option.heatmap) (0, _heatmapDefault.default)(art, danmuku, danmuku.option.heatmap);\n return {\n name: 'artplayerPluginDanmuku',\n emit: danmuku.emit.bind(danmuku),\n load: danmuku.load.bind(danmuku),\n config: danmuku.config.bind(danmuku),\n hide: danmuku.hide.bind(danmuku),\n show: danmuku.show.bind(danmuku),\n reset: danmuku.reset.bind(danmuku),\n mount: setting.mount.bind(setting),\n get option () {\n return danmuku.option;\n },\n get isHide () {\n return danmuku.isHide;\n },\n get isStop () {\n return danmuku.isStop;\n }\n };\n };\n}\nartplayerPluginDanmuku.icons = (0, _settingDefault.default).icons;\nif (typeof window !== 'undefined') window['artplayerPluginDanmuku'] = artplayerPluginDanmuku;\n\n},{\"./danmuku\":\"6C7g0\",\"./setting\":\"90QKZ\",\"./heatmap\":\"h2ayY\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"6C7g0\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nvar _bilibili = require(\"./bilibili\");\nvar _worker = require(\"bundle-text:./worker\");\nvar _workerDefault = parcelHelpers.interopDefault(_worker);\nclass Danmuku {\n constructor(art, option){\n const { constructor, template } = art;\n this.utils = constructor.utils; // 工具库\n this.validator = constructor.validator; // 配置校验器\n this.$danmuku = template.$danmuku; // 弹幕层容器\n this.$player = template.$player; // 播放器容器\n this.art = art;\n this.queue = []; // 实际弹幕队列\n this.$refs = []; // 弹幕DOM节点池\n this.isStop = false; // 是否停止\n this.isHide = false; // 是否隐藏\n this.timer = null; // 定时器\n this.index = 0; // 弹幕索引\n // 格式化后的配置项\n this.option = Danmuku.option;\n // 弹幕状态池\n this.states = {\n wait: [],\n ready: [],\n emit: [],\n stop: []\n };\n // 初始化配置\n this.config(option);\n // 创建 Web Worker, 用于计算弹幕的 top 值\n const workerText2 = (0, _workerDefault.default).replace('export{e as default};', '');\n const blob = new Blob([\n workerText2\n ], {\n type: 'application/javascript'\n });\n this.worker = new Worker(URL.createObjectURL(blob));\n // 绑定公用事件\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.reset = this.reset.bind(this);\n this.resize = this.resize.bind(this);\n this.destroy = this.destroy.bind(this);\n // 监听事件\n art.on('video:play', this.start);\n art.on('video:playing', this.start);\n art.on('video:pause', this.stop);\n art.on('video:waiting', this.stop);\n art.on('destroy', this.destroy);\n art.on('resize', this.resize);\n // 开始加载弹幕\n this.load();\n }\n // 默认配置\n static get option() {\n return {\n danmuku: [],\n speed: 5,\n margin: [\n 10,\n '25%'\n ],\n opacity: 1,\n color: '#FFFFFF',\n mode: 0,\n modes: [\n 0,\n 1,\n 2\n ],\n fontSize: 25,\n antiOverlap: true,\n synchronousPlayback: false,\n mount: undefined,\n heatmap: false,\n width: 512,\n points: [],\n filter: ()=>true,\n beforeEmit: ()=>true,\n beforeVisible: ()=>true,\n visible: true,\n emitter: true,\n maxLength: 200,\n lockTime: 5,\n theme: 'dark',\n OPACITY: {},\n FONT_SIZE: {},\n MARGIN: {},\n SPEED: {},\n COLOR: []\n };\n }\n // 配置校验\n static get scheme() {\n return {\n danmuku: 'array|function|string',\n speed: 'number',\n margin: 'array',\n opacity: 'number',\n color: 'string',\n mode: 'number',\n modes: 'array',\n fontSize: 'number|string',\n antiOverlap: 'boolean',\n synchronousPlayback: 'boolean',\n mount: '?htmldivelement|string',\n heatmap: 'object|boolean',\n width: 'number',\n points: 'array',\n filter: 'function',\n beforeEmit: 'function',\n beforeVisible: 'function',\n visible: 'boolean',\n emitter: 'boolean',\n maxLength: 'number',\n lockTime: 'number',\n theme: 'string',\n OPACITY: 'object',\n FONT_SIZE: 'object',\n MARGIN: 'object',\n SPEED: 'object',\n COLOR: 'array'\n };\n }\n // 初始弹幕样式\n static get cssText() {\n return `\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, \"Microsoft JhengHei\", Arial, Helvetica, sans-serif;\n 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;\n `;\n }\n // 是否在移动端使用了自动旋屏,会影响弹幕的left和top值\n get isRotate() {\n return this.art.plugins?.autoOrientation?.state;\n }\n // 计算上空白边距\n get marginTop() {\n const { clamp } = this.utils;\n const value = this.option.margin[0];\n const { clientHeight } = this.$player;\n if (typeof value === 'number') return clamp(value, 0, clientHeight);\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n return Danmuku.option.margin[0];\n }\n // 计算下空白边距\n get marginBottom() {\n const { clamp } = this.utils;\n const value = this.option.margin[1];\n const { clientHeight } = this.$player;\n if (typeof value === 'number') return clamp(value, 0, clientHeight);\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n return Danmuku.option.margin[1];\n }\n // 计算弹幕字体大小\n get fontSize() {\n const { clamp } = this.utils;\n const { clientHeight } = this.$player;\n const fontSize = this.option.fontSize;\n if (typeof fontSize === 'number') return Math.round(clamp(fontSize, 12, clientHeight));\n if (typeof fontSize === 'string' && fontSize.endsWith('%')) {\n const ratio = parseFloat(fontSize) / 100;\n return Math.round(clamp(clientHeight * ratio, 12, clientHeight));\n }\n return Danmuku.option.fontSize;\n }\n // 获取弹幕DOM节点\n get $ref() {\n const $ref = this.$refs.pop() || document.createElement('div');\n $ref.style.cssText = Danmuku.cssText;\n $ref.dataset.mode = '';\n $ref.className = '';\n return $ref;\n }\n // 获取准备好发送的弹幕\n get readys() {\n const { currentTime } = this.art;\n const result = [];\n // 有的是ready状态:之前因为弹幕太多而暂停发送的弹幕\n this.filter('ready', (danmu)=>result.push(danmu));\n // 有的是wait状态:符合时间范围的弹幕\n this.filter('wait', (danmu)=>{\n if (currentTime + 0.1 >= danmu.time && danmu.time >= currentTime - 0.1) result.push(danmu);\n });\n return result;\n }\n // 可见的弹幕的数据,用于计算下一个弹幕的top值\n get visibles() {\n const result = [];\n const { clientWidth } = this.$player;\n const clientLeft = this.getLeft(this.$player);\n this.filter('emit', (danmu)=>{\n const top = danmu.$ref.offsetTop;\n const left = this.getLeft(danmu.$ref) - clientLeft;\n const height = danmu.$ref.clientHeight;\n const width = danmu.$ref.clientWidth;\n const distance = left + width;\n const right = clientWidth - distance;\n const speed = distance / danmu.$restTime;\n const emit = {};\n emit.top = top;\n emit.left = left;\n emit.height = height;\n emit.width = width;\n emit.right = right;\n emit.speed = speed;\n emit.distance = distance;\n emit.time = danmu.$restTime;\n emit.mode = danmu.mode;\n result.push(emit);\n });\n return result;\n }\n // 计算弹幕速度\n get speed() {\n return this.option.synchronousPlayback && this.art.playbackRate ? this.option.speed / Number(this.art.playbackRate) : this.option.speed;\n }\n // 加载弹幕\n async load(danmuku) {\n const { errorHandle } = this.utils;\n let danmus = [];\n const target = danmuku || this.option.danmuku;\n try {\n if (typeof target === 'function') danmus = await target(); // 异步函数获取\n else if (target instanceof Promise) danmus = await target; // 从 Promise 对象获取\n else if (typeof target === 'string') danmus = await (0, _bilibili.bilibiliDanmuParseFromUrl)(target); // 从B站xml链接解析\n else if (Array.isArray(target)) danmus = target; // 直接传入数组\n errorHandle(Array.isArray(danmus), 'Danmuku need return an array as result');\n // 假如没有传入弹幕参数,则清空弹幕,否则追加弹幕\n if (danmuku === undefined) {\n this.reset(); // 重置弹幕\n this.queue = []; // 清空弹幕队列\n this.states = {\n wait: [],\n ready: [],\n emit: [],\n stop: []\n }; // 清空弹幕状态池\n this.$refs = []; // 清空弹幕DOM节点池\n this.$danmuku.innerText = ''; // 清空弹幕层\n }\n // 逐个验证原始弹幕并转换到弹幕队列\n for(let index = 0; index < danmus.length; index++){\n const danmu = danmus[index];\n await this.emit(danmu);\n }\n this.art.emit('artplayerPluginDanmuku:loaded', this.queue);\n } catch (error) {\n this.art.emit('artplayerPluginDanmuku:error', error);\n throw error;\n }\n return this;\n }\n // 把原始弹幕转换到弹幕队列\n async emit(danmu) {\n const { clamp } = this.utils;\n this.validator(danmu, {\n text: 'string',\n mode: '?number',\n color: '?string',\n time: '?number',\n border: '?boolean',\n style: '?object'\n });\n // 弹幕文本为空则直接忽略\n if (!danmu.text.trim()) return this;\n // 设置弹幕时间,如果没有则默认为当前时间加 0.5 秒\n if (danmu.time) danmu.time = clamp(danmu.time, 0, Infinity);\n else danmu.time = this.art.currentTime + 0.5;\n // 设置弹幕模式,如果没有则默认为全局配置\n if (danmu.mode === undefined) danmu.mode = this.option.mode;\n // 设置弹幕单独样式,如果没有则默认为空对象\n if (danmu.style === undefined) danmu.style = {};\n // 设置弹幕颜色,如果没有则默认为全局配置\n if (danmu.color === undefined) danmu.color = this.option.color;\n // 弹幕模式只能是 0, 1, 2\n if (![\n 0,\n 1,\n 2\n ].includes(danmu.mode)) return this;\n // 自定义弹幕过滤函数\n if (!this.option.filter(danmu)) return this;\n // 添加自定义属性\n const item = {\n ...danmu,\n $state: 'wait',\n $id: this.index++,\n $ref: null,\n $restTime: 0,\n $lastStartTime: 0\n };\n // 转换为wait状态\n this.setState(item, 'wait');\n // 添加到实际弹幕队列\n this.queue.push(item);\n // 弹幕有四个状态:\n // - wait: 弹幕还未开始显示,没有被添加到 DOM 中\n // - ready: 弹幕准备好显示,没有被添加到 DOM 中\n // - emit: 弹幕正在显示,已经被添加到 DOM 中\n // - stop: 弹幕正在停止显示,已经被添加到 DOM 中\n return this;\n }\n // 动态配置\n config(option) {\n const { clamp } = this.utils;\n const { $controlsCenter } = this.art.template;\n // 判断配置项是否有变化\n const changed = Object.keys(option).some((key)=>JSON.stringify(this.option[key]) !== JSON.stringify(option[key]));\n // 没有变化则直接返回\n if (!changed) return this;\n // 更新配置项\n this.option = Object.assign({}, Danmuku.option, this.option, option);\n this.validator(this.option, Danmuku.scheme);\n this.option.mode = clamp(this.option.mode, 0, 2);\n this.option.speed = clamp(this.option.speed, 1, 10);\n this.option.opacity = clamp(this.option.opacity, 0, 1);\n this.option.lockTime = clamp(this.option.lockTime, 1, 60);\n this.option.maxLength = clamp(this.option.maxLength, 1, 1000);\n this.option.mount = this.option.mount || $controlsCenter;\n // 动态配置有字体大小,需要重新渲染\n if (option.fontSize) this.reset();\n // 通过配置项控制弹幕的显示和隐藏\n if (this.option.visible) this.show();\n else this.hide();\n this.art.emit('artplayerPluginDanmuku:config', this.option);\n return this;\n }\n // 计算DOM的left值,受到旋屏影响\n getLeft($ref) {\n const rect = $ref.getBoundingClientRect();\n return this.isRotate ? rect.top : rect.left;\n }\n // 复杂运算交给 Web Worker 处理\n postMessage(message = {}) {\n return new Promise((resolve)=>{\n message.id = Date.now(); // 生成唯一标识\n this.worker.postMessage(message);\n this.worker.onmessage = (event)=>{\n const { data } = event;\n // 判断是否是当前的消息\n if (data.id === message.id) resolve(data);\n };\n });\n }\n // 根据状态获取弹幕\n filter(state, callback) {\n const danmus = this.states[state] || [];\n for(let index = 0; index < danmus.length; index++)callback(danmus[index]);\n return danmus;\n }\n // 设置弹幕状态\n setState(danmu, state) {\n // 从原状态池中删除\n this.states[danmu.$state] = this.states[danmu.$state].filter((item)=>item !== danmu);\n // 设置新状态\n danmu.$state = state;\n // 设置DOM节点状态\n if (danmu.$ref) danmu.$ref.dataset.state = state;\n // 添加到新状态池中\n this.states[state].push(danmu);\n }\n // 重置弹幕到wait状态,回收弹幕DOM节点\n makeWait(danmu) {\n this.setState(danmu, 'wait');\n if (danmu.$ref) {\n danmu.$ref.style.cssText = Danmuku.cssText;\n danmu.$ref.style.visibility = 'hidden';\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = 'translateX(0px)';\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n // 实时更新弹幕\n update() {\n const { setStyles } = this.utils;\n this.timer = window.requestAnimationFrame(async ()=>{\n if (this.art.playing && !this.isHide) {\n // 实时计算弹幕的剩余显示时间\n this.filter('emit', (danmu)=>{\n const emitTime = (Date.now() - danmu.$lastStartTime) / 1000;\n danmu.$restTime -= emitTime;\n danmu.$lastStartTime = Date.now();\n // 超过时间即重置弹幕\n if (danmu.$restTime <= 0) this.makeWait(danmu);\n });\n // 获取准备好发送的弹幕,可能包含ready和wait状态的弹幕\n const readys = this.readys;\n for(let index = 0; index < readys.length; index++){\n const danmu = readys[index];\n // 弹幕发送前的过滤器\n const state = await this.option.beforeVisible(danmu);\n if (state) {\n const { clientWidth, clientHeight } = this.$player;\n danmu.$ref = this.$ref; // 获取弹幕DOM节点\n danmu.$ref.innerText = danmu.text; // 设置弹幕文本\n // 提前添加到弹幕层中,用于计算top值\n this.$danmuku.appendChild(danmu.$ref);\n // 设置初始弹幕样式\n danmu.$ref.style.opacity = this.option.opacity;\n danmu.$ref.style.fontSize = `${this.fontSize}px`;\n danmu.$ref.style.color = danmu.color;\n danmu.$ref.style.border = danmu.border ? `1px solid ${danmu.color}` : null;\n danmu.$ref.style.backgroundColor = danmu.border ? 'rgb(0 0 0 / 50%)' : null;\n // 设置单独弹幕样式\n setStyles(danmu.$ref, danmu.style);\n // 记录弹幕时间戳\n danmu.$lastStartTime = Date.now();\n // 计算弹幕剩余时间\n danmu.$restTime = this.speed;\n // 计算弹幕滚动的距离\n const distance = clientWidth + danmu.$ref.clientWidth;\n // 计算弹幕的top值\n const { result: top } = await this.postMessage({\n type: 'getDanmuTop',\n target: {\n mode: danmu.mode,\n height: danmu.$ref.clientHeight,\n speed: distance / danmu.$restTime\n },\n visibles: this.visibles,\n antiOverlap: this.option.antiOverlap,\n clientWidth: clientWidth,\n clientHeight: clientHeight,\n marginBottom: this.marginBottom,\n marginTop: this.marginTop\n });\n if (danmu.$ref) {\n if (!this.isStop && top !== undefined) {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$ref.style.top = `${top}px`;\n danmu.$ref.style.visibility = 'visible';\n danmu.$ref.dataset.mode = danmu.mode; // CSS控制模式的显示和隐藏\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n case 1:\n // falls through\n case 2:\n danmu.$ref.style.left = '50%';\n danmu.$ref.style.marginLeft = `-${danmu.$ref.clientWidth / 2}px`;\n break;\n default:\n break;\n }\n this.art.emit('artplayerPluginDanmuku:visible', danmu);\n } else {\n // 假如弹幕已经停止或者没有 top 值,则重置弹幕为ready状态,回收弹幕DOM节点,等待下次发送\n this.setState(danmu, 'ready');\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n }\n }\n }\n // 递归调用\n if (!this.isStop) this.update();\n });\n return this;\n }\n // 重置正在显示的弹幕: stop/emit 状态的弹幕\n resize() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu)=>{\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n break;\n default:\n break;\n }\n });\n this.filter('emit', (danmu)=>{\n danmu.$lastStartTime = Date.now();\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n }\n // 继续弹幕\n continue() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu)=>{\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$lastStartTime = Date.now();\n switch(danmu.mode){\n // 继续滚动的弹幕\n case 0:\n {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n return this;\n }\n // 暂停弹幕\n suspend() {\n const { clientWidth } = this.$player;\n this.filter('emit', (danmu)=>{\n this.setState(danmu, 'stop'); // 转换为stop状态\n switch(danmu.mode){\n // 停止滚动的弹幕\n case 0:\n {\n const translateX = clientWidth - (this.getLeft(danmu.$ref) - this.getLeft(this.$player));\n danmu.$ref.style.transform = `translateX(${-translateX}px)`;\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n break;\n }\n default:\n break;\n }\n });\n return this;\n }\n stop() {\n this.isStop = true;\n this.suspend();\n window.cancelAnimationFrame(this.timer);\n this.art.emit('artplayerPluginDanmuku:stop');\n return this;\n }\n start() {\n this.isStop = false;\n this.continue();\n this.update();\n this.art.emit('artplayerPluginDanmuku:start');\n return this;\n }\n reset() {\n this.queue.forEach((danmu)=>this.makeWait(danmu));\n this.art.emit('artplayerPluginDanmuku:reset');\n return this;\n }\n show() {\n this.isHide = false;\n this.$danmuku.style.opacity = 1;\n this.option.visible = true;\n this.art.emit('artplayerPluginDanmuku:show');\n return this;\n }\n hide() {\n this.isHide = true;\n this.$danmuku.style.opacity = 0;\n this.option.visible = false;\n this.art.emit('artplayerPluginDanmuku:hide');\n return this;\n }\n destroy() {\n this.stop();\n this.worker.terminate();\n this.art.off('video:play', this.start);\n this.art.off('video:playing', this.start);\n this.art.off('video:pause', this.stop);\n this.art.off('video:waiting', this.stop);\n this.art.off('resize', this.reset);\n this.art.off('destroy', this.destroy);\n this.art.emit('artplayerPluginDanmuku:destroy');\n }\n}\nexports.default = Danmuku;\n\n},{\"./bilibili\":\"8WBpY\",\"bundle-text:./worker\":\"8UAYg\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"8WBpY\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"bilibiliDanmuParseFromUrl\", ()=>bilibiliDanmuParseFromUrl);\nfunction getMode(key) {\n switch(key){\n case 1:\n case 2:\n case 3:\n return 0;\n case 4:\n return 2;\n case 5:\n return 1;\n default:\n return 0;\n }\n}\nfunction bilibiliDanmuParseFromXml(xmlString) {\n if (typeof xmlString !== 'string') return [];\n const reg = new RegExp(/.+?)\"(?: .*?)?>(?.+?)<\\/d>/gs);\n const matches = xmlString.matchAll(reg);\n return Array.from(matches).map((match)=>{\n const attr = match.groups.p.split(',');\n if (attr.length >= 8) {\n const text = match.groups.text.trim().replaceAll('"', '\"').replaceAll(''', \"'\").replaceAll('<', '<').replaceAll('>', '>').replaceAll('&', '&');\n return {\n text,\n time: Number(attr[0]),\n mode: getMode(Number(attr[1])),\n fontSize: Number(attr[2]),\n color: `#${Number(attr[3]).toString(16)}`,\n timestamp: Number(attr[4]),\n pool: Number(attr[5]),\n userID: attr[6],\n rowID: Number(attr[7])\n };\n } else return null;\n }).filter(Boolean);\n}\nfunction onmessage({ data }) {\n const { xml, id } = data;\n if (!id || !xml) return;\n const danmus = bilibiliDanmuParseFromXml(xml);\n self.postMessage({\n danmus,\n id\n });\n}\nfunction createWorker() {\n const workerText = `\n ${getMode.toString()}\n ${bilibiliDanmuParseFromXml.toString()}\n onmessage = ${onmessage.toString()}\n `;\n const blob = new Blob([\n workerText\n ], {\n type: 'application/javascript'\n });\n return new Worker(URL.createObjectURL(blob));\n}\nfunction bilibiliDanmuParseFromUrl(url) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve)=>{\n const res = await fetch(url);\n const xml = await res.text();\n try {\n const worker = createWorker();\n worker.onmessage = (event)=>{\n const { danmus, id } = event.data;\n if (!id || !danmus) return;\n resolve(danmus);\n worker.terminate();\n };\n worker.postMessage({\n xml,\n id: Date.now()\n });\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n const danmus = bilibiliDanmuParseFromXml(xml);\n resolve(danmus);\n }\n });\n}\n\n},{\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"5lQoW\":[function(require,module,exports,__globalThis) {\nexports.interopDefault = function(a) {\n return a && a.__esModule ? a : {\n default: a\n };\n};\nexports.defineInteropFlag = function(a) {\n Object.defineProperty(a, '__esModule', {\n value: true\n });\n};\nexports.exportAll = function(source, dest) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return;\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function() {\n return source[key];\n }\n });\n });\n return dest;\n};\nexports.export = function(dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get\n });\n};\n\n},{}],\"8UAYg\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"!function(e,t,i,r,o,n,l,d){var f=\\\"undefined\\\"!=typeof globalThis?globalThis:\\\"undefined\\\"!=typeof self?self:\\\"undefined\\\"!=typeof window?window:\\\"undefined\\\"!=typeof global?global:{},u=\\\"function\\\"==typeof f[r]&&f[r],p=u.i||{},s=u.cache||{},h=\\\"undefined\\\"!=typeof module&&\\\"function\\\"==typeof module.require&&module.require.bind(module);function a(t,i){if(!s[t]){if(!e[t]){if(o[t])return o[t];var n=\\\"function\\\"==typeof f[r]&&f[r];if(!i&&n)return n(t,!0);if(u)return u(t,!0);if(h&&\\\"string\\\"==typeof t)return h(t);var l=Error(\\\"Cannot find module '\\\"+t+\\\"'\\\");throw l.code=\\\"MODULE_NOT_FOUND\\\",l}p.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},p.cache={};var d=s[t]=new a.Module(t);e[t][0].call(d.exports,p,d,d.exports,f)}return s[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=h,this.exports={}},a.modules=e,a.cache=s,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=p,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,\\\"root\\\",{get:function(){return f[r]}}),f[r]=a;for(var c=0;ct.mode===e.mode&&t.top<=d).sort((e,t)=>e.top-t.top);if(0===f.length)if(2===e.mode)return d-e.height;else return n;if(f.unshift({type:\\\"top\\\",top:0,left:0,right:0,height:n,width:i,speed:0,distance:i}),f.push({type:\\\"bottom\\\",top:d,left:0,right:0,height:o,width:i,speed:0,distance:i}),2===e.mode)for(let t=f.length-2;t>=0;t-=1){let i=f[t],r=f[t+1],o=i.top+i.height;if(r.top-o>=e.height)return r.top-e.height}else for(let t=1;t=e.height)return o}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),r=Math.min(...e.map(e=>e.right));return i*t.length-r*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},[\\\"4KwZ6\\\"],\\\"4KwZ6\\\",\\\"parcelRequire4dc0\\\",{});let{\\\"*\\\":e}=parcelRequire4dc0(\\\"4KwZ6\\\");export{e as default};\";\n\n},{}],\"90QKZ\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nvar _styleLess = require(\"bundle-text:./style.less\");\nvar _styleLessDefault = parcelHelpers.interopDefault(_styleLess);\nvar _onSvg = require(\"bundle-text:./img/on.svg\");\nvar _onSvgDefault = parcelHelpers.interopDefault(_onSvg);\nvar _offSvg = require(\"bundle-text:./img/off.svg\");\nvar _offSvgDefault = parcelHelpers.interopDefault(_offSvg);\nvar _configSvg = require(\"bundle-text:./img/config.svg\");\nvar _configSvgDefault = parcelHelpers.interopDefault(_configSvg);\nvar _styleSvg = require(\"bundle-text:./img/style.svg\");\nvar _styleSvgDefault = parcelHelpers.interopDefault(_styleSvg);\nvar _mode0OffSvg = require(\"bundle-text:./img/mode_0_off.svg\");\nvar _mode0OffSvgDefault = parcelHelpers.interopDefault(_mode0OffSvg);\nvar _mode0OnSvg = require(\"bundle-text:./img/mode_0_on.svg\");\nvar _mode0OnSvgDefault = parcelHelpers.interopDefault(_mode0OnSvg);\nvar _mode1OffSvg = require(\"bundle-text:./img/mode_1_off.svg\");\nvar _mode1OffSvgDefault = parcelHelpers.interopDefault(_mode1OffSvg);\nvar _mode1OnSvg = require(\"bundle-text:./img/mode_1_on.svg\");\nvar _mode1OnSvgDefault = parcelHelpers.interopDefault(_mode1OnSvg);\nvar _mode2OffSvg = require(\"bundle-text:./img/mode_2_off.svg\");\nvar _mode2OffSvgDefault = parcelHelpers.interopDefault(_mode2OffSvg);\nvar _mode2OnSvg = require(\"bundle-text:./img/mode_2_on.svg\");\nvar _mode2OnSvgDefault = parcelHelpers.interopDefault(_mode2OnSvg);\nvar _checkOnSvg = require(\"bundle-text:./img/check_on.svg\");\nvar _checkOnSvgDefault = parcelHelpers.interopDefault(_checkOnSvg);\nvar _checkOffSvg = require(\"bundle-text:./img/check_off.svg\");\nvar _checkOffSvgDefault = parcelHelpers.interopDefault(_checkOffSvg);\nclass Setting {\n constructor(art, danmuku){\n this.art = art;\n this.danmuku = danmuku;\n this.utils = art.constructor.utils;\n const { setStyle } = this.utils;\n const { $controlsCenter } = art.template;\n setStyle($controlsCenter, 'display', 'flex');\n this.template = {\n $controlsCenter,\n $mount: $controlsCenter,\n $danmuku: null,\n $toggle: null,\n $config: null,\n $configPanel: null,\n $configModes: null,\n $style: null,\n $stylePanel: null,\n $styleModes: null,\n $colors: null,\n $opacitySlider: null,\n $opacityValue: null,\n $marginSlider: null,\n $marginValue: null,\n $fontSizeSlider: null,\n $fontSizeValue: null,\n $speedSlider: null,\n $speedValue: null,\n $input: null,\n $send: null\n };\n this.slider = {\n opacity: null,\n margin: null,\n fontSize: null,\n speed: null\n };\n this.emitting = false;\n this.isLock = false;\n this.timer = null;\n this.createTemplate();\n this.createSliders();\n this.createEvents();\n this.mount(this.option.mount);\n art.on('resize', ()=>this.resize());\n art.on('fullscreen', (state)=>this.onFullscreen(state));\n art.on('fullscreenWeb', (state)=>this.onFullscreen(state));\n art.proxy(this.template.$config, 'mouseenter', ()=>{\n this.onMouseEnter({\n $control: this.template.$config,\n $panel: this.template.$configPanel\n });\n });\n art.proxy(this.template.$style, 'mouseenter', ()=>{\n this.onMouseEnter({\n $control: this.template.$style,\n $panel: this.template.$stylePanel\n });\n });\n }\n static get icons() {\n return {\n $on: (0, _onSvgDefault.default),\n $off: (0, _offSvgDefault.default),\n $config: (0, _configSvgDefault.default),\n $style: (0, _styleSvgDefault.default),\n $mode_0_off: (0, _mode0OffSvgDefault.default),\n $mode_0_on: (0, _mode0OnSvgDefault.default),\n $mode_1_off: (0, _mode1OffSvgDefault.default),\n $mode_1_on: (0, _mode1OnSvgDefault.default),\n $mode_2_off: (0, _mode2OffSvgDefault.default),\n $mode_2_on: (0, _mode2OnSvgDefault.default),\n $check_on: (0, _checkOnSvgDefault.default),\n $check_off: (0, _checkOffSvgDefault.default)\n };\n }\n get option() {\n return this.danmuku.option;\n }\n get outside() {\n return this.template.$mount !== this.template.$controlsCenter;\n }\n get TEMPLATE() {\n const { option } = this;\n return `\n
\n ${0, _onSvgDefault.default}${0, _offSvgDefault.default}\n
\n
\n ${0, _configSvgDefault.default}\n
\n
\n
\n \\u{6309}\\u{7C7B}\\u{578B}\\u{5C4F}\\u{853D}\n
\n
\n ${0, _mode0OffSvgDefault.default}${0, _mode0OnSvgDefault.default}\n
\\u{6EDA}\\u{52A8}
\n
\n
\n ${0, _mode1OffSvgDefault.default}${0, _mode1OnSvgDefault.default}\n
\\u{9876}\\u{90E8}
\n
\n
\n ${0, _mode2OffSvgDefault.default}${0, _mode2OnSvgDefault.default}\n
\\u{5E95}\\u{90E8}
\n
\n
\n
\n
\n
\n ${0, _checkOnSvgDefault.default}${0, _checkOffSvgDefault.default}\n \\u{9632}\\u{6B62}\\u{5F39}\\u{5E55}\\u{91CD}\\u{53E0}\n
\n
\n ${0, _checkOnSvgDefault.default}${0, _checkOffSvgDefault.default}\n \\u{540C}\\u{6B65}\\u{89C6}\\u{9891}\\u{901F}\\u{5EA6}\n
\n
\n
\n \\u{4E0D}\\u{900F}\\u{660E}\\u{5EA6}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{663E}\\u{793A}\\u{533A}\\u{57DF}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{5F39}\\u{5E55}\\u{5B57}\\u{53F7}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{5F39}\\u{5E55}\\u{901F}\\u{5EA6}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n
\n
\n
\n
\n ${0, _styleSvgDefault.default}\n
\n
\n
\n \\u{6A21}\\u{5F0F}\n
\n
\n ${0, _mode0OnSvgDefault.default}\n
\\u{6EDA}\\u{52A8}
\n
\n
\n ${0, _mode1OnSvgDefault.default}\n
\\u{9876}\\u{90E8}
\n
\n
\n ${0, _mode2OnSvgDefault.default}\n
\\u{5E95}\\u{90E8}
\n
\n
\n
\n
\n \\u{989C}\\u{8272}\n
\n ${this.COLOR.map((color)=>`
`).join('')}\n
\n
\n
\n
\n
\n \n
\\u{53D1}\\u{9001}
\n
\n `;\n }\n get OPACITY() {\n return {\n min: 0,\n max: 100,\n steps: [],\n ...this.option.OPACITY\n };\n }\n get FONT_SIZE() {\n return {\n min: 12,\n max: 120,\n steps: [],\n ...this.option.FONT_SIZE\n };\n }\n get MARGIN() {\n return {\n min: 0,\n max: 3,\n steps: [\n {\n name: '1/4',\n value: [\n 10,\n '75%'\n ]\n },\n {\n name: \"\\u534A\\u5C4F\",\n value: [\n 10,\n '50%'\n ]\n },\n {\n name: '3/4',\n value: [\n 10,\n '25%'\n ]\n },\n {\n name: \"\\u6EE1\\u5C4F\",\n value: [\n 10,\n 10\n ]\n }\n ],\n ...this.option.MARGIN\n };\n }\n get SPEED() {\n return {\n min: 0,\n max: 4,\n steps: [\n {\n name: \"\\u6781\\u6162\",\n value: 10\n },\n {\n name: \"\\u8F83\\u6162\",\n value: 7.5,\n hide: true\n },\n {\n name: \"\\u9002\\u4E2D\",\n value: 5\n },\n {\n name: \"\\u8F83\\u5FEB\",\n value: 2.5,\n hide: true\n },\n {\n name: \"\\u6781\\u5FEB\",\n value: 1\n }\n ],\n ...this.option.SPEED\n };\n }\n get COLOR() {\n return this.option.COLOR.length ? this.option.COLOR : [\n '#FE0302',\n '#FF7204',\n '#FFAA02',\n '#FFD302',\n '#FFFF00',\n '#A0EE00',\n '#00CD00',\n '#019899',\n '#4266BE',\n '#89D5FF',\n '#CC0273',\n '#222222',\n '#9B9B9B',\n '#FFFFFF'\n ];\n }\n query(selector) {\n const { query } = this.utils;\n const { $danmuku } = this.template;\n return query(selector, $danmuku);\n }\n append(el, target) {\n const { append } = this.utils;\n const children = [\n ...el.children\n ];\n if (children.some((item)=>item === target)) return;\n append(el, target);\n }\n setData(key, value) {\n const { $player } = this.art.template;\n const { $mount } = this.template;\n $player.dataset[key] = value;\n if (this.outside) $mount.dataset[key] = value;\n }\n createTemplate() {\n const { createElement, tooltip } = this.utils;\n const $danmuku = createElement('div');\n $danmuku.className = 'artplayer-plugin-danmuku';\n $danmuku.innerHTML = this.TEMPLATE;\n this.template.$danmuku = $danmuku;\n this.template.$toggle = this.query('.apd-toggle');\n this.template.$config = this.query('.apd-config');\n this.template.$configPanel = this.query('.apd-config-panel');\n this.template.$configModes = this.query('.apd-config-mode .apd-modes');\n this.template.$style = this.query('.apd-style');\n this.template.$stylePanel = this.query('.apd-style-panel');\n this.template.$styleModes = this.query('.apd-style-mode .apd-modes');\n this.template.$colors = this.query('.apd-colors');\n this.template.$antiOverlap = this.query('.apd-anti-overlap');\n this.template.$syncVideo = this.query('.apd-sync-video');\n this.template.$opacitySlider = this.query('.apd-config-opacity .apd-slider');\n this.template.$opacityValue = this.query('.apd-config-opacity .apd-value');\n this.template.$marginSlider = this.query('.apd-config-margin .apd-slider');\n this.template.$marginValue = this.query('.apd-config-margin .apd-value');\n this.template.$fontSizeSlider = this.query('.apd-config-fontSize .apd-slider');\n this.template.$fontSizeValue = this.query('.apd-config-fontSize .apd-value');\n this.template.$speedSlider = this.query('.apd-config-speed .apd-slider');\n this.template.$speedValue = this.query('.apd-config-speed .apd-value');\n this.template.$input = this.query('.apd-input');\n this.template.$send = this.query('.apd-send');\n const { $toggle } = this.template;\n this.art.on('artplayerPluginDanmuku:show', ()=>{\n tooltip($toggle, \"\\u5173\\u95ED\\u5F39\\u5E55\");\n });\n this.art.on('artplayerPluginDanmuku:hide', ()=>{\n tooltip($toggle, \"\\u6253\\u5F00\\u5F39\\u5E55\");\n });\n }\n createEvents() {\n const { $toggle, $configModes, $styleModes, $colors, $antiOverlap, $syncVideo, $send, $input } = this.template;\n this.art.proxy($toggle, 'click', ()=>{\n this.danmuku.config({\n visible: !this.option.visible\n });\n this.reset();\n });\n this.art.proxy($configModes, 'click', (event)=>{\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n if (this.option.modes.includes(mode)) this.danmuku.config({\n modes: this.option.modes.filter((m)=>m !== mode)\n });\n else this.danmuku.config({\n modes: [\n ...this.option.modes,\n mode\n ]\n });\n this.reset();\n });\n this.art.proxy($antiOverlap, 'click', ()=>{\n this.danmuku.config({\n antiOverlap: !this.option.antiOverlap\n });\n this.reset();\n });\n this.art.proxy($syncVideo, 'click', ()=>{\n this.danmuku.config({\n synchronousPlayback: !this.option.synchronousPlayback\n });\n this.reset();\n });\n this.art.proxy($styleModes, 'click', (event)=>{\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n this.danmuku.config({\n mode: mode\n });\n this.reset();\n });\n this.art.proxy($colors, 'click', (event)=>{\n const $color = event.target.closest('.apd-color');\n if (!$color) return;\n this.danmuku.config({\n color: $color.dataset.color\n });\n this.reset();\n });\n this.art.proxy($send, 'click', ()=>this.emit());\n this.art.proxy($input, 'keypress', (event)=>{\n if (event.key === 'Enter') {\n event.preventDefault();\n this.emit();\n }\n });\n }\n createSliders() {\n this.slider.opacity = this.createSlider({\n ...this.OPACITY,\n container: this.template.$opacitySlider,\n findIndex: ()=>{\n return Math.round(this.option.opacity * 100);\n },\n onChange: (index)=>{\n const { $opacityValue } = this.template;\n $opacityValue.textContent = `${index}%`;\n this.danmuku.config({\n opacity: index / 100\n });\n }\n });\n this.slider.margin = this.createSlider({\n ...this.MARGIN,\n container: this.template.$marginSlider,\n findIndex: ()=>{\n return this.MARGIN.steps.findIndex((item)=>item.value[0] === this.option.margin[0] && item.value[1] === this.option.margin[1]);\n },\n onChange: (index)=>{\n const margin = this.MARGIN.steps[index];\n if (!margin) return;\n const { $marginValue } = this.template;\n $marginValue.textContent = margin.name;\n this.danmuku.config({\n margin: margin.value\n });\n }\n });\n this.slider.fontSize = this.createSlider({\n ...this.FONT_SIZE,\n container: this.template.$fontSizeSlider,\n findIndex: ()=>{\n return this.danmuku.fontSize;\n },\n onChange: (index)=>{\n const { $fontSizeValue } = this.template;\n $fontSizeValue.textContent = `${index}px`;\n if (index === this.danmuku.fontSize) return;\n this.danmuku.config({\n fontSize: index\n });\n }\n });\n this.slider.speed = this.createSlider({\n ...this.SPEED,\n container: this.template.$speedSlider,\n findIndex: ()=>{\n return this.SPEED.steps.findIndex((item)=>item.value === this.option.speed);\n },\n onChange: (index)=>{\n const speed = this.SPEED.steps[index];\n if (!speed) return;\n const { $speedValue } = this.template;\n $speedValue.textContent = speed.name;\n this.danmuku.config({\n speed: speed.value\n });\n }\n });\n }\n createSlider({ min, max, container, findIndex, onChange, steps = [] }) {\n const { query, clamp, setStyle } = this.utils;\n setStyle(container, 'touch-action', 'none');\n container.innerHTML = `\n
\n
\n ${steps.map(()=>`
`).join('')}\n
\n
\n
\n
\n
\n ${steps.map((step)=>step.hide ? '' : `
${step.name}
`).join('')}\n
\n `;\n const $dot = query('.apd-slider-dot', container);\n const $progress = query('.apd-slider-progress', container);\n let isDroging = false;\n function reset(index = findIndex()) {\n if (index < min || index > max) return;\n const percentage = (index - min) / (max - min);\n $dot.style.left = `${percentage * 100}%`;\n if (steps.length === 0) $progress.style.width = $dot.style.left;\n onChange(index);\n }\n function updateLeft(event) {\n const { top, height, left, width } = container.getBoundingClientRect();\n if (this.art.isRotate) {\n const value = clamp(event.clientY - top, 0, height);\n const index = Math.round(value / height * (max - min) + min);\n reset(index);\n } else {\n const value = clamp(event.clientX - left, 0, width);\n const index = Math.round(value / width * (max - min) + min);\n reset(index);\n }\n }\n this.art.proxy(container, 'click', (event)=>{\n updateLeft.call(this, event);\n });\n this.art.proxy(container, 'pointerdown', (event)=>{\n isDroging = event.button === 0;\n });\n this.art.proxy(document, 'pointermove', (event)=>{\n if (isDroging) updateLeft.call(this, event);\n });\n this.art.proxy(document, 'pointerup', (event)=>{\n if (isDroging) {\n isDroging = false;\n updateLeft.call(this, event);\n }\n });\n return {\n reset\n };\n }\n onFullscreen(state) {\n const { $danmuku, $controlsCenter, $mount } = this.template;\n if (this.outside) {\n if (state) this.append($controlsCenter, $danmuku);\n else this.append($mount, $danmuku);\n } else this.append($controlsCenter, $danmuku);\n }\n onMouseEnter({ $control, $panel }) {\n const { $player } = this.art.template;\n const controlRect = $control.getBoundingClientRect();\n const panelRect = $panel.getBoundingClientRect();\n const playerRect = $player.getBoundingClientRect();\n const half = panelRect.width / 2 - controlRect.width / 2;\n const left = playerRect.left - (controlRect.left - half);\n const right = controlRect.right + half - playerRect.right;\n if (left > 0) $panel.style.left = `${-half + left}px`;\n else if (right > 0) $panel.style.left = `${-half - right}px`;\n else $panel.style.left = `${-half}px`;\n }\n async emit() {\n const { $input } = this.template;\n const text = $input.value.trim();\n if (!text.length) return;\n if (this.isLock) return;\n if (this.emitting) return;\n const danmu = {\n text: text,\n mode: this.option.mode,\n color: this.option.color,\n time: this.art.currentTime\n };\n try {\n this.emitting = true;\n const state = await this.option.beforeEmit(danmu);\n this.emitting = false;\n if (state !== true) return;\n danmu.border = true;\n delete danmu.time;\n this.danmuku.emit(danmu);\n $input.value = '';\n this.lock();\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n this.emitting = false;\n }\n }\n lock() {\n const { addClass } = this.utils;\n const { $send } = this.template;\n this.isLock = true;\n let time = this.option.lockTime;\n $send.innerText = time;\n addClass($send, 'apd-lock');\n const loop = ()=>{\n this.timer = setTimeout(()=>{\n if (time === 0) this.unlock();\n else {\n time -= 1;\n $send.innerText = time;\n loop();\n }\n }, 1000);\n };\n loop();\n }\n unlock() {\n const { removeClass } = this.utils;\n const { $send } = this.template;\n clearTimeout(this.timer);\n this.isLock = false;\n $send.innerText = \"\\u53D1\\u9001\";\n removeClass($send, 'apd-lock');\n }\n resize() {\n if (this.outside) return;\n if (this.art.fullscreen) return;\n if (this.art.fullscreenWeb) return;\n const { $player, $controlsCenter } = this.art.template;\n const { $danmuku } = this.template;\n if (this.art.width < this.option.width) this.append($player, $danmuku);\n else this.append($controlsCenter, $danmuku);\n }\n reset() {\n const { inverseClass, tooltip } = this.utils;\n const { $toggle, $colors } = this.template;\n this.slider.opacity.reset();\n this.slider.margin.reset();\n this.slider.fontSize.reset();\n this.slider.speed.reset();\n this.setData('danmukuVisible', this.option.visible);\n this.setData('danmukuMode', this.option.mode);\n this.setData('danmukuColor', this.option.color);\n this.setData('danmukuMode0', this.option.modes.includes(0));\n this.setData('danmukuMode1', this.option.modes.includes(1));\n this.setData('danmukuMode2', this.option.modes.includes(2));\n this.setData('danmukuAntiOverlap', this.option.antiOverlap);\n this.setData('danmukuSyncVideo', this.option.synchronousPlayback);\n this.setData('danmukuTheme', this.option.theme);\n this.setData('danmukuEmitter', this.option.emitter);\n const colors = $colors.children;\n const $color = Array.from(colors).find((item)=>item.dataset.color === this.option.color.toUpperCase());\n $color && inverseClass($color, 'apd-active');\n tooltip($toggle, this.option.visible ? \"\\u5173\\u95ED\\u5F39\\u5E55\" : \"\\u6253\\u5F00\\u5F39\\u5E55\");\n this.resize();\n }\n mount(target) {\n const { errorHandle } = this.utils;\n const $el = typeof target === 'string' ? document.querySelector(target) : target;\n errorHandle($el, `Can not find the mount point: ${target}`);\n this.append($el, this.template.$danmuku);\n this.template.$mount = $el;\n this.reset();\n }\n}\nexports.default = Setting;\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-danmuku';\n let $style = document.getElementById(id);\n if (!$style) {\n $style = document.createElement('style');\n $style.id = id;\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', ()=>{\n document.head.appendChild($style);\n });\n else (document.head || document.documentElement).appendChild($style);\n }\n $style.textContent = (0, _styleLessDefault.default);\n}\n\n},{\"bundle-text:./style.less\":\"dHTK8\",\"bundle-text:./img/on.svg\":\"5XkVj\",\"bundle-text:./img/off.svg\":\"3WiJz\",\"bundle-text:./img/config.svg\":\"DK7bp\",\"bundle-text:./img/style.svg\":\"h2xX3\",\"bundle-text:./img/mode_0_off.svg\":\"fp5qd\",\"bundle-text:./img/mode_0_on.svg\":\"fYNQe\",\"bundle-text:./img/mode_1_off.svg\":\"gQMgY\",\"bundle-text:./img/mode_1_on.svg\":\"5E8Hg\",\"bundle-text:./img/mode_2_off.svg\":\"89iSb\",\"bundle-text:./img/mode_2_on.svg\":\"2YEb0\",\"bundle-text:./img/check_on.svg\":\"iQql8\",\"bundle-text:./img/check_off.svg\":\"4tC1X\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"dHTK8\":[function(require,module,exports,__globalThis) {\nmodule.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}\";\n\n},{}],\"5XkVj\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"3WiJz\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"DK7bp\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"h2xX3\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"fp5qd\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"fYNQe\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"gQMgY\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"5E8Hg\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"89iSb\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"2YEb0\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"iQql8\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"4tC1X\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"h2ayY\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>heatmap);\nconst lib = {\n map (value, inMin, inMax, outMin, outMax) {\n return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n },\n range (start, end, tick) {\n const s = Math.round(start / tick) * tick;\n return Array.from({\n length: Math.floor((end - start) / tick)\n }, (v, k)=>{\n return k * tick + s;\n });\n }\n};\nconst line = (pointA, pointB)=>{\n const lengthX = pointB[0] - pointA[0];\n const lengthY = pointB[1] - pointA[1];\n return {\n length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),\n angle: Math.atan2(lengthY, lengthX)\n };\n};\nfunction heatmap(art, danmuku, option) {\n const { query } = art.constructor.utils;\n art.controls.add({\n name: 'heatmap',\n position: 'top',\n html: '',\n style: {\n position: 'absolute',\n top: '-100px',\n left: '0px',\n right: '0px',\n height: '100px',\n width: '100%',\n pointerEvents: 'none'\n },\n mounted ($heatmap) {\n let $start = null;\n let $stop = null;\n function update(arg = []) {\n $start = null;\n $stop = null;\n $heatmap.innerHTML = '';\n if (!art.duration || art.option.isLive) return;\n const svg = {\n w: $heatmap.offsetWidth,\n h: $heatmap.offsetHeight\n };\n const options = {\n xMin: 0,\n xMax: svg.w,\n yMin: 0,\n yMax: 128,\n scale: 0.25,\n opacity: 0.2,\n minHeight: Math.floor(svg.h * 0.05),\n sampling: Math.floor(svg.w / 100),\n smoothing: 0.2,\n flattening: 0.2\n };\n if (typeof option === 'object') Object.assign(options, option);\n let points = [];\n if (Array.isArray(arg) && arg.length) points = [\n ...arg\n ];\n else {\n const gap = art.duration / svg.w;\n for(let x = 0; x <= svg.w; x += options.sampling){\n const y = danmuku.queue.filter(({ time })=>time > x * gap && time <= (x + options.sampling) * gap).length;\n points.push([\n x,\n y\n ]);\n }\n }\n if (points.length === 0) return;\n const lastPoint = points[points.length - 1];\n const lastX = lastPoint[0];\n const lastY = lastPoint[1];\n if (lastX !== svg.w) points.push([\n svg.w,\n lastY\n ]);\n const yPoints = points.map((point)=>point[1]);\n const yMin = Math.min(...yPoints);\n const yMax = Math.max(...yPoints);\n const yMid = (yMin + yMax) / 2;\n for(let i = 0; i < points.length; i++){\n const point = points[i];\n const y = point[1];\n point[1] = y * (y > yMid ? 1 + options.scale : 1 - options.scale) + options.minHeight;\n }\n const controlPoint = (current, previous, next, reverse)=>{\n const p = previous || current;\n const n = next || current;\n const o = line(p, n);\n const flat = lib.map(Math.cos(o.angle) * options.flattening, 0, 1, 1, 0);\n const angle = o.angle * flat + (reverse ? Math.PI : 0);\n const length = o.length * options.smoothing;\n const x = current[0] + Math.cos(angle) * length;\n const y = current[1] + Math.sin(angle) * length;\n return [\n x,\n y\n ];\n };\n const bezierCommand = (point, i, a)=>{\n const cps = controlPoint(a[i - 1], a[i - 2], point);\n const cpe = controlPoint(point, a[i - 1], a[i + 1], true);\n const close = i === a.length - 1 ? ' z' : '';\n return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}${close}`;\n };\n const pointsPositions = points.map((e)=>{\n const x = lib.map(e[0], options.xMin, options.xMax, 0, svg.w);\n const y = lib.map(e[1], options.yMin, options.yMax, svg.h, 0);\n return [\n x,\n y\n ];\n });\n const pathD = pointsPositions.reduce((acc, e, i, a)=>i === 0 ? `M ${a[a.length - 1][0]},${svg.h} L ${e[0]},${svg.h} L ${e[0]},${e[1]}` : `${acc} ${bezierCommand(e, i, a)}`, '');\n $heatmap.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n `;\n $start = query('#heatmap-start', $heatmap);\n $stop = query('#heatmap-stop', $heatmap);\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n art.on('video:timeupdate', ()=>{\n if ($start && $stop) {\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n });\n art.on('setBar', (type, percentage)=>{\n if ($start && $stop && type === 'played') {\n $start.setAttribute('offset', `${percentage * 100}%`);\n $stop.setAttribute('offset', `${percentage * 100}%`);\n }\n });\n art.on('ready', ()=>update());\n art.on('resize', ()=>update());\n art.on('artplayerPluginDanmuku:loaded', ()=>update());\n art.on('artplayerPluginDanmuku:points', (points)=>update(points));\n }\n });\n}\n\n},{\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}]},[\"6ZbtA\"], \"6ZbtA\", \"parcelRequire4dc0\", {})\nlet {default: _default, } = parcelRequire4dc0(\"6ZbtA\");\nexport {_default as default, };\n\n//# sourceMappingURL=index.js.map\n","import Danmuku from './danmuku';\nimport Setting from './setting';\nimport heatmap from './heatmap';\n\nexport default function artplayerPluginDanmuku(option) {\n return (art) => {\n const danmuku = new Danmuku(art, option);\n const setting = new Setting(art, danmuku);\n\n if (danmuku.option.heatmap) {\n heatmap(art, danmuku, danmuku.option.heatmap);\n }\n\n return {\n name: 'artplayerPluginDanmuku',\n emit: danmuku.emit.bind(danmuku),\n load: danmuku.load.bind(danmuku),\n config: danmuku.config.bind(danmuku),\n hide: danmuku.hide.bind(danmuku),\n show: danmuku.show.bind(danmuku),\n reset: danmuku.reset.bind(danmuku),\n mount: setting.mount.bind(setting),\n get option() {\n return danmuku.option;\n },\n get isHide() {\n return danmuku.isHide;\n },\n get isStop() {\n return danmuku.isStop;\n },\n };\n };\n}\n\nartplayerPluginDanmuku.icons = Setting.icons;\n\nif (typeof window !== 'undefined') {\n window['artplayerPluginDanmuku'] = artplayerPluginDanmuku;\n}\n","import { bilibiliDanmuParseFromUrl } from './bilibili';\nimport workerText from 'bundle-text:./worker';\n\nexport default class Danmuku {\n constructor(art, option) {\n const { constructor, template } = art;\n\n this.utils = constructor.utils; // 工具库\n this.validator = constructor.validator; // 配置校验器\n this.$danmuku = template.$danmuku; // 弹幕层容器\n this.$player = template.$player; // 播放器容器\n\n this.art = art;\n this.queue = []; // 实际弹幕队列\n this.$refs = []; // 弹幕DOM节点池\n this.isStop = false; // 是否停止\n this.isHide = false; // 是否隐藏\n this.timer = null; // 定时器\n this.index = 0; // 弹幕索引\n\n // 格式化后的配置项\n this.option = Danmuku.option;\n\n // 弹幕状态池\n this.states = { wait: [], ready: [], emit: [], stop: [] };\n\n // 初始化配置\n this.config(option);\n\n // 创建 Web Worker, 用于计算弹幕的 top 值\n const workerText2 = workerText.replace('export{e as default};', '');\n const blob = new Blob([workerText2], { type: 'application/javascript' });\n this.worker = new Worker(URL.createObjectURL(blob));\n\n // 绑定公用事件\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.reset = this.reset.bind(this);\n this.resize = this.resize.bind(this);\n this.destroy = this.destroy.bind(this);\n\n // 监听事件\n art.on('video:play', this.start);\n art.on('video:playing', this.start);\n art.on('video:pause', this.stop);\n art.on('video:waiting', this.stop);\n art.on('destroy', this.destroy);\n art.on('resize', this.resize);\n\n // 开始加载弹幕\n this.load();\n }\n\n // 默认配置\n static get option() {\n return {\n danmuku: [], // 弹幕数据\n speed: 5, // 弹幕持续时间,范围在[1 ~ 10]\n margin: [10, '25%'], // 弹幕上下边距,支持像素数字和百分比\n opacity: 1, // 弹幕透明度,范围在[0 ~ 1]\n color: '#FFFFFF', // 默认弹幕颜色,可以被单独弹幕项覆盖\n mode: 0, // 默认弹幕模式: 0: 滚动,1: 顶部,2: 底部\n modes: [0, 1, 2], // 弹幕可见的模式\n fontSize: 25, // 弹幕字体大小,支持像素数字和百分比\n antiOverlap: true, // 弹幕是否防重叠\n synchronousPlayback: false, // 是否同步播放速度\n mount: undefined, // 弹幕发射器挂载点, 默认为播放器控制栏中部\n heatmap: false, // 是否开启热力图\n width: 512, // 当播放器宽度小于此值时,弹幕发射器置于播放器底部\n points: [], // 热力图数据\n filter: () => true, // 弹幕载入前的过滤器,只支持返回布尔值\n beforeEmit: () => true, // 弹幕发送前的过滤器,支持返回 Promise\n beforeVisible: () => true, // 弹幕显示前的过滤器,支持返回 Promise\n visible: true, // 弹幕层是否可见\n emitter: true, // 是否开启弹幕发射器\n maxLength: 200, // 弹幕输入框最大长度, 范围在[1 ~ 1000]\n lockTime: 5, // 输入框锁定时间,范围在[1 ~ 60]\n theme: 'dark', // 弹幕主题,支持 dark 和 light,只在自定义挂载时生效\n OPACITY: {}, // 不透明度配置项\n FONT_SIZE: {}, // 弹幕字号配置项\n MARGIN: {}, // 显示区域配置项\n SPEED: {}, // 弹幕速度配置项\n COLOR: [], // 颜色列表配置项\n };\n }\n\n // 配置校验\n static get scheme() {\n return {\n danmuku: 'array|function|string',\n speed: 'number',\n margin: 'array',\n opacity: 'number',\n color: 'string',\n mode: 'number',\n modes: 'array',\n fontSize: 'number|string',\n antiOverlap: 'boolean',\n synchronousPlayback: 'boolean',\n mount: '?htmldivelement|string',\n heatmap: 'object|boolean',\n width: 'number',\n points: 'array',\n filter: 'function',\n beforeEmit: 'function',\n beforeVisible: 'function',\n visible: 'boolean',\n emitter: 'boolean',\n maxLength: 'number',\n lockTime: 'number',\n theme: 'string',\n OPACITY: 'object',\n FONT_SIZE: 'object',\n MARGIN: 'object',\n SPEED: 'object',\n COLOR: 'array',\n };\n }\n\n // 初始弹幕样式\n static get cssText() {\n return `\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, \"Microsoft JhengHei\", Arial, Helvetica, sans-serif;\n 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;\n `;\n }\n\n // 是否在移动端使用了自动旋屏,会影响弹幕的left和top值\n get isRotate() {\n return this.art.plugins?.autoOrientation?.state;\n }\n\n // 计算上空白边距\n get marginTop() {\n const { clamp } = this.utils;\n const value = this.option.margin[0];\n const { clientHeight } = this.$player;\n\n if (typeof value === 'number') {\n return clamp(value, 0, clientHeight);\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n\n return Danmuku.option.margin[0];\n }\n\n // 计算下空白边距\n get marginBottom() {\n const { clamp } = this.utils;\n const value = this.option.margin[1];\n const { clientHeight } = this.$player;\n\n if (typeof value === 'number') {\n return clamp(value, 0, clientHeight);\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n\n return Danmuku.option.margin[1];\n }\n\n // 计算弹幕字体大小\n get fontSize() {\n const { clamp } = this.utils;\n const { clientHeight } = this.$player;\n\n const fontSize = this.option.fontSize;\n\n if (typeof fontSize === 'number') {\n return Math.round(clamp(fontSize, 12, clientHeight));\n }\n\n if (typeof fontSize === 'string' && fontSize.endsWith('%')) {\n const ratio = parseFloat(fontSize) / 100;\n return Math.round(clamp(clientHeight * ratio, 12, clientHeight));\n }\n\n return Danmuku.option.fontSize;\n }\n\n // 获取弹幕DOM节点\n get $ref() {\n const $ref = this.$refs.pop() || document.createElement('div');\n $ref.style.cssText = Danmuku.cssText;\n $ref.dataset.mode = '';\n $ref.className = '';\n return $ref;\n }\n\n // 获取准备好发送的弹幕\n get readys() {\n const { currentTime } = this.art;\n\n const result = [];\n\n // 有的是ready状态:之前因为弹幕太多而暂停发送的弹幕\n this.filter('ready', (danmu) => result.push(danmu));\n\n // 有的是wait状态:符合时间范围的弹幕\n this.filter('wait', (danmu) => {\n if (currentTime + 0.1 >= danmu.time && danmu.time >= currentTime - 0.1) {\n result.push(danmu);\n }\n });\n\n return result;\n }\n\n // 可见的弹幕的数据,用于计算下一个弹幕的top值\n get visibles() {\n const result = [];\n const { clientWidth } = this.$player;\n const clientLeft = this.getLeft(this.$player);\n\n this.filter('emit', (danmu) => {\n const top = danmu.$ref.offsetTop;\n const left = this.getLeft(danmu.$ref) - clientLeft;\n const height = danmu.$ref.clientHeight;\n const width = danmu.$ref.clientWidth;\n const distance = left + width;\n const right = clientWidth - distance;\n const speed = distance / danmu.$restTime;\n\n const emit = {};\n emit.top = top;\n emit.left = left;\n emit.height = height;\n emit.width = width;\n emit.right = right;\n emit.speed = speed;\n emit.distance = distance;\n emit.time = danmu.$restTime;\n emit.mode = danmu.mode;\n\n result.push(emit);\n });\n\n return result;\n }\n\n // 计算弹幕速度\n get speed() {\n return this.option.synchronousPlayback && this.art.playbackRate\n ? this.option.speed / Number(this.art.playbackRate)\n : this.option.speed;\n }\n\n // 加载弹幕\n async load(danmuku) {\n const { errorHandle } = this.utils;\n\n let danmus = [];\n const target = danmuku || this.option.danmuku;\n\n try {\n if (typeof target === 'function') {\n danmus = await target(); // 异步函数获取\n } else if (target instanceof Promise) {\n danmus = await target; // 从 Promise 对象获取\n } else if (typeof target === 'string') {\n danmus = await bilibiliDanmuParseFromUrl(target); // 从B站xml链接解析\n } else if (Array.isArray(target)) {\n danmus = target; // 直接传入数组\n }\n\n errorHandle(Array.isArray(danmus), 'Danmuku need return an array as result');\n\n // 假如没有传入弹幕参数,则清空弹幕,否则追加弹幕\n if (danmuku === undefined) {\n this.reset(); // 重置弹幕\n this.queue = []; // 清空弹幕队列\n this.states = { wait: [], ready: [], emit: [], stop: [] }; // 清空弹幕状态池\n this.$refs = []; // 清空弹幕DOM节点池\n this.$danmuku.innerText = ''; // 清空弹幕层\n }\n\n // 逐个验证原始弹幕并转换到弹幕队列\n for (let index = 0; index < danmus.length; index++) {\n const danmu = danmus[index];\n await this.emit(danmu);\n }\n\n this.art.emit('artplayerPluginDanmuku:loaded', this.queue);\n } catch (error) {\n this.art.emit('artplayerPluginDanmuku:error', error);\n throw error;\n }\n\n return this;\n }\n\n // 把原始弹幕转换到弹幕队列\n async emit(danmu) {\n const { clamp } = this.utils;\n\n this.validator(danmu, {\n text: 'string', // 弹幕文本\n mode: '?number', // 弹幕模式: 0: 滚动,1: 顶部,2: 底部\n color: '?string', // 弹幕颜色\n time: '?number', // 弹幕时间\n border: '?boolean', // 弹幕是否有边框\n style: '?object', // 弹幕额外样式\n });\n\n // 弹幕文本为空则直接忽略\n if (!danmu.text.trim()) return this;\n\n // 设置弹幕时间,如果没有则默认为当前时间加 0.5 秒\n if (danmu.time) {\n danmu.time = clamp(danmu.time, 0, Infinity);\n } else {\n danmu.time = this.art.currentTime + 0.5;\n }\n\n // 设置弹幕模式,如果没有则默认为全局配置\n if (danmu.mode === undefined) {\n danmu.mode = this.option.mode;\n }\n\n // 设置弹幕单独样式,如果没有则默认为空对象\n if (danmu.style === undefined) {\n danmu.style = {};\n }\n\n // 设置弹幕颜色,如果没有则默认为全局配置\n if (danmu.color === undefined) {\n danmu.color = this.option.color;\n }\n\n // 弹幕模式只能是 0, 1, 2\n if (![0, 1, 2].includes(danmu.mode)) return this;\n\n // 自定义弹幕过滤函数\n if (!this.option.filter(danmu)) return this;\n\n // 添加自定义属性\n const item = {\n ...danmu,\n $state: 'wait', // 弹幕初始状态\n $id: this.index++, // 弹幕唯一标识\n $ref: null, // 弹幕 DOM 节点\n $restTime: 0, // 弹幕剩余时间\n $lastStartTime: 0, // 弹幕上次开始时间\n };\n\n // 转换为wait状态\n this.setState(item, 'wait');\n\n // 添加到实际弹幕队列\n this.queue.push(item);\n\n // 弹幕有四个状态:\n // - wait: 弹幕还未开始显示,没有被添加到 DOM 中\n // - ready: 弹幕准备好显示,没有被添加到 DOM 中\n // - emit: 弹幕正在显示,已经被添加到 DOM 中\n // - stop: 弹幕正在停止显示,已经被添加到 DOM 中\n\n return this;\n }\n\n // 动态配置\n config(option) {\n const { clamp } = this.utils;\n const { $controlsCenter } = this.art.template;\n\n // 判断配置项是否有变化\n const changed = Object.keys(option).some(\n (key) => JSON.stringify(this.option[key]) !== JSON.stringify(option[key]),\n );\n\n // 没有变化则直接返回\n if (!changed) return this;\n\n // 更新配置项\n this.option = Object.assign({}, Danmuku.option, this.option, option);\n this.validator(this.option, Danmuku.scheme);\n\n this.option.mode = clamp(this.option.mode, 0, 2);\n this.option.speed = clamp(this.option.speed, 1, 10);\n this.option.opacity = clamp(this.option.opacity, 0, 1);\n this.option.lockTime = clamp(this.option.lockTime, 1, 60);\n this.option.maxLength = clamp(this.option.maxLength, 1, 1000);\n this.option.mount = this.option.mount || $controlsCenter;\n\n // 动态配置有字体大小,需要重新渲染\n if (option.fontSize) {\n this.reset();\n }\n\n // 通过配置项控制弹幕的显示和隐藏\n if (this.option.visible) {\n this.show();\n } else {\n this.hide();\n }\n\n this.art.emit('artplayerPluginDanmuku:config', this.option);\n\n return this;\n }\n\n // 计算DOM的left值,受到旋屏影响\n getLeft($ref) {\n const rect = $ref.getBoundingClientRect();\n return this.isRotate ? rect.top : rect.left;\n }\n\n // 复杂运算交给 Web Worker 处理\n postMessage(message = {}) {\n return new Promise((resolve) => {\n message.id = Date.now(); // 生成唯一标识\n this.worker.postMessage(message);\n this.worker.onmessage = (event) => {\n const { data } = event;\n // 判断是否是当前的消息\n if (data.id === message.id) {\n resolve(data);\n }\n };\n });\n }\n\n // 根据状态获取弹幕\n filter(state, callback) {\n const danmus = this.states[state] || [];\n for (let index = 0; index < danmus.length; index++) {\n callback(danmus[index]);\n }\n return danmus;\n }\n\n // 设置弹幕状态\n setState(danmu, state) {\n // 从原状态池中删除\n this.states[danmu.$state] = this.states[danmu.$state].filter((item) => item !== danmu);\n\n // 设置新状态\n danmu.$state = state;\n\n // 设置DOM节点状态\n if (danmu.$ref) {\n danmu.$ref.dataset.state = state;\n }\n\n // 添加到新状态池中\n this.states[state].push(danmu);\n }\n\n // 重置弹幕到wait状态,回收弹幕DOM节点\n makeWait(danmu) {\n this.setState(danmu, 'wait');\n if (danmu.$ref) {\n danmu.$ref.style.cssText = Danmuku.cssText;\n danmu.$ref.style.visibility = 'hidden';\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = 'translateX(0px)';\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n\n // 实时更新弹幕\n update() {\n const { setStyles } = this.utils;\n\n this.timer = window.requestAnimationFrame(async () => {\n if (this.art.playing && !this.isHide) {\n // 实时计算弹幕的剩余显示时间\n this.filter('emit', (danmu) => {\n const emitTime = (Date.now() - danmu.$lastStartTime) / 1000;\n danmu.$restTime -= emitTime;\n danmu.$lastStartTime = Date.now();\n // 超过时间即重置弹幕\n if (danmu.$restTime <= 0) {\n this.makeWait(danmu);\n }\n });\n\n // 获取准备好发送的弹幕,可能包含ready和wait状态的弹幕\n const readys = this.readys;\n\n for (let index = 0; index < readys.length; index++) {\n const danmu = readys[index];\n\n // 弹幕发送前的过滤器\n const state = await this.option.beforeVisible(danmu);\n\n if (state) {\n const { clientWidth, clientHeight } = this.$player;\n danmu.$ref = this.$ref; // 获取弹幕DOM节点\n danmu.$ref.innerText = danmu.text; // 设置弹幕文本\n\n // 提前添加到弹幕层中,用于计算top值\n this.$danmuku.appendChild(danmu.$ref);\n\n // 设置初始弹幕样式\n danmu.$ref.style.opacity = this.option.opacity;\n danmu.$ref.style.fontSize = `${this.fontSize}px`;\n danmu.$ref.style.color = danmu.color;\n danmu.$ref.style.border = danmu.border ? `1px solid ${danmu.color}` : null;\n danmu.$ref.style.backgroundColor = danmu.border ? 'rgb(0 0 0 / 50%)' : null;\n\n // 设置单独弹幕样式\n setStyles(danmu.$ref, danmu.style);\n\n // 记录弹幕时间戳\n danmu.$lastStartTime = Date.now();\n\n // 计算弹幕剩余时间\n danmu.$restTime = this.speed;\n\n // 计算弹幕滚动的距离\n const distance = clientWidth + danmu.$ref.clientWidth;\n\n // 计算弹幕的top值\n const { result: top } = await this.postMessage({\n type: 'getDanmuTop',\n target: {\n mode: danmu.mode,\n height: danmu.$ref.clientHeight,\n speed: distance / danmu.$restTime,\n }, // 当前弹幕信息\n visibles: this.visibles, // 可见的弹幕的数据\n antiOverlap: this.option.antiOverlap,\n clientWidth: clientWidth,\n clientHeight: clientHeight,\n marginBottom: this.marginBottom,\n marginTop: this.marginTop,\n });\n\n if (danmu.$ref) {\n if (!this.isStop && top !== undefined) {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$ref.style.top = `${top}px`;\n danmu.$ref.style.visibility = 'visible';\n danmu.$ref.dataset.mode = danmu.mode; // CSS控制模式的显示和隐藏\n\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0: {\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n case 1:\n // falls through\n case 2:\n danmu.$ref.style.left = '50%';\n danmu.$ref.style.marginLeft = `-${danmu.$ref.clientWidth / 2}px`;\n break;\n default:\n break;\n }\n\n this.art.emit('artplayerPluginDanmuku:visible', danmu);\n } else {\n // 假如弹幕已经停止或者没有 top 值,则重置弹幕为ready状态,回收弹幕DOM节点,等待下次发送\n this.setState(danmu, 'ready');\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n }\n }\n }\n\n // 递归调用\n if (!this.isStop) {\n this.update();\n }\n });\n return this;\n }\n\n // 重置正在显示的弹幕: stop/emit 状态的弹幕\n resize() {\n const { clientWidth } = this.$player;\n\n this.filter('stop', (danmu) => {\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n break;\n default:\n break;\n }\n });\n\n this.filter('emit', (danmu) => {\n danmu.$lastStartTime = Date.now();\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0: {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n }\n\n // 继续弹幕\n continue() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu) => {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$lastStartTime = Date.now();\n switch (danmu.mode) {\n // 继续滚动的弹幕\n case 0: {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n\n return this;\n }\n\n // 暂停弹幕\n suspend() {\n const { clientWidth } = this.$player;\n this.filter('emit', (danmu) => {\n this.setState(danmu, 'stop'); // 转换为stop状态\n switch (danmu.mode) {\n // 停止滚动的弹幕\n case 0: {\n const translateX = clientWidth - (this.getLeft(danmu.$ref) - this.getLeft(this.$player));\n danmu.$ref.style.transform = `translateX(${-translateX}px)`;\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n break;\n }\n default:\n break;\n }\n });\n\n return this;\n }\n\n stop() {\n this.isStop = true;\n this.suspend();\n window.cancelAnimationFrame(this.timer);\n this.art.emit('artplayerPluginDanmuku:stop');\n return this;\n }\n\n start() {\n this.isStop = false;\n this.continue();\n this.update();\n this.art.emit('artplayerPluginDanmuku:start');\n return this;\n }\n\n reset() {\n this.queue.forEach((danmu) => this.makeWait(danmu));\n this.art.emit('artplayerPluginDanmuku:reset');\n return this;\n }\n\n show() {\n this.isHide = false;\n this.$danmuku.style.opacity = 1;\n this.option.visible = true;\n this.art.emit('artplayerPluginDanmuku:show');\n return this;\n }\n\n hide() {\n this.isHide = true;\n this.$danmuku.style.opacity = 0;\n this.option.visible = false;\n this.art.emit('artplayerPluginDanmuku:hide');\n return this;\n }\n\n destroy() {\n this.stop();\n this.worker.terminate();\n this.art.off('video:play', this.start);\n this.art.off('video:playing', this.start);\n this.art.off('video:pause', this.stop);\n this.art.off('video:waiting', this.stop);\n this.art.off('resize', this.reset);\n this.art.off('destroy', this.destroy);\n this.art.emit('artplayerPluginDanmuku:destroy');\n }\n}\n","function getMode(key) {\n switch (key) {\n case 1:\n case 2:\n case 3:\n return 0;\n case 4:\n return 2;\n case 5:\n return 1;\n default:\n return 0;\n }\n}\n\nfunction bilibiliDanmuParseFromXml(xmlString) {\n if (typeof xmlString !== 'string') return [];\n const reg = new RegExp(/.+?)\"(?: .*?)?>(?.+?)<\\/d>/gs);\n const matches = xmlString.matchAll(reg);\n return Array.from(matches)\n .map((match) => {\n const attr = match.groups.p.split(',');\n if (attr.length >= 8) {\n const text = match.groups.text\n .trim()\n .replaceAll('"', '\"')\n .replaceAll(''', \"'\")\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n .replaceAll('&', '&');\n\n return {\n text,\n time: Number(attr[0]),\n mode: getMode(Number(attr[1])),\n fontSize: Number(attr[2]),\n color: `#${Number(attr[3]).toString(16)}`,\n timestamp: Number(attr[4]),\n pool: Number(attr[5]),\n userID: attr[6],\n rowID: Number(attr[7]),\n };\n } else {\n return null;\n }\n })\n .filter(Boolean);\n}\n\nfunction onmessage({ data }) {\n const { xml, id } = data;\n if (!id || !xml) return;\n const danmus = bilibiliDanmuParseFromXml(xml);\n self.postMessage({ danmus, id });\n}\n\nfunction createWorker() {\n const workerText = `\n ${getMode.toString()}\n ${bilibiliDanmuParseFromXml.toString()}\n onmessage = ${onmessage.toString()}\n `;\n const blob = new Blob([workerText], { type: 'application/javascript' });\n return new Worker(URL.createObjectURL(blob));\n}\n\nexport function bilibiliDanmuParseFromUrl(url) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve) => {\n const res = await fetch(url);\n const xml = await res.text();\n\n try {\n const worker = createWorker();\n worker.onmessage = (event) => {\n const { danmus, id } = event.data;\n if (!id || !danmus) return;\n resolve(danmus);\n worker.terminate();\n };\n worker.postMessage({ xml, id: Date.now() });\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n const danmus = bilibiliDanmuParseFromXml(xml);\n resolve(danmus);\n }\n });\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n","module.exports = \"dd7efcb5fd87c1c0\";","import style from 'bundle-text:./style.less';\nimport $on from 'bundle-text:./img/on.svg';\nimport $off from 'bundle-text:./img/off.svg';\nimport $config from 'bundle-text:./img/config.svg';\nimport $style from 'bundle-text:./img/style.svg';\nimport $mode_0_off from 'bundle-text:./img/mode_0_off.svg';\nimport $mode_0_on from 'bundle-text:./img/mode_0_on.svg';\nimport $mode_1_off from 'bundle-text:./img/mode_1_off.svg';\nimport $mode_1_on from 'bundle-text:./img/mode_1_on.svg';\nimport $mode_2_off from 'bundle-text:./img/mode_2_off.svg';\nimport $mode_2_on from 'bundle-text:./img/mode_2_on.svg';\nimport $check_on from 'bundle-text:./img/check_on.svg';\nimport $check_off from 'bundle-text:./img/check_off.svg';\n\nexport default class Setting {\n constructor(art, danmuku) {\n this.art = art;\n this.danmuku = danmuku;\n this.utils = art.constructor.utils;\n\n const { setStyle } = this.utils;\n const { $controlsCenter } = art.template;\n setStyle($controlsCenter, 'display', 'flex');\n\n this.template = {\n $controlsCenter,\n $mount: $controlsCenter,\n $danmuku: null,\n $toggle: null,\n $config: null,\n $configPanel: null,\n $configModes: null,\n $style: null,\n $stylePanel: null,\n $styleModes: null,\n $colors: null,\n $opacitySlider: null,\n $opacityValue: null,\n $marginSlider: null,\n $marginValue: null,\n $fontSizeSlider: null,\n $fontSizeValue: null,\n $speedSlider: null,\n $speedValue: null,\n $input: null,\n $send: null,\n };\n\n this.slider = {\n opacity: null,\n margin: null,\n fontSize: null,\n speed: null,\n };\n\n this.emitting = false;\n this.isLock = false;\n this.timer = null;\n\n this.createTemplate();\n this.createSliders();\n this.createEvents();\n\n this.mount(this.option.mount);\n\n art.on('resize', () => this.resize());\n art.on('fullscreen', (state) => this.onFullscreen(state));\n art.on('fullscreenWeb', (state) => this.onFullscreen(state));\n\n art.proxy(this.template.$config, 'mouseenter', () => {\n this.onMouseEnter({\n $control: this.template.$config,\n $panel: this.template.$configPanel,\n });\n });\n\n art.proxy(this.template.$style, 'mouseenter', () => {\n this.onMouseEnter({\n $control: this.template.$style,\n $panel: this.template.$stylePanel,\n });\n });\n }\n\n static get icons() {\n return {\n $on,\n $off,\n $config,\n $style,\n $mode_0_off,\n $mode_0_on,\n $mode_1_off,\n $mode_1_on,\n $mode_2_off,\n $mode_2_on,\n $check_on,\n $check_off,\n };\n }\n\n get option() {\n return this.danmuku.option;\n }\n\n get outside() {\n return this.template.$mount !== this.template.$controlsCenter;\n }\n\n get TEMPLATE() {\n const { option } = this;\n return `\n
\n ${$on}${$off}\n
\n
\n ${$config}\n
\n
\n
\n 按类型屏蔽\n
\n
\n ${$mode_0_off}${$mode_0_on}\n
滚动
\n
\n
\n ${$mode_1_off}${$mode_1_on}\n
顶部
\n
\n
\n ${$mode_2_off}${$mode_2_on}\n
底部
\n
\n
\n
\n
\n
\n ${$check_on}${$check_off}\n 防止弹幕重叠\n
\n
\n ${$check_on}${$check_off}\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 ${$style}\n
\n
\n
\n 模式\n
\n
\n ${$mode_0_on}\n
滚动
\n
\n
\n ${$mode_1_on}\n
顶部
\n
\n
\n ${$mode_2_on}\n
底部
\n
\n
\n
\n
\n 颜色\n
\n ${this.COLOR.map((color) => `
`).join('')}\n
\n
\n
\n
\n
\n \n
发送
\n
\n `;\n }\n\n get OPACITY() {\n return {\n min: 0,\n max: 100,\n steps: [],\n ...this.option.OPACITY,\n };\n }\n\n get FONT_SIZE() {\n return {\n min: 12,\n max: 120,\n steps: [],\n ...this.option.FONT_SIZE,\n };\n }\n\n get MARGIN() {\n return {\n min: 0,\n max: 3,\n steps: [\n {\n name: '1/4',\n value: [10, '75%'],\n },\n {\n name: '半屏',\n value: [10, '50%'],\n },\n {\n name: '3/4',\n value: [10, '25%'],\n },\n {\n name: '满屏',\n value: [10, 10],\n },\n ],\n ...this.option.MARGIN,\n };\n }\n\n get SPEED() {\n return {\n min: 0,\n max: 4,\n steps: [\n {\n name: '极慢',\n value: 10,\n },\n {\n name: '较慢',\n value: 7.5,\n hide: true,\n },\n {\n name: '适中',\n value: 5,\n },\n {\n name: '较快',\n value: 2.5,\n hide: true,\n },\n {\n name: '极快',\n value: 1,\n },\n ],\n ...this.option.SPEED,\n };\n }\n\n get COLOR() {\n return this.option.COLOR.length\n ? this.option.COLOR\n : [\n '#FE0302',\n '#FF7204',\n '#FFAA02',\n '#FFD302',\n '#FFFF00',\n '#A0EE00',\n '#00CD00',\n '#019899',\n '#4266BE',\n '#89D5FF',\n '#CC0273',\n '#222222',\n '#9B9B9B',\n '#FFFFFF',\n ];\n }\n\n query(selector) {\n const { query } = this.utils;\n const { $danmuku } = this.template;\n return query(selector, $danmuku);\n }\n\n append(el, target) {\n const { append } = this.utils;\n const children = [...el.children];\n if (children.some((item) => item === target)) return;\n append(el, target);\n }\n\n setData(key, value) {\n const { $player } = this.art.template;\n const { $mount } = this.template;\n $player.dataset[key] = value;\n if (this.outside) {\n $mount.dataset[key] = value;\n }\n }\n\n createTemplate() {\n const { createElement, tooltip } = this.utils;\n\n const $danmuku = createElement('div');\n $danmuku.className = 'artplayer-plugin-danmuku';\n $danmuku.innerHTML = this.TEMPLATE;\n\n this.template.$danmuku = $danmuku;\n this.template.$toggle = this.query('.apd-toggle');\n this.template.$config = this.query('.apd-config');\n this.template.$configPanel = this.query('.apd-config-panel');\n this.template.$configModes = this.query('.apd-config-mode .apd-modes');\n this.template.$style = this.query('.apd-style');\n this.template.$stylePanel = this.query('.apd-style-panel');\n this.template.$styleModes = this.query('.apd-style-mode .apd-modes');\n this.template.$colors = this.query('.apd-colors');\n this.template.$antiOverlap = this.query('.apd-anti-overlap');\n this.template.$syncVideo = this.query('.apd-sync-video');\n this.template.$opacitySlider = this.query('.apd-config-opacity .apd-slider');\n this.template.$opacityValue = this.query('.apd-config-opacity .apd-value');\n this.template.$marginSlider = this.query('.apd-config-margin .apd-slider');\n this.template.$marginValue = this.query('.apd-config-margin .apd-value');\n this.template.$fontSizeSlider = this.query('.apd-config-fontSize .apd-slider');\n this.template.$fontSizeValue = this.query('.apd-config-fontSize .apd-value');\n this.template.$speedSlider = this.query('.apd-config-speed .apd-slider');\n this.template.$speedValue = this.query('.apd-config-speed .apd-value');\n this.template.$input = this.query('.apd-input');\n this.template.$send = this.query('.apd-send');\n\n const { $toggle } = this.template;\n\n this.art.on('artplayerPluginDanmuku:show', () => {\n tooltip($toggle, '关闭弹幕');\n });\n\n this.art.on('artplayerPluginDanmuku:hide', () => {\n tooltip($toggle, '打开弹幕');\n });\n }\n\n createEvents() {\n const { $toggle, $configModes, $styleModes, $colors, $antiOverlap, $syncVideo, $send, $input } = this.template;\n\n this.art.proxy($toggle, 'click', () => {\n this.danmuku.config({\n visible: !this.option.visible,\n });\n this.reset();\n });\n\n this.art.proxy($configModes, 'click', (event) => {\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n if (this.option.modes.includes(mode)) {\n this.danmuku.config({\n modes: this.option.modes.filter((m) => m !== mode),\n });\n } else {\n this.danmuku.config({\n modes: [...this.option.modes, mode],\n });\n }\n this.reset();\n });\n\n this.art.proxy($antiOverlap, 'click', () => {\n this.danmuku.config({\n antiOverlap: !this.option.antiOverlap,\n });\n this.reset();\n });\n\n this.art.proxy($syncVideo, 'click', () => {\n this.danmuku.config({\n synchronousPlayback: !this.option.synchronousPlayback,\n });\n this.reset();\n });\n\n this.art.proxy($styleModes, 'click', (event) => {\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n this.danmuku.config({\n mode: mode,\n });\n this.reset();\n });\n\n this.art.proxy($colors, 'click', (event) => {\n const $color = event.target.closest('.apd-color');\n if (!$color) return;\n this.danmuku.config({\n color: $color.dataset.color,\n });\n this.reset();\n });\n\n this.art.proxy($send, 'click', () => this.emit());\n\n this.art.proxy($input, 'keypress', (event) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.emit();\n }\n });\n }\n\n createSliders() {\n this.slider.opacity = this.createSlider({\n ...this.OPACITY,\n container: this.template.$opacitySlider,\n findIndex: () => {\n return Math.round(this.option.opacity * 100);\n },\n onChange: (index) => {\n const { $opacityValue } = this.template;\n $opacityValue.textContent = `${index}%`;\n this.danmuku.config({\n opacity: index / 100,\n });\n },\n });\n\n this.slider.margin = this.createSlider({\n ...this.MARGIN,\n container: this.template.$marginSlider,\n findIndex: () => {\n return this.MARGIN.steps.findIndex(\n (item) => item.value[0] === this.option.margin[0] && item.value[1] === this.option.margin[1],\n );\n },\n onChange: (index) => {\n const margin = this.MARGIN.steps[index];\n if (!margin) return;\n const { $marginValue } = this.template;\n $marginValue.textContent = margin.name;\n this.danmuku.config({\n margin: margin.value,\n });\n },\n });\n\n this.slider.fontSize = this.createSlider({\n ...this.FONT_SIZE,\n container: this.template.$fontSizeSlider,\n findIndex: () => {\n return this.danmuku.fontSize;\n },\n onChange: (index) => {\n const { $fontSizeValue } = this.template;\n $fontSizeValue.textContent = `${index}px`;\n if (index === this.danmuku.fontSize) return;\n this.danmuku.config({\n fontSize: index,\n });\n },\n });\n\n this.slider.speed = this.createSlider({\n ...this.SPEED,\n container: this.template.$speedSlider,\n findIndex: () => {\n return this.SPEED.steps.findIndex((item) => item.value === this.option.speed);\n },\n onChange: (index) => {\n const speed = this.SPEED.steps[index];\n if (!speed) return;\n const { $speedValue } = this.template;\n $speedValue.textContent = speed.name;\n this.danmuku.config({\n speed: speed.value,\n });\n },\n });\n }\n\n createSlider({ min, max, container, findIndex, onChange, steps = [] }) {\n const { query, clamp, setStyle } = this.utils;\n\n setStyle(container, 'touch-action', 'none');\n\n container.innerHTML = `\n
\n
\n ${steps.map(() => `
`).join('')}\n
\n
\n
\n
\n
\n ${steps.map((step) => (step.hide ? '' : `
${step.name}
`)).join('')}\n
\n `;\n\n const $dot = query('.apd-slider-dot', container);\n const $progress = query('.apd-slider-progress', container);\n\n let isDroging = false;\n\n function reset(index = findIndex()) {\n if (index < min || index > max) return;\n const percentage = (index - min) / (max - min);\n $dot.style.left = `${percentage * 100}%`;\n if (steps.length === 0) {\n $progress.style.width = $dot.style.left;\n }\n onChange(index);\n }\n\n function updateLeft(event) {\n const { top, height, left, width } = container.getBoundingClientRect();\n if (this.art.isRotate) {\n const value = clamp(event.clientY - top, 0, height);\n const index = Math.round((value / height) * (max - min) + min);\n reset(index);\n } else {\n const value = clamp(event.clientX - left, 0, width);\n const index = Math.round((value / width) * (max - min) + min);\n reset(index);\n }\n }\n\n this.art.proxy(container, 'click', (event) => {\n updateLeft.call(this, event);\n });\n\n this.art.proxy(container, 'pointerdown', (event) => {\n isDroging = event.button === 0;\n });\n\n this.art.proxy(document, 'pointermove', (event) => {\n if (isDroging) {\n updateLeft.call(this, event);\n }\n });\n\n this.art.proxy(document, 'pointerup', (event) => {\n if (isDroging) {\n isDroging = false;\n updateLeft.call(this, event);\n }\n });\n\n return { reset };\n }\n\n onFullscreen(state) {\n const { $danmuku, $controlsCenter, $mount } = this.template;\n if (this.outside) {\n if (state) {\n this.append($controlsCenter, $danmuku);\n } else {\n this.append($mount, $danmuku);\n }\n } else {\n this.append($controlsCenter, $danmuku);\n }\n }\n\n onMouseEnter({ $control, $panel }) {\n const { $player } = this.art.template;\n const controlRect = $control.getBoundingClientRect();\n const panelRect = $panel.getBoundingClientRect();\n const playerRect = $player.getBoundingClientRect();\n\n const half = panelRect.width / 2 - controlRect.width / 2;\n const left = playerRect.left - (controlRect.left - half);\n const right = controlRect.right + half - playerRect.right;\n\n if (left > 0) {\n $panel.style.left = `${-half + left}px`;\n } else if (right > 0) {\n $panel.style.left = `${-half - right}px`;\n } else {\n $panel.style.left = `${-half}px`;\n }\n }\n\n async emit() {\n const { $input } = this.template;\n\n const text = $input.value.trim();\n if (!text.length) return;\n if (this.isLock) return;\n if (this.emitting) return;\n\n const danmu = {\n text: text,\n mode: this.option.mode,\n color: this.option.color,\n time: this.art.currentTime,\n };\n\n try {\n this.emitting = true;\n const state = await this.option.beforeEmit(danmu);\n this.emitting = false;\n\n if (state !== true) return;\n\n danmu.border = true;\n delete danmu.time;\n this.danmuku.emit(danmu);\n $input.value = '';\n\n this.lock();\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n this.emitting = false;\n }\n }\n\n lock() {\n const { addClass } = this.utils;\n const { $send } = this.template;\n\n this.isLock = true;\n let time = this.option.lockTime;\n $send.innerText = time;\n addClass($send, 'apd-lock');\n\n const loop = () => {\n this.timer = setTimeout(() => {\n if (time === 0) {\n this.unlock();\n } else {\n time -= 1;\n $send.innerText = time;\n loop();\n }\n }, 1000);\n };\n\n loop();\n }\n\n unlock() {\n const { removeClass } = this.utils;\n const { $send } = this.template;\n clearTimeout(this.timer);\n this.isLock = false;\n $send.innerText = '发送';\n removeClass($send, 'apd-lock');\n }\n\n resize() {\n if (this.outside) return;\n if (this.art.fullscreen) return;\n if (this.art.fullscreenWeb) return;\n const { $player, $controlsCenter } = this.art.template;\n const { $danmuku } = this.template;\n if (this.art.width < this.option.width) {\n this.append($player, $danmuku);\n } else {\n this.append($controlsCenter, $danmuku);\n }\n }\n\n reset() {\n const { inverseClass, tooltip } = this.utils;\n const { $toggle, $colors } = this.template;\n\n this.slider.opacity.reset();\n this.slider.margin.reset();\n this.slider.fontSize.reset();\n this.slider.speed.reset();\n\n this.setData('danmukuVisible', this.option.visible);\n this.setData('danmukuMode', this.option.mode);\n this.setData('danmukuColor', this.option.color);\n this.setData('danmukuMode0', this.option.modes.includes(0));\n this.setData('danmukuMode1', this.option.modes.includes(1));\n this.setData('danmukuMode2', this.option.modes.includes(2));\n this.setData('danmukuAntiOverlap', this.option.antiOverlap);\n this.setData('danmukuSyncVideo', this.option.synchronousPlayback);\n this.setData('danmukuTheme', this.option.theme);\n this.setData('danmukuEmitter', this.option.emitter);\n\n const colors = $colors.children;\n const $color = Array.from(colors).find((item) => item.dataset.color === this.option.color.toUpperCase());\n $color && inverseClass($color, 'apd-active');\n\n tooltip($toggle, this.option.visible ? '关闭弹幕' : '打开弹幕');\n\n this.resize();\n }\n\n mount(target) {\n const { errorHandle } = this.utils;\n const $el = typeof target === 'string' ? document.querySelector(target) : target;\n errorHandle($el, `Can not find the mount point: ${target}`);\n this.append($el, this.template.$danmuku);\n this.template.$mount = $el;\n this.reset();\n }\n}\n\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-danmuku';\n let $style = document.getElementById(id);\n if (!$style) {\n $style = document.createElement('style');\n $style.id = id;\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild($style);\n });\n } else {\n (document.head || document.documentElement).appendChild($style);\n }\n }\n $style.textContent = style;\n}\n","module.exports = \"95fd45dd2fe5c5a5\";","module.exports = \"c6881a3522f2fe2a\";","module.exports = \"4e92064d88d9e604\";","module.exports = \"49c14b4dbf213408\";","module.exports = \"5050154cc04e750f\";","module.exports = \"a0f690bca27acdee\";","module.exports = \"70b07d4e4796c39f\";","module.exports = \"bffb346eb331a03f\";","module.exports = \"ade441db0e7be833\";","module.exports = \"8acc265c0fe9e947\";","module.exports = \"d374f135d6d7b8db\";","module.exports = \"8e2849d281974e34\";","module.exports = \"0616b3f5e6434b38\";","const lib = {\n map(value, inMin, inMax, outMin, outMax) {\n return ((value - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;\n },\n range(start, end, tick) {\n const s = Math.round(start / tick) * tick;\n return Array.from(\n {\n length: Math.floor((end - start) / tick),\n },\n (v, k) => {\n return k * tick + s;\n },\n );\n },\n};\n\nconst line = (pointA, pointB) => {\n const lengthX = pointB[0] - pointA[0];\n const lengthY = pointB[1] - pointA[1];\n return {\n length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),\n angle: Math.atan2(lengthY, lengthX),\n };\n};\n\nexport default function heatmap(art, danmuku, option) {\n const { query } = art.constructor.utils;\n\n art.controls.add({\n name: 'heatmap',\n position: 'top',\n html: '',\n style: {\n position: 'absolute',\n top: '-100px',\n left: '0px',\n right: '0px',\n height: '100px',\n width: '100%',\n pointerEvents: 'none',\n },\n mounted($heatmap) {\n let $start = null;\n let $stop = null;\n\n function update(arg = []) {\n $start = null;\n $stop = null;\n $heatmap.innerHTML = '';\n\n if (!art.duration || art.option.isLive) return;\n\n const svg = {\n w: $heatmap.offsetWidth,\n h: $heatmap.offsetHeight,\n };\n\n const options = {\n xMin: 0,\n xMax: svg.w,\n yMin: 0,\n yMax: 128,\n scale: 0.25,\n opacity: 0.2,\n minHeight: Math.floor(svg.h * 0.05),\n sampling: Math.floor(svg.w / 100),\n smoothing: 0.2,\n flattening: 0.2,\n };\n\n if (typeof option === 'object') {\n Object.assign(options, option);\n }\n\n let points = [];\n\n if (Array.isArray(arg) && arg.length) {\n points = [...arg];\n } else {\n const gap = art.duration / svg.w;\n for (let x = 0; x <= svg.w; x += options.sampling) {\n const y = danmuku.queue.filter(\n ({ time }) => time > x * gap && time <= (x + options.sampling) * gap,\n ).length;\n points.push([x, y]);\n }\n }\n\n if (points.length === 0) return;\n\n const lastPoint = points[points.length - 1];\n const lastX = lastPoint[0];\n const lastY = lastPoint[1];\n if (lastX !== svg.w) {\n points.push([svg.w, lastY]);\n }\n\n const yPoints = points.map((point) => point[1]);\n const yMin = Math.min(...yPoints);\n const yMax = Math.max(...yPoints);\n const yMid = (yMin + yMax) / 2;\n\n for (let i = 0; i < points.length; i++) {\n const point = points[i];\n const y = point[1];\n point[1] = y * (y > yMid ? 1 + options.scale : 1 - options.scale) + options.minHeight;\n }\n\n const controlPoint = (current, previous, next, reverse) => {\n const p = previous || current;\n const n = next || current;\n const o = line(p, n);\n const flat = lib.map(Math.cos(o.angle) * options.flattening, 0, 1, 1, 0);\n const angle = o.angle * flat + (reverse ? Math.PI : 0);\n const length = o.length * options.smoothing;\n const x = current[0] + Math.cos(angle) * length;\n const y = current[1] + Math.sin(angle) * length;\n return [x, y];\n };\n\n const bezierCommand = (point, i, a) => {\n const cps = controlPoint(a[i - 1], a[i - 2], point);\n const cpe = controlPoint(point, a[i - 1], a[i + 1], true);\n const close = i === a.length - 1 ? ' z' : '';\n return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}${close}`;\n };\n\n const pointsPositions = points.map((e) => {\n const x = lib.map(e[0], options.xMin, options.xMax, 0, svg.w);\n const y = lib.map(e[1], options.yMin, options.yMax, svg.h, 0);\n return [x, y];\n });\n\n const pathD = pointsPositions.reduce(\n (acc, e, i, a) =>\n i === 0\n ? `M ${a[a.length - 1][0]},${svg.h} L ${e[0]},${svg.h} L ${e[0]},${e[1]}`\n : `${acc} ${bezierCommand(e, i, a)}`,\n '',\n );\n\n $heatmap.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n `;\n\n $start = query('#heatmap-start', $heatmap);\n $stop = query('#heatmap-stop', $heatmap);\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n\n art.on('video:timeupdate', () => {\n if ($start && $stop) {\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n });\n\n art.on('setBar', (type, percentage) => {\n if ($start && $stop && type === 'played') {\n $start.setAttribute('offset', `${percentage * 100}%`);\n $stop.setAttribute('offset', `${percentage * 100}%`);\n }\n });\n\n art.on('ready', () => update());\n art.on('resize', () => update());\n art.on('artplayerPluginDanmuku:loaded', () => update());\n art.on('artplayerPluginDanmuku:points', (points) => update(points));\n },\n });\n}\n"],"names":["modules","entry","mainEntry","parcelRequireName","externals","distDir","publicUrl","devServer","globalObject","globalThis","self","window","global","previousRequire","importMap","i","cache","nodeRequire","module","require","bind","newRequire","name","jumped","currentRequire","err","Error","code","localRequire","resolve","x","id","Module","call","exports","res","isParcelRequire","moduleName","bundle","parent","register","Object","defineProperty","get","length","mainExports","define","amd","__globalThis","parcelHelpers","defineInteropFlag","export","artplayerPluginDanmuku","_danmuku","_danmukuDefault","interopDefault","_setting","_settingDefault","_heatmap","_heatmapDefault","option","art","danmuku","default","setting","heatmap","emit","load","config","hide","show","reset","mount","isHide","isStop","icons","_bilibili","_worker","_workerDefault","Danmuku","constructor","template","utils","validator","$danmuku","$player","queue","$refs","timer","index","states","wait","ready","stop","blob","Blob","replace","type","worker","Worker","URL","createObjectURL","start","resize","destroy","on","speed","margin","opacity","color","mode","modes","fontSize","antiOverlap","synchronousPlayback","undefined","width","points","filter","beforeEmit","beforeVisible","visible","emitter","maxLength","lockTime","theme","OPACITY","FONT_SIZE","MARGIN","SPEED","COLOR","scheme","cssText","isRotate","plugins","autoOrientation","state","marginTop","clamp","value","clientHeight","endsWith","parseFloat","marginBottom","Math","round","$ref","pop","document","createElement","style","dataset","className","readys","currentTime","result","danmu","push","time","visibles","clientWidth","clientLeft","getLeft","top","offsetTop","left","height","distance","$restTime","right","playbackRate","Number","errorHandle","danmus","target","Promise","bilibiliDanmuParseFromUrl","Array","isArray","innerText","error","text","border","trim","Infinity","includes","item","$state","$id","$lastStartTime","setState","$controlsCenter","keys","some","key","JSON","stringify","assign","rect","getBoundingClientRect","postMessage","message","Date","now","onmessage","event","data","callback","makeWait","visibility","marginLeft","transform","transition","update","setStyles","requestAnimationFrame","playing","emitTime","appendChild","backgroundColor","continue","suspend","translateX","cancelAnimationFrame","forEach","terminate","off","getMode","bilibiliDanmuParseFromXml","xmlString","reg","RegExp","from","matchAll","map","match","attr","groups","p","split","replaceAll","toString","timestamp","pool","userID","rowID","Boolean","xml","url","fetch","createWorker","a","__esModule","exportAll","source","dest","prototype","hasOwnProperty","enumerable","destName","_styleLess","_styleLessDefault","_onSvg","_onSvgDefault","_offSvg","_offSvgDefault","_configSvg","_configSvgDefault","_styleSvg","_styleSvgDefault","_mode0OffSvg","_mode0OffSvgDefault","_mode0OnSvg","_mode0OnSvgDefault","_mode1OffSvg","_mode1OffSvgDefault","_mode1OnSvg","_mode1OnSvgDefault","_mode2OffSvg","_mode2OffSvgDefault","_mode2OnSvg","_mode2OnSvgDefault","_checkOnSvg","_checkOnSvgDefault","_checkOffSvg","_checkOffSvgDefault","setStyle","$mount","$toggle","$config","$configPanel","$configModes","$style","$stylePanel","$styleModes","$colors","$opacitySlider","$opacityValue","$marginSlider","$marginValue","$fontSizeSlider","$fontSizeValue","$speedSlider","$speedValue","$input","$send","slider","emitting","isLock","createTemplate","createSliders","createEvents","onFullscreen","proxy","onMouseEnter","$control","$panel","$on","$off","$mode_0_off","$mode_0_on","$mode_1_off","$mode_1_on","$mode_2_off","$mode_2_on","$check_on","$check_off","outside","TEMPLATE","join","min","max","steps","query","selector","append","el","children","setData","tooltip","innerHTML","$antiOverlap","$syncVideo","$mode","closest","m","$color","preventDefault","createSlider","container","findIndex","onChange","textContent","step","$dot","$progress","isDroging","percentage","updateLeft","clientY","clientX","button","controlRect","panelRect","playerRect","half","lock","addClass","loop","setTimeout","unlock","removeClass","clearTimeout","fullscreen","fullscreenWeb","inverseClass","find","toUpperCase","$el","querySelector","getElementById","readyState","addEventListener","head","documentElement","lib","inMin","inMax","outMin","outMax","range","end","tick","s","floor","v","k","line","pointA","pointB","lengthX","lengthY","sqrt","pow","angle","atan2","controls","add","position","html","pointerEvents","mounted","$heatmap","$start","$stop","arg","duration","isLive","svg","w","offsetWidth","h","offsetHeight","options","xMin","xMax","yMin","yMax","scale","minHeight","sampling","smoothing","flattening","gap","y","lastPoint","lastX","lastY","yPoints","point","yMid","controlPoint","current","previous","next","reverse","o","flat","cos","PI","sin","bezierCommand","cps","cpe","close","pathD","pointsPositions","e","reduce","acc","setAttribute","played","_default","parcelRequire4dc0"],"version":3,"file":"index.js.map"} \ No newline at end of file +{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,A,Y,O,C,C,E,E,C,C,E,C,E,E,C,E,C,E,E,E,K,E,C,E,E,A,a,O,Q,A,Y,O,O,O,E,O,O,C,I,C,Q,S,E,C,C,C,E,G,C,C,C,E,C,C,G,C,C,C,E,C,C,G,C,C,E,C,O,C,C,E,C,I,E,A,Y,O,C,C,E,E,C,C,E,C,G,C,G,E,O,E,E,C,G,G,E,O,E,E,C,G,G,G,A,U,O,E,O,E,G,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,O,C,S,C,E,I,E,C,C,E,C,E,C,E,C,O,A,M,E,E,C,E,E,K,C,C,E,I,E,C,C,E,C,I,E,M,C,G,C,C,E,C,E,C,I,C,E,O,C,E,E,E,O,C,E,C,O,C,C,E,C,O,C,S,E,C,E,I,E,E,O,C,G,M,A,C,I,E,C,E,E,E,C,C,E,e,C,C,E,E,M,C,S,C,E,I,C,E,C,E,I,C,M,C,E,I,C,O,C,E,I,C,O,C,C,C,E,E,O,C,E,E,K,C,E,E,M,C,E,E,O,C,K,E,E,S,C,K,E,E,S,C,K,E,E,C,C,E,E,Q,C,S,C,C,C,E,C,C,E,C,C,S,C,C,C,E,E,O,C,C,E,C,E,A,E,O,c,C,E,O,C,I,W,O,C,C,E,A,C,G,C,C,E,C,E,I,I,E,E,E,E,M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,EACpD,EAAM,YAAY,CAAC,SAAU,CAAA,EAAG,AAAa,IAAb,EAAiB,CAAC,CAAC,EAE3D,GAEA,EAAI,EAAE,CAAC,QAAS,IAAM,KACtB,EAAI,EAAE,CAAC,SAAU,IAAM,KACvB,EAAI,EAAE,CAAC,gCAAiC,IAAM,KAC9C,EAAI,EAAE,CAAC,gCAAiC,AAAC,GAAW,EAAO,GAC/D,CACJ,EACJ,C,E,C,iD,O,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["","src/index.js","src/danmuku.js","src/bilibili.js","../../node_modules/@parcel/transformer-js/src/esmodule-helpers.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-2b9af4c751c9af0f.js","src/setting.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-dccb0d3065212e9e.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-d85a064dfde0d678.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-73f5a0f2cfb429eb.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-5c3216007e3a5d58.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-12ba311be953b248.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-de9c7e9efb8cb601.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-77d567d1f7edd248.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-cc88bf1e36f735fd.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-8a845466dee64975.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-5f8d4f0b11c9856f.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-9fdca1abf90117b8.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-6bb3abce7399b265.js","../../node_modules/@parcel/runtime-js/lib/bundles/runtime-0a27f24766a5efcc.js","src/heatmap.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (\n modules,\n entry,\n mainEntry,\n parcelRequireName,\n externals,\n distDir,\n publicUrl,\n devServer\n) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var importMap = previousRequire.i || {};\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof module.require === 'function' &&\n module.require.bind(module);\n\n function newRequire(name, jumped) {\n if (!cache[name]) {\n if (!modules[name]) {\n if (externals[name]) {\n return externals[name];\n }\n // if we cannot find the module within our internal map or\n // cache jump to the current global require ie. the last bundle\n // that was added to the page.\n var currentRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n if (!jumped && currentRequire) {\n return currentRequire(name, true);\n }\n\n // If there are other bundles on this page the require from the\n // previous one is saved to 'previousRequire'. Repeat this as\n // many times as there are bundles until the module is found or\n // we exhaust the require chain.\n if (previousRequire) {\n return previousRequire(name, true);\n }\n\n // Try the node require function if it exists.\n if (nodeRequire && typeof name === 'string') {\n return nodeRequire(name);\n }\n\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n }\n\n localRequire.resolve = resolve;\n localRequire.cache = {};\n\n var module = (cache[name] = new newRequire.Module(name));\n\n modules[name][0].call(\n module.exports,\n localRequire,\n module,\n module.exports,\n globalObject\n );\n }\n\n return cache[name].exports;\n\n function localRequire(x) {\n var res = localRequire.resolve(x);\n return res === false ? {} : newRequire(res);\n }\n\n function resolve(x) {\n var id = modules[name][1][x];\n return id != null ? id : x;\n }\n }\n\n function Module(moduleName) {\n this.id = moduleName;\n this.bundle = newRequire;\n this.require = nodeRequire;\n this.exports = {};\n }\n\n newRequire.isParcelRequire = true;\n newRequire.Module = Module;\n newRequire.modules = modules;\n newRequire.cache = cache;\n newRequire.parent = previousRequire;\n newRequire.distDir = distDir;\n newRequire.publicUrl = publicUrl;\n newRequire.devServer = devServer;\n newRequire.i = importMap;\n newRequire.register = function (id, exports) {\n modules[id] = [\n function (require, module) {\n module.exports = exports;\n },\n {},\n ];\n };\n\n // Only insert newRequire.load when it is actually used.\n // The code in this file is linted against ES5, so dynamic import is not allowed.\n // INSERT_LOAD_HERE\n\n Object.defineProperty(newRequire, 'root', {\n get: function () {\n return globalObject[parcelRequireName];\n },\n });\n\n globalObject[parcelRequireName] = newRequire;\n\n for (var i = 0; i < entry.length; i++) {\n newRequire(entry[i]);\n }\n\n if (mainEntry) {\n // Expose entry point to Node, AMD or browser globals\n // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js\n var mainExports = newRequire(mainEntry);\n\n // CommonJS\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n module.exports = mainExports;\n\n // RequireJS\n } else if (typeof define === 'function' && define.amd) {\n define(function () {\n return mainExports;\n });\n }\n }\n})({\"4omrA\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>artplayerPluginDanmuku);\nvar _danmuku = require(\"./danmuku\");\nvar _danmukuDefault = parcelHelpers.interopDefault(_danmuku);\nvar _setting = require(\"./setting\");\nvar _settingDefault = parcelHelpers.interopDefault(_setting);\nvar _heatmap = require(\"./heatmap\");\nvar _heatmapDefault = parcelHelpers.interopDefault(_heatmap);\nfunction artplayerPluginDanmuku(option) {\n return (art)=>{\n const danmuku = new (0, _danmukuDefault.default)(art, option);\n const setting = new (0, _settingDefault.default)(art, danmuku);\n if (danmuku.option.heatmap) (0, _heatmapDefault.default)(art, danmuku, danmuku.option.heatmap);\n return {\n name: 'artplayerPluginDanmuku',\n emit: danmuku.emit.bind(danmuku),\n load: danmuku.load.bind(danmuku),\n config: danmuku.config.bind(danmuku),\n hide: danmuku.hide.bind(danmuku),\n show: danmuku.show.bind(danmuku),\n reset: danmuku.reset.bind(danmuku),\n mount: setting.mount.bind(setting),\n get option () {\n return danmuku.option;\n },\n get isHide () {\n return danmuku.isHide;\n },\n get isStop () {\n return danmuku.isStop;\n }\n };\n };\n}\nartplayerPluginDanmuku.icons = (0, _settingDefault.default).icons;\nif (typeof window !== 'undefined') window['artplayerPluginDanmuku'] = artplayerPluginDanmuku;\n\n},{\"./danmuku\":\"3UaSK\",\"./setting\":\"jUZBE\",\"./heatmap\":\"kCWvn\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}],\"3UaSK\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nvar _bilibili = require(\"./bilibili\");\nvar _worker = require(\"bundle-text:./worker\");\nvar _workerDefault = parcelHelpers.interopDefault(_worker);\nclass Danmuku {\n constructor(art, option){\n const { constructor, template } = art;\n this.utils = constructor.utils; // 工具库\n this.validator = constructor.validator; // 配置校验器\n this.$danmuku = template.$danmuku; // 弹幕层容器\n this.$player = template.$player; // 播放器容器\n this.art = art;\n this.queue = []; // 实际弹幕队列\n this.$refs = []; // 弹幕DOM节点池\n this.isStop = false; // 是否停止\n this.isHide = false; // 是否隐藏\n this.timer = null; // 定时器\n this.index = 0; // 弹幕索引\n // 格式化后的配置项\n this.option = Danmuku.option;\n // 弹幕状态池\n this.states = {\n wait: [],\n ready: [],\n emit: [],\n stop: []\n };\n // 初始化配置\n this.config(option, true);\n // 创建 Web Worker, 用于计算弹幕的 top 值\n const workerText2 = (0, _workerDefault.default).replace('export{e as default};', '');\n const blob = new Blob([\n workerText2\n ], {\n type: 'application/javascript'\n });\n this.worker = new Worker(URL.createObjectURL(blob));\n // 绑定公用事件\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.reset = this.reset.bind(this);\n this.resize = this.resize.bind(this);\n this.destroy = this.destroy.bind(this);\n // 监听事件\n art.on('video:play', this.start);\n art.on('video:playing', this.start);\n art.on('video:pause', this.stop);\n art.on('video:waiting', this.stop);\n art.on('destroy', this.destroy);\n art.on('resize', this.resize);\n // 开始加载弹幕\n this.load();\n }\n // 默认配置\n static get option() {\n return {\n danmuku: [],\n speed: 5,\n margin: [\n 10,\n '25%'\n ],\n opacity: 1,\n color: '#FFFFFF',\n mode: 0,\n modes: [\n 0,\n 1,\n 2\n ],\n fontSize: 25,\n antiOverlap: true,\n synchronousPlayback: false,\n mount: undefined,\n heatmap: false,\n width: 512,\n points: [],\n filter: ()=>true,\n beforeEmit: ()=>true,\n beforeVisible: ()=>true,\n visible: true,\n emitter: true,\n maxLength: 200,\n lockTime: 5,\n theme: 'dark',\n OPACITY: {},\n FONT_SIZE: {},\n MARGIN: {},\n SPEED: {},\n COLOR: []\n };\n }\n // 配置校验\n static get scheme() {\n return {\n danmuku: 'array|function|string',\n speed: 'number',\n margin: 'array',\n opacity: 'number',\n color: 'string',\n mode: 'number',\n modes: 'array',\n fontSize: 'number|string',\n antiOverlap: 'boolean',\n synchronousPlayback: 'boolean',\n mount: '?htmldivelement|string',\n heatmap: 'object|boolean',\n width: 'number',\n points: 'array',\n filter: 'function',\n beforeEmit: 'function',\n beforeVisible: 'function',\n visible: 'boolean',\n emitter: 'boolean',\n maxLength: 'number',\n lockTime: 'number',\n theme: 'string',\n OPACITY: 'object',\n FONT_SIZE: 'object',\n MARGIN: 'object',\n SPEED: 'object',\n COLOR: 'array'\n };\n }\n // 初始弹幕样式\n static get cssText() {\n return `\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, \"Microsoft JhengHei\", Arial, Helvetica, sans-serif;\n 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;\n `;\n }\n // 是否在移动端使用了自动旋屏,会影响弹幕的left和top值\n get isRotate() {\n return this.art.plugins?.autoOrientation?.state;\n }\n // 计算上空白边距\n get marginTop() {\n const { clamp } = this.utils;\n const value = this.option.margin[0];\n const { clientHeight } = this.$player;\n if (typeof value === 'number') return clamp(value, 0, clientHeight);\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n return Danmuku.option.margin[0];\n }\n // 计算下空白边距\n get marginBottom() {\n const { clamp } = this.utils;\n const value = this.option.margin[1];\n const { clientHeight } = this.$player;\n if (typeof value === 'number') return clamp(value, 0, clientHeight);\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n return Danmuku.option.margin[1];\n }\n // 计算弹幕字体大小\n get fontSize() {\n const { clamp } = this.utils;\n const { clientHeight } = this.$player;\n const fontSize = this.option.fontSize;\n if (typeof fontSize === 'number') return Math.round(clamp(fontSize, 12, clientHeight));\n if (typeof fontSize === 'string' && fontSize.endsWith('%')) {\n const ratio = parseFloat(fontSize) / 100;\n return Math.round(clamp(clientHeight * ratio, 12, clientHeight));\n }\n return Danmuku.option.fontSize;\n }\n // 获取弹幕DOM节点\n get $ref() {\n const $ref = this.$refs.pop() || document.createElement('div');\n $ref.style.cssText = Danmuku.cssText;\n $ref.dataset.mode = '';\n $ref.className = '';\n return $ref;\n }\n // 获取准备好发送的弹幕\n get readys() {\n const { currentTime } = this.art;\n const result = [];\n // 有的是ready状态:之前因为弹幕太多而暂停发送的弹幕\n this.filter('ready', (danmu)=>result.push(danmu));\n // 有的是wait状态:符合时间范围的弹幕\n this.filter('wait', (danmu)=>{\n if (currentTime + 0.1 >= danmu.time && danmu.time >= currentTime - 0.1) result.push(danmu);\n });\n return result;\n }\n // 可见的弹幕的数据,用于计算下一个弹幕的top值\n get visibles() {\n const result = [];\n const { clientWidth } = this.$player;\n const clientLeft = this.getLeft(this.$player);\n this.filter('emit', (danmu)=>{\n const top = danmu.$ref.offsetTop;\n const left = this.getLeft(danmu.$ref) - clientLeft;\n const height = danmu.$ref.clientHeight;\n const width = danmu.$ref.clientWidth;\n const distance = left + width;\n const right = clientWidth - distance;\n const speed = distance / danmu.$restTime;\n const emit = {};\n emit.top = top;\n emit.left = left;\n emit.height = height;\n emit.width = width;\n emit.right = right;\n emit.speed = speed;\n emit.distance = distance;\n emit.time = danmu.$restTime;\n emit.mode = danmu.mode;\n result.push(emit);\n });\n return result;\n }\n // 计算弹幕速度\n get speed() {\n return this.option.synchronousPlayback && this.art.playbackRate ? this.option.speed / Number(this.art.playbackRate) : this.option.speed;\n }\n // 加载弹幕\n async load(danmuku) {\n const { errorHandle } = this.utils;\n let danmus = [];\n const target = danmuku || this.option.danmuku;\n try {\n if (typeof target === 'function') danmus = await target(); // 异步函数获取\n else if (target instanceof Promise) danmus = await target; // 从 Promise 对象获取\n else if (typeof target === 'string') danmus = await (0, _bilibili.bilibiliDanmuParseFromUrl)(target); // 从B站xml链接解析\n else if (Array.isArray(target)) danmus = target; // 直接传入数组\n errorHandle(Array.isArray(danmus), 'Danmuku need return an array as result');\n // 假如没有传入弹幕参数,则清空弹幕,否则追加弹幕\n if (danmuku === undefined) {\n this.reset(); // 重置弹幕\n this.queue = []; // 清空弹幕队列\n this.states = {\n wait: [],\n ready: [],\n emit: [],\n stop: []\n }; // 清空弹幕状态池\n this.$refs = []; // 清空弹幕DOM节点池\n this.$danmuku.innerText = ''; // 清空弹幕层\n }\n // 逐个验证原始弹幕并转换到弹幕队列\n for(let index = 0; index < danmus.length; index++){\n const danmu = danmus[index];\n await this.emit(danmu);\n }\n this.art.emit('artplayerPluginDanmuku:loaded', this.queue);\n } catch (error) {\n this.art.emit('artplayerPluginDanmuku:error', error);\n throw error;\n }\n return this;\n }\n // 把原始弹幕转换到弹幕队列\n async emit(danmu) {\n const { clamp } = this.utils;\n this.validator(danmu, {\n text: 'string',\n mode: '?number',\n color: '?string',\n time: '?number',\n border: '?boolean',\n style: '?object'\n });\n // 弹幕文本为空则直接忽略\n if (!danmu.text.trim()) return this;\n // 设置弹幕时间,如果没有则默认为当前时间加 0.5 秒\n if (danmu.time) danmu.time = clamp(danmu.time, 0, Infinity);\n else danmu.time = this.art.currentTime + 0.5;\n // 设置弹幕模式,如果没有则默认为全局配置\n if (danmu.mode === undefined) danmu.mode = this.option.mode;\n // 设置弹幕单独样式,如果没有则默认为空对象\n if (danmu.style === undefined) danmu.style = {};\n // 设置弹幕颜色,如果没有则默认为全局配置\n if (danmu.color === undefined) danmu.color = this.option.color;\n // 弹幕模式只能是 0, 1, 2\n if (![\n 0,\n 1,\n 2\n ].includes(danmu.mode)) return this;\n // 自定义弹幕过滤函数\n if (!this.option.filter(danmu)) return this;\n // 添加自定义属性\n const item = {\n ...danmu,\n $state: 'wait',\n $id: this.index++,\n $ref: null,\n $restTime: 0,\n $lastStartTime: 0\n };\n // 转换为wait状态\n this.setState(item, 'wait');\n // 添加到实际弹幕队列\n this.queue.push(item);\n // 弹幕有四个状态:\n // - wait: 弹幕还未开始显示,没有被添加到 DOM 中\n // - ready: 弹幕准备好显示,没有被添加到 DOM 中\n // - emit: 弹幕正在显示,已经被添加到 DOM 中\n // - stop: 弹幕正在停止显示,已经被添加到 DOM 中\n return this;\n }\n // 动态配置\n config(option, isInit = false) {\n const { clamp } = this.utils;\n const { $controlsCenter } = this.art.template;\n // 判断配置项是否有变化\n const changed = Object.keys(option).some((key)=>JSON.stringify(this.option[key]) !== JSON.stringify(option[key]));\n // 没有变化则直接返回\n if (!changed && !isInit) return this;\n // 更新配置项\n this.option = Object.assign({}, Danmuku.option, this.option, option);\n this.validator(this.option, Danmuku.scheme);\n this.option.mode = clamp(this.option.mode, 0, 2);\n this.option.speed = clamp(this.option.speed, 1, 10);\n this.option.opacity = clamp(this.option.opacity, 0, 1);\n this.option.lockTime = clamp(this.option.lockTime, 1, 60);\n this.option.maxLength = clamp(this.option.maxLength, 1, 1000);\n this.option.mount = this.option.mount || $controlsCenter;\n // 动态配置有字体大小,需要重新渲染\n if (option.fontSize) this.reset();\n // 通过配置项控制弹幕的显示和隐藏\n if (this.option.visible) this.show();\n else this.hide();\n this.art.emit('artplayerPluginDanmuku:config', this.option);\n return this;\n }\n // 计算DOM的left值,受到旋屏影响\n getLeft($ref) {\n const rect = $ref.getBoundingClientRect();\n return this.isRotate ? rect.top : rect.left;\n }\n // 复杂运算交给 Web Worker 处理\n postMessage(message = {}) {\n return new Promise((resolve)=>{\n message.id = Date.now(); // 生成唯一标识\n this.worker.postMessage(message);\n this.worker.onmessage = (event)=>{\n const { data } = event;\n // 判断是否是当前的消息\n if (data.id === message.id) resolve(data);\n };\n });\n }\n // 根据状态获取弹幕\n filter(state, callback) {\n const danmus = this.states[state] || [];\n for(let index = 0; index < danmus.length; index++)callback(danmus[index]);\n return danmus;\n }\n // 设置弹幕状态\n setState(danmu, state) {\n // 从原状态池中删除\n this.states[danmu.$state] = this.states[danmu.$state].filter((item)=>item !== danmu);\n // 设置新状态\n danmu.$state = state;\n // 设置DOM节点状态\n if (danmu.$ref) danmu.$ref.dataset.state = state;\n // 添加到新状态池中\n this.states[state].push(danmu);\n }\n // 重置弹幕到wait状态,回收弹幕DOM节点\n makeWait(danmu) {\n this.setState(danmu, 'wait');\n if (danmu.$ref) {\n danmu.$ref.style.cssText = Danmuku.cssText;\n danmu.$ref.style.visibility = 'hidden';\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = 'translateX(0px)';\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n // 实时更新弹幕\n update() {\n const { setStyles } = this.utils;\n this.timer = window.requestAnimationFrame(async ()=>{\n if (this.art.playing && !this.isHide) {\n // 实时计算弹幕的剩余显示时间\n this.filter('emit', (danmu)=>{\n const emitTime = (Date.now() - danmu.$lastStartTime) / 1000;\n danmu.$restTime -= emitTime;\n danmu.$lastStartTime = Date.now();\n // 超过时间即重置弹幕\n if (danmu.$restTime <= 0) this.makeWait(danmu);\n });\n // 获取准备好发送的弹幕,可能包含ready和wait状态的弹幕\n const readys = this.readys;\n for(let index = 0; index < readys.length; index++){\n const danmu = readys[index];\n // 弹幕发送前的过滤器\n const state = await this.option.beforeVisible(danmu);\n if (state) {\n const { clientWidth, clientHeight } = this.$player;\n danmu.$ref = this.$ref; // 获取弹幕DOM节点\n danmu.$ref.innerText = danmu.text; // 设置弹幕文本\n // 提前添加到弹幕层中,用于计算top值\n this.$danmuku.appendChild(danmu.$ref);\n // 设置初始弹幕样式\n danmu.$ref.style.opacity = this.option.opacity;\n danmu.$ref.style.fontSize = `${this.fontSize}px`;\n danmu.$ref.style.color = danmu.color;\n danmu.$ref.style.border = danmu.border ? `1px solid ${danmu.color}` : null;\n danmu.$ref.style.backgroundColor = danmu.border ? 'rgb(0 0 0 / 50%)' : null;\n // 设置单独弹幕样式\n setStyles(danmu.$ref, danmu.style);\n // 记录弹幕时间戳\n danmu.$lastStartTime = Date.now();\n // 计算弹幕剩余时间\n danmu.$restTime = this.speed;\n // 计算弹幕滚动的距离\n const distance = clientWidth + danmu.$ref.clientWidth;\n // 计算弹幕的top值\n const { result: top } = await this.postMessage({\n type: 'getDanmuTop',\n target: {\n mode: danmu.mode,\n height: danmu.$ref.clientHeight,\n speed: distance / danmu.$restTime\n },\n visibles: this.visibles,\n antiOverlap: this.option.antiOverlap,\n clientWidth: clientWidth,\n clientHeight: clientHeight,\n marginBottom: this.marginBottom,\n marginTop: this.marginTop\n });\n if (danmu.$ref) {\n if (!this.isStop && top !== undefined) {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$ref.style.top = `${top}px`;\n danmu.$ref.style.visibility = 'visible';\n danmu.$ref.dataset.mode = danmu.mode; // CSS控制模式的显示和隐藏\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n case 1:\n // falls through\n case 2:\n danmu.$ref.style.left = '50%';\n danmu.$ref.style.marginLeft = `-${danmu.$ref.clientWidth / 2}px`;\n break;\n default:\n break;\n }\n this.art.emit('artplayerPluginDanmuku:visible', danmu);\n } else {\n // 假如弹幕已经停止或者没有 top 值,则重置弹幕为ready状态,回收弹幕DOM节点,等待下次发送\n this.setState(danmu, 'ready');\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n }\n }\n }\n // 递归调用\n if (!this.isStop) this.update();\n });\n return this;\n }\n // 重置正在显示的弹幕: stop/emit 状态的弹幕\n resize() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu)=>{\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n break;\n default:\n break;\n }\n });\n this.filter('emit', (danmu)=>{\n danmu.$lastStartTime = Date.now();\n switch(danmu.mode){\n // 滚动的弹幕\n case 0:\n {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n }\n // 继续弹幕\n continue() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu)=>{\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$lastStartTime = Date.now();\n switch(danmu.mode){\n // 继续滚动的弹幕\n case 0:\n {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n return this;\n }\n // 暂停弹幕\n suspend() {\n const { clientWidth } = this.$player;\n this.filter('emit', (danmu)=>{\n this.setState(danmu, 'stop'); // 转换为stop状态\n switch(danmu.mode){\n // 停止滚动的弹幕\n case 0:\n {\n const translateX = clientWidth - (this.getLeft(danmu.$ref) - this.getLeft(this.$player));\n danmu.$ref.style.transform = `translateX(${-translateX}px)`;\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n break;\n }\n default:\n break;\n }\n });\n return this;\n }\n stop() {\n this.isStop = true;\n this.suspend();\n window.cancelAnimationFrame(this.timer);\n this.art.emit('artplayerPluginDanmuku:stop');\n return this;\n }\n start() {\n this.isStop = false;\n this.continue();\n this.update();\n this.art.emit('artplayerPluginDanmuku:start');\n return this;\n }\n reset() {\n this.queue.forEach((danmu)=>this.makeWait(danmu));\n this.art.emit('artplayerPluginDanmuku:reset');\n return this;\n }\n show() {\n this.isHide = false;\n this.$danmuku.style.opacity = 1;\n this.option.visible = true;\n this.art.emit('artplayerPluginDanmuku:show');\n return this;\n }\n hide() {\n this.isHide = true;\n this.$danmuku.style.opacity = 0;\n this.option.visible = false;\n this.art.emit('artplayerPluginDanmuku:hide');\n return this;\n }\n destroy() {\n this.stop();\n this.worker.terminate();\n this.art.off('video:play', this.start);\n this.art.off('video:playing', this.start);\n this.art.off('video:pause', this.stop);\n this.art.off('video:waiting', this.stop);\n this.art.off('resize', this.reset);\n this.art.off('destroy', this.destroy);\n this.art.emit('artplayerPluginDanmuku:destroy');\n }\n}\nexports.default = Danmuku;\n\n},{\"./bilibili\":\"lLE5f\",\"bundle-text:./worker\":\"2to4T\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}],\"lLE5f\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"bilibiliDanmuParseFromUrl\", ()=>bilibiliDanmuParseFromUrl);\nfunction getMode(key) {\n switch(key){\n case 1:\n case 2:\n case 3:\n return 0;\n case 4:\n return 2;\n case 5:\n return 1;\n default:\n return 0;\n }\n}\nfunction bilibiliDanmuParseFromXml(xmlString) {\n if (typeof xmlString !== 'string') return [];\n const reg = new RegExp(/.+?)\"(?: .*?)?>(?.+?)<\\/d>/gs);\n const matches = xmlString.matchAll(reg);\n return Array.from(matches).map((match)=>{\n const attr = match.groups.p.split(',');\n if (attr.length >= 8) {\n const text = match.groups.text.trim().replaceAll('"', '\"').replaceAll(''', \"'\").replaceAll('<', '<').replaceAll('>', '>').replaceAll('&', '&');\n return {\n text,\n time: Number(attr[0]),\n mode: getMode(Number(attr[1])),\n fontSize: Number(attr[2]),\n color: `#${Number(attr[3]).toString(16)}`,\n timestamp: Number(attr[4]),\n pool: Number(attr[5]),\n userID: attr[6],\n rowID: Number(attr[7])\n };\n } else return null;\n }).filter(Boolean);\n}\nfunction onmessage({ data }) {\n const { xml, id } = data;\n if (!id || !xml) return;\n const danmus = bilibiliDanmuParseFromXml(xml);\n self.postMessage({\n danmus,\n id\n });\n}\nfunction createWorker() {\n const workerText = `\n ${getMode.toString()}\n ${bilibiliDanmuParseFromXml.toString()}\n onmessage = ${onmessage.toString()}\n `;\n const blob = new Blob([\n workerText\n ], {\n type: 'application/javascript'\n });\n return new Worker(URL.createObjectURL(blob));\n}\nfunction bilibiliDanmuParseFromUrl(url) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve)=>{\n const res = await fetch(url);\n const xml = await res.text();\n try {\n const worker = createWorker();\n worker.onmessage = (event)=>{\n const { danmus, id } = event.data;\n if (!id || !danmus) return;\n resolve(danmus);\n worker.terminate();\n };\n worker.postMessage({\n xml,\n id: Date.now()\n });\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n const danmus = bilibiliDanmuParseFromXml(xml);\n resolve(danmus);\n }\n });\n}\n\n},{\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}],\"w4pLy\":[function(require,module,exports,__globalThis) {\nexports.interopDefault = function(a) {\n return a && a.__esModule ? a : {\n default: a\n };\n};\nexports.defineInteropFlag = function(a) {\n Object.defineProperty(a, '__esModule', {\n value: true\n });\n};\nexports.exportAll = function(source, dest) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return;\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function() {\n return source[key];\n }\n });\n });\n return dest;\n};\nexports.export = function(dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get\n });\n};\n\n},{}],\"2to4T\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"!function(e,t,i,r,o,n,d,f){var l=\\\"undefined\\\"!=typeof globalThis?globalThis:\\\"undefined\\\"!=typeof self?self:\\\"undefined\\\"!=typeof window?window:\\\"undefined\\\"!=typeof global?global:{},u=\\\"function\\\"==typeof l[r]&&l[r],h=u.i||{},p=u.cache||{},s=\\\"undefined\\\"!=typeof module&&\\\"function\\\"==typeof module.require&&module.require.bind(module);function a(t,i){if(!p[t]){if(!e[t]){if(o[t])return o[t];var n=\\\"function\\\"==typeof l[r]&&l[r];if(!i&&n)return n(t,!0);if(u)return u(t,!0);if(s&&\\\"string\\\"==typeof t)return s(t);var d=Error(\\\"Cannot find module '\\\"+t+\\\"'\\\");throw d.code=\\\"MODULE_NOT_FOUND\\\",d}h.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},h.cache={};var f=p[t]=new a.Module(t);e[t][0].call(f.exports,h,f,f.exports,l)}return p[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=s,this.exports={}},a.modules=e,a.cache=p,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=h,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,\\\"root\\\",{get:function(){return l[r]}}),l[r]=a;for(var c=0;ct.mode===e.mode&&t.top<=f).sort((e,t)=>e.top-t.top);if(0===l.length)if(2===e.mode)return f-e.height;else return n;if(l.unshift({type:\\\"top\\\",top:0,left:0,right:0,height:n,width:i,speed:0,distance:i}),l.push({type:\\\"bottom\\\",top:f,left:0,right:0,height:o,width:i,speed:0,distance:i}),2===e.mode)for(let t=l.length-2;t>=0;t-=1){let i=l[t],r=l[t+1],o=i.top+i.height;if(r.top-o>=e.height)return r.top-e.height}else for(let t=1;t=e.height)return o}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),r=Math.min(...e.map(e=>e.right));return i*t.length-r*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},[\\\"dETh6\\\"],\\\"dETh6\\\",\\\"parcelRequire93cf\\\",{});let{\\\"*\\\":e}=parcelRequire93cf(\\\"dETh6\\\");export{e as default};\";\n\n},{}],\"jUZBE\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nvar _styleLess = require(\"bundle-text:./style.less\");\nvar _styleLessDefault = parcelHelpers.interopDefault(_styleLess);\nvar _onSvg = require(\"bundle-text:./img/on.svg\");\nvar _onSvgDefault = parcelHelpers.interopDefault(_onSvg);\nvar _offSvg = require(\"bundle-text:./img/off.svg\");\nvar _offSvgDefault = parcelHelpers.interopDefault(_offSvg);\nvar _configSvg = require(\"bundle-text:./img/config.svg\");\nvar _configSvgDefault = parcelHelpers.interopDefault(_configSvg);\nvar _styleSvg = require(\"bundle-text:./img/style.svg\");\nvar _styleSvgDefault = parcelHelpers.interopDefault(_styleSvg);\nvar _mode0OffSvg = require(\"bundle-text:./img/mode_0_off.svg\");\nvar _mode0OffSvgDefault = parcelHelpers.interopDefault(_mode0OffSvg);\nvar _mode0OnSvg = require(\"bundle-text:./img/mode_0_on.svg\");\nvar _mode0OnSvgDefault = parcelHelpers.interopDefault(_mode0OnSvg);\nvar _mode1OffSvg = require(\"bundle-text:./img/mode_1_off.svg\");\nvar _mode1OffSvgDefault = parcelHelpers.interopDefault(_mode1OffSvg);\nvar _mode1OnSvg = require(\"bundle-text:./img/mode_1_on.svg\");\nvar _mode1OnSvgDefault = parcelHelpers.interopDefault(_mode1OnSvg);\nvar _mode2OffSvg = require(\"bundle-text:./img/mode_2_off.svg\");\nvar _mode2OffSvgDefault = parcelHelpers.interopDefault(_mode2OffSvg);\nvar _mode2OnSvg = require(\"bundle-text:./img/mode_2_on.svg\");\nvar _mode2OnSvgDefault = parcelHelpers.interopDefault(_mode2OnSvg);\nvar _checkOnSvg = require(\"bundle-text:./img/check_on.svg\");\nvar _checkOnSvgDefault = parcelHelpers.interopDefault(_checkOnSvg);\nvar _checkOffSvg = require(\"bundle-text:./img/check_off.svg\");\nvar _checkOffSvgDefault = parcelHelpers.interopDefault(_checkOffSvg);\nclass Setting {\n constructor(art, danmuku){\n this.art = art;\n this.danmuku = danmuku;\n this.utils = art.constructor.utils;\n const { setStyle } = this.utils;\n const { $controlsCenter } = art.template;\n setStyle($controlsCenter, 'display', 'flex');\n this.template = {\n $controlsCenter,\n $mount: $controlsCenter,\n $danmuku: null,\n $toggle: null,\n $config: null,\n $configPanel: null,\n $configModes: null,\n $style: null,\n $stylePanel: null,\n $styleModes: null,\n $colors: null,\n $opacitySlider: null,\n $opacityValue: null,\n $marginSlider: null,\n $marginValue: null,\n $fontSizeSlider: null,\n $fontSizeValue: null,\n $speedSlider: null,\n $speedValue: null,\n $input: null,\n $send: null\n };\n this.slider = {\n opacity: null,\n margin: null,\n fontSize: null,\n speed: null\n };\n this.emitting = false;\n this.isLock = false;\n this.timer = null;\n this.createTemplate();\n this.createSliders();\n this.createEvents();\n this.mount(this.option.mount);\n art.on('resize', ()=>this.resize());\n art.on('fullscreen', (state)=>this.onFullscreen(state));\n art.on('fullscreenWeb', (state)=>this.onFullscreen(state));\n art.proxy(this.template.$config, 'mouseenter', ()=>{\n this.onMouseEnter({\n $control: this.template.$config,\n $panel: this.template.$configPanel\n });\n });\n art.proxy(this.template.$style, 'mouseenter', ()=>{\n this.onMouseEnter({\n $control: this.template.$style,\n $panel: this.template.$stylePanel\n });\n });\n }\n static get icons() {\n return {\n $on: (0, _onSvgDefault.default),\n $off: (0, _offSvgDefault.default),\n $config: (0, _configSvgDefault.default),\n $style: (0, _styleSvgDefault.default),\n $mode_0_off: (0, _mode0OffSvgDefault.default),\n $mode_0_on: (0, _mode0OnSvgDefault.default),\n $mode_1_off: (0, _mode1OffSvgDefault.default),\n $mode_1_on: (0, _mode1OnSvgDefault.default),\n $mode_2_off: (0, _mode2OffSvgDefault.default),\n $mode_2_on: (0, _mode2OnSvgDefault.default),\n $check_on: (0, _checkOnSvgDefault.default),\n $check_off: (0, _checkOffSvgDefault.default)\n };\n }\n get option() {\n return this.danmuku.option;\n }\n get outside() {\n return this.template.$mount !== this.template.$controlsCenter;\n }\n get TEMPLATE() {\n const { option } = this;\n return `\n
\n ${0, _onSvgDefault.default}${0, _offSvgDefault.default}\n
\n
\n ${0, _configSvgDefault.default}\n
\n
\n
\n \\u{6309}\\u{7C7B}\\u{578B}\\u{5C4F}\\u{853D}\n
\n
\n ${0, _mode0OffSvgDefault.default}${0, _mode0OnSvgDefault.default}\n
\\u{6EDA}\\u{52A8}
\n
\n
\n ${0, _mode1OffSvgDefault.default}${0, _mode1OnSvgDefault.default}\n
\\u{9876}\\u{90E8}
\n
\n
\n ${0, _mode2OffSvgDefault.default}${0, _mode2OnSvgDefault.default}\n
\\u{5E95}\\u{90E8}
\n
\n
\n
\n
\n
\n ${0, _checkOnSvgDefault.default}${0, _checkOffSvgDefault.default}\n \\u{9632}\\u{6B62}\\u{5F39}\\u{5E55}\\u{91CD}\\u{53E0}\n
\n
\n ${0, _checkOnSvgDefault.default}${0, _checkOffSvgDefault.default}\n \\u{540C}\\u{6B65}\\u{89C6}\\u{9891}\\u{901F}\\u{5EA6}\n
\n
\n
\n \\u{4E0D}\\u{900F}\\u{660E}\\u{5EA6}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{663E}\\u{793A}\\u{533A}\\u{57DF}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{5F39}\\u{5E55}\\u{5B57}\\u{53F7}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n \\u{5F39}\\u{5E55}\\u{901F}\\u{5EA6}\n
\n
\\u{672A}\\u{77E5}
\n
\n
\n
\n
\n
\n
\n ${0, _styleSvgDefault.default}\n
\n
\n
\n \\u{6A21}\\u{5F0F}\n
\n
\n ${0, _mode0OnSvgDefault.default}\n
\\u{6EDA}\\u{52A8}
\n
\n
\n ${0, _mode1OnSvgDefault.default}\n
\\u{9876}\\u{90E8}
\n
\n
\n ${0, _mode2OnSvgDefault.default}\n
\\u{5E95}\\u{90E8}
\n
\n
\n
\n
\n \\u{989C}\\u{8272}\n
\n ${this.COLOR.map((color)=>`
`).join('')}\n
\n
\n
\n
\n
\n \n
\\u{53D1}\\u{9001}
\n
\n `;\n }\n get OPACITY() {\n return {\n min: 0,\n max: 100,\n steps: [],\n ...this.option.OPACITY\n };\n }\n get FONT_SIZE() {\n return {\n min: 12,\n max: 120,\n steps: [],\n ...this.option.FONT_SIZE\n };\n }\n get MARGIN() {\n return {\n min: 0,\n max: 3,\n steps: [\n {\n name: '1/4',\n value: [\n 10,\n '75%'\n ]\n },\n {\n name: \"\\u534A\\u5C4F\",\n value: [\n 10,\n '50%'\n ]\n },\n {\n name: '3/4',\n value: [\n 10,\n '25%'\n ]\n },\n {\n name: \"\\u6EE1\\u5C4F\",\n value: [\n 10,\n 10\n ]\n }\n ],\n ...this.option.MARGIN\n };\n }\n get SPEED() {\n return {\n min: 0,\n max: 4,\n steps: [\n {\n name: \"\\u6781\\u6162\",\n value: 10\n },\n {\n name: \"\\u8F83\\u6162\",\n value: 7.5,\n hide: true\n },\n {\n name: \"\\u9002\\u4E2D\",\n value: 5\n },\n {\n name: \"\\u8F83\\u5FEB\",\n value: 2.5,\n hide: true\n },\n {\n name: \"\\u6781\\u5FEB\",\n value: 1\n }\n ],\n ...this.option.SPEED\n };\n }\n get COLOR() {\n return this.option.COLOR.length ? this.option.COLOR : [\n '#FE0302',\n '#FF7204',\n '#FFAA02',\n '#FFD302',\n '#FFFF00',\n '#A0EE00',\n '#00CD00',\n '#019899',\n '#4266BE',\n '#89D5FF',\n '#CC0273',\n '#222222',\n '#9B9B9B',\n '#FFFFFF'\n ];\n }\n query(selector) {\n const { query } = this.utils;\n const { $danmuku } = this.template;\n return query(selector, $danmuku);\n }\n append(el, target) {\n const { append } = this.utils;\n const children = [\n ...el.children\n ];\n if (children.some((item)=>item === target)) return;\n append(el, target);\n }\n setData(key, value) {\n const { $player } = this.art.template;\n const { $mount } = this.template;\n $player.dataset[key] = value;\n if (this.outside) $mount.dataset[key] = value;\n }\n createTemplate() {\n const { createElement, tooltip } = this.utils;\n const $danmuku = createElement('div');\n $danmuku.className = 'artplayer-plugin-danmuku';\n $danmuku.innerHTML = this.TEMPLATE;\n this.template.$danmuku = $danmuku;\n this.template.$toggle = this.query('.apd-toggle');\n this.template.$config = this.query('.apd-config');\n this.template.$configPanel = this.query('.apd-config-panel');\n this.template.$configModes = this.query('.apd-config-mode .apd-modes');\n this.template.$style = this.query('.apd-style');\n this.template.$stylePanel = this.query('.apd-style-panel');\n this.template.$styleModes = this.query('.apd-style-mode .apd-modes');\n this.template.$colors = this.query('.apd-colors');\n this.template.$antiOverlap = this.query('.apd-anti-overlap');\n this.template.$syncVideo = this.query('.apd-sync-video');\n this.template.$opacitySlider = this.query('.apd-config-opacity .apd-slider');\n this.template.$opacityValue = this.query('.apd-config-opacity .apd-value');\n this.template.$marginSlider = this.query('.apd-config-margin .apd-slider');\n this.template.$marginValue = this.query('.apd-config-margin .apd-value');\n this.template.$fontSizeSlider = this.query('.apd-config-fontSize .apd-slider');\n this.template.$fontSizeValue = this.query('.apd-config-fontSize .apd-value');\n this.template.$speedSlider = this.query('.apd-config-speed .apd-slider');\n this.template.$speedValue = this.query('.apd-config-speed .apd-value');\n this.template.$input = this.query('.apd-input');\n this.template.$send = this.query('.apd-send');\n const { $toggle } = this.template;\n this.art.on('artplayerPluginDanmuku:show', ()=>{\n tooltip($toggle, \"\\u5173\\u95ED\\u5F39\\u5E55\");\n });\n this.art.on('artplayerPluginDanmuku:hide', ()=>{\n tooltip($toggle, \"\\u6253\\u5F00\\u5F39\\u5E55\");\n });\n }\n createEvents() {\n const { $toggle, $configModes, $styleModes, $colors, $antiOverlap, $syncVideo, $send, $input } = this.template;\n this.art.proxy($toggle, 'click', ()=>{\n this.danmuku.config({\n visible: !this.option.visible\n });\n this.reset();\n });\n this.art.proxy($configModes, 'click', (event)=>{\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n if (this.option.modes.includes(mode)) this.danmuku.config({\n modes: this.option.modes.filter((m)=>m !== mode)\n });\n else this.danmuku.config({\n modes: [\n ...this.option.modes,\n mode\n ]\n });\n this.reset();\n });\n this.art.proxy($antiOverlap, 'click', ()=>{\n this.danmuku.config({\n antiOverlap: !this.option.antiOverlap\n });\n this.reset();\n });\n this.art.proxy($syncVideo, 'click', ()=>{\n this.danmuku.config({\n synchronousPlayback: !this.option.synchronousPlayback\n });\n this.reset();\n });\n this.art.proxy($styleModes, 'click', (event)=>{\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n this.danmuku.config({\n mode: mode\n });\n this.reset();\n });\n this.art.proxy($colors, 'click', (event)=>{\n const $color = event.target.closest('.apd-color');\n if (!$color) return;\n this.danmuku.config({\n color: $color.dataset.color\n });\n this.reset();\n });\n this.art.proxy($send, 'click', ()=>this.emit());\n this.art.proxy($input, 'keypress', (event)=>{\n if (event.key === 'Enter') {\n event.preventDefault();\n this.emit();\n }\n });\n }\n createSliders() {\n this.slider.opacity = this.createSlider({\n ...this.OPACITY,\n container: this.template.$opacitySlider,\n findIndex: ()=>{\n return Math.round(this.option.opacity * 100);\n },\n onChange: (index)=>{\n const { $opacityValue } = this.template;\n $opacityValue.textContent = `${index}%`;\n this.danmuku.config({\n opacity: index / 100\n });\n }\n });\n this.slider.margin = this.createSlider({\n ...this.MARGIN,\n container: this.template.$marginSlider,\n findIndex: ()=>{\n return this.MARGIN.steps.findIndex((item)=>item.value[0] === this.option.margin[0] && item.value[1] === this.option.margin[1]);\n },\n onChange: (index)=>{\n const margin = this.MARGIN.steps[index];\n if (!margin) return;\n const { $marginValue } = this.template;\n $marginValue.textContent = margin.name;\n this.danmuku.config({\n margin: margin.value\n });\n }\n });\n this.slider.fontSize = this.createSlider({\n ...this.FONT_SIZE,\n container: this.template.$fontSizeSlider,\n findIndex: ()=>{\n return this.danmuku.fontSize;\n },\n onChange: (index)=>{\n const { $fontSizeValue } = this.template;\n $fontSizeValue.textContent = `${index}px`;\n if (index === this.danmuku.fontSize) return;\n this.danmuku.config({\n fontSize: index\n });\n }\n });\n this.slider.speed = this.createSlider({\n ...this.SPEED,\n container: this.template.$speedSlider,\n findIndex: ()=>{\n return this.SPEED.steps.findIndex((item)=>item.value === this.option.speed);\n },\n onChange: (index)=>{\n const speed = this.SPEED.steps[index];\n if (!speed) return;\n const { $speedValue } = this.template;\n $speedValue.textContent = speed.name;\n this.danmuku.config({\n speed: speed.value\n });\n }\n });\n }\n createSlider({ min, max, container, findIndex, onChange, steps = [] }) {\n const { query, clamp, setStyle } = this.utils;\n setStyle(container, 'touch-action', 'none');\n container.innerHTML = `\n
\n
\n ${steps.map(()=>`
`).join('')}\n
\n
\n
\n
\n
\n ${steps.map((step)=>step.hide ? '' : `
${step.name}
`).join('')}\n
\n `;\n const $dot = query('.apd-slider-dot', container);\n const $progress = query('.apd-slider-progress', container);\n let isDroging = false;\n function reset(index = findIndex()) {\n if (index < min || index > max) return;\n const percentage = (index - min) / (max - min);\n $dot.style.left = `${percentage * 100}%`;\n if (steps.length === 0) $progress.style.width = $dot.style.left;\n onChange(index);\n }\n function updateLeft(event) {\n const { top, height, left, width } = container.getBoundingClientRect();\n if (this.art.isRotate) {\n const value = clamp(event.clientY - top, 0, height);\n const index = Math.round(value / height * (max - min) + min);\n reset(index);\n } else {\n const value = clamp(event.clientX - left, 0, width);\n const index = Math.round(value / width * (max - min) + min);\n reset(index);\n }\n }\n this.art.proxy(container, 'click', (event)=>{\n updateLeft.call(this, event);\n });\n this.art.proxy(container, 'pointerdown', (event)=>{\n isDroging = event.button === 0;\n });\n this.art.proxy(document, 'pointermove', (event)=>{\n if (isDroging) updateLeft.call(this, event);\n });\n this.art.proxy(document, 'pointerup', (event)=>{\n if (isDroging) {\n isDroging = false;\n updateLeft.call(this, event);\n }\n });\n return {\n reset\n };\n }\n onFullscreen(state) {\n const { $danmuku, $controlsCenter, $mount } = this.template;\n if (this.outside) {\n if (state) this.append($controlsCenter, $danmuku);\n else this.append($mount, $danmuku);\n } else this.append($controlsCenter, $danmuku);\n }\n onMouseEnter({ $control, $panel }) {\n const { $player } = this.art.template;\n const controlRect = $control.getBoundingClientRect();\n const panelRect = $panel.getBoundingClientRect();\n const playerRect = $player.getBoundingClientRect();\n const half = panelRect.width / 2 - controlRect.width / 2;\n const left = playerRect.left - (controlRect.left - half);\n const right = controlRect.right + half - playerRect.right;\n if (left > 0) $panel.style.left = `${-half + left}px`;\n else if (right > 0) $panel.style.left = `${-half - right}px`;\n else $panel.style.left = `${-half}px`;\n }\n async emit() {\n const { $input } = this.template;\n const text = $input.value.trim();\n if (!text.length) return;\n if (this.isLock) return;\n if (this.emitting) return;\n const danmu = {\n text: text,\n mode: this.option.mode,\n color: this.option.color,\n time: this.art.currentTime\n };\n try {\n this.emitting = true;\n const state = await this.option.beforeEmit(danmu);\n this.emitting = false;\n if (state !== true) return;\n danmu.border = true;\n delete danmu.time;\n this.danmuku.emit(danmu);\n $input.value = '';\n this.lock();\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n this.emitting = false;\n }\n }\n lock() {\n const { addClass } = this.utils;\n const { $send } = this.template;\n this.isLock = true;\n let time = this.option.lockTime;\n $send.innerText = time;\n addClass($send, 'apd-lock');\n const loop = ()=>{\n this.timer = setTimeout(()=>{\n if (time === 0) this.unlock();\n else {\n time -= 1;\n $send.innerText = time;\n loop();\n }\n }, 1000);\n };\n loop();\n }\n unlock() {\n const { removeClass } = this.utils;\n const { $send } = this.template;\n clearTimeout(this.timer);\n this.isLock = false;\n $send.innerText = \"\\u53D1\\u9001\";\n removeClass($send, 'apd-lock');\n }\n resize() {\n if (this.outside) return;\n if (this.art.fullscreen) return;\n if (this.art.fullscreenWeb) return;\n const { $player, $controlsCenter } = this.art.template;\n const { $danmuku } = this.template;\n if (this.art.width < this.option.width) this.append($player, $danmuku);\n else this.append($controlsCenter, $danmuku);\n }\n reset() {\n const { inverseClass, tooltip } = this.utils;\n const { $toggle, $colors } = this.template;\n this.slider.opacity.reset();\n this.slider.margin.reset();\n this.slider.fontSize.reset();\n this.slider.speed.reset();\n this.setData('danmukuVisible', this.option.visible);\n this.setData('danmukuMode', this.option.mode);\n this.setData('danmukuColor', this.option.color);\n this.setData('danmukuMode0', this.option.modes.includes(0));\n this.setData('danmukuMode1', this.option.modes.includes(1));\n this.setData('danmukuMode2', this.option.modes.includes(2));\n this.setData('danmukuAntiOverlap', this.option.antiOverlap);\n this.setData('danmukuSyncVideo', this.option.synchronousPlayback);\n this.setData('danmukuTheme', this.option.theme);\n this.setData('danmukuEmitter', this.option.emitter);\n const colors = $colors.children;\n const $color = Array.from(colors).find((item)=>item.dataset.color === this.option.color.toUpperCase());\n $color && inverseClass($color, 'apd-active');\n tooltip($toggle, this.option.visible ? \"\\u5173\\u95ED\\u5F39\\u5E55\" : \"\\u6253\\u5F00\\u5F39\\u5E55\");\n this.resize();\n }\n mount(target) {\n const { errorHandle } = this.utils;\n const $el = typeof target === 'string' ? document.querySelector(target) : target;\n errorHandle($el, `Can not find the mount point: ${target}`);\n this.append($el, this.template.$danmuku);\n this.template.$mount = $el;\n this.reset();\n }\n}\nexports.default = Setting;\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-danmuku';\n let $style = document.getElementById(id);\n if (!$style) {\n $style = document.createElement('style');\n $style.id = id;\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', ()=>{\n document.head.appendChild($style);\n });\n else (document.head || document.documentElement).appendChild($style);\n }\n $style.textContent = (0, _styleLessDefault.default);\n}\n\n},{\"bundle-text:./style.less\":\"lDhE1\",\"bundle-text:./img/on.svg\":\"eIVgK\",\"bundle-text:./img/off.svg\":\"ikaFC\",\"bundle-text:./img/config.svg\":\"4rX4v\",\"bundle-text:./img/style.svg\":\"7QZb5\",\"bundle-text:./img/mode_0_off.svg\":\"emfRo\",\"bundle-text:./img/mode_0_on.svg\":\"hgDUE\",\"bundle-text:./img/mode_1_off.svg\":\"c2dTL\",\"bundle-text:./img/mode_1_on.svg\":\"gDNkp\",\"bundle-text:./img/mode_2_off.svg\":\"04dKo\",\"bundle-text:./img/mode_2_on.svg\":\"dT4Rc\",\"bundle-text:./img/check_on.svg\":\"l7wFs\",\"bundle-text:./img/check_off.svg\":\"2rFnr\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}],\"lDhE1\":[function(require,module,exports,__globalThis) {\nmodule.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}\";\n\n},{}],\"eIVgK\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"ikaFC\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"4rX4v\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"7QZb5\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"emfRo\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"hgDUE\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"c2dTL\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"gDNkp\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"04dKo\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"dT4Rc\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"l7wFs\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"2rFnr\":[function(require,module,exports,__globalThis) {\nmodule.exports = \"\";\n\n},{}],\"kCWvn\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>heatmap);\nconst lib = {\n map (value, inMin, inMax, outMin, outMax) {\n return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;\n },\n range (start, end, tick) {\n const s = Math.round(start / tick) * tick;\n return Array.from({\n length: Math.floor((end - start) / tick)\n }, (v, k)=>{\n return k * tick + s;\n });\n }\n};\nconst line = (pointA, pointB)=>{\n const lengthX = pointB[0] - pointA[0];\n const lengthY = pointB[1] - pointA[1];\n return {\n length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),\n angle: Math.atan2(lengthY, lengthX)\n };\n};\nfunction heatmap(art, danmuku, option) {\n const { query } = art.constructor.utils;\n art.controls.add({\n name: 'heatmap',\n position: 'top',\n html: '',\n style: {\n position: 'absolute',\n top: '-100px',\n left: '0px',\n right: '0px',\n height: '100px',\n width: '100%',\n pointerEvents: 'none'\n },\n mounted ($heatmap) {\n let $start = null;\n let $stop = null;\n function update(arg = []) {\n $start = null;\n $stop = null;\n $heatmap.innerHTML = '';\n if (!art.duration || art.option.isLive) return;\n const svg = {\n w: $heatmap.offsetWidth,\n h: $heatmap.offsetHeight\n };\n const options = {\n xMin: 0,\n xMax: svg.w,\n yMin: 0,\n yMax: 128,\n scale: 0.25,\n opacity: 0.2,\n minHeight: Math.floor(svg.h * 0.05),\n sampling: Math.floor(svg.w / 100),\n smoothing: 0.2,\n flattening: 0.2\n };\n if (typeof option === 'object') Object.assign(options, option);\n let points = [];\n if (Array.isArray(arg) && arg.length) points = [\n ...arg\n ];\n else {\n const gap = art.duration / svg.w;\n for(let x = 0; x <= svg.w; x += options.sampling){\n const y = danmuku.queue.filter(({ time })=>time > x * gap && time <= (x + options.sampling) * gap).length;\n points.push([\n x,\n y\n ]);\n }\n }\n if (points.length === 0) return;\n const lastPoint = points[points.length - 1];\n const lastX = lastPoint[0];\n const lastY = lastPoint[1];\n if (lastX !== svg.w) points.push([\n svg.w,\n lastY\n ]);\n const yPoints = points.map((point)=>point[1]);\n const yMin = Math.min(...yPoints);\n const yMax = Math.max(...yPoints);\n const yMid = (yMin + yMax) / 2;\n for(let i = 0; i < points.length; i++){\n const point = points[i];\n const y = point[1];\n point[1] = y * (y > yMid ? 1 + options.scale : 1 - options.scale) + options.minHeight;\n }\n const controlPoint = (current, previous, next, reverse)=>{\n const p = previous || current;\n const n = next || current;\n const o = line(p, n);\n const flat = lib.map(Math.cos(o.angle) * options.flattening, 0, 1, 1, 0);\n const angle = o.angle * flat + (reverse ? Math.PI : 0);\n const length = o.length * options.smoothing;\n const x = current[0] + Math.cos(angle) * length;\n const y = current[1] + Math.sin(angle) * length;\n return [\n x,\n y\n ];\n };\n const bezierCommand = (point, i, a)=>{\n const cps = controlPoint(a[i - 1], a[i - 2], point);\n const cpe = controlPoint(point, a[i - 1], a[i + 1], true);\n const close = i === a.length - 1 ? ' z' : '';\n return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}${close}`;\n };\n const pointsPositions = points.map((e)=>{\n const x = lib.map(e[0], options.xMin, options.xMax, 0, svg.w);\n const y = lib.map(e[1], options.yMin, options.yMax, svg.h, 0);\n return [\n x,\n y\n ];\n });\n const pathD = pointsPositions.reduce((acc, e, i, a)=>i === 0 ? `M ${a[a.length - 1][0]},${svg.h} L ${e[0]},${svg.h} L ${e[0]},${e[1]}` : `${acc} ${bezierCommand(e, i, a)}`, '');\n $heatmap.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n `;\n $start = query('#heatmap-start', $heatmap);\n $stop = query('#heatmap-stop', $heatmap);\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n art.on('video:timeupdate', ()=>{\n if ($start && $stop) {\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n });\n art.on('setBar', (type, percentage)=>{\n if ($start && $stop && type === 'played') {\n $start.setAttribute('offset', `${percentage * 100}%`);\n $stop.setAttribute('offset', `${percentage * 100}%`);\n }\n });\n art.on('ready', ()=>update());\n art.on('resize', ()=>update());\n art.on('artplayerPluginDanmuku:loaded', ()=>update());\n art.on('artplayerPluginDanmuku:points', (points)=>update(points));\n }\n });\n}\n\n},{\"@parcel/transformer-js/src/esmodule-helpers.js\":\"w4pLy\"}]},[\"4omrA\"], \"4omrA\", \"parcelRequire93cf\", {})\nlet {default: _default, } = parcelRequire93cf(\"4omrA\");\nexport {_default as default, };\n\n//# sourceMappingURL=index.js.map\n","import Danmuku from './danmuku';\nimport Setting from './setting';\nimport heatmap from './heatmap';\n\nexport default function artplayerPluginDanmuku(option) {\n return (art) => {\n const danmuku = new Danmuku(art, option);\n const setting = new Setting(art, danmuku);\n\n if (danmuku.option.heatmap) {\n heatmap(art, danmuku, danmuku.option.heatmap);\n }\n\n return {\n name: 'artplayerPluginDanmuku',\n emit: danmuku.emit.bind(danmuku),\n load: danmuku.load.bind(danmuku),\n config: danmuku.config.bind(danmuku),\n hide: danmuku.hide.bind(danmuku),\n show: danmuku.show.bind(danmuku),\n reset: danmuku.reset.bind(danmuku),\n mount: setting.mount.bind(setting),\n get option() {\n return danmuku.option;\n },\n get isHide() {\n return danmuku.isHide;\n },\n get isStop() {\n return danmuku.isStop;\n },\n };\n };\n}\n\nartplayerPluginDanmuku.icons = Setting.icons;\n\nif (typeof window !== 'undefined') {\n window['artplayerPluginDanmuku'] = artplayerPluginDanmuku;\n}\n","import { bilibiliDanmuParseFromUrl } from './bilibili';\nimport workerText from 'bundle-text:./worker';\n\nexport default class Danmuku {\n constructor(art, option) {\n const { constructor, template } = art;\n\n this.utils = constructor.utils; // 工具库\n this.validator = constructor.validator; // 配置校验器\n this.$danmuku = template.$danmuku; // 弹幕层容器\n this.$player = template.$player; // 播放器容器\n\n this.art = art;\n this.queue = []; // 实际弹幕队列\n this.$refs = []; // 弹幕DOM节点池\n this.isStop = false; // 是否停止\n this.isHide = false; // 是否隐藏\n this.timer = null; // 定时器\n this.index = 0; // 弹幕索引\n\n // 格式化后的配置项\n this.option = Danmuku.option;\n\n // 弹幕状态池\n this.states = { wait: [], ready: [], emit: [], stop: [] };\n\n // 初始化配置\n this.config(option, true);\n\n // 创建 Web Worker, 用于计算弹幕的 top 值\n const workerText2 = workerText.replace('export{e as default};', '');\n const blob = new Blob([workerText2], { type: 'application/javascript' });\n this.worker = new Worker(URL.createObjectURL(blob));\n\n // 绑定公用事件\n this.start = this.start.bind(this);\n this.stop = this.stop.bind(this);\n this.reset = this.reset.bind(this);\n this.resize = this.resize.bind(this);\n this.destroy = this.destroy.bind(this);\n\n // 监听事件\n art.on('video:play', this.start);\n art.on('video:playing', this.start);\n art.on('video:pause', this.stop);\n art.on('video:waiting', this.stop);\n art.on('destroy', this.destroy);\n art.on('resize', this.resize);\n\n // 开始加载弹幕\n this.load();\n }\n\n // 默认配置\n static get option() {\n return {\n danmuku: [], // 弹幕数据\n speed: 5, // 弹幕持续时间,范围在[1 ~ 10]\n margin: [10, '25%'], // 弹幕上下边距,支持像素数字和百分比\n opacity: 1, // 弹幕透明度,范围在[0 ~ 1]\n color: '#FFFFFF', // 默认弹幕颜色,可以被单独弹幕项覆盖\n mode: 0, // 默认弹幕模式: 0: 滚动,1: 顶部,2: 底部\n modes: [0, 1, 2], // 弹幕可见的模式\n fontSize: 25, // 弹幕字体大小,支持像素数字和百分比\n antiOverlap: true, // 弹幕是否防重叠\n synchronousPlayback: false, // 是否同步播放速度\n mount: undefined, // 弹幕发射器挂载点, 默认为播放器控制栏中部\n heatmap: false, // 是否开启热力图\n width: 512, // 当播放器宽度小于此值时,弹幕发射器置于播放器底部\n points: [], // 热力图数据\n filter: () => true, // 弹幕载入前的过滤器,只支持返回布尔值\n beforeEmit: () => true, // 弹幕发送前的过滤器,支持返回 Promise\n beforeVisible: () => true, // 弹幕显示前的过滤器,支持返回 Promise\n visible: true, // 弹幕层是否可见\n emitter: true, // 是否开启弹幕发射器\n maxLength: 200, // 弹幕输入框最大长度, 范围在[1 ~ 1000]\n lockTime: 5, // 输入框锁定时间,范围在[1 ~ 60]\n theme: 'dark', // 弹幕主题,支持 dark 和 light,只在自定义挂载时生效\n OPACITY: {}, // 不透明度配置项\n FONT_SIZE: {}, // 弹幕字号配置项\n MARGIN: {}, // 显示区域配置项\n SPEED: {}, // 弹幕速度配置项\n COLOR: [], // 颜色列表配置项\n };\n }\n\n // 配置校验\n static get scheme() {\n return {\n danmuku: 'array|function|string',\n speed: 'number',\n margin: 'array',\n opacity: 'number',\n color: 'string',\n mode: 'number',\n modes: 'array',\n fontSize: 'number|string',\n antiOverlap: 'boolean',\n synchronousPlayback: 'boolean',\n mount: '?htmldivelement|string',\n heatmap: 'object|boolean',\n width: 'number',\n points: 'array',\n filter: 'function',\n beforeEmit: 'function',\n beforeVisible: 'function',\n visible: 'boolean',\n emitter: 'boolean',\n maxLength: 'number',\n lockTime: 'number',\n theme: 'string',\n OPACITY: 'object',\n FONT_SIZE: 'object',\n MARGIN: 'object',\n SPEED: 'object',\n COLOR: 'array',\n };\n }\n\n // 初始弹幕样式\n static get cssText() {\n return `\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, \"Microsoft JhengHei\", Arial, Helvetica, sans-serif;\n 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;\n `;\n }\n\n // 是否在移动端使用了自动旋屏,会影响弹幕的left和top值\n get isRotate() {\n return this.art.plugins?.autoOrientation?.state;\n }\n\n // 计算上空白边距\n get marginTop() {\n const { clamp } = this.utils;\n const value = this.option.margin[0];\n const { clientHeight } = this.$player;\n\n if (typeof value === 'number') {\n return clamp(value, 0, clientHeight);\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n\n return Danmuku.option.margin[0];\n }\n\n // 计算下空白边距\n get marginBottom() {\n const { clamp } = this.utils;\n const value = this.option.margin[1];\n const { clientHeight } = this.$player;\n\n if (typeof value === 'number') {\n return clamp(value, 0, clientHeight);\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n const ratio = parseFloat(value) / 100;\n return clamp(clientHeight * ratio, 0, clientHeight);\n }\n\n return Danmuku.option.margin[1];\n }\n\n // 计算弹幕字体大小\n get fontSize() {\n const { clamp } = this.utils;\n const { clientHeight } = this.$player;\n\n const fontSize = this.option.fontSize;\n\n if (typeof fontSize === 'number') {\n return Math.round(clamp(fontSize, 12, clientHeight));\n }\n\n if (typeof fontSize === 'string' && fontSize.endsWith('%')) {\n const ratio = parseFloat(fontSize) / 100;\n return Math.round(clamp(clientHeight * ratio, 12, clientHeight));\n }\n\n return Danmuku.option.fontSize;\n }\n\n // 获取弹幕DOM节点\n get $ref() {\n const $ref = this.$refs.pop() || document.createElement('div');\n $ref.style.cssText = Danmuku.cssText;\n $ref.dataset.mode = '';\n $ref.className = '';\n return $ref;\n }\n\n // 获取准备好发送的弹幕\n get readys() {\n const { currentTime } = this.art;\n\n const result = [];\n\n // 有的是ready状态:之前因为弹幕太多而暂停发送的弹幕\n this.filter('ready', (danmu) => result.push(danmu));\n\n // 有的是wait状态:符合时间范围的弹幕\n this.filter('wait', (danmu) => {\n if (currentTime + 0.1 >= danmu.time && danmu.time >= currentTime - 0.1) {\n result.push(danmu);\n }\n });\n\n return result;\n }\n\n // 可见的弹幕的数据,用于计算下一个弹幕的top值\n get visibles() {\n const result = [];\n const { clientWidth } = this.$player;\n const clientLeft = this.getLeft(this.$player);\n\n this.filter('emit', (danmu) => {\n const top = danmu.$ref.offsetTop;\n const left = this.getLeft(danmu.$ref) - clientLeft;\n const height = danmu.$ref.clientHeight;\n const width = danmu.$ref.clientWidth;\n const distance = left + width;\n const right = clientWidth - distance;\n const speed = distance / danmu.$restTime;\n\n const emit = {};\n emit.top = top;\n emit.left = left;\n emit.height = height;\n emit.width = width;\n emit.right = right;\n emit.speed = speed;\n emit.distance = distance;\n emit.time = danmu.$restTime;\n emit.mode = danmu.mode;\n\n result.push(emit);\n });\n\n return result;\n }\n\n // 计算弹幕速度\n get speed() {\n return this.option.synchronousPlayback && this.art.playbackRate\n ? this.option.speed / Number(this.art.playbackRate)\n : this.option.speed;\n }\n\n // 加载弹幕\n async load(danmuku) {\n const { errorHandle } = this.utils;\n\n let danmus = [];\n const target = danmuku || this.option.danmuku;\n\n try {\n if (typeof target === 'function') {\n danmus = await target(); // 异步函数获取\n } else if (target instanceof Promise) {\n danmus = await target; // 从 Promise 对象获取\n } else if (typeof target === 'string') {\n danmus = await bilibiliDanmuParseFromUrl(target); // 从B站xml链接解析\n } else if (Array.isArray(target)) {\n danmus = target; // 直接传入数组\n }\n\n errorHandle(Array.isArray(danmus), 'Danmuku need return an array as result');\n\n // 假如没有传入弹幕参数,则清空弹幕,否则追加弹幕\n if (danmuku === undefined) {\n this.reset(); // 重置弹幕\n this.queue = []; // 清空弹幕队列\n this.states = { wait: [], ready: [], emit: [], stop: [] }; // 清空弹幕状态池\n this.$refs = []; // 清空弹幕DOM节点池\n this.$danmuku.innerText = ''; // 清空弹幕层\n }\n\n // 逐个验证原始弹幕并转换到弹幕队列\n for (let index = 0; index < danmus.length; index++) {\n const danmu = danmus[index];\n await this.emit(danmu);\n }\n\n this.art.emit('artplayerPluginDanmuku:loaded', this.queue);\n } catch (error) {\n this.art.emit('artplayerPluginDanmuku:error', error);\n throw error;\n }\n\n return this;\n }\n\n // 把原始弹幕转换到弹幕队列\n async emit(danmu) {\n const { clamp } = this.utils;\n\n this.validator(danmu, {\n text: 'string', // 弹幕文本\n mode: '?number', // 弹幕模式: 0: 滚动,1: 顶部,2: 底部\n color: '?string', // 弹幕颜色\n time: '?number', // 弹幕时间\n border: '?boolean', // 弹幕是否有边框\n style: '?object', // 弹幕额外样式\n });\n\n // 弹幕文本为空则直接忽略\n if (!danmu.text.trim()) return this;\n\n // 设置弹幕时间,如果没有则默认为当前时间加 0.5 秒\n if (danmu.time) {\n danmu.time = clamp(danmu.time, 0, Infinity);\n } else {\n danmu.time = this.art.currentTime + 0.5;\n }\n\n // 设置弹幕模式,如果没有则默认为全局配置\n if (danmu.mode === undefined) {\n danmu.mode = this.option.mode;\n }\n\n // 设置弹幕单独样式,如果没有则默认为空对象\n if (danmu.style === undefined) {\n danmu.style = {};\n }\n\n // 设置弹幕颜色,如果没有则默认为全局配置\n if (danmu.color === undefined) {\n danmu.color = this.option.color;\n }\n\n // 弹幕模式只能是 0, 1, 2\n if (![0, 1, 2].includes(danmu.mode)) return this;\n\n // 自定义弹幕过滤函数\n if (!this.option.filter(danmu)) return this;\n\n // 添加自定义属性\n const item = {\n ...danmu,\n $state: 'wait', // 弹幕初始状态\n $id: this.index++, // 弹幕唯一标识\n $ref: null, // 弹幕 DOM 节点\n $restTime: 0, // 弹幕剩余时间\n $lastStartTime: 0, // 弹幕上次开始时间\n };\n\n // 转换为wait状态\n this.setState(item, 'wait');\n\n // 添加到实际弹幕队列\n this.queue.push(item);\n\n // 弹幕有四个状态:\n // - wait: 弹幕还未开始显示,没有被添加到 DOM 中\n // - ready: 弹幕准备好显示,没有被添加到 DOM 中\n // - emit: 弹幕正在显示,已经被添加到 DOM 中\n // - stop: 弹幕正在停止显示,已经被添加到 DOM 中\n\n return this;\n }\n\n // 动态配置\n config(option, isInit = false) {\n const { clamp } = this.utils;\n const { $controlsCenter } = this.art.template;\n\n // 判断配置项是否有变化\n const changed = Object.keys(option).some(\n (key) => JSON.stringify(this.option[key]) !== JSON.stringify(option[key]),\n );\n\n // 没有变化则直接返回\n if (!changed && !isInit) return this;\n\n // 更新配置项\n this.option = Object.assign({}, Danmuku.option, this.option, option);\n this.validator(this.option, Danmuku.scheme);\n\n this.option.mode = clamp(this.option.mode, 0, 2);\n this.option.speed = clamp(this.option.speed, 1, 10);\n this.option.opacity = clamp(this.option.opacity, 0, 1);\n this.option.lockTime = clamp(this.option.lockTime, 1, 60);\n this.option.maxLength = clamp(this.option.maxLength, 1, 1000);\n this.option.mount = this.option.mount || $controlsCenter;\n\n // 动态配置有字体大小,需要重新渲染\n if (option.fontSize) {\n this.reset();\n }\n\n // 通过配置项控制弹幕的显示和隐藏\n if (this.option.visible) {\n this.show();\n } else {\n this.hide();\n }\n\n this.art.emit('artplayerPluginDanmuku:config', this.option);\n\n return this;\n }\n\n // 计算DOM的left值,受到旋屏影响\n getLeft($ref) {\n const rect = $ref.getBoundingClientRect();\n return this.isRotate ? rect.top : rect.left;\n }\n\n // 复杂运算交给 Web Worker 处理\n postMessage(message = {}) {\n return new Promise((resolve) => {\n message.id = Date.now(); // 生成唯一标识\n this.worker.postMessage(message);\n this.worker.onmessage = (event) => {\n const { data } = event;\n // 判断是否是当前的消息\n if (data.id === message.id) {\n resolve(data);\n }\n };\n });\n }\n\n // 根据状态获取弹幕\n filter(state, callback) {\n const danmus = this.states[state] || [];\n for (let index = 0; index < danmus.length; index++) {\n callback(danmus[index]);\n }\n return danmus;\n }\n\n // 设置弹幕状态\n setState(danmu, state) {\n // 从原状态池中删除\n this.states[danmu.$state] = this.states[danmu.$state].filter((item) => item !== danmu);\n\n // 设置新状态\n danmu.$state = state;\n\n // 设置DOM节点状态\n if (danmu.$ref) {\n danmu.$ref.dataset.state = state;\n }\n\n // 添加到新状态池中\n this.states[state].push(danmu);\n }\n\n // 重置弹幕到wait状态,回收弹幕DOM节点\n makeWait(danmu) {\n this.setState(danmu, 'wait');\n if (danmu.$ref) {\n danmu.$ref.style.cssText = Danmuku.cssText;\n danmu.$ref.style.visibility = 'hidden';\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = 'translateX(0px)';\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n\n // 实时更新弹幕\n update() {\n const { setStyles } = this.utils;\n\n this.timer = window.requestAnimationFrame(async () => {\n if (this.art.playing && !this.isHide) {\n // 实时计算弹幕的剩余显示时间\n this.filter('emit', (danmu) => {\n const emitTime = (Date.now() - danmu.$lastStartTime) / 1000;\n danmu.$restTime -= emitTime;\n danmu.$lastStartTime = Date.now();\n // 超过时间即重置弹幕\n if (danmu.$restTime <= 0) {\n this.makeWait(danmu);\n }\n });\n\n // 获取准备好发送的弹幕,可能包含ready和wait状态的弹幕\n const readys = this.readys;\n\n for (let index = 0; index < readys.length; index++) {\n const danmu = readys[index];\n\n // 弹幕发送前的过滤器\n const state = await this.option.beforeVisible(danmu);\n\n if (state) {\n const { clientWidth, clientHeight } = this.$player;\n danmu.$ref = this.$ref; // 获取弹幕DOM节点\n danmu.$ref.innerText = danmu.text; // 设置弹幕文本\n\n // 提前添加到弹幕层中,用于计算top值\n this.$danmuku.appendChild(danmu.$ref);\n\n // 设置初始弹幕样式\n danmu.$ref.style.opacity = this.option.opacity;\n danmu.$ref.style.fontSize = `${this.fontSize}px`;\n danmu.$ref.style.color = danmu.color;\n danmu.$ref.style.border = danmu.border ? `1px solid ${danmu.color}` : null;\n danmu.$ref.style.backgroundColor = danmu.border ? 'rgb(0 0 0 / 50%)' : null;\n\n // 设置单独弹幕样式\n setStyles(danmu.$ref, danmu.style);\n\n // 记录弹幕时间戳\n danmu.$lastStartTime = Date.now();\n\n // 计算弹幕剩余时间\n danmu.$restTime = this.speed;\n\n // 计算弹幕滚动的距离\n const distance = clientWidth + danmu.$ref.clientWidth;\n\n // 计算弹幕的top值\n const { result: top } = await this.postMessage({\n type: 'getDanmuTop',\n target: {\n mode: danmu.mode,\n height: danmu.$ref.clientHeight,\n speed: distance / danmu.$restTime,\n }, // 当前弹幕信息\n visibles: this.visibles, // 可见的弹幕的数据\n antiOverlap: this.option.antiOverlap,\n clientWidth: clientWidth,\n clientHeight: clientHeight,\n marginBottom: this.marginBottom,\n marginTop: this.marginTop,\n });\n\n if (danmu.$ref) {\n if (!this.isStop && top !== undefined) {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$ref.style.top = `${top}px`;\n danmu.$ref.style.visibility = 'visible';\n danmu.$ref.dataset.mode = danmu.mode; // CSS控制模式的显示和隐藏\n\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0: {\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.marginLeft = '0px';\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n case 1:\n // falls through\n case 2:\n danmu.$ref.style.left = '50%';\n danmu.$ref.style.marginLeft = `-${danmu.$ref.clientWidth / 2}px`;\n break;\n default:\n break;\n }\n\n this.art.emit('artplayerPluginDanmuku:visible', danmu);\n } else {\n // 假如弹幕已经停止或者没有 top 值,则重置弹幕为ready状态,回收弹幕DOM节点,等待下次发送\n this.setState(danmu, 'ready');\n this.$refs.push(danmu.$ref);\n danmu.$ref = null;\n }\n }\n }\n }\n }\n\n // 递归调用\n if (!this.isStop) {\n this.update();\n }\n });\n return this;\n }\n\n // 重置正在显示的弹幕: stop/emit 状态的弹幕\n resize() {\n const { clientWidth } = this.$player;\n\n this.filter('stop', (danmu) => {\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0:\n danmu.$ref.style.left = `${clientWidth}px`;\n break;\n default:\n break;\n }\n });\n\n this.filter('emit', (danmu) => {\n danmu.$lastStartTime = Date.now();\n switch (danmu.mode) {\n // 滚动的弹幕\n case 0: {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.left = `${clientWidth}px`;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n }\n\n // 继续弹幕\n continue() {\n const { clientWidth } = this.$player;\n this.filter('stop', (danmu) => {\n this.setState(danmu, 'emit'); // 转换为emit状态\n danmu.$lastStartTime = Date.now();\n switch (danmu.mode) {\n // 继续滚动的弹幕\n case 0: {\n const distance = clientWidth + danmu.$ref.clientWidth;\n danmu.$ref.style.transform = `translateX(${-distance}px)`;\n danmu.$ref.style.transition = `transform ${danmu.$restTime}s linear 0s`;\n break;\n }\n default:\n break;\n }\n });\n\n return this;\n }\n\n // 暂停弹幕\n suspend() {\n const { clientWidth } = this.$player;\n this.filter('emit', (danmu) => {\n this.setState(danmu, 'stop'); // 转换为stop状态\n switch (danmu.mode) {\n // 停止滚动的弹幕\n case 0: {\n const translateX = clientWidth - (this.getLeft(danmu.$ref) - this.getLeft(this.$player));\n danmu.$ref.style.transform = `translateX(${-translateX}px)`;\n danmu.$ref.style.transition = 'transform 0s linear 0s';\n break;\n }\n default:\n break;\n }\n });\n\n return this;\n }\n\n stop() {\n this.isStop = true;\n this.suspend();\n window.cancelAnimationFrame(this.timer);\n this.art.emit('artplayerPluginDanmuku:stop');\n return this;\n }\n\n start() {\n this.isStop = false;\n this.continue();\n this.update();\n this.art.emit('artplayerPluginDanmuku:start');\n return this;\n }\n\n reset() {\n this.queue.forEach((danmu) => this.makeWait(danmu));\n this.art.emit('artplayerPluginDanmuku:reset');\n return this;\n }\n\n show() {\n this.isHide = false;\n this.$danmuku.style.opacity = 1;\n this.option.visible = true;\n this.art.emit('artplayerPluginDanmuku:show');\n return this;\n }\n\n hide() {\n this.isHide = true;\n this.$danmuku.style.opacity = 0;\n this.option.visible = false;\n this.art.emit('artplayerPluginDanmuku:hide');\n return this;\n }\n\n destroy() {\n this.stop();\n this.worker.terminate();\n this.art.off('video:play', this.start);\n this.art.off('video:playing', this.start);\n this.art.off('video:pause', this.stop);\n this.art.off('video:waiting', this.stop);\n this.art.off('resize', this.reset);\n this.art.off('destroy', this.destroy);\n this.art.emit('artplayerPluginDanmuku:destroy');\n }\n}\n","function getMode(key) {\n switch (key) {\n case 1:\n case 2:\n case 3:\n return 0;\n case 4:\n return 2;\n case 5:\n return 1;\n default:\n return 0;\n }\n}\n\nfunction bilibiliDanmuParseFromXml(xmlString) {\n if (typeof xmlString !== 'string') return [];\n const reg = new RegExp(/.+?)\"(?: .*?)?>(?.+?)<\\/d>/gs);\n const matches = xmlString.matchAll(reg);\n return Array.from(matches)\n .map((match) => {\n const attr = match.groups.p.split(',');\n if (attr.length >= 8) {\n const text = match.groups.text\n .trim()\n .replaceAll('"', '\"')\n .replaceAll(''', \"'\")\n .replaceAll('<', '<')\n .replaceAll('>', '>')\n .replaceAll('&', '&');\n\n return {\n text,\n time: Number(attr[0]),\n mode: getMode(Number(attr[1])),\n fontSize: Number(attr[2]),\n color: `#${Number(attr[3]).toString(16)}`,\n timestamp: Number(attr[4]),\n pool: Number(attr[5]),\n userID: attr[6],\n rowID: Number(attr[7]),\n };\n } else {\n return null;\n }\n })\n .filter(Boolean);\n}\n\nfunction onmessage({ data }) {\n const { xml, id } = data;\n if (!id || !xml) return;\n const danmus = bilibiliDanmuParseFromXml(xml);\n self.postMessage({ danmus, id });\n}\n\nfunction createWorker() {\n const workerText = `\n ${getMode.toString()}\n ${bilibiliDanmuParseFromXml.toString()}\n onmessage = ${onmessage.toString()}\n `;\n const blob = new Blob([workerText], { type: 'application/javascript' });\n return new Worker(URL.createObjectURL(blob));\n}\n\nexport function bilibiliDanmuParseFromUrl(url) {\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve) => {\n const res = await fetch(url);\n const xml = await res.text();\n\n try {\n const worker = createWorker();\n worker.onmessage = (event) => {\n const { danmus, id } = event.data;\n if (!id || !danmus) return;\n resolve(danmus);\n worker.terminate();\n };\n worker.postMessage({ xml, id: Date.now() });\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n const danmus = bilibiliDanmuParseFromXml(xml);\n resolve(danmus);\n }\n });\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n","module.exports = \"c420afa03d5d12c1\";","import style from 'bundle-text:./style.less';\nimport $on from 'bundle-text:./img/on.svg';\nimport $off from 'bundle-text:./img/off.svg';\nimport $config from 'bundle-text:./img/config.svg';\nimport $style from 'bundle-text:./img/style.svg';\nimport $mode_0_off from 'bundle-text:./img/mode_0_off.svg';\nimport $mode_0_on from 'bundle-text:./img/mode_0_on.svg';\nimport $mode_1_off from 'bundle-text:./img/mode_1_off.svg';\nimport $mode_1_on from 'bundle-text:./img/mode_1_on.svg';\nimport $mode_2_off from 'bundle-text:./img/mode_2_off.svg';\nimport $mode_2_on from 'bundle-text:./img/mode_2_on.svg';\nimport $check_on from 'bundle-text:./img/check_on.svg';\nimport $check_off from 'bundle-text:./img/check_off.svg';\n\nexport default class Setting {\n constructor(art, danmuku) {\n this.art = art;\n this.danmuku = danmuku;\n this.utils = art.constructor.utils;\n\n const { setStyle } = this.utils;\n const { $controlsCenter } = art.template;\n setStyle($controlsCenter, 'display', 'flex');\n\n this.template = {\n $controlsCenter,\n $mount: $controlsCenter,\n $danmuku: null,\n $toggle: null,\n $config: null,\n $configPanel: null,\n $configModes: null,\n $style: null,\n $stylePanel: null,\n $styleModes: null,\n $colors: null,\n $opacitySlider: null,\n $opacityValue: null,\n $marginSlider: null,\n $marginValue: null,\n $fontSizeSlider: null,\n $fontSizeValue: null,\n $speedSlider: null,\n $speedValue: null,\n $input: null,\n $send: null,\n };\n\n this.slider = {\n opacity: null,\n margin: null,\n fontSize: null,\n speed: null,\n };\n\n this.emitting = false;\n this.isLock = false;\n this.timer = null;\n\n this.createTemplate();\n this.createSliders();\n this.createEvents();\n\n this.mount(this.option.mount);\n\n art.on('resize', () => this.resize());\n art.on('fullscreen', (state) => this.onFullscreen(state));\n art.on('fullscreenWeb', (state) => this.onFullscreen(state));\n\n art.proxy(this.template.$config, 'mouseenter', () => {\n this.onMouseEnter({\n $control: this.template.$config,\n $panel: this.template.$configPanel,\n });\n });\n\n art.proxy(this.template.$style, 'mouseenter', () => {\n this.onMouseEnter({\n $control: this.template.$style,\n $panel: this.template.$stylePanel,\n });\n });\n }\n\n static get icons() {\n return {\n $on,\n $off,\n $config,\n $style,\n $mode_0_off,\n $mode_0_on,\n $mode_1_off,\n $mode_1_on,\n $mode_2_off,\n $mode_2_on,\n $check_on,\n $check_off,\n };\n }\n\n get option() {\n return this.danmuku.option;\n }\n\n get outside() {\n return this.template.$mount !== this.template.$controlsCenter;\n }\n\n get TEMPLATE() {\n const { option } = this;\n return `\n
\n ${$on}${$off}\n
\n
\n ${$config}\n
\n
\n
\n 按类型屏蔽\n
\n
\n ${$mode_0_off}${$mode_0_on}\n
滚动
\n
\n
\n ${$mode_1_off}${$mode_1_on}\n
顶部
\n
\n
\n ${$mode_2_off}${$mode_2_on}\n
底部
\n
\n
\n
\n
\n
\n ${$check_on}${$check_off}\n 防止弹幕重叠\n
\n
\n ${$check_on}${$check_off}\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 ${$style}\n
\n
\n
\n 模式\n
\n
\n ${$mode_0_on}\n
滚动
\n
\n
\n ${$mode_1_on}\n
顶部
\n
\n
\n ${$mode_2_on}\n
底部
\n
\n
\n
\n
\n 颜色\n
\n ${this.COLOR.map((color) => `
`).join('')}\n
\n
\n
\n
\n
\n \n
发送
\n
\n `;\n }\n\n get OPACITY() {\n return {\n min: 0,\n max: 100,\n steps: [],\n ...this.option.OPACITY,\n };\n }\n\n get FONT_SIZE() {\n return {\n min: 12,\n max: 120,\n steps: [],\n ...this.option.FONT_SIZE,\n };\n }\n\n get MARGIN() {\n return {\n min: 0,\n max: 3,\n steps: [\n {\n name: '1/4',\n value: [10, '75%'],\n },\n {\n name: '半屏',\n value: [10, '50%'],\n },\n {\n name: '3/4',\n value: [10, '25%'],\n },\n {\n name: '满屏',\n value: [10, 10],\n },\n ],\n ...this.option.MARGIN,\n };\n }\n\n get SPEED() {\n return {\n min: 0,\n max: 4,\n steps: [\n {\n name: '极慢',\n value: 10,\n },\n {\n name: '较慢',\n value: 7.5,\n hide: true,\n },\n {\n name: '适中',\n value: 5,\n },\n {\n name: '较快',\n value: 2.5,\n hide: true,\n },\n {\n name: '极快',\n value: 1,\n },\n ],\n ...this.option.SPEED,\n };\n }\n\n get COLOR() {\n return this.option.COLOR.length\n ? this.option.COLOR\n : [\n '#FE0302',\n '#FF7204',\n '#FFAA02',\n '#FFD302',\n '#FFFF00',\n '#A0EE00',\n '#00CD00',\n '#019899',\n '#4266BE',\n '#89D5FF',\n '#CC0273',\n '#222222',\n '#9B9B9B',\n '#FFFFFF',\n ];\n }\n\n query(selector) {\n const { query } = this.utils;\n const { $danmuku } = this.template;\n return query(selector, $danmuku);\n }\n\n append(el, target) {\n const { append } = this.utils;\n const children = [...el.children];\n if (children.some((item) => item === target)) return;\n append(el, target);\n }\n\n setData(key, value) {\n const { $player } = this.art.template;\n const { $mount } = this.template;\n $player.dataset[key] = value;\n if (this.outside) {\n $mount.dataset[key] = value;\n }\n }\n\n createTemplate() {\n const { createElement, tooltip } = this.utils;\n\n const $danmuku = createElement('div');\n $danmuku.className = 'artplayer-plugin-danmuku';\n $danmuku.innerHTML = this.TEMPLATE;\n\n this.template.$danmuku = $danmuku;\n this.template.$toggle = this.query('.apd-toggle');\n this.template.$config = this.query('.apd-config');\n this.template.$configPanel = this.query('.apd-config-panel');\n this.template.$configModes = this.query('.apd-config-mode .apd-modes');\n this.template.$style = this.query('.apd-style');\n this.template.$stylePanel = this.query('.apd-style-panel');\n this.template.$styleModes = this.query('.apd-style-mode .apd-modes');\n this.template.$colors = this.query('.apd-colors');\n this.template.$antiOverlap = this.query('.apd-anti-overlap');\n this.template.$syncVideo = this.query('.apd-sync-video');\n this.template.$opacitySlider = this.query('.apd-config-opacity .apd-slider');\n this.template.$opacityValue = this.query('.apd-config-opacity .apd-value');\n this.template.$marginSlider = this.query('.apd-config-margin .apd-slider');\n this.template.$marginValue = this.query('.apd-config-margin .apd-value');\n this.template.$fontSizeSlider = this.query('.apd-config-fontSize .apd-slider');\n this.template.$fontSizeValue = this.query('.apd-config-fontSize .apd-value');\n this.template.$speedSlider = this.query('.apd-config-speed .apd-slider');\n this.template.$speedValue = this.query('.apd-config-speed .apd-value');\n this.template.$input = this.query('.apd-input');\n this.template.$send = this.query('.apd-send');\n\n const { $toggle } = this.template;\n\n this.art.on('artplayerPluginDanmuku:show', () => {\n tooltip($toggle, '关闭弹幕');\n });\n\n this.art.on('artplayerPluginDanmuku:hide', () => {\n tooltip($toggle, '打开弹幕');\n });\n }\n\n createEvents() {\n const { $toggle, $configModes, $styleModes, $colors, $antiOverlap, $syncVideo, $send, $input } = this.template;\n\n this.art.proxy($toggle, 'click', () => {\n this.danmuku.config({\n visible: !this.option.visible,\n });\n this.reset();\n });\n\n this.art.proxy($configModes, 'click', (event) => {\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n if (this.option.modes.includes(mode)) {\n this.danmuku.config({\n modes: this.option.modes.filter((m) => m !== mode),\n });\n } else {\n this.danmuku.config({\n modes: [...this.option.modes, mode],\n });\n }\n this.reset();\n });\n\n this.art.proxy($antiOverlap, 'click', () => {\n this.danmuku.config({\n antiOverlap: !this.option.antiOverlap,\n });\n this.reset();\n });\n\n this.art.proxy($syncVideo, 'click', () => {\n this.danmuku.config({\n synchronousPlayback: !this.option.synchronousPlayback,\n });\n this.reset();\n });\n\n this.art.proxy($styleModes, 'click', (event) => {\n const $mode = event.target.closest('.apd-mode');\n if (!$mode) return;\n const mode = Number($mode.dataset.mode);\n this.danmuku.config({\n mode: mode,\n });\n this.reset();\n });\n\n this.art.proxy($colors, 'click', (event) => {\n const $color = event.target.closest('.apd-color');\n if (!$color) return;\n this.danmuku.config({\n color: $color.dataset.color,\n });\n this.reset();\n });\n\n this.art.proxy($send, 'click', () => this.emit());\n\n this.art.proxy($input, 'keypress', (event) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.emit();\n }\n });\n }\n\n createSliders() {\n this.slider.opacity = this.createSlider({\n ...this.OPACITY,\n container: this.template.$opacitySlider,\n findIndex: () => {\n return Math.round(this.option.opacity * 100);\n },\n onChange: (index) => {\n const { $opacityValue } = this.template;\n $opacityValue.textContent = `${index}%`;\n this.danmuku.config({\n opacity: index / 100,\n });\n },\n });\n\n this.slider.margin = this.createSlider({\n ...this.MARGIN,\n container: this.template.$marginSlider,\n findIndex: () => {\n return this.MARGIN.steps.findIndex(\n (item) => item.value[0] === this.option.margin[0] && item.value[1] === this.option.margin[1],\n );\n },\n onChange: (index) => {\n const margin = this.MARGIN.steps[index];\n if (!margin) return;\n const { $marginValue } = this.template;\n $marginValue.textContent = margin.name;\n this.danmuku.config({\n margin: margin.value,\n });\n },\n });\n\n this.slider.fontSize = this.createSlider({\n ...this.FONT_SIZE,\n container: this.template.$fontSizeSlider,\n findIndex: () => {\n return this.danmuku.fontSize;\n },\n onChange: (index) => {\n const { $fontSizeValue } = this.template;\n $fontSizeValue.textContent = `${index}px`;\n if (index === this.danmuku.fontSize) return;\n this.danmuku.config({\n fontSize: index,\n });\n },\n });\n\n this.slider.speed = this.createSlider({\n ...this.SPEED,\n container: this.template.$speedSlider,\n findIndex: () => {\n return this.SPEED.steps.findIndex((item) => item.value === this.option.speed);\n },\n onChange: (index) => {\n const speed = this.SPEED.steps[index];\n if (!speed) return;\n const { $speedValue } = this.template;\n $speedValue.textContent = speed.name;\n this.danmuku.config({\n speed: speed.value,\n });\n },\n });\n }\n\n createSlider({ min, max, container, findIndex, onChange, steps = [] }) {\n const { query, clamp, setStyle } = this.utils;\n\n setStyle(container, 'touch-action', 'none');\n\n container.innerHTML = `\n
\n
\n ${steps.map(() => `
`).join('')}\n
\n
\n
\n
\n
\n ${steps.map((step) => (step.hide ? '' : `
${step.name}
`)).join('')}\n
\n `;\n\n const $dot = query('.apd-slider-dot', container);\n const $progress = query('.apd-slider-progress', container);\n\n let isDroging = false;\n\n function reset(index = findIndex()) {\n if (index < min || index > max) return;\n const percentage = (index - min) / (max - min);\n $dot.style.left = `${percentage * 100}%`;\n if (steps.length === 0) {\n $progress.style.width = $dot.style.left;\n }\n onChange(index);\n }\n\n function updateLeft(event) {\n const { top, height, left, width } = container.getBoundingClientRect();\n if (this.art.isRotate) {\n const value = clamp(event.clientY - top, 0, height);\n const index = Math.round((value / height) * (max - min) + min);\n reset(index);\n } else {\n const value = clamp(event.clientX - left, 0, width);\n const index = Math.round((value / width) * (max - min) + min);\n reset(index);\n }\n }\n\n this.art.proxy(container, 'click', (event) => {\n updateLeft.call(this, event);\n });\n\n this.art.proxy(container, 'pointerdown', (event) => {\n isDroging = event.button === 0;\n });\n\n this.art.proxy(document, 'pointermove', (event) => {\n if (isDroging) {\n updateLeft.call(this, event);\n }\n });\n\n this.art.proxy(document, 'pointerup', (event) => {\n if (isDroging) {\n isDroging = false;\n updateLeft.call(this, event);\n }\n });\n\n return { reset };\n }\n\n onFullscreen(state) {\n const { $danmuku, $controlsCenter, $mount } = this.template;\n if (this.outside) {\n if (state) {\n this.append($controlsCenter, $danmuku);\n } else {\n this.append($mount, $danmuku);\n }\n } else {\n this.append($controlsCenter, $danmuku);\n }\n }\n\n onMouseEnter({ $control, $panel }) {\n const { $player } = this.art.template;\n const controlRect = $control.getBoundingClientRect();\n const panelRect = $panel.getBoundingClientRect();\n const playerRect = $player.getBoundingClientRect();\n\n const half = panelRect.width / 2 - controlRect.width / 2;\n const left = playerRect.left - (controlRect.left - half);\n const right = controlRect.right + half - playerRect.right;\n\n if (left > 0) {\n $panel.style.left = `${-half + left}px`;\n } else if (right > 0) {\n $panel.style.left = `${-half - right}px`;\n } else {\n $panel.style.left = `${-half}px`;\n }\n }\n\n async emit() {\n const { $input } = this.template;\n\n const text = $input.value.trim();\n if (!text.length) return;\n if (this.isLock) return;\n if (this.emitting) return;\n\n const danmu = {\n text: text,\n mode: this.option.mode,\n color: this.option.color,\n time: this.art.currentTime,\n };\n\n try {\n this.emitting = true;\n const state = await this.option.beforeEmit(danmu);\n this.emitting = false;\n\n if (state !== true) return;\n\n danmu.border = true;\n delete danmu.time;\n this.danmuku.emit(danmu);\n $input.value = '';\n\n this.lock();\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n this.emitting = false;\n }\n }\n\n lock() {\n const { addClass } = this.utils;\n const { $send } = this.template;\n\n this.isLock = true;\n let time = this.option.lockTime;\n $send.innerText = time;\n addClass($send, 'apd-lock');\n\n const loop = () => {\n this.timer = setTimeout(() => {\n if (time === 0) {\n this.unlock();\n } else {\n time -= 1;\n $send.innerText = time;\n loop();\n }\n }, 1000);\n };\n\n loop();\n }\n\n unlock() {\n const { removeClass } = this.utils;\n const { $send } = this.template;\n clearTimeout(this.timer);\n this.isLock = false;\n $send.innerText = '发送';\n removeClass($send, 'apd-lock');\n }\n\n resize() {\n if (this.outside) return;\n if (this.art.fullscreen) return;\n if (this.art.fullscreenWeb) return;\n const { $player, $controlsCenter } = this.art.template;\n const { $danmuku } = this.template;\n if (this.art.width < this.option.width) {\n this.append($player, $danmuku);\n } else {\n this.append($controlsCenter, $danmuku);\n }\n }\n\n reset() {\n const { inverseClass, tooltip } = this.utils;\n const { $toggle, $colors } = this.template;\n\n this.slider.opacity.reset();\n this.slider.margin.reset();\n this.slider.fontSize.reset();\n this.slider.speed.reset();\n\n this.setData('danmukuVisible', this.option.visible);\n this.setData('danmukuMode', this.option.mode);\n this.setData('danmukuColor', this.option.color);\n this.setData('danmukuMode0', this.option.modes.includes(0));\n this.setData('danmukuMode1', this.option.modes.includes(1));\n this.setData('danmukuMode2', this.option.modes.includes(2));\n this.setData('danmukuAntiOverlap', this.option.antiOverlap);\n this.setData('danmukuSyncVideo', this.option.synchronousPlayback);\n this.setData('danmukuTheme', this.option.theme);\n this.setData('danmukuEmitter', this.option.emitter);\n\n const colors = $colors.children;\n const $color = Array.from(colors).find((item) => item.dataset.color === this.option.color.toUpperCase());\n $color && inverseClass($color, 'apd-active');\n\n tooltip($toggle, this.option.visible ? '关闭弹幕' : '打开弹幕');\n\n this.resize();\n }\n\n mount(target) {\n const { errorHandle } = this.utils;\n const $el = typeof target === 'string' ? document.querySelector(target) : target;\n errorHandle($el, `Can not find the mount point: ${target}`);\n this.append($el, this.template.$danmuku);\n this.template.$mount = $el;\n this.reset();\n }\n}\n\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-danmuku';\n let $style = document.getElementById(id);\n if (!$style) {\n $style = document.createElement('style');\n $style.id = id;\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild($style);\n });\n } else {\n (document.head || document.documentElement).appendChild($style);\n }\n }\n $style.textContent = style;\n}\n","module.exports = \"bc5428a5075ddaba\";","module.exports = \"bf1932cb468b3021\";","module.exports = \"b74dc3080b6cd7eb\";","module.exports = \"e1f7929fc7eb56f5\";","module.exports = \"83a1c89d2b4d7383\";","module.exports = \"401f250f3293e528\";","module.exports = \"a27f224d3e9c5a81\";","module.exports = \"ec9f79d2c4c498de\";","module.exports = \"8bc1f3138bababa6\";","module.exports = \"b60ab50237bcbef4\";","module.exports = \"19bca7c1e3731c0a\";","module.exports = \"e3b49968901c24db\";","module.exports = \"f01b6a0cef3c915e\";","const lib = {\n map(value, inMin, inMax, outMin, outMax) {\n return ((value - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;\n },\n range(start, end, tick) {\n const s = Math.round(start / tick) * tick;\n return Array.from(\n {\n length: Math.floor((end - start) / tick),\n },\n (v, k) => {\n return k * tick + s;\n },\n );\n },\n};\n\nconst line = (pointA, pointB) => {\n const lengthX = pointB[0] - pointA[0];\n const lengthY = pointB[1] - pointA[1];\n return {\n length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),\n angle: Math.atan2(lengthY, lengthX),\n };\n};\n\nexport default function heatmap(art, danmuku, option) {\n const { query } = art.constructor.utils;\n\n art.controls.add({\n name: 'heatmap',\n position: 'top',\n html: '',\n style: {\n position: 'absolute',\n top: '-100px',\n left: '0px',\n right: '0px',\n height: '100px',\n width: '100%',\n pointerEvents: 'none',\n },\n mounted($heatmap) {\n let $start = null;\n let $stop = null;\n\n function update(arg = []) {\n $start = null;\n $stop = null;\n $heatmap.innerHTML = '';\n\n if (!art.duration || art.option.isLive) return;\n\n const svg = {\n w: $heatmap.offsetWidth,\n h: $heatmap.offsetHeight,\n };\n\n const options = {\n xMin: 0,\n xMax: svg.w,\n yMin: 0,\n yMax: 128,\n scale: 0.25,\n opacity: 0.2,\n minHeight: Math.floor(svg.h * 0.05),\n sampling: Math.floor(svg.w / 100),\n smoothing: 0.2,\n flattening: 0.2,\n };\n\n if (typeof option === 'object') {\n Object.assign(options, option);\n }\n\n let points = [];\n\n if (Array.isArray(arg) && arg.length) {\n points = [...arg];\n } else {\n const gap = art.duration / svg.w;\n for (let x = 0; x <= svg.w; x += options.sampling) {\n const y = danmuku.queue.filter(\n ({ time }) => time > x * gap && time <= (x + options.sampling) * gap,\n ).length;\n points.push([x, y]);\n }\n }\n\n if (points.length === 0) return;\n\n const lastPoint = points[points.length - 1];\n const lastX = lastPoint[0];\n const lastY = lastPoint[1];\n if (lastX !== svg.w) {\n points.push([svg.w, lastY]);\n }\n\n const yPoints = points.map((point) => point[1]);\n const yMin = Math.min(...yPoints);\n const yMax = Math.max(...yPoints);\n const yMid = (yMin + yMax) / 2;\n\n for (let i = 0; i < points.length; i++) {\n const point = points[i];\n const y = point[1];\n point[1] = y * (y > yMid ? 1 + options.scale : 1 - options.scale) + options.minHeight;\n }\n\n const controlPoint = (current, previous, next, reverse) => {\n const p = previous || current;\n const n = next || current;\n const o = line(p, n);\n const flat = lib.map(Math.cos(o.angle) * options.flattening, 0, 1, 1, 0);\n const angle = o.angle * flat + (reverse ? Math.PI : 0);\n const length = o.length * options.smoothing;\n const x = current[0] + Math.cos(angle) * length;\n const y = current[1] + Math.sin(angle) * length;\n return [x, y];\n };\n\n const bezierCommand = (point, i, a) => {\n const cps = controlPoint(a[i - 1], a[i - 2], point);\n const cpe = controlPoint(point, a[i - 1], a[i + 1], true);\n const close = i === a.length - 1 ? ' z' : '';\n return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}${close}`;\n };\n\n const pointsPositions = points.map((e) => {\n const x = lib.map(e[0], options.xMin, options.xMax, 0, svg.w);\n const y = lib.map(e[1], options.yMin, options.yMax, svg.h, 0);\n return [x, y];\n });\n\n const pathD = pointsPositions.reduce(\n (acc, e, i, a) =>\n i === 0\n ? `M ${a[a.length - 1][0]},${svg.h} L ${e[0]},${svg.h} L ${e[0]},${e[1]}`\n : `${acc} ${bezierCommand(e, i, a)}`,\n '',\n );\n\n $heatmap.innerHTML = `\n \n \n \n \n \n \n \n \n \n \n \n `;\n\n $start = query('#heatmap-start', $heatmap);\n $stop = query('#heatmap-stop', $heatmap);\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n\n art.on('video:timeupdate', () => {\n if ($start && $stop) {\n $start.setAttribute('offset', `${art.played * 100}%`);\n $stop.setAttribute('offset', `${art.played * 100}%`);\n }\n });\n\n art.on('setBar', (type, percentage) => {\n if ($start && $stop && type === 'played') {\n $start.setAttribute('offset', `${percentage * 100}%`);\n $stop.setAttribute('offset', `${percentage * 100}%`);\n }\n });\n\n art.on('ready', () => update());\n art.on('resize', () => update());\n art.on('artplayerPluginDanmuku:loaded', () => update());\n art.on('artplayerPluginDanmuku:points', (points) => update(points));\n },\n });\n}\n"],"names":["modules","entry","mainEntry","parcelRequireName","externals","distDir","publicUrl","devServer","globalObject","globalThis","self","window","global","previousRequire","importMap","i","cache","nodeRequire","module","require","bind","newRequire","name","jumped","currentRequire","err","Error","code","localRequire","resolve","x","id","Module","call","exports","res","isParcelRequire","moduleName","bundle","parent","register","Object","defineProperty","get","length","mainExports","define","amd","__globalThis","parcelHelpers","defineInteropFlag","export","artplayerPluginDanmuku","_danmuku","_danmukuDefault","interopDefault","_setting","_settingDefault","_heatmap","_heatmapDefault","option","art","danmuku","default","setting","heatmap","emit","load","config","hide","show","reset","mount","isHide","isStop","icons","_bilibili","_worker","_workerDefault","Danmuku","constructor","template","utils","validator","$danmuku","$player","queue","$refs","timer","index","states","wait","ready","stop","blob","Blob","replace","type","worker","Worker","URL","createObjectURL","start","resize","destroy","on","speed","margin","opacity","color","mode","modes","fontSize","antiOverlap","synchronousPlayback","undefined","width","points","filter","beforeEmit","beforeVisible","visible","emitter","maxLength","lockTime","theme","OPACITY","FONT_SIZE","MARGIN","SPEED","COLOR","scheme","cssText","isRotate","plugins","autoOrientation","state","marginTop","clamp","value","clientHeight","endsWith","parseFloat","marginBottom","Math","round","$ref","pop","document","createElement","style","dataset","className","readys","currentTime","result","danmu","push","time","visibles","clientWidth","clientLeft","getLeft","top","offsetTop","left","height","distance","$restTime","right","playbackRate","Number","errorHandle","danmus","target","Promise","bilibiliDanmuParseFromUrl","Array","isArray","innerText","error","text","border","trim","Infinity","includes","item","$state","$id","$lastStartTime","setState","isInit","$controlsCenter","keys","some","key","JSON","stringify","assign","rect","getBoundingClientRect","postMessage","message","Date","now","onmessage","event","data","callback","makeWait","visibility","marginLeft","transform","transition","update","setStyles","requestAnimationFrame","playing","emitTime","appendChild","backgroundColor","continue","suspend","translateX","cancelAnimationFrame","forEach","terminate","off","getMode","bilibiliDanmuParseFromXml","xmlString","reg","RegExp","from","matchAll","map","match","attr","groups","p","split","replaceAll","toString","timestamp","pool","userID","rowID","Boolean","xml","url","fetch","createWorker","a","__esModule","exportAll","source","dest","prototype","hasOwnProperty","enumerable","destName","_styleLess","_styleLessDefault","_onSvg","_onSvgDefault","_offSvg","_offSvgDefault","_configSvg","_configSvgDefault","_styleSvg","_styleSvgDefault","_mode0OffSvg","_mode0OffSvgDefault","_mode0OnSvg","_mode0OnSvgDefault","_mode1OffSvg","_mode1OffSvgDefault","_mode1OnSvg","_mode1OnSvgDefault","_mode2OffSvg","_mode2OffSvgDefault","_mode2OnSvg","_mode2OnSvgDefault","_checkOnSvg","_checkOnSvgDefault","_checkOffSvg","_checkOffSvgDefault","setStyle","$mount","$toggle","$config","$configPanel","$configModes","$style","$stylePanel","$styleModes","$colors","$opacitySlider","$opacityValue","$marginSlider","$marginValue","$fontSizeSlider","$fontSizeValue","$speedSlider","$speedValue","$input","$send","slider","emitting","isLock","createTemplate","createSliders","createEvents","onFullscreen","proxy","onMouseEnter","$control","$panel","$on","$off","$mode_0_off","$mode_0_on","$mode_1_off","$mode_1_on","$mode_2_off","$mode_2_on","$check_on","$check_off","outside","TEMPLATE","join","min","max","steps","query","selector","append","el","children","setData","tooltip","innerHTML","$antiOverlap","$syncVideo","$mode","closest","m","$color","preventDefault","createSlider","container","findIndex","onChange","textContent","step","$dot","$progress","isDroging","percentage","updateLeft","clientY","clientX","button","controlRect","panelRect","playerRect","half","lock","addClass","loop","setTimeout","unlock","removeClass","clearTimeout","fullscreen","fullscreenWeb","inverseClass","find","toUpperCase","$el","querySelector","getElementById","readyState","addEventListener","head","documentElement","lib","inMin","inMax","outMin","outMax","range","end","tick","s","floor","v","k","line","pointA","pointB","lengthX","lengthY","sqrt","pow","angle","atan2","controls","add","position","html","pointerEvents","mounted","$heatmap","$start","$stop","arg","duration","isLive","svg","w","offsetWidth","h","offsetHeight","options","xMin","xMax","yMin","yMax","scale","minHeight","sampling","smoothing","flattening","gap","y","lastPoint","lastX","lastY","yPoints","point","yMid","controlPoint","current","previous","next","reverse","o","flat","cos","PI","sin","bezierCommand","cps","cpe","close","pathD","pointsPositions","e","reduce","acc","setAttribute","played","_default","parcelRequire93cf"],"version":3,"file":"index.js.map"} \ 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 dbcaec203..ef47ca3a4 100644 --- a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js +++ b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js @@ -5,4 +5,4 @@ * (c) 2017-2025 Harvey Zack * Released under the MIT License. */ -!function(t,e,i,a,n,o,s,l){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof r[a]&&r[a],p=d.i||{},u=d.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof r[a]&&r[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var l=u[e]=new m.Module(e);t[e][0].call(l.exports,p,l,l.exports,r)}return u[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return r[a]}}),r[a]=m;for(var c=0;cu);var o=t("./danmuku"),s=n.interopDefault(o),l=t("./setting"),r=n.interopDefault(l),d=t("./heatmap"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,r.default)(e,i);return i.option.heatmap&&(0,p.default)(e,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}}}}u.icons=r.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"g81Wu","./setting":"ho690","./heatmap":"hjtgU","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],g81Wu:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("./bilibili"),s=t("bundle-text:./worker"),l=n.interopDefault(s);class r{constructor(t,e){let{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e);let n=new Blob([l.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),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,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}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|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}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:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[1]}get fontSize(){let{clamp:t}=this.utils,{clientHeight:e}=this.$player,i=this.option.fontSize;return"number"==typeof i?Math.round(t(i,12,e)):"string"==typeof i&&i.endsWith("%")?Math.round(t(e*(parseFloat(i)/100),12,e)):r.option.fontSize}get $ref(){let t=this.$refs.pop()||document.createElement("div");return t.style.cssText=r.cssText,t.dataset.mode="",t.className="",t}get readys(){let{currentTime:t}=this.art,e=[];return this.filter("ready",t=>e.push(t)),this.filter("wait",i=>{t+.1>=i.time&&i.time>=t-.1&&e.push(i)}),e}get visibles(){let t=[],{clientWidth:e}=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=e-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,t.push(p)}),t}get speed(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}async load(t){let{errorHandle:e}=this.utils,i=[],a=t||this.option.danmuku;try{"function"==typeof a?i=await a():a instanceof Promise?i=await a:"string"==typeof a?i=await (0,o.bilibiliDanmuParseFromUrl)(a):Array.isArray(a)&&(i=a),e(Array.isArray(i),"Danmuku need return an array as result"),void 0===t&&(this.reset(),this.queue=[],this.states={wait:[],ready:[],emit:[],stop:[]},this.$refs=[],this.$danmuku.innerText="");for(let t=0;tJSON.stringify(this.option[e])!==JSON.stringify(t[e]))&&(this.option=Object.assign({},r.option,this.option,t),this.validator(this.option,r.scheme),this.option.mode=e(this.option.mode,0,2),this.option.speed=e(this.option.speed,1,10),this.option.opacity=e(this.option.opacity,0,1),this.option.lockTime=e(this.option.lockTime,1,60),this.option.maxLength=e(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}postMessage(t={}){return new Promise(e=>{t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:a}=i;a.id===t.id&&e(a)}})}filter(t,e){let i=this.states[t]||[];for(let t=0;te!==t),t.$state=e,t.$ref&&(t.$ref.dataset.state=e),this.states[e].push(t)}makeWait(t){this.setState(t,"wait"),t.$ref&&(t.$ref.style.cssText=r.cssText,t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}update(){let{setStyles:t}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let e=this.readys;for(let i=0;i{0===e.mode&&(e.$ref.style.left=`${t}px`)}),this.filter("emit",e=>{if(e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.left=`${t}px`,e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}})}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(this.setState(e,"emit"),e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(this.setState(e,"stop"),0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$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(t=>this.makeWait(t)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.$danmuku.style.opacity=1,this.option.visible=!0,this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.$danmuku.style.opacity=0,this.option.visible=!1,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=r},{"./bilibili":"jICn4","bundle-text:./worker":"cK8sH","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],jICn4:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function o(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function s(t){if("string"!=typeof t)return[];let e=new RegExp(/(?.+?)<\/d>/gs);return Array.from(t.matchAll(e)).map(t=>{let e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:o(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null}).filter(Boolean)}function l({data:t}){let{xml:e,id:i}=t;if(!i||!e)return;let a=s(e);self.postMessage({danmus:a,id:i})}function r(t){return new Promise(async e=>{let i=await fetch(t),a=await i.text();try{let t=function(){let t=new Blob([` ${o.toString()} ${s.toString()} onmessage = ${l.toString()} `],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}();t.onmessage=i=>{let{danmus:a,id:n}=i.data;n&&a&&(e(a),t.terminate())},t.postMessage({xml:a,id:Date.now()})}catch(t){e(s(a))}})}n.defineInteropFlag(i),n.export(i,"bilibiliDanmuParseFromUrl",()=>r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(t,e,i,a){i.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},i.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.exportAll=function(t,e){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e},i.export=function(t,e,i){Object.defineProperty(t,e,{enumerable:!0,get:i})}},{}],cK8sH:[function(t,e,i,a){e.exports='!function(e,t,i,o,n,r,f,d){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof l[o]&&l[o],p=u.i||{},h=u.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!h[t]){if(!e[t]){if(n[t])return n[t];var r="function"==typeof l[o]&&l[o];if(!i&&r)return r(t,!0);if(u)return u(t,!0);if(s&&"string"==typeof t)return s(t);var f=Error("Cannot find module \'"+t+"\'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(i){var o=e[t][1][i];return null!=o?o:i},p.cache={};var d=h[t]=new a.Module(t);e[t][0].call(d.exports,p,d,d.exports,l)}return h[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=s,this.exports={}},a.modules=e,a.cache=h,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=p,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return l[o]}}),l[o]=a;for(var c=0;ct.mode===e.mode&&t.top<=d).sort((e,t)=>e.top-t.top);if(0===l.length)if(2===e.mode)return d-e.height;else return r;if(l.unshift({type:"top",top:0,left:0,right:0,height:r,width:i,speed:0,distance:i}),l.push({type:"bottom",top:d,left:0,right:0,height:n,width:i,speed:0,distance:i}),2===e.mode)for(let t=l.length-2;t>=0;t-=1){let i=l[t],o=l[t+1],n=i.top+i.height;if(o.top-n>=e.height)return o.top-e.height}else for(let t=1;t=e.height)return n}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),o=Math.min(...e.map(e=>e.right));return i*t.length-o*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:n})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},["fpBtQ"],"fpBtQ","parcelRequire4dc0",{});'},{}],ho690:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./style.less"),s=n.interopDefault(o),l=t("bundle-text:./img/on.svg"),r=n.interopDefault(l),d=t("bundle-text:./img/off.svg"),p=n.interopDefault(d),u=t("bundle-text:./img/config.svg"),h=n.interopDefault(u),m=t("bundle-text:./img/style.svg"),c=n.interopDefault(m),f=t("bundle-text:./img/mode_0_off.svg"),g=n.interopDefault(f),y=t("bundle-text:./img/mode_0_on.svg"),v=n.interopDefault(y),x=t("bundle-text:./img/mode_1_off.svg"),k=n.interopDefault(x),b=t("bundle-text:./img/mode_1_on.svg"),$=n.interopDefault(b),w=t("bundle-text:./img/mode_2_off.svg"),M=n.interopDefault(w),E=t("bundle-text:./img/mode_2_on.svg"),D=n.interopDefault(E),S=t("bundle-text:./img/check_on.svg"),F=n.interopDefault(S),A=t("bundle-text:./img/check_off.svg"),z=n.interopDefault(A);if(i.default=class{constructor(t,e){this.art=t,this.danmuku=e,this.utils=t.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=t.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$config:null,$configPanel:null,$configModes:null,$style:null,$stylePanel: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),t.on("resize",()=>this.resize()),t.on("fullscreen",t=>this.onFullscreen(t)),t.on("fullscreenWeb",t=>this.onFullscreen(t)),t.proxy(this.template.$config,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$config,$panel:this.template.$configPanel})}),t.proxy(this.template.$style,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$style,$panel:this.template.$stylePanel})})}static get icons(){return{$on:r.default,$off:p.default,$config:h.default,$style:c.default,$mode_0_off:g.default,$mode_0_on:v.default,$mode_1_off:k.default,$mode_1_on:$.default,$mode_2_off:M.default,$mode_2_on:D.default,$check_on:F.default,$check_off:z.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:t}=this;return`
${r.default}${p.default}
${h.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${g.default}${v.default}
\u{6EDA}\u{52A8}
${k.default}${$.default}
\u{9876}\u{90E8}
${M.default}${D.default}
\u{5E95}\u{90E8}
${F.default}${z.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${F.default}${z.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}
${c.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${$.default}
\u{9876}\u{90E8}
${D.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(t=>`
`).join("")}
\u{53D1}\u{9001}
`}get OPACITY(){return{min:0,max:100,steps:[],...this.option.OPACITY}}get FONT_SIZE(){return{min:12,max:120,steps:[],...this.option.FONT_SIZE}}get MARGIN(){return{min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}],...this.option.MARGIN}}get SPEED(){return{min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}],...this.option.SPEED}}get COLOR(){return this.option.COLOR.length?this.option.COLOR:["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(t){let{query:e}=this.utils,{$danmuku:i}=this.template;return e(t,i)}append(t,e){let{append:i}=this.utils;[...t.children].some(t=>t===e)||i(t,e)}setData(t,e){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[t]=e,this.outside&&(a.dataset[t]=e)}createTemplate(){let{createElement:t,tooltip:e}=this.utils,i=t("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");let{$toggle:a}=this.template;this.art.on("artplayerPluginDanmuku:show",()=>{e(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",()=>{e(a,"打开弹幕")})}createEvents(){let{$toggle:t,$configModes:e,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(t,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(e,"click",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(t=>t!==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",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",t=>{let e=t.target.closest(".apd-color");e&&(this.danmuku.config({color:e.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({...this.OPACITY,container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:t=>{let{$opacityValue:e}=this.template;e.textContent=`${t}%`,this.danmuku.config({opacity:t/100})}}),this.slider.margin=this.createSlider({...this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.steps.findIndex(t=>t.value[0]===this.option.margin[0]&&t.value[1]===this.option.margin[1]),onChange:t=>{let e=this.MARGIN.steps[t];if(!e)return;let{$marginValue:i}=this.template;i.textContent=e.name,this.danmuku.config({margin:e.value})}}),this.slider.fontSize=this.createSlider({...this.FONT_SIZE,container:this.template.$fontSizeSlider,findIndex:()=>this.danmuku.fontSize,onChange:t=>{let{$fontSizeValue:e}=this.template;e.textContent=`${t}px`,t!==this.danmuku.fontSize&&this.danmuku.config({fontSize:t})}}),this.slider.speed=this.createSlider({...this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.steps.findIndex(t=>t.value===this.option.speed),onChange:t=>{let e=this.SPEED.steps[t];if(!e)return;let{$speedValue:i}=this.template;i.textContent=e.name,this.danmuku.config({speed:e.value})}})}createSlider({min:t,max:e,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l,setStyle:r}=this.utils;r(i,"touch-action","none"),i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(t=>t.hide?"":`
${t.name}
`).join("")}
`;let d=s(".apd-slider-dot",i),p=s(".apd-slider-progress",i),u=!1;function h(i=a()){if(ie)return;let s=(i-t)/(e-t);d.style.left=`${100*s}%`,0===o.length&&(p.style.width=d.style.left),n(i)}function m(a){let{top:n,height:o,left:s,width:r}=i.getBoundingClientRect();this.art.isRotate?h(Math.round(l(a.clientY-n,0,o)/o*(e-t)+t)):h(Math.round(l(a.clientX-s,0,r)/r*(e-t)+t))}return this.art.proxy(i,"click",t=>{m.call(this,t)}),this.art.proxy(i,"pointerdown",t=>{u=0===t.button}),this.art.proxy(document,"pointermove",t=>{u&&m.call(this,t)}),this.art.proxy(document,"pointerup",t=>{u&&(u=!1,m.call(this,t))}),{reset:h}}onFullscreen(t){let{$danmuku:e,$controlsCenter:i,$mount:a}=this.template;this.outside?t?this.append(i,e):this.append(a,e):this.append(i,e)}onMouseEnter({$control:t,$panel:e}){let{$player:i}=this.art.template,a=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=i.getBoundingClientRect(),s=n.width/2-a.width/2,l=o.left-(a.left-s),r=a.right+s-o.right;l>0?e.style.left=`${-s+l}px`:r>0?e.style.left=`${-s-r}px`:e.style.left=`${-s}px`}async emit(){let{$input:t}=this.template,e=t.value.trim();if(!e.length||this.isLock||this.emitting)return;let i={text:e,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let e=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==e)return;i.border=!0,delete i.time,this.danmuku.emit(i),t.value="",this.lock()}catch(t){this.emitting=!1}}lock(){let{addClass:t}=this.utils,{$send:e}=this.template;this.isLock=!0;let i=this.option.lockTime;e.innerText=i,t(e,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(e.innerText=i-=1,a())},1e3)};a()}unlock(){let{removeClass:t}=this.utils,{$send:e}=this.template;clearTimeout(this.timer),this.isLock=!1,e.innerText="发送",t(e,"apd-lock")}resize(){if(this.outside||this.art.fullscreen||this.art.fullscreenWeb)return;let{$player:t,$controlsCenter:e}=this.art.template,{$danmuku:i}=this.template;this.art.widtht.dataset.color===this.option.color.toUpperCase());n&&t(n,"apd-active"),e(i,this.option.visible?"关闭弹幕":"打开弹幕"),this.resize()}mount(t){let{errorHandle:e}=this.utils,i="string"==typeof t?document.querySelector(t):t;e(i,`Can not find the mount point: ${t}`),this.append(i,this.template.$danmuku),this.template.$mount=i,this.reset()}},"undefined"!=typeof document){let t="artplayer-plugin-danmuku",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=s.default}},{"bundle-text:./style.less":"e4L1w","bundle-text:./img/on.svg":"2h5UL","bundle-text:./img/off.svg":"bMJJY","bundle-text:./img/config.svg":"jqR46","bundle-text:./img/style.svg":"9tkqu","bundle-text:./img/mode_0_off.svg":"fFoDs","bundle-text:./img/mode_0_on.svg":"hkEt9","bundle-text:./img/mode_1_off.svg":"3n5ax","bundle-text:./img/mode_1_on.svg":"hJjtU","bundle-text:./img/mode_2_off.svg":"dWW5U","bundle-text:./img/mode_2_on.svg":"1QGuJ","bundle-text:./img/check_on.svg":"9EUUq","bundle-text:./img/check_off.svg":"gf3jX","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],e4L1w:[function(t,e,i,a){e.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}'},{}],"2h5UL":[function(t,e,i,a){e.exports=''},{}],bMJJY:[function(t,e,i,a){e.exports=''},{}],jqR46:[function(t,e,i,a){e.exports=''},{}],"9tkqu":[function(t,e,i,a){e.exports=''},{}],fFoDs:[function(t,e,i,a){e.exports=''},{}],hkEt9:[function(t,e,i,a){e.exports=''},{}],"3n5ax":[function(t,e,i,a){e.exports=''},{}],hJjtU:[function(t,e,i,a){e.exports=''},{}],dWW5U:[function(t,e,i,a){e.exports=''},{}],"1QGuJ":[function(t,e,i,a){e.exports=''},{}],"9EUUq":[function(t,e,i,a){e.exports=''},{}],gf3jX:[function(t,e,i,a){e.exports=''},{}],hjtgU:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>l);let o={map:(t,e,i,a,n)=>(t-e)*(n-a)/(i-e)+a,range(t,e,i){let a=Math.round(t/i)*i;return Array.from({length:Math.floor((e-t)/i)},(t,e)=>e*i+a)}},s=(t,e)=>{let i=e[0]-t[0],a=e[1]-t[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function l(t,e,i){let{query:a}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(n){let l=null,r=null;function d(p=[]){if(l=null,r=null,n.innerHTML="",!t.duration||t.option.isLive)return;let u={w:n.offsetWidth,h:n.offsetHeight},h={xMin:0,xMax:u.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*u.h),sampling:Math.floor(u.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(h,i);let m=[];if(Array.isArray(p)&&p.length)m=[...p];else{let i=t.duration/u.w;for(let t=0;t<=u.w;t+=h.sampling){let a=e.queue.filter(({time:e})=>e>t*i&&e<=(t+h.sampling)*i).length;m.push([t,a])}}if(0===m.length)return;let c=m[m.length-1],f=c[0],g=c[1];f!==u.w&&m.push([u.w,g]);let y=m.map(t=>t[1]),v=(Math.min(...y)+Math.max(...y))/2;for(let t=0;tv?1+h.scale:1-h.scale)+h.minHeight}let x=(t,e,i,a)=>{let n=s(e||t,i||t),l=o.map(Math.cos(n.angle)*h.flattening,0,1,1,0),r=n.angle*l+(a?Math.PI:0),d=n.length*h.smoothing;return[t[0]+Math.cos(r)*d,t[1]+Math.sin(r)*d]},k=(t,e,i)=>{let a=x(i[e-1],i[e-2],t),n=x(t,i[e-1],i[e+1],!0),o=e===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${t[0]},${t[1]}${o}`},b=m.map(t=>[o.map(t[0],h.xMin,h.xMax,0,u.w),o.map(t[1],h.yMin,h.yMax,u.h,0)]).reduce((t,e,i,a)=>0===i?`M ${a[a.length-1][0]},${u.h} L ${e[0]},${u.h} L ${e[0]},${e[1]}`:`${t} ${k(e,i,a)}`,"");n.innerHTML=``,l=a("#heatmap-start",n),r=a("#heatmap-stop",n),l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{l&&r&&"played"===t&&(l.setAttribute("offset",`${100*e}%`),r.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>d()),t.on("resize",()=>d()),t.on("artplayerPluginDanmuku:loaded",()=>d()),t.on("artplayerPluginDanmuku:points",t=>d(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}]},["666Ok"],"666Ok","parcelRequire4dc0",{}); \ No newline at end of file +!function(t,e,i,a,n,o,s,l){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof r[a]&&r[a],p=d.i||{},u=d.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof r[a]&&r[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var l=u[e]=new m.Module(e);t[e][0].call(l.exports,p,l,l.exports,r)}return u[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return r[a]}}),r[a]=m;for(var c=0;cu);var o=t("./danmuku"),s=n.interopDefault(o),l=t("./setting"),r=n.interopDefault(l),d=t("./heatmap"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,r.default)(e,i);return i.option.heatmap&&(0,p.default)(e,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}}}}u.icons=r.default.icons,"undefined"!=typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"3oV1P","./setting":"ddE7h","./heatmap":"falVu","@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],"3oV1P":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("./bilibili"),s=t("bundle-text:./worker"),l=n.interopDefault(s);class r{constructor(t,e){let{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=r.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0);let n=new Blob([l.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),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,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}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|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}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:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;return"number"==typeof e?t(e,0,i):"string"==typeof e&&e.endsWith("%")?t(i*(parseFloat(e)/100),0,i):r.option.margin[1]}get fontSize(){let{clamp:t}=this.utils,{clientHeight:e}=this.$player,i=this.option.fontSize;return"number"==typeof i?Math.round(t(i,12,e)):"string"==typeof i&&i.endsWith("%")?Math.round(t(e*(parseFloat(i)/100),12,e)):r.option.fontSize}get $ref(){let t=this.$refs.pop()||document.createElement("div");return t.style.cssText=r.cssText,t.dataset.mode="",t.className="",t}get readys(){let{currentTime:t}=this.art,e=[];return this.filter("ready",t=>e.push(t)),this.filter("wait",i=>{t+.1>=i.time&&i.time>=t-.1&&e.push(i)}),e}get visibles(){let t=[],{clientWidth:e}=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=e-r,p.speed=d,p.distance=r,p.time=a.$restTime,p.mode=a.mode,t.push(p)}),t}get speed(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}async load(t){let{errorHandle:e}=this.utils,i=[],a=t||this.option.danmuku;try{"function"==typeof a?i=await a():a instanceof Promise?i=await a:"string"==typeof a?i=await (0,o.bilibiliDanmuParseFromUrl)(a):Array.isArray(a)&&(i=a),e(Array.isArray(i),"Danmuku need return an array as result"),void 0===t&&(this.reset(),this.queue=[],this.states={wait:[],ready:[],emit:[],stop:[]},this.$refs=[],this.$danmuku.innerText="");for(let t=0;tJSON.stringify(this.option[e])!==JSON.stringify(t[e]))||e)&&(this.option=Object.assign({},r.option,this.option,t),this.validator(this.option,r.scheme),this.option.mode=i(this.option.mode,0,2),this.option.speed=i(this.option.speed,1,10),this.option.opacity=i(this.option.opacity,0,1),this.option.lockTime=i(this.option.lockTime,1,60),this.option.maxLength=i(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||a,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}postMessage(t={}){return new Promise(e=>{t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:a}=i;a.id===t.id&&e(a)}})}filter(t,e){let i=this.states[t]||[];for(let t=0;te!==t),t.$state=e,t.$ref&&(t.$ref.dataset.state=e),this.states[e].push(t)}makeWait(t){this.setState(t,"wait"),t.$ref&&(t.$ref.style.cssText=r.cssText,t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}update(){let{setStyles:t}=this.utils;return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let e=this.readys;for(let i=0;i{0===e.mode&&(e.$ref.style.left=`${t}px`)}),this.filter("emit",e=>{if(e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.left=`${t}px`,e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}})}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(this.setState(e,"emit"),e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(this.setState(e,"stop"),0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$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(t=>this.makeWait(t)),this.art.emit("artplayerPluginDanmuku:reset"),this}show(){return this.isHide=!1,this.$danmuku.style.opacity=1,this.option.visible=!0,this.art.emit("artplayerPluginDanmuku:show"),this}hide(){return this.isHide=!0,this.$danmuku.style.opacity=0,this.option.visible=!1,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=r},{"./bilibili":"4KZjR","bundle-text:./worker":"4Jmn3","@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],"4KZjR":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");function o(t){switch(t){case 1:case 2:case 3:default:return 0;case 4:return 2;case 5:return 1}}function s(t){if("string"!=typeof t)return[];let e=new RegExp(/(?.+?)<\/d>/gs);return Array.from(t.matchAll(e)).map(t=>{let e=t.groups.p.split(",");return e.length>=8?{text:t.groups.text.trim().replaceAll(""",'"').replaceAll("'","'").replaceAll("<","<").replaceAll(">",">").replaceAll("&","&"),time:Number(e[0]),mode:o(Number(e[1])),fontSize:Number(e[2]),color:`#${Number(e[3]).toString(16)}`,timestamp:Number(e[4]),pool:Number(e[5]),userID:e[6],rowID:Number(e[7])}:null}).filter(Boolean)}function l({data:t}){let{xml:e,id:i}=t;if(!i||!e)return;let a=s(e);self.postMessage({danmus:a,id:i})}function r(t){return new Promise(async e=>{let i=await fetch(t),a=await i.text();try{let t=function(){let t=new Blob([` ${o.toString()} ${s.toString()} onmessage = ${l.toString()} `],{type:"application/javascript"});return new Worker(URL.createObjectURL(t))}();t.onmessage=i=>{let{danmus:a,id:n}=i.data;n&&a&&(e(a),t.terminate())},t.postMessage({xml:a,id:Date.now()})}catch(t){e(s(a))}})}n.defineInteropFlag(i),n.export(i,"bilibiliDanmuParseFromUrl",()=>r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],"7o2zS":[function(t,e,i,a){i.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},i.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.exportAll=function(t,e){return Object.keys(t).forEach(function(i){"default"===i||"__esModule"===i||Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[i]}})}),e},i.export=function(t,e,i){Object.defineProperty(t,e,{enumerable:!0,get:i})}},{}],"4Jmn3":[function(t,e,i,a){e.exports='!function(e,t,i,o,n,r,f,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof d[o]&&d[o],h=u.i||{},p=u.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!p[t]){if(!e[t]){if(n[t])return n[t];var r="function"==typeof d[o]&&d[o];if(!i&&r)return r(t,!0);if(u)return u(t,!0);if(s&&"string"==typeof t)return s(t);var f=Error("Cannot find module \'"+t+"\'");throw f.code="MODULE_NOT_FOUND",f}h.resolve=function(i){var o=e[t][1][i];return null!=o?o:i},h.cache={};var l=p[t]=new a.Module(t);e[t][0].call(l.exports,h,l,l.exports,d)}return p[t].exports;function h(e){var t=h.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.require=s,this.exports={}},a.modules=e,a.cache=p,a.parent=u,a.distDir=void 0,a.publicUrl=void 0,a.devServer=void 0,a.i=h,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return d[o]}}),d[o]=a;for(var c=0;ct.mode===e.mode&&t.top<=l).sort((e,t)=>e.top-t.top);if(0===d.length)if(2===e.mode)return l-e.height;else return r;if(d.unshift({type:"top",top:0,left:0,right:0,height:r,width:i,speed:0,distance:i}),d.push({type:"bottom",top:l,left:0,right:0,height:n,width:i,speed:0,distance:i}),2===e.mode)for(let t=d.length-2;t>=0;t-=1){let i=d[t],o=d[t+1],n=i.top+i.height;if(o.top-n>=e.height)return o.top-e.height}else for(let t=1;t=e.height)return n}let u=[];for(let e=1;et.every(t=>!(it.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 i=Math.min(...t.map(e=>e.right)),o=Math.min(...e.map(e=>e.right));return i*t.length-o*e.length});break;case 1:case 2:u.sort((e,t)=>{let i=Math.max(...t.map(e=>e.width));return Math.max(...e.map(e=>e.width))*e.length-i*t.length})}return u[0][0].top}}onmessage=e=>{let{data:t}=e;if(!t.id||!t.type)return;let i=(0,({getDanmuTop:n})[t.type])(t);self.postMessage({result:i,id:t.id})}},{}]},["3DCG7"],"3DCG7","parcelRequire93cf",{});'},{}],ddE7h:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./style.less"),s=n.interopDefault(o),l=t("bundle-text:./img/on.svg"),r=n.interopDefault(l),d=t("bundle-text:./img/off.svg"),p=n.interopDefault(d),u=t("bundle-text:./img/config.svg"),h=n.interopDefault(u),m=t("bundle-text:./img/style.svg"),c=n.interopDefault(m),f=t("bundle-text:./img/mode_0_off.svg"),g=n.interopDefault(f),y=t("bundle-text:./img/mode_0_on.svg"),v=n.interopDefault(y),x=t("bundle-text:./img/mode_1_off.svg"),k=n.interopDefault(x),$=t("bundle-text:./img/mode_1_on.svg"),b=n.interopDefault($),w=t("bundle-text:./img/mode_2_off.svg"),E=n.interopDefault(w),M=t("bundle-text:./img/mode_2_on.svg"),S=n.interopDefault(M),D=t("bundle-text:./img/check_on.svg"),z=n.interopDefault(D),F=t("bundle-text:./img/check_off.svg"),A=n.interopDefault(F);if(i.default=class{constructor(t,e){this.art=t,this.danmuku=e,this.utils=t.constructor.utils;let{setStyle:i}=this.utils,{$controlsCenter:a}=t.template;i(a,"display","flex"),this.template={$controlsCenter:a,$mount:a,$danmuku:null,$toggle:null,$config:null,$configPanel:null,$configModes:null,$style:null,$stylePanel: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),t.on("resize",()=>this.resize()),t.on("fullscreen",t=>this.onFullscreen(t)),t.on("fullscreenWeb",t=>this.onFullscreen(t)),t.proxy(this.template.$config,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$config,$panel:this.template.$configPanel})}),t.proxy(this.template.$style,"mouseenter",()=>{this.onMouseEnter({$control:this.template.$style,$panel:this.template.$stylePanel})})}static get icons(){return{$on:r.default,$off:p.default,$config:h.default,$style:c.default,$mode_0_off:g.default,$mode_0_on:v.default,$mode_1_off:k.default,$mode_1_on:b.default,$mode_2_off:E.default,$mode_2_on:S.default,$check_on:z.default,$check_off:A.default}}get option(){return this.danmuku.option}get outside(){return this.template.$mount!==this.template.$controlsCenter}get TEMPLATE(){let{option:t}=this;return`
${r.default}${p.default}
${h.default}
\u{6309}\u{7C7B}\u{578B}\u{5C4F}\u{853D}
${g.default}${v.default}
\u{6EDA}\u{52A8}
${k.default}${b.default}
\u{9876}\u{90E8}
${E.default}${S.default}
\u{5E95}\u{90E8}
${z.default}${A.default} \u{9632}\u{6B62}\u{5F39}\u{5E55}\u{91CD}\u{53E0}
${z.default}${A.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}
${c.default}
\u{6A21}\u{5F0F}
${v.default}
\u{6EDA}\u{52A8}
${b.default}
\u{9876}\u{90E8}
${S.default}
\u{5E95}\u{90E8}
\u{989C}\u{8272}
${this.COLOR.map(t=>`
`).join("")}
\u{53D1}\u{9001}
`}get OPACITY(){return{min:0,max:100,steps:[],...this.option.OPACITY}}get FONT_SIZE(){return{min:12,max:120,steps:[],...this.option.FONT_SIZE}}get MARGIN(){return{min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}],...this.option.MARGIN}}get SPEED(){return{min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}],...this.option.SPEED}}get COLOR(){return this.option.COLOR.length?this.option.COLOR:["#FE0302","#FF7204","#FFAA02","#FFD302","#FFFF00","#A0EE00","#00CD00","#019899","#4266BE","#89D5FF","#CC0273","#222222","#9B9B9B","#FFFFFF"]}query(t){let{query:e}=this.utils,{$danmuku:i}=this.template;return e(t,i)}append(t,e){let{append:i}=this.utils;[...t.children].some(t=>t===e)||i(t,e)}setData(t,e){let{$player:i}=this.art.template,{$mount:a}=this.template;i.dataset[t]=e,this.outside&&(a.dataset[t]=e)}createTemplate(){let{createElement:t,tooltip:e}=this.utils,i=t("div");i.className="artplayer-plugin-danmuku",i.innerHTML=this.TEMPLATE,this.template.$danmuku=i,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");let{$toggle:a}=this.template;this.art.on("artplayerPluginDanmuku:show",()=>{e(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",()=>{e(a,"打开弹幕")})}createEvents(){let{$toggle:t,$configModes:e,$styleModes:i,$colors:a,$antiOverlap:n,$syncVideo:o,$send:s,$input:l}=this.template;this.art.proxy(t,"click",()=>{this.danmuku.config({visible:!this.option.visible}),this.reset()}),this.art.proxy(e,"click",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.option.modes.includes(i)?this.danmuku.config({modes:this.option.modes.filter(t=>t!==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",t=>{let e=t.target.closest(".apd-mode");if(!e)return;let i=Number(e.dataset.mode);this.danmuku.config({mode:i}),this.reset()}),this.art.proxy(a,"click",t=>{let e=t.target.closest(".apd-color");e&&(this.danmuku.config({color:e.dataset.color}),this.reset())}),this.art.proxy(s,"click",()=>this.emit()),this.art.proxy(l,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),this.emit())})}createSliders(){this.slider.opacity=this.createSlider({...this.OPACITY,container:this.template.$opacitySlider,findIndex:()=>Math.round(100*this.option.opacity),onChange:t=>{let{$opacityValue:e}=this.template;e.textContent=`${t}%`,this.danmuku.config({opacity:t/100})}}),this.slider.margin=this.createSlider({...this.MARGIN,container:this.template.$marginSlider,findIndex:()=>this.MARGIN.steps.findIndex(t=>t.value[0]===this.option.margin[0]&&t.value[1]===this.option.margin[1]),onChange:t=>{let e=this.MARGIN.steps[t];if(!e)return;let{$marginValue:i}=this.template;i.textContent=e.name,this.danmuku.config({margin:e.value})}}),this.slider.fontSize=this.createSlider({...this.FONT_SIZE,container:this.template.$fontSizeSlider,findIndex:()=>this.danmuku.fontSize,onChange:t=>{let{$fontSizeValue:e}=this.template;e.textContent=`${t}px`,t!==this.danmuku.fontSize&&this.danmuku.config({fontSize:t})}}),this.slider.speed=this.createSlider({...this.SPEED,container:this.template.$speedSlider,findIndex:()=>this.SPEED.steps.findIndex(t=>t.value===this.option.speed),onChange:t=>{let e=this.SPEED.steps[t];if(!e)return;let{$speedValue:i}=this.template;i.textContent=e.name,this.danmuku.config({speed:e.value})}})}createSlider({min:t,max:e,container:i,findIndex:a,onChange:n,steps:o=[]}){let{query:s,clamp:l,setStyle:r}=this.utils;r(i,"touch-action","none"),i.innerHTML=`
${o.map(()=>'
').join("")}
${o.map(t=>t.hide?"":`
${t.name}
`).join("")}
`;let d=s(".apd-slider-dot",i),p=s(".apd-slider-progress",i),u=!1;function h(i=a()){if(ie)return;let s=(i-t)/(e-t);d.style.left=`${100*s}%`,0===o.length&&(p.style.width=d.style.left),n(i)}function m(a){let{top:n,height:o,left:s,width:r}=i.getBoundingClientRect();this.art.isRotate?h(Math.round(l(a.clientY-n,0,o)/o*(e-t)+t)):h(Math.round(l(a.clientX-s,0,r)/r*(e-t)+t))}return this.art.proxy(i,"click",t=>{m.call(this,t)}),this.art.proxy(i,"pointerdown",t=>{u=0===t.button}),this.art.proxy(document,"pointermove",t=>{u&&m.call(this,t)}),this.art.proxy(document,"pointerup",t=>{u&&(u=!1,m.call(this,t))}),{reset:h}}onFullscreen(t){let{$danmuku:e,$controlsCenter:i,$mount:a}=this.template;this.outside?t?this.append(i,e):this.append(a,e):this.append(i,e)}onMouseEnter({$control:t,$panel:e}){let{$player:i}=this.art.template,a=t.getBoundingClientRect(),n=e.getBoundingClientRect(),o=i.getBoundingClientRect(),s=n.width/2-a.width/2,l=o.left-(a.left-s),r=a.right+s-o.right;l>0?e.style.left=`${-s+l}px`:r>0?e.style.left=`${-s-r}px`:e.style.left=`${-s}px`}async emit(){let{$input:t}=this.template,e=t.value.trim();if(!e.length||this.isLock||this.emitting)return;let i={text:e,mode:this.option.mode,color:this.option.color,time:this.art.currentTime};try{this.emitting=!0;let e=await this.option.beforeEmit(i);if(this.emitting=!1,!0!==e)return;i.border=!0,delete i.time,this.danmuku.emit(i),t.value="",this.lock()}catch(t){this.emitting=!1}}lock(){let{addClass:t}=this.utils,{$send:e}=this.template;this.isLock=!0;let i=this.option.lockTime;e.innerText=i,t(e,"apd-lock");let a=()=>{this.timer=setTimeout(()=>{0===i?this.unlock():(e.innerText=i-=1,a())},1e3)};a()}unlock(){let{removeClass:t}=this.utils,{$send:e}=this.template;clearTimeout(this.timer),this.isLock=!1,e.innerText="发送",t(e,"apd-lock")}resize(){if(this.outside||this.art.fullscreen||this.art.fullscreenWeb)return;let{$player:t,$controlsCenter:e}=this.art.template,{$danmuku:i}=this.template;this.art.widtht.dataset.color===this.option.color.toUpperCase());n&&t(n,"apd-active"),e(i,this.option.visible?"关闭弹幕":"打开弹幕"),this.resize()}mount(t){let{errorHandle:e}=this.utils,i="string"==typeof t?document.querySelector(t):t;e(i,`Can not find the mount point: ${t}`),this.append(i,this.template.$danmuku),this.template.$mount=i,this.reset()}},"undefined"!=typeof document){let t="artplayer-plugin-danmuku",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=s.default}},{"bundle-text:./style.less":"jaQAo","bundle-text:./img/on.svg":"86CEd","bundle-text:./img/off.svg":"3FcnK","bundle-text:./img/config.svg":"j1vhO","bundle-text:./img/style.svg":"jmfTi","bundle-text:./img/mode_0_off.svg":"ffHqV","bundle-text:./img/mode_0_on.svg":"eGfex","bundle-text:./img/mode_1_off.svg":"77326","bundle-text:./img/mode_1_on.svg":"6P4nN","bundle-text:./img/mode_2_off.svg":"cBcwx","bundle-text:./img/mode_2_on.svg":"i6KC4","bundle-text:./img/check_on.svg":"2H4K5","bundle-text:./img/check_off.svg":"4JI0m","@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],jaQAo:[function(t,e,i,a){e.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{opacity:0;pointer-events:none;width:320px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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{opacity:0;pointer-events:none;width:200px;padding:10px;position:absolute;bottom:24px;left:0}.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{opacity:100;pointer-events:all}.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;width:60px;height:100%;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;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}.art-video-player>.artplayer-plugin-danmuku{padding:0 10px;position:absolute;bottom:-40px;left:0;right:0}.art-video-player:has(>.artplayer-plugin-danmuku){margin-bottom:40px}[data-danmuku-emitter=false] .apd-emitter{display:none!important}[data-danmuku-emitter=false] .art-controls-center .artplayer-plugin-danmuku{justify-content:flex-end;gap:18px}[data-danmuku-emitter=false].art-fullscreen .art-controls-center .artplayer-plugin-danmuku,[data-danmuku-emitter=false].art-fullscreen-web .art-controls-center .artplayer-plugin-danmuku{gap:24px}[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}'},{}],"86CEd":[function(t,e,i,a){e.exports=''},{}],"3FcnK":[function(t,e,i,a){e.exports=''},{}],j1vhO:[function(t,e,i,a){e.exports=''},{}],jmfTi:[function(t,e,i,a){e.exports=''},{}],ffHqV:[function(t,e,i,a){e.exports=''},{}],eGfex:[function(t,e,i,a){e.exports=''},{}],77326:[function(t,e,i,a){e.exports=''},{}],"6P4nN":[function(t,e,i,a){e.exports=''},{}],cBcwx:[function(t,e,i,a){e.exports=''},{}],i6KC4:[function(t,e,i,a){e.exports=''},{}],"2H4K5":[function(t,e,i,a){e.exports=''},{}],"4JI0m":[function(t,e,i,a){e.exports=''},{}],falVu:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>l);let o={map:(t,e,i,a,n)=>(t-e)*(n-a)/(i-e)+a,range(t,e,i){let a=Math.round(t/i)*i;return Array.from({length:Math.floor((e-t)/i)},(t,e)=>e*i+a)}},s=(t,e)=>{let i=e[0]-t[0],a=e[1]-t[1];return{length:Math.sqrt(Math.pow(i,2)+Math.pow(a,2)),angle:Math.atan2(a,i)}};function l(t,e,i){let{query:a}=t.constructor.utils;t.controls.add({name:"heatmap",position:"top",html:"",style:{position:"absolute",top:"-100px",left:"0px",right:"0px",height:"100px",width:"100%",pointerEvents:"none"},mounted(n){let l=null,r=null;function d(p=[]){if(l=null,r=null,n.innerHTML="",!t.duration||t.option.isLive)return;let u={w:n.offsetWidth,h:n.offsetHeight},h={xMin:0,xMax:u.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*u.h),sampling:Math.floor(u.w/100),smoothing:.2,flattening:.2};"object"==typeof i&&Object.assign(h,i);let m=[];if(Array.isArray(p)&&p.length)m=[...p];else{let i=t.duration/u.w;for(let t=0;t<=u.w;t+=h.sampling){let a=e.queue.filter(({time:e})=>e>t*i&&e<=(t+h.sampling)*i).length;m.push([t,a])}}if(0===m.length)return;let c=m[m.length-1],f=c[0],g=c[1];f!==u.w&&m.push([u.w,g]);let y=m.map(t=>t[1]),v=(Math.min(...y)+Math.max(...y))/2;for(let t=0;tv?1+h.scale:1-h.scale)+h.minHeight}let x=(t,e,i,a)=>{let n=s(e||t,i||t),l=o.map(Math.cos(n.angle)*h.flattening,0,1,1,0),r=n.angle*l+(a?Math.PI:0),d=n.length*h.smoothing;return[t[0]+Math.cos(r)*d,t[1]+Math.sin(r)*d]},k=(t,e,i)=>{let a=x(i[e-1],i[e-2],t),n=x(t,i[e-1],i[e+1],!0),o=e===i.length-1?" z":"";return`C ${a[0]},${a[1]} ${n[0]},${n[1]} ${t[0]},${t[1]}${o}`},$=m.map(t=>[o.map(t[0],h.xMin,h.xMax,0,u.w),o.map(t[1],h.yMin,h.yMax,u.h,0)]).reduce((t,e,i,a)=>0===i?`M ${a[a.length-1][0]},${u.h} L ${e[0]},${u.h} L ${e[0]},${e[1]}`:`${t} ${k(e,i,a)}`,"");n.innerHTML=``,l=a("#heatmap-start",n),r=a("#heatmap-stop",n),l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{l&&r&&(l.setAttribute("offset",`${100*t.played}%`),r.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{l&&r&&"played"===t&&(l.setAttribute("offset",`${100*e}%`),r.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>d()),t.on("resize",()=>d()),t.on("artplayerPluginDanmuku:loaded",()=>d()),t.on("artplayerPluginDanmuku:points",t=>d(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}]},["jz4E5"],"jz4E5","parcelRequire93cf",{}); \ 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 8b35c2087..d26a49466 100644 --- a/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.legacy.js +++ b/packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.legacy.js @@ -5,4 +5,4 @@ * (c) 2017-2025 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,r,a,i,o,s){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof l[r]&&l[r],c=u.i||{},d=u.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!d[t]){if(!e[t]){if(a[t])return a[t];var i="function"==typeof l[r]&&l[r];if(!n&&i)return i(t,!0);if(u)return u(t,!0);if(p&&"string"==typeof t)return p(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}c.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},c.cache={};var s=d[t]=new f.Module(t);e[t][0].call(s.exports,c,s,s.exports,l)}return d[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=p,this.exports={}},f.modules=e,f.cache=d,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var h=0;h=n.time&&n.time>=e-.1&&t.push(n)}),t}},{key:"visibles",get:function(){var e=this,t=[],n=this.$player.clientWidth,r=this.getLeft(this.$player);return this.filter("emit",function(a){var i=a.$ref.offsetTop,o=e.getLeft(a.$ref)-r,s=a.$ref.clientHeight,l=a.$ref.clientWidth,u=o+l,c=u/a.$restTime,d={};d.top=i,d.left=o,d.height=s,d.width=l,d.right=n-u,d.speed=c,d.distance=u,d.time=a.$restTime,d.mode=a.mode,t.push(d)}),t}},{key:"speed",get:function(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}},{key:"load",value:function(e){var t=this;return(0,i._)(function(){var n,r,a,i,o,s;return(0,c._)(this,function(l){switch(l.label){case 0:n=t.utils.errorHandle,r=[],a=e||t.option.danmuku,l.label=1;case 1:if(l.trys.push([1,13,,14]),"function"!=typeof a)return[3,3];return[4,a()];case 2:case 4:case 6:return r=l.sent(),[3,8];case 3:if(!(a instanceof Promise))return[3,5];return[4,a];case 5:if("string"!=typeof a)return[3,7];return[4,(0,d.bilibiliDanmuParseFromUrl)(a)];case 7:Array.isArray(a)&&(r=a),l.label=8;case 8:n(Array.isArray(r),"Danmuku need return an array as result"),void 0===e&&(t.reset(),t.queue=[],t.states={wait:[],ready:[],emit:[],stop:[]},t.$refs=[],t.$danmuku.innerText=""),i=0,l.label=9;case 9:if(!(i0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(n){t.id=Date.now(),e.worker.postMessage(t),e.worker.onmessage=function(e){var r=e.data;r.id===t.id&&n(r)}})}},{key:"filter",value:function(e,t){for(var n=this.states[e]||[],r=0;rt.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);at.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function c(e,t,n,r){var a,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(s=(o<3?a(s):o>3?a(t,n,s):a(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function d(e,t){return function(n,r){t(n,r,e)}}function p(e,t,n,r,a,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var l,u=r.kind,c="getter"===u?"get":"setter"===u?"set":"value",d=!t&&e?r.static?e:e.prototype:null,p=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),f=!1,h=n.length-1;h>=0;h--){var m={};for(var y in r)m[y]="access"===y?{}:r[y];for(var y in r.access)m.access[y]=r.access[y];m.addInitializer=function(e){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var g=(0,n[h])("accessor"===u?{get:p.get,set:p.set}:p[c],m);if("accessor"===u){if(void 0===g)continue;if(null===g||(void 0===g?"undefined":(0,i._)(g))!=="object")throw TypeError("Object expected");(l=s(g.get))&&(p.get=l),(l=s(g.set))&&(p.set=l),(l=s(g.init))&&a.unshift(l)}else(l=s(g))&&("field"===u?a.unshift(l):p[c]=l)}d&&Object.defineProperty(d,r.name,p),f=!0}function f(e,t,n){for(var r=arguments.length>2,a=0;a0&&a[a.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return o}function w(){for(var e=[],t=0;t1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{var n;(n=a[e](t)).value instanceof S?Promise.resolve(n.value.v).then(l,u):c(i[0][2],n)}catch(e){c(i[0][3],e)}}function l(e){s("next",e)}function u(e){s("throw",e)}function c(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function M(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,a){t[r]=e[r]?function(t){return(n=!n)?{value:S(e[r](t)),done:!1}:a?a(t):t}:a}}function P(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=x(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,a){var i,o,s;i=r,o=a,s=(t=e[n](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:s})},o)})}}}function E(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var D=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},T=function(e){return(T=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t})(e)};function A(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=T(e),r=0;r(?.+?)<\\/d>',"gs"));return Array.from(e.matchAll(t)).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:s(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 u(e){var t=e.data,n=t.xml,r=t.id;if(r&&n){var a=l(n);self.postMessage({danmus:a,id:r})}}function c(e){var t;return new Promise((t=(0,i._)(function(t){var n,r;return(0,o._)(this,function(a){switch(a.label){case 0:return[4,fetch(e)];case 1:return[4,a.sent().text()];case 2:n=a.sent();try{var i;i=new Blob(["\n ".concat(s.toString(),"\n ").concat(l.toString(),"\n onmessage = ").concat(u.toString(),"\n ")],{type:"application/javascript"}),(r=new Worker(URL.createObjectURL(i))).onmessage=function(e){var n=e.data,a=n.danmus;n.id&&a&&(t(a),r.terminate())},r.postMessage({xml:n,id:Date.now()})}catch(e){t(l(n))}return[2]}})}),function(e){return t.apply(this,arguments)}))}},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],eJQ5w:[function(e,t,n,r){t.exports='!function(e,t,r,n,i,o,f,u){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof a[n]&&a[n],s=c.i||{},d=c.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!d[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof a[n]&&a[n];if(!r&&o)return o(t,!0);if(c)return c(t,!0);if(l&&"string"==typeof t)return l(t);var f=Error("Cannot find module \'"+t+"\'");throw f.code="MODULE_NOT_FOUND",f}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var u=d[t]=new p.Module(t);e[t][0].call(u.exports,s,u,u.exports,a)}return d[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=l,this.exports={}},p.modules=e,p.cache=d,p.parent=c,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[n]}}),a[n]=p;for(var h=0;h=0;d-=1){var l=s[d],p=s[d+1],h=l.top+l.height;if(p.top-h>=t.height)return p.top-t.height}else for(var m=1;m=t.height)return v}for(var y=[],_=1;_e.time))})});return A&&A[0]?A[0].top:void 0;case 1:case 2:return}else{switch(t.mode){case 0:y.sort(function(e,t){var r,n,o=(r=Math).min.apply(r,(0,i._)(t.map(function(e){return e.right}))),f=(n=Math).min.apply(n,(0,i._)(e.map(function(e){return e.right})));return o*t.length-f*e.length});break;case 1:case 2:y.sort(function(e,t){var r,n,o=(r=Math).max.apply(r,(0,i._)(t.map(function(e){return e.width})));return(n=Math).max.apply(n,(0,i._)(e.map(function(e){return e.width})))*e.length-o*t.length})}return y[0][0].top}}onmessage=function(e){var t=e.data;if(t.id&&t.type){var r=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:r,id:t.id})}}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6"}],i81N6:[function(e,t,r,n){"use strict";var i=e("d402183024004bc7"),o=e("3209e2b12672cd18"),f=e("fc58adb8f1bff142"),u=e("5e213dc122a10171");r._=function(e){return i._(e)||o._(e)||u._(e)||f._()}},{d402183024004bc7:"hfQG0","3209e2b12672cd18":"fQrlQ",fc58adb8f1bff142:"fWabh","5e213dc122a10171":"fh7mx"}],hfQG0:[function(e,t,r,n){"use strict";var i=e("5bd5b10bf87fc8e");r._=function(e){if(Array.isArray(e))return i._(e)}},{"5bd5b10bf87fc8e":"1WOAB"}],"1WOAB":[function(e,t,r,n){"use strict";r._=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r\n '.concat(m.default).concat(g.default,'\n\n
\n ').concat(b.default,'\n
\n
\n
\n 按类型屏蔽\n
\n
\n ').concat(w.default).concat($.default,'\n
滚动
\n
\n
\n ').concat(O.default).concat(P.default,'\n
顶部
\n
\n
\n ').concat(D.default).concat(A.default,'\n
底部
\n
\n
\n
\n
\n
\n ').concat(F.default).concat(C.default,'\n 防止弹幕重叠\n
\n
\n ').concat(F.default).concat(C.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(x.default,'\n
\n
\n
\n 模式\n
\n
\n ').concat($.default,'\n
滚动
\n
\n
\n ').concat(P.default,'\n
顶部
\n
\n
\n ').concat(A.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:"OPACITY",get:function(){return(0,l._)({min:0,max:100,steps:[]},this.option.OPACITY)}},{key:"FONT_SIZE",get:function(){return(0,l._)({min:12,max:120,steps:[]},this.option.FONT_SIZE)}},{key:"MARGIN",get:function(){return(0,l._)({min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}]},this.option.MARGIN)}},{key:"SPEED",get:function(){return(0,l._)({min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}]},this.option.SPEED)}},{key:"COLOR",get:function(){return this.option.COLOR.length?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:"append",value:function(e,t){var n=this.utils.append;(0,c._)(e.children).some(function(e){return e===t})||n(e,t)}},{key:"setData",value:function(e,t){var n=this.art.template.$player,r=this.template.$mount;n.dataset[e]=t,this.outside&&(r.dataset[e]=t)}},{key:"createTemplate",value:function(){var e=this.utils,t=e.createElement,n=e.tooltip,r=t("div");r.className="artplayer-plugin-danmuku",r.innerHTML=this.TEMPLATE,this.template.$danmuku=r,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");var a=this.template.$toggle;this.art.on("artplayerPluginDanmuku:show",function(){n(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",function(){n(a,"打开弹幕")})}},{key:"createEvents",value:function(){var e=this,t=this.template,n=t.$toggle,r=t.$configModes,a=t.$styleModes,i=t.$colors,o=t.$antiOverlap,s=t.$syncVideo,l=t.$send,u=t.$input;this.art.proxy(n,"click",function(){e.danmuku.config({visible:!e.option.visible}),e.reset()}),this.art.proxy(r,"click",function(t){var n=t.target.closest(".apd-mode");if(n){var r=Number(n.dataset.mode);e.option.modes.includes(r)?e.danmuku.config({modes:e.option.modes.filter(function(e){return e!==r})}):e.danmuku.config({modes:(0,c._)(e.option.modes).concat([r])}),e.reset()}}),this.art.proxy(o,"click",function(){e.danmuku.config({antiOverlap:!e.option.antiOverlap}),e.reset()}),this.art.proxy(s,"click",function(){e.danmuku.config({synchronousPlayback:!e.option.synchronousPlayback}),e.reset()}),this.art.proxy(a,"click",function(t){var n=t.target.closest(".apd-mode");if(n){var r=Number(n.dataset.mode);e.danmuku.config({mode:r}),e.reset()}}),this.art.proxy(i,"click",function(t){var n=t.target.closest(".apd-color");n&&(e.danmuku.config({color:n.dataset.color}),e.reset())}),this.art.proxy(l,"click",function(){return e.emit()}),this.art.proxy(u,"keypress",function(t){"Enter"===t.key&&(t.preventDefault(),e.emit())})}},{key:"createSliders",value:function(){var e=this;this.slider.opacity=this.createSlider((0,u._)((0,l._)({},this.OPACITY),{container:this.template.$opacitySlider,findIndex:function(){return Math.round(100*e.option.opacity)},onChange:function(t){e.template.$opacityValue.textContent="".concat(t,"%"),e.danmuku.config({opacity:t/100})}})),this.slider.margin=this.createSlider((0,u._)((0,l._)({},this.MARGIN),{container:this.template.$marginSlider,findIndex:function(){return e.MARGIN.steps.findIndex(function(t){return t.value[0]===e.option.margin[0]&&t.value[1]===e.option.margin[1]})},onChange:function(t){var n=e.MARGIN.steps[t];n&&(e.template.$marginValue.textContent=n.name,e.danmuku.config({margin:n.value}))}})),this.slider.fontSize=this.createSlider((0,u._)((0,l._)({},this.FONT_SIZE),{container:this.template.$fontSizeSlider,findIndex:function(){return e.danmuku.fontSize},onChange:function(t){e.template.$fontSizeValue.textContent="".concat(t,"px"),t!==e.danmuku.fontSize&&e.danmuku.config({fontSize:t})}})),this.slider.speed=this.createSlider((0,u._)((0,l._)({},this.SPEED),{container:this.template.$speedSlider,findIndex:function(){return e.SPEED.steps.findIndex(function(t){return t.value===e.option.speed})},onChange:function(t){var n=e.SPEED.steps[t];n&&(e.template.$speedValue.textContent=n.name,e.danmuku.config({speed:n.value}))}}))}},{key:"createSlider",value:function(e){var t=this,n=e.min,r=e.max,a=e.container,i=e.findIndex,o=e.onChange,s=e.steps,l=void 0===s?[]:s,u=this.utils,c=u.query,d=u.clamp;(0,u.setStyle)(a,"touch-action","none"),a.innerHTML='\n
\n
\n '.concat(l.map(function(){return'
'}).join(""),'\n
\n
\n
\n
\n
\n ').concat(l.map(function(e){return e.hide?"":'
'.concat(e.name,"
")}).join(""),"\n
\n ");var p=c(".apd-slider-dot",a),f=c(".apd-slider-progress",a),h=!1;function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i();if(!(er)){var t=(e-n)/(r-n);p.style.left="".concat(100*t,"%"),0===l.length&&(f.style.width=p.style.left),o(e)}}function y(e){var t=a.getBoundingClientRect(),i=t.top,o=t.height,s=t.left,l=t.width;this.art.isRotate?m(Math.round(d(e.clientY-i,0,o)/o*(r-n)+n)):m(Math.round(d(e.clientX-s,0,l)/l*(r-n)+n))}return this.art.proxy(a,"click",function(e){y.call(t,e)}),this.art.proxy(a,"pointerdown",function(e){h=0===e.button}),this.art.proxy(document,"pointermove",function(e){h&&y.call(t,e)}),this.art.proxy(document,"pointerup",function(e){h&&(h=!1,y.call(t,e))}),{reset:m}}},{key:"onFullscreen",value:function(e){var t=this.template,n=t.$danmuku,r=t.$controlsCenter,a=t.$mount;this.outside?e?this.append(r,n):this.append(a,n):this.append(r,n)}},{key:"onMouseEnter",value:function(e){var t=e.$control,n=e.$panel,r=this.art.template.$player,a=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.getBoundingClientRect(),s=i.width/2-a.width/2,l=o.left-(a.left-s),u=a.right+s-o.right;l>0?n.style.left="".concat(-s+l,"px"):u>0?n.style.left="".concat(-s-u,"px"):n.style.left="".concat(-s,"px")}},{key:"emit",value:function(){var e=this;return(0,i._)(function(){var t,n,r,a;return(0,d._)(this,function(i){switch(i.label){case 0:if(!(n=(t=e.template.$input).value.trim()).length||e.isLock||e.emitting)return[2];r={text:n,mode:e.option.mode,color:e.option.color,time:e.art.currentTime},i.label=1;case 1:return i.trys.push([1,3,,4]),e.emitting=!0,[4,e.option.beforeEmit(r)];case 2:if(a=i.sent(),e.emitting=!1,!0!==a)return[2];return r.border=!0,delete r.time,e.danmuku.emit(r),t.value="",e.lock(),[3,4];case 3:return i.sent(),e.emitting=!1,[3,4];case 4:return[2]}})})()}},{key:"lock",value:function(){var e=this,t=this.utils.addClass,n=this.template.$send;this.isLock=!0;var r=this.option.lockTime;n.innerText=r,t(n,"apd-lock");var a=function(){e.timer=setTimeout(function(){0===r?e.unlock():(n.innerText=r-=1,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:"resize",value:function(){if(!this.outside&&!this.art.fullscreen&&!this.art.fullscreenWeb){var e=this.art.template,t=e.$player,n=e.$controlsCenter,r=this.template.$danmuku;this.art.widthe.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[];if(u=null,c=null,a.innerHTML="",e.duration&&!e.option.isLive){var h={w:a.offsetWidth,h:a.offsetHeight},m={xMin:0,xMax:h.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*h.h),sampling:Math.floor(h.w/100),smoothing:.2,flattening:.2};(void 0===n?"undefined":(0,o._)(n))==="object"&&Object.assign(m,n);var y=[];if(Array.isArray(f)&&f.length)y=(0,i._)(f);else for(var g=function(e){var n=t.queue.filter(function(t){var n=t.time;return n>e*v&&n<=(e+m.sampling)*v}).length;y.push([e,n])},v=e.duration/h.w,b=0;b<=h.w;b+=m.sampling)g(b);if(0!==y.length){var _=y[y.length-1],x=_[0],k=_[1];x!==h.w&&y.push([h.w,k]);for(var w=y.map(function(e){return e[1]}),j=((d=Math).min.apply(d,(0,i._)(w))+(p=Math).max.apply(p,(0,i._)(w)))/2,$=0;$j?1+m.scale:1-m.scale)+m.minHeight}var M=function(e,t,n,r){var a=l(t||e,n||e),i=s.map(Math.cos(a.angle)*m.flattening,0,1,1,0),o=a.angle*i+(r?Math.PI:0),u=a.length*m.smoothing;return[e[0]+Math.cos(o)*u,e[1]+Math.sin(o)*u]},P=function(e,t,n){var r=M(n[t-1],n[t-2],e),a=M(e,n[t-1],n[t+1],!0),i=t===n.length-1?" z":"";return"C ".concat(r[0],",").concat(r[1]," ").concat(a[0],",").concat(a[1]," ").concat(e[0],",").concat(e[1]).concat(i)},E=y.map(function(e){return[s.map(e[0],m.xMin,m.xMax,0,h.w),s.map(e[1],m.yMin,m.yMax,h.h,0)]}).reduce(function(e,t,n,r){return 0===n?"M ".concat(r[r.length-1][0],",").concat(h.h," L ").concat(t[0],",").concat(h.h," L ").concat(t[0],",").concat(t[1]):"".concat(e," ").concat(P(t,n,r))},"");a.innerHTML='\n\n\n\n\n\n\n\n\n\n\n\n '),u=r("#heatmap-start",a),c=r("#heatmap-stop",a),u.setAttribute("offset","".concat(100*e.played,"%")),c.setAttribute("offset","".concat(100*e.played,"%"))}}}e.on("video:timeupdate",function(){u&&c&&(u.setAttribute("offset","".concat(100*e.played,"%")),c.setAttribute("offset","".concat(100*e.played,"%")))}),e.on("setBar",function(e,t){u&&c&&"played"===e&&(u.setAttribute("offset","".concat(100*t,"%")),c.setAttribute("offset","".concat(100*t,"%")))}),e.on("ready",function(){return d()}),e.on("resize",function(){return d()}),e.on("artplayerPluginDanmuku:loaded",function(){return d()}),e.on("artplayerPluginDanmuku:points",function(e){return d(e)})}})}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"i81N6","@swc/helpers/cjs/_type_of.cjs":"iXhRw","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}]},["l3CkF"],"l3CkF","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,n,r,a,i,o,s){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof l[r]&&l[r],c=u.i||{},d=u.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!d[t]){if(!e[t]){if(a[t])return a[t];var i="function"==typeof l[r]&&l[r];if(!n&&i)return i(t,!0);if(u)return u(t,!0);if(p&&"string"==typeof t)return p(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}c.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},c.cache={};var s=d[t]=new f.Module(t);e[t][0].call(s.exports,c,s,s.exports,l)}return d[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=p,this.exports={}},f.modules=e,f.cache=d,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var h=0;h=n.time&&n.time>=e-.1&&t.push(n)}),t}},{key:"visibles",get:function(){var e=this,t=[],n=this.$player.clientWidth,r=this.getLeft(this.$player);return this.filter("emit",function(a){var i=a.$ref.offsetTop,o=e.getLeft(a.$ref)-r,s=a.$ref.clientHeight,l=a.$ref.clientWidth,u=o+l,c=u/a.$restTime,d={};d.top=i,d.left=o,d.height=s,d.width=l,d.right=n-u,d.speed=c,d.distance=u,d.time=a.$restTime,d.mode=a.mode,t.push(d)}),t}},{key:"speed",get:function(){return this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed}},{key:"load",value:function(e){var t=this;return(0,i._)(function(){var n,r,a,i,o,s;return(0,c._)(this,function(l){switch(l.label){case 0:n=t.utils.errorHandle,r=[],a=e||t.option.danmuku,l.label=1;case 1:if(l.trys.push([1,13,,14]),"function"!=typeof a)return[3,3];return[4,a()];case 2:case 4:case 6:return r=l.sent(),[3,8];case 3:if(!(a instanceof Promise))return[3,5];return[4,a];case 5:if("string"!=typeof a)return[3,7];return[4,(0,d.bilibiliDanmuParseFromUrl)(a)];case 7:Array.isArray(a)&&(r=a),l.label=8;case 8:n(Array.isArray(r),"Danmuku need return an array as result"),void 0===e&&(t.reset(),t.queue=[],t.states={wait:[],ready:[],emit:[],stop:[]},t.$refs=[],t.$danmuku.innerText=""),i=0,l.label=9;case 9:if(!(i1&&void 0!==arguments[1]&&arguments[1],a=this.utils.clamp,i=this.art.template.$controlsCenter;return(Object.keys(t).some(function(e){return JSON.stringify(n.option[e])!==JSON.stringify(t[e])})||r)&&(this.option=Object.assign({},e.option,this.option,t),this.validator(this.option,e.scheme),this.option.mode=a(this.option.mode,0,2),this.option.speed=a(this.option.speed,1,10),this.option.opacity=a(this.option.opacity,0,1),this.option.lockTime=a(this.option.lockTime,1,60),this.option.maxLength=a(this.option.maxLength,1,1e3),this.option.mount=this.option.mount||i,t.fontSize&&this.reset(),this.option.visible?this.show():this.hide(),this.art.emit("artplayerPluginDanmuku:config",this.option)),this}},{key:"getLeft",value:function(e){var t=e.getBoundingClientRect();return this.isRotate?t.top:t.left}},{key:"postMessage",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(n){t.id=Date.now(),e.worker.postMessage(t),e.worker.onmessage=function(e){var r=e.data;r.id===t.id&&n(r)}})}},{key:"filter",value:function(e,t){for(var n=this.states[e]||[],r=0;rt.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);at.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function c(e,t,n,r){var a,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(s=(o<3?a(s):o>3?a(t,n,s):a(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function d(e,t){return function(n,r){t(n,r,e)}}function p(e,t,n,r,a,o){function s(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var l,u=r.kind,c="getter"===u?"get":"setter"===u?"set":"value",d=!t&&e?r.static?e:e.prototype:null,p=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),f=!1,h=n.length-1;h>=0;h--){var m={};for(var g in r)m[g]="access"===g?{}:r[g];for(var g in r.access)m.access[g]=r.access[g];m.addInitializer=function(e){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(s(e||null))};var y=(0,n[h])("accessor"===u?{get:p.get,set:p.set}:p[c],m);if("accessor"===u){if(void 0===y)continue;if(null===y||(void 0===y?"undefined":(0,i._)(y))!=="object")throw TypeError("Object expected");(l=s(y.get))&&(p.get=l),(l=s(y.set))&&(p.set=l),(l=s(y.init))&&a.unshift(l)}else(l=s(y))&&("field"===u?a.unshift(l):p[c]=l)}d&&Object.defineProperty(d,r.name,p),f=!0}function f(e,t,n){for(var r=arguments.length>2,a=0;a0&&a[a.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!a||u[1]>a[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return o}function w(){for(var e=[],t=0;t1||s(e,t)})},t&&(r[e]=t(r[e])))}function s(e,t){try{var n;(n=a[e](t)).value instanceof S?Promise.resolve(n.value.v).then(l,u):c(i[0][2],n)}catch(e){c(i[0][3],e)}}function l(e){s("next",e)}function u(e){s("throw",e)}function c(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function E(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,a){t[r]=e[r]?function(t){return(n=!n)?{value:S(e[r](t)),done:!1}:a?a(t):t}:a}}function M(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=x(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,a){var i,o,s;i=r,o=a,s=(t=e[n](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:s})},o)})}}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},D=function(e){return(D=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t})(e)};function z(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=D(e),r=0;r(?.+?)<\\/d>',"gs"));return Array.from(e.matchAll(t)).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:s(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 u(e){var t=e.data,n=t.xml,r=t.id;if(r&&n){var a=l(n);self.postMessage({danmus:a,id:r})}}function c(e){var t;return new Promise((t=(0,i._)(function(t){var n,r;return(0,o._)(this,function(a){switch(a.label){case 0:return[4,fetch(e)];case 1:return[4,a.sent().text()];case 2:n=a.sent();try{var i;i=new Blob(["\n ".concat(s.toString(),"\n ").concat(l.toString(),"\n onmessage = ").concat(u.toString(),"\n ")],{type:"application/javascript"}),(r=new Worker(URL.createObjectURL(i))).onmessage=function(e){var n=e.data,a=n.danmus;n.id&&a&&(t(a),r.terminate())},r.postMessage({xml:n,id:Date.now()})}catch(e){t(l(n))}return[2]}})}),function(e){return t.apply(this,arguments)}))}},{"@swc/helpers/cjs/_async_to_generator.cjs":"4ElRo","@swc/helpers/cjs/_ts_generator.cjs":"a4h1C","@parcel/transformer-js/src/esmodule-helpers.js":"ihnSZ"}],"3dTMr":[function(e,t,n,r){t.exports='!function(e,t,r,n,i,o,a,u){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof f[n]&&f[n],s=c.i||{},d=c.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!d[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof f[n]&&f[n];if(!r&&o)return o(t,!0);if(c)return c(t,!0);if(l&&"string"==typeof t)return l(t);var a=Error("Cannot find module \'"+t+"\'");throw a.code="MODULE_NOT_FOUND",a}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var u=d[t]=new p.Module(t);e[t][0].call(u.exports,s,u,u.exports,f)}return d[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=l,this.exports={}},p.modules=e,p.cache=d,p.parent=c,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=s,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return f[n]}}),f[n]=p;for(var h=0;h=0;d-=1){var l=s[d],p=s[d+1],h=l.top+l.height;if(p.top-h>=t.height)return p.top-t.height}else for(var g=1;g=t.height)return b}for(var y=[],_=1;_e.time))})});return M&&M[0]?M[0].top:void 0;case 1:case 2:return}else{switch(t.mode){case 0:y.sort(function(e,t){var r,n,o=(r=Math).min.apply(r,(0,i._)(t.map(function(e){return e.right}))),a=(n=Math).min.apply(n,(0,i._)(e.map(function(e){return e.right})));return o*t.length-a*e.length});break;case 1:case 2:y.sort(function(e,t){var r,n,o=(r=Math).max.apply(r,(0,i._)(t.map(function(e){return e.width})));return(n=Math).max.apply(n,(0,i._)(e.map(function(e){return e.width})))*e.length-o*t.length})}return y[0][0].top}}onmessage=function(e){var t=e.data;if(t.id&&t.type){var r=(0,({getDanmuTop:o})[t.type])(t);self.postMessage({result:r,id:t.id})}}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"1LaMX"}],"1LaMX":[function(e,t,r,n){"use strict";var i=e("39b649abd35ac2e2"),o=e("8428e13fa0ef5403"),a=e("8d50a6b373b717fa"),u=e("3c184cf684436bb9");r._=function(e){return i._(e)||o._(e)||u._(e)||a._()}},{"39b649abd35ac2e2":"i3OgW","8428e13fa0ef5403":"5CLcV","8d50a6b373b717fa":"cpcPX","3c184cf684436bb9":"ikxEb"}],i3OgW:[function(e,t,r,n){"use strict";var i=e("ec82543f1393b568");r._=function(e){if(Array.isArray(e))return i._(e)}},{ec82543f1393b568:"8HLaN"}],"8HLaN":[function(e,t,r,n){"use strict";r._=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r\n '.concat(m.default).concat(y.default,'\n\n
\n ').concat(b.default,'\n
\n
\n
\n 按类型屏蔽\n
\n
\n ').concat(w.default).concat($.default,'\n
滚动
\n
\n
\n ').concat(O.default).concat(M.default,'\n
顶部
\n
\n
\n ').concat(T.default).concat(z.default,'\n
底部
\n
\n
\n
\n
\n
\n ').concat(F.default).concat(q.default,'\n 防止弹幕重叠\n
\n
\n ').concat(F.default).concat(q.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(x.default,'\n
\n
\n
\n 模式\n
\n
\n ').concat($.default,'\n
滚动
\n
\n
\n ').concat(M.default,'\n
顶部
\n
\n
\n ').concat(z.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:"OPACITY",get:function(){return(0,l._)({min:0,max:100,steps:[]},this.option.OPACITY)}},{key:"FONT_SIZE",get:function(){return(0,l._)({min:12,max:120,steps:[]},this.option.FONT_SIZE)}},{key:"MARGIN",get:function(){return(0,l._)({min:0,max:3,steps:[{name:"1/4",value:[10,"75%"]},{name:"半屏",value:[10,"50%"]},{name:"3/4",value:[10,"25%"]},{name:"满屏",value:[10,10]}]},this.option.MARGIN)}},{key:"SPEED",get:function(){return(0,l._)({min:0,max:4,steps:[{name:"极慢",value:10},{name:"较慢",value:7.5,hide:!0},{name:"适中",value:5},{name:"较快",value:2.5,hide:!0},{name:"极快",value:1}]},this.option.SPEED)}},{key:"COLOR",get:function(){return this.option.COLOR.length?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:"append",value:function(e,t){var n=this.utils.append;(0,c._)(e.children).some(function(e){return e===t})||n(e,t)}},{key:"setData",value:function(e,t){var n=this.art.template.$player,r=this.template.$mount;n.dataset[e]=t,this.outside&&(r.dataset[e]=t)}},{key:"createTemplate",value:function(){var e=this.utils,t=e.createElement,n=e.tooltip,r=t("div");r.className="artplayer-plugin-danmuku",r.innerHTML=this.TEMPLATE,this.template.$danmuku=r,this.template.$toggle=this.query(".apd-toggle"),this.template.$config=this.query(".apd-config"),this.template.$configPanel=this.query(".apd-config-panel"),this.template.$configModes=this.query(".apd-config-mode .apd-modes"),this.template.$style=this.query(".apd-style"),this.template.$stylePanel=this.query(".apd-style-panel"),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");var a=this.template.$toggle;this.art.on("artplayerPluginDanmuku:show",function(){n(a,"关闭弹幕")}),this.art.on("artplayerPluginDanmuku:hide",function(){n(a,"打开弹幕")})}},{key:"createEvents",value:function(){var e=this,t=this.template,n=t.$toggle,r=t.$configModes,a=t.$styleModes,i=t.$colors,o=t.$antiOverlap,s=t.$syncVideo,l=t.$send,u=t.$input;this.art.proxy(n,"click",function(){e.danmuku.config({visible:!e.option.visible}),e.reset()}),this.art.proxy(r,"click",function(t){var n=t.target.closest(".apd-mode");if(n){var r=Number(n.dataset.mode);e.option.modes.includes(r)?e.danmuku.config({modes:e.option.modes.filter(function(e){return e!==r})}):e.danmuku.config({modes:(0,c._)(e.option.modes).concat([r])}),e.reset()}}),this.art.proxy(o,"click",function(){e.danmuku.config({antiOverlap:!e.option.antiOverlap}),e.reset()}),this.art.proxy(s,"click",function(){e.danmuku.config({synchronousPlayback:!e.option.synchronousPlayback}),e.reset()}),this.art.proxy(a,"click",function(t){var n=t.target.closest(".apd-mode");if(n){var r=Number(n.dataset.mode);e.danmuku.config({mode:r}),e.reset()}}),this.art.proxy(i,"click",function(t){var n=t.target.closest(".apd-color");n&&(e.danmuku.config({color:n.dataset.color}),e.reset())}),this.art.proxy(l,"click",function(){return e.emit()}),this.art.proxy(u,"keypress",function(t){"Enter"===t.key&&(t.preventDefault(),e.emit())})}},{key:"createSliders",value:function(){var e=this;this.slider.opacity=this.createSlider((0,u._)((0,l._)({},this.OPACITY),{container:this.template.$opacitySlider,findIndex:function(){return Math.round(100*e.option.opacity)},onChange:function(t){e.template.$opacityValue.textContent="".concat(t,"%"),e.danmuku.config({opacity:t/100})}})),this.slider.margin=this.createSlider((0,u._)((0,l._)({},this.MARGIN),{container:this.template.$marginSlider,findIndex:function(){return e.MARGIN.steps.findIndex(function(t){return t.value[0]===e.option.margin[0]&&t.value[1]===e.option.margin[1]})},onChange:function(t){var n=e.MARGIN.steps[t];n&&(e.template.$marginValue.textContent=n.name,e.danmuku.config({margin:n.value}))}})),this.slider.fontSize=this.createSlider((0,u._)((0,l._)({},this.FONT_SIZE),{container:this.template.$fontSizeSlider,findIndex:function(){return e.danmuku.fontSize},onChange:function(t){e.template.$fontSizeValue.textContent="".concat(t,"px"),t!==e.danmuku.fontSize&&e.danmuku.config({fontSize:t})}})),this.slider.speed=this.createSlider((0,u._)((0,l._)({},this.SPEED),{container:this.template.$speedSlider,findIndex:function(){return e.SPEED.steps.findIndex(function(t){return t.value===e.option.speed})},onChange:function(t){var n=e.SPEED.steps[t];n&&(e.template.$speedValue.textContent=n.name,e.danmuku.config({speed:n.value}))}}))}},{key:"createSlider",value:function(e){var t=this,n=e.min,r=e.max,a=e.container,i=e.findIndex,o=e.onChange,s=e.steps,l=void 0===s?[]:s,u=this.utils,c=u.query,d=u.clamp;(0,u.setStyle)(a,"touch-action","none"),a.innerHTML='\n
\n
\n '.concat(l.map(function(){return'
'}).join(""),'\n
\n
\n
\n
\n
\n ').concat(l.map(function(e){return e.hide?"":'
'.concat(e.name,"
")}).join(""),"\n
\n ");var p=c(".apd-slider-dot",a),f=c(".apd-slider-progress",a),h=!1;function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i();if(!(er)){var t=(e-n)/(r-n);p.style.left="".concat(100*t,"%"),0===l.length&&(f.style.width=p.style.left),o(e)}}function g(e){var t=a.getBoundingClientRect(),i=t.top,o=t.height,s=t.left,l=t.width;this.art.isRotate?m(Math.round(d(e.clientY-i,0,o)/o*(r-n)+n)):m(Math.round(d(e.clientX-s,0,l)/l*(r-n)+n))}return this.art.proxy(a,"click",function(e){g.call(t,e)}),this.art.proxy(a,"pointerdown",function(e){h=0===e.button}),this.art.proxy(document,"pointermove",function(e){h&&g.call(t,e)}),this.art.proxy(document,"pointerup",function(e){h&&(h=!1,g.call(t,e))}),{reset:m}}},{key:"onFullscreen",value:function(e){var t=this.template,n=t.$danmuku,r=t.$controlsCenter,a=t.$mount;this.outside?e?this.append(r,n):this.append(a,n):this.append(r,n)}},{key:"onMouseEnter",value:function(e){var t=e.$control,n=e.$panel,r=this.art.template.$player,a=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.getBoundingClientRect(),s=i.width/2-a.width/2,l=o.left-(a.left-s),u=a.right+s-o.right;l>0?n.style.left="".concat(-s+l,"px"):u>0?n.style.left="".concat(-s-u,"px"):n.style.left="".concat(-s,"px")}},{key:"emit",value:function(){var e=this;return(0,i._)(function(){var t,n,r,a;return(0,d._)(this,function(i){switch(i.label){case 0:if(!(n=(t=e.template.$input).value.trim()).length||e.isLock||e.emitting)return[2];r={text:n,mode:e.option.mode,color:e.option.color,time:e.art.currentTime},i.label=1;case 1:return i.trys.push([1,3,,4]),e.emitting=!0,[4,e.option.beforeEmit(r)];case 2:if(a=i.sent(),e.emitting=!1,!0!==a)return[2];return r.border=!0,delete r.time,e.danmuku.emit(r),t.value="",e.lock(),[3,4];case 3:return i.sent(),e.emitting=!1,[3,4];case 4:return[2]}})})()}},{key:"lock",value:function(){var e=this,t=this.utils.addClass,n=this.template.$send;this.isLock=!0;var r=this.option.lockTime;n.innerText=r,t(n,"apd-lock");var a=function(){e.timer=setTimeout(function(){0===r?e.unlock():(n.innerText=r-=1,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:"resize",value:function(){if(!this.outside&&!this.art.fullscreen&&!this.art.fullscreenWeb){var e=this.art.template,t=e.$player,n=e.$controlsCenter,r=this.template.$danmuku;this.art.widthe.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:[];if(u=null,c=null,a.innerHTML="",e.duration&&!e.option.isLive){var h={w:a.offsetWidth,h:a.offsetHeight},m={xMin:0,xMax:h.w,yMin:0,yMax:128,scale:.25,opacity:.2,minHeight:Math.floor(.05*h.h),sampling:Math.floor(h.w/100),smoothing:.2,flattening:.2};(void 0===n?"undefined":(0,o._)(n))==="object"&&Object.assign(m,n);var g=[];if(Array.isArray(f)&&f.length)g=(0,i._)(f);else for(var y=function(e){var n=t.queue.filter(function(t){var n=t.time;return n>e*v&&n<=(e+m.sampling)*v}).length;g.push([e,n])},v=e.duration/h.w,b=0;b<=h.w;b+=m.sampling)y(b);if(0!==g.length){var _=g[g.length-1],x=_[0],k=_[1];x!==h.w&&g.push([h.w,k]);for(var w=g.map(function(e){return e[1]}),j=((d=Math).min.apply(d,(0,i._)(w))+(p=Math).max.apply(p,(0,i._)(w)))/2,$=0;$j?1+m.scale:1-m.scale)+m.minHeight}var E=function(e,t,n,r){var a=l(t||e,n||e),i=s.map(Math.cos(a.angle)*m.flattening,0,1,1,0),o=a.angle*i+(r?Math.PI:0),u=a.length*m.smoothing;return[e[0]+Math.cos(o)*u,e[1]+Math.sin(o)*u]},M=function(e,t,n){var r=E(n[t-1],n[t-2],e),a=E(e,n[t-1],n[t+1],!0),i=t===n.length-1?" z":"";return"C ".concat(r[0],",").concat(r[1]," ").concat(a[0],",").concat(a[1]," ").concat(e[0],",").concat(e[1]).concat(i)},P=g.map(function(e){return[s.map(e[0],m.xMin,m.xMax,0,h.w),s.map(e[1],m.yMin,m.yMax,h.h,0)]}).reduce(function(e,t,n,r){return 0===n?"M ".concat(r[r.length-1][0],",").concat(h.h," L ").concat(t[0],",").concat(h.h," L ").concat(t[0],",").concat(t[1]):"".concat(e," ").concat(M(t,n,r))},"");a.innerHTML='\n\n\n\n\n\n\n\n\n\n\n\n '),u=r("#heatmap-start",a),c=r("#heatmap-stop",a),u.setAttribute("offset","".concat(100*e.played,"%")),c.setAttribute("offset","".concat(100*e.played,"%"))}}}e.on("video:timeupdate",function(){u&&c&&(u.setAttribute("offset","".concat(100*e.played,"%")),c.setAttribute("offset","".concat(100*e.played,"%")))}),e.on("setBar",function(e,t){u&&c&&"played"===e&&(u.setAttribute("offset","".concat(100*t,"%")),c.setAttribute("offset","".concat(100*t,"%")))}),e.on("ready",function(){return d()}),e.on("resize",function(){return d()}),e.on("artplayerPluginDanmuku:loaded",function(){return d()}),e.on("artplayerPluginDanmuku:points",function(e){return d(e)})}})}},{"@swc/helpers/cjs/_to_consumable_array.cjs":"1LaMX","@swc/helpers/cjs/_type_of.cjs":"9vrOw","@parcel/transformer-js/src/esmodule-helpers.js":"ihnSZ"}]},["bzF6W"],"bzF6W","parcelRequire93cf",{}); \ No newline at end of file