diff --git a/.size-snapshot.json b/.size-snapshot.json new file mode 100644 index 000000000..43ef02fa9 --- /dev/null +++ b/.size-snapshot.json @@ -0,0 +1,47 @@ +{ + "packages/artplayer/dist/artplayer.js": { + "bundled": 167524, + "minified": 91369, + "gzipped": 21798 + }, + "packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js": { + "bundled": 4642, + "minified": 1999, + "gzipped": 961 + }, + "packages/artplayer-tool-github/dist/artplayer-tool-github.js": { + "bundled": 12660, + "minified": 12307, + "gzipped": 4310 + }, + "packages/artplayer-plugin-gif/dist/artplayer-plugin-gif.js": { + "bundled": 98443, + "minified": 28826, + "gzipped": 10440 + }, + "packages/artplayer-plugin-playlist/dist/artplayer-plugin-playlist.js": { + "bundled": 4331, + "minified": 2031, + "gzipped": 857 + }, + "packages/artplayer-tool-thumbnail/dist/artplayer-tool-thumbnail.js": { + "bundled": 16311, + "minified": 7927, + "gzipped": 2827 + }, + "packages/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js": { + "bundled": 23907, + "minified": 12909, + "gzipped": 4096 + }, + "packages/artplayer-vue/dist/artplayer-vue.js": { + "bundled": 169067, + "minified": 92280, + "gzipped": 21954 + }, + "packages/artplayer-react/dist/artplayer-react.js": { + "bundled": 252440, + "minified": 121369, + "gzipped": 31023 + } +} diff --git a/dist/artplayer-plugin-backlight.js b/dist/artplayer-plugin-backlight.js index 1d3b992a3..765df117b 100644 --- a/dist/artplayer-plugin-backlight.js +++ b/dist/artplayer-plugin-backlight.js @@ -5,4 +5,4 @@ * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).artplayerPluginBacklight=e()}(this,function(){"use strict";function l(t){for(var e=[],n=0;n<10;n+=1)for(var o=0;o<5;o+=1)0!==n&&9!==n&&0!==o&&4!==o||e.push(t(n,o,10,5));return e}return function(o){var t=o.constructor.utils.setStyles,e=o.template,n=e.$player,a=e.$video,r=o.player,i=document.createElement("div");i.classList.add("artplayer-backlight"),t(i,{position:"absolute",zIndex:9,left:0,top:0,right:0,bottom:0,width:"100%",height:"100%"});var h=function(r){return l(function(t,e,n,o){var a=document.createElement("div");return a.style.position="absolute",a.style.left="".concat(100*t/n,"%"),a.style.top="".concat(100*e/o,"%"),a.style.width="".concat(100/n,"%"),a.style.height="".concat(100/o,"%"),a.style.webkitBorderRadius="50%",a.style.borderRadius="50%",a.style.webkitTransition="all .2s ease",a.style.transition="all .2s ease",r.appendChild(a),{$box:a,left:0===t,right:t===n-1,top:0===e,bottom:e===o-1}})}(i),c=document.createElement("canvas");return n.insertBefore(i,a),function n(){window.requestAnimationFrame(function(){if(r.playing){var t=a.clientWidth,e=a.clientHeight;(function(t,e,p,g){var y=t.getContext("2d");return t.width=p,t.height=g,y.drawImage(e,0,0),l(function(t,e,n,o){for(var a=p/n,r=g/o,i=t*a,c=e*r,l=y.getImageData(i,c,a,r).data,s=0,u=0,d=0,f=0,h=l.length;f\n '.concat(t.get("Danmu opacity"),': 100%\n \n
\n \n
\n '),mounted:function(t){var e=t.querySelector("input[type=range]"),n=t.querySelector(".art-value");i(e,"change",function(){var t=e.value;n.innerText=100*Number(t),r.plugins.artplayerPluginDanmuku.config({opacity:Number(t)})}),r.on("artplayerPluginDanmuku:config",function(t){e.value!==t.opacity&&(e.value=t.opacity,n.innerText=100*t.opacity)})}}}function s(r){var t=r.i18n,i=r.events.proxy;return{name:"danmuku-size",index:11,html:'\n
\n '.concat(t.get("Danmu size"),': 25px\n
\n
\n \n
\n '),mounted:function(t){var e=t.querySelector("input[type=range]"),n=t.querySelector(".art-value");i(e,"change",function(){var t=e.value;n.innerText=t,r.plugins.artplayerPluginDanmuku.config({fontSize:Number(t)})}),r.on("artplayerPluginDanmuku:config",function(t){e.value!==t.fontSize&&(e.value=t.fontSize,n.innerText=t.fontSize)})}}}function l(r){var t=r.i18n,i=r.events.proxy;return{name:"danmuku-speed",index:12,html:'\n
\n '.concat(t.get("Danmu speed"),': 5s\n
\n
\n \n
\n '),mounted:function(t){var e=t.querySelector("input[type=range]"),n=t.querySelector(".art-value");i(e,"change",function(){var t=e.value;n.innerText=t,r.plugins.artplayerPluginDanmuku.config({speed:Number(t)})}),r.on("artplayerPluginDanmuku:config",function(t){e.value!==t.speed&&(e.value=t.speed,n.innerText=t.speed)})}}}function c(n){var t=n.i18n,r=n.events.proxy;return{name:"danmuku-synchronousPlayback",index:13,html:'\n \n "),mounted:function(t){var e=t.querySelector("input[type=checkbox]");r(e,"change",function(){n.plugins.artplayerPluginDanmuku.config({synchronousPlayback:e.checked})}),n.on("artplayerPluginDanmuku:config",function(t){e.checked!==t.synchronousPlayback&&(e.checked=t.synchronousPlayback)})}}}function n(t,e,n){return t.filter(function(t){return t.$state===e}).map(n)}function p(t,e){var n=t.getBoundingClientRect();return e?n[e]:n}var f=function(t){if(Array.isArray(t))return t};var m=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw a}}return n}};var h=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var x=function(t,e){return f(t)||m(t,e)||h()};function d(t){if("string"!=typeof t)return[];var e=t.match(/[\S ]*?)<\/d>/gi);return e.length?e.map(function(t){var e=t.match(/(.+)<\/d>/),n=x(e,3),r=n[1],i=n[2],a=r.split(",");return 8===a.length&&i.trim()?{text:i,time:Number(a[0]),mode:function(t){switch(t){case 1:case 2:case 3:return"scroll";case 4:case 5:return"static";default:return null}}(Number(a[1])),fontSize:Number(a[2]),color:"#".concat(Number(a[3]).toString(16)),timestamp:Number(a[4]),pool:Number(a[5]),userID:a[6],rowID:Number(a[7])}:null}):[]}function y(t,e){var n=x(t.option.margin,2),r=n[0],i=n[1],o=p(t.art.template.$player),a=t.queue.filter(function(t){return t.mode===e.mode&&"emit"===t.$state&&t.$ref&&t.$ref.style.fontSize===e.$ref.style.fontSize&&parseFloat(t.$ref.style.top)<=o.height-i}).map(function(t){var e=p(t.$ref),n=e.width,r=e.height,i=e.top-o.top,a=e.left-o.left;return{top:i,left:a,height:r,width:n,right:o.width-a-n}}).sort(function(t,e){return t.top-e.top});return 0===a.length?r:(a.unshift({top:0,left:0,right:0,height:r,width:o.width}),a.push({top:o.height-i,left:0,right:0,height:i,width:o.width}),function(t){for(var e=0,n={},r=0;r=t.time&&t.time>=a.currentTime-.1&&"wait"===t.$state}).forEach(function(t){t.$ref=function(t){var e=t.find(function(t){return t.$ref&&"wait"===t.$state});if(e){var n=e.$ref;return e.$ref=null,n}var r=document.createElement("div");return r.style.cssText='\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-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n font-weight: normal;\n line-height: 1.125;\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 ',r}(i.queue),i.$danmuku.appendChild(t.$ref),t.$ref.style.opacity=i.option.opacity,t.$ref.style.fontSize="".concat(i.option.fontSize,"px"),t.$ref.innerText=t.text,t.$ref.style.color=t.color,t.$ref.style.border=t.border?"1px solid ".concat(t.color):"none",t.$restTime=i.option.synchronousPlayback&&a.playbackRate?i.option.speed/Number(a.playbackRate):i.option.speed,t.$lastStartTime=Date.now();var e=p(t.$ref,"width"),n=y(i,t);switch(t.$state="emit",t.mode){case"scroll":t.$restWidth=r+e+5,t.$ref.style.left="".concat(r,"px"),t.$ref.style.top="".concat(n,"px"),t.$ref.style.transform="translateX(".concat(-t.$restWidth,"px) translateY(0px) translateZ(0px)"),t.$ref.style.transition="transform ".concat(t.$restTime,"s linear 0s");break;case"static":t.$ref.style.top="".concat(n,"px"),t.$ref.style.left="50%",t.$ref.style.marginLeft="-".concat(e/2,"px")}})}i.isStop||i.update()})}},{key:"stop",value:function(){this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.animationFrameTimer),this.art.emit("artplayerPluginDanmuku:stop")}},{key:"start",value:function(){this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start")}},{key:"show",value:function(){this.$danmuku.style="block",this.art.emit("artplayerPluginDanmuku:show")}},{key:"hide",value:function(){this.$danmuku.style="none",this.art.emit("artplayerPluginDanmuku:hide")}},{key:"emit",value:function(t){var e=this.art,n=e.notice,r=e.player,i=e.i18n;t.text.trim()?t.text.length>this.option.maxlength?n.show("".concat(i.get("The length of the danmu does not exceed")," ").concat(this.option.maxlength)):("number"!=typeof t.time&&(t.time=r.currentTime),this.queue.push(function(e){for(var t=1;t\n '.concat(e.get("Danmu opacity"),': 100%\n \n
\n \n
\n '),mounted:function(e){var r=e.querySelector("input[type=range]"),i=e.querySelector(".art-value");n(r,"change",(function(){var e=r.value;i.innerText=100*Number(e),t.plugins.artplayerPluginDanmuku.config({opacity:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){r.value!==t.opacity&&(r.value=t.opacity,i.innerText=100*t.opacity)}))}}}function o(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-size",index:11,html:'\n
\n '.concat(e.get("Danmu size"),': 25px\n
\n
\n \n
\n '),mounted:function(e){var r=e.querySelector("input[type=range]"),i=e.querySelector(".art-value");n(r,"change",(function(){var e=r.value;i.innerText=e,t.plugins.artplayerPluginDanmuku.config({fontSize:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){r.value!==t.fontSize&&(r.value=t.fontSize,i.innerText=t.fontSize)}))}}}function u(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-speed",index:12,html:'\n
\n '.concat(e.get("Danmu speed"),': 5s\n
\n
\n \n
\n '),mounted:function(e){var r=e.querySelector("input[type=range]"),i=e.querySelector(".art-value");n(r,"change",(function(){var e=r.value;i.innerText=e,t.plugins.artplayerPluginDanmuku.config({speed:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){r.value!==t.speed&&(r.value=t.speed,i.innerText=t.speed)}))}}}function s(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-synchronousPlayback",index:13,html:'\n \n "),mounted:function(e){var r=e.querySelector("input[type=checkbox]");n(r,"change",(function(){t.plugins.artplayerPluginDanmuku.config({synchronousPlayback:r.checked})})),t.on("artplayerPluginDanmuku:config",(function(t){r.checked!==t.synchronousPlayback&&(r.checked=t.synchronousPlayback)}))}}}function l(t,e,n){return t.filter((function(t){return t.$state===e})).map(n)}function c(t,e){var n=t.getBoundingClientRect();return e?n[e]:n}var p=function(t){if(Array.isArray(t))return t};var f=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw a}}return n}};var m=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var h=function(t,e){return p(t)||f(t,e)||m()};function d(t){switch(t){case 1:case 2:case 3:return"scroll";case 4:case 5:return"static";default:return null}}function y(t){return fetch(t).then((function(t){return t.text()})).then((function(t){return function(t){if("string"!=typeof t)return[];var e=t.match(/[\S ]*?)<\/d>/gi);return e.length?e.map((function(t){var e=t.match(/(.+)<\/d>/),n=h(e,3),r=n[1],i=n[2],a=r.split(",");return 8===a.length&&i.trim()?{text:i,time:Number(a[0]),mode:d(Number(a[1])),fontSize:Number(a[2]),color:"#".concat(Number(a[3]).toString(16)),timestamp:Number(a[4]),pool:Number(a[5]),userID:a[6],rowID:Number(a[7])}:null})):[]}(t)}))}function g(t,e){var n=h(t.option.margin,2),r=n[0],i=n[1],a=c(t.art.template.$player),o=t.queue.filter((function(t){return t.mode===e.mode&&"emit"===t.$state&&t.$ref&&t.$ref.style.fontSize===e.$ref.style.fontSize&&parseFloat(t.$ref.style.top)<=a.height-i})).map((function(t){var e=c(t.$ref),n=e.width,r=e.height,i=e.top-a.top,o=e.left-a.left;return{top:i,left:o,height:r,width:n,right:a.width-o-n}})).sort((function(t,e){return t.top-e.top}));return 0===o.length?r:(o.unshift({top:0,left:0,right:0,height:r,width:a.width}),o.push({top:a.height-i,left:0,right:0,height:i,width:a.width}),function(t){for(var e=0,n={},r=0;ro&&(e=c,o=p)}if(0===e)for(var f=0,m=0;mf)f=d,e=h(g,1)[0].top}if(0===e){var x=a.filter((function(t,e){return 0!==e&&e!==a.length-1})).sort((function(t,e){return n[t].length-n[e].length}));e=h(x,1)[0]}return e}(o))}function v(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var b=function(){function n(t,r){var l=this;e(this,n),t.i18n.update(i),t.setting.add(a),t.setting.add(o),t.setting.add(u),t.setting.add(s),this.art=t,this.queue=[],this.option={},this.config(r),this.isStop=!1,this.animationFrameTimer=null,this.$danmuku=t.template.$danmuku,t.on("video:play",this.start.bind(this)),t.on("video:playing",this.start.bind(this)),t.on("video:pause",this.stop.bind(this)),t.on("video:waiting",this.stop.bind(this)),t.on("resize",this.resize.bind(this)),t.on("destroy",this.stop.bind(this)),"function"==typeof this.option.danmuku?this.option.danmuku().then((function(e){e.forEach(l.emit.bind(l)),t.emit("artplayerPluginDanmuku:loaded")})):"string"==typeof this.option.danmuku?y(this.option.danmuku).then((function(e){e.forEach(l.emit.bind(l)),t.emit("artplayerPluginDanmuku:loaded")})):(this.option.danmuku.forEach(this.emit.bind(this)),t.emit("artplayerPluginDanmuku:loaded"))}return r(n,[{key:"config",value:function(t){var e=this.art.constructor,r=e.utils.clamp,i=e.validator;this.option=Object.assign({},n.option,this.option,t),i(this.option,n.scheme),this.option.speed=r(this.option.speed,1,10),this.option.maxlength=r(this.option.maxlength,10,100),this.option.margin[0]=r(this.option.margin[0],0,100),this.option.margin[1]=r(this.option.margin[1],0,100),this.option.opacity=r(this.option.opacity,0,1),this.option.fontSize=r(this.option.fontSize,12,30),this.art.emit("artplayerPluginDanmuku:config",this.option)}},{key:"continue",value:function(){l(this.queue,"stop",(function(t){switch(t.$state="emit",t.$lastStartTime=Date.now(),t.mode){case"scroll":t.$ref.style.transform="translateX(".concat(-t.$restWidth,"px) translateY(0px) translateZ(0px)"),t.$ref.style.transition="transform ".concat(t.$restTime,"s linear 0s")}}))}},{key:"suspend",value:function(){var t=this.art.template.$player;l(this.queue,"emit",(function(e){switch(e.$state="stop",e.mode){case"scroll":var n=c(t),r=n.left,i=n.width-(c(e.$ref).left-r)+5;e.$ref.style.transform="translateX(".concat(-i,"px) translateY(0px) translateZ(0px)"),e.$ref.style.transition="transform 0s linear 0s"}}))}},{key:"resize",value:function(){var t=c(this.art.template.$player,"width");l(this.queue,"wait",(function(e){e.$ref&&(e.$ref.style.border="none",e.$ref.style.left="".concat(t,"px"),e.$ref.style.marginLeft="0px",e.$ref.style.transform="translateX(0px) translateY(0px) translateZ(0px)",e.$ref.style.transition="transform 0s linear 0s")}))}},{key:"update",value:function(){var t=this,e=this.art,n=e.player,r=e.template.$player;this.animationFrameTimer=window.requestAnimationFrame((function(){if(n.playing){var e=c(r,"width");l(t.queue,"emit",(function(t){t.$restTime-=(Date.now()-t.$lastStartTime)/1e3,t.$lastStartTime=Date.now(),t.$restTime<=0&&(t.$state="wait",t.$ref.style.border="none",t.$ref.style.left="".concat(e,"px"),t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px) translateY(0px) translateZ(0px)",t.$ref.style.transition="transform 0s linear 0s")})),t.queue.filter((function(t){return n.currentTime+.1>=t.time&&t.time>=n.currentTime-.1&&"wait"===t.$state})).forEach((function(r){r.$ref=function(t){var e=t.find((function(t){return t.$ref&&"wait"===t.$state}));if(e){var n=e.$ref;return e.$ref=null,n}var r=document.createElement("div");return r.style.cssText='\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-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n font-weight: normal;\n line-height: 1.125;\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 ',r}(t.queue),t.$danmuku.appendChild(r.$ref),r.$ref.style.opacity=t.option.opacity,r.$ref.style.fontSize="".concat(t.option.fontSize,"px"),r.$ref.innerText=r.text,r.$ref.style.color=r.color,r.$ref.style.border=r.border?"1px solid ".concat(r.color):"none",r.$restTime=t.option.synchronousPlayback&&n.playbackRate?t.option.speed/Number(n.playbackRate):t.option.speed,r.$lastStartTime=Date.now();var i=c(r.$ref,"width"),a=g(t,r);switch(r.$state="emit",r.mode){case"scroll":r.$restWidth=e+i+5,r.$ref.style.left="".concat(e,"px"),r.$ref.style.top="".concat(a,"px"),r.$ref.style.transform="translateX(".concat(-r.$restWidth,"px) translateY(0px) translateZ(0px)"),r.$ref.style.transition="transform ".concat(r.$restTime,"s linear 0s");break;case"static":r.$ref.style.top="".concat(a,"px"),r.$ref.style.left="50%",r.$ref.style.marginLeft="-".concat(i/2,"px")}}))}t.isStop||t.update()}))}},{key:"stop",value:function(){this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.animationFrameTimer),this.art.emit("artplayerPluginDanmuku:stop")}},{key:"start",value:function(){this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start")}},{key:"show",value:function(){this.$danmuku.style="block",this.art.emit("artplayerPluginDanmuku:show")}},{key:"hide",value:function(){this.$danmuku.style="none",this.art.emit("artplayerPluginDanmuku:hide")}},{key:"emit",value:function(e){var n=this.art,r=n.notice,i=n.player,a=n.i18n;e.text.trim()?e.text.length>this.option.maxlength?r.show("".concat(a.get("The length of the danmu does not exceed")," ").concat(this.option.maxlength)):("number"!=typeof e.time&&(e.time=i.currentTime),this.queue.push(function(e){for(var n=1;n>2,d=(3&o)<<4|(a=e.charCodeAt(r++))>>4,l=(15&a)<<2|(s=e.charCodeAt(r++))>>6,u=63&s,isNaN(a)?l=u=64:isNaN(s)&&(u=64),t=t+n.charAt(c)+n.charAt(d)+n.charAt(l)+n.charAt(u);return t},i?i.bind(e):B.noop),isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return B.isObject(e)&&!Object.keys(e).length},isArray:function(e){return e&&Array.isArray(e)},isFunction:function(e){return e&&"function"==typeof e},isElement:function(e){return e&&1===e.nodeType},isString:function(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)},isSupported:{canvas:function(){var e=z.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return e.Worker},blob:function(){return B.Blob},Uint8Array:function(){return e.Uint8Array},Uint32Array:function(){return e.Uint32Array},videoCodecs:function(){var e=z.createElement("video"),t={mp4:!1,h264:!1,ogv:!1,ogg:!1,webm:!1};try{e&&e.canPlayType&&(t.mp4=""!==e.canPlayType('video/mp4; codecs="mp4v.20.8"'),t.h264=""!==(e.canPlayType('video/mp4; codecs="avc1.42E01E"')||e.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')),t.ogv=""!==e.canPlayType('video/ogg; codecs="theora"'),t.ogg=""!==e.canPlayType('video/ogg; codecs="theora"'),t.webm=-1!==e.canPlayType('video/webm; codecs="vp8, vorbis"'))}catch(e){}return t}()},noop:function(){},each:function(e,t){var r=void 0,i=void 0;if(B.isArray(e))for(r=-1,i=e.length;++ri&&o<=n;)s.style.fontSize=--n+"px";return z.body.removeChild(s),n+"px"},webWorkerError:!1},o=Object.freeze({default:B}),f={validate:function(i){i=B.isObject(i)?i:{};var n={};return B.each(f.validators,function(e,t){var r=t.errorCode;if(!i[r]&&!t.condition)return!((n=t).error=!0)}),delete n.condition,n},isValid:function(e){var t=!0!==f.validate(e).error;return t},validators:[{condition:B.isFunction(B.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:B.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:B.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:B.isFunction(B.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:B.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:B.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:B.isSupported.Uint32Array(),errorCode:"window.Uint32Array",errorMsg:"The window.Uint32Array function constructor is not supported in your browser"}],messages:{videoCodecs:{errorCode:"videocodec",errorMsg:"The video codec you are trying to use is not supported in your browser"}}},a=Object.freeze({default:f}),c={sampleInterval:10,numWorkers:2,filter:"",gifWidth:200,gifHeight:200,interval:.1,numFrames:10,frameDuration:1,keepCameraOn:!1,images:[],video:null,webcamVideoElement:null,cameraStream:null,text:"",fontWeight:"normal",fontSize:"16px",minFontSize:"10px",resizeFont:!1,fontFamily:"sans-serif",fontColor:"#ffffff",textAlign:"center",textBaseline:"bottom",textXCoordinate:null,textYCoordinate:null,progressCallback:r,completeCallback:r,saveRenderingContexts:!1,savedRenderingContexts:[],crossOrigin:"Anonymous"},s=Object.freeze({default:c});function d(){return f.isValid()}function h(){var m,h,p,v,g,b=256,w=499,y=491,C=487,S=503,x=3*S,c=b-1,k=4,O=100,F=16,o=1<>E,R=o<>3)*(1<>F-k))>E,V[i]-=s,P[i]+=s<>U)<=1&&(a=0),e=0;e>U)<=1&&(a=0),t=0;t>=k,g[e][1]>>=k,g[e][2]>>=k,g[e][3]=e}(),function(){var e,t,r,i,n,o,a,s;for(e=s=a=0;e>1,t=a+1;t>1,t=a+1;t<256;t++)l[t]=c}(),function(){for(var e=[],t=new Array(b),r=0;r>8&255,v[b++]=255&t,v[b++]=t>>8&255,v[b++]=0|(null!==w?128:0),v[b++]=0,v[b++]=0,null!==i){if(i<0||65535>8&255,v[b++]=0}var y=!1;this.addFrame=function(e,t,r,i,n,o){if(!0===y&&(--b,y=!1),o=o===G?{}:o,e<0||t<0||65535>=1;)++d;c=1<>8&255,v[b++]=g,v[b++]=0),v[b++]=44,v[b++]=255&e,v[b++]=e>>8&255,v[b++]=255&t,v[b++]=t>>8&255,v[b++]=255&r,v[b++]=r>>8&255,v[b++]=255&i,v[b++]=i>>8&255,v[b++]=!0===a?128|d-1:0,!0===a)for(var m=0,h=s.length;m>16&255,v[b++]=p>>8&255,v[b++]=255&p}b=function(t,r,e,i){t[r++]=e;var n=r++,o=1<>=8,l-=8,r===n+256&&(t[n]=255,n=r++)}function g(e){u|=e<>=8,l-=8,r===n+256&&(t[n]=255,n=r++);4096===c?(g(o),c=1+s,d=e+1,h={}):(1<';else if(t instanceof Blob){try{o.src=B.URL.createObjectURL(t)}catch(e){}o.innerHTML=''}}else if(o.mozSrcObject)o.mozSrcObject=r;else if(B.URL)try{o.srcObject=r,o.src=B.URL.createObjectURL(r)}catch(e){o.srcObject=r}o.play(),B.requestTimeout(function e(){e.count=e.count||0,!0===v.loadedData?(v.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}),v.loadedData=!1):10<(e.count+=1)?v.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}):e()},0)},startStreaming:function(e){var t=B.isFunction(e.error)?e.error:B.noop,r=B.isFunction(e.streamed)?e.streamed:B.noop,i=B.isFunction(e.completed)?e.completed:B.noop,n=e.crossOrigin,o=e.existingVideo,a=e.lastCameraStream,s=e.options,c=e.webcamVideoElement,d=B.isElement(o)?o:c||z.createElement("video");n&&(d.crossOrigin=s.crossOrigin),d.autoplay=!0,d.loop=!0,d.muted=!0,d.addEventListener("loadeddata",function(e){v.loadedData=!0,s.offset&&(d.currentTime=s.offset)}),o?v.stream({videoElement:d,existingVideo:o,completedCallback:i}):a?v.stream({videoElement:d,cameraStream:a,streamedCallback:r,completedCallback:i}):B.getUserMedia({video:!0},function(e){v.stream({videoElement:d,cameraStream:e,streamedCallback:r,completedCallback:i})},t)},startVideoStreaming:function(a,e){var t=1=t?e.call():i.value=n(o)})),i},Blob:t.Blob||t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,btoa:(o=t.btoa||function(e){for(var t="",r=0,i=e.length,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=void 0,a=void 0,s=void 0,c=void 0,d=void 0,l=void 0,u=void 0;r>2,d=(3&o)<<4|(a=e.charCodeAt(r++))>>4,l=(15&a)<<2|(s=e.charCodeAt(r++))>>6,u=63&s,isNaN(a)?l=u=64:isNaN(s)&&(u=64),t=t+n.charAt(c)+n.charAt(d)+n.charAt(l)+n.charAt(u);return t},o?o.bind(t):s.noop),isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return s.isObject(e)&&!Object.keys(e).length},isArray:function(e){return e&&Array.isArray(e)},isFunction:function(e){return e&&"function"==typeof e},isElement:function(e){return e&&1===e.nodeType},isString:function(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)},isSupported:{canvas:function(){var e=r.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return t.Worker},blob:function(){return s.Blob},Uint8Array:function(){return t.Uint8Array},Uint32Array:function(){return t.Uint32Array},videoCodecs:function(){var e=r.createElement("video"),t={mp4:!1,h264:!1,ogv:!1,ogg:!1,webm:!1};try{e&&e.canPlayType&&(t.mp4=""!==e.canPlayType('video/mp4; codecs="mp4v.20.8"'),t.h264=""!==(e.canPlayType('video/mp4; codecs="avc1.42E01E"')||e.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')),t.ogv=""!==e.canPlayType('video/ogg; codecs="theora"'),t.ogg=""!==e.canPlayType('video/ogg; codecs="theora"'),t.webm=-1!==e.canPlayType('video/webm; codecs="vp8, vorbis"'))}catch(e){}return t}()},noop:function(){},each:function(e,t){var r=void 0,i=void 0;if(s.isArray(e))for(r=-1,i=e.length;++r0&&arguments[0]!==n?arguments[0]:{};if(!r.body||!1===e.resizeFont)return e.fontSize;var t=e.text,i=e.gifWidth,o=parseInt(e.fontSize,10),a=parseInt(e.minFontSize,10),s=r.createElement("div"),c=r.createElement("span");for(s.setAttribute("width",i),s.appendChild(c),c.innerHTML=t,c.style.fontSize=o+"px",c.style.textIndent="-9999px",c.style.visibility="hidden",r.body.appendChild(c);c.offsetWidth>i&&o>=a;)c.style.fontSize=--o+"px";return r.body.removeChild(c),o+"px"},webWorkerError:!1},c=Object.freeze({default:s}),d={validate:function(e){e=s.isObject(e)?e:{};var t={};return s.each(d.validators,(function(r,i){var n=i.errorCode;if(!e[n]&&!i.condition)return(t=i).error=!0,!1})),delete t.condition,t},isValid:function(e){var t=!0!==d.validate(e).error;return t},validators:[{condition:s.isFunction(s.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:s.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:s.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:s.isFunction(s.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:s.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:s.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:s.isSupported.Uint32Array(),errorCode:"window.Uint32Array",errorMsg:"The window.Uint32Array function constructor is not supported in your browser"}],messages:{videoCodecs:{errorCode:"videocodec",errorMsg:"The video codec you are trying to use is not supported in your browser"}}},l=Object.freeze({default:d}),u=function(){},f={sampleInterval:10,numWorkers:2,filter:"",gifWidth:200,gifHeight:200,interval:.1,numFrames:10,frameDuration:1,keepCameraOn:!1,images:[],video:null,webcamVideoElement:null,cameraStream:null,text:"",fontWeight:"normal",fontSize:"16px",minFontSize:"10px",resizeFont:!1,fontFamily:"sans-serif",fontColor:"#ffffff",textAlign:"center",textBaseline:"bottom",textXCoordinate:null,textYCoordinate:null,progressCallback:u,completeCallback:u,saveRenderingContexts:!1,savedRenderingContexts:[],crossOrigin:"Anonymous"},g=Object.freeze({default:f});function m(){return d.isValid()}function h(){var e,t,r,i,n,o=256,a=499,s=491,c=487,d=503,l=3*d,u=o-1,f=4,g=100,m=16,h=1<>v,w=h<>3)*(1<o&&(l=o),s=t+1,c=t-1,f=1;sd;){if(u=A[f++],sd){g=n[c--];try{g[0]-=u*(g[0]-r)/O|0,g[1]-=u*(g[1]-i)/O|0,g[2]-=u*(g[2]-a)/O|0}catch(e){}}}}function T(e,t,r,i,o){var a=n[t],s=e/x;a[0]-=s*(a[0]-r)|0,a[1]-=s*(a[1]-i)|0,a[2]-=s*(a[2]-o)|0}function U(e,t,r){var i,a,s,c,d,l,u,g,h,y;for(h=g=~(1<<31),u=l=-1,i=0;i>m-f))>v,E[i]-=d,W[i]+=d<=0;)i=d?i=o:(i++,s<0&&(s=-s),(c=l[0]-e)<0&&(c=-c),(s+=c)=0&&((s=t-(l=n[a])[1])>=d?a=-1:(a--,s<0&&(s=-s),(c=l[0]-e)<0&&(c=-c),(s+=c)>y)<=1&&(v=0),n=0;n=M&&(E-=r),0===O&&(O=1),++n%O==0)for(b-=b/e,(v=(p-=p/S)>>y)<=1&&(v=0),o=0;o>=f,n[e][1]>>=f,n[e][2]>>=f,n[e][3]=e}(),function(){var e,t,r,i,a,s,c,d;for(c=0,d=0,e=0;e>1,t=c+1;t>1,t=c+1;t<256;t++)F[t]=u}(),function(){for(var e=[],t=new Array(o),r=0;r65535||r>65535)throw"Width/Height invalid.";e[o++]=71,e[o++]=73,e[o++]=70,e[o++]=56,e[o++]=57,e[o++]=97;if(e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&r,e[o++]=r>>8&255,e[o++]=0|(null!==s?128:0),e[o++]=0,e[o++]=0,null!==a){if(a<0||a>65535)throw"Loop count invalid.";e[o++]=33,e[o++]=255,e[o++]=11,e[o++]=78,e[o++]=69,e[o++]=84,e[o++]=83,e[o++]=67,e[o++]=65,e[o++]=80,e[o++]=69,e[o++]=50,e[o++]=46,e[o++]=48,e[o++]=3,e[o++]=1,e[o++]=255&a,e[o++]=a>>8&255,e[o++]=0}var c=!1;this.addFrame=function(t,r,i,a,d,l){if(!0===c&&(--o,c=!1),l=l===n?{}:l,t<0||r<0||t>65535||r>65535)throw"x/y invalid.";if(i<=0||a<=0||i>65535||a>65535)throw"Width/Height invalid.";if(d.length256||t&t-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return t}(f),m=0;g>>=1;)++m;g=1<3)throw"Disposal out of range.";var v=!1,b=0;if(l.transparent!==n&&null!==l.transparent&&(v=!0,(b=l.transparent)<0||b>=g))throw"Transparent color index.";if((0!==p||v||0!==h)&&(e[o++]=33,e[o++]=249,e[o++]=4,e[o++]=p<<2|(!0===v?1:0),e[o++]=255&h,e[o++]=h>>8&255,e[o++]=b,e[o++]=0),e[o++]=44,e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&r,e[o++]=r>>8&255,e[o++]=255&i,e[o++]=i>>8&255,e[o++]=255&a,e[o++]=a>>8&255,e[o++]=!0===u?128|m-1:0,!0===u)for(var w=0,y=f.length;w>16&255,e[o++]=C>>8&255,e[o++]=255&C}o=function(e,t,r,i){e[t++]=r;var o=t++,a=1<=r;)e[t++]=255&f,f>>=8,u-=8,t===o+256&&(e[o]=255,o=t++)}function m(e){f|=e<=8;)e[t++]=255&f,f>>=8,u-=8,t===o+256&&(e[o]=255,o=t++);4096===d?(m(a),d=c+1,l=r+1,p={}):(d>=1<0&&arguments[0]!==n?arguments[0]:{},r=e.data;delete s.data,s.pixels=Array.prototype.slice.call(r.pixels),s.palette=Array.prototype.slice.call(r.palette),s.done=!0,s.beingProcessed=!1,t.freeWorker(c),t.onFrameFinished(i)};(s=a[e]).beingProcessed||s.done?this.onFrameFinished():(s.sampleInterval=o,s.beingProcessed=!0,s.gifshot=!0,(c=this.getWorker())?(c.onmessage=d,c.postMessage(s)):d({data:t.workerMethods.run(s)}))},startRendering:function(e){this.onRenderCompleteCallback=e;for(var t=0;t=0&&this.processFrame(e)},generateGIF:function(e,t){var r=[],i={loop:this.repeat},n=this.options,o=n.interval,a=n.frameDuration,c=!!n.images.length,d=n.gifHeight,l=n.gifWidth,u=new v(r,l,d,i),f=this.onRenderProgressCallback,g=c?100*o:0,m=void 0;this.generatingGIF=!0,s.each(e,(function(t,r){var i=r.palette;f(.75+.25*r.position*1/e.length);for(var n=0;n0&&arguments[0]!==n?arguments[0]:{},t=this.frames,r=e.data;this.frames.push({data:r,width:e.width,height:e.height,palette:null,dithering:null,done:!1,beingProcessed:!1,position:t.length})},onRenderProgress:function(e){this.onRenderProgressCallback=e},isRendering:function(){return this.generatingGIF},getBase64GIF:function(e){var t=this;t.startRendering((function(r){t.destroyWorkers(),s.requestTimeout((function(){e(r)}),0)}))},destroyWorkers:function(){if(!this.workerError){var e=this.workers;s.each(e,(function(e,t){var r=t.worker,i=t.objectUrl;r.terminate(),s.URL.revokeObjectURL(i)}))}}};var y=function(){},C={getGIF:function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=arguments[1];t=s.isFunction(t)?t:y;var i=r.createElement("canvas"),o=void 0,a=e.images,c=!!a.length,d=e.cameraStream,l=e.crop,u=e.filter,f=e.fontColor,g=e.fontFamily,m=e.fontWeight,h=e.keepCameraOn,p=(e.numWorkers,e.progressCallback),v=e.saveRenderingContexts,b=e.savedRenderingContexts,C=e.text,S=e.textAlign,x=e.textBaseline,k=e.videoElement,O=e.videoHeight,F=e.videoWidth,W=e.webcamVideoElement,E=Number(e.gifWidth),A=Number(e.gifHeight),R=Number(e.interval),T=(Number(e.sampleInterval),c?0:1e3*R),U=[],M=b.length?b.length:e.numFrames,j=M,I=new w(e),P=s.getFontSize(e),V=e.textXCoordinate?e.textXCoordinate:"left"===S?1:"right"===S?E:E/2,L=e.textYCoordinate?e.textYCoordinate:"top"===x?1:"center"===x?A/2:A,H=m+" "+P+" "+g,z=l?Math.floor(l.scaledWidth/2):0,G=l?F-l.scaledWidth:0,B=l?Math.floor(l.scaledHeight/2):0,D=l?O-l.scaledHeight:0,N=function e(){var r=j-1;function i(){var i;v&&U.push(o.getImageData(0,0,E,A)),C&&(o.font=H,o.fillStyle=f,o.textAlign=S,o.textBaseline=x,o.fillText(C,V,L)),i=o.getImageData(0,0,E,A),I.addFrameImageData(i),p((M-(j=r))/M),r>0&&s.requestTimeout(e,T),j||I.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:d,videoElement:k,webcamVideoElement:W,savedRenderingContexts:U,keepCameraOn:h})}))}b.length?(o.putImageData(b[M-j],0,0),i()):function e(){try{G>F&&(G=F),D>O&&(D=O),z<0&&(z=0),B<0&&(B=0),o.filter=u,o.drawImage(k,z,B,G,D,0,0,E,A),i()}catch(t){if("NS_ERROR_NOT_AVAILABLE"!==t.name)throw t;s.requestTimeout(e,100)}}()};M=M!==n?M:10,R=R!==n?R:.1,i.width=E,i.height=A,o=i.getContext("2d"),function e(){b.length||0!==k.currentTime?N():s.requestTimeout(e,100)}()},getCropDimensions:function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.videoWidth,r=e.videoHeight,i=e.gifWidth,o=e.gifHeight,a={width:0,height:0,scaledWidth:0,scaledHeight:0};return t>r?(a.width=Math.round(t*(o/r))-i,a.scaledWidth=Math.round(a.width*(r/o))):(a.height=Math.round(r*(i/t))-o,a.scaledHeight=Math.round(a.height*(t/i))),a}},S={loadedData:!1,defaultVideoDimensions:{width:640,height:480},findVideoSize:function e(t){e.attempts=e.attempts||0;var r=t.cameraStream,i=t.completedCallback,n=t.videoElement;n&&(n.videoWidth>0&&n.videoHeight>0?(n.removeEventListener("loadeddata",S.findVideoSize),i({videoElement:n,cameraStream:r,videoWidth:n.videoWidth,videoHeight:n.videoHeight})):e.attempts<10?(e.attempts+=1,s.requestTimeout((function(){S.findVideoSize(t)}),400)):i({videoElement:n,cameraStream:r,videoWidth:S.defaultVideoDimensions.width,videoHeight:S.defaultVideoDimensions.height}))},onStreamingTimeout:function(e){s.isFunction(e)&&e({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - Timed out while trying to start streaming",image:null,cameraStream:{}})},stream:function(e){var t=s.isArray(e.existingVideo)?e.existingVideo[0]:e.existingVideo,r=e.cameraStream,i=e.completedCallback,n=e.streamedCallback,o=e.videoElement;if(s.isFunction(n)&&n(),t){if(s.isString(t))o.src=t,o.innerHTML='';else if(t instanceof Blob){try{o.src=s.URL.createObjectURL(t)}catch(e){}o.innerHTML=''}}else if(o.mozSrcObject)o.mozSrcObject=r;else if(s.URL)try{o.srcObject=r,o.src=s.URL.createObjectURL(r)}catch(e){o.srcObject=r}o.play(),s.requestTimeout((function e(){e.count=e.count||0,!0===S.loadedData?(S.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}),S.loadedData=!1):(e.count+=1)>10?S.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}):e()}),0)},startStreaming:function(e){var t=s.isFunction(e.error)?e.error:s.noop,i=s.isFunction(e.streamed)?e.streamed:s.noop,n=s.isFunction(e.completed)?e.completed:s.noop,o=e.crossOrigin,a=e.existingVideo,c=e.lastCameraStream,d=e.options,l=e.webcamVideoElement,u=s.isElement(a)?a:l||r.createElement("video");o&&(u.crossOrigin=d.crossOrigin),u.autoplay=!0,u.loop=!0,u.muted=!0,u.addEventListener("loadeddata",(function(e){S.loadedData=!0,d.offset&&(u.currentTime=d.offset)})),a?S.stream({videoElement:u,existingVideo:a,completedCallback:n}):c?S.stream({videoElement:u,cameraStream:c,streamedCallback:i,completedCallback:n}):s.getUserMedia({video:!0},(function(e){S.stream({videoElement:u,cameraStream:e,streamedCallback:i,completedCallback:n})}),t)},startVideoStreaming:function(e){var t=arguments.length>1&&arguments[1]!==n?arguments[1]:{},r=t.timeout!==n?t.timeout:0,i=t.callback,o=t.webcamVideoElement,a=void 0;r>0&&(a=s.requestTimeout((function(){S.onStreamingTimeout(i)}),1e4)),S.startStreaming({error:function(){i({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - the user probably denied permission",image:null,cameraStream:{}})},streamed:function(){clearTimeout(a)},completed:function(){var t=arguments.length>0&&arguments[0]!==n?arguments[0]:{},r=t.cameraStream,i=t.videoElement,o=t.videoHeight,a=t.videoWidth;e({cameraStream:r,videoElement:i,videoHeight:o,videoWidth:a})},lastCameraStream:t.lastCameraStream,webcamVideoElement:o,crossOrigin:t.crossOrigin,options:t})},stopVideoStreaming:function(e){var t=e=s.isObject(e)?e:{},r=t.keepCameraOn,i=t.videoElement,n=t.webcamVideoElement,o=e.cameraStream||{},a=o.getTracks&&o.getTracks()||[],c=!!a.length,d=a[0];!r&&c&&s.isFunction(d.stop)&&d.stop(),s.isElement(i)&&!n&&(i.pause(),s.isFunction(s.URL.revokeObjectURL)&&!s.webWorkerError&&i.src&&s.URL.revokeObjectURL(i.src),s.removeElement(i))}};function x(e){e=s.isObject(e)?e:{},S.stopVideoStreaming(e)}function k(e,t){var i=e.options||{},n=i.images,o=i.video,a=Number(i.gifWidth),c=Number(i.gifHeight),d=(Number(i.numFrames),e.cameraStream),l=e.videoElement,u=e.videoWidth,f=e.videoHeight,g=C.getCropDimensions({videoWidth:u,videoHeight:f,gifHeight:c,gifWidth:a}),m=t;i.crop=g,i.videoElement=l,i.videoWidth=u,i.videoHeight=f,i.cameraStream=d,s.isElement(l)&&(l.width=a+g.width,l.height=c+g.height,i.webcamVideoElement||(s.setCSSAttr(l,{position:"fixed",opacity:"0"}),r.body.appendChild(l)),l.play(),C.getGIF(i,(function(e){n&&n.length||o&&o.length||x(e),m(e)})))}function O(e,t){if(t=s.isFunction(e)?e:t,e=s.isObject(e)?e:{},s.isFunction(t)){var i=s.mergeOptions(f,e)||{},o=e.cameraStream,a=i.images,c=a?a.length:0,l=i.video,u=i.webcamVideoElement;i=s.mergeOptions(i,{gifWidth:Math.floor(i.gifWidth),gifHeight:Math.floor(i.gifHeight)}),c?function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.callback,i=e.images,o=e.options,a=e.imagesLength,c=d.validate({getUserMedia:!0,"window.URL":!0}),l=[],u=0,f=void 0,g=void 0;if(c.error)return t(c);function m(){s.each(l,(function(e,t){t&&(t.text?g.addFrame(t.img,o,t.text):g.addFrame(t,o))})),function(e,t){e.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e})}))}(g,t)}g=new w(o),s.each(i,(function(e,i){var n=i;i.src&&(n=n.src),s.isElement(n)?(o.crossOrigin&&(n.crossOrigin=o.crossOrigin),l[e]=n,(u+=1)===a&&m()):s.isString(n)&&(f=new Image,o.crossOrigin&&(f.crossOrigin=o.crossOrigin),function(r){i.text&&(r.text=i.text),r.onerror=function(e){var r=void 0;if(0===--a)return(r={}).error="None of the requested images was capable of being retrieved",t(r)},r.onload=function(t){i.text?l[e]={img:r,text:r.text}:l[e]=r,(u+=1)===a&&m(),s.removeElement(r)},r.src=n}(f),s.setCSSAttr(f,{position:"fixed",opacity:"0"}),r.body.appendChild(f))}))}({images:a,imagesLength:c,callback:t,options:i}):l?function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.callback,r=e.existingVideo,i=e.options,o=d.validate({getUserMedia:!0,"window.URL":!0}),a=void 0,c=void 0;if(o.error)return t(o);if(s.isElement(r)&&r.src){if(c=r.src,a=s.getExtension(c),!s.isSupported.videoCodecs[a])return t(d.messages.videoCodecs)}else s.isArray(r)&&s.each(r,(function(e,t){if(a=t instanceof Blob?t.type.substr(t.type.lastIndexOf("/")+1,t.length):t.substr(t.lastIndexOf(".")+1,t.length),s.isSupported.videoCodecs[a])return r=t,!1}));S.startStreaming({completed:function(e){e.options=i||{},k(e,t)},existingVideo:r,crossOrigin:i.crossOrigin,options:i})}({existingVideo:l,callback:t,options:i}):function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.callback,r=e.lastCameraStream,i=e.options,o=e.webcamVideoElement;if(!m())return t(d.validate());i.savedRenderingContexts.length?C.getGIF(i,(function(e){t(e)})):S.startVideoStreaming((function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{};e.options=i||{},k(e,t)}),{lastCameraStream:r,callback:t,webcamVideoElement:o,crossOrigin:i.crossOrigin})}({lastCameraStream:o,callback:t,webcamVideoElement:u,options:i})}}var F={utils:c,error:l,defaultOptions:g,createGIF:O,takeSnapShot:function(e,t){if(t=s.isFunction(e)?e:t,e=s.isObject(e)?e:{},s.isFunction(t)){var r=s.mergeOptions(f,e);O(s.mergeOptions(r,{interval:.1,numFrames:1,gifWidth:Math.floor(r.gifWidth),gifHeight:Math.floor(r.gifHeight)}),t)}},stopVideoStreaming:x,isSupported:function(){return d.isValid()},isWebCamGIFSupported:m,isExistingVideoGIFSupported:function(e){var t=!1;if(s.isArray(e)&&e.length){if(s.each(e,(function(e,r){s.isSupported.videoCodecs[r]&&(t=!0)})),!t)return!1}else if(s.isString(e)&&e.length&&!s.isSupported.videoCodecs[e])return!1;return d.isValid({getUserMedia:!0})},isExistingImagesGIFSupported:function(){return d.isValid({getUserMedia:!0})},VERSION:"0.4.5"};"function"==typeof n&&n.amd?n([],(function(){return F})):e.exports=F}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{createElement:function(){}},"undefined"!=typeof window?window.navigator:{})})),i=t((function(e){var t;t=function(){return function(e,t,r){t=t||"",r=r||512;for(var i=atob(e),n=[],o=0;o0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;y=!0,f.show=!0,e.emit("artplayerPluginGif:start"),d.show(c.get("Start creating gif..."),!1),r.createGIF(o({},t,{video:[v.src],crossOrigin:"anonymous"}),(function(t){if(t.error)d.show(t.errorMsg),n(!1,t.errorMsg);else if("function"==typeof a){var r=t.image.split(",")[1],o=i(r,"image/gif"),s=URL.createObjectURL(o);d.show(c.get("Create gif successfully")),e.emit("artplayerPluginGif",s),a(s)}y=!1,f.show=!1,e.emit("artplayerPluginGif:end")}))}}}})); diff --git a/dist/artplayer-plugin-playlist.js b/dist/artplayer-plugin-playlist.js index a15f036ef..d84c3430b 100644 --- a/dist/artplayer-plugin-playlist.js +++ b/dist/artplayer-plugin-playlist.js @@ -5,4 +5,4 @@ * Released under the MIT License. */ -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).artplayerPluginPlaylist=n()}(this,function(){"use strict";return function(h){return function(e){var t=e.constructor.utils,n=t.append,r=t.errorHandle,i=t.sleep,a=t.inverseClass,l=e.player,o=e.events.proxy,s=e.template,u=s.$player,c=s.$video,y=n(u,'\n
\n
\n
\n ');r(Array.isArray(h),"Playlist is not an array type"),r(0').concat(t.title,"")}).join(""),o(p,"click",function(t){var n=t.target.dataset.optionIndex;n&&Number(n)<=f.length-1&&d(n)}),o(y,"click",function(t){t.target===y&&u.classList.remove("artplayer-playlist-show")}),e.on("video:ended",function(){v().then(function(){i(1e3).then(function(){l.play=!0})})}),e.on("afterAttachUrl",function(){var t=f.findIndex(function(t){return t.url===c.src}),n=Array.from(p.children)[t];-1!==t&&n&&a(n,"active")}),{name:"artplayerPluginPlaylist",show:function(){u.classList.add("artplayer-playlist-show")},hide:function(){u.classList.remove("artplayer-playlist-show")},next:function(){v()},prev:function(){!function(){var t=f.findIndex(function(t){return t.url===c.src});r(-1!==t,"Can't find Playlist item"),1===f.length?d(0):d(t-1==-1?f.length-1:t-1)}()}}}}}); +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).artplayerPluginPlaylist=n()}(this,(function(){"use strict";return function(t){return function(n){var e=n.constructor.utils,r=e.append,i=e.errorHandle,a=e.sleep,l=e.inverseClass,o=n.player,s=n.events.proxy,u=n.template,c=u.$player,y=u.$video,f=r(c,'\n
\n
\n
\n ');i(Array.isArray(t),"Playlist is not an array type"),i(t.length>0,"Playlist cannot be empty");var p=t.map((function(t){return i(t.url,"Playlist items require url attribute"),i(t.title,"Playlist items require title attribute"),t})),d=f.querySelector(".artplayer-playlist-inner");function v(t){var e=p[t];return o.switchUrl(e.url,e.title).then((function(){n.emit("artplayerPluginPlaylist:change",e)}))}function h(){var t=p.findIndex((function(t){return t.url===y.src}));return i(-1!==t,"Can't find Playlist item"),1===p.length?v(0):v(t+1===p.length?0:t+1)}return d.innerHTML=p.map((function(t,n){return'
').concat(t.title,"
")})).join(""),s(d,"click",(function(t){var n=t.target.dataset.optionIndex;n&&Number(n)<=p.length-1&&v(n)})),s(f,"click",(function(t){t.target===f&&c.classList.remove("artplayer-playlist-show")})),n.on("video:ended",(function(){h().then((function(){a(1e3).then((function(){o.play=!0}))}))})),n.on("afterAttachUrl",(function(){var t=p.findIndex((function(t){return t.url===y.src})),n=Array.from(d.children)[t];-1!==t&&n&&l(n,"active")})),{name:"artplayerPluginPlaylist",show:function(){c.classList.add("artplayer-playlist-show")},hide:function(){c.classList.remove("artplayer-playlist-show")},next:function(){h()},prev:function(){var t;t=p.findIndex((function(t){return t.url===y.src})),i(-1!==t,"Can't find Playlist item"),1===p.length?v(0):v(t-1==-1?p.length-1:t-1)}}}}})); diff --git a/dist/artplayer-react.js b/dist/artplayer-react.js index 143c67a27..05d1078d5 100644 --- a/dist/artplayer-react.js +++ b/dist/artplayer-react.js @@ -5,4 +5,15 @@ * Released under the MIT License. */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).ArtplayerReact=t()}(this,function(){"use strict";var a=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r.")}return t}(t);if(!we[n]){we[n]=!0;var r="";e&&e._owner&&e._owner!==z.current&&(r=" It was passed a child from "+F(e._owner.type)+"."),V(e),H(!1,'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',n,r),V(null)}}}function ke(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n",o=" Did you accidentally export a JSX literal instead of a component?"):a=typeof e,H(!1,"React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",a,o)}var c=K.apply(this,arguments);if(null==c)return c;if(r)for(var u=2;u is not supported and will be removed in a future major release. Did you mean to render instead?"),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||H(!(r=!0),"Rendering is not supported and will be removed in a future major release. Did you mean to render instead?"),n.Consumer}}}),n.Consumer=i,n._currentRenderer=null,n._currentRenderer2=null,n},forwardRef:function(e){return null!=e&&e.$$typeof===f?j(!1,"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?j(!1,"forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&j(!1,"forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null==e||null==e.defaultProps&&null==e.propTypes||j(!1,"forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"),{$$typeof:i,render:e}},lazy:function(e){var t={$$typeof:p,_ctor:e,_status:-1,_result:null},n=void 0,r=void 0;return Object.defineProperties(t,{defaultProps:{configurable:!0,get:function(){return n},set:function(e){H(!1,"React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(t,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){H(!1,"React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),r=e,Object.defineProperty(t,"propTypes",{enumerable:!0})}}}),t},memo:function(e,t){return he(e)||j(!1,"memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e),{$$typeof:f,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return ve().useCallback(e,t)},useContext:function(e,t){var n=ve();if(void 0!==t&&H(!1,"useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&Array.isArray(arguments[2])?"\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://fb.me/rules-of-hooks":""),void 0!==e._context){var r=e._context;r.Consumer===e?H(!1,"Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&H(!1,"Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},useEffect:function(e,t){return ve().useEffect(e,t)},useImperativeHandle:function(e,t,n){return ve().useImperativeHandle(e,t,n)},useDebugValue:function(e,t){return ve().useDebugValue(e,t)},useLayoutEffect:function(e,t){return ve().useLayoutEffect(e,t)},useMemo:function(e,t){return ve().useMemo(e,t)},useReducer:function(e,t,n){return ve().useReducer(e,t,n)},useRef:function(e){return ve().useRef(e)},useState:function(e){return ve().useState(e)},Fragment:s,Profiler:r,StrictMode:n,Suspense:u,unstable_SuspenseList:l,createElement:Pe,cloneElement:function(e,t,n){for(var r=function(e,t,n){!function(){if(null==e)throw O(Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+"."))}();var r=void 0,o=y({},e.props),i=e.key,a=e.ref,c=e._self,u=e._source,s=e._owner;if(null!=t){J(t)&&(a=t.ref,s=z.current),G(t)&&(i=""+t.key);var l=void 0;for(r in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)B.call(t,r)&&!Y.hasOwnProperty(r)&&(void 0===t[r]&&void 0!==l?o[r]=l[r]:o[r]=t[r])}var f=arguments.length-2;if(1==f)o.children=n;else if(1").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function Re(e){return URL.createObjectURL(new Blob([e],{type:"text/vtt"}))}function $e(e){var n=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(e){return(0\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n \n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(e){e?this.$container.innerHTML="":de(this.$player,"artplayer-destroy")}}]),n}(),Qe={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Ke={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},et=function(){function t(e){u(this,t),this.art=e,this.languages={"zh-cn":Qe,"zh-tw":Ke},this.init()}return s(t,[{key:"init",value:function(){var e=this.art.option.lang.toLowerCase();this.language=this.languages[e]||{}}},{key:"get",value:function(e){return this.language[e]||e}},{key:"update",value:function(e){this.languages=Fe(this.languages,e),this.init()}}]),t}();var tt=e(function(e){var i,t,o,r,n;i="undefined"!=typeof window&&void 0!==window.document?window.document:{},t=e.exports,o=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=t.length,o={};n ").concat(u));var s=document.createElement("div");s.classList.value="art-".concat(i," art-").concat(i,"-").concat(u),a.html&&ve(s,a.html),a.style&&ge(s,a.style),a.tooltip&&ke(s,a.tooltip);var l=Array.from(e.children);s.dataset.index=a.index||c;var f=l.find(function(e){return Number(e.dataset.index)>=Number(s.dataset.index)});return f?f.insertAdjacentElement("beforebegin",s):ve(e,s),a.click&&t.events.proxy(s,"click",function(e){e.preventDefault(),a.click.call(t,n,e),t.emit("".concat(i,":click"),s)}),a.mounted&&a.mounted(s,n,t),o&&o(s,n,t),Object.defineProperty(n,u,{value:{get id(){return c},get $ref(){return s},set show(e){e?(me(s,"display","block"),t.emit("".concat(i,":show"),s)):(me(s,"display","none"),t.emit("".concat(i,":hide"),s))}}}),t.emit("".concat(i,":add"),a),n[u]}function it(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function at(e){return function(a){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),mounted:function(i){var o=!1,n=fe(".art-progress-loaded",i),r=fe(".art-progress-played",i),a=fe(".art-progress-highlight",i),c=fe(".art-progress-indicator",i),u=fe(".art-progress-tip",i);function s(e,t){"loaded"===e&&me(n,"width","".concat(100*t,"%")),"played"===e&&(me(r,"width","".concat(100*t,"%")),me(c,"left","calc(".concat(100*t,"% - ").concat(be(c,"width")/2,"px)")))}t.forEach(function(e){var t=Ue(e.time,0,p.duration)/p.duration*100;ve(a,''))}),s("loaded",p.loaded),l.on("video:progress",function(){s("loaded",p.loaded)}),l.on("video:timeupdate",function(){s("played",p.played)}),l.on("video:ended",function(){s("played",1)}),f(i,"mousemove",function(e){me(u,"display","block"),-1i.clientWidth-r/2?me(u,"left","".concat(i.clientWidth-r,"px")):me(u,"left","".concat(t-r/2,"px"))}(e):function(e){var t=yt(l,e),n=t.width,r=t.time;u.innerHTML=r;var o=u.clientWidth;n<=o/2?me(u,"left",0):n>i.clientWidth-o/2?me(u,"left","".concat(i.clientWidth-o,"px")):me(u,"left","".concat(n-o/2,"px"))}(e)}),f(i,"mouseout",function(){me(u,"display","none")}),f(i,"click",function(e){if(e.target!==c){var t=yt(l,e),n=t.second;s("played",t.percentage),p.seek=n}}),f(c,"mousedown",function(){o=!0}),f(document,"mousemove",function(e){if(o){var t=yt(l,e),n=t.second,r=t.percentage;de(c,"art-show-indicator"),s("played",r),p.seek=n}}),f(document,"mouseup",function(){o&&(o=!1,ye(c,"art-show-indicator"))})}})}}function vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function mt(e){return function(a){return function(t){for(var e=1;e'),s=ve(u,'
');function l(e){var t=u.getBoundingClientRect(),n=t.left,r=t.width,o=s.getBoundingClientRect().width;return Ue(e.pageX-n-o/2,0,r-o/2)/(r-o)}function f(e){var t=0d.clientWidth-o/2?me(f,"left","".concat(d.clientWidth-o,"px")):me(f,"left","".concat(t-o/2,"px"))}(e))}),t(d,"mouseout",function(){me(f,"display","none")})}})}}function St(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Et(e){return function(a){return function(t){for(var e=1;e'.concat(o.name,"")),s=i.map(function(e,t){return'
').concat(e.name,"
")}).join(""),l=ve(e,'
'.concat(s,"
"));r(e,function(){l.style.left="-".concat(be(l,"width")/2-e.clientWidth/2,"px")}),n(l,"click",function(e){var t=Number(e.target.dataset.index),n=i[t],r=n.url,o=n.name;r&&o&&c!==t&&(a.switchQuality(r,o),u.innerHTML=o,c=t)})}})}}var Ct=function(){function n(e){var t=this;u(this,n),this.id=0,this.art=e,this.art.on("ready",function(){t.init()})}return s(n,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(ht({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add($t({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(Et({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(jt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(ut({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach(function(e){t.add(e)})}},{key:"add",value:function(e,t){var n,r="function"==typeof e?e(this.art):e,o=this.art.template,i=o.$progress,a=o.$controlsLeft,c=o.$controlsRight;switch(r.position){case"top":n=i;break;case"left":n=a;break;case"right":n=c}this.id+=1,Se(r.position,"Controls option.position can not be empty");var u=ot(this.art,this,n,r,t,"control");return r.disable||"top"===r.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||de(u.$ref,"art-control-onlyText"),u}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,de(t,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,ye(t,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),n}();function Dt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Tt(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(t.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(e,t){var n=t.target.dataset.rate;n&&(r.playbackRate=Number(n),e.show=!1)},mounted:function(n){e.on("playbackRateChange",function(t){var e=pe("span",n).find(function(e){return Number(e.dataset.rate)===t});e&&Oe(e,"current")})}})}}function _t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function At(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(t.get("Default"),'\n 4:3\n 16:9\n '),click:function(e,t){var n=t.target.dataset.ratio;n&&(r.aspectRatio=n,e.show=!1)},mounted:function(n){e.on("aspectRatioChange",function(t){var e=pe("span",n).find(function(e){return e.dataset.ratio===t});e&&Oe(e,"current")})}})}}function Lt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Mt(e){return function(t){return function(t){for(var e=1;eArtPlayer 3.1.18'})}function It(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;e".concat(e,"

")}).join("")),this.art.emit("subtitle:update",e)}},{key:"switch",value:function(e,t){var n=this,r=1\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},e.option.icons);Object.keys(r).forEach(function(e){var t=document.createElement("i");t.classList.add("art-icon"),t.classList.add("art-icon-".concat(e)),ve(t,r[e]),n[e]=t})}var Ht=function(){function n(e){var t=this;u(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),e.whitelist.state&&e.once("video:canplay",function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],function(e){-1'.concat(t.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(e,t){var n=t.target.dataset.value;n&&(r.flip=n)},mounted:function(n){e.on("flipChange",function(t){var e=pe("button",n).find(function(e){return e.dataset.value===t});e&&Oe(e.parentElement,"current")})}})}}function Kt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function en(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(t.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(e,t){var n=t.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(n){e.on("aspectRatioChange",function(t){var e=pe("button",n).find(function(e){return e.dataset.value===t});e&&Oe(e.parentElement,"current")})}})}}function tn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function nn(t){return function(r){var e=r.i18n,o=r.player,i=r.events.proxy;return function(t){for(var e=1;e\n '.concat(e.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(e){var t=fe(".art-setting-range input",e),n=fe(".art-subtitle-value",e);i(t,"change",function(){var e=t.value;n.innerText=e,o.playbackRate=Number(e)}),r.on("playbackRateChange",function(e){t.value!==e&&(t.value=e,n.innerText=e)})}})}}var rn=function(){function n(e){var t=this;u(this,n),this.id=0,this.art=e,this.state=!1,e.option.setting&&(this.art.on("ready",function(){t.init()}),this.art.on("blur",function(){t.show=!1}))}return s(n,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",function(e){e.target===r&&(t.show=!1)}),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(en({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(nn({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(e,t){this.id+=1;var n=this.art.template.$settingBody;return ot(this.art,this,n,e,t,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,de(t,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,ye(t,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),n}(),on=function(){function r(e){u(this,r),this.art=e,this.name="artplayer_settings";var t=e.option,n=this.get("volume");n&&(t.volume=n)}return s(r,[{key:"get",value:function(e){var t=JSON.parse(window.localStorage.getItem(this.name))||{};return e?t[e]:{}}},{key:"set",value:function(e,t){var n=Object.assign({},this.get(),c({},e,t));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(e){var t=this.get();delete t[e],window.localStorage.setItem(this.name,JSON.stringify(t))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),r}();function an(r){var e=r.i18n,o=r.subtitle,i=r.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(e){var t=fe(".art-setting-range input",e),n=fe(".art-subtitle-value",e);i(t,"change",function(){var e=t.value;n.innerText=e,r.plugins.subtitleOffset.offset(Number(e))}),r.on("subtitle:switch",function(){t.value=0,n.innerText=0}),r.on("artplayerPluginSubtitleOffset",function(e){o.update(),t.value!==e&&(t.value=e,n.innerText=e)})}}}function cn(r){var o=r.constructor.utils.clamp,e=r.setting,i=r.notice,a=r.template,c=r.i18n,u=r.player;c.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),e.add(an);var s=[];return r.on("subtitle:switch",function(){s=[]}),{name:"subtitleOffset",offset:function(e){if(a.$track&&a.$track.track){var t=Array.from(a.$track.track.cues),n=o(e,-5,5);t.forEach(function(e,t){s[t]||(s[t]={startTime:e.startTime,endTime:e.endTime}),e.startTime=o(s[t].startTime+n,0,u.duration),e.endTime=o(s[t].endTime+n,0,u.duration)}),i.show("".concat(c.get("Subtitle offset time"),": ").concat(e,"s")),r.emit("artplayerPluginSubtitleOffset",e)}else i.show("".concat(c.get("No subtitles found"))),r.emit("artplayerPluginSubtitleOffset",0)}}}function un(e){var n=e.events.proxy,r=e.template,o=e.player;function i(e){if(e){var t=r.$video.canPlayType(e.type);if("maybe"===t||"probably"===t){var n=URL.createObjectURL(e);o.switchUrl(n,e.name)}else Se(!1,"Playback of this file format is not supported")}}return n(r.$player,"dragover",function(e){e.preventDefault()}),n(r.$player,"drop",function(e){e.preventDefault(),i(e.dataTransfer.files[0])}),{name:"localVideo",attach:function(e){var t=ve(e,'');me(e,"position","relative"),ge(t,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(t,"change",function(){i(t.files[0])})}}}function sn(e){var n=e.events.proxy,c=e.subtitle;return{name:"localSubtitle",attach:function(e){var t=ve(e,'');me(e,"position","relative"),ge(t,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(t,"change",function(){!function(i){if(i){var a=Ce(i.name);if(["ass","vtt","srt"].includes(a)){var e=new FileReader;n(e,"load",function(e){var t=e.target.result;switch(a){case"srt":var n=Re(Ee(t));c.switch(n,i.name);break;case"ass":var r=Re($e(t));c.switch(r,i.name);break;case"vtt":var o=Re(t);c.switch(o,i.name)}}),e.readAsText(i)}else Se(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(t.files[0])})}}}function ln(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("controls:show",function(){e.style.display="none"}),t.on("destroy",function(){e.style.display="none"}),t.on("controls:hide",function(){e.style.display="block"}),t.on("video:timeupdate",function(){e.style.width="".concat(100*n.played,"%")})}}),{name:"miniProgressBar"}}function fn(r){var o=1e4,i=0,a=0,c=0,e=null;function t(){c=a=i=0,cancelAnimationFrame(e),e=null}function n(){e||!function n(){r.isDestroy||(e=requestAnimationFrame(function(){var e=Date.now();if(c){var t=e-c;a+=t,r.player.playing||(i+=t)}c=e,r.emit("networkMonitor",i/a),o<=a&&(a=i=0),n()}))}()}return r.on("play",n),r.on("pause",t),{name:"networkMonitor",reset:t,start:n,sample:function(e){o=e}}}function pn(t){var e=t.events,n=t.player,r=t.template,o=Ne(function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))},300);return e.proxy(window,"scroll",o),{name:"autoPip"}}function dn(t){u(this,dn);var n=t.option,r=t.events.proxy,o=t.template.$video;Je.video.events.forEach(function(e){r(o,e,function(e){t.emit("video:".concat(e.type),e)})}),Object.keys(n.moreVideoAttr).forEach(function(e){o[e]=n.moreVideoAttr[e]}),n.muted&&(o.muted=n.muted),n.volume&&(o.volume=Ue(n.volume,0,1)),n.poster&&(o.poster=n.poster),n.autoplay&&(o.autoplay=n.autoplay),o.controls=!0;var e=n.type||Ce(n.url),i=n.customType[e];e&&i?(t.emit("beforeCustomType",e),i(o,n.url,t),t.emit("afterCustomType",e)):(t.emit("beforeAttachUrl",n.url),o.src=n.url,t.emit("afterAttachUrl",o.src))}var yn=function(){function r(e){var t=this;u(this,r),this.art=e,this.id=0;var n=e.option;n.subtitle.url&&n.subtitleOffset&&this.add(cn),!n.isLive&&n.miniProgressBar&&this.add(ln),n.localVideo&&this.add(un),n.localSubtitle&&this.add(sn),n.networkMonitor&&this.add(fn),n.autoPip&&this.add(pn),e.option.plugins.forEach(function(e){t.add(e)})}return s(r,[{key:"add",value:function(e){this.id+=1;var t=e.call(this,this.art),n="";return Se(!qe(this,n=t&&t.name?t.name:e.name?e.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:t}),this.art.emit("plugin:add",e),this}}]),r}(),hn=0,vn=function(){function n(e){var t;return u(this,n),(t=f(this,p(n).call(this))).option=se(Fe(n.option,e),Ze),t.isFocus=!1,t.isDestroy=!1,t.whitelist=new Xe(l(t)),t.template=new Ge(l(t)),t.events=new Ht(l(t)),t.whitelist.state?(t.storage=new on(l(t)),t.icons=new Ut(l(t)),t.i18n=new et(l(t)),t.notice=new Zt(l(t)),t.player=new rt(l(t)),t.layers=new Yt(l(t)),t.controls=new Ct(l(t)),t.contextmenu=new Wt(l(t)),t.subtitle=new Vt(l(t)),t.info=new Nt(l(t)),t.loading=new Xt(l(t)),t.hotkey=new Bt(l(t)),t.mask=new Jt(l(t)),t.setting=new rn(l(t)),t.plugins=new yn(l(t))):t.mobile=new dn(l(t)),hn+=1,t.id=hn,n.instances.push(l(t)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),t}return t(n,le),s(n,[{key:"destroy",value:function(e){var t=!(0=0||(o[n]=e[n]);return o};var t=function(t,n){if(null==t)return{};var r,o,i=e(t,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i};var n=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function r(e,t){return e(t={exports:{}},t.exports),t.exports}var o=r((function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(r){return"function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?e.exports=n=function(e){return t(e)}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":t(e)},n(r)}e.exports=n}));var i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function a(e,t){for(var n=0;nY.length&&Y.push(e)}function J(e,t,n){return null==e?0:function e(t,n,r,o){var i=typeof t;"undefined"!==i&&"boolean"!==i||(t=null);var a=!1;if(null===t)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case b:case w:a=!0}}if(a)return r(o,t,""===n?"."+G(t,0):n),1;if(a=0,n=""===n?".":n+":",Array.isArray(t))for(var c=0;c1?t-1:0),r=1;r2?n-2:0),o=2;o2?n-2:0),o=2;o8)throw new Error("warningWithoutStack() currently supports at most 8 arguments.");if(!e){if("undefined"!=typeof console){var i=r.map((function(e){return""+e}));i.unshift("Warning: "+t),Function.prototype.apply.call(console.error,console,i)}try{var a=0,c="Warning: "+t.replace(/%s/g,(function(){return r[a++]}));throw new Error(c)}catch(e){}}},E={};function R(e,t){var n=e.constructor,r=n&&(n.displayName||n.name)||"ReactClass",o=r+"."+t;E[o]||(S(!1,"Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",t,r),E[o]=!0)}var $={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){R(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,r){R(e,"replaceState")},enqueueSetState:function(e,t,n,r){R(e,"setState")}},C={};function D(e,t,n){this.props=e,this.context=t,this.refs=C,this.updater=n||$}Object.freeze(C),D.prototype.isReactComponent={},D.prototype.setState=function(e,t){!function(){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw j(Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."))}(),this.updater.enqueueSetState(this,e,t,"setState")},D.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var T={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},_=function(e,t){Object.defineProperty(D.prototype,e,{get:function(){x(!1,"%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var A in T)T.hasOwnProperty(A)&&_(A,T[A]);function L(){}function M(e,t,n){this.props=e,this.context=t,this.refs=C,this.updater=n||$}L.prototype=D.prototype;var z=M.prototype=new L;z.constructor=M,t(z,D.prototype),z.isPureReactComponent=!0;var q={current:null},I={suspense:null},F={current:null},W=/^(.*)[\\\/]/,N=1;function V(e){if(null==e)return null;if("number"==typeof e.tag&&S(!1,"Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case a:return"Fragment";case i:return"Portal";case u:return"Profiler";case c:return"StrictMode";case d:return"Suspense";case y:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case l:return"Context.Consumer";case s:return"Context.Provider";case p:return r=e,o=e.render,f="ForwardRef",m=o.displayName||o.name||"",r.displayName||(""!==m?f+"("+m+")":f);case h:return V(e.type);case v:var t=(n=e)._status===N?n._result:null;if(t)return V(t)}var n,r,o,f,m;return null}var U={},H=null;function B(e){H=e}U.getCurrentStack=null,U.getStackAddendum=function(){var e="";if(H){var t=V(H.type),n=H._owner;e+=function(e,t,n){var r="";if(t){var o=t.fileName,i=o.replace(W,"");if(/^index\./.test(i)){var a=o.match(W);if(a){var c=a[1];if(c)i=c.replace(W,"")+"/"+i}}r=" (at "+i+":"+t.lineNumber+")"}else n&&(r=" (created by "+n+")");return"\n in "+(e||"Unknown")+r}(t,H._source,n&&V(n.type))}var r=U.getCurrentStack;return r&&(e+=r()||""),e};var Y={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:I,ReactCurrentOwner:F,IsSomeRendererActing:{current:!1},assign:t};t(Y,{ReactDebugCurrentFrame:U,ReactComponentTreeHook:{}});var X=function(e,t){if(!e){for(var n=Y.ReactDebugCurrentFrame,r=n.getStackAddendum(),o=arguments.length,i=Array(o>2?o-2:0),a=2;a1){for(var l=Array(s),f=0;f1){for(var d=Array(p),y=0;y.")}return t}(t);if(!Pe[n]){Pe[n]=!0;var r="";e&&e._owner&&e._owner!==F.current&&(r=" It was passed a child from "+V(e._owner.type)+"."),B(e),X(!1,'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',n,r),B(null)}}}function Se(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n",u=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,X(!1,"React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,u)}var f=ne.apply(this,arguments);if(null==f)return f;if(c)for(var p=2;p is not supported and will be removed in a future major release. Did you mean to render instead?")),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||(r=!0,X(!1,"Rendering is not supported and will be removed in a future major release. Did you mean to render instead?")),n.Consumer}}}),n.Consumer=i,n._currentRenderer=null,n._currentRenderer2=null,n},forwardRef:function(e){return null!=e&&e.$$typeof===h?S(!1,"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?S(!1,"forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&S(!1,"forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null!=e.defaultProps||null!=e.propTypes)&&S(!1,"forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"),{$$typeof:p,render:e}},lazy:function(e){var t={$$typeof:v,_ctor:e,_status:-1,_result:null},n=void 0,r=void 0;return Object.defineProperties(t,{defaultProps:{configurable:!0,get:function(){return n},set:function(e){X(!1,"React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(t,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){X(!1,"React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),r=e,Object.defineProperty(t,"propTypes",{enumerable:!0})}}}),t},memo:function(e,t){return we(e)||S(!1,"memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e),{$$typeof:h,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return Oe().useCallback(e,t)},useContext:function(e,t){var n=Oe();if(void 0!==t&&X(!1,"useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&Array.isArray(arguments[2])?"\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://fb.me/rules-of-hooks":""),void 0!==e._context){var r=e._context;r.Consumer===e?X(!1,"Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&X(!1,"Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},useEffect:function(e,t){return Oe().useEffect(e,t)},useImperativeHandle:function(e,t,n){return Oe().useImperativeHandle(e,t,n)},useDebugValue:function(e,t){return Oe().useDebugValue(e,t)},useLayoutEffect:function(e,t){return Oe().useLayoutEffect(e,t)},useMemo:function(e,t){return Oe().useMemo(e,t)},useReducer:function(e,t,n){return Oe().useReducer(e,t,n)},useRef:function(e){return Oe().useRef(e)},useState:function(e){return Oe().useState(e)},Fragment:a,Profiler:u,StrictMode:c,Suspense:d,unstable_SuspenseList:y,createElement:Re,cloneElement:function(e,t,n){for(var r=re.apply(this,arguments),o=2;o1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document).querySelector(e)}function me(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(t.querySelectorAll(e))}function ge(e,t){return e.classList.add(t)}function be(e,t){return e.classList.remove(t)}function we(e,t){return e.classList.contains(t)}function Oe(e,t){return t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function ke(e,t,n){return e.style[t]=n,e}function je(e,t){return Object.keys(t).forEach((function(n){ke(e,n,t[n])})),e}function Pe(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(e,null).getPropertyValue(t);return n?parseFloat(r):r}function xe(e){return Array.from(e.parentElement.children).filter((function(t){return t!==e}))}function Se(e,t){xe(e).forEach((function(e){return be(e,t)})),ge(e,t)}function Ee(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";e.setAttribute("aria-label",t),e.setAttribute("data-balloon-pos",n)}var Re=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},$e=r((function(e){function t(n,r,o){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?e.exports=t=function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&f(o,n.prototype),o}:e.exports=t=Reflect.construct,t.apply(null,arguments)}e.exports=t})),Ce=function(e){function t(e,n){var r;return i(this,t),r=s(this,l(t).call(this,e)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(u(r),n||r.constructor),r.name="ArtPlayerError",r}return p(t,e),t}(r((function(e){function t(n){var r="function"==typeof Map?new Map:void 0;return e.exports=t=function(e){if(null===e||!Re(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return $e(e,arguments,l(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),f(t,e)},t(n)}e.exports=t}))(Error));function De(e,t){if(!e)throw new Ce(t);return e}function Te(e){return"WEBVTT \r\n\r\n".concat(e.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function _e(e){return URL.createObjectURL(new Blob([e],{type:"text/vtt"}))}function Ae(e){var t=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(e,t,n){if(t===n.length-1){if(1===e.length)return".".concat(e,"00");if(2===e.length)return".".concat(e,"0")}else if(1===e.length)return(0===t?"0":":0")+e;return 0===t?e:t===n.length-1?".".concat(e):":".concat(e)})).join("")}return"WEBVTT\n\n".concat(e.split(/\r?\n/).map((function(e){var r=e.match(t);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(e){return e.trim()})).join("\n")}:null})).filter((function(e){return e})).map((function(e,t){return e?"".concat(t+1,"\n").concat(e.start," --\x3e ").concat(e.end,"\n").concat(e.text):""})).filter((function(e){return e.trim()})).join("\n\n"))}function Le(e){return e.includes("?")?Le(e.split("?")[0]):e.includes("#")?Le(e.split("#")[0]):e.trim().toLowerCase().split(".").pop()}function Me(e,t){var n=document.createElement("a");n.style.display="none",n.href=e,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var ze=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}function He(e,t,n){var r;function o(){for(var o=arguments.length,i=new Array(o),a=0;a0?[t,n,r]:[n,r]).map((function(e){return e<10?"0".concat(e):String(e)})).join(":")}var Ze=Object.freeze({__proto__:null,query:ve,queryAll:me,addClass:ge,removeClass:be,hasClass:we,append:Oe,remove:function(e){return e.parentNode.removeChild(e)},setStyle:ke,setStyles:je,getStyle:Pe,sublings:xe,inverseClass:Se,tooltip:Ee,ArtPlayerError:Ce,errorHandle:De,srtToVtt:Te,vttToBlob:_e,assToVtt:Ae,getExt:Le,downloadFile:Me,hasOwnProperty:We,proxyPropertys:Ne,mergeDeep:Ve,sleep:Ue,debounce:He,throttle:Be,clamp:Ye,secondToTime:Xe});function Je(e,t,n){return De("string"===t||e instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Ge={container:Je,url:"string|function",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Je,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Je,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Je,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(e,t,n){var r=["top","left","right"];return De(r.includes(e),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},Qe={video:{propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]}},Ke=function e(t){var n=this;i(this,e);var r=t.constructor.kindOf,o=t.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(e){switch(r(e)){case"string":return n.userAgent.indexOf(e)>-1;case"function":return e(n.userAgent);case"regexp":return e.test(n.userAgent);default:return!1}}))},et=function(){function e(t){var n=this;i(this,e),this.art=t,t.option.container instanceof Element?this.$container=t.option.container:(this.$container=ve(t.option.container),De(this.$container,"No container element found by ".concat(t.option.container))),De(t.constructor.instances.every((function(e){return e.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),De(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),t.whitelist.state?this.initDesktop():this.initMobile()}return c(e,[{key:"query",value:function(e){return ve(e,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(e){e?this.$container.innerHTML="":ge(this.$player,"artplayer-destroy")}}]),e}(),tt={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},nt={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},rt=function(){function e(t){i(this,e),this.art=t,this.languages={"zh-cn":tt,"zh-tw":nt},this.init()}return c(e,[{key:"init",value:function(){var e=this.art.option.lang.toLowerCase();this.language=this.languages[e]||{}}},{key:"get",value:function(e){return this.language[e]||e}},{key:"update",value:function(e){this.languages=Ve(this.languages,e),this.init()}}]),e}();var ot=r((function(e){ +/*! + * screenfull + * v5.0.0 - 2019-09-09 + * (c) Sindre Sorhus; MIT License + */ +!function(){var t="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=e.exports,r=function(){for(var e,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,o=n.length,i={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==i.$video.src){URL.revokeObjectURL(i.$video.src);var u=t.currentTime,s=t.playing;return t.attachUrl(a).then((function(){o.url=a,t.playbackRate=!1,t.aspectRatio=!1,e.on("ready",(function(){t.currentTime=u})),s&&(t.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),e.emit("switch",a)}))}return null}}),Object.defineProperty(t,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==i.$video.src){URL.revokeObjectURL(i.$video.src);var u=t.playing;return t.attachUrl(a).then((function(){o.url=a,t.playbackRate=!1,t.aspectRatio=!1,e.on("ready",(function(){t.currentTime=0})),u&&(t.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),e.emit("switch",a)}))}return null}})}(t,this),function(e,t){var n=e.template,r=n.$video,o=n.$player,i=e.i18n,a=e.notice;Object.defineProperty(t,"playbackRate",{get:function(){return o.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if(De(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===o.dataset.playbackRate)return;r.playbackRate=n,o.dataset.playbackRate=n,a.show("".concat(i.get("Rate"),": ").concat(1===n?i.get("Normal"):"".concat(n,"x"))),e.emit("playbackRateChange",n)}else t.playbackRate&&(t.playbackRate=1,delete o.dataset.playbackRate,e.emit("playbackRateRemove"))}}),Object.defineProperty(t,"playbackRateReset",{set:function(n){if(n){var r=o.dataset.playbackRate;r&&(t.playbackRate=Number(r),e.emit("playbackRateReset"))}}})}(t,this),function(e,t){var n=e.template,r=n.$video,o=n.$player,i=e.i18n,a=e.notice;Object.defineProperty(t,"aspectRatio",{get:function(){return o.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if(De(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)t.aspectRatio=!1;else{var u=n.split(":"),s=r.videoWidth,l=r.videoHeight,f=o.clientWidth,p=o.clientHeight,d=s/l,y=u[0]/u[1];if(d>y){var h=y*l/s;ke(r,"width","".concat(100*h,"%")),ke(r,"height","100%"),ke(r,"padding","0 ".concat((f-f*h)/2,"px"))}else{var v=s/y/l;ke(r,"width","100%"),ke(r,"height","".concat(100*v,"%")),ke(r,"padding","".concat((p-p*v)/2,"px 0"))}}o.dataset.aspectRatio=n,a.show("".concat(i.get("Aspect ratio"),": ").concat("default"===n?i.get("Default"):n)),e.emit("aspectRatioChange",n)}else t.aspectRatio&&(ke(r,"width",null),ke(r,"height",null),ke(r,"padding",null),delete o.dataset.aspectRatio,e.emit("aspectRatioRemove"))}}),Object.defineProperty(t,"aspectRatioReset",{set:function(n){if(n&&t.aspectRatio){var r=t.aspectRatio;t.aspectRatio=r,e.emit("aspectRatioReset")}}})}(t,this),function(e,t){var n=e.option,r=e.notice,o=e.template.$video;Object.defineProperty(t,"getScreenshotDataURL",{value:function(){try{var e=document.createElement("canvas");return e.width=o.videoWidth,e.height=o.videoHeight,e.getContext("2d").drawImage(o,0,0),e.toDataURL("image/png")}catch(e){throw r.show(e),e}}}),Object.defineProperty(t,"getScreenshotBlobUrl",{value:function(){return new Promise((function(e,t){try{var n=document.createElement("canvas");n.width=o.videoWidth,n.height=o.videoHeight,n.getContext("2d").drawImage(o,0,0),n.toBlob((function(t){e(URL.createObjectURL(t))}))}catch(e){r.show(e),t(e)}}))}}),Object.defineProperty(t,"screenshot",{value:function(){var r=t.getScreenshotDataURL();r&&(Me(r,"".concat(n.title||"artplayer","_").concat(Xe(o.currentTime),".png")),e.emit("screenshot",r))}})}(t,this),function(e,t){var n=e.i18n,r=e.notice,o=e.events.destroyEvents,i=e.template.$player,a=function(){e.emit("fullscreen:change",ot.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};t.fullscreenIsEnabled&&(ot.on("change",a),ot.on("error",c),o.push((function(){ot.off("change",a),ot.off("error",c)}))),Object.defineProperty(t,"fullscreen",{get:function(){return ot.isFullscreen},set:function(n){t.fullscreenIsEnabled?n?(t.fullscreenWeb&&(t.fullscreenWeb=!1),ot.request(i).then((function(){ge(i,"artplayer-fullscreen"),t.aspectRatioReset=!0,e.emit("fullscreen:enabled")}))):(t.fullscreenWeb&&(t.fullscreenWeb=!1),ot.exit().then((function(){be(i,"artplayer-fullscreen"),t.aspectRatioReset=!0,e.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(t,"fullscreenToggle",{set:function(e){e&&(t.fullscreen=!t.fullscreen)}}),Object.defineProperty(t,"fullscreenIsEnabled",{get:function(){return ot.isEnabled}})}(t,this),function(e,t){var n=e.template.$player;Object.defineProperty(t,"fullscreenWeb",{get:function(){return we(n,"artplayer-web-fullscreen")},set:function(r){r?(t.fullscreen&&(t.fullscreen=!1),ge(n,"artplayer-web-fullscreen"),t.aspectRatioReset=!0,e.emit("fullscreenWeb:enabled")):(t.fullscreen&&(t.fullscreen=!1),be(n,"artplayer-web-fullscreen"),t.aspectRatioReset=!0,e.emit("fullscreenWeb:exit"))}}),Object.defineProperty(t,"fullscreenWebToggle",{set:function(e){e&&(t.fullscreenWeb=!t.fullscreenWeb)}})}(t,this),it(t,this),function(e,t){var n=e.template.$video;Object.defineProperty(t,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(t,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(t,this),function(e,t){Object.defineProperty(t,"played",{get:function(){return e.template.$video.currentTime/e.template.$video.duration}})}(t,this),function(e,t){var n=e.template.$video;Object.defineProperty(t,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(t,this),function(e,t){var n=e.template,r=n.$container,o=n.$player,i=n.$video;Object.defineProperty(t,"autoSize",{get:function(){return we(r,"artplayer-auto-size")},set:function(t){if(t){var n=i.videoWidth,a=i.videoHeight,c=r.getBoundingClientRect(),u=c.width,s=c.height,l=n/a,f=u/s;if(ge(r,"artplayer-auto-size"),f>l){ke(o,"width","".concat(s*l/u*100,"%")),ke(o,"height","100%")}else{var p=u/l/s*100;ke(o,"width","100%"),ke(o,"height","".concat(p,"%"))}e.emit("autoSizeChange")}else be(r,"artplayer-auto-size"),ke(o,"width",null),ke(o,"height",null),e.emit("autoSizeRemove")}})}(t,this),function(e,t){Object.defineProperty(t,"rect",{get:function(){return e.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(e){Object.defineProperty(t,e,{get:function(){return t.rect[e]}})})),Object.defineProperty(t,"x",{get:function(){return t.left+window.pageXOffset}}),Object.defineProperty(t,"y",{get:function(){return t.top+window.pageYOffset}})}(t,this),function(e,t){Object.defineProperty(t,"flip",{get:function(){return e.template.$player.dataset.flip},set:function(t){if(t){var n=["normal","horizontal","vertical"];De(n.includes(t),"'flip' only accept ".concat(n.toString()," as parameters")),e.template.$player.dataset.flip=t,e.emit("flipChange",t)}else delete e.template.$player.dataset.flip,e.emit("flipRemove")}})}(t,this),Ne(t,this)};function ct(e,t,n,r,o,i){var a="function"==typeof r?r(e):r;if(a.disable)return{};var c=t.id,u=a.name||"".concat(i).concat(c);De(!We(t,u),"Cannot create a component that already has the same name: ".concat(i," -> ").concat(u));var s=document.createElement("div");s.classList.value="art-".concat(i," art-").concat(i,"-").concat(u),a.html&&Oe(s,a.html),a.style&&je(s,a.style),a.tooltip&&Ee(s,a.tooltip);var l=Array.from(n.children);s.dataset.index=a.index||c;var f=l.find((function(e){return Number(e.dataset.index)>=Number(s.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",s):Oe(n,s),a.click&&e.events.proxy(s,"click",(function(n){n.preventDefault(),a.click.call(e,t,n),e.emit("".concat(i,":click"),s)})),a.mounted&&a.mounted(s,t,e),o&&o(s,t,e),Object.defineProperty(t,u,{value:{get id(){return c},get $ref(){return s},set show(t){t?(ke(s,"display","block"),e.emit("".concat(i,":show"),s)):(ke(s,"display","none"),e.emit("".concat(i,":hide"),s))}}}),e.emit("".concat(i,":add"),a),t[u]}function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function st(e){return function(t){return function(e){for(var t=1;t\n
\n
\n
\n
\n
\n \n '),mounted:function(e){var n=!1,r=ve(".art-progress-loaded",e),i=ve(".art-progress-played",e),u=ve(".art-progress-highlight",e),s=ve(".art-progress-indicator",e),l=ve(".art-progress-tip",e);function f(e,t){"loaded"===e&&ke(r,"width","".concat(100*t,"%")),"played"===e&&(ke(i,"width","".concat(100*t,"%")),ke(s,"left","calc(".concat(100*t,"% - ").concat(Pe(s,"width")/2,"px)")))}o.forEach((function(e){var t=Ye(e.time,0,c.duration)/c.duration*100;Oe(u,''))})),f("loaded",c.loaded),t.on("video:progress",(function(){f("loaded",c.loaded)})),t.on("video:timeupdate",(function(){f("played",c.played)})),t.on("video:ended",(function(){f("played",1)})),a(e,"mousemove",(function(n){ke(l,"display","block"),n.composedPath().indexOf(u)>-1?function(n){var r=mt(t,n).width,o=n.target.dataset.text;l.innerHTML=o;var i=l.clientWidth;r<=i/2?ke(l,"left",0):r>e.clientWidth-i/2?ke(l,"left","".concat(e.clientWidth-i,"px")):ke(l,"left","".concat(r-i/2,"px"))}(n):function(n){var r=mt(t,n),o=r.width,i=r.time;l.innerHTML=i;var a=l.clientWidth;o<=a/2?ke(l,"left",0):o>e.clientWidth-a/2?ke(l,"left","".concat(e.clientWidth-a,"px")):ke(l,"left","".concat(o-a/2,"px"))}(n)})),a(e,"mouseout",(function(){ke(l,"display","none")})),a(e,"click",(function(e){if(e.target!==s){var n=mt(t,e),r=n.second;f("played",n.percentage),c.seek=r}})),a(s,"mousedown",(function(){n=!0})),a(document,"mousemove",(function(e){if(n){var r=mt(t,e),o=r.second,i=r.percentage;ge(s,"art-show-indicator"),f("played",i),c.seek=o}})),a(document,"mouseup",(function(){n&&(n=!1,be(s,"art-show-indicator"))}))}})}}function bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wt(e){return function(t){return function(e){for(var t=1;t'),l=Oe(s,'
');function f(e){var t=s.getBoundingClientRect(),n=t.left,r=t.width,o=l.getBoundingClientRect().width;return Ye(e.pageX-n-o/2,0,r-o/2)/(r-o)}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(o.muted||0===e)ke(c,"display","none"),ke(u,"display","flex"),ke(l,"left","0");else{var t=((Pe(s,"width")||60)-Pe(l,"width"))*e;ke(c,"display","flex"),ke(u,"display","none"),ke(l,"left","".concat(t,"px"))}}Ee(c,i.get("Mute")),ke(u,"display","none"),p(o.volume),t.on("video:volumechange",(function(){p(o.volume)})),n(c,"click",(function(){o.muted=!0})),n(u,"click",(function(){o.muted=!1})),n(s,"click",(function(e){o.muted=!1,o.volume=f(e)})),n(l,"mousedown",(function(){a=!0})),n(l,"mousemove",(function(e){a&&(o.muted=!1,o.volume=f(e))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function xt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function St(e){return function(t){return function(e){for(var t=1;tr.clientWidth-u/2?ke(e,"left","".concat(r.clientWidth-u,"px")):ke(e,"left","".concat(i-u/2,"px"))}(o))})),i(r,"mouseout",(function(){ke(e,"display","none")}))}})}}function $t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ct(e){return function(t){return function(e){for(var t=1;t'.concat(u.name,"")),l=n.map((function(e,t){return'
').concat(e.name,"
")})).join(""),f=Oe(e,'
'.concat(l,"
"));i(e,(function(){f.style.left="-".concat(Pe(f,"width")/2-e.clientWidth/2,"px")})),o(f,"click",(function(e){var t=Number(e.target.dataset.index),r=n[t],o=r.url,i=r.name;o&&i&&c!==t&&(a.switchQuality(o,i),s.innerHTML=i,c=t)}))}})}}var _t=function(){function e(t){var n=this;i(this,e),this.id=0,this.art=t,this.art.on("ready",(function(){n.init()}))}return c(e,[{key:"init",value:function(){var e=this,t=this.art.option;this.add(gt({name:"progress",disable:t.isLive,position:"top",index:10})),this.add(Rt({name:"thumbnails",disable:!t.thumbnails.url||t.isLive,position:"top",index:20})),this.add(ht({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Pt({name:"volume",disable:!1,position:"left",index:20})),this.add(kt({name:"time",disable:t.isLive,position:"left",index:30})),this.add(Tt({name:"quality",disable:0===t.quality.length,position:"right",index:10})),this.add(Ct({name:"screenshot",disable:!t.screenshot,position:"right",index:20})),this.add(wt({name:"subtitle",disable:!t.subtitle.url,position:"right",index:30})),this.add(St({name:"setting",disable:!t.setting,position:"right",index:40})),this.add(dt({name:"pip",disable:!t.pip,position:"right",index:50})),this.add(ft({name:"fullscreenWeb",disable:!t.fullscreenWeb,position:"right",index:60})),this.add(st({name:"fullscreen",disable:!t.fullscreen,position:"right",index:70})),t.controls.forEach((function(t){e.add(t)}))}},{key:"add",value:function(e,t){var n,r="function"==typeof e?e(this.art):e,o=this.art.template,i=o.$progress,a=o.$controlsLeft,c=o.$controlsRight;switch(r.position){case"top":n=i;break;case"left":n=a;break;case"right":n=c}this.id+=1,De(r.position,"Controls option.position can not be empty");var u=ct(this.art,this,n,r,t,"control");return r.disable||"top"===r.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||ge(u.$ref,"art-control-onlyText"),u}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,be(t,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),e}();function At(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Lt(e){return function(t){var r=t.i18n,o=t.player;return function(e){for(var t=1;t0.5\n 0.75\n ').concat(r.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(e,t){var n=t.target.dataset.rate;n&&(o.playbackRate=Number(n),e.show=!1)},mounted:function(e){t.on("playbackRateChange",(function(t){var n=me("span",e).find((function(e){return Number(e.dataset.rate)===t}));n&&Se(n,"current")}))}})}}function Mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zt(e){return function(t){var r=t.i18n,o=t.player;return function(e){for(var t=1;t').concat(r.get("Default"),'\n 4:3\n 16:9\n '),click:function(e,t){var n=t.target.dataset.ratio;n&&(o.aspectRatio=n,e.show=!1)},mounted:function(e){t.on("aspectRatioChange",(function(t){var n=me("span",e).find((function(e){return e.dataset.ratio===t}));n&&Se(n,"current")}))}})}}function qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function It(e){return function(t){return function(e){for(var t=1;tArtPlayer 3.1.18'})}function Nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Vt(e){return function(t){return function(e){for(var t=1;ts+u&&(y=u-d),i+p>l+c&&(h=c-p),ke(r,"left","".concat(y,"px")),ke(r,"top","".concat(h,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,be(t,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),e}(),Ht=function(){function e(t){var n=this;i(this,e),this.art=t,this.timer=null;var r=t.template,o=r.$infoPanel,a=r.$infoClose,c=t.events.proxy;this.types=me("[data-video]",o),c(a,"click",(function(){n.show=!1})),this.art.on("destroy",(function(){clearTimeout(n.timer)}))}return c(e,[{key:"readInfo",value:function(){var e=this.art.template.$video;this.types.forEach((function(t){var n=e[t.dataset.video];t.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var e=this;this.readInfo(),this.timer=setTimeout((function(){e.readInfo(),e.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,be(t,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),e}(),Bt=function(){function e(t){i(this,e),this.art=t,this.state=!0;var n=t.events.proxy,r=t.option.subtitle;je(t.template.$subtitle,r.style),n(this.textTrack,"cuechange",this.update.bind(this)),r.url&&this.init(r.url)}return c(e,[{key:"update",value:function(){var e=this.art.template.$subtitle;e.innerHTML="",this.activeCue&&(e.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(e){return"

".concat(e,"

")})).join("")),this.art.emit("subtitle:update",e)}},{key:"switch",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,o=r.i18n,i=r.notice;return this.init(e).then((function(e){return i.show("".concat(o.get("Switch subtitle"),": ").concat(n)),t.art.emit("subtitle:switch",e),e}))}},{key:"init",value:function(e){var t=this,n=this.art,r=n.notice,o=n.template,i=o.$subtitle,a=o.$track;return fetch(e).then((function(e){return e.text()})).then((function(t){switch(Le(e)){case"srt":return _e(Te(t));case"ass":return _e(Ae(t));case"vtt":return _e(t);default:return e}})).then((function(e){return i.innerHTML="",t.url===e?e:(URL.revokeObjectURL(t.url),a.src=e,e)})).catch((function(e){throw r.show(e),e}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,be(t,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,ge(t,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),e}();var Yt=function(){function e(t){var n=this;i(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),t.whitelist.state&&t.once("video:canplay",(function(){!function(e,t){var n=e.template.$player;t.proxy(document,["click","contextmenu"],(function(t){t.composedPath().indexOf(n)>-1?(e.isFocus=!0,e.emit("focus")):(e.isFocus=!1,e.emit("blur"))}))}(t,n),function(e,t){var n=e.template.$player;t.hover(n,(function(){ge(n,"artplayer-hover"),e.emit("hoverenter")}),(function(){be(n,"artplayer-hover"),e.emit("hoverleave")}))}(t,n),function(e,t){var n=e.template,r=n.$player,o=n.$video,i=e.player,a=He((function(){ge(r,"artplayer-hide-cursor"),be(r,"artplayer-hover"),e.controls.show=!1}),3e3);e.on("hoverleave",(function(){i.playing&&a()})),t.proxy(r,"mousemove",(function(t){a.clearTimeout(),be(r,"artplayer-hide-cursor"),e.controls.show=!0,!e.player.pip&&i.playing&&t.target===o&&a()}))}(t,n),function(e,t){var n=e.option,r=e.player,o=e.template.$player,i=document.createElement("object");i.setAttribute("aria-hidden","true"),i.setAttribute("tabindex",-1),i.type="text/html",i.data="about:blank";var a=r.width,c=r.height,u=Be((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(e.player.fullscreen||e.player.fullscreenWeb||e.player.pip?e.player.autoSize=!1:e.player.autoSize=!0),e.player.aspectRatioReset=!0,e.emit("resize",{width:r.width,height:r.height}))}),500);t.proxy(i,"load",(function(){t.proxy(i.contentDocument.defaultView,"resize",u)})),o.appendChild(i)}(t,n)}))}return c(e,[{key:"proxy",value:function(e,t,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(t)?t.forEach((function(t){return r.proxy(e,t,n,o)})):(e.addEventListener(t,n,o),this.destroyEvents.push((function(){e.removeEventListener(t,n,o)})))}},{key:"hover",value:function(e,t,n){t&&this.proxy(e,"mouseenter",t),n&&this.proxy(e,"mouseleave",n)}},{key:"loadImg",value:function(e){var t=this;return new Promise((function(n,r){var o;if(e instanceof HTMLImageElement)o=e;else{if("string"!=typeof e)return r(e);(o=new Image).src=e}return o.complete?n(o):(t.proxy(o,"load",(function(){return n(o)})),t.proxy(o,"error",(function(){return r(o)})),e)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(e){return e()}))}}]),e}(),Xt=function(){function e(t){var n=this;i(this,e),this.art=t,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){n.add(27,(function(){t.player.fullscreenWeb&&(t.player.fullscreenWeb=!1)})),n.add(32,(function(){t.player.toggle=!0})),n.add(37,(function(){t.player.seek=t.player.currentTime-5})),n.add(38,(function(){t.player.volume+=.1})),n.add(39,(function(){t.player.seek=t.player.currentTime+5})),n.add(40,(function(){t.player.volume-=.1})),n.init()}))}return c(e,[{key:"add",value:function(e,t){this.keys[e]?this.keys[e].push(t):this.keys[e]=[t]}},{key:"init",value:function(){var e=this;(0,this.art.events.proxy)(window,"keydown",(function(t){if(e.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var o=e.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(e){return e()})),e.art.emit("hotkey",t))}}}))}}]),e}(),Zt=function(){function e(t){var n=this;i(this,e),this.id=0,this.art=t,this.add=this.add.bind(this),this.art.on("ready",(function(){n.art.option.layers.forEach((function(e){n.add(e)}))}))}return c(e,[{key:"add",value:function(e,t){this.id+=1;var n=this.art.template.$layers;return ct(this.art,this,n,e,t,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,be(t,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,ge(t,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),e}(),Jt=function(){function e(t){i(this,e),this.art=t,Oe(t.template.$loading,t.icons.loading)}return c(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,be(t,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),e}(),Gt=function(){function e(t){i(this,e),this.art=t,this.timer=null}return c(e,[{key:"show",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,o=this.art.template,i=o.$player,a=o.$noticeInner;this.state=!0,ge(i,"artplayer-notice-show"),a.innerHTML=e instanceof Error?e.message.trim():e,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){t.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var e=this.art.template.$player;this.state=!1,be(e,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),e}(),Qt=function(){function e(t){i(this,e),this.art=t,Oe(t.template.$state,t.icons.state)}return c(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,be(t,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),e}(),Kt=function e(t){var n=this;i(this,e);var r=Object.assign({loading:'\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},t.option.icons);Object.keys(r).forEach((function(e){var t=document.createElement("i");t.classList.add("art-icon"),t.classList.add("art-icon-".concat(e)),Oe(t,r[e]),n[e]=t}))};function en(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function tn(e){return function(t){var r=t.i18n,o=t.player;return function(e){for(var t=1;t'.concat(r.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(e,t){var n=t.target.dataset.value;n&&(o.flip=n)},mounted:function(e){t.on("flipChange",(function(t){var n=me("button",e).find((function(e){return e.dataset.value===t}));n&&Se(n.parentElement,"current")}))}})}}function nn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rn(e){return function(t){var r=t.i18n,o=t.player;return function(e){for(var t=1;t'.concat(r.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(e,t){var n=t.target.dataset.value;n&&(o.aspectRatio=n)},mounted:function(e){t.on("aspectRatioChange",(function(t){var n=me("button",e).find((function(e){return e.dataset.value===t}));n&&Se(n.parentElement,"current")}))}})}}function on(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function an(e){return function(t){var r=t.i18n,o=t.player,i=t.events.proxy;return function(e){for(var t=1;t\n '.concat(r.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(e){var n=ve(".art-setting-range input",e),r=ve(".art-subtitle-value",e);i(n,"change",(function(){var e=n.value;r.innerText=e,o.playbackRate=Number(e)})),t.on("playbackRateChange",(function(e){n.value!==e&&(n.value=e,r.innerText=e)}))}})}}var cn=function(){function e(t){var n=this;i(this,e),this.id=0,this.art=t,this.state=!1,t.option.setting&&(this.art.on("ready",(function(){n.init()})),this.art.on("blur",(function(){n.show=!1})))}return c(e,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,r=t.template.$setting;(0,t.events.proxy)(r,"click",(function(t){t.target===r&&(e.show=!1)})),this.add(tn({disable:!n.flip,name:"flip"})),this.add(rn({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(an({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(e,t){this.id+=1;var n=this.art.template.$settingBody;return ct(this.art,this,n,e,t,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,be(t,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),e}(),un=function(){function e(t){i(this,e),this.art=t,this.name="artplayer_settings";var n=t.option,r=this.get("volume");r&&(n.volume=r)}return c(e,[{key:"get",value:function(e){var t=JSON.parse(window.localStorage.getItem(this.name))||{};return e?t[e]:{}}},{key:"set",value:function(e,t){var r=Object.assign({},this.get(),n({},e,t));window.localStorage.setItem(this.name,JSON.stringify(r))}},{key:"del",value:function(e){var t=this.get();delete t[e],window.localStorage.setItem(this.name,JSON.stringify(t))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),e}();function sn(e){var t=e.i18n,n=e.subtitle,r=e.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(t.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(t){var o=ve(".art-setting-range input",t),i=ve(".art-subtitle-value",t);r(o,"change",(function(){var t=o.value;i.innerText=t,e.plugins.subtitleOffset.offset(Number(t))})),e.on("subtitle:switch",(function(){o.value=0,i.innerText=0})),e.on("artplayerPluginSubtitleOffset",(function(e){n.update(),o.value!==e&&(o.value=e,i.innerText=e)}))}}}function ln(e){var t=e.constructor.utils.clamp,n=e.setting,r=e.notice,o=e.template,i=e.i18n,a=e.player;i.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(sn);var c=[];return e.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(o.$track&&o.$track.track){var u=Array.from(o.$track.track.cues),s=t(n,-5,5);u.forEach((function(e,n){c[n]||(c[n]={startTime:e.startTime,endTime:e.endTime}),e.startTime=t(c[n].startTime+s,0,a.duration),e.endTime=t(c[n].endTime+s,0,a.duration)})),r.show("".concat(i.get("Subtitle offset time"),": ").concat(n,"s")),e.emit("artplayerPluginSubtitleOffset",n)}else r.show("".concat(i.get("No subtitles found"))),e.emit("artplayerPluginSubtitleOffset",0)}}}function fn(e){var t=e.events.proxy,n=e.template,r=e.player;function o(e){if(e){var t=n.$video.canPlayType(e.type);if("maybe"===t||"probably"===t){var o=URL.createObjectURL(e);r.switchUrl(o,e.name)}else De(!1,"Playback of this file format is not supported")}}return t(n.$player,"dragover",(function(e){e.preventDefault()})),t(n.$player,"drop",(function(e){e.preventDefault(),o(e.dataTransfer.files[0])})),{name:"localVideo",attach:function(e){var n=Oe(e,'');ke(e,"position","relative"),je(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),t(n,"change",(function(){o(n.files[0])}))}}}function pn(e){var t=e.events.proxy,n=e.subtitle;return{name:"localSubtitle",attach:function(e){var r=Oe(e,'');ke(e,"position","relative"),je(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),t(r,"change",(function(){!function(e){if(e){var r=Le(e.name);if(["ass","vtt","srt"].includes(r)){var o=new FileReader;t(o,"load",(function(t){var o=t.target.result;switch(r){case"srt":var i=_e(Te(o));n.switch(i,e.name);break;case"ass":var a=_e(Ae(o));n.switch(a,e.name);break;case"vtt":var c=_e(o);n.switch(c,e.name)}})),o.readAsText(e)}else De(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function dn(e){var t=e.layers,n=e.player,r=e.option.theme;return t.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(t){e.on("controls:show",(function(){t.style.display="none"})),e.on("destroy",(function(){t.style.display="none"})),e.on("controls:hide",(function(){t.style.display="block"})),e.on("video:timeupdate",(function(){t.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function yn(e){var t=1e4,n=0,r=0,o=0,i=null;function a(){n=0,r=0,o=0,cancelAnimationFrame(i),i=null}function c(){i||function a(){e.isDestroy||(i=requestAnimationFrame((function(){var i=Date.now();if(o){var c=i-o;r+=c,e.player.playing||(n+=c)}o=i,e.emit("networkMonitor",n/r),r>=t&&(n=0,r=0),a()})))}()}return e.on("play",c),e.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(e){t=e}}}function hn(e){var t=e.events,n=e.player,r=e.template,o=He((function(){var t=r.$player.getBoundingClientRect();t.top+t.height<=0&&!n.pip?(n.pip=!0,e.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,e.emit("artplayerPluginAutoPip",!1))}),300);return t.proxy(window,"scroll",o),{name:"autoPip"}}var vn=function(){function e(t){var n=this;i(this,e),this.art=t,this.id=0;var r=t.option;r.subtitle.url&&r.subtitleOffset&&this.add(ln),!r.isLive&&r.miniProgressBar&&this.add(dn),r.localVideo&&this.add(fn),r.localSubtitle&&this.add(pn),r.networkMonitor&&this.add(yn),r.autoPip&&this.add(hn),t.option.plugins.forEach((function(e){n.add(e)}))}return c(e,[{key:"add",value:function(e){this.id+=1;var t=e.call(this,this.art),n="";return De(!We(this,n=t&&t.name?t.name:e.name?e.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:t}),this.art.emit("plugin:add",e),this}}]),e}(),mn=function e(t){i(this,e);var n=t.option,r=t.events.proxy,o=t.template.$video;Qe.video.events.forEach((function(e){r(o,e,(function(e){t.emit("video:".concat(e.type),e)}))})),Object.keys(n.moreVideoAttr).forEach((function(e){o[e]=n.moreVideoAttr[e]})),n.muted&&(o.muted=n.muted),n.volume&&(o.volume=Ye(n.volume,0,1)),n.poster&&(o.poster=n.poster),n.autoplay&&(o.autoplay=n.autoplay),o.controls=!0;var a=n.type||Le(n.url),c=n.customType[a];a&&c?(t.emit("beforeCustomType",a),c(o,n.url,t),t.emit("afterCustomType",a)):(t.emit("beforeAttachUrl",n.url),o.src=n.url,t.emit("afterAttachUrl",o.src))},gn=0,bn=function(e){function t(e){var n;return i(this,t),(n=s(this,l(t).call(this))).option=ye(Ve(t.option,e),Ge),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new Ke(u(n)),n.template=new et(u(n)),n.events=new Yt(u(n)),n.whitelist.state?(n.storage=new un(u(n)),n.icons=new Kt(u(n)),n.i18n=new rt(u(n)),n.notice=new Gt(u(n)),n.player=new at(u(n)),n.layers=new Zt(u(n)),n.controls=new _t(u(n)),n.contextmenu=new Ut(u(n)),n.subtitle=new Bt(u(n)),n.info=new Ht(u(n)),n.loading=new Jt(u(n)),n.hotkey=new Xt(u(n)),n.mask=new Qt(u(n)),n.setting=new cn(u(n)),n.plugins=new vn(u(n))):n.mobile=new mn(u(n)),gn+=1,n.id=gn,t.instances.push(u(n)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),n}return p(t,e),c(t,[{key:"destroy",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(e),t.instances.splice(t.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Qe}},{key:"utils",get:function(){return Ze}},{key:"scheme",get:function(){return Ge}},{key:"Emitter",get:function(){return he}},{key:"validator",get:function(){return ye}},{key:"kindOf",get:function(){return ye.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),t}(he);function wn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function On(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return t(this,o),(e=a(this,s(o).call(this))).processing=!1,e.option={},e.setup(Object.assign({},o.DEFAULTS,n)),e.video=o.creatVideo(),e.inputChange=e.inputChange.bind(r(e)),e.ondrop=e.ondrop.bind(r(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",o.ondragover),e.option.fileInput.addEventListener("drop",o.ondrop),e}return l(o,e),n(o,[{key:"ondrop",value:function(t){t.preventDefault();var e=t.dataTransfer.files[0];this.loadVideo(e)}},{key:"setup",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,e);var n=this.option,o=n.fileInput,i=n.delay,r=n.number,a=n.width,s=n.height,u=n.column;if(this.errorHandle(o instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==o.tagName||"file"!==o.type){o.style.position="relative";var l=document.createElement("input");l.type="file",l.style.position="absolute",l.style.width="100%",l.style.height="100%",l.style.left="0",l.style.top="0",l.style.right="0",l.style.bottom="0",l.style.opacity="0",o.appendChild(l),this.option.fileInput=l}return["delay","number","width","height","column"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.delay=d(i,10,1e3),this.option.number=d(r,10,1e3),this.option.width=d(a,10,1e3),this.option.height=d(s,10,1e3),this.option.column=d(u,1,1e3),this}},{key:"inputChange",value:function(){var t=this.option.fileInput.files[0];this.loadVideo(t)}},{key:"loadVideo",value:function(t){var e=this,n=this.option.delay;if(t){var o=this.video.canPlayType(t.type);this.errorHandle("maybe"===o||"probably"===o,"Playback of this file format is not supported: ".concat(t.type));var i=URL.createObjectURL(t);this.videoUrl=i,this.file=t,this.emit("file",this.file),this.video.src=i,p(n).then((function(){e.emit("video",e.video)})).catch((function(t){throw e.emit("error",t.message),t}))}}},{key:"start",value:function(){var t=this,e=this.option,n=e.width,o=e.height,i=e.number,r=e.delay;this.density=i/this.video.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),s=this.creatCanvas(),u=s.getContext("2d");this.emit("canvas",s);var l,c=a.map((function(e,a){return function(){return t.video.currentTime=e.time,new Promise((function(l){p(r).then((function(){u.drawImage(t.video,e.x,e.y,n,o),s.toBlob((function(e){t.thumbnailUrl&&URL.revokeObjectURL(t.thumbnailUrl),t.thumbnailUrl=URL.createObjectURL(e),t.emit("update",t.thumbnailUrl,(a+1)/i),l()}))})).catch((function(t){throw t}))}))}}));return this.processing=!0,(l=c,l.reduce((function(t,e){return t.then(e)}),Promise.resolve())).then((function(){return p(2*r).then((function(){t.processing=!1,t.emit("done")})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))}},{key:"creatScreenshotDate",value:function(){for(var t=this.option,e=t.number,n=t.width,o=t.height,i=t.column,r=this.video.duration/e,a=[r];a.length").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function D(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function T(t){var n=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(t){return(0\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n \n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":m(this.$player,"artplayer-destroy")}}]),n}(),Q={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},tt=function(){function e(t){s(this,e),this.art=t,this.languages={"zh-cn":Q,"zh-tw":K},this.init()}return i(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=H(this.languages,t),this.init()}}]),e}();var et=t(function(t){var o,e,i,r,n;o="undefined"!=typeof window&&void 0!==window.document?window.document:{},e=t.exports,i=function(){for(var t,e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=e.length,i={};n ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&w(u,a.html),a.style&&v(u,a.style),a.tooltip&&k(u,a.tooltip);var l=Array.from(t.children);u.dataset.index=a.index||c;var f=l.find(function(t){return Number(t.dataset.index)>=Number(u.dataset.index)});return f?f.insertAdjacentElement("beforebegin",u):w(t,u),a.click&&e.events.proxy(u,"click",function(t){t.preventDefault(),a.click.call(e,n,t),e.emit("".concat(o,":click"),u)}),a.mounted&&a.mounted(u,n,e),i&&i(u,n,e),Object.defineProperty(n,s,{value:{get id(){return c},get $ref(){return u},set show(t){t?(O(u,"display","block"),e.emit("".concat(o,":show"),u)):(O(u,"display","none"),e.emit("".concat(o,":hide"),u))}}}),e.emit("".concat(o,":add"),a),n[s]}function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(t){return function(a){return function(e){for(var t=1;t\n
\n
\n
\n
\n
\n \n '),mounted:function(o){var i=!1,n=h(".art-progress-loaded",o),r=h(".art-progress-played",o),a=h(".art-progress-highlight",o),c=h(".art-progress-indicator",o),s=h(".art-progress-tip",o);function u(t,e){"loaded"===t&&O(n,"width","".concat(100*e,"%")),"played"===t&&(O(r,"width","".concat(100*e,"%")),O(c,"left","calc(".concat(100*e,"% - ").concat(j(c,"width")/2,"px)")))}e.forEach(function(t){var e=N(t.time,0,p.duration)/p.duration*100;w(a,''))}),u("loaded",p.loaded),l.on("video:progress",function(){u("loaded",p.loaded)}),l.on("video:timeupdate",function(){u("played",p.played)}),l.on("video:ended",function(){u("played",1)}),f(o,"mousemove",function(t){O(s,"display","block"),-1o.clientWidth-r/2?O(s,"left","".concat(o.clientWidth-r,"px")):O(s,"left","".concat(e-r/2,"px"))}(t):function(t){var e=ht(l,t),n=e.width,r=e.time;s.innerHTML=r;var i=s.clientWidth;n<=i/2?O(s,"left",0):n>o.clientWidth-i/2?O(s,"left","".concat(o.clientWidth-i,"px")):O(s,"left","".concat(n-i/2,"px"))}(t)}),f(o,"mouseout",function(){O(s,"display","none")}),f(o,"click",function(t){if(t.target!==c){var e=ht(l,t),n=e.second;u("played",e.percentage),p.seek=n}}),f(c,"mousedown",function(){i=!0}),f(document,"mousemove",function(t){if(i){var e=ht(l,t),n=e.second,r=e.percentage;m(c,"art-show-indicator"),u("played",r),p.seek=n}}),f(document,"mouseup",function(){i&&(i=!1,g(c,"art-show-indicator"))})}})}}function vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mt(t){return function(a){return function(e){for(var t=1;t'),u=w(s,'
');function l(t){var e=s.getBoundingClientRect(),n=e.left,r=e.width,i=u.getBoundingClientRect().width;return N(t.pageX-n-i/2,0,r-i/2)/(r-i)}function f(t){var e=0d.clientWidth-i/2?O(f,"left","".concat(d.clientWidth-i,"px")):O(f,"left","".concat(e-i/2,"px"))}(t))}),e(d,"mouseout",function(){O(f,"display","none")})}})}}function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function St(t){return function(a){return function(e){for(var t=1;t'.concat(i.name,"")),u=o.map(function(t,e){return'
').concat(t.name,"
")}).join(""),l=w(t,'
'.concat(u,"
"));r(t,function(){l.style.left="-".concat(j(l,"width")/2-t.clientWidth/2,"px")}),n(l,"click",function(t){var e=Number(t.target.dataset.index),n=o[e],r=n.url,i=n.name;r&&i&&c!==e&&(a.switchQuality(r,i),s.innerHTML=i,c=e)})}})}}var Dt=function(){function n(t){var e=this;s(this,n),this.id=0,this.art=t,this.art.on("ready",function(){e.init()})}return i(n,[{key:"init",value:function(){var e=this,t=this.art.option;this.add(yt({name:"progress",disable:t.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!t.thumbnails.url||t.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:t.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===t.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!t.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!t.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!t.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!t.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!t.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!t.fullscreen,position:"right",index:70})),t.controls.forEach(function(t){e.add(t)})}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,$(r.position,"Controls option.position can not be empty");var s=it(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||m(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,g(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),n}();function Tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ct(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t0.5\n 0.75\n ').concat(e.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(n){t.on("playbackRateChange",function(e){var t=y("span",n).find(function(t){return Number(t.dataset.rate)===e});t&&P(t,"current")})}})}}function At(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lt(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t').concat(e.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(n){t.on("aspectRatioChange",function(e){var t=y("span",n).find(function(t){return t.dataset.ratio===e});t&&P(t,"current")})}})}}function Mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zt(t){return function(e){return function(e){for(var t=1;tArtPlayer 3.1.18'})}function Ft(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ht(e){return function(t){return function(e){for(var t=1;t".concat(t,"

")}).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t,e){var n=this,r=1\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},t.option.icons);Object.keys(r).forEach(function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),w(e,r[t]),n[t]=e})}var Ut=function(){function n(t){var e=this;s(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),t.whitelist.state&&t.once("video:canplay",function(){!function(e,t){var n=e.template.$player;t.proxy(document,["click","contextmenu"],function(t){-1'.concat(e.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(n){t.on("flipChange",function(e){var t=y("button",n).find(function(t){return t.dataset.value===e});t&&P(t.parentElement,"current")})}})}}function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function te(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t'.concat(e.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(n){t.on("aspectRatioChange",function(e){var t=y("button",n).find(function(t){return t.dataset.value===e});t&&P(t.parentElement,"current")})}})}}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){return function(r){var t=r.i18n,i=r.player,o=r.events.proxy;return function(e){for(var t=1;t\n '.concat(t.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(t){var e=h(".art-setting-range input",t),n=h(".art-subtitle-value",t);o(e,"change",function(){var t=e.value;n.innerText=t,i.playbackRate=Number(t)}),r.on("playbackRateChange",function(t){e.value!==t&&(e.value=t,n.innerText=t)})}})}}var re=function(){function n(t){var e=this;s(this,n),this.id=0,this.art=t,this.state=!1,t.option.setting&&(this.art.on("ready",function(){e.init()}),this.art.on("blur",function(){e.show=!1}))}return i(n,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,r=t.template.$setting;(0,t.events.proxy)(r,"click",function(t){t.target===r&&(e.show=!1)}),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return it(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,g(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),n}(),ie=function(){function r(t){s(this,r),this.art=t,this.name="artplayer_settings";var e=t.option,n=this.get("volume");n&&(e.volume=n)}return i(r,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),c({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),r}();function oe(r){var t=r.i18n,i=r.subtitle,o=r.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(t.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(t){var e=h(".art-setting-range input",t),n=h(".art-subtitle-value",t);o(e,"change",function(){var t=e.value;n.innerText=t,r.plugins.subtitleOffset.offset(Number(t))}),r.on("subtitle:switch",function(){e.value=0,n.innerText=0}),r.on("artplayerPluginSubtitleOffset",function(t){i.update(),e.value!==t&&(e.value=t,n.innerText=t)})}}}function ae(r){var i=r.constructor.utils.clamp,t=r.setting,o=r.notice,a=r.template,c=r.i18n,s=r.player;c.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),t.add(oe);var u=[];return r.on("subtitle:switch",function(){u=[]}),{name:"subtitleOffset",offset:function(t){if(a.$track&&a.$track.track){var e=Array.from(a.$track.track.cues),n=i(t,-5,5);e.forEach(function(t,e){u[e]||(u[e]={startTime:t.startTime,endTime:t.endTime}),t.startTime=i(u[e].startTime+n,0,s.duration),t.endTime=i(u[e].endTime+n,0,s.duration)}),o.show("".concat(c.get("Subtitle offset time"),": ").concat(t,"s")),r.emit("artplayerPluginSubtitleOffset",t)}else o.show("".concat(c.get("No subtitles found"))),r.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var n=t.events.proxy,r=t.template,i=t.player;function o(t){if(t){var e=r.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var n=URL.createObjectURL(t);i.switchUrl(n,t.name)}else $(!1,"Playback of this file format is not supported")}}return n(r.$player,"dragover",function(t){t.preventDefault()}),n(r.$player,"drop",function(t){t.preventDefault(),o(t.dataTransfer.files[0])}),{name:"localVideo",attach:function(t){var e=w(t,'');O(t,"position","relative"),v(e,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(e,"change",function(){o(e.files[0])})}}}function se(t){var n=t.events.proxy,c=t.subtitle;return{name:"localSubtitle",attach:function(t){var e=w(t,'');O(t,"position","relative"),v(e,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(e,"change",function(){!function(o){if(o){var a=C(o.name);if(["ass","vtt","srt"].includes(a)){var t=new FileReader;n(t,"load",function(t){var e=t.target.result;switch(a){case"srt":var n=D(R(e));c.switch(n,o.name);break;case"ass":var r=D(T(e));c.switch(r,o.name);break;case"vtt":var i=D(e);c.switch(i,o.name)}}),t.readAsText(o)}else $(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(e.files[0])})}}}function ue(e){var t=e.layers,n=e.player,r=e.option.theme;return t.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(t){e.on("controls:show",function(){t.style.display="none"}),e.on("destroy",function(){t.style.display="none"}),e.on("controls:hide",function(){t.style.display="block"}),e.on("video:timeupdate",function(){t.style.width="".concat(100*n.played,"%")})}}),{name:"miniProgressBar"}}function le(r){var i=1e4,o=0,a=0,c=0,t=null;function e(){c=a=o=0,cancelAnimationFrame(t),t=null}function n(){t||!function n(){r.isDestroy||(t=requestAnimationFrame(function(){var t=Date.now();if(c){var e=t-c;a+=e,r.player.playing||(o+=e)}c=t,r.emit("networkMonitor",o/a),i<=a&&(a=o=0),n()}))}()}return r.on("play",n),r.on("pause",e),{name:"networkMonitor",reset:e,start:n,sample:function(t){i=t}}}function fe(e){var t=e.events,n=e.player,r=e.template,i=B(function(){var t=r.$player.getBoundingClientRect();t.top+t.height<=0&&!n.pip?(n.pip=!0,e.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,e.emit("artplayerPluginAutoPip",!1))},300);return t.proxy(window,"scroll",i),{name:"autoPip"}}function pe(e){s(this,pe);var n=e.option,r=e.events.proxy,i=e.template.$video;J.video.events.forEach(function(t){r(i,t,function(t){e.emit("video:".concat(t.type),t)})}),Object.keys(n.moreVideoAttr).forEach(function(t){i[t]=n.moreVideoAttr[t]}),n.muted&&(i.muted=n.muted),n.volume&&(i.volume=N(n.volume,0,1)),n.poster&&(i.poster=n.poster),n.autoplay&&(i.autoplay=n.autoplay),i.controls=!0;var t=n.type||C(n.url),o=n.customType[t];t&&o?(e.emit("beforeCustomType",t),o(i,n.url,e),e.emit("afterCustomType",t)):(e.emit("beforeAttachUrl",n.url),i.src=n.url,e.emit("afterAttachUrl",i.src))}var de=function(){function r(t){var e=this;s(this,r),this.art=t,this.id=0;var n=t.option;n.subtitle.url&&n.subtitleOffset&&this.add(ae),!n.isLive&&n.miniProgressBar&&this.add(ue),n.localVideo&&this.add(ce),n.localSubtitle&&this.add(se),n.networkMonitor&&this.add(le),n.autoPip&&this.add(fe),t.option.plugins.forEach(function(t){e.add(t)})}return i(r,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return $(!W(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),r}(),he=0,ye=function(){function n(t){var e;return s(this,n),(e=u(this,l(n).call(this))).option=p(H(n.option,t),Z),e.isFocus=!1,e.isDestroy=!1,e.whitelist=new Y(o(e)),e.template=new G(o(e)),e.events=new Ut(o(e)),e.whitelist.state?(e.storage=new ie(o(e)),e.icons=new Nt(o(e)),e.i18n=new tt(o(e)),e.notice=new Zt(o(e)),e.player=new rt(o(e)),e.layers=new Xt(o(e)),e.controls=new Dt(o(e)),e.contextmenu=new Vt(o(e)),e.subtitle=new It(o(e)),e.info=new Bt(o(e)),e.loading=new Yt(o(e)),e.hotkey=new _t(o(e)),e.mask=new Jt(o(e)),e.setting=new re(o(e)),e.plugins=new de(o(e))):e.mobile=new pe(o(e)),he+=1,e.id=he,n.instances.push(o(e)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),e}return e(n,d),i(n,[{key:"destroy",value:function(t){var e=!(01?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function y(t,e){return t.classList.add(e)}function v(t,e){return t.classList.remove(e)}function m(t,e){return t.classList.contains(e)}function g(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function b(t,e,n){return t.style[e]=n,t}function w(t,e){return Object.keys(e).forEach((function(n){b(t,n,e[n])})),t}function O(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function j(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function P(t,e){j(t).forEach((function(t){return v(t,e)})),y(t,e)}function k(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var x=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},E=i((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&u(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),S=function(t){function n(t,r){var i;return e(this,n),i=c(this,s(n).call(this,t)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),r||i.constructor),i.name="ArtPlayerError",i}return l(n,t),n}(i((function(t){function e(n){var r="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!x(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return E(t,arguments,s(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),u(e,t)},e(n)}t.exports=e}))(Error));function $(t,e){if(!t)throw new S(e);return t}function R(t){return"WEBVTT \r\n\r\n".concat(t.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function D(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function T(t){var e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(t,e,n){if(e===n.length-1){if(1===t.length)return".".concat(t,"00");if(2===t.length)return".".concat(t,"0")}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===n.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var r=t.match(e);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(t){return t.trim()})).join("\n")}:null})).filter((function(t){return t})).map((function(t,e){return t?"".concat(e+1,"\n").concat(t.start," --\x3e ").concat(t.end,"\n").concat(t.text):""})).filter((function(t){return t.trim()})).join("\n\n"))}function C(t){return t.includes("?")?C(t.split("?")[0]):t.includes("#")?C(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function A(t,e){var n=document.createElement("a");n.style.display="none",n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function B(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var _=Object.freeze({__proto__:null,query:d,queryAll:h,addClass:y,removeClass:v,hasClass:m,append:g,remove:function(t){return t.parentNode.removeChild(t)},setStyle:b,setStyles:w,getStyle:O,sublings:j,inverseClass:P,tooltip:k,ArtPlayerError:S,errorHandle:$,srtToVtt:R,vttToBlob:D,assToVtt:T,getExt:C,downloadFile:A,hasOwnProperty:W,proxyPropertys:F,mergeDeep:H,sleep:V,debounce:B,throttle:I,clamp:N,secondToTime:U});function X(t,e,n){return $("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Y={container:X,url:"string|function",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:X,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:X,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:X,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return $(r.includes(t),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},Z={video:{propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]}},J=function t(n){var r=this;e(this,t);var i=n.constructor.kindOf,o=n.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.userAgent.indexOf(t)>-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},G=function(){function t(n){var r=this;e(this,t),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=d(n.option.container),$(this.$container,"No container element found by ".concat(n.option.container))),$(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),$(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.initDesktop():this.initMobile()}return r(t,[{key:"query",value:function(t){return d(t,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":y(this.$player,"artplayer-destroy")}}]),t}(),Q={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},tt=function(){function t(n){e(this,t),this.art=n,this.languages={"zh-cn":Q,"zh-tw":K},this.init()}return r(t,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=H(this.languages,t),this.init()}}]),t}();var et=i((function(t){ +/*! + * screenfull + * v5.0.0 - 2019-09-09 + * (c) Sindre Sorhus; MIT License + */ +!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,i=n.length,o={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.currentTime,u=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=s})),u&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}}),Object.defineProperty(e,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=0})),s&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"playbackRate",{get:function(){return i.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if($(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===i.dataset.playbackRate)return;r.playbackRate=n,i.dataset.playbackRate=n,a.show("".concat(o.get("Rate"),": ").concat(1===n?o.get("Normal"):"".concat(n,"x"))),t.emit("playbackRateChange",n)}else e.playbackRate&&(e.playbackRate=1,delete i.dataset.playbackRate,t.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{set:function(n){if(n){var r=i.dataset.playbackRate;r&&(e.playbackRate=Number(r),t.emit("playbackRateReset"))}}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"aspectRatio",{get:function(){return i.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if($(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)e.aspectRatio=!1;else{var s=n.split(":"),u=r.videoWidth,l=r.videoHeight,f=i.clientWidth,p=i.clientHeight,d=u/l,h=s[0]/s[1];if(d>h){var y=h*l/u;b(r,"width","".concat(100*y,"%")),b(r,"height","100%"),b(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;b(r,"width","100%"),b(r,"height","".concat(100*v,"%")),b(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show("".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n)),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(b(r,"width",null),b(r,"height",null),b(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),Object.defineProperty(e,"aspectRatioReset",{set:function(n){if(n&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r,t.emit("aspectRatioReset")}}})}(n,this),function(t,e){var n=t.option,r=t.notice,i=t.template.$video;Object.defineProperty(e,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),t.toDataURL("image/png")}catch(t){throw r.show(t),t}}}),Object.defineProperty(e,"getScreenshotBlobUrl",{value:function(){return new Promise((function(t,e){try{var n=document.createElement("canvas");n.width=i.videoWidth,n.height=i.videoHeight,n.getContext("2d").drawImage(i,0,0),n.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show(t),e(t)}}))}}),Object.defineProperty(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(A(r,"".concat(n.title||"artplayer","_").concat(U(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.i18n,r=t.notice,i=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreen:change",et.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(et.on("change",a),et.on("error",c),i.push((function(){et.off("change",a),et.off("error",c)}))),Object.defineProperty(e,"fullscreen",{get:function(){return et.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),et.request(o).then((function(){y(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:enabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),et.exit().then((function(){v(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),Object.defineProperty(e,"fullscreenIsEnabled",{get:function(){return et.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWeb",{get:function(){return m(n,"artplayer-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),y(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:enabled")):(e.fullscreen&&(e.fullscreen=!1),v(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:exit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),nt(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(n,this),function(t,e){var n=t.template,r=n.$container,i=n.$player,o=n.$video;Object.defineProperty(e,"autoSize",{get:function(){return m(r,"artplayer-auto-size")},set:function(e){if(e){var n=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,u=c.height,l=n/a,f=s/u;if(y(r,"artplayer-auto-size"),f>l){b(i,"width","".concat(u*l/s*100,"%")),b(i,"height","100%")}else{var p=s/l/u*100;b(i,"width","100%"),b(i,"height","".concat(p,"%"))}t.emit("autoSizeChange")}else v(r,"artplayer-auto-size"),b(i,"width",null),b(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})})),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){Object.defineProperty(e,"flip",{get:function(){return t.template.$player.dataset.flip},set:function(e){if(e){var n=["normal","horizontal","vertical"];$(n.includes(e),"'flip' only accept ".concat(n.toString()," as parameters")),t.template.$player.dataset.flip=e,t.emit("flipChange",e)}else delete t.template.$player.dataset.flip,t.emit("flipRemove")}})}(n,this),F(n,this)};function it(t,e,n,r,i,o){var a="function"==typeof r?r(t):r;if(a.disable)return{};var c=e.id,s=a.name||"".concat(o).concat(c);$(!W(e,s),"Cannot create a component that already has the same name: ".concat(o," -> ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&g(u,a.html),a.style&&w(u,a.style),a.tooltip&&k(u,a.tooltip);var l=Array.from(n.children);u.dataset.index=a.index||c;var f=l.find((function(t){return Number(t.dataset.index)>=Number(u.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",u):g(n,u),a.click&&t.events.proxy(u,"click",(function(n){n.preventDefault(),a.click.call(t,e,n),t.emit("".concat(o,":click"),u)})),a.mounted&&a.mounted(u,e,t),i&&i(u,e,t),Object.defineProperty(e,s,{value:{get id(){return c},get $ref(){return u},set show(e){e?(b(u,"display","block"),t.emit("".concat(o,":show"),u)):(b(u,"display","none"),t.emit("".concat(o,":hide"),u))}}}),t.emit("".concat(o,":add"),a),e[s]}function ot(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function at(e){return function(n){return function(e){for(var n=1;n\n
\n
\n
\n
\n
\n \n '),mounted:function(t){var e=!1,r=d(".art-progress-loaded",t),o=d(".art-progress-played",t),s=d(".art-progress-highlight",t),u=d(".art-progress-indicator",t),l=d(".art-progress-tip",t);function f(t,e){"loaded"===t&&b(r,"width","".concat(100*e,"%")),"played"===t&&(b(o,"width","".concat(100*e,"%")),b(u,"left","calc(".concat(100*e,"% - ").concat(O(u,"width")/2,"px)")))}i.forEach((function(t){var e=N(t.time,0,c.duration)/c.duration*100;g(s,''))})),f("loaded",c.loaded),n.on("video:progress",(function(){f("loaded",c.loaded)})),n.on("video:timeupdate",(function(){f("played",c.played)})),n.on("video:ended",(function(){f("played",1)})),a(t,"mousemove",(function(e){b(l,"display","block"),e.composedPath().indexOf(s)>-1?function(e){var r=ht(n,e).width,i=e.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?b(l,"left",0):r>t.clientWidth-o/2?b(l,"left","".concat(t.clientWidth-o,"px")):b(l,"left","".concat(r-o/2,"px"))}(e):function(e){var r=ht(n,e),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?b(l,"left",0):i>t.clientWidth-a/2?b(l,"left","".concat(t.clientWidth-a,"px")):b(l,"left","".concat(i-a/2,"px"))}(e)})),a(t,"mouseout",(function(){b(l,"display","none")})),a(t,"click",(function(t){if(t.target!==u){var e=ht(n,t),r=e.second;f("played",e.percentage),c.seek=r}})),a(u,"mousedown",(function(){e=!0})),a(document,"mousemove",(function(t){if(e){var r=ht(n,t),i=r.second,o=r.percentage;y(u,"art-show-indicator"),f("played",o),c.seek=i}})),a(document,"mouseup",(function(){e&&(e=!1,v(u,"art-show-indicator"))}))}})}}function vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function mt(e){return function(n){return function(e){for(var n=1;n'),l=g(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return N(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)b(c,"display","none"),b(s,"display","flex"),b(l,"left","0");else{var e=((O(u,"width")||60)-O(l,"width"))*t;b(c,"display","flex"),b(s,"display","none"),b(l,"left","".concat(e,"px"))}}k(c,o.get("Mute")),b(s,"display","none"),p(i.volume),n.on("video:volumechange",(function(){p(i.volume)})),e(c,"click",(function(){i.muted=!0})),e(s,"click",(function(){i.muted=!1})),e(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),e(l,"mousedown",(function(){a=!0})),e(l,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),e(document,"mouseup",(function(){a&&(a=!1)}))}})}}function jt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Pt(e){return function(n){return function(e){for(var n=1;nr.clientWidth-s/2?b(t,"left","".concat(r.clientWidth-s,"px")):b(t,"left","".concat(o-s/2,"px"))}(i))})),o(r,"mouseout",(function(){b(t,"display","none")}))}})}}function Et(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function St(e){return function(n){return function(e){for(var n=1;n'.concat(s.name,"")),l=e.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=g(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(O(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var n=Number(t.target.dataset.index),r=e[n],i=r.url,o=r.name;i&&o&&c!==n&&(a.switchQuality(i,o),u.innerHTML=o,c=n)}))}})}}var Dt=function(){function t(n){var r=this;e(this,t),this.id=0,this.art=n,this.art.on("ready",(function(){r.init()}))}return r(t,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(yt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach((function(e){t.add(e)}))}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,$(r.position,"Controls option.position can not be empty");var s=it(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||y(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,v(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),t}();function Tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ct(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n0.5\n 0.75\n ').concat(r.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(i.playbackRate=Number(n),t.show=!1)},mounted:function(t){n.on("playbackRateChange",(function(e){var n=h("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&P(n,"current")}))}})}}function At(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Lt(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n').concat(r.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(i.aspectRatio=n,t.show=!1)},mounted:function(t){n.on("aspectRatioChange",(function(e){var n=h("span",t).find((function(t){return t.dataset.ratio===e}));n&&P(n,"current")}))}})}}function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function zt(e){return function(n){return function(e){for(var n=1;nArtPlayer 3.1.18'})}function Ft(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ht(e){return function(n){return function(e){for(var n=1;nu+s&&(h=s-d),o+p>l+c&&(y=c-p),b(r,"left","".concat(h,"px")),b(r,"top","".concat(y,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,v(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),t}(),Bt=function(){function t(n){var r=this;e(this,t),this.art=n,this.timer=null;var i=n.template,o=i.$infoPanel,a=i.$infoClose,c=n.events.proxy;this.types=h("[data-video]",o),c(a,"click",(function(){r.show=!1})),this.art.on("destroy",(function(){clearTimeout(r.timer)}))}return r(t,[{key:"readInfo",value:function(){var t=this.art.template.$video;this.types.forEach((function(e){var n=t[e.dataset.video];e.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout((function(){t.readInfo(),t.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,v(e,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),t}(),It=function(){function t(n){e(this,t),this.art=n,this.state=!0;var r=n.events.proxy,i=n.option.subtitle;w(n.template.$subtitle,i.style),r(this.textTrack,"cuechange",this.update.bind(this)),i.url&&this.init(i.url)}return r(t,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return o.show("".concat(i.get("Switch subtitle"),": ").concat(n)),e.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t){var e=this,n=this.art,r=n.notice,i=n.template,o=i.$subtitle,a=i.$track;return fetch(t).then((function(t){return t.text()})).then((function(e){switch(C(t)){case"srt":return D(R(e));case"ass":return D(T(e));case"vtt":return D(e);default:return t}})).then((function(t){return o.innerHTML="",e.url===t?t:(URL.revokeObjectURL(e.url),a.src=t,t)})).catch((function(t){throw r.show(t),t}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,v(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,y(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),t}();var Nt=function(){function t(n){var r=this;e(this,t),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),n.whitelist.state&&n.once("video:canplay",(function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){e.composedPath().indexOf(n)>-1?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){y(n,"artplayer-hover"),t.emit("hoverenter")}),(function(){v(n,"artplayer-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=B((function(){y(r,"artplayer-hide-cursor"),v(r,"artplayer-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),v(r,"artplayer-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a()}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=I((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(t.player.fullscreen||t.player.fullscreenWeb||t.player.pip?t.player.autoSize=!1:t.player.autoSize=!0),t.player.aspectRatioReset=!0,t.emit("resize",{width:r.width,height:r.height}))}),500);e.proxy(o,"load",(function(){e.proxy(o.contentDocument.defaultView,"resize",s)})),i.appendChild(o)}(n,r)}))}return r(t,[{key:"proxy",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(e)?e.forEach((function(e){return r.proxy(t,e,n,i)})):(t.addEventListener(e,n,i),this.destroyEvents.push((function(){t.removeEventListener(e,n,i)})))}},{key:"hover",value:function(t,e,n){e&&this.proxy(t,"mouseenter",e),n&&this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(n,r){var i;if(t instanceof HTMLImageElement)i=t;else{if("string"!=typeof t)return r(t);(i=new Image).src=t}return i.complete?n(i):(e.proxy(i,"load",(function(){return n(i)})),e.proxy(i,"error",(function(){return r(i)})),t)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),t}(),Ut=function(){function t(n){var r=this;e(this,t),this.art=n,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){r.add(27,(function(){n.player.fullscreenWeb&&(n.player.fullscreenWeb=!1)})),r.add(32,(function(){n.player.toggle=!0})),r.add(37,(function(){n.player.seek=n.player.currentTime-5})),r.add(38,(function(){n.player.volume+=.1})),r.add(39,(function(){n.player.seek=n.player.currentTime+5})),r.add(40,(function(){n.player.volume-=.1})),r.init()}))}return r(t,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var t=this;(0,this.art.events.proxy)(window,"keydown",(function(e){if(t.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var i=t.keys[e.keyCode];i&&(e.preventDefault(),i.forEach((function(t){return t()})),t.art.emit("hotkey",e))}}}))}}]),t}(),_t=function(){function t(n){var r=this;e(this,t),this.id=0,this.art=n,this.add=this.add.bind(this),this.art.on("ready",(function(){r.art.option.layers.forEach((function(t){r.add(t)}))}))}return r(t,[{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$layers;return it(this.art,this,n,t,e,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,v(e,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,y(e,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),t}(),Xt=function(){function t(n){e(this,t),this.art=n,g(n.template.$loading,n.icons.loading)}return r(t,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,v(e,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),t}(),Yt=function(){function t(n){e(this,t),this.art=n,this.timer=null}return r(t,[{key:"show",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=this.art.template,o=i.$player,a=i.$noticeInner;this.state=!0,y(o,"artplayer-notice-show"),a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,v(t,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),t}(),Zt=function(){function t(n){e(this,t),this.art=n,g(n.template.$state,n.icons.state)}return r(t,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,v(e,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),t}(),Jt=function t(n){var r=this;e(this,t);var i=Object.assign({loading:'\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},n.option.icons);Object.keys(i).forEach((function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),g(e,i[t]),r[t]=e}))};function Gt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Qt(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n'.concat(r.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(t,e){var n=e.target.dataset.value;n&&(i.flip=n)},mounted:function(t){n.on("flipChange",(function(e){var n=h("button",t).find((function(t){return t.dataset.value===e}));n&&P(n.parentElement,"current")}))}})}}function Kt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function te(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n'.concat(r.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(t,e){var n=e.target.dataset.value;n&&(i.aspectRatio=n)},mounted:function(t){n.on("aspectRatioChange",(function(e){var n=h("button",t).find((function(t){return t.dataset.value===e}));n&&P(n.parentElement,"current")}))}})}}function ee(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ne(e){return function(n){var r=n.i18n,i=n.player,o=n.events.proxy;return function(e){for(var n=1;n\n '.concat(r.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(t){var e=d(".art-setting-range input",t),r=d(".art-subtitle-value",t);o(e,"change",(function(){var t=e.value;r.innerText=t,i.playbackRate=Number(t)})),n.on("playbackRateChange",(function(t){e.value!==t&&(e.value=t,r.innerText=t)}))}})}}var re=function(){function t(n){var r=this;e(this,t),this.id=0,this.art=n,this.state=!1,n.option.setting&&(this.art.on("ready",(function(){r.init()})),this.art.on("blur",(function(){r.show=!1})))}return r(t,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",(function(e){e.target===r&&(t.show=!1)})),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return it(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,v(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),t}(),ie=function(){function n(t){e(this,n),this.art=t,this.name="artplayer_settings";var r=t.option,i=this.get("volume");i&&(r.volume=i)}return r(n,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(e,n){var r=Object.assign({},this.get(),t({},e,n));window.localStorage.setItem(this.name,JSON.stringify(r))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),n}();function oe(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(e){var i=d(".art-setting-range input",e),o=d(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("artplayerPluginSubtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function ae(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;o.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(oe);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show("".concat(o.get("Subtitle offset time"),": ").concat(n,"s")),t.emit("artplayerPluginSubtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var e=t.events.proxy,n=t.template,r=t.player;function i(t){if(t){var e=n.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var i=URL.createObjectURL(t);r.switchUrl(i,t.name)}else $(!1,"Playback of this file format is not supported")}}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),i(t.dataTransfer.files[0])})),{name:"localVideo",attach:function(t){var n=g(t,'');b(t,"position","relative"),w(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){i(n.files[0])}))}}}function se(t){var e=t.events.proxy,n=t.subtitle;return{name:"localSubtitle",attach:function(t){var r=g(t,'');b(t,"position","relative"),w(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){!function(t){if(t){var r=C(t.name);if(["ass","vtt","srt"].includes(r)){var i=new FileReader;e(i,"load",(function(e){var i=e.target.result;switch(r){case"srt":var o=D(R(i));n.switch(o,t.name);break;case"ass":var a=D(T(i));n.switch(a,t.name);break;case"vtt":var c=D(i);n.switch(c,t.name)}})),i.readAsText(t)}else $(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function ue(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("controls:show",(function(){e.style.display="none"})),t.on("destroy",(function(){e.style.display="none"})),t.on("controls:hide",(function(){e.style.display="block"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function le(t){var e=1e4,n=0,r=0,i=0,o=null;function a(){n=0,r=0,i=0,cancelAnimationFrame(o),o=null}function c(){o||function a(){t.isDestroy||(o=requestAnimationFrame((function(){var o=Date.now();if(i){var c=o-i;r+=c,t.player.playing||(n+=c)}i=o,t.emit("networkMonitor",n/r),r>=e&&(n=0,r=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}function fe(t){var e=t.events,n=t.player,r=t.template,i=B((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var pe=function(){function t(n){var r=this;e(this,t),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(ae),!i.isLive&&i.miniProgressBar&&this.add(ue),i.localVideo&&this.add(ce),i.localSubtitle&&this.add(se),i.networkMonitor&&this.add(le),i.autoPip&&this.add(fe),n.option.plugins.forEach((function(t){r.add(t)}))}return r(t,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return $(!W(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),t}(),de=function t(n){e(this,t);var r=n.option,i=n.events.proxy,o=n.template.$video;Z.video.events.forEach((function(t){i(o,t,(function(t){n.emit("video:".concat(t.type),t)}))})),Object.keys(r.moreVideoAttr).forEach((function(t){o[t]=r.moreVideoAttr[t]})),r.muted&&(o.muted=r.muted),r.volume&&(o.volume=N(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||C(r.url),c=r.customType[a];a&&c?(n.emit("beforeCustomType",a),c(o,r.url,n),n.emit("afterCustomType",a)):(n.emit("beforeAttachUrl",r.url),o.src=r.url,n.emit("afterAttachUrl",o.src))},he=0,ye=function(t){function n(t){var r;return e(this,n),(r=c(this,s(n).call(this))).option=f(H(n.option,t),Y),r.isFocus=!1,r.isDestroy=!1,r.whitelist=new J(a(r)),r.template=new G(a(r)),r.events=new Nt(a(r)),r.whitelist.state?(r.storage=new ie(a(r)),r.icons=new Jt(a(r)),r.i18n=new tt(a(r)),r.notice=new Yt(a(r)),r.player=new rt(a(r)),r.layers=new _t(a(r)),r.controls=new Dt(a(r)),r.contextmenu=new Vt(a(r)),r.subtitle=new It(a(r)),r.info=new Bt(a(r)),r.loading=new Xt(a(r)),r.hotkey=new Ut(a(r)),r.mask=new Zt(a(r)),r.setting=new re(a(r)),r.plugins=new pe(a(r))):r.mobile=new de(a(r)),he+=1,r.id=he,n.instances.push(a(r)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),r}return l(n,t),r(n,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),n.instances.splice(n.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Z}},{key:"utils",get:function(){return _}},{key:"scheme",get:function(){return Y}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return f}},{key:"kindOf",get:function(){return f.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),n}(p);function ve(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}return Object.defineProperty(ye,"instances",{value:[]}),{data:function(){return{instance:null}},props:{option:{type:Object,required:!0},getInstance:Function},mounted:function(){this.instance=new ye(function(e){for(var n=1;n").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function R(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function D(t){var n=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(t){return(0\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n \n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":m(this.$player,"artplayer-destroy")}}]),n}(),G={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Q={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K=function(){function e(t){c(this,e),this.art=t,this.languages={"zh-cn":G,"zh-tw":Q},this.init()}return i(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=F(this.languages,t),this.init()}}]),e}();var tt=t(function(t){var o,e,i,r,n;o="undefined"!=typeof window&&void 0!==window.document?window.document:{},e=t.exports,i=function(){for(var t,e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=e.length,i={};n ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&w(u,a.html),a.style&&y(u,a.style),a.tooltip&&P(u,a.tooltip);var l=Array.from(t.children);u.dataset.index=a.index||c;var f=l.find(function(t){return Number(t.dataset.index)>=Number(u.dataset.index)});return f?f.insertAdjacentElement("beforebegin",u):w(t,u),a.click&&e.events.proxy(u,"click",function(t){t.preventDefault(),a.click.call(e,n,t),e.emit("".concat(o,":click"),u)}),a.mounted&&a.mounted(u,n,e),i&&i(u,n,e),Object.defineProperty(n,s,{value:{get id(){return c},get $ref(){return u},set show(t){t?(O(u,"display","block"),e.emit("".concat(o,":show"),u)):(O(u,"display","none"),e.emit("".concat(o,":hide"),u))}}}),e.emit("".concat(o,":add"),a),n[s]}var it=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(t){return function(a){return function(e){for(var t=1;t\n
\n
\n
\n
\n
\n \n '),mounted:function(o){var i=!1,n=d(".art-progress-loaded",o),r=d(".art-progress-played",o),a=d(".art-progress-highlight",o),c=d(".art-progress-indicator",o),s=d(".art-progress-tip",o);function u(t,e){"loaded"===t&&O(n,"width","".concat(100*e,"%")),"played"===t&&(O(r,"width","".concat(100*e,"%")),O(c,"left","calc(".concat(100*e,"% - ").concat(v(c,"width")/2,"px)")))}e.forEach(function(t){var e=I(t.time,0,p.duration)/p.duration*100;w(a,''))}),u("loaded",p.loaded),l.on("video:progress",function(){u("loaded",p.loaded)}),l.on("video:timeupdate",function(){u("played",p.played)}),l.on("video:ended",function(){u("played",1)}),f(o,"mousemove",function(t){O(s,"display","block"),-1o.clientWidth-r/2?O(s,"left","".concat(o.clientWidth-r,"px")):O(s,"left","".concat(e-r/2,"px"))}(t):function(t){var e=ht(l,t),n=e.width,r=e.time;s.innerHTML=r;var i=s.clientWidth;n<=i/2?O(s,"left",0):n>o.clientWidth-i/2?O(s,"left","".concat(o.clientWidth-i,"px")):O(s,"left","".concat(n-i/2,"px"))}(t)}),f(o,"mouseout",function(){O(s,"display","none")}),f(o,"click",function(t){if(t.target!==c){var e=ht(l,t),n=e.second;u("played",e.percentage),p.seek=n}}),f(c,"mousedown",function(){i=!0}),f(document,"mousemove",function(t){if(i){var e=ht(l,t),n=e.second,r=e.percentage;m(c,"art-show-indicator"),u("played",r),p.seek=n}}),f(document,"mouseup",function(){i&&(i=!1,g(c,"art-show-indicator"))})}})}}function vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mt(t){return function(a){return function(e){for(var t=1;t'),u=w(s,'
');function l(t){var e=s.getBoundingClientRect(),n=e.left,r=e.width,i=u.getBoundingClientRect().width;return I(t.pageX-n-i/2,0,r-i/2)/(r-i)}function f(t){var e=0d.clientWidth-i/2?O(f,"left","".concat(d.clientWidth-i,"px")):O(f,"left","".concat(e-i/2,"px"))}(t))}),e(d,"mouseout",function(){O(f,"display","none")})}})}}function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function St(t){return function(a){return function(e){for(var t=1;t'.concat(i.name,"")),u=o.map(function(t,e){return'
').concat(t.name,"
")}).join(""),l=w(t,'
'.concat(u,"
"));r(t,function(){l.style.left="-".concat(v(l,"width")/2-t.clientWidth/2,"px")}),n(l,"click",function(t){var e=Number(t.target.dataset.index),n=o[e],r=n.url,i=n.name;r&&i&&c!==e&&(a.switchQuality(r,i),s.innerHTML=i,c=e)})}})}}var Dt=function(){function n(t){var e=this;c(this,n),this.id=0,this.art=t,this.art.on("ready",function(){e.init()})}return i(n,[{key:"init",value:function(){var e=this,t=this.art.option;this.add(yt({name:"progress",disable:t.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!t.thumbnails.url||t.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:t.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===t.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!t.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!t.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!t.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!t.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!t.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!t.fullscreen,position:"right",index:70})),t.controls.forEach(function(t){e.add(t)})}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,S(r.position,"Controls option.position can not be empty");var s=rt(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||m(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,g(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),n}();function Tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ct(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t0.5\n 0.75\n ').concat(e.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(n){t.on("playbackRateChange",function(e){var t=h("span",n).find(function(t){return Number(t.dataset.rate)===e});t&&j(t,"current")})}})}}function At(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lt(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t').concat(e.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(n){t.on("aspectRatioChange",function(e){var t=h("span",n).find(function(t){return t.dataset.ratio===e});t&&j(t,"current")})}})}}function Mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zt(t){return function(e){return function(e){for(var t=1;tArtPlayer 3.1.18'})}function Ft(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ht(e){return function(t){return function(e){for(var t=1;t".concat(t,"

")}).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t,e){var n=this,r=1\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},t.option.icons);Object.keys(r).forEach(function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),w(e,r[t]),n[t]=e})}var Ut=function(){function n(t){var e=this;c(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),t.whitelist.state&&t.once("video:canplay",function(){!function(e,t){var n=e.template.$player;t.proxy(document,["click","contextmenu"],function(t){-1'.concat(e.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(n){t.on("flipChange",function(e){var t=h("button",n).find(function(t){return t.dataset.value===e});t&&j(t.parentElement,"current")})}})}}function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function te(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t'.concat(e.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(n){t.on("aspectRatioChange",function(e){var t=h("button",n).find(function(t){return t.dataset.value===e});t&&j(t.parentElement,"current")})}})}}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){return function(r){var t=r.i18n,i=r.player,o=r.events.proxy;return function(e){for(var t=1;t\n '.concat(t.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(t){var e=d(".art-setting-range input",t),n=d(".art-subtitle-value",t);o(e,"change",function(){var t=e.value;n.innerText=t,i.playbackRate=Number(t)}),r.on("playbackRateChange",function(t){e.value!==t&&(e.value=t,n.innerText=t)})}})}}var re=function(){function n(t){var e=this;c(this,n),this.id=0,this.art=t,this.state=!1,t.option.setting&&(this.art.on("ready",function(){e.init()}),this.art.on("blur",function(){e.show=!1}))}return i(n,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,r=t.template.$setting;(0,t.events.proxy)(r,"click",function(t){t.target===r&&(e.show=!1)}),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return rt(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,g(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),n}(),ie=function(){function r(t){c(this,r),this.art=t,this.name="artplayer_settings";var e=t.option,n=this.get("volume");n&&(e.volume=n)}return i(r,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),it({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),r}();function oe(r){var t=r.i18n,i=r.subtitle,o=r.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(t.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(t){var e=d(".art-setting-range input",t),n=d(".art-subtitle-value",t);o(e,"change",function(){var t=e.value;n.innerText=t,r.plugins.subtitleOffset.offset(Number(t))}),r.on("subtitle:switch",function(){e.value=0,n.innerText=0}),r.on("artplayerPluginSubtitleOffset",function(t){i.update(),e.value!==t&&(e.value=t,n.innerText=t)})}}}function ae(r){var i=r.constructor.utils.clamp,t=r.setting,o=r.notice,a=r.template,c=r.i18n,s=r.player;c.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),t.add(oe);var u=[];return r.on("subtitle:switch",function(){u=[]}),{name:"subtitleOffset",offset:function(t){if(a.$track&&a.$track.track){var e=Array.from(a.$track.track.cues),n=i(t,-5,5);e.forEach(function(t,e){u[e]||(u[e]={startTime:t.startTime,endTime:t.endTime}),t.startTime=i(u[e].startTime+n,0,s.duration),t.endTime=i(u[e].endTime+n,0,s.duration)}),o.show("".concat(c.get("Subtitle offset time"),": ").concat(t,"s")),r.emit("artplayerPluginSubtitleOffset",t)}else o.show("".concat(c.get("No subtitles found"))),r.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var n=t.events.proxy,r=t.template,i=t.player;function o(t){if(t){var e=r.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var n=URL.createObjectURL(t);i.switchUrl(n,t.name)}else S(!1,"Playback of this file format is not supported")}}return n(r.$player,"dragover",function(t){t.preventDefault()}),n(r.$player,"drop",function(t){t.preventDefault(),o(t.dataTransfer.files[0])}),{name:"localVideo",attach:function(t){var e=w(t,'');O(t,"position","relative"),y(e,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(e,"change",function(){o(e.files[0])})}}}function se(t){var n=t.events.proxy,c=t.subtitle;return{name:"localSubtitle",attach:function(t){var e=w(t,'');O(t,"position","relative"),y(e,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(e,"change",function(){!function(o){if(o){var a=T(o.name);if(["ass","vtt","srt"].includes(a)){var t=new FileReader;n(t,"load",function(t){var e=t.target.result;switch(a){case"srt":var n=R($(e));c.switch(n,o.name);break;case"ass":var r=R(D(e));c.switch(r,o.name);break;case"vtt":var i=R(e);c.switch(i,o.name)}}),t.readAsText(o)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(e.files[0])})}}}function ue(e){var t=e.layers,n=e.player,r=e.option.theme;return t.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(t){e.on("controls:show",function(){t.style.display="none"}),e.on("destroy",function(){t.style.display="none"}),e.on("controls:hide",function(){t.style.display="block"}),e.on("video:timeupdate",function(){t.style.width="".concat(100*n.played,"%")})}}),{name:"miniProgressBar"}}function le(r){var i=1e4,o=0,a=0,c=0,t=null;function e(){c=a=o=0,cancelAnimationFrame(t),t=null}function n(){t||!function n(){r.isDestroy||(t=requestAnimationFrame(function(){var t=Date.now();if(c){var e=t-c;a+=e,r.player.playing||(o+=e)}c=t,r.emit("networkMonitor",o/a),i<=a&&(a=o=0),n()}))}()}return r.on("play",n),r.on("pause",e),{name:"networkMonitor",reset:e,start:n,sample:function(t){i=t}}}function fe(e){var t=e.events,n=e.player,r=e.template,i=V(function(){var t=r.$player.getBoundingClientRect();t.top+t.height<=0&&!n.pip?(n.pip=!0,e.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,e.emit("artplayerPluginAutoPip",!1))},300);return t.proxy(window,"scroll",i),{name:"autoPip"}}function pe(e){c(this,pe);var n=e.option,r=e.events.proxy,i=e.template.$video;Z.video.events.forEach(function(t){r(i,t,function(t){e.emit("video:".concat(t.type),t)})}),Object.keys(n.moreVideoAttr).forEach(function(t){i[t]=n.moreVideoAttr[t]}),n.muted&&(i.muted=n.muted),n.volume&&(i.volume=I(n.volume,0,1)),n.poster&&(i.poster=n.poster),n.autoplay&&(i.autoplay=n.autoplay),i.controls=!0;var t=n.type||T(n.url),o=n.customType[t];t&&o?(e.emit("beforeCustomType",t),o(i,n.url,e),e.emit("afterCustomType",t)):(e.emit("beforeAttachUrl",n.url),i.src=n.url,e.emit("afterAttachUrl",i.src))}var de=function(){function r(t){var e=this;c(this,r),this.art=t,this.id=0;var n=t.option;n.subtitle.url&&n.subtitleOffset&&this.add(ae),!n.isLive&&n.miniProgressBar&&this.add(ue),n.localVideo&&this.add(ce),n.localSubtitle&&this.add(se),n.networkMonitor&&this.add(le),n.autoPip&&this.add(fe),t.option.plugins.forEach(function(t){e.add(t)})}return i(r,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return S(!q(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),r}(),he=0,ye=function(){function n(t){var e;return c(this,n),(e=s(this,u(n).call(this))).option=f(F(n.option,t),Y),e.isFocus=!1,e.isDestroy=!1,e.whitelist=new X(o(e)),e.template=new J(o(e)),e.events=new Ut(o(e)),e.whitelist.state?(e.storage=new ie(o(e)),e.icons=new Nt(o(e)),e.i18n=new K(o(e)),e.notice=new Zt(o(e)),e.player=new nt(o(e)),e.layers=new Xt(o(e)),e.controls=new Dt(o(e)),e.contextmenu=new Vt(o(e)),e.subtitle=new It(o(e)),e.info=new Bt(o(e)),e.loading=new Yt(o(e)),e.hotkey=new _t(o(e)),e.mask=new Jt(o(e)),e.setting=new re(o(e)),e.plugins=new de(o(e))):e.mobile=new pe(o(e)),he+=1,e.id=he,n.instances.push(o(e)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),e}return e(n,p),i(n,[{key:"destroy",value:function(t){var e=!(01?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function j(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function P(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var k=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},x=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&s(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),E=function(e){function n(e,r){var i;return t(this,n),i=a(this,c(n).call(this,e)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),r||i.constructor),i.name="ArtPlayerError",i}return u(n,e),n}(r((function(t){function e(n){var r="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!k(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return x(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s(e,t)},e(n)}t.exports=e}))(Error));function S(t,e){if(!t)throw new E(e);return t}function $(t){return"WEBVTT \r\n\r\n".concat(t.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function R(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function T(t){var e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(t,e,n){if(e===n.length-1){if(1===t.length)return".".concat(t,"00");if(2===t.length)return".".concat(t,"0")}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===n.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var r=t.match(e);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(t){return t.trim()})).join("\n")}:null})).filter((function(t){return t})).map((function(t,e){return t?"".concat(e+1,"\n").concat(t.start," --\x3e ").concat(t.end,"\n").concat(t.text):""})).filter((function(t){return t.trim()})).join("\n\n"))}function D(t){return t.includes("?")?D(t.split("?")[0]):t.includes("#")?D(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function C(t,e){var n=document.createElement("a");n.style.display="none",n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var A=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function V(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var U=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:j,tooltip:P,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,hasOwnProperty:q,proxyPropertys:W,mergeDeep:F,sleep:H,debounce:V,throttle:B,clamp:I,secondToTime:N});function _(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var X={container:_,url:"string|function",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return S(r.includes(t),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},Y={video:{propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]}},Z=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.userAgent.indexOf(t)>-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},J=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),S(this.$container,"No container element found by ".concat(n.option.container))),S(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),S(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.initDesktop():this.initMobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"artplayer-destroy")}}]),e}(),G={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Q={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":G,"zh-tw":Q},this.init()}return n(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=F(this.languages,t),this.init()}}]),e}();var tt=r((function(t){ +/*! + * screenfull + * v5.0.0 - 2019-09-09 + * (c) Sindre Sorhus; MIT License + */ +!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,i=n.length,o={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.currentTime,u=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=s})),u&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}}),Object.defineProperty(e,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=0})),s&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"playbackRate",{get:function(){return i.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if(S(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===i.dataset.playbackRate)return;r.playbackRate=n,i.dataset.playbackRate=n,a.show("".concat(o.get("Rate"),": ").concat(1===n?o.get("Normal"):"".concat(n,"x"))),t.emit("playbackRateChange",n)}else e.playbackRate&&(e.playbackRate=1,delete i.dataset.playbackRate,t.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{set:function(n){if(n){var r=i.dataset.playbackRate;r&&(e.playbackRate=Number(r),t.emit("playbackRateReset"))}}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"aspectRatio",{get:function(){return i.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if(S(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)e.aspectRatio=!1;else{var s=n.split(":"),u=r.videoWidth,l=r.videoHeight,f=i.clientWidth,p=i.clientHeight,d=u/l,h=s[0]/s[1];if(d>h){var y=h*l/u;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show("".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n)),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),Object.defineProperty(e,"aspectRatioReset",{set:function(n){if(n&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r,t.emit("aspectRatioReset")}}})}(n,this),function(t,e){var n=t.option,r=t.notice,i=t.template.$video;Object.defineProperty(e,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),t.toDataURL("image/png")}catch(t){throw r.show(t),t}}}),Object.defineProperty(e,"getScreenshotBlobUrl",{value:function(){return new Promise((function(t,e){try{var n=document.createElement("canvas");n.width=i.videoWidth,n.height=i.videoHeight,n.getContext("2d").drawImage(i,0,0),n.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show(t),e(t)}}))}}),Object.defineProperty(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(N(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.i18n,r=t.notice,i=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreen:change",tt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(tt.on("change",a),tt.on("error",c),i.push((function(){tt.off("change",a),tt.off("error",c)}))),Object.defineProperty(e,"fullscreen",{get:function(){return tt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.request(o).then((function(){h(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:enabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.exit().then((function(){y(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),Object.defineProperty(e,"fullscreenIsEnabled",{get:function(){return tt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWeb",{get:function(){return v(n,"artplayer-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:enabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:exit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),et(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(n,this),function(t,e){var n=t.template,r=n.$container,i=n.$player,o=n.$video;Object.defineProperty(e,"autoSize",{get:function(){return v(r,"artplayer-auto-size")},set:function(e){if(e){var n=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,u=c.height,l=n/a,f=s/u;if(h(r,"artplayer-auto-size"),f>l){g(i,"width","".concat(u*l/s*100,"%")),g(i,"height","100%")}else{var p=s/l/u*100;g(i,"width","100%"),g(i,"height","".concat(p,"%"))}t.emit("autoSizeChange")}else y(r,"artplayer-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})})),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){Object.defineProperty(e,"flip",{get:function(){return t.template.$player.dataset.flip},set:function(e){if(e){var n=["normal","horizontal","vertical"];S(n.includes(e),"'flip' only accept ".concat(n.toString()," as parameters")),t.template.$player.dataset.flip=e,t.emit("flipChange",e)}else delete t.template.$player.dataset.flip,t.emit("flipRemove")}})}(n,this),W(n,this)};function rt(t,e,n,r,i,o){var a="function"==typeof r?r(t):r;if(a.disable)return{};var c=e.id,s=a.name||"".concat(o).concat(c);S(!q(e,s),"Cannot create a component that already has the same name: ".concat(o," -> ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&m(u,a.html),a.style&&b(u,a.style),a.tooltip&&P(u,a.tooltip);var l=Array.from(n.children);u.dataset.index=a.index||c;var f=l.find((function(t){return Number(t.dataset.index)>=Number(u.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",u):m(n,u),a.click&&t.events.proxy(u,"click",(function(n){n.preventDefault(),a.click.call(t,e,n),t.emit("".concat(o,":click"),u)})),a.mounted&&a.mounted(u,e,t),i&&i(u,e,t),Object.defineProperty(e,s,{value:{get id(){return c},get $ref(){return u},set show(e){e?(g(u,"display","block"),t.emit("".concat(o,":show"),u)):(g(u,"display","none"),t.emit("".concat(o,":hide"),u))}}}),t.emit("".concat(o,":add"),a),e[s]}var it=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ot(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function at(t){return function(e){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),s=p(".art-progress-highlight",t),u=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(u,"left","calc(".concat(100*e,"% - ").concat(w(u,"width")/2,"px)")))}r.forEach((function(t){var e=I(t.time,0,a.duration)/a.duration*100;m(s,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(s)>-1?function(n){var r=ht(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=ht(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==u){var n=ht(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(u,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=ht(e,t),i=r.second,o=r.percentage;h(u,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(u,"art-show-indicator"))}))}})}}function vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function mt(t){return function(e){return function(t){for(var e=1;e'),l=m(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return I(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(s,"display","flex"),g(l,"left","0");else{var e=((w(u,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(s,"display","none"),g(l,"left","".concat(e,"px"))}}P(c,o.get("Mute")),g(s,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(s,"click",(function(){i.muted=!1})),n(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(l,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function jt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Pt(t){return function(e){return function(t){for(var e=1;er.clientWidth-s/2?g(t,"left","".concat(r.clientWidth-s,"px")):g(t,"left","".concat(o-s/2,"px"))}(i))})),o(r,"mouseout",(function(){g(t,"display","none")}))}})}}function Et(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function St(t){return function(e){return function(t){for(var e=1;e'.concat(s.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),u.innerHTML=o,c=e)}))}})}}var Tt=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.art.on("ready",(function(){r.init()}))}return n(e,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(yt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach((function(e){t.add(e)}))}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,S(r.position,"Controls option.position can not be empty");var s=rt(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||h(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,y(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),e}();function Dt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ct(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(n.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&j(n,"current")}))}})}}function At(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Lt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&j(n,"current")}))}})}}function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function zt(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.1.18'})}function Ft(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ht(t){return function(e){return function(t){for(var e=1;eu+s&&(h=s-d),o+p>l+c&&(y=c-p),g(r,"left","".concat(h,"px")),g(r,"top","".concat(y,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,y(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),e}(),Bt=function(){function e(n){var r=this;t(this,e),this.art=n,this.timer=null;var i=n.template,o=i.$infoPanel,a=i.$infoClose,c=n.events.proxy;this.types=d("[data-video]",o),c(a,"click",(function(){r.show=!1})),this.art.on("destroy",(function(){clearTimeout(r.timer)}))}return n(e,[{key:"readInfo",value:function(){var t=this.art.template.$video;this.types.forEach((function(e){var n=t[e.dataset.video];e.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout((function(){t.readInfo(),t.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,y(e,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),e}(),It=function(){function e(n){t(this,e),this.art=n,this.state=!0;var r=n.events.proxy,i=n.option.subtitle;b(n.template.$subtitle,i.style),r(this.textTrack,"cuechange",this.update.bind(this)),i.url&&this.init(i.url)}return n(e,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return o.show("".concat(i.get("Switch subtitle"),": ").concat(n)),e.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t){var e=this,n=this.art,r=n.notice,i=n.template,o=i.$subtitle,a=i.$track;return fetch(t).then((function(t){return t.text()})).then((function(e){switch(D(t)){case"srt":return R($(e));case"ass":return R(T(e));case"vtt":return R(e);default:return t}})).then((function(t){return o.innerHTML="",e.url===t?t:(URL.revokeObjectURL(e.url),a.src=t,t)})).catch((function(t){throw r.show(t),t}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,h(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),e}();var Nt=function(){function e(n){var r=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),n.whitelist.state&&n.once("video:canplay",(function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){e.composedPath().indexOf(n)>-1?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){h(n,"artplayer-hover"),t.emit("hoverenter")}),(function(){y(n,"artplayer-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=V((function(){h(r,"artplayer-hide-cursor"),y(r,"artplayer-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"artplayer-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a()}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=B((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(t.player.fullscreen||t.player.fullscreenWeb||t.player.pip?t.player.autoSize=!1:t.player.autoSize=!0),t.player.aspectRatioReset=!0,t.emit("resize",{width:r.width,height:r.height}))}),500);e.proxy(o,"load",(function(){e.proxy(o.contentDocument.defaultView,"resize",s)})),i.appendChild(o)}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(e)?e.forEach((function(e){return r.proxy(t,e,n,i)})):(t.addEventListener(e,n,i),this.destroyEvents.push((function(){t.removeEventListener(e,n,i)})))}},{key:"hover",value:function(t,e,n){e&&this.proxy(t,"mouseenter",e),n&&this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(n,r){var i;if(t instanceof HTMLImageElement)i=t;else{if("string"!=typeof t)return r(t);(i=new Image).src=t}return i.complete?n(i):(e.proxy(i,"load",(function(){return n(i)})),e.proxy(i,"error",(function(){return r(i)})),t)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),Ut=function(){function e(n){var r=this;t(this,e),this.art=n,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){r.add(27,(function(){n.player.fullscreenWeb&&(n.player.fullscreenWeb=!1)})),r.add(32,(function(){n.player.toggle=!0})),r.add(37,(function(){n.player.seek=n.player.currentTime-5})),r.add(38,(function(){n.player.volume+=.1})),r.add(39,(function(){n.player.seek=n.player.currentTime+5})),r.add(40,(function(){n.player.volume-=.1})),r.init()}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var t=this;(0,this.art.events.proxy)(window,"keydown",(function(e){if(t.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var i=t.keys[e.keyCode];i&&(e.preventDefault(),i.forEach((function(t){return t()})),t.art.emit("hotkey",e))}}}))}}]),e}(),_t=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.art.on("ready",(function(){r.art.option.layers.forEach((function(t){r.add(t)}))}))}return n(e,[{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$layers;return rt(this.art,this,n,t,e,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,h(e,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),e}(),Xt=function(){function e(n){t(this,e),this.art=n,m(n.template.$loading,n.icons.loading)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,y(e,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),e}(),Yt=function(){function e(n){t(this,e),this.art=n,this.timer=null}return n(e,[{key:"show",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=this.art.template,o=i.$player,a=i.$noticeInner;this.state=!0,h(o,"artplayer-notice-show"),a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,y(t,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),e}(),Zt=function(){function e(n){t(this,e),this.art=n,m(n.template.$state,n.icons.state)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,y(e,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),e}(),Jt=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},n.option.icons);Object.keys(i).forEach((function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),m(e,i[t]),r[t]=e}))};function Gt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Qt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function Kt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function te(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ee(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ne(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e\n '.concat(n.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var re=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.state=!1,n.option.setting&&(this.art.on("ready",(function(){r.init()})),this.art.on("blur",(function(){r.show=!1})))}return n(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",(function(e){e.target===r&&(t.show=!1)})),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return rt(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,y(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),e}(),ie=function(){function e(n){t(this,e),this.art=n,this.name="artplayer_settings";var r=n.option,i=this.get("volume");i&&(r.volume=i)}return n(e,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),it({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),e}();function oe(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("artplayerPluginSubtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function ae(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;o.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(oe);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show("".concat(o.get("Subtitle offset time"),": ").concat(n,"s")),t.emit("artplayerPluginSubtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var e=t.events.proxy,n=t.template,r=t.player;function i(t){if(t){var e=n.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var i=URL.createObjectURL(t);r.switchUrl(i,t.name)}else S(!1,"Playback of this file format is not supported")}}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),i(t.dataTransfer.files[0])})),{name:"localVideo",attach:function(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){i(n.files[0])}))}}}function se(t){var e=t.events.proxy,n=t.subtitle;return{name:"localSubtitle",attach:function(t){var r=m(t,'');g(t,"position","relative"),b(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){!function(t){if(t){var r=D(t.name);if(["ass","vtt","srt"].includes(r)){var i=new FileReader;e(i,"load",(function(e){var i=e.target.result;switch(r){case"srt":var o=R($(i));n.switch(o,t.name);break;case"ass":var a=R(T(i));n.switch(a,t.name);break;case"vtt":var c=R(i);n.switch(c,t.name)}})),i.readAsText(t)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function ue(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("controls:show",(function(){e.style.display="none"})),t.on("destroy",(function(){e.style.display="none"})),t.on("controls:hide",(function(){e.style.display="block"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function le(t){var e=1e4,n=0,r=0,i=0,o=null;function a(){n=0,r=0,i=0,cancelAnimationFrame(o),o=null}function c(){o||function a(){t.isDestroy||(o=requestAnimationFrame((function(){var o=Date.now();if(i){var c=o-i;r+=c,t.player.playing||(n+=c)}i=o,t.emit("networkMonitor",n/r),r>=e&&(n=0,r=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}function fe(t){var e=t.events,n=t.player,r=t.template,i=V((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var pe=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(ae),!i.isLive&&i.miniProgressBar&&this.add(ue),i.localVideo&&this.add(ce),i.localSubtitle&&this.add(se),i.networkMonitor&&this.add(le),i.autoPip&&this.add(fe),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return S(!q(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),de=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;Y.video.events.forEach((function(t){i(o,t,(function(t){n.emit("video:".concat(t.type),t)}))})),Object.keys(r.moreVideoAttr).forEach((function(t){o[t]=r.moreVideoAttr[t]})),r.muted&&(o.muted=r.muted),r.volume&&(o.volume=I(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(n.emit("beforeCustomType",a),c(o,r.url,n),n.emit("afterCustomType",a)):(n.emit("beforeAttachUrl",r.url),o.src=r.url,n.emit("afterAttachUrl",o.src))},he=0,ye=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(F(r.option,e),X),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new Z(o(n)),n.template=new J(o(n)),n.events=new Nt(o(n)),n.whitelist.state?(n.storage=new ie(o(n)),n.icons=new Jt(o(n)),n.i18n=new K(o(n)),n.notice=new Yt(o(n)),n.player=new nt(o(n)),n.layers=new _t(o(n)),n.controls=new Tt(o(n)),n.contextmenu=new Vt(o(n)),n.subtitle=new It(o(n)),n.info=new Bt(o(n)),n.loading=new Xt(o(n)),n.hotkey=new Ut(o(n)),n.mask=new Zt(o(n)),n.setting=new re(o(n)),n.plugins=new pe(o(n))):n.mobile=new de(o(n)),he+=1,n.id=he,r.instances.push(o(n)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),n}return u(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Y}},{key:"utils",get:function(){return U}},{key:"scheme",get:function(){return X}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(ye,"instances",{value:[]}),ye})); diff --git a/package.json b/package.json index 091760d37..07d9a41aa 100644 --- a/package.json +++ b/package.json @@ -62,9 +62,10 @@ "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-postcss": "^2.0.3", "rollup-plugin-replace": "^2.2.0", + "rollup-plugin-size-snapshot": "^0.10.0", "rollup-plugin-svgo": "^1.1.0", - "rollup-plugin-uglify": "^6.0.3", + "rollup-plugin-terser": "^5.1.2", "servor": "^2.2.1", "travis-size-report": "^1.1.0" } -} +} \ No newline at end of file diff --git a/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js b/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js index 1d3b992a3..765df117b 100644 --- a/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js +++ b/packages/artplayer-plugin-backlight/dist/artplayer-plugin-backlight.js @@ -5,4 +5,4 @@ * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).artplayerPluginBacklight=e()}(this,function(){"use strict";function l(t){for(var e=[],n=0;n<10;n+=1)for(var o=0;o<5;o+=1)0!==n&&9!==n&&0!==o&&4!==o||e.push(t(n,o,10,5));return e}return function(o){var t=o.constructor.utils.setStyles,e=o.template,n=e.$player,a=e.$video,r=o.player,i=document.createElement("div");i.classList.add("artplayer-backlight"),t(i,{position:"absolute",zIndex:9,left:0,top:0,right:0,bottom:0,width:"100%",height:"100%"});var h=function(r){return l(function(t,e,n,o){var a=document.createElement("div");return a.style.position="absolute",a.style.left="".concat(100*t/n,"%"),a.style.top="".concat(100*e/o,"%"),a.style.width="".concat(100/n,"%"),a.style.height="".concat(100/o,"%"),a.style.webkitBorderRadius="50%",a.style.borderRadius="50%",a.style.webkitTransition="all .2s ease",a.style.transition="all .2s ease",r.appendChild(a),{$box:a,left:0===t,right:t===n-1,top:0===e,bottom:e===o-1}})}(i),c=document.createElement("canvas");return n.insertBefore(i,a),function n(){window.requestAnimationFrame(function(){if(r.playing){var t=a.clientWidth,e=a.clientHeight;(function(t,e,p,g){var y=t.getContext("2d");return t.width=p,t.height=g,y.drawImage(e,0,0),l(function(t,e,n,o){for(var a=p/n,r=g/o,i=t*a,c=e*r,l=y.getImageData(i,c,a,r).data,s=0,u=0,d=0,f=0,h=l.length;f\n '.concat(t.get("Danmu opacity"),': 100%\n \n
\n \n
\n '),mounted:function(t){var e=t.querySelector("input[type=range]"),n=t.querySelector(".art-value");i(e,"change",function(){var t=e.value;n.innerText=100*Number(t),r.plugins.artplayerPluginDanmuku.config({opacity:Number(t)})}),r.on("artplayerPluginDanmuku:config",function(t){e.value!==t.opacity&&(e.value=t.opacity,n.innerText=100*t.opacity)})}}}function s(r){var t=r.i18n,i=r.events.proxy;return{name:"danmuku-size",index:11,html:'\n
\n '.concat(t.get("Danmu size"),': 25px\n
\n
\n \n
\n '),mounted:function(t){var e=t.querySelector("input[type=range]"),n=t.querySelector(".art-value");i(e,"change",function(){var t=e.value;n.innerText=t,r.plugins.artplayerPluginDanmuku.config({fontSize:Number(t)})}),r.on("artplayerPluginDanmuku:config",function(t){e.value!==t.fontSize&&(e.value=t.fontSize,n.innerText=t.fontSize)})}}}function l(r){var t=r.i18n,i=r.events.proxy;return{name:"danmuku-speed",index:12,html:'\n
\n '.concat(t.get("Danmu speed"),': 5s\n
\n
\n \n
\n '),mounted:function(t){var e=t.querySelector("input[type=range]"),n=t.querySelector(".art-value");i(e,"change",function(){var t=e.value;n.innerText=t,r.plugins.artplayerPluginDanmuku.config({speed:Number(t)})}),r.on("artplayerPluginDanmuku:config",function(t){e.value!==t.speed&&(e.value=t.speed,n.innerText=t.speed)})}}}function c(n){var t=n.i18n,r=n.events.proxy;return{name:"danmuku-synchronousPlayback",index:13,html:'\n \n "),mounted:function(t){var e=t.querySelector("input[type=checkbox]");r(e,"change",function(){n.plugins.artplayerPluginDanmuku.config({synchronousPlayback:e.checked})}),n.on("artplayerPluginDanmuku:config",function(t){e.checked!==t.synchronousPlayback&&(e.checked=t.synchronousPlayback)})}}}function n(t,e,n){return t.filter(function(t){return t.$state===e}).map(n)}function p(t,e){var n=t.getBoundingClientRect();return e?n[e]:n}var f=function(t){if(Array.isArray(t))return t};var m=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw a}}return n}};var h=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var x=function(t,e){return f(t)||m(t,e)||h()};function d(t){if("string"!=typeof t)return[];var e=t.match(/[\S ]*?)<\/d>/gi);return e.length?e.map(function(t){var e=t.match(/(.+)<\/d>/),n=x(e,3),r=n[1],i=n[2],a=r.split(",");return 8===a.length&&i.trim()?{text:i,time:Number(a[0]),mode:function(t){switch(t){case 1:case 2:case 3:return"scroll";case 4:case 5:return"static";default:return null}}(Number(a[1])),fontSize:Number(a[2]),color:"#".concat(Number(a[3]).toString(16)),timestamp:Number(a[4]),pool:Number(a[5]),userID:a[6],rowID:Number(a[7])}:null}):[]}function y(t,e){var n=x(t.option.margin,2),r=n[0],i=n[1],o=p(t.art.template.$player),a=t.queue.filter(function(t){return t.mode===e.mode&&"emit"===t.$state&&t.$ref&&t.$ref.style.fontSize===e.$ref.style.fontSize&&parseFloat(t.$ref.style.top)<=o.height-i}).map(function(t){var e=p(t.$ref),n=e.width,r=e.height,i=e.top-o.top,a=e.left-o.left;return{top:i,left:a,height:r,width:n,right:o.width-a-n}}).sort(function(t,e){return t.top-e.top});return 0===a.length?r:(a.unshift({top:0,left:0,right:0,height:r,width:o.width}),a.push({top:o.height-i,left:0,right:0,height:i,width:o.width}),function(t){for(var e=0,n={},r=0;r=t.time&&t.time>=a.currentTime-.1&&"wait"===t.$state}).forEach(function(t){t.$ref=function(t){var e=t.find(function(t){return t.$ref&&"wait"===t.$state});if(e){var n=e.$ref;return e.$ref=null,n}var r=document.createElement("div");return r.style.cssText='\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-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n font-weight: normal;\n line-height: 1.125;\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 ',r}(i.queue),i.$danmuku.appendChild(t.$ref),t.$ref.style.opacity=i.option.opacity,t.$ref.style.fontSize="".concat(i.option.fontSize,"px"),t.$ref.innerText=t.text,t.$ref.style.color=t.color,t.$ref.style.border=t.border?"1px solid ".concat(t.color):"none",t.$restTime=i.option.synchronousPlayback&&a.playbackRate?i.option.speed/Number(a.playbackRate):i.option.speed,t.$lastStartTime=Date.now();var e=p(t.$ref,"width"),n=y(i,t);switch(t.$state="emit",t.mode){case"scroll":t.$restWidth=r+e+5,t.$ref.style.left="".concat(r,"px"),t.$ref.style.top="".concat(n,"px"),t.$ref.style.transform="translateX(".concat(-t.$restWidth,"px) translateY(0px) translateZ(0px)"),t.$ref.style.transition="transform ".concat(t.$restTime,"s linear 0s");break;case"static":t.$ref.style.top="".concat(n,"px"),t.$ref.style.left="50%",t.$ref.style.marginLeft="-".concat(e/2,"px")}})}i.isStop||i.update()})}},{key:"stop",value:function(){this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.animationFrameTimer),this.art.emit("artplayerPluginDanmuku:stop")}},{key:"start",value:function(){this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start")}},{key:"show",value:function(){this.$danmuku.style="block",this.art.emit("artplayerPluginDanmuku:show")}},{key:"hide",value:function(){this.$danmuku.style="none",this.art.emit("artplayerPluginDanmuku:hide")}},{key:"emit",value:function(t){var e=this.art,n=e.notice,r=e.player,i=e.i18n;t.text.trim()?t.text.length>this.option.maxlength?n.show("".concat(i.get("The length of the danmu does not exceed")," ").concat(this.option.maxlength)):("number"!=typeof t.time&&(t.time=r.currentTime),this.queue.push(function(e){for(var t=1;t\n '.concat(e.get("Danmu opacity"),': 100%\n \n
\n \n
\n '),mounted:function(e){var r=e.querySelector("input[type=range]"),i=e.querySelector(".art-value");n(r,"change",(function(){var e=r.value;i.innerText=100*Number(e),t.plugins.artplayerPluginDanmuku.config({opacity:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){r.value!==t.opacity&&(r.value=t.opacity,i.innerText=100*t.opacity)}))}}}function o(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-size",index:11,html:'\n
\n '.concat(e.get("Danmu size"),': 25px\n
\n
\n \n
\n '),mounted:function(e){var r=e.querySelector("input[type=range]"),i=e.querySelector(".art-value");n(r,"change",(function(){var e=r.value;i.innerText=e,t.plugins.artplayerPluginDanmuku.config({fontSize:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){r.value!==t.fontSize&&(r.value=t.fontSize,i.innerText=t.fontSize)}))}}}function u(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-speed",index:12,html:'\n
\n '.concat(e.get("Danmu speed"),': 5s\n
\n
\n \n
\n '),mounted:function(e){var r=e.querySelector("input[type=range]"),i=e.querySelector(".art-value");n(r,"change",(function(){var e=r.value;i.innerText=e,t.plugins.artplayerPluginDanmuku.config({speed:Number(e)})})),t.on("artplayerPluginDanmuku:config",(function(t){r.value!==t.speed&&(r.value=t.speed,i.innerText=t.speed)}))}}}function s(t){var e=t.i18n,n=t.events.proxy;return{name:"danmuku-synchronousPlayback",index:13,html:'\n \n "),mounted:function(e){var r=e.querySelector("input[type=checkbox]");n(r,"change",(function(){t.plugins.artplayerPluginDanmuku.config({synchronousPlayback:r.checked})})),t.on("artplayerPluginDanmuku:config",(function(t){r.checked!==t.synchronousPlayback&&(r.checked=t.synchronousPlayback)}))}}}function l(t,e,n){return t.filter((function(t){return t.$state===e})).map(n)}function c(t,e){var n=t.getBoundingClientRect();return e?n[e]:n}var p=function(t){if(Array.isArray(t))return t};var f=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw a}}return n}};var m=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var h=function(t,e){return p(t)||f(t,e)||m()};function d(t){switch(t){case 1:case 2:case 3:return"scroll";case 4:case 5:return"static";default:return null}}function y(t){return fetch(t).then((function(t){return t.text()})).then((function(t){return function(t){if("string"!=typeof t)return[];var e=t.match(/[\S ]*?)<\/d>/gi);return e.length?e.map((function(t){var e=t.match(/(.+)<\/d>/),n=h(e,3),r=n[1],i=n[2],a=r.split(",");return 8===a.length&&i.trim()?{text:i,time:Number(a[0]),mode:d(Number(a[1])),fontSize:Number(a[2]),color:"#".concat(Number(a[3]).toString(16)),timestamp:Number(a[4]),pool:Number(a[5]),userID:a[6],rowID:Number(a[7])}:null})):[]}(t)}))}function g(t,e){var n=h(t.option.margin,2),r=n[0],i=n[1],a=c(t.art.template.$player),o=t.queue.filter((function(t){return t.mode===e.mode&&"emit"===t.$state&&t.$ref&&t.$ref.style.fontSize===e.$ref.style.fontSize&&parseFloat(t.$ref.style.top)<=a.height-i})).map((function(t){var e=c(t.$ref),n=e.width,r=e.height,i=e.top-a.top,o=e.left-a.left;return{top:i,left:o,height:r,width:n,right:a.width-o-n}})).sort((function(t,e){return t.top-e.top}));return 0===o.length?r:(o.unshift({top:0,left:0,right:0,height:r,width:a.width}),o.push({top:a.height-i,left:0,right:0,height:i,width:a.width}),function(t){for(var e=0,n={},r=0;ro&&(e=c,o=p)}if(0===e)for(var f=0,m=0;mf)f=d,e=h(g,1)[0].top}if(0===e){var x=a.filter((function(t,e){return 0!==e&&e!==a.length-1})).sort((function(t,e){return n[t].length-n[e].length}));e=h(x,1)[0]}return e}(o))}function v(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}var b=function(){function n(t,r){var l=this;e(this,n),t.i18n.update(i),t.setting.add(a),t.setting.add(o),t.setting.add(u),t.setting.add(s),this.art=t,this.queue=[],this.option={},this.config(r),this.isStop=!1,this.animationFrameTimer=null,this.$danmuku=t.template.$danmuku,t.on("video:play",this.start.bind(this)),t.on("video:playing",this.start.bind(this)),t.on("video:pause",this.stop.bind(this)),t.on("video:waiting",this.stop.bind(this)),t.on("resize",this.resize.bind(this)),t.on("destroy",this.stop.bind(this)),"function"==typeof this.option.danmuku?this.option.danmuku().then((function(e){e.forEach(l.emit.bind(l)),t.emit("artplayerPluginDanmuku:loaded")})):"string"==typeof this.option.danmuku?y(this.option.danmuku).then((function(e){e.forEach(l.emit.bind(l)),t.emit("artplayerPluginDanmuku:loaded")})):(this.option.danmuku.forEach(this.emit.bind(this)),t.emit("artplayerPluginDanmuku:loaded"))}return r(n,[{key:"config",value:function(t){var e=this.art.constructor,r=e.utils.clamp,i=e.validator;this.option=Object.assign({},n.option,this.option,t),i(this.option,n.scheme),this.option.speed=r(this.option.speed,1,10),this.option.maxlength=r(this.option.maxlength,10,100),this.option.margin[0]=r(this.option.margin[0],0,100),this.option.margin[1]=r(this.option.margin[1],0,100),this.option.opacity=r(this.option.opacity,0,1),this.option.fontSize=r(this.option.fontSize,12,30),this.art.emit("artplayerPluginDanmuku:config",this.option)}},{key:"continue",value:function(){l(this.queue,"stop",(function(t){switch(t.$state="emit",t.$lastStartTime=Date.now(),t.mode){case"scroll":t.$ref.style.transform="translateX(".concat(-t.$restWidth,"px) translateY(0px) translateZ(0px)"),t.$ref.style.transition="transform ".concat(t.$restTime,"s linear 0s")}}))}},{key:"suspend",value:function(){var t=this.art.template.$player;l(this.queue,"emit",(function(e){switch(e.$state="stop",e.mode){case"scroll":var n=c(t),r=n.left,i=n.width-(c(e.$ref).left-r)+5;e.$ref.style.transform="translateX(".concat(-i,"px) translateY(0px) translateZ(0px)"),e.$ref.style.transition="transform 0s linear 0s"}}))}},{key:"resize",value:function(){var t=c(this.art.template.$player,"width");l(this.queue,"wait",(function(e){e.$ref&&(e.$ref.style.border="none",e.$ref.style.left="".concat(t,"px"),e.$ref.style.marginLeft="0px",e.$ref.style.transform="translateX(0px) translateY(0px) translateZ(0px)",e.$ref.style.transition="transform 0s linear 0s")}))}},{key:"update",value:function(){var t=this,e=this.art,n=e.player,r=e.template.$player;this.animationFrameTimer=window.requestAnimationFrame((function(){if(n.playing){var e=c(r,"width");l(t.queue,"emit",(function(t){t.$restTime-=(Date.now()-t.$lastStartTime)/1e3,t.$lastStartTime=Date.now(),t.$restTime<=0&&(t.$state="wait",t.$ref.style.border="none",t.$ref.style.left="".concat(e,"px"),t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px) translateY(0px) translateZ(0px)",t.$ref.style.transition="transform 0s linear 0s")})),t.queue.filter((function(t){return n.currentTime+.1>=t.time&&t.time>=n.currentTime-.1&&"wait"===t.$state})).forEach((function(r){r.$ref=function(t){var e=t.find((function(t){return t.$ref&&"wait"===t.$state}));if(e){var n=e.$ref;return e.$ref=null,n}var r=document.createElement("div");return r.style.cssText='\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-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n font-weight: normal;\n line-height: 1.125;\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 ',r}(t.queue),t.$danmuku.appendChild(r.$ref),r.$ref.style.opacity=t.option.opacity,r.$ref.style.fontSize="".concat(t.option.fontSize,"px"),r.$ref.innerText=r.text,r.$ref.style.color=r.color,r.$ref.style.border=r.border?"1px solid ".concat(r.color):"none",r.$restTime=t.option.synchronousPlayback&&n.playbackRate?t.option.speed/Number(n.playbackRate):t.option.speed,r.$lastStartTime=Date.now();var i=c(r.$ref,"width"),a=g(t,r);switch(r.$state="emit",r.mode){case"scroll":r.$restWidth=e+i+5,r.$ref.style.left="".concat(e,"px"),r.$ref.style.top="".concat(a,"px"),r.$ref.style.transform="translateX(".concat(-r.$restWidth,"px) translateY(0px) translateZ(0px)"),r.$ref.style.transition="transform ".concat(r.$restTime,"s linear 0s");break;case"static":r.$ref.style.top="".concat(a,"px"),r.$ref.style.left="50%",r.$ref.style.marginLeft="-".concat(i/2,"px")}}))}t.isStop||t.update()}))}},{key:"stop",value:function(){this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.animationFrameTimer),this.art.emit("artplayerPluginDanmuku:stop")}},{key:"start",value:function(){this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start")}},{key:"show",value:function(){this.$danmuku.style="block",this.art.emit("artplayerPluginDanmuku:show")}},{key:"hide",value:function(){this.$danmuku.style="none",this.art.emit("artplayerPluginDanmuku:hide")}},{key:"emit",value:function(e){var n=this.art,r=n.notice,i=n.player,a=n.i18n;e.text.trim()?e.text.length>this.option.maxlength?r.show("".concat(a.get("The length of the danmu does not exceed")," ").concat(this.option.maxlength)):("number"!=typeof e.time&&(e.time=i.currentTime),this.queue.push(function(e){for(var n=1;n>2,d=(3&o)<<4|(a=e.charCodeAt(r++))>>4,l=(15&a)<<2|(s=e.charCodeAt(r++))>>6,u=63&s,isNaN(a)?l=u=64:isNaN(s)&&(u=64),t=t+n.charAt(c)+n.charAt(d)+n.charAt(l)+n.charAt(u);return t},i?i.bind(e):B.noop),isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return B.isObject(e)&&!Object.keys(e).length},isArray:function(e){return e&&Array.isArray(e)},isFunction:function(e){return e&&"function"==typeof e},isElement:function(e){return e&&1===e.nodeType},isString:function(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)},isSupported:{canvas:function(){var e=z.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return e.Worker},blob:function(){return B.Blob},Uint8Array:function(){return e.Uint8Array},Uint32Array:function(){return e.Uint32Array},videoCodecs:function(){var e=z.createElement("video"),t={mp4:!1,h264:!1,ogv:!1,ogg:!1,webm:!1};try{e&&e.canPlayType&&(t.mp4=""!==e.canPlayType('video/mp4; codecs="mp4v.20.8"'),t.h264=""!==(e.canPlayType('video/mp4; codecs="avc1.42E01E"')||e.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')),t.ogv=""!==e.canPlayType('video/ogg; codecs="theora"'),t.ogg=""!==e.canPlayType('video/ogg; codecs="theora"'),t.webm=-1!==e.canPlayType('video/webm; codecs="vp8, vorbis"'))}catch(e){}return t}()},noop:function(){},each:function(e,t){var r=void 0,i=void 0;if(B.isArray(e))for(r=-1,i=e.length;++ri&&o<=n;)s.style.fontSize=--n+"px";return z.body.removeChild(s),n+"px"},webWorkerError:!1},o=Object.freeze({default:B}),f={validate:function(i){i=B.isObject(i)?i:{};var n={};return B.each(f.validators,function(e,t){var r=t.errorCode;if(!i[r]&&!t.condition)return!((n=t).error=!0)}),delete n.condition,n},isValid:function(e){var t=!0!==f.validate(e).error;return t},validators:[{condition:B.isFunction(B.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:B.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:B.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:B.isFunction(B.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:B.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:B.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:B.isSupported.Uint32Array(),errorCode:"window.Uint32Array",errorMsg:"The window.Uint32Array function constructor is not supported in your browser"}],messages:{videoCodecs:{errorCode:"videocodec",errorMsg:"The video codec you are trying to use is not supported in your browser"}}},a=Object.freeze({default:f}),c={sampleInterval:10,numWorkers:2,filter:"",gifWidth:200,gifHeight:200,interval:.1,numFrames:10,frameDuration:1,keepCameraOn:!1,images:[],video:null,webcamVideoElement:null,cameraStream:null,text:"",fontWeight:"normal",fontSize:"16px",minFontSize:"10px",resizeFont:!1,fontFamily:"sans-serif",fontColor:"#ffffff",textAlign:"center",textBaseline:"bottom",textXCoordinate:null,textYCoordinate:null,progressCallback:r,completeCallback:r,saveRenderingContexts:!1,savedRenderingContexts:[],crossOrigin:"Anonymous"},s=Object.freeze({default:c});function d(){return f.isValid()}function h(){var m,h,p,v,g,b=256,w=499,y=491,C=487,S=503,x=3*S,c=b-1,k=4,O=100,F=16,o=1<>E,R=o<>3)*(1<>F-k))>E,V[i]-=s,P[i]+=s<>U)<=1&&(a=0),e=0;e>U)<=1&&(a=0),t=0;t>=k,g[e][1]>>=k,g[e][2]>>=k,g[e][3]=e}(),function(){var e,t,r,i,n,o,a,s;for(e=s=a=0;e>1,t=a+1;t>1,t=a+1;t<256;t++)l[t]=c}(),function(){for(var e=[],t=new Array(b),r=0;r>8&255,v[b++]=255&t,v[b++]=t>>8&255,v[b++]=0|(null!==w?128:0),v[b++]=0,v[b++]=0,null!==i){if(i<0||65535>8&255,v[b++]=0}var y=!1;this.addFrame=function(e,t,r,i,n,o){if(!0===y&&(--b,y=!1),o=o===G?{}:o,e<0||t<0||65535>=1;)++d;c=1<>8&255,v[b++]=g,v[b++]=0),v[b++]=44,v[b++]=255&e,v[b++]=e>>8&255,v[b++]=255&t,v[b++]=t>>8&255,v[b++]=255&r,v[b++]=r>>8&255,v[b++]=255&i,v[b++]=i>>8&255,v[b++]=!0===a?128|d-1:0,!0===a)for(var m=0,h=s.length;m>16&255,v[b++]=p>>8&255,v[b++]=255&p}b=function(t,r,e,i){t[r++]=e;var n=r++,o=1<>=8,l-=8,r===n+256&&(t[n]=255,n=r++)}function g(e){u|=e<>=8,l-=8,r===n+256&&(t[n]=255,n=r++);4096===c?(g(o),c=1+s,d=e+1,h={}):(1<';else if(t instanceof Blob){try{o.src=B.URL.createObjectURL(t)}catch(e){}o.innerHTML=''}}else if(o.mozSrcObject)o.mozSrcObject=r;else if(B.URL)try{o.srcObject=r,o.src=B.URL.createObjectURL(r)}catch(e){o.srcObject=r}o.play(),B.requestTimeout(function e(){e.count=e.count||0,!0===v.loadedData?(v.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}),v.loadedData=!1):10<(e.count+=1)?v.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}):e()},0)},startStreaming:function(e){var t=B.isFunction(e.error)?e.error:B.noop,r=B.isFunction(e.streamed)?e.streamed:B.noop,i=B.isFunction(e.completed)?e.completed:B.noop,n=e.crossOrigin,o=e.existingVideo,a=e.lastCameraStream,s=e.options,c=e.webcamVideoElement,d=B.isElement(o)?o:c||z.createElement("video");n&&(d.crossOrigin=s.crossOrigin),d.autoplay=!0,d.loop=!0,d.muted=!0,d.addEventListener("loadeddata",function(e){v.loadedData=!0,s.offset&&(d.currentTime=s.offset)}),o?v.stream({videoElement:d,existingVideo:o,completedCallback:i}):a?v.stream({videoElement:d,cameraStream:a,streamedCallback:r,completedCallback:i}):B.getUserMedia({video:!0},function(e){v.stream({videoElement:d,cameraStream:e,streamedCallback:r,completedCallback:i})},t)},startVideoStreaming:function(a,e){var t=1=t?e.call():i.value=n(o)})),i},Blob:t.Blob||t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,btoa:(o=t.btoa||function(e){for(var t="",r=0,i=e.length,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=void 0,a=void 0,s=void 0,c=void 0,d=void 0,l=void 0,u=void 0;r>2,d=(3&o)<<4|(a=e.charCodeAt(r++))>>4,l=(15&a)<<2|(s=e.charCodeAt(r++))>>6,u=63&s,isNaN(a)?l=u=64:isNaN(s)&&(u=64),t=t+n.charAt(c)+n.charAt(d)+n.charAt(l)+n.charAt(u);return t},o?o.bind(t):s.noop),isObject:function(e){return e&&"[object Object]"===Object.prototype.toString.call(e)},isEmptyObject:function(e){return s.isObject(e)&&!Object.keys(e).length},isArray:function(e){return e&&Array.isArray(e)},isFunction:function(e){return e&&"function"==typeof e},isElement:function(e){return e&&1===e.nodeType},isString:function(e){return"string"==typeof e||"[object String]"===Object.prototype.toString.call(e)},isSupported:{canvas:function(){var e=r.createElement("canvas");return e&&e.getContext&&e.getContext("2d")},webworkers:function(){return t.Worker},blob:function(){return s.Blob},Uint8Array:function(){return t.Uint8Array},Uint32Array:function(){return t.Uint32Array},videoCodecs:function(){var e=r.createElement("video"),t={mp4:!1,h264:!1,ogv:!1,ogg:!1,webm:!1};try{e&&e.canPlayType&&(t.mp4=""!==e.canPlayType('video/mp4; codecs="mp4v.20.8"'),t.h264=""!==(e.canPlayType('video/mp4; codecs="avc1.42E01E"')||e.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')),t.ogv=""!==e.canPlayType('video/ogg; codecs="theora"'),t.ogg=""!==e.canPlayType('video/ogg; codecs="theora"'),t.webm=-1!==e.canPlayType('video/webm; codecs="vp8, vorbis"'))}catch(e){}return t}()},noop:function(){},each:function(e,t){var r=void 0,i=void 0;if(s.isArray(e))for(r=-1,i=e.length;++r0&&arguments[0]!==n?arguments[0]:{};if(!r.body||!1===e.resizeFont)return e.fontSize;var t=e.text,i=e.gifWidth,o=parseInt(e.fontSize,10),a=parseInt(e.minFontSize,10),s=r.createElement("div"),c=r.createElement("span");for(s.setAttribute("width",i),s.appendChild(c),c.innerHTML=t,c.style.fontSize=o+"px",c.style.textIndent="-9999px",c.style.visibility="hidden",r.body.appendChild(c);c.offsetWidth>i&&o>=a;)c.style.fontSize=--o+"px";return r.body.removeChild(c),o+"px"},webWorkerError:!1},c=Object.freeze({default:s}),d={validate:function(e){e=s.isObject(e)?e:{};var t={};return s.each(d.validators,(function(r,i){var n=i.errorCode;if(!e[n]&&!i.condition)return(t=i).error=!0,!1})),delete t.condition,t},isValid:function(e){var t=!0!==d.validate(e).error;return t},validators:[{condition:s.isFunction(s.getUserMedia),errorCode:"getUserMedia",errorMsg:"The getUserMedia API is not supported in your browser"},{condition:s.isSupported.canvas(),errorCode:"canvas",errorMsg:"Canvas elements are not supported in your browser"},{condition:s.isSupported.webworkers(),errorCode:"webworkers",errorMsg:"The Web Workers API is not supported in your browser"},{condition:s.isFunction(s.URL),errorCode:"window.URL",errorMsg:"The window.URL API is not supported in your browser"},{condition:s.isSupported.blob(),errorCode:"window.Blob",errorMsg:"The window.Blob File API is not supported in your browser"},{condition:s.isSupported.Uint8Array(),errorCode:"window.Uint8Array",errorMsg:"The window.Uint8Array function constructor is not supported in your browser"},{condition:s.isSupported.Uint32Array(),errorCode:"window.Uint32Array",errorMsg:"The window.Uint32Array function constructor is not supported in your browser"}],messages:{videoCodecs:{errorCode:"videocodec",errorMsg:"The video codec you are trying to use is not supported in your browser"}}},l=Object.freeze({default:d}),u=function(){},f={sampleInterval:10,numWorkers:2,filter:"",gifWidth:200,gifHeight:200,interval:.1,numFrames:10,frameDuration:1,keepCameraOn:!1,images:[],video:null,webcamVideoElement:null,cameraStream:null,text:"",fontWeight:"normal",fontSize:"16px",minFontSize:"10px",resizeFont:!1,fontFamily:"sans-serif",fontColor:"#ffffff",textAlign:"center",textBaseline:"bottom",textXCoordinate:null,textYCoordinate:null,progressCallback:u,completeCallback:u,saveRenderingContexts:!1,savedRenderingContexts:[],crossOrigin:"Anonymous"},g=Object.freeze({default:f});function m(){return d.isValid()}function h(){var e,t,r,i,n,o=256,a=499,s=491,c=487,d=503,l=3*d,u=o-1,f=4,g=100,m=16,h=1<>v,w=h<>3)*(1<o&&(l=o),s=t+1,c=t-1,f=1;sd;){if(u=A[f++],sd){g=n[c--];try{g[0]-=u*(g[0]-r)/O|0,g[1]-=u*(g[1]-i)/O|0,g[2]-=u*(g[2]-a)/O|0}catch(e){}}}}function T(e,t,r,i,o){var a=n[t],s=e/x;a[0]-=s*(a[0]-r)|0,a[1]-=s*(a[1]-i)|0,a[2]-=s*(a[2]-o)|0}function U(e,t,r){var i,a,s,c,d,l,u,g,h,y;for(h=g=~(1<<31),u=l=-1,i=0;i>m-f))>v,E[i]-=d,W[i]+=d<=0;)i=d?i=o:(i++,s<0&&(s=-s),(c=l[0]-e)<0&&(c=-c),(s+=c)=0&&((s=t-(l=n[a])[1])>=d?a=-1:(a--,s<0&&(s=-s),(c=l[0]-e)<0&&(c=-c),(s+=c)>y)<=1&&(v=0),n=0;n=M&&(E-=r),0===O&&(O=1),++n%O==0)for(b-=b/e,(v=(p-=p/S)>>y)<=1&&(v=0),o=0;o>=f,n[e][1]>>=f,n[e][2]>>=f,n[e][3]=e}(),function(){var e,t,r,i,a,s,c,d;for(c=0,d=0,e=0;e>1,t=c+1;t>1,t=c+1;t<256;t++)F[t]=u}(),function(){for(var e=[],t=new Array(o),r=0;r65535||r>65535)throw"Width/Height invalid.";e[o++]=71,e[o++]=73,e[o++]=70,e[o++]=56,e[o++]=57,e[o++]=97;if(e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&r,e[o++]=r>>8&255,e[o++]=0|(null!==s?128:0),e[o++]=0,e[o++]=0,null!==a){if(a<0||a>65535)throw"Loop count invalid.";e[o++]=33,e[o++]=255,e[o++]=11,e[o++]=78,e[o++]=69,e[o++]=84,e[o++]=83,e[o++]=67,e[o++]=65,e[o++]=80,e[o++]=69,e[o++]=50,e[o++]=46,e[o++]=48,e[o++]=3,e[o++]=1,e[o++]=255&a,e[o++]=a>>8&255,e[o++]=0}var c=!1;this.addFrame=function(t,r,i,a,d,l){if(!0===c&&(--o,c=!1),l=l===n?{}:l,t<0||r<0||t>65535||r>65535)throw"x/y invalid.";if(i<=0||a<=0||i>65535||a>65535)throw"Width/Height invalid.";if(d.length256||t&t-1)throw"Invalid code/color length, must be power of 2 and 2 .. 256.";return t}(f),m=0;g>>=1;)++m;g=1<3)throw"Disposal out of range.";var v=!1,b=0;if(l.transparent!==n&&null!==l.transparent&&(v=!0,(b=l.transparent)<0||b>=g))throw"Transparent color index.";if((0!==p||v||0!==h)&&(e[o++]=33,e[o++]=249,e[o++]=4,e[o++]=p<<2|(!0===v?1:0),e[o++]=255&h,e[o++]=h>>8&255,e[o++]=b,e[o++]=0),e[o++]=44,e[o++]=255&t,e[o++]=t>>8&255,e[o++]=255&r,e[o++]=r>>8&255,e[o++]=255&i,e[o++]=i>>8&255,e[o++]=255&a,e[o++]=a>>8&255,e[o++]=!0===u?128|m-1:0,!0===u)for(var w=0,y=f.length;w>16&255,e[o++]=C>>8&255,e[o++]=255&C}o=function(e,t,r,i){e[t++]=r;var o=t++,a=1<=r;)e[t++]=255&f,f>>=8,u-=8,t===o+256&&(e[o]=255,o=t++)}function m(e){f|=e<=8;)e[t++]=255&f,f>>=8,u-=8,t===o+256&&(e[o]=255,o=t++);4096===d?(m(a),d=c+1,l=r+1,p={}):(d>=1<0&&arguments[0]!==n?arguments[0]:{},r=e.data;delete s.data,s.pixels=Array.prototype.slice.call(r.pixels),s.palette=Array.prototype.slice.call(r.palette),s.done=!0,s.beingProcessed=!1,t.freeWorker(c),t.onFrameFinished(i)};(s=a[e]).beingProcessed||s.done?this.onFrameFinished():(s.sampleInterval=o,s.beingProcessed=!0,s.gifshot=!0,(c=this.getWorker())?(c.onmessage=d,c.postMessage(s)):d({data:t.workerMethods.run(s)}))},startRendering:function(e){this.onRenderCompleteCallback=e;for(var t=0;t=0&&this.processFrame(e)},generateGIF:function(e,t){var r=[],i={loop:this.repeat},n=this.options,o=n.interval,a=n.frameDuration,c=!!n.images.length,d=n.gifHeight,l=n.gifWidth,u=new v(r,l,d,i),f=this.onRenderProgressCallback,g=c?100*o:0,m=void 0;this.generatingGIF=!0,s.each(e,(function(t,r){var i=r.palette;f(.75+.25*r.position*1/e.length);for(var n=0;n0&&arguments[0]!==n?arguments[0]:{},t=this.frames,r=e.data;this.frames.push({data:r,width:e.width,height:e.height,palette:null,dithering:null,done:!1,beingProcessed:!1,position:t.length})},onRenderProgress:function(e){this.onRenderProgressCallback=e},isRendering:function(){return this.generatingGIF},getBase64GIF:function(e){var t=this;t.startRendering((function(r){t.destroyWorkers(),s.requestTimeout((function(){e(r)}),0)}))},destroyWorkers:function(){if(!this.workerError){var e=this.workers;s.each(e,(function(e,t){var r=t.worker,i=t.objectUrl;r.terminate(),s.URL.revokeObjectURL(i)}))}}};var y=function(){},C={getGIF:function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=arguments[1];t=s.isFunction(t)?t:y;var i=r.createElement("canvas"),o=void 0,a=e.images,c=!!a.length,d=e.cameraStream,l=e.crop,u=e.filter,f=e.fontColor,g=e.fontFamily,m=e.fontWeight,h=e.keepCameraOn,p=(e.numWorkers,e.progressCallback),v=e.saveRenderingContexts,b=e.savedRenderingContexts,C=e.text,S=e.textAlign,x=e.textBaseline,k=e.videoElement,O=e.videoHeight,F=e.videoWidth,W=e.webcamVideoElement,E=Number(e.gifWidth),A=Number(e.gifHeight),R=Number(e.interval),T=(Number(e.sampleInterval),c?0:1e3*R),U=[],M=b.length?b.length:e.numFrames,j=M,I=new w(e),P=s.getFontSize(e),V=e.textXCoordinate?e.textXCoordinate:"left"===S?1:"right"===S?E:E/2,L=e.textYCoordinate?e.textYCoordinate:"top"===x?1:"center"===x?A/2:A,H=m+" "+P+" "+g,z=l?Math.floor(l.scaledWidth/2):0,G=l?F-l.scaledWidth:0,B=l?Math.floor(l.scaledHeight/2):0,D=l?O-l.scaledHeight:0,N=function e(){var r=j-1;function i(){var i;v&&U.push(o.getImageData(0,0,E,A)),C&&(o.font=H,o.fillStyle=f,o.textAlign=S,o.textBaseline=x,o.fillText(C,V,L)),i=o.getImageData(0,0,E,A),I.addFrameImageData(i),p((M-(j=r))/M),r>0&&s.requestTimeout(e,T),j||I.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e,cameraStream:d,videoElement:k,webcamVideoElement:W,savedRenderingContexts:U,keepCameraOn:h})}))}b.length?(o.putImageData(b[M-j],0,0),i()):function e(){try{G>F&&(G=F),D>O&&(D=O),z<0&&(z=0),B<0&&(B=0),o.filter=u,o.drawImage(k,z,B,G,D,0,0,E,A),i()}catch(t){if("NS_ERROR_NOT_AVAILABLE"!==t.name)throw t;s.requestTimeout(e,100)}}()};M=M!==n?M:10,R=R!==n?R:.1,i.width=E,i.height=A,o=i.getContext("2d"),function e(){b.length||0!==k.currentTime?N():s.requestTimeout(e,100)}()},getCropDimensions:function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.videoWidth,r=e.videoHeight,i=e.gifWidth,o=e.gifHeight,a={width:0,height:0,scaledWidth:0,scaledHeight:0};return t>r?(a.width=Math.round(t*(o/r))-i,a.scaledWidth=Math.round(a.width*(r/o))):(a.height=Math.round(r*(i/t))-o,a.scaledHeight=Math.round(a.height*(t/i))),a}},S={loadedData:!1,defaultVideoDimensions:{width:640,height:480},findVideoSize:function e(t){e.attempts=e.attempts||0;var r=t.cameraStream,i=t.completedCallback,n=t.videoElement;n&&(n.videoWidth>0&&n.videoHeight>0?(n.removeEventListener("loadeddata",S.findVideoSize),i({videoElement:n,cameraStream:r,videoWidth:n.videoWidth,videoHeight:n.videoHeight})):e.attempts<10?(e.attempts+=1,s.requestTimeout((function(){S.findVideoSize(t)}),400)):i({videoElement:n,cameraStream:r,videoWidth:S.defaultVideoDimensions.width,videoHeight:S.defaultVideoDimensions.height}))},onStreamingTimeout:function(e){s.isFunction(e)&&e({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - Timed out while trying to start streaming",image:null,cameraStream:{}})},stream:function(e){var t=s.isArray(e.existingVideo)?e.existingVideo[0]:e.existingVideo,r=e.cameraStream,i=e.completedCallback,n=e.streamedCallback,o=e.videoElement;if(s.isFunction(n)&&n(),t){if(s.isString(t))o.src=t,o.innerHTML='';else if(t instanceof Blob){try{o.src=s.URL.createObjectURL(t)}catch(e){}o.innerHTML=''}}else if(o.mozSrcObject)o.mozSrcObject=r;else if(s.URL)try{o.srcObject=r,o.src=s.URL.createObjectURL(r)}catch(e){o.srcObject=r}o.play(),s.requestTimeout((function e(){e.count=e.count||0,!0===S.loadedData?(S.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}),S.loadedData=!1):(e.count+=1)>10?S.findVideoSize({videoElement:o,cameraStream:r,completedCallback:i}):e()}),0)},startStreaming:function(e){var t=s.isFunction(e.error)?e.error:s.noop,i=s.isFunction(e.streamed)?e.streamed:s.noop,n=s.isFunction(e.completed)?e.completed:s.noop,o=e.crossOrigin,a=e.existingVideo,c=e.lastCameraStream,d=e.options,l=e.webcamVideoElement,u=s.isElement(a)?a:l||r.createElement("video");o&&(u.crossOrigin=d.crossOrigin),u.autoplay=!0,u.loop=!0,u.muted=!0,u.addEventListener("loadeddata",(function(e){S.loadedData=!0,d.offset&&(u.currentTime=d.offset)})),a?S.stream({videoElement:u,existingVideo:a,completedCallback:n}):c?S.stream({videoElement:u,cameraStream:c,streamedCallback:i,completedCallback:n}):s.getUserMedia({video:!0},(function(e){S.stream({videoElement:u,cameraStream:e,streamedCallback:i,completedCallback:n})}),t)},startVideoStreaming:function(e){var t=arguments.length>1&&arguments[1]!==n?arguments[1]:{},r=t.timeout!==n?t.timeout:0,i=t.callback,o=t.webcamVideoElement,a=void 0;r>0&&(a=s.requestTimeout((function(){S.onStreamingTimeout(i)}),1e4)),S.startStreaming({error:function(){i({error:!0,errorCode:"getUserMedia",errorMsg:"There was an issue with the getUserMedia API - the user probably denied permission",image:null,cameraStream:{}})},streamed:function(){clearTimeout(a)},completed:function(){var t=arguments.length>0&&arguments[0]!==n?arguments[0]:{},r=t.cameraStream,i=t.videoElement,o=t.videoHeight,a=t.videoWidth;e({cameraStream:r,videoElement:i,videoHeight:o,videoWidth:a})},lastCameraStream:t.lastCameraStream,webcamVideoElement:o,crossOrigin:t.crossOrigin,options:t})},stopVideoStreaming:function(e){var t=e=s.isObject(e)?e:{},r=t.keepCameraOn,i=t.videoElement,n=t.webcamVideoElement,o=e.cameraStream||{},a=o.getTracks&&o.getTracks()||[],c=!!a.length,d=a[0];!r&&c&&s.isFunction(d.stop)&&d.stop(),s.isElement(i)&&!n&&(i.pause(),s.isFunction(s.URL.revokeObjectURL)&&!s.webWorkerError&&i.src&&s.URL.revokeObjectURL(i.src),s.removeElement(i))}};function x(e){e=s.isObject(e)?e:{},S.stopVideoStreaming(e)}function k(e,t){var i=e.options||{},n=i.images,o=i.video,a=Number(i.gifWidth),c=Number(i.gifHeight),d=(Number(i.numFrames),e.cameraStream),l=e.videoElement,u=e.videoWidth,f=e.videoHeight,g=C.getCropDimensions({videoWidth:u,videoHeight:f,gifHeight:c,gifWidth:a}),m=t;i.crop=g,i.videoElement=l,i.videoWidth=u,i.videoHeight=f,i.cameraStream=d,s.isElement(l)&&(l.width=a+g.width,l.height=c+g.height,i.webcamVideoElement||(s.setCSSAttr(l,{position:"fixed",opacity:"0"}),r.body.appendChild(l)),l.play(),C.getGIF(i,(function(e){n&&n.length||o&&o.length||x(e),m(e)})))}function O(e,t){if(t=s.isFunction(e)?e:t,e=s.isObject(e)?e:{},s.isFunction(t)){var i=s.mergeOptions(f,e)||{},o=e.cameraStream,a=i.images,c=a?a.length:0,l=i.video,u=i.webcamVideoElement;i=s.mergeOptions(i,{gifWidth:Math.floor(i.gifWidth),gifHeight:Math.floor(i.gifHeight)}),c?function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.callback,i=e.images,o=e.options,a=e.imagesLength,c=d.validate({getUserMedia:!0,"window.URL":!0}),l=[],u=0,f=void 0,g=void 0;if(c.error)return t(c);function m(){s.each(l,(function(e,t){t&&(t.text?g.addFrame(t.img,o,t.text):g.addFrame(t,o))})),function(e,t){e.getBase64GIF((function(e){t({error:!1,errorCode:"",errorMsg:"",image:e})}))}(g,t)}g=new w(o),s.each(i,(function(e,i){var n=i;i.src&&(n=n.src),s.isElement(n)?(o.crossOrigin&&(n.crossOrigin=o.crossOrigin),l[e]=n,(u+=1)===a&&m()):s.isString(n)&&(f=new Image,o.crossOrigin&&(f.crossOrigin=o.crossOrigin),function(r){i.text&&(r.text=i.text),r.onerror=function(e){var r=void 0;if(0===--a)return(r={}).error="None of the requested images was capable of being retrieved",t(r)},r.onload=function(t){i.text?l[e]={img:r,text:r.text}:l[e]=r,(u+=1)===a&&m(),s.removeElement(r)},r.src=n}(f),s.setCSSAttr(f,{position:"fixed",opacity:"0"}),r.body.appendChild(f))}))}({images:a,imagesLength:c,callback:t,options:i}):l?function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.callback,r=e.existingVideo,i=e.options,o=d.validate({getUserMedia:!0,"window.URL":!0}),a=void 0,c=void 0;if(o.error)return t(o);if(s.isElement(r)&&r.src){if(c=r.src,a=s.getExtension(c),!s.isSupported.videoCodecs[a])return t(d.messages.videoCodecs)}else s.isArray(r)&&s.each(r,(function(e,t){if(a=t instanceof Blob?t.type.substr(t.type.lastIndexOf("/")+1,t.length):t.substr(t.lastIndexOf(".")+1,t.length),s.isSupported.videoCodecs[a])return r=t,!1}));S.startStreaming({completed:function(e){e.options=i||{},k(e,t)},existingVideo:r,crossOrigin:i.crossOrigin,options:i})}({existingVideo:l,callback:t,options:i}):function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{},t=e.callback,r=e.lastCameraStream,i=e.options,o=e.webcamVideoElement;if(!m())return t(d.validate());i.savedRenderingContexts.length?C.getGIF(i,(function(e){t(e)})):S.startVideoStreaming((function(){var e=arguments.length>0&&arguments[0]!==n?arguments[0]:{};e.options=i||{},k(e,t)}),{lastCameraStream:r,callback:t,webcamVideoElement:o,crossOrigin:i.crossOrigin})}({lastCameraStream:o,callback:t,webcamVideoElement:u,options:i})}}var F={utils:c,error:l,defaultOptions:g,createGIF:O,takeSnapShot:function(e,t){if(t=s.isFunction(e)?e:t,e=s.isObject(e)?e:{},s.isFunction(t)){var r=s.mergeOptions(f,e);O(s.mergeOptions(r,{interval:.1,numFrames:1,gifWidth:Math.floor(r.gifWidth),gifHeight:Math.floor(r.gifHeight)}),t)}},stopVideoStreaming:x,isSupported:function(){return d.isValid()},isWebCamGIFSupported:m,isExistingVideoGIFSupported:function(e){var t=!1;if(s.isArray(e)&&e.length){if(s.each(e,(function(e,r){s.isSupported.videoCodecs[r]&&(t=!0)})),!t)return!1}else if(s.isString(e)&&e.length&&!s.isSupported.videoCodecs[e])return!1;return d.isValid({getUserMedia:!0})},isExistingImagesGIFSupported:function(){return d.isValid({getUserMedia:!0})},VERSION:"0.4.5"};"function"==typeof n&&n.amd?n([],(function(){return F})):e.exports=F}("undefined"!=typeof window?window:{},"undefined"!=typeof document?document:{createElement:function(){}},"undefined"!=typeof window?window.navigator:{})})),i=t((function(e){var t;t=function(){return function(e,t,r){t=t||"",r=r||512;for(var i=atob(e),n=[],o=0;o0&&void 0!==arguments[0]?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;y=!0,f.show=!0,e.emit("artplayerPluginGif:start"),d.show(c.get("Start creating gif..."),!1),r.createGIF(o({},t,{video:[v.src],crossOrigin:"anonymous"}),(function(t){if(t.error)d.show(t.errorMsg),n(!1,t.errorMsg);else if("function"==typeof a){var r=t.image.split(",")[1],o=i(r,"image/gif"),s=URL.createObjectURL(o);d.show(c.get("Create gif successfully")),e.emit("artplayerPluginGif",s),a(s)}y=!1,f.show=!1,e.emit("artplayerPluginGif:end")}))}}}})); diff --git a/packages/artplayer-plugin-playlist/dist/artplayer-plugin-playlist.js b/packages/artplayer-plugin-playlist/dist/artplayer-plugin-playlist.js index a15f036ef..d84c3430b 100644 --- a/packages/artplayer-plugin-playlist/dist/artplayer-plugin-playlist.js +++ b/packages/artplayer-plugin-playlist/dist/artplayer-plugin-playlist.js @@ -5,4 +5,4 @@ * Released under the MIT License. */ -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).artplayerPluginPlaylist=n()}(this,function(){"use strict";return function(h){return function(e){var t=e.constructor.utils,n=t.append,r=t.errorHandle,i=t.sleep,a=t.inverseClass,l=e.player,o=e.events.proxy,s=e.template,u=s.$player,c=s.$video,y=n(u,'\n
\n
\n
\n ');r(Array.isArray(h),"Playlist is not an array type"),r(0').concat(t.title,"")}).join(""),o(p,"click",function(t){var n=t.target.dataset.optionIndex;n&&Number(n)<=f.length-1&&d(n)}),o(y,"click",function(t){t.target===y&&u.classList.remove("artplayer-playlist-show")}),e.on("video:ended",function(){v().then(function(){i(1e3).then(function(){l.play=!0})})}),e.on("afterAttachUrl",function(){var t=f.findIndex(function(t){return t.url===c.src}),n=Array.from(p.children)[t];-1!==t&&n&&a(n,"active")}),{name:"artplayerPluginPlaylist",show:function(){u.classList.add("artplayer-playlist-show")},hide:function(){u.classList.remove("artplayer-playlist-show")},next:function(){v()},prev:function(){!function(){var t=f.findIndex(function(t){return t.url===c.src});r(-1!==t,"Can't find Playlist item"),1===f.length?d(0):d(t-1==-1?f.length-1:t-1)}()}}}}}); +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).artplayerPluginPlaylist=n()}(this,(function(){"use strict";return function(t){return function(n){var e=n.constructor.utils,r=e.append,i=e.errorHandle,a=e.sleep,l=e.inverseClass,o=n.player,s=n.events.proxy,u=n.template,c=u.$player,y=u.$video,f=r(c,'\n
\n
\n
\n ');i(Array.isArray(t),"Playlist is not an array type"),i(t.length>0,"Playlist cannot be empty");var p=t.map((function(t){return i(t.url,"Playlist items require url attribute"),i(t.title,"Playlist items require title attribute"),t})),d=f.querySelector(".artplayer-playlist-inner");function v(t){var e=p[t];return o.switchUrl(e.url,e.title).then((function(){n.emit("artplayerPluginPlaylist:change",e)}))}function h(){var t=p.findIndex((function(t){return t.url===y.src}));return i(-1!==t,"Can't find Playlist item"),1===p.length?v(0):v(t+1===p.length?0:t+1)}return d.innerHTML=p.map((function(t,n){return'
').concat(t.title,"
")})).join(""),s(d,"click",(function(t){var n=t.target.dataset.optionIndex;n&&Number(n)<=p.length-1&&v(n)})),s(f,"click",(function(t){t.target===f&&c.classList.remove("artplayer-playlist-show")})),n.on("video:ended",(function(){h().then((function(){a(1e3).then((function(){o.play=!0}))}))})),n.on("afterAttachUrl",(function(){var t=p.findIndex((function(t){return t.url===y.src})),n=Array.from(d.children)[t];-1!==t&&n&&l(n,"active")})),{name:"artplayerPluginPlaylist",show:function(){c.classList.add("artplayer-playlist-show")},hide:function(){c.classList.remove("artplayer-playlist-show")},next:function(){h()},prev:function(){var t;t=p.findIndex((function(t){return t.url===y.src})),i(-1!==t,"Can't find Playlist item"),1===p.length?v(0):v(t-1==-1?p.length-1:t-1)}}}}})); diff --git a/packages/artplayer-react/dist/artplayer-react.js b/packages/artplayer-react/dist/artplayer-react.js index 143c67a27..05d1078d5 100644 --- a/packages/artplayer-react/dist/artplayer-react.js +++ b/packages/artplayer-react/dist/artplayer-react.js @@ -5,4 +5,15 @@ * Released under the MIT License. */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).ArtplayerReact=t()}(this,function(){"use strict";var a=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r.")}return t}(t);if(!we[n]){we[n]=!0;var r="";e&&e._owner&&e._owner!==z.current&&(r=" It was passed a child from "+F(e._owner.type)+"."),V(e),H(!1,'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',n,r),V(null)}}}function ke(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n",o=" Did you accidentally export a JSX literal instead of a component?"):a=typeof e,H(!1,"React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",a,o)}var c=K.apply(this,arguments);if(null==c)return c;if(r)for(var u=2;u is not supported and will be removed in a future major release. Did you mean to render instead?"),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||H(!(r=!0),"Rendering is not supported and will be removed in a future major release. Did you mean to render instead?"),n.Consumer}}}),n.Consumer=i,n._currentRenderer=null,n._currentRenderer2=null,n},forwardRef:function(e){return null!=e&&e.$$typeof===f?j(!1,"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?j(!1,"forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&j(!1,"forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null==e||null==e.defaultProps&&null==e.propTypes||j(!1,"forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"),{$$typeof:i,render:e}},lazy:function(e){var t={$$typeof:p,_ctor:e,_status:-1,_result:null},n=void 0,r=void 0;return Object.defineProperties(t,{defaultProps:{configurable:!0,get:function(){return n},set:function(e){H(!1,"React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(t,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){H(!1,"React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),r=e,Object.defineProperty(t,"propTypes",{enumerable:!0})}}}),t},memo:function(e,t){return he(e)||j(!1,"memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e),{$$typeof:f,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return ve().useCallback(e,t)},useContext:function(e,t){var n=ve();if(void 0!==t&&H(!1,"useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&Array.isArray(arguments[2])?"\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://fb.me/rules-of-hooks":""),void 0!==e._context){var r=e._context;r.Consumer===e?H(!1,"Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&H(!1,"Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},useEffect:function(e,t){return ve().useEffect(e,t)},useImperativeHandle:function(e,t,n){return ve().useImperativeHandle(e,t,n)},useDebugValue:function(e,t){return ve().useDebugValue(e,t)},useLayoutEffect:function(e,t){return ve().useLayoutEffect(e,t)},useMemo:function(e,t){return ve().useMemo(e,t)},useReducer:function(e,t,n){return ve().useReducer(e,t,n)},useRef:function(e){return ve().useRef(e)},useState:function(e){return ve().useState(e)},Fragment:s,Profiler:r,StrictMode:n,Suspense:u,unstable_SuspenseList:l,createElement:Pe,cloneElement:function(e,t,n){for(var r=function(e,t,n){!function(){if(null==e)throw O(Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+"."))}();var r=void 0,o=y({},e.props),i=e.key,a=e.ref,c=e._self,u=e._source,s=e._owner;if(null!=t){J(t)&&(a=t.ref,s=z.current),G(t)&&(i=""+t.key);var l=void 0;for(r in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)B.call(t,r)&&!Y.hasOwnProperty(r)&&(void 0===t[r]&&void 0!==l?o[r]=l[r]:o[r]=t[r])}var f=arguments.length-2;if(1==f)o.children=n;else if(1").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function Re(e){return URL.createObjectURL(new Blob([e],{type:"text/vtt"}))}function $e(e){var n=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(e){return(0\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n \n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(e){e?this.$container.innerHTML="":de(this.$player,"artplayer-destroy")}}]),n}(),Qe={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Ke={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},et=function(){function t(e){u(this,t),this.art=e,this.languages={"zh-cn":Qe,"zh-tw":Ke},this.init()}return s(t,[{key:"init",value:function(){var e=this.art.option.lang.toLowerCase();this.language=this.languages[e]||{}}},{key:"get",value:function(e){return this.language[e]||e}},{key:"update",value:function(e){this.languages=Fe(this.languages,e),this.init()}}]),t}();var tt=e(function(e){var i,t,o,r,n;i="undefined"!=typeof window&&void 0!==window.document?window.document:{},t=e.exports,o=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=t.length,o={};n ").concat(u));var s=document.createElement("div");s.classList.value="art-".concat(i," art-").concat(i,"-").concat(u),a.html&&ve(s,a.html),a.style&&ge(s,a.style),a.tooltip&&ke(s,a.tooltip);var l=Array.from(e.children);s.dataset.index=a.index||c;var f=l.find(function(e){return Number(e.dataset.index)>=Number(s.dataset.index)});return f?f.insertAdjacentElement("beforebegin",s):ve(e,s),a.click&&t.events.proxy(s,"click",function(e){e.preventDefault(),a.click.call(t,n,e),t.emit("".concat(i,":click"),s)}),a.mounted&&a.mounted(s,n,t),o&&o(s,n,t),Object.defineProperty(n,u,{value:{get id(){return c},get $ref(){return s},set show(e){e?(me(s,"display","block"),t.emit("".concat(i,":show"),s)):(me(s,"display","none"),t.emit("".concat(i,":hide"),s))}}}),t.emit("".concat(i,":add"),a),n[u]}function it(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function at(e){return function(a){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),mounted:function(i){var o=!1,n=fe(".art-progress-loaded",i),r=fe(".art-progress-played",i),a=fe(".art-progress-highlight",i),c=fe(".art-progress-indicator",i),u=fe(".art-progress-tip",i);function s(e,t){"loaded"===e&&me(n,"width","".concat(100*t,"%")),"played"===e&&(me(r,"width","".concat(100*t,"%")),me(c,"left","calc(".concat(100*t,"% - ").concat(be(c,"width")/2,"px)")))}t.forEach(function(e){var t=Ue(e.time,0,p.duration)/p.duration*100;ve(a,''))}),s("loaded",p.loaded),l.on("video:progress",function(){s("loaded",p.loaded)}),l.on("video:timeupdate",function(){s("played",p.played)}),l.on("video:ended",function(){s("played",1)}),f(i,"mousemove",function(e){me(u,"display","block"),-1i.clientWidth-r/2?me(u,"left","".concat(i.clientWidth-r,"px")):me(u,"left","".concat(t-r/2,"px"))}(e):function(e){var t=yt(l,e),n=t.width,r=t.time;u.innerHTML=r;var o=u.clientWidth;n<=o/2?me(u,"left",0):n>i.clientWidth-o/2?me(u,"left","".concat(i.clientWidth-o,"px")):me(u,"left","".concat(n-o/2,"px"))}(e)}),f(i,"mouseout",function(){me(u,"display","none")}),f(i,"click",function(e){if(e.target!==c){var t=yt(l,e),n=t.second;s("played",t.percentage),p.seek=n}}),f(c,"mousedown",function(){o=!0}),f(document,"mousemove",function(e){if(o){var t=yt(l,e),n=t.second,r=t.percentage;de(c,"art-show-indicator"),s("played",r),p.seek=n}}),f(document,"mouseup",function(){o&&(o=!1,ye(c,"art-show-indicator"))})}})}}function vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function mt(e){return function(a){return function(t){for(var e=1;e'),s=ve(u,'
');function l(e){var t=u.getBoundingClientRect(),n=t.left,r=t.width,o=s.getBoundingClientRect().width;return Ue(e.pageX-n-o/2,0,r-o/2)/(r-o)}function f(e){var t=0d.clientWidth-o/2?me(f,"left","".concat(d.clientWidth-o,"px")):me(f,"left","".concat(t-o/2,"px"))}(e))}),t(d,"mouseout",function(){me(f,"display","none")})}})}}function St(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Et(e){return function(a){return function(t){for(var e=1;e'.concat(o.name,"")),s=i.map(function(e,t){return'
').concat(e.name,"
")}).join(""),l=ve(e,'
'.concat(s,"
"));r(e,function(){l.style.left="-".concat(be(l,"width")/2-e.clientWidth/2,"px")}),n(l,"click",function(e){var t=Number(e.target.dataset.index),n=i[t],r=n.url,o=n.name;r&&o&&c!==t&&(a.switchQuality(r,o),u.innerHTML=o,c=t)})}})}}var Ct=function(){function n(e){var t=this;u(this,n),this.id=0,this.art=e,this.art.on("ready",function(){t.init()})}return s(n,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(ht({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add($t({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(Et({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(jt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(ut({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach(function(e){t.add(e)})}},{key:"add",value:function(e,t){var n,r="function"==typeof e?e(this.art):e,o=this.art.template,i=o.$progress,a=o.$controlsLeft,c=o.$controlsRight;switch(r.position){case"top":n=i;break;case"left":n=a;break;case"right":n=c}this.id+=1,Se(r.position,"Controls option.position can not be empty");var u=ot(this.art,this,n,r,t,"control");return r.disable||"top"===r.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||de(u.$ref,"art-control-onlyText"),u}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,de(t,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,ye(t,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),n}();function Dt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Tt(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(t.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(e,t){var n=t.target.dataset.rate;n&&(r.playbackRate=Number(n),e.show=!1)},mounted:function(n){e.on("playbackRateChange",function(t){var e=pe("span",n).find(function(e){return Number(e.dataset.rate)===t});e&&Oe(e,"current")})}})}}function _t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function At(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(t.get("Default"),'\n 4:3\n 16:9\n '),click:function(e,t){var n=t.target.dataset.ratio;n&&(r.aspectRatio=n,e.show=!1)},mounted:function(n){e.on("aspectRatioChange",function(t){var e=pe("span",n).find(function(e){return e.dataset.ratio===t});e&&Oe(e,"current")})}})}}function Lt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Mt(e){return function(t){return function(t){for(var e=1;eArtPlayer 3.1.18'})}function It(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Ft(t){return function(e){return function(t){for(var e=1;e".concat(e,"

")}).join("")),this.art.emit("subtitle:update",e)}},{key:"switch",value:function(e,t){var n=this,r=1\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},e.option.icons);Object.keys(r).forEach(function(e){var t=document.createElement("i");t.classList.add("art-icon"),t.classList.add("art-icon-".concat(e)),ve(t,r[e]),n[e]=t})}var Ht=function(){function n(e){var t=this;u(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),e.whitelist.state&&e.once("video:canplay",function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],function(e){-1'.concat(t.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(e,t){var n=t.target.dataset.value;n&&(r.flip=n)},mounted:function(n){e.on("flipChange",function(t){var e=pe("button",n).find(function(e){return e.dataset.value===t});e&&Oe(e.parentElement,"current")})}})}}function Kt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function en(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(t.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(e,t){var n=t.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(n){e.on("aspectRatioChange",function(t){var e=pe("button",n).find(function(e){return e.dataset.value===t});e&&Oe(e.parentElement,"current")})}})}}function tn(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function nn(t){return function(r){var e=r.i18n,o=r.player,i=r.events.proxy;return function(t){for(var e=1;e\n '.concat(e.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(e){var t=fe(".art-setting-range input",e),n=fe(".art-subtitle-value",e);i(t,"change",function(){var e=t.value;n.innerText=e,o.playbackRate=Number(e)}),r.on("playbackRateChange",function(e){t.value!==e&&(t.value=e,n.innerText=e)})}})}}var rn=function(){function n(e){var t=this;u(this,n),this.id=0,this.art=e,this.state=!1,e.option.setting&&(this.art.on("ready",function(){t.init()}),this.art.on("blur",function(){t.show=!1}))}return s(n,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",function(e){e.target===r&&(t.show=!1)}),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(en({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(nn({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(e,t){this.id+=1;var n=this.art.template.$settingBody;return ot(this.art,this,n,e,t,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,de(t,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,ye(t,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),n}(),on=function(){function r(e){u(this,r),this.art=e,this.name="artplayer_settings";var t=e.option,n=this.get("volume");n&&(t.volume=n)}return s(r,[{key:"get",value:function(e){var t=JSON.parse(window.localStorage.getItem(this.name))||{};return e?t[e]:{}}},{key:"set",value:function(e,t){var n=Object.assign({},this.get(),c({},e,t));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(e){var t=this.get();delete t[e],window.localStorage.setItem(this.name,JSON.stringify(t))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),r}();function an(r){var e=r.i18n,o=r.subtitle,i=r.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(e){var t=fe(".art-setting-range input",e),n=fe(".art-subtitle-value",e);i(t,"change",function(){var e=t.value;n.innerText=e,r.plugins.subtitleOffset.offset(Number(e))}),r.on("subtitle:switch",function(){t.value=0,n.innerText=0}),r.on("artplayerPluginSubtitleOffset",function(e){o.update(),t.value!==e&&(t.value=e,n.innerText=e)})}}}function cn(r){var o=r.constructor.utils.clamp,e=r.setting,i=r.notice,a=r.template,c=r.i18n,u=r.player;c.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),e.add(an);var s=[];return r.on("subtitle:switch",function(){s=[]}),{name:"subtitleOffset",offset:function(e){if(a.$track&&a.$track.track){var t=Array.from(a.$track.track.cues),n=o(e,-5,5);t.forEach(function(e,t){s[t]||(s[t]={startTime:e.startTime,endTime:e.endTime}),e.startTime=o(s[t].startTime+n,0,u.duration),e.endTime=o(s[t].endTime+n,0,u.duration)}),i.show("".concat(c.get("Subtitle offset time"),": ").concat(e,"s")),r.emit("artplayerPluginSubtitleOffset",e)}else i.show("".concat(c.get("No subtitles found"))),r.emit("artplayerPluginSubtitleOffset",0)}}}function un(e){var n=e.events.proxy,r=e.template,o=e.player;function i(e){if(e){var t=r.$video.canPlayType(e.type);if("maybe"===t||"probably"===t){var n=URL.createObjectURL(e);o.switchUrl(n,e.name)}else Se(!1,"Playback of this file format is not supported")}}return n(r.$player,"dragover",function(e){e.preventDefault()}),n(r.$player,"drop",function(e){e.preventDefault(),i(e.dataTransfer.files[0])}),{name:"localVideo",attach:function(e){var t=ve(e,'');me(e,"position","relative"),ge(t,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(t,"change",function(){i(t.files[0])})}}}function sn(e){var n=e.events.proxy,c=e.subtitle;return{name:"localSubtitle",attach:function(e){var t=ve(e,'');me(e,"position","relative"),ge(t,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(t,"change",function(){!function(i){if(i){var a=Ce(i.name);if(["ass","vtt","srt"].includes(a)){var e=new FileReader;n(e,"load",function(e){var t=e.target.result;switch(a){case"srt":var n=Re(Ee(t));c.switch(n,i.name);break;case"ass":var r=Re($e(t));c.switch(r,i.name);break;case"vtt":var o=Re(t);c.switch(o,i.name)}}),e.readAsText(i)}else Se(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(t.files[0])})}}}function ln(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("controls:show",function(){e.style.display="none"}),t.on("destroy",function(){e.style.display="none"}),t.on("controls:hide",function(){e.style.display="block"}),t.on("video:timeupdate",function(){e.style.width="".concat(100*n.played,"%")})}}),{name:"miniProgressBar"}}function fn(r){var o=1e4,i=0,a=0,c=0,e=null;function t(){c=a=i=0,cancelAnimationFrame(e),e=null}function n(){e||!function n(){r.isDestroy||(e=requestAnimationFrame(function(){var e=Date.now();if(c){var t=e-c;a+=t,r.player.playing||(i+=t)}c=e,r.emit("networkMonitor",i/a),o<=a&&(a=i=0),n()}))}()}return r.on("play",n),r.on("pause",t),{name:"networkMonitor",reset:t,start:n,sample:function(e){o=e}}}function pn(t){var e=t.events,n=t.player,r=t.template,o=Ne(function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))},300);return e.proxy(window,"scroll",o),{name:"autoPip"}}function dn(t){u(this,dn);var n=t.option,r=t.events.proxy,o=t.template.$video;Je.video.events.forEach(function(e){r(o,e,function(e){t.emit("video:".concat(e.type),e)})}),Object.keys(n.moreVideoAttr).forEach(function(e){o[e]=n.moreVideoAttr[e]}),n.muted&&(o.muted=n.muted),n.volume&&(o.volume=Ue(n.volume,0,1)),n.poster&&(o.poster=n.poster),n.autoplay&&(o.autoplay=n.autoplay),o.controls=!0;var e=n.type||Ce(n.url),i=n.customType[e];e&&i?(t.emit("beforeCustomType",e),i(o,n.url,t),t.emit("afterCustomType",e)):(t.emit("beforeAttachUrl",n.url),o.src=n.url,t.emit("afterAttachUrl",o.src))}var yn=function(){function r(e){var t=this;u(this,r),this.art=e,this.id=0;var n=e.option;n.subtitle.url&&n.subtitleOffset&&this.add(cn),!n.isLive&&n.miniProgressBar&&this.add(ln),n.localVideo&&this.add(un),n.localSubtitle&&this.add(sn),n.networkMonitor&&this.add(fn),n.autoPip&&this.add(pn),e.option.plugins.forEach(function(e){t.add(e)})}return s(r,[{key:"add",value:function(e){this.id+=1;var t=e.call(this,this.art),n="";return Se(!qe(this,n=t&&t.name?t.name:e.name?e.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:t}),this.art.emit("plugin:add",e),this}}]),r}(),hn=0,vn=function(){function n(e){var t;return u(this,n),(t=f(this,p(n).call(this))).option=se(Fe(n.option,e),Ze),t.isFocus=!1,t.isDestroy=!1,t.whitelist=new Xe(l(t)),t.template=new Ge(l(t)),t.events=new Ht(l(t)),t.whitelist.state?(t.storage=new on(l(t)),t.icons=new Ut(l(t)),t.i18n=new et(l(t)),t.notice=new Zt(l(t)),t.player=new rt(l(t)),t.layers=new Yt(l(t)),t.controls=new Ct(l(t)),t.contextmenu=new Wt(l(t)),t.subtitle=new Vt(l(t)),t.info=new Nt(l(t)),t.loading=new Xt(l(t)),t.hotkey=new Bt(l(t)),t.mask=new Jt(l(t)),t.setting=new rn(l(t)),t.plugins=new yn(l(t))):t.mobile=new dn(l(t)),hn+=1,t.id=hn,n.instances.push(l(t)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),t}return t(n,le),s(n,[{key:"destroy",value:function(e){var t=!(0=0||(o[n]=e[n]);return o};var t=function(t,n){if(null==t)return{};var r,o,i=e(t,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i};var n=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function r(e,t){return e(t={exports:{}},t.exports),t.exports}var o=r((function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(r){return"function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?e.exports=n=function(e){return t(e)}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":t(e)},n(r)}e.exports=n}));var i=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function a(e,t){for(var n=0;nY.length&&Y.push(e)}function J(e,t,n){return null==e?0:function e(t,n,r,o){var i=typeof t;"undefined"!==i&&"boolean"!==i||(t=null);var a=!1;if(null===t)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case b:case w:a=!0}}if(a)return r(o,t,""===n?"."+G(t,0):n),1;if(a=0,n=""===n?".":n+":",Array.isArray(t))for(var c=0;c1?t-1:0),r=1;r2?n-2:0),o=2;o2?n-2:0),o=2;o8)throw new Error("warningWithoutStack() currently supports at most 8 arguments.");if(!e){if("undefined"!=typeof console){var i=r.map((function(e){return""+e}));i.unshift("Warning: "+t),Function.prototype.apply.call(console.error,console,i)}try{var a=0,c="Warning: "+t.replace(/%s/g,(function(){return r[a++]}));throw new Error(c)}catch(e){}}},E={};function R(e,t){var n=e.constructor,r=n&&(n.displayName||n.name)||"ReactClass",o=r+"."+t;E[o]||(S(!1,"Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",t,r),E[o]=!0)}var $={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,n){R(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,r){R(e,"replaceState")},enqueueSetState:function(e,t,n,r){R(e,"setState")}},C={};function D(e,t,n){this.props=e,this.context=t,this.refs=C,this.updater=n||$}Object.freeze(C),D.prototype.isReactComponent={},D.prototype.setState=function(e,t){!function(){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw j(Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."))}(),this.updater.enqueueSetState(this,e,t,"setState")},D.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var T={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},_=function(e,t){Object.defineProperty(D.prototype,e,{get:function(){x(!1,"%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var A in T)T.hasOwnProperty(A)&&_(A,T[A]);function L(){}function M(e,t,n){this.props=e,this.context=t,this.refs=C,this.updater=n||$}L.prototype=D.prototype;var z=M.prototype=new L;z.constructor=M,t(z,D.prototype),z.isPureReactComponent=!0;var q={current:null},I={suspense:null},F={current:null},W=/^(.*)[\\\/]/,N=1;function V(e){if(null==e)return null;if("number"==typeof e.tag&&S(!1,"Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case a:return"Fragment";case i:return"Portal";case u:return"Profiler";case c:return"StrictMode";case d:return"Suspense";case y:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case l:return"Context.Consumer";case s:return"Context.Provider";case p:return r=e,o=e.render,f="ForwardRef",m=o.displayName||o.name||"",r.displayName||(""!==m?f+"("+m+")":f);case h:return V(e.type);case v:var t=(n=e)._status===N?n._result:null;if(t)return V(t)}var n,r,o,f,m;return null}var U={},H=null;function B(e){H=e}U.getCurrentStack=null,U.getStackAddendum=function(){var e="";if(H){var t=V(H.type),n=H._owner;e+=function(e,t,n){var r="";if(t){var o=t.fileName,i=o.replace(W,"");if(/^index\./.test(i)){var a=o.match(W);if(a){var c=a[1];if(c)i=c.replace(W,"")+"/"+i}}r=" (at "+i+":"+t.lineNumber+")"}else n&&(r=" (created by "+n+")");return"\n in "+(e||"Unknown")+r}(t,H._source,n&&V(n.type))}var r=U.getCurrentStack;return r&&(e+=r()||""),e};var Y={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:I,ReactCurrentOwner:F,IsSomeRendererActing:{current:!1},assign:t};t(Y,{ReactDebugCurrentFrame:U,ReactComponentTreeHook:{}});var X=function(e,t){if(!e){for(var n=Y.ReactDebugCurrentFrame,r=n.getStackAddendum(),o=arguments.length,i=Array(o>2?o-2:0),a=2;a1){for(var l=Array(s),f=0;f1){for(var d=Array(p),y=0;y.")}return t}(t);if(!Pe[n]){Pe[n]=!0;var r="";e&&e._owner&&e._owner!==F.current&&(r=" It was passed a child from "+V(e._owner.type)+"."),B(e),X(!1,'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',n,r),B(null)}}}function Se(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n",u=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,X(!1,"React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,u)}var f=ne.apply(this,arguments);if(null==f)return f;if(c)for(var p=2;p is not supported and will be removed in a future major release. Did you mean to render instead?")),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||(r=!0,X(!1,"Rendering is not supported and will be removed in a future major release. Did you mean to render instead?")),n.Consumer}}}),n.Consumer=i,n._currentRenderer=null,n._currentRenderer2=null,n},forwardRef:function(e){return null!=e&&e.$$typeof===h?S(!1,"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?S(!1,"forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&S(!1,"forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null!=e.defaultProps||null!=e.propTypes)&&S(!1,"forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"),{$$typeof:p,render:e}},lazy:function(e){var t={$$typeof:v,_ctor:e,_status:-1,_result:null},n=void 0,r=void 0;return Object.defineProperties(t,{defaultProps:{configurable:!0,get:function(){return n},set:function(e){X(!1,"React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(t,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){X(!1,"React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),r=e,Object.defineProperty(t,"propTypes",{enumerable:!0})}}}),t},memo:function(e,t){return we(e)||S(!1,"memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e),{$$typeof:h,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return Oe().useCallback(e,t)},useContext:function(e,t){var n=Oe();if(void 0!==t&&X(!1,"useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&Array.isArray(arguments[2])?"\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://fb.me/rules-of-hooks":""),void 0!==e._context){var r=e._context;r.Consumer===e?X(!1,"Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&X(!1,"Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},useEffect:function(e,t){return Oe().useEffect(e,t)},useImperativeHandle:function(e,t,n){return Oe().useImperativeHandle(e,t,n)},useDebugValue:function(e,t){return Oe().useDebugValue(e,t)},useLayoutEffect:function(e,t){return Oe().useLayoutEffect(e,t)},useMemo:function(e,t){return Oe().useMemo(e,t)},useReducer:function(e,t,n){return Oe().useReducer(e,t,n)},useRef:function(e){return Oe().useRef(e)},useState:function(e){return Oe().useState(e)},Fragment:a,Profiler:u,StrictMode:c,Suspense:d,unstable_SuspenseList:y,createElement:Re,cloneElement:function(e,t,n){for(var r=re.apply(this,arguments),o=2;o1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document).querySelector(e)}function me(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(t.querySelectorAll(e))}function ge(e,t){return e.classList.add(t)}function be(e,t){return e.classList.remove(t)}function we(e,t){return e.classList.contains(t)}function Oe(e,t){return t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function ke(e,t,n){return e.style[t]=n,e}function je(e,t){return Object.keys(t).forEach((function(n){ke(e,n,t[n])})),e}function Pe(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(e,null).getPropertyValue(t);return n?parseFloat(r):r}function xe(e){return Array.from(e.parentElement.children).filter((function(t){return t!==e}))}function Se(e,t){xe(e).forEach((function(e){return be(e,t)})),ge(e,t)}function Ee(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";e.setAttribute("aria-label",t),e.setAttribute("data-balloon-pos",n)}var Re=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},$e=r((function(e){function t(n,r,o){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?e.exports=t=function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&f(o,n.prototype),o}:e.exports=t=Reflect.construct,t.apply(null,arguments)}e.exports=t})),Ce=function(e){function t(e,n){var r;return i(this,t),r=s(this,l(t).call(this,e)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(u(r),n||r.constructor),r.name="ArtPlayerError",r}return p(t,e),t}(r((function(e){function t(n){var r="function"==typeof Map?new Map:void 0;return e.exports=t=function(e){if(null===e||!Re(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return $e(e,arguments,l(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),f(t,e)},t(n)}e.exports=t}))(Error));function De(e,t){if(!e)throw new Ce(t);return e}function Te(e){return"WEBVTT \r\n\r\n".concat(e.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function _e(e){return URL.createObjectURL(new Blob([e],{type:"text/vtt"}))}function Ae(e){var t=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(e,t,n){if(t===n.length-1){if(1===e.length)return".".concat(e,"00");if(2===e.length)return".".concat(e,"0")}else if(1===e.length)return(0===t?"0":":0")+e;return 0===t?e:t===n.length-1?".".concat(e):":".concat(e)})).join("")}return"WEBVTT\n\n".concat(e.split(/\r?\n/).map((function(e){var r=e.match(t);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(e){return e.trim()})).join("\n")}:null})).filter((function(e){return e})).map((function(e,t){return e?"".concat(t+1,"\n").concat(e.start," --\x3e ").concat(e.end,"\n").concat(e.text):""})).filter((function(e){return e.trim()})).join("\n\n"))}function Le(e){return e.includes("?")?Le(e.split("?")[0]):e.includes("#")?Le(e.split("#")[0]):e.trim().toLowerCase().split(".").pop()}function Me(e,t){var n=document.createElement("a");n.style.display="none",n.href=e,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var ze=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(t){return setTimeout(t,e)}))}function He(e,t,n){var r;function o(){for(var o=arguments.length,i=new Array(o),a=0;a0?[t,n,r]:[n,r]).map((function(e){return e<10?"0".concat(e):String(e)})).join(":")}var Ze=Object.freeze({__proto__:null,query:ve,queryAll:me,addClass:ge,removeClass:be,hasClass:we,append:Oe,remove:function(e){return e.parentNode.removeChild(e)},setStyle:ke,setStyles:je,getStyle:Pe,sublings:xe,inverseClass:Se,tooltip:Ee,ArtPlayerError:Ce,errorHandle:De,srtToVtt:Te,vttToBlob:_e,assToVtt:Ae,getExt:Le,downloadFile:Me,hasOwnProperty:We,proxyPropertys:Ne,mergeDeep:Ve,sleep:Ue,debounce:He,throttle:Be,clamp:Ye,secondToTime:Xe});function Je(e,t,n){return De("string"===t||e instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Ge={container:Je,url:"string|function",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Je,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Je,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:Je,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(e,t,n){var r=["top","left","right"];return De(r.includes(e),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},Qe={video:{propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]}},Ke=function e(t){var n=this;i(this,e);var r=t.constructor.kindOf,o=t.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(e){switch(r(e)){case"string":return n.userAgent.indexOf(e)>-1;case"function":return e(n.userAgent);case"regexp":return e.test(n.userAgent);default:return!1}}))},et=function(){function e(t){var n=this;i(this,e),this.art=t,t.option.container instanceof Element?this.$container=t.option.container:(this.$container=ve(t.option.container),De(this.$container,"No container element found by ".concat(t.option.container))),De(t.constructor.instances.every((function(e){return e.template.$container!==n.$container})),"Cannot mount multiple instances on the same dom element"),De(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),t.whitelist.state?this.initDesktop():this.initMobile()}return c(e,[{key:"query",value:function(e){return ve(e,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(e){e?this.$container.innerHTML="":ge(this.$player,"artplayer-destroy")}}]),e}(),tt={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},nt={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},rt=function(){function e(t){i(this,e),this.art=t,this.languages={"zh-cn":tt,"zh-tw":nt},this.init()}return c(e,[{key:"init",value:function(){var e=this.art.option.lang.toLowerCase();this.language=this.languages[e]||{}}},{key:"get",value:function(e){return this.language[e]||e}},{key:"update",value:function(e){this.languages=Ve(this.languages,e),this.init()}}]),e}();var ot=r((function(e){ +/*! + * screenfull + * v5.0.0 - 2019-09-09 + * (c) Sindre Sorhus; MIT License + */ +!function(){var t="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=e.exports,r=function(){for(var e,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,o=n.length,i={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==i.$video.src){URL.revokeObjectURL(i.$video.src);var u=t.currentTime,s=t.playing;return t.attachUrl(a).then((function(){o.url=a,t.playbackRate=!1,t.aspectRatio=!1,e.on("ready",(function(){t.currentTime=u})),s&&(t.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),e.emit("switch",a)}))}return null}}),Object.defineProperty(t,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==i.$video.src){URL.revokeObjectURL(i.$video.src);var u=t.playing;return t.attachUrl(a).then((function(){o.url=a,t.playbackRate=!1,t.aspectRatio=!1,e.on("ready",(function(){t.currentTime=0})),u&&(t.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),e.emit("switch",a)}))}return null}})}(t,this),function(e,t){var n=e.template,r=n.$video,o=n.$player,i=e.i18n,a=e.notice;Object.defineProperty(t,"playbackRate",{get:function(){return o.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if(De(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===o.dataset.playbackRate)return;r.playbackRate=n,o.dataset.playbackRate=n,a.show("".concat(i.get("Rate"),": ").concat(1===n?i.get("Normal"):"".concat(n,"x"))),e.emit("playbackRateChange",n)}else t.playbackRate&&(t.playbackRate=1,delete o.dataset.playbackRate,e.emit("playbackRateRemove"))}}),Object.defineProperty(t,"playbackRateReset",{set:function(n){if(n){var r=o.dataset.playbackRate;r&&(t.playbackRate=Number(r),e.emit("playbackRateReset"))}}})}(t,this),function(e,t){var n=e.template,r=n.$video,o=n.$player,i=e.i18n,a=e.notice;Object.defineProperty(t,"aspectRatio",{get:function(){return o.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if(De(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)t.aspectRatio=!1;else{var u=n.split(":"),s=r.videoWidth,l=r.videoHeight,f=o.clientWidth,p=o.clientHeight,d=s/l,y=u[0]/u[1];if(d>y){var h=y*l/s;ke(r,"width","".concat(100*h,"%")),ke(r,"height","100%"),ke(r,"padding","0 ".concat((f-f*h)/2,"px"))}else{var v=s/y/l;ke(r,"width","100%"),ke(r,"height","".concat(100*v,"%")),ke(r,"padding","".concat((p-p*v)/2,"px 0"))}}o.dataset.aspectRatio=n,a.show("".concat(i.get("Aspect ratio"),": ").concat("default"===n?i.get("Default"):n)),e.emit("aspectRatioChange",n)}else t.aspectRatio&&(ke(r,"width",null),ke(r,"height",null),ke(r,"padding",null),delete o.dataset.aspectRatio,e.emit("aspectRatioRemove"))}}),Object.defineProperty(t,"aspectRatioReset",{set:function(n){if(n&&t.aspectRatio){var r=t.aspectRatio;t.aspectRatio=r,e.emit("aspectRatioReset")}}})}(t,this),function(e,t){var n=e.option,r=e.notice,o=e.template.$video;Object.defineProperty(t,"getScreenshotDataURL",{value:function(){try{var e=document.createElement("canvas");return e.width=o.videoWidth,e.height=o.videoHeight,e.getContext("2d").drawImage(o,0,0),e.toDataURL("image/png")}catch(e){throw r.show(e),e}}}),Object.defineProperty(t,"getScreenshotBlobUrl",{value:function(){return new Promise((function(e,t){try{var n=document.createElement("canvas");n.width=o.videoWidth,n.height=o.videoHeight,n.getContext("2d").drawImage(o,0,0),n.toBlob((function(t){e(URL.createObjectURL(t))}))}catch(e){r.show(e),t(e)}}))}}),Object.defineProperty(t,"screenshot",{value:function(){var r=t.getScreenshotDataURL();r&&(Me(r,"".concat(n.title||"artplayer","_").concat(Xe(o.currentTime),".png")),e.emit("screenshot",r))}})}(t,this),function(e,t){var n=e.i18n,r=e.notice,o=e.events.destroyEvents,i=e.template.$player,a=function(){e.emit("fullscreen:change",ot.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};t.fullscreenIsEnabled&&(ot.on("change",a),ot.on("error",c),o.push((function(){ot.off("change",a),ot.off("error",c)}))),Object.defineProperty(t,"fullscreen",{get:function(){return ot.isFullscreen},set:function(n){t.fullscreenIsEnabled?n?(t.fullscreenWeb&&(t.fullscreenWeb=!1),ot.request(i).then((function(){ge(i,"artplayer-fullscreen"),t.aspectRatioReset=!0,e.emit("fullscreen:enabled")}))):(t.fullscreenWeb&&(t.fullscreenWeb=!1),ot.exit().then((function(){be(i,"artplayer-fullscreen"),t.aspectRatioReset=!0,e.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(t,"fullscreenToggle",{set:function(e){e&&(t.fullscreen=!t.fullscreen)}}),Object.defineProperty(t,"fullscreenIsEnabled",{get:function(){return ot.isEnabled}})}(t,this),function(e,t){var n=e.template.$player;Object.defineProperty(t,"fullscreenWeb",{get:function(){return we(n,"artplayer-web-fullscreen")},set:function(r){r?(t.fullscreen&&(t.fullscreen=!1),ge(n,"artplayer-web-fullscreen"),t.aspectRatioReset=!0,e.emit("fullscreenWeb:enabled")):(t.fullscreen&&(t.fullscreen=!1),be(n,"artplayer-web-fullscreen"),t.aspectRatioReset=!0,e.emit("fullscreenWeb:exit"))}}),Object.defineProperty(t,"fullscreenWebToggle",{set:function(e){e&&(t.fullscreenWeb=!t.fullscreenWeb)}})}(t,this),it(t,this),function(e,t){var n=e.template.$video;Object.defineProperty(t,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(t,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(t,this),function(e,t){Object.defineProperty(t,"played",{get:function(){return e.template.$video.currentTime/e.template.$video.duration}})}(t,this),function(e,t){var n=e.template.$video;Object.defineProperty(t,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(t,this),function(e,t){var n=e.template,r=n.$container,o=n.$player,i=n.$video;Object.defineProperty(t,"autoSize",{get:function(){return we(r,"artplayer-auto-size")},set:function(t){if(t){var n=i.videoWidth,a=i.videoHeight,c=r.getBoundingClientRect(),u=c.width,s=c.height,l=n/a,f=u/s;if(ge(r,"artplayer-auto-size"),f>l){ke(o,"width","".concat(s*l/u*100,"%")),ke(o,"height","100%")}else{var p=u/l/s*100;ke(o,"width","100%"),ke(o,"height","".concat(p,"%"))}e.emit("autoSizeChange")}else be(r,"artplayer-auto-size"),ke(o,"width",null),ke(o,"height",null),e.emit("autoSizeRemove")}})}(t,this),function(e,t){Object.defineProperty(t,"rect",{get:function(){return e.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(e){Object.defineProperty(t,e,{get:function(){return t.rect[e]}})})),Object.defineProperty(t,"x",{get:function(){return t.left+window.pageXOffset}}),Object.defineProperty(t,"y",{get:function(){return t.top+window.pageYOffset}})}(t,this),function(e,t){Object.defineProperty(t,"flip",{get:function(){return e.template.$player.dataset.flip},set:function(t){if(t){var n=["normal","horizontal","vertical"];De(n.includes(t),"'flip' only accept ".concat(n.toString()," as parameters")),e.template.$player.dataset.flip=t,e.emit("flipChange",t)}else delete e.template.$player.dataset.flip,e.emit("flipRemove")}})}(t,this),Ne(t,this)};function ct(e,t,n,r,o,i){var a="function"==typeof r?r(e):r;if(a.disable)return{};var c=t.id,u=a.name||"".concat(i).concat(c);De(!We(t,u),"Cannot create a component that already has the same name: ".concat(i," -> ").concat(u));var s=document.createElement("div");s.classList.value="art-".concat(i," art-").concat(i,"-").concat(u),a.html&&Oe(s,a.html),a.style&&je(s,a.style),a.tooltip&&Ee(s,a.tooltip);var l=Array.from(n.children);s.dataset.index=a.index||c;var f=l.find((function(e){return Number(e.dataset.index)>=Number(s.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",s):Oe(n,s),a.click&&e.events.proxy(s,"click",(function(n){n.preventDefault(),a.click.call(e,t,n),e.emit("".concat(i,":click"),s)})),a.mounted&&a.mounted(s,t,e),o&&o(s,t,e),Object.defineProperty(t,u,{value:{get id(){return c},get $ref(){return s},set show(t){t?(ke(s,"display","block"),e.emit("".concat(i,":show"),s)):(ke(s,"display","none"),e.emit("".concat(i,":hide"),s))}}}),e.emit("".concat(i,":add"),a),t[u]}function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function st(e){return function(t){return function(e){for(var t=1;t\n
\n
\n
\n
\n
\n \n '),mounted:function(e){var n=!1,r=ve(".art-progress-loaded",e),i=ve(".art-progress-played",e),u=ve(".art-progress-highlight",e),s=ve(".art-progress-indicator",e),l=ve(".art-progress-tip",e);function f(e,t){"loaded"===e&&ke(r,"width","".concat(100*t,"%")),"played"===e&&(ke(i,"width","".concat(100*t,"%")),ke(s,"left","calc(".concat(100*t,"% - ").concat(Pe(s,"width")/2,"px)")))}o.forEach((function(e){var t=Ye(e.time,0,c.duration)/c.duration*100;Oe(u,''))})),f("loaded",c.loaded),t.on("video:progress",(function(){f("loaded",c.loaded)})),t.on("video:timeupdate",(function(){f("played",c.played)})),t.on("video:ended",(function(){f("played",1)})),a(e,"mousemove",(function(n){ke(l,"display","block"),n.composedPath().indexOf(u)>-1?function(n){var r=mt(t,n).width,o=n.target.dataset.text;l.innerHTML=o;var i=l.clientWidth;r<=i/2?ke(l,"left",0):r>e.clientWidth-i/2?ke(l,"left","".concat(e.clientWidth-i,"px")):ke(l,"left","".concat(r-i/2,"px"))}(n):function(n){var r=mt(t,n),o=r.width,i=r.time;l.innerHTML=i;var a=l.clientWidth;o<=a/2?ke(l,"left",0):o>e.clientWidth-a/2?ke(l,"left","".concat(e.clientWidth-a,"px")):ke(l,"left","".concat(o-a/2,"px"))}(n)})),a(e,"mouseout",(function(){ke(l,"display","none")})),a(e,"click",(function(e){if(e.target!==s){var n=mt(t,e),r=n.second;f("played",n.percentage),c.seek=r}})),a(s,"mousedown",(function(){n=!0})),a(document,"mousemove",(function(e){if(n){var r=mt(t,e),o=r.second,i=r.percentage;ge(s,"art-show-indicator"),f("played",i),c.seek=o}})),a(document,"mouseup",(function(){n&&(n=!1,be(s,"art-show-indicator"))}))}})}}function bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function wt(e){return function(t){return function(e){for(var t=1;t'),l=Oe(s,'
');function f(e){var t=s.getBoundingClientRect(),n=t.left,r=t.width,o=l.getBoundingClientRect().width;return Ye(e.pageX-n-o/2,0,r-o/2)/(r-o)}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(o.muted||0===e)ke(c,"display","none"),ke(u,"display","flex"),ke(l,"left","0");else{var t=((Pe(s,"width")||60)-Pe(l,"width"))*e;ke(c,"display","flex"),ke(u,"display","none"),ke(l,"left","".concat(t,"px"))}}Ee(c,i.get("Mute")),ke(u,"display","none"),p(o.volume),t.on("video:volumechange",(function(){p(o.volume)})),n(c,"click",(function(){o.muted=!0})),n(u,"click",(function(){o.muted=!1})),n(s,"click",(function(e){o.muted=!1,o.volume=f(e)})),n(l,"mousedown",(function(){a=!0})),n(l,"mousemove",(function(e){a&&(o.muted=!1,o.volume=f(e))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function xt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function St(e){return function(t){return function(e){for(var t=1;tr.clientWidth-u/2?ke(e,"left","".concat(r.clientWidth-u,"px")):ke(e,"left","".concat(i-u/2,"px"))}(o))})),i(r,"mouseout",(function(){ke(e,"display","none")}))}})}}function $t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ct(e){return function(t){return function(e){for(var t=1;t'.concat(u.name,"")),l=n.map((function(e,t){return'
').concat(e.name,"
")})).join(""),f=Oe(e,'
'.concat(l,"
"));i(e,(function(){f.style.left="-".concat(Pe(f,"width")/2-e.clientWidth/2,"px")})),o(f,"click",(function(e){var t=Number(e.target.dataset.index),r=n[t],o=r.url,i=r.name;o&&i&&c!==t&&(a.switchQuality(o,i),s.innerHTML=i,c=t)}))}})}}var _t=function(){function e(t){var n=this;i(this,e),this.id=0,this.art=t,this.art.on("ready",(function(){n.init()}))}return c(e,[{key:"init",value:function(){var e=this,t=this.art.option;this.add(gt({name:"progress",disable:t.isLive,position:"top",index:10})),this.add(Rt({name:"thumbnails",disable:!t.thumbnails.url||t.isLive,position:"top",index:20})),this.add(ht({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Pt({name:"volume",disable:!1,position:"left",index:20})),this.add(kt({name:"time",disable:t.isLive,position:"left",index:30})),this.add(Tt({name:"quality",disable:0===t.quality.length,position:"right",index:10})),this.add(Ct({name:"screenshot",disable:!t.screenshot,position:"right",index:20})),this.add(wt({name:"subtitle",disable:!t.subtitle.url,position:"right",index:30})),this.add(St({name:"setting",disable:!t.setting,position:"right",index:40})),this.add(dt({name:"pip",disable:!t.pip,position:"right",index:50})),this.add(ft({name:"fullscreenWeb",disable:!t.fullscreenWeb,position:"right",index:60})),this.add(st({name:"fullscreen",disable:!t.fullscreen,position:"right",index:70})),t.controls.forEach((function(t){e.add(t)}))}},{key:"add",value:function(e,t){var n,r="function"==typeof e?e(this.art):e,o=this.art.template,i=o.$progress,a=o.$controlsLeft,c=o.$controlsRight;switch(r.position){case"top":n=i;break;case"left":n=a;break;case"right":n=c}this.id+=1,De(r.position,"Controls option.position can not be empty");var u=ct(this.art,this,n,r,t,"control");return r.disable||"top"===r.position||u.$ref.firstElementChild&&"I"===u.$ref.firstElementChild.tagName||ge(u.$ref,"art-control-onlyText"),u}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,be(t,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),e}();function At(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Lt(e){return function(t){var r=t.i18n,o=t.player;return function(e){for(var t=1;t0.5\n 0.75\n ').concat(r.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(e,t){var n=t.target.dataset.rate;n&&(o.playbackRate=Number(n),e.show=!1)},mounted:function(e){t.on("playbackRateChange",(function(t){var n=me("span",e).find((function(e){return Number(e.dataset.rate)===t}));n&&Se(n,"current")}))}})}}function Mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zt(e){return function(t){var r=t.i18n,o=t.player;return function(e){for(var t=1;t').concat(r.get("Default"),'\n 4:3\n 16:9\n '),click:function(e,t){var n=t.target.dataset.ratio;n&&(o.aspectRatio=n,e.show=!1)},mounted:function(e){t.on("aspectRatioChange",(function(t){var n=me("span",e).find((function(e){return e.dataset.ratio===t}));n&&Se(n,"current")}))}})}}function qt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function It(e){return function(t){return function(e){for(var t=1;tArtPlayer 3.1.18'})}function Nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Vt(e){return function(t){return function(e){for(var t=1;ts+u&&(y=u-d),i+p>l+c&&(h=c-p),ke(r,"left","".concat(y,"px")),ke(r,"top","".concat(h,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,be(t,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),e}(),Ht=function(){function e(t){var n=this;i(this,e),this.art=t,this.timer=null;var r=t.template,o=r.$infoPanel,a=r.$infoClose,c=t.events.proxy;this.types=me("[data-video]",o),c(a,"click",(function(){n.show=!1})),this.art.on("destroy",(function(){clearTimeout(n.timer)}))}return c(e,[{key:"readInfo",value:function(){var e=this.art.template.$video;this.types.forEach((function(t){var n=e[t.dataset.video];t.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var e=this;this.readInfo(),this.timer=setTimeout((function(){e.readInfo(),e.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,be(t,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),e}(),Bt=function(){function e(t){i(this,e),this.art=t,this.state=!0;var n=t.events.proxy,r=t.option.subtitle;je(t.template.$subtitle,r.style),n(this.textTrack,"cuechange",this.update.bind(this)),r.url&&this.init(r.url)}return c(e,[{key:"update",value:function(){var e=this.art.template.$subtitle;e.innerHTML="",this.activeCue&&(e.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(e){return"

".concat(e,"

")})).join("")),this.art.emit("subtitle:update",e)}},{key:"switch",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,o=r.i18n,i=r.notice;return this.init(e).then((function(e){return i.show("".concat(o.get("Switch subtitle"),": ").concat(n)),t.art.emit("subtitle:switch",e),e}))}},{key:"init",value:function(e){var t=this,n=this.art,r=n.notice,o=n.template,i=o.$subtitle,a=o.$track;return fetch(e).then((function(e){return e.text()})).then((function(t){switch(Le(e)){case"srt":return _e(Te(t));case"ass":return _e(Ae(t));case"vtt":return _e(t);default:return e}})).then((function(e){return i.innerHTML="",t.url===e?e:(URL.revokeObjectURL(t.url),a.src=e,e)})).catch((function(e){throw r.show(e),e}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,be(t,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,ge(t,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),e}();var Yt=function(){function e(t){var n=this;i(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),t.whitelist.state&&t.once("video:canplay",(function(){!function(e,t){var n=e.template.$player;t.proxy(document,["click","contextmenu"],(function(t){t.composedPath().indexOf(n)>-1?(e.isFocus=!0,e.emit("focus")):(e.isFocus=!1,e.emit("blur"))}))}(t,n),function(e,t){var n=e.template.$player;t.hover(n,(function(){ge(n,"artplayer-hover"),e.emit("hoverenter")}),(function(){be(n,"artplayer-hover"),e.emit("hoverleave")}))}(t,n),function(e,t){var n=e.template,r=n.$player,o=n.$video,i=e.player,a=He((function(){ge(r,"artplayer-hide-cursor"),be(r,"artplayer-hover"),e.controls.show=!1}),3e3);e.on("hoverleave",(function(){i.playing&&a()})),t.proxy(r,"mousemove",(function(t){a.clearTimeout(),be(r,"artplayer-hide-cursor"),e.controls.show=!0,!e.player.pip&&i.playing&&t.target===o&&a()}))}(t,n),function(e,t){var n=e.option,r=e.player,o=e.template.$player,i=document.createElement("object");i.setAttribute("aria-hidden","true"),i.setAttribute("tabindex",-1),i.type="text/html",i.data="about:blank";var a=r.width,c=r.height,u=Be((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(e.player.fullscreen||e.player.fullscreenWeb||e.player.pip?e.player.autoSize=!1:e.player.autoSize=!0),e.player.aspectRatioReset=!0,e.emit("resize",{width:r.width,height:r.height}))}),500);t.proxy(i,"load",(function(){t.proxy(i.contentDocument.defaultView,"resize",u)})),o.appendChild(i)}(t,n)}))}return c(e,[{key:"proxy",value:function(e,t,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(t)?t.forEach((function(t){return r.proxy(e,t,n,o)})):(e.addEventListener(t,n,o),this.destroyEvents.push((function(){e.removeEventListener(t,n,o)})))}},{key:"hover",value:function(e,t,n){t&&this.proxy(e,"mouseenter",t),n&&this.proxy(e,"mouseleave",n)}},{key:"loadImg",value:function(e){var t=this;return new Promise((function(n,r){var o;if(e instanceof HTMLImageElement)o=e;else{if("string"!=typeof e)return r(e);(o=new Image).src=e}return o.complete?n(o):(t.proxy(o,"load",(function(){return n(o)})),t.proxy(o,"error",(function(){return r(o)})),e)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(e){return e()}))}}]),e}(),Xt=function(){function e(t){var n=this;i(this,e),this.art=t,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){n.add(27,(function(){t.player.fullscreenWeb&&(t.player.fullscreenWeb=!1)})),n.add(32,(function(){t.player.toggle=!0})),n.add(37,(function(){t.player.seek=t.player.currentTime-5})),n.add(38,(function(){t.player.volume+=.1})),n.add(39,(function(){t.player.seek=t.player.currentTime+5})),n.add(40,(function(){t.player.volume-=.1})),n.init()}))}return c(e,[{key:"add",value:function(e,t){this.keys[e]?this.keys[e].push(t):this.keys[e]=[t]}},{key:"init",value:function(){var e=this;(0,this.art.events.proxy)(window,"keydown",(function(t){if(e.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var o=e.keys[t.keyCode];o&&(t.preventDefault(),o.forEach((function(e){return e()})),e.art.emit("hotkey",t))}}}))}}]),e}(),Zt=function(){function e(t){var n=this;i(this,e),this.id=0,this.art=t,this.add=this.add.bind(this),this.art.on("ready",(function(){n.art.option.layers.forEach((function(e){n.add(e)}))}))}return c(e,[{key:"add",value:function(e,t){this.id+=1;var n=this.art.template.$layers;return ct(this.art,this,n,e,t,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,be(t,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,ge(t,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),e}(),Jt=function(){function e(t){i(this,e),this.art=t,Oe(t.template.$loading,t.icons.loading)}return c(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,be(t,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),e}(),Gt=function(){function e(t){i(this,e),this.art=t,this.timer=null}return c(e,[{key:"show",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,o=this.art.template,i=o.$player,a=o.$noticeInner;this.state=!0,ge(i,"artplayer-notice-show"),a.innerHTML=e instanceof Error?e.message.trim():e,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){t.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var e=this.art.template.$player;this.state=!1,be(e,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),e}(),Qt=function(){function e(t){i(this,e),this.art=t,Oe(t.template.$state,t.icons.state)}return c(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,be(t,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),e}(),Kt=function e(t){var n=this;i(this,e);var r=Object.assign({loading:'\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},t.option.icons);Object.keys(r).forEach((function(e){var t=document.createElement("i");t.classList.add("art-icon"),t.classList.add("art-icon-".concat(e)),Oe(t,r[e]),n[e]=t}))};function en(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function tn(e){return function(t){var r=t.i18n,o=t.player;return function(e){for(var t=1;t'.concat(r.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(e,t){var n=t.target.dataset.value;n&&(o.flip=n)},mounted:function(e){t.on("flipChange",(function(t){var n=me("button",e).find((function(e){return e.dataset.value===t}));n&&Se(n.parentElement,"current")}))}})}}function nn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rn(e){return function(t){var r=t.i18n,o=t.player;return function(e){for(var t=1;t'.concat(r.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(e,t){var n=t.target.dataset.value;n&&(o.aspectRatio=n)},mounted:function(e){t.on("aspectRatioChange",(function(t){var n=me("button",e).find((function(e){return e.dataset.value===t}));n&&Se(n.parentElement,"current")}))}})}}function on(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function an(e){return function(t){var r=t.i18n,o=t.player,i=t.events.proxy;return function(e){for(var t=1;t\n '.concat(r.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(e){var n=ve(".art-setting-range input",e),r=ve(".art-subtitle-value",e);i(n,"change",(function(){var e=n.value;r.innerText=e,o.playbackRate=Number(e)})),t.on("playbackRateChange",(function(e){n.value!==e&&(n.value=e,r.innerText=e)}))}})}}var cn=function(){function e(t){var n=this;i(this,e),this.id=0,this.art=t,this.state=!1,t.option.setting&&(this.art.on("ready",(function(){n.init()})),this.art.on("blur",(function(){n.show=!1})))}return c(e,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,r=t.template.$setting;(0,t.events.proxy)(r,"click",(function(t){t.target===r&&(e.show=!1)})),this.add(tn({disable:!n.flip,name:"flip"})),this.add(rn({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(an({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(e,t){this.id+=1;var n=this.art.template.$settingBody;return ct(this.art,this,n,e,t,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,ge(t,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,be(t,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),e}(),un=function(){function e(t){i(this,e),this.art=t,this.name="artplayer_settings";var n=t.option,r=this.get("volume");r&&(n.volume=r)}return c(e,[{key:"get",value:function(e){var t=JSON.parse(window.localStorage.getItem(this.name))||{};return e?t[e]:{}}},{key:"set",value:function(e,t){var r=Object.assign({},this.get(),n({},e,t));window.localStorage.setItem(this.name,JSON.stringify(r))}},{key:"del",value:function(e){var t=this.get();delete t[e],window.localStorage.setItem(this.name,JSON.stringify(t))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),e}();function sn(e){var t=e.i18n,n=e.subtitle,r=e.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(t.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(t){var o=ve(".art-setting-range input",t),i=ve(".art-subtitle-value",t);r(o,"change",(function(){var t=o.value;i.innerText=t,e.plugins.subtitleOffset.offset(Number(t))})),e.on("subtitle:switch",(function(){o.value=0,i.innerText=0})),e.on("artplayerPluginSubtitleOffset",(function(e){n.update(),o.value!==e&&(o.value=e,i.innerText=e)}))}}}function ln(e){var t=e.constructor.utils.clamp,n=e.setting,r=e.notice,o=e.template,i=e.i18n,a=e.player;i.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(sn);var c=[];return e.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(o.$track&&o.$track.track){var u=Array.from(o.$track.track.cues),s=t(n,-5,5);u.forEach((function(e,n){c[n]||(c[n]={startTime:e.startTime,endTime:e.endTime}),e.startTime=t(c[n].startTime+s,0,a.duration),e.endTime=t(c[n].endTime+s,0,a.duration)})),r.show("".concat(i.get("Subtitle offset time"),": ").concat(n,"s")),e.emit("artplayerPluginSubtitleOffset",n)}else r.show("".concat(i.get("No subtitles found"))),e.emit("artplayerPluginSubtitleOffset",0)}}}function fn(e){var t=e.events.proxy,n=e.template,r=e.player;function o(e){if(e){var t=n.$video.canPlayType(e.type);if("maybe"===t||"probably"===t){var o=URL.createObjectURL(e);r.switchUrl(o,e.name)}else De(!1,"Playback of this file format is not supported")}}return t(n.$player,"dragover",(function(e){e.preventDefault()})),t(n.$player,"drop",(function(e){e.preventDefault(),o(e.dataTransfer.files[0])})),{name:"localVideo",attach:function(e){var n=Oe(e,'');ke(e,"position","relative"),je(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),t(n,"change",(function(){o(n.files[0])}))}}}function pn(e){var t=e.events.proxy,n=e.subtitle;return{name:"localSubtitle",attach:function(e){var r=Oe(e,'');ke(e,"position","relative"),je(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),t(r,"change",(function(){!function(e){if(e){var r=Le(e.name);if(["ass","vtt","srt"].includes(r)){var o=new FileReader;t(o,"load",(function(t){var o=t.target.result;switch(r){case"srt":var i=_e(Te(o));n.switch(i,e.name);break;case"ass":var a=_e(Ae(o));n.switch(a,e.name);break;case"vtt":var c=_e(o);n.switch(c,e.name)}})),o.readAsText(e)}else De(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function dn(e){var t=e.layers,n=e.player,r=e.option.theme;return t.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(t){e.on("controls:show",(function(){t.style.display="none"})),e.on("destroy",(function(){t.style.display="none"})),e.on("controls:hide",(function(){t.style.display="block"})),e.on("video:timeupdate",(function(){t.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function yn(e){var t=1e4,n=0,r=0,o=0,i=null;function a(){n=0,r=0,o=0,cancelAnimationFrame(i),i=null}function c(){i||function a(){e.isDestroy||(i=requestAnimationFrame((function(){var i=Date.now();if(o){var c=i-o;r+=c,e.player.playing||(n+=c)}o=i,e.emit("networkMonitor",n/r),r>=t&&(n=0,r=0),a()})))}()}return e.on("play",c),e.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(e){t=e}}}function hn(e){var t=e.events,n=e.player,r=e.template,o=He((function(){var t=r.$player.getBoundingClientRect();t.top+t.height<=0&&!n.pip?(n.pip=!0,e.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,e.emit("artplayerPluginAutoPip",!1))}),300);return t.proxy(window,"scroll",o),{name:"autoPip"}}var vn=function(){function e(t){var n=this;i(this,e),this.art=t,this.id=0;var r=t.option;r.subtitle.url&&r.subtitleOffset&&this.add(ln),!r.isLive&&r.miniProgressBar&&this.add(dn),r.localVideo&&this.add(fn),r.localSubtitle&&this.add(pn),r.networkMonitor&&this.add(yn),r.autoPip&&this.add(hn),t.option.plugins.forEach((function(e){n.add(e)}))}return c(e,[{key:"add",value:function(e){this.id+=1;var t=e.call(this,this.art),n="";return De(!We(this,n=t&&t.name?t.name:e.name?e.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:t}),this.art.emit("plugin:add",e),this}}]),e}(),mn=function e(t){i(this,e);var n=t.option,r=t.events.proxy,o=t.template.$video;Qe.video.events.forEach((function(e){r(o,e,(function(e){t.emit("video:".concat(e.type),e)}))})),Object.keys(n.moreVideoAttr).forEach((function(e){o[e]=n.moreVideoAttr[e]})),n.muted&&(o.muted=n.muted),n.volume&&(o.volume=Ye(n.volume,0,1)),n.poster&&(o.poster=n.poster),n.autoplay&&(o.autoplay=n.autoplay),o.controls=!0;var a=n.type||Le(n.url),c=n.customType[a];a&&c?(t.emit("beforeCustomType",a),c(o,n.url,t),t.emit("afterCustomType",a)):(t.emit("beforeAttachUrl",n.url),o.src=n.url,t.emit("afterAttachUrl",o.src))},gn=0,bn=function(e){function t(e){var n;return i(this,t),(n=s(this,l(t).call(this))).option=ye(Ve(t.option,e),Ge),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new Ke(u(n)),n.template=new et(u(n)),n.events=new Yt(u(n)),n.whitelist.state?(n.storage=new un(u(n)),n.icons=new Kt(u(n)),n.i18n=new rt(u(n)),n.notice=new Gt(u(n)),n.player=new at(u(n)),n.layers=new Zt(u(n)),n.controls=new _t(u(n)),n.contextmenu=new Ut(u(n)),n.subtitle=new Bt(u(n)),n.info=new Ht(u(n)),n.loading=new Jt(u(n)),n.hotkey=new Xt(u(n)),n.mask=new Qt(u(n)),n.setting=new cn(u(n)),n.plugins=new vn(u(n))):n.mobile=new mn(u(n)),gn+=1,n.id=gn,t.instances.push(u(n)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),n}return p(t,e),c(t,[{key:"destroy",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(e),t.instances.splice(t.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Qe}},{key:"utils",get:function(){return Ze}},{key:"scheme",get:function(){return Ge}},{key:"Emitter",get:function(){return he}},{key:"validator",get:function(){return ye}},{key:"kindOf",get:function(){return ye.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),t}(he);function wn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function On(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return t(this,o),(e=a(this,s(o).call(this))).processing=!1,e.option={},e.setup(Object.assign({},o.DEFAULTS,n)),e.video=o.creatVideo(),e.inputChange=e.inputChange.bind(r(e)),e.ondrop=e.ondrop.bind(r(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",o.ondragover),e.option.fileInput.addEventListener("drop",o.ondrop),e}return l(o,e),n(o,[{key:"ondrop",value:function(t){t.preventDefault();var e=t.dataTransfer.files[0];this.loadVideo(e)}},{key:"setup",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,e);var n=this.option,o=n.fileInput,i=n.delay,r=n.number,a=n.width,s=n.height,u=n.column;if(this.errorHandle(o instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==o.tagName||"file"!==o.type){o.style.position="relative";var l=document.createElement("input");l.type="file",l.style.position="absolute",l.style.width="100%",l.style.height="100%",l.style.left="0",l.style.top="0",l.style.right="0",l.style.bottom="0",l.style.opacity="0",o.appendChild(l),this.option.fileInput=l}return["delay","number","width","height","column"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.delay=d(i,10,1e3),this.option.number=d(r,10,1e3),this.option.width=d(a,10,1e3),this.option.height=d(s,10,1e3),this.option.column=d(u,1,1e3),this}},{key:"inputChange",value:function(){var t=this.option.fileInput.files[0];this.loadVideo(t)}},{key:"loadVideo",value:function(t){var e=this,n=this.option.delay;if(t){var o=this.video.canPlayType(t.type);this.errorHandle("maybe"===o||"probably"===o,"Playback of this file format is not supported: ".concat(t.type));var i=URL.createObjectURL(t);this.videoUrl=i,this.file=t,this.emit("file",this.file),this.video.src=i,p(n).then((function(){e.emit("video",e.video)})).catch((function(t){throw e.emit("error",t.message),t}))}}},{key:"start",value:function(){var t=this,e=this.option,n=e.width,o=e.height,i=e.number,r=e.delay;this.density=i/this.video.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),s=this.creatCanvas(),u=s.getContext("2d");this.emit("canvas",s);var l,c=a.map((function(e,a){return function(){return t.video.currentTime=e.time,new Promise((function(l){p(r).then((function(){u.drawImage(t.video,e.x,e.y,n,o),s.toBlob((function(e){t.thumbnailUrl&&URL.revokeObjectURL(t.thumbnailUrl),t.thumbnailUrl=URL.createObjectURL(e),t.emit("update",t.thumbnailUrl,(a+1)/i),l()}))})).catch((function(t){throw t}))}))}}));return this.processing=!0,(l=c,l.reduce((function(t,e){return t.then(e)}),Promise.resolve())).then((function(){return p(2*r).then((function(){t.processing=!1,t.emit("done")})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))})).catch((function(e){throw t.processing=!1,t.emit("error",e.message),e}))}},{key:"creatScreenshotDate",value:function(){for(var t=this.option,e=t.number,n=t.width,o=t.height,i=t.column,r=this.video.duration/e,a=[r];a.length").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function D(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function T(t){var n=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(t){return(0\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n \n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":m(this.$player,"artplayer-destroy")}}]),n}(),Q={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},tt=function(){function e(t){s(this,e),this.art=t,this.languages={"zh-cn":Q,"zh-tw":K},this.init()}return i(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=H(this.languages,t),this.init()}}]),e}();var et=t(function(t){var o,e,i,r,n;o="undefined"!=typeof window&&void 0!==window.document?window.document:{},e=t.exports,i=function(){for(var t,e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=e.length,i={};n ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&w(u,a.html),a.style&&v(u,a.style),a.tooltip&&k(u,a.tooltip);var l=Array.from(t.children);u.dataset.index=a.index||c;var f=l.find(function(t){return Number(t.dataset.index)>=Number(u.dataset.index)});return f?f.insertAdjacentElement("beforebegin",u):w(t,u),a.click&&e.events.proxy(u,"click",function(t){t.preventDefault(),a.click.call(e,n,t),e.emit("".concat(o,":click"),u)}),a.mounted&&a.mounted(u,n,e),i&&i(u,n,e),Object.defineProperty(n,s,{value:{get id(){return c},get $ref(){return u},set show(t){t?(O(u,"display","block"),e.emit("".concat(o,":show"),u)):(O(u,"display","none"),e.emit("".concat(o,":hide"),u))}}}),e.emit("".concat(o,":add"),a),n[s]}function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(t){return function(a){return function(e){for(var t=1;t\n
\n
\n
\n
\n
\n \n '),mounted:function(o){var i=!1,n=h(".art-progress-loaded",o),r=h(".art-progress-played",o),a=h(".art-progress-highlight",o),c=h(".art-progress-indicator",o),s=h(".art-progress-tip",o);function u(t,e){"loaded"===t&&O(n,"width","".concat(100*e,"%")),"played"===t&&(O(r,"width","".concat(100*e,"%")),O(c,"left","calc(".concat(100*e,"% - ").concat(j(c,"width")/2,"px)")))}e.forEach(function(t){var e=N(t.time,0,p.duration)/p.duration*100;w(a,''))}),u("loaded",p.loaded),l.on("video:progress",function(){u("loaded",p.loaded)}),l.on("video:timeupdate",function(){u("played",p.played)}),l.on("video:ended",function(){u("played",1)}),f(o,"mousemove",function(t){O(s,"display","block"),-1o.clientWidth-r/2?O(s,"left","".concat(o.clientWidth-r,"px")):O(s,"left","".concat(e-r/2,"px"))}(t):function(t){var e=ht(l,t),n=e.width,r=e.time;s.innerHTML=r;var i=s.clientWidth;n<=i/2?O(s,"left",0):n>o.clientWidth-i/2?O(s,"left","".concat(o.clientWidth-i,"px")):O(s,"left","".concat(n-i/2,"px"))}(t)}),f(o,"mouseout",function(){O(s,"display","none")}),f(o,"click",function(t){if(t.target!==c){var e=ht(l,t),n=e.second;u("played",e.percentage),p.seek=n}}),f(c,"mousedown",function(){i=!0}),f(document,"mousemove",function(t){if(i){var e=ht(l,t),n=e.second,r=e.percentage;m(c,"art-show-indicator"),u("played",r),p.seek=n}}),f(document,"mouseup",function(){i&&(i=!1,g(c,"art-show-indicator"))})}})}}function vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mt(t){return function(a){return function(e){for(var t=1;t'),u=w(s,'
');function l(t){var e=s.getBoundingClientRect(),n=e.left,r=e.width,i=u.getBoundingClientRect().width;return N(t.pageX-n-i/2,0,r-i/2)/(r-i)}function f(t){var e=0d.clientWidth-i/2?O(f,"left","".concat(d.clientWidth-i,"px")):O(f,"left","".concat(e-i/2,"px"))}(t))}),e(d,"mouseout",function(){O(f,"display","none")})}})}}function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function St(t){return function(a){return function(e){for(var t=1;t'.concat(i.name,"")),u=o.map(function(t,e){return'
').concat(t.name,"
")}).join(""),l=w(t,'
'.concat(u,"
"));r(t,function(){l.style.left="-".concat(j(l,"width")/2-t.clientWidth/2,"px")}),n(l,"click",function(t){var e=Number(t.target.dataset.index),n=o[e],r=n.url,i=n.name;r&&i&&c!==e&&(a.switchQuality(r,i),s.innerHTML=i,c=e)})}})}}var Dt=function(){function n(t){var e=this;s(this,n),this.id=0,this.art=t,this.art.on("ready",function(){e.init()})}return i(n,[{key:"init",value:function(){var e=this,t=this.art.option;this.add(yt({name:"progress",disable:t.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!t.thumbnails.url||t.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:t.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===t.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!t.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!t.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!t.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!t.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!t.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!t.fullscreen,position:"right",index:70})),t.controls.forEach(function(t){e.add(t)})}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,$(r.position,"Controls option.position can not be empty");var s=it(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||m(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,g(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),n}();function Tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ct(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t0.5\n 0.75\n ').concat(e.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(n){t.on("playbackRateChange",function(e){var t=y("span",n).find(function(t){return Number(t.dataset.rate)===e});t&&P(t,"current")})}})}}function At(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lt(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t').concat(e.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(n){t.on("aspectRatioChange",function(e){var t=y("span",n).find(function(t){return t.dataset.ratio===e});t&&P(t,"current")})}})}}function Mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zt(t){return function(e){return function(e){for(var t=1;tArtPlayer 3.1.18'})}function Ft(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ht(e){return function(t){return function(e){for(var t=1;t".concat(t,"

")}).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t,e){var n=this,r=1\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},t.option.icons);Object.keys(r).forEach(function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),w(e,r[t]),n[t]=e})}var Ut=function(){function n(t){var e=this;s(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),t.whitelist.state&&t.once("video:canplay",function(){!function(e,t){var n=e.template.$player;t.proxy(document,["click","contextmenu"],function(t){-1'.concat(e.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(n){t.on("flipChange",function(e){var t=y("button",n).find(function(t){return t.dataset.value===e});t&&P(t.parentElement,"current")})}})}}function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function te(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t'.concat(e.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(n){t.on("aspectRatioChange",function(e){var t=y("button",n).find(function(t){return t.dataset.value===e});t&&P(t.parentElement,"current")})}})}}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){return function(r){var t=r.i18n,i=r.player,o=r.events.proxy;return function(e){for(var t=1;t\n '.concat(t.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(t){var e=h(".art-setting-range input",t),n=h(".art-subtitle-value",t);o(e,"change",function(){var t=e.value;n.innerText=t,i.playbackRate=Number(t)}),r.on("playbackRateChange",function(t){e.value!==t&&(e.value=t,n.innerText=t)})}})}}var re=function(){function n(t){var e=this;s(this,n),this.id=0,this.art=t,this.state=!1,t.option.setting&&(this.art.on("ready",function(){e.init()}),this.art.on("blur",function(){e.show=!1}))}return i(n,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,r=t.template.$setting;(0,t.events.proxy)(r,"click",function(t){t.target===r&&(e.show=!1)}),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return it(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,g(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),n}(),ie=function(){function r(t){s(this,r),this.art=t,this.name="artplayer_settings";var e=t.option,n=this.get("volume");n&&(e.volume=n)}return i(r,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),c({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),r}();function oe(r){var t=r.i18n,i=r.subtitle,o=r.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(t.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(t){var e=h(".art-setting-range input",t),n=h(".art-subtitle-value",t);o(e,"change",function(){var t=e.value;n.innerText=t,r.plugins.subtitleOffset.offset(Number(t))}),r.on("subtitle:switch",function(){e.value=0,n.innerText=0}),r.on("artplayerPluginSubtitleOffset",function(t){i.update(),e.value!==t&&(e.value=t,n.innerText=t)})}}}function ae(r){var i=r.constructor.utils.clamp,t=r.setting,o=r.notice,a=r.template,c=r.i18n,s=r.player;c.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),t.add(oe);var u=[];return r.on("subtitle:switch",function(){u=[]}),{name:"subtitleOffset",offset:function(t){if(a.$track&&a.$track.track){var e=Array.from(a.$track.track.cues),n=i(t,-5,5);e.forEach(function(t,e){u[e]||(u[e]={startTime:t.startTime,endTime:t.endTime}),t.startTime=i(u[e].startTime+n,0,s.duration),t.endTime=i(u[e].endTime+n,0,s.duration)}),o.show("".concat(c.get("Subtitle offset time"),": ").concat(t,"s")),r.emit("artplayerPluginSubtitleOffset",t)}else o.show("".concat(c.get("No subtitles found"))),r.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var n=t.events.proxy,r=t.template,i=t.player;function o(t){if(t){var e=r.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var n=URL.createObjectURL(t);i.switchUrl(n,t.name)}else $(!1,"Playback of this file format is not supported")}}return n(r.$player,"dragover",function(t){t.preventDefault()}),n(r.$player,"drop",function(t){t.preventDefault(),o(t.dataTransfer.files[0])}),{name:"localVideo",attach:function(t){var e=w(t,'');O(t,"position","relative"),v(e,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(e,"change",function(){o(e.files[0])})}}}function se(t){var n=t.events.proxy,c=t.subtitle;return{name:"localSubtitle",attach:function(t){var e=w(t,'');O(t,"position","relative"),v(e,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(e,"change",function(){!function(o){if(o){var a=C(o.name);if(["ass","vtt","srt"].includes(a)){var t=new FileReader;n(t,"load",function(t){var e=t.target.result;switch(a){case"srt":var n=D(R(e));c.switch(n,o.name);break;case"ass":var r=D(T(e));c.switch(r,o.name);break;case"vtt":var i=D(e);c.switch(i,o.name)}}),t.readAsText(o)}else $(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(e.files[0])})}}}function ue(e){var t=e.layers,n=e.player,r=e.option.theme;return t.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(t){e.on("controls:show",function(){t.style.display="none"}),e.on("destroy",function(){t.style.display="none"}),e.on("controls:hide",function(){t.style.display="block"}),e.on("video:timeupdate",function(){t.style.width="".concat(100*n.played,"%")})}}),{name:"miniProgressBar"}}function le(r){var i=1e4,o=0,a=0,c=0,t=null;function e(){c=a=o=0,cancelAnimationFrame(t),t=null}function n(){t||!function n(){r.isDestroy||(t=requestAnimationFrame(function(){var t=Date.now();if(c){var e=t-c;a+=e,r.player.playing||(o+=e)}c=t,r.emit("networkMonitor",o/a),i<=a&&(a=o=0),n()}))}()}return r.on("play",n),r.on("pause",e),{name:"networkMonitor",reset:e,start:n,sample:function(t){i=t}}}function fe(e){var t=e.events,n=e.player,r=e.template,i=B(function(){var t=r.$player.getBoundingClientRect();t.top+t.height<=0&&!n.pip?(n.pip=!0,e.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,e.emit("artplayerPluginAutoPip",!1))},300);return t.proxy(window,"scroll",i),{name:"autoPip"}}function pe(e){s(this,pe);var n=e.option,r=e.events.proxy,i=e.template.$video;J.video.events.forEach(function(t){r(i,t,function(t){e.emit("video:".concat(t.type),t)})}),Object.keys(n.moreVideoAttr).forEach(function(t){i[t]=n.moreVideoAttr[t]}),n.muted&&(i.muted=n.muted),n.volume&&(i.volume=N(n.volume,0,1)),n.poster&&(i.poster=n.poster),n.autoplay&&(i.autoplay=n.autoplay),i.controls=!0;var t=n.type||C(n.url),o=n.customType[t];t&&o?(e.emit("beforeCustomType",t),o(i,n.url,e),e.emit("afterCustomType",t)):(e.emit("beforeAttachUrl",n.url),i.src=n.url,e.emit("afterAttachUrl",i.src))}var de=function(){function r(t){var e=this;s(this,r),this.art=t,this.id=0;var n=t.option;n.subtitle.url&&n.subtitleOffset&&this.add(ae),!n.isLive&&n.miniProgressBar&&this.add(ue),n.localVideo&&this.add(ce),n.localSubtitle&&this.add(se),n.networkMonitor&&this.add(le),n.autoPip&&this.add(fe),t.option.plugins.forEach(function(t){e.add(t)})}return i(r,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return $(!W(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),r}(),he=0,ye=function(){function n(t){var e;return s(this,n),(e=u(this,l(n).call(this))).option=p(H(n.option,t),Z),e.isFocus=!1,e.isDestroy=!1,e.whitelist=new Y(o(e)),e.template=new G(o(e)),e.events=new Ut(o(e)),e.whitelist.state?(e.storage=new ie(o(e)),e.icons=new Nt(o(e)),e.i18n=new tt(o(e)),e.notice=new Zt(o(e)),e.player=new rt(o(e)),e.layers=new Xt(o(e)),e.controls=new Dt(o(e)),e.contextmenu=new Vt(o(e)),e.subtitle=new It(o(e)),e.info=new Bt(o(e)),e.loading=new Yt(o(e)),e.hotkey=new _t(o(e)),e.mask=new Jt(o(e)),e.setting=new re(o(e)),e.plugins=new de(o(e))):e.mobile=new pe(o(e)),he+=1,e.id=he,n.instances.push(o(e)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),e}return e(n,d),i(n,[{key:"destroy",value:function(t){var e=!(01?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function y(t,e){return t.classList.add(e)}function v(t,e){return t.classList.remove(e)}function m(t,e){return t.classList.contains(e)}function g(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function b(t,e,n){return t.style[e]=n,t}function w(t,e){return Object.keys(e).forEach((function(n){b(t,n,e[n])})),t}function O(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function j(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function P(t,e){j(t).forEach((function(t){return v(t,e)})),y(t,e)}function k(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var x=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},E=i((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&u(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),S=function(t){function n(t,r){var i;return e(this,n),i=c(this,s(n).call(this,t)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(a(i),r||i.constructor),i.name="ArtPlayerError",i}return l(n,t),n}(i((function(t){function e(n){var r="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!x(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return E(t,arguments,s(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),u(e,t)},e(n)}t.exports=e}))(Error));function $(t,e){if(!t)throw new S(e);return t}function R(t){return"WEBVTT \r\n\r\n".concat(t.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function D(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function T(t){var e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(t,e,n){if(e===n.length-1){if(1===t.length)return".".concat(t,"00");if(2===t.length)return".".concat(t,"0")}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===n.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var r=t.match(e);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(t){return t.trim()})).join("\n")}:null})).filter((function(t){return t})).map((function(t,e){return t?"".concat(e+1,"\n").concat(t.start," --\x3e ").concat(t.end,"\n").concat(t.text):""})).filter((function(t){return t.trim()})).join("\n\n"))}function C(t){return t.includes("?")?C(t.split("?")[0]):t.includes("#")?C(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function A(t,e){var n=document.createElement("a");n.style.display="none",n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var L=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function B(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var _=Object.freeze({__proto__:null,query:d,queryAll:h,addClass:y,removeClass:v,hasClass:m,append:g,remove:function(t){return t.parentNode.removeChild(t)},setStyle:b,setStyles:w,getStyle:O,sublings:j,inverseClass:P,tooltip:k,ArtPlayerError:S,errorHandle:$,srtToVtt:R,vttToBlob:D,assToVtt:T,getExt:C,downloadFile:A,hasOwnProperty:W,proxyPropertys:F,mergeDeep:H,sleep:V,debounce:B,throttle:I,clamp:N,secondToTime:U});function X(t,e,n){return $("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var Y={container:X,url:"string|function",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:X,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:X,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:X,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return $(r.includes(t),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},Z={video:{propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]}},J=function t(n){var r=this;e(this,t);var i=n.constructor.kindOf,o=n.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.userAgent.indexOf(t)>-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},G=function(){function t(n){var r=this;e(this,t),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=d(n.option.container),$(this.$container,"No container element found by ".concat(n.option.container))),$(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),$(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.initDesktop():this.initMobile()}return r(t,[{key:"query",value:function(t){return d(t,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":y(this.$player,"artplayer-destroy")}}]),t}(),Q={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},tt=function(){function t(n){e(this,t),this.art=n,this.languages={"zh-cn":Q,"zh-tw":K},this.init()}return r(t,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=H(this.languages,t),this.init()}}]),t}();var et=i((function(t){ +/*! + * screenfull + * v5.0.0 - 2019-09-09 + * (c) Sindre Sorhus; MIT License + */ +!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,i=n.length,o={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.currentTime,u=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=s})),u&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}}),Object.defineProperty(e,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=0})),s&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"playbackRate",{get:function(){return i.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if($(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===i.dataset.playbackRate)return;r.playbackRate=n,i.dataset.playbackRate=n,a.show("".concat(o.get("Rate"),": ").concat(1===n?o.get("Normal"):"".concat(n,"x"))),t.emit("playbackRateChange",n)}else e.playbackRate&&(e.playbackRate=1,delete i.dataset.playbackRate,t.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{set:function(n){if(n){var r=i.dataset.playbackRate;r&&(e.playbackRate=Number(r),t.emit("playbackRateReset"))}}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"aspectRatio",{get:function(){return i.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if($(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)e.aspectRatio=!1;else{var s=n.split(":"),u=r.videoWidth,l=r.videoHeight,f=i.clientWidth,p=i.clientHeight,d=u/l,h=s[0]/s[1];if(d>h){var y=h*l/u;b(r,"width","".concat(100*y,"%")),b(r,"height","100%"),b(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;b(r,"width","100%"),b(r,"height","".concat(100*v,"%")),b(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show("".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n)),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(b(r,"width",null),b(r,"height",null),b(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),Object.defineProperty(e,"aspectRatioReset",{set:function(n){if(n&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r,t.emit("aspectRatioReset")}}})}(n,this),function(t,e){var n=t.option,r=t.notice,i=t.template.$video;Object.defineProperty(e,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),t.toDataURL("image/png")}catch(t){throw r.show(t),t}}}),Object.defineProperty(e,"getScreenshotBlobUrl",{value:function(){return new Promise((function(t,e){try{var n=document.createElement("canvas");n.width=i.videoWidth,n.height=i.videoHeight,n.getContext("2d").drawImage(i,0,0),n.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show(t),e(t)}}))}}),Object.defineProperty(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(A(r,"".concat(n.title||"artplayer","_").concat(U(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.i18n,r=t.notice,i=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreen:change",et.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(et.on("change",a),et.on("error",c),i.push((function(){et.off("change",a),et.off("error",c)}))),Object.defineProperty(e,"fullscreen",{get:function(){return et.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),et.request(o).then((function(){y(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:enabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),et.exit().then((function(){v(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),Object.defineProperty(e,"fullscreenIsEnabled",{get:function(){return et.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWeb",{get:function(){return m(n,"artplayer-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),y(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:enabled")):(e.fullscreen&&(e.fullscreen=!1),v(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:exit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),nt(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(n,this),function(t,e){var n=t.template,r=n.$container,i=n.$player,o=n.$video;Object.defineProperty(e,"autoSize",{get:function(){return m(r,"artplayer-auto-size")},set:function(e){if(e){var n=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,u=c.height,l=n/a,f=s/u;if(y(r,"artplayer-auto-size"),f>l){b(i,"width","".concat(u*l/s*100,"%")),b(i,"height","100%")}else{var p=s/l/u*100;b(i,"width","100%"),b(i,"height","".concat(p,"%"))}t.emit("autoSizeChange")}else v(r,"artplayer-auto-size"),b(i,"width",null),b(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})})),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){Object.defineProperty(e,"flip",{get:function(){return t.template.$player.dataset.flip},set:function(e){if(e){var n=["normal","horizontal","vertical"];$(n.includes(e),"'flip' only accept ".concat(n.toString()," as parameters")),t.template.$player.dataset.flip=e,t.emit("flipChange",e)}else delete t.template.$player.dataset.flip,t.emit("flipRemove")}})}(n,this),F(n,this)};function it(t,e,n,r,i,o){var a="function"==typeof r?r(t):r;if(a.disable)return{};var c=e.id,s=a.name||"".concat(o).concat(c);$(!W(e,s),"Cannot create a component that already has the same name: ".concat(o," -> ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&g(u,a.html),a.style&&w(u,a.style),a.tooltip&&k(u,a.tooltip);var l=Array.from(n.children);u.dataset.index=a.index||c;var f=l.find((function(t){return Number(t.dataset.index)>=Number(u.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",u):g(n,u),a.click&&t.events.proxy(u,"click",(function(n){n.preventDefault(),a.click.call(t,e,n),t.emit("".concat(o,":click"),u)})),a.mounted&&a.mounted(u,e,t),i&&i(u,e,t),Object.defineProperty(e,s,{value:{get id(){return c},get $ref(){return u},set show(e){e?(b(u,"display","block"),t.emit("".concat(o,":show"),u)):(b(u,"display","none"),t.emit("".concat(o,":hide"),u))}}}),t.emit("".concat(o,":add"),a),e[s]}function ot(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function at(e){return function(n){return function(e){for(var n=1;n\n
\n
\n
\n
\n
\n \n '),mounted:function(t){var e=!1,r=d(".art-progress-loaded",t),o=d(".art-progress-played",t),s=d(".art-progress-highlight",t),u=d(".art-progress-indicator",t),l=d(".art-progress-tip",t);function f(t,e){"loaded"===t&&b(r,"width","".concat(100*e,"%")),"played"===t&&(b(o,"width","".concat(100*e,"%")),b(u,"left","calc(".concat(100*e,"% - ").concat(O(u,"width")/2,"px)")))}i.forEach((function(t){var e=N(t.time,0,c.duration)/c.duration*100;g(s,''))})),f("loaded",c.loaded),n.on("video:progress",(function(){f("loaded",c.loaded)})),n.on("video:timeupdate",(function(){f("played",c.played)})),n.on("video:ended",(function(){f("played",1)})),a(t,"mousemove",(function(e){b(l,"display","block"),e.composedPath().indexOf(s)>-1?function(e){var r=ht(n,e).width,i=e.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?b(l,"left",0):r>t.clientWidth-o/2?b(l,"left","".concat(t.clientWidth-o,"px")):b(l,"left","".concat(r-o/2,"px"))}(e):function(e){var r=ht(n,e),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?b(l,"left",0):i>t.clientWidth-a/2?b(l,"left","".concat(t.clientWidth-a,"px")):b(l,"left","".concat(i-a/2,"px"))}(e)})),a(t,"mouseout",(function(){b(l,"display","none")})),a(t,"click",(function(t){if(t.target!==u){var e=ht(n,t),r=e.second;f("played",e.percentage),c.seek=r}})),a(u,"mousedown",(function(){e=!0})),a(document,"mousemove",(function(t){if(e){var r=ht(n,t),i=r.second,o=r.percentage;y(u,"art-show-indicator"),f("played",o),c.seek=i}})),a(document,"mouseup",(function(){e&&(e=!1,v(u,"art-show-indicator"))}))}})}}function vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function mt(e){return function(n){return function(e){for(var n=1;n'),l=g(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return N(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)b(c,"display","none"),b(s,"display","flex"),b(l,"left","0");else{var e=((O(u,"width")||60)-O(l,"width"))*t;b(c,"display","flex"),b(s,"display","none"),b(l,"left","".concat(e,"px"))}}k(c,o.get("Mute")),b(s,"display","none"),p(i.volume),n.on("video:volumechange",(function(){p(i.volume)})),e(c,"click",(function(){i.muted=!0})),e(s,"click",(function(){i.muted=!1})),e(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),e(l,"mousedown",(function(){a=!0})),e(l,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),e(document,"mouseup",(function(){a&&(a=!1)}))}})}}function jt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Pt(e){return function(n){return function(e){for(var n=1;nr.clientWidth-s/2?b(t,"left","".concat(r.clientWidth-s,"px")):b(t,"left","".concat(o-s/2,"px"))}(i))})),o(r,"mouseout",(function(){b(t,"display","none")}))}})}}function Et(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function St(e){return function(n){return function(e){for(var n=1;n'.concat(s.name,"")),l=e.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=g(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(O(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var n=Number(t.target.dataset.index),r=e[n],i=r.url,o=r.name;i&&o&&c!==n&&(a.switchQuality(i,o),u.innerHTML=o,c=n)}))}})}}var Dt=function(){function t(n){var r=this;e(this,t),this.id=0,this.art=n,this.art.on("ready",(function(){r.init()}))}return r(t,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(yt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach((function(e){t.add(e)}))}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,$(r.position,"Controls option.position can not be empty");var s=it(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||y(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,v(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),t}();function Tt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ct(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n0.5\n 0.75\n ').concat(r.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(i.playbackRate=Number(n),t.show=!1)},mounted:function(t){n.on("playbackRateChange",(function(e){var n=h("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&P(n,"current")}))}})}}function At(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Lt(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n').concat(r.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(i.aspectRatio=n,t.show=!1)},mounted:function(t){n.on("aspectRatioChange",(function(e){var n=h("span",t).find((function(t){return t.dataset.ratio===e}));n&&P(n,"current")}))}})}}function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function zt(e){return function(n){return function(e){for(var n=1;nArtPlayer 3.1.18'})}function Ft(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ht(e){return function(n){return function(e){for(var n=1;nu+s&&(h=s-d),o+p>l+c&&(y=c-p),b(r,"left","".concat(h,"px")),b(r,"top","".concat(y,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,v(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),t}(),Bt=function(){function t(n){var r=this;e(this,t),this.art=n,this.timer=null;var i=n.template,o=i.$infoPanel,a=i.$infoClose,c=n.events.proxy;this.types=h("[data-video]",o),c(a,"click",(function(){r.show=!1})),this.art.on("destroy",(function(){clearTimeout(r.timer)}))}return r(t,[{key:"readInfo",value:function(){var t=this.art.template.$video;this.types.forEach((function(e){var n=t[e.dataset.video];e.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout((function(){t.readInfo(),t.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,v(e,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),t}(),It=function(){function t(n){e(this,t),this.art=n,this.state=!0;var r=n.events.proxy,i=n.option.subtitle;w(n.template.$subtitle,i.style),r(this.textTrack,"cuechange",this.update.bind(this)),i.url&&this.init(i.url)}return r(t,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return o.show("".concat(i.get("Switch subtitle"),": ").concat(n)),e.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t){var e=this,n=this.art,r=n.notice,i=n.template,o=i.$subtitle,a=i.$track;return fetch(t).then((function(t){return t.text()})).then((function(e){switch(C(t)){case"srt":return D(R(e));case"ass":return D(T(e));case"vtt":return D(e);default:return t}})).then((function(t){return o.innerHTML="",e.url===t?t:(URL.revokeObjectURL(e.url),a.src=t,t)})).catch((function(t){throw r.show(t),t}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,v(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,y(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),t}();var Nt=function(){function t(n){var r=this;e(this,t),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),n.whitelist.state&&n.once("video:canplay",(function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){e.composedPath().indexOf(n)>-1?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){y(n,"artplayer-hover"),t.emit("hoverenter")}),(function(){v(n,"artplayer-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=B((function(){y(r,"artplayer-hide-cursor"),v(r,"artplayer-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),v(r,"artplayer-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a()}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=I((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(t.player.fullscreen||t.player.fullscreenWeb||t.player.pip?t.player.autoSize=!1:t.player.autoSize=!0),t.player.aspectRatioReset=!0,t.emit("resize",{width:r.width,height:r.height}))}),500);e.proxy(o,"load",(function(){e.proxy(o.contentDocument.defaultView,"resize",s)})),i.appendChild(o)}(n,r)}))}return r(t,[{key:"proxy",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(e)?e.forEach((function(e){return r.proxy(t,e,n,i)})):(t.addEventListener(e,n,i),this.destroyEvents.push((function(){t.removeEventListener(e,n,i)})))}},{key:"hover",value:function(t,e,n){e&&this.proxy(t,"mouseenter",e),n&&this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(n,r){var i;if(t instanceof HTMLImageElement)i=t;else{if("string"!=typeof t)return r(t);(i=new Image).src=t}return i.complete?n(i):(e.proxy(i,"load",(function(){return n(i)})),e.proxy(i,"error",(function(){return r(i)})),t)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),t}(),Ut=function(){function t(n){var r=this;e(this,t),this.art=n,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){r.add(27,(function(){n.player.fullscreenWeb&&(n.player.fullscreenWeb=!1)})),r.add(32,(function(){n.player.toggle=!0})),r.add(37,(function(){n.player.seek=n.player.currentTime-5})),r.add(38,(function(){n.player.volume+=.1})),r.add(39,(function(){n.player.seek=n.player.currentTime+5})),r.add(40,(function(){n.player.volume-=.1})),r.init()}))}return r(t,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var t=this;(0,this.art.events.proxy)(window,"keydown",(function(e){if(t.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var i=t.keys[e.keyCode];i&&(e.preventDefault(),i.forEach((function(t){return t()})),t.art.emit("hotkey",e))}}}))}}]),t}(),_t=function(){function t(n){var r=this;e(this,t),this.id=0,this.art=n,this.add=this.add.bind(this),this.art.on("ready",(function(){r.art.option.layers.forEach((function(t){r.add(t)}))}))}return r(t,[{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$layers;return it(this.art,this,n,t,e,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,v(e,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,y(e,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),t}(),Xt=function(){function t(n){e(this,t),this.art=n,g(n.template.$loading,n.icons.loading)}return r(t,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,v(e,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),t}(),Yt=function(){function t(n){e(this,t),this.art=n,this.timer=null}return r(t,[{key:"show",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=this.art.template,o=i.$player,a=i.$noticeInner;this.state=!0,y(o,"artplayer-notice-show"),a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,v(t,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),t}(),Zt=function(){function t(n){e(this,t),this.art=n,g(n.template.$state,n.icons.state)}return r(t,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,v(e,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),t}(),Jt=function t(n){var r=this;e(this,t);var i=Object.assign({loading:'\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},n.option.icons);Object.keys(i).forEach((function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),g(e,i[t]),r[t]=e}))};function Gt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Qt(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n'.concat(r.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(t,e){var n=e.target.dataset.value;n&&(i.flip=n)},mounted:function(t){n.on("flipChange",(function(e){var n=h("button",t).find((function(t){return t.dataset.value===e}));n&&P(n.parentElement,"current")}))}})}}function Kt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function te(e){return function(n){var r=n.i18n,i=n.player;return function(e){for(var n=1;n'.concat(r.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(t,e){var n=e.target.dataset.value;n&&(i.aspectRatio=n)},mounted:function(t){n.on("aspectRatioChange",(function(e){var n=h("button",t).find((function(t){return t.dataset.value===e}));n&&P(n.parentElement,"current")}))}})}}function ee(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ne(e){return function(n){var r=n.i18n,i=n.player,o=n.events.proxy;return function(e){for(var n=1;n\n '.concat(r.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(t){var e=d(".art-setting-range input",t),r=d(".art-subtitle-value",t);o(e,"change",(function(){var t=e.value;r.innerText=t,i.playbackRate=Number(t)})),n.on("playbackRateChange",(function(t){e.value!==t&&(e.value=t,r.innerText=t)}))}})}}var re=function(){function t(n){var r=this;e(this,t),this.id=0,this.art=n,this.state=!1,n.option.setting&&(this.art.on("ready",(function(){r.init()})),this.art.on("blur",(function(){r.show=!1})))}return r(t,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",(function(e){e.target===r&&(t.show=!1)})),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return it(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,v(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),t}(),ie=function(){function n(t){e(this,n),this.art=t,this.name="artplayer_settings";var r=t.option,i=this.get("volume");i&&(r.volume=i)}return r(n,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(e,n){var r=Object.assign({},this.get(),t({},e,n));window.localStorage.setItem(this.name,JSON.stringify(r))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),n}();function oe(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(e){var i=d(".art-setting-range input",e),o=d(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("artplayerPluginSubtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function ae(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;o.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(oe);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show("".concat(o.get("Subtitle offset time"),": ").concat(n,"s")),t.emit("artplayerPluginSubtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var e=t.events.proxy,n=t.template,r=t.player;function i(t){if(t){var e=n.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var i=URL.createObjectURL(t);r.switchUrl(i,t.name)}else $(!1,"Playback of this file format is not supported")}}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),i(t.dataTransfer.files[0])})),{name:"localVideo",attach:function(t){var n=g(t,'');b(t,"position","relative"),w(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){i(n.files[0])}))}}}function se(t){var e=t.events.proxy,n=t.subtitle;return{name:"localSubtitle",attach:function(t){var r=g(t,'');b(t,"position","relative"),w(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){!function(t){if(t){var r=C(t.name);if(["ass","vtt","srt"].includes(r)){var i=new FileReader;e(i,"load",(function(e){var i=e.target.result;switch(r){case"srt":var o=D(R(i));n.switch(o,t.name);break;case"ass":var a=D(T(i));n.switch(a,t.name);break;case"vtt":var c=D(i);n.switch(c,t.name)}})),i.readAsText(t)}else $(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function ue(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("controls:show",(function(){e.style.display="none"})),t.on("destroy",(function(){e.style.display="none"})),t.on("controls:hide",(function(){e.style.display="block"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function le(t){var e=1e4,n=0,r=0,i=0,o=null;function a(){n=0,r=0,i=0,cancelAnimationFrame(o),o=null}function c(){o||function a(){t.isDestroy||(o=requestAnimationFrame((function(){var o=Date.now();if(i){var c=o-i;r+=c,t.player.playing||(n+=c)}i=o,t.emit("networkMonitor",n/r),r>=e&&(n=0,r=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}function fe(t){var e=t.events,n=t.player,r=t.template,i=B((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var pe=function(){function t(n){var r=this;e(this,t),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(ae),!i.isLive&&i.miniProgressBar&&this.add(ue),i.localVideo&&this.add(ce),i.localSubtitle&&this.add(se),i.networkMonitor&&this.add(le),i.autoPip&&this.add(fe),n.option.plugins.forEach((function(t){r.add(t)}))}return r(t,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return $(!W(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),t}(),de=function t(n){e(this,t);var r=n.option,i=n.events.proxy,o=n.template.$video;Z.video.events.forEach((function(t){i(o,t,(function(t){n.emit("video:".concat(t.type),t)}))})),Object.keys(r.moreVideoAttr).forEach((function(t){o[t]=r.moreVideoAttr[t]})),r.muted&&(o.muted=r.muted),r.volume&&(o.volume=N(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||C(r.url),c=r.customType[a];a&&c?(n.emit("beforeCustomType",a),c(o,r.url,n),n.emit("afterCustomType",a)):(n.emit("beforeAttachUrl",r.url),o.src=r.url,n.emit("afterAttachUrl",o.src))},he=0,ye=function(t){function n(t){var r;return e(this,n),(r=c(this,s(n).call(this))).option=f(H(n.option,t),Y),r.isFocus=!1,r.isDestroy=!1,r.whitelist=new J(a(r)),r.template=new G(a(r)),r.events=new Nt(a(r)),r.whitelist.state?(r.storage=new ie(a(r)),r.icons=new Jt(a(r)),r.i18n=new tt(a(r)),r.notice=new Yt(a(r)),r.player=new rt(a(r)),r.layers=new _t(a(r)),r.controls=new Dt(a(r)),r.contextmenu=new Vt(a(r)),r.subtitle=new It(a(r)),r.info=new Bt(a(r)),r.loading=new Xt(a(r)),r.hotkey=new Ut(a(r)),r.mask=new Zt(a(r)),r.setting=new re(a(r)),r.plugins=new pe(a(r))):r.mobile=new de(a(r)),he+=1,r.id=he,n.instances.push(a(r)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),r}return l(n,t),r(n,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),n.instances.splice(n.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Z}},{key:"utils",get:function(){return _}},{key:"scheme",get:function(){return Y}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return f}},{key:"kindOf",get:function(){return f.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),n}(p);function ve(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}return Object.defineProperty(ye,"instances",{value:[]}),{data:function(){return{instance:null}},props:{option:{type:Object,required:!0},getInstance:Function},mounted:function(){this.instance=new ye(function(e){for(var n=1;n").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function R(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function D(t){var n=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(t){return(0\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n \n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":m(this.$player,"artplayer-destroy")}}]),n}(),G={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Q={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K=function(){function e(t){c(this,e),this.art=t,this.languages={"zh-cn":G,"zh-tw":Q},this.init()}return i(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=F(this.languages,t),this.init()}}]),e}();var tt=t(function(t){var o,e,i,r,n;o="undefined"!=typeof window&&void 0!==window.document?window.document:{},e=t.exports,i=function(){for(var t,e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=e.length,i={};n ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&w(u,a.html),a.style&&y(u,a.style),a.tooltip&&P(u,a.tooltip);var l=Array.from(t.children);u.dataset.index=a.index||c;var f=l.find(function(t){return Number(t.dataset.index)>=Number(u.dataset.index)});return f?f.insertAdjacentElement("beforebegin",u):w(t,u),a.click&&e.events.proxy(u,"click",function(t){t.preventDefault(),a.click.call(e,n,t),e.emit("".concat(o,":click"),u)}),a.mounted&&a.mounted(u,n,e),i&&i(u,n,e),Object.defineProperty(n,s,{value:{get id(){return c},get $ref(){return u},set show(t){t?(O(u,"display","block"),e.emit("".concat(o,":show"),u)):(O(u,"display","none"),e.emit("".concat(o,":hide"),u))}}}),e.emit("".concat(o,":add"),a),n[s]}var it=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(t){return function(a){return function(e){for(var t=1;t\n
\n
\n
\n
\n
\n \n '),mounted:function(o){var i=!1,n=d(".art-progress-loaded",o),r=d(".art-progress-played",o),a=d(".art-progress-highlight",o),c=d(".art-progress-indicator",o),s=d(".art-progress-tip",o);function u(t,e){"loaded"===t&&O(n,"width","".concat(100*e,"%")),"played"===t&&(O(r,"width","".concat(100*e,"%")),O(c,"left","calc(".concat(100*e,"% - ").concat(v(c,"width")/2,"px)")))}e.forEach(function(t){var e=I(t.time,0,p.duration)/p.duration*100;w(a,''))}),u("loaded",p.loaded),l.on("video:progress",function(){u("loaded",p.loaded)}),l.on("video:timeupdate",function(){u("played",p.played)}),l.on("video:ended",function(){u("played",1)}),f(o,"mousemove",function(t){O(s,"display","block"),-1o.clientWidth-r/2?O(s,"left","".concat(o.clientWidth-r,"px")):O(s,"left","".concat(e-r/2,"px"))}(t):function(t){var e=ht(l,t),n=e.width,r=e.time;s.innerHTML=r;var i=s.clientWidth;n<=i/2?O(s,"left",0):n>o.clientWidth-i/2?O(s,"left","".concat(o.clientWidth-i,"px")):O(s,"left","".concat(n-i/2,"px"))}(t)}),f(o,"mouseout",function(){O(s,"display","none")}),f(o,"click",function(t){if(t.target!==c){var e=ht(l,t),n=e.second;u("played",e.percentage),p.seek=n}}),f(c,"mousedown",function(){i=!0}),f(document,"mousemove",function(t){if(i){var e=ht(l,t),n=e.second,r=e.percentage;m(c,"art-show-indicator"),u("played",r),p.seek=n}}),f(document,"mouseup",function(){i&&(i=!1,g(c,"art-show-indicator"))})}})}}function vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mt(t){return function(a){return function(e){for(var t=1;t'),u=w(s,'
');function l(t){var e=s.getBoundingClientRect(),n=e.left,r=e.width,i=u.getBoundingClientRect().width;return I(t.pageX-n-i/2,0,r-i/2)/(r-i)}function f(t){var e=0d.clientWidth-i/2?O(f,"left","".concat(d.clientWidth-i,"px")):O(f,"left","".concat(e-i/2,"px"))}(t))}),e(d,"mouseout",function(){O(f,"display","none")})}})}}function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function St(t){return function(a){return function(e){for(var t=1;t'.concat(i.name,"")),u=o.map(function(t,e){return'
').concat(t.name,"
")}).join(""),l=w(t,'
'.concat(u,"
"));r(t,function(){l.style.left="-".concat(v(l,"width")/2-t.clientWidth/2,"px")}),n(l,"click",function(t){var e=Number(t.target.dataset.index),n=o[e],r=n.url,i=n.name;r&&i&&c!==e&&(a.switchQuality(r,i),s.innerHTML=i,c=e)})}})}}var Dt=function(){function n(t){var e=this;c(this,n),this.id=0,this.art=t,this.art.on("ready",function(){e.init()})}return i(n,[{key:"init",value:function(){var e=this,t=this.art.option;this.add(yt({name:"progress",disable:t.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!t.thumbnails.url||t.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:t.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===t.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!t.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!t.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!t.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!t.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!t.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!t.fullscreen,position:"right",index:70})),t.controls.forEach(function(t){e.add(t)})}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,S(r.position,"Controls option.position can not be empty");var s=rt(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||m(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,g(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),n}();function Tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ct(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t0.5\n 0.75\n ').concat(e.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(n){t.on("playbackRateChange",function(e){var t=h("span",n).find(function(t){return Number(t.dataset.rate)===e});t&&j(t,"current")})}})}}function At(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Lt(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t').concat(e.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(n){t.on("aspectRatioChange",function(e){var t=h("span",n).find(function(t){return t.dataset.ratio===e});t&&j(t,"current")})}})}}function Mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zt(t){return function(e){return function(e){for(var t=1;tArtPlayer 3.1.18'})}function Ft(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ht(e){return function(t){return function(e){for(var t=1;t".concat(t,"

")}).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t,e){var n=this,r=1\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},t.option.icons);Object.keys(r).forEach(function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),w(e,r[t]),n[t]=e})}var Ut=function(){function n(t){var e=this;c(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),t.whitelist.state&&t.once("video:canplay",function(){!function(e,t){var n=e.template.$player;t.proxy(document,["click","contextmenu"],function(t){-1'.concat(e.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(n){t.on("flipChange",function(e){var t=h("button",n).find(function(t){return t.dataset.value===e});t&&j(t.parentElement,"current")})}})}}function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function te(n){return function(t){var e=t.i18n,r=t.player;return function(e){for(var t=1;t'.concat(e.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(n){t.on("aspectRatioChange",function(e){var t=h("button",n).find(function(t){return t.dataset.value===e});t&&j(t.parentElement,"current")})}})}}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){return function(r){var t=r.i18n,i=r.player,o=r.events.proxy;return function(e){for(var t=1;t\n '.concat(t.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(t){var e=d(".art-setting-range input",t),n=d(".art-subtitle-value",t);o(e,"change",function(){var t=e.value;n.innerText=t,i.playbackRate=Number(t)}),r.on("playbackRateChange",function(t){e.value!==t&&(e.value=t,n.innerText=t)})}})}}var re=function(){function n(t){var e=this;c(this,n),this.id=0,this.art=t,this.state=!1,t.option.setting&&(this.art.on("ready",function(){e.init()}),this.art.on("blur",function(){e.show=!1}))}return i(n,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,r=t.template.$setting;(0,t.events.proxy)(r,"click",function(t){t.target===r&&(e.show=!1)}),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return rt(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,m(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,g(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),n}(),ie=function(){function r(t){c(this,r),this.art=t,this.name="artplayer_settings";var e=t.option,n=this.get("volume");n&&(e.volume=n)}return i(r,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),it({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),r}();function oe(r){var t=r.i18n,i=r.subtitle,o=r.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(t.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(t){var e=d(".art-setting-range input",t),n=d(".art-subtitle-value",t);o(e,"change",function(){var t=e.value;n.innerText=t,r.plugins.subtitleOffset.offset(Number(t))}),r.on("subtitle:switch",function(){e.value=0,n.innerText=0}),r.on("artplayerPluginSubtitleOffset",function(t){i.update(),e.value!==t&&(e.value=t,n.innerText=t)})}}}function ae(r){var i=r.constructor.utils.clamp,t=r.setting,o=r.notice,a=r.template,c=r.i18n,s=r.player;c.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),t.add(oe);var u=[];return r.on("subtitle:switch",function(){u=[]}),{name:"subtitleOffset",offset:function(t){if(a.$track&&a.$track.track){var e=Array.from(a.$track.track.cues),n=i(t,-5,5);e.forEach(function(t,e){u[e]||(u[e]={startTime:t.startTime,endTime:t.endTime}),t.startTime=i(u[e].startTime+n,0,s.duration),t.endTime=i(u[e].endTime+n,0,s.duration)}),o.show("".concat(c.get("Subtitle offset time"),": ").concat(t,"s")),r.emit("artplayerPluginSubtitleOffset",t)}else o.show("".concat(c.get("No subtitles found"))),r.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var n=t.events.proxy,r=t.template,i=t.player;function o(t){if(t){var e=r.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var n=URL.createObjectURL(t);i.switchUrl(n,t.name)}else S(!1,"Playback of this file format is not supported")}}return n(r.$player,"dragover",function(t){t.preventDefault()}),n(r.$player,"drop",function(t){t.preventDefault(),o(t.dataTransfer.files[0])}),{name:"localVideo",attach:function(t){var e=w(t,'');O(t,"position","relative"),y(e,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(e,"change",function(){o(e.files[0])})}}}function se(t){var n=t.events.proxy,c=t.subtitle;return{name:"localSubtitle",attach:function(t){var e=w(t,'');O(t,"position","relative"),y(e,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),n(e,"change",function(){!function(o){if(o){var a=T(o.name);if(["ass","vtt","srt"].includes(a)){var t=new FileReader;n(t,"load",function(t){var e=t.target.result;switch(a){case"srt":var n=R($(e));c.switch(n,o.name);break;case"ass":var r=R(D(e));c.switch(r,o.name);break;case"vtt":var i=R(e);c.switch(i,o.name)}}),t.readAsText(o)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(e.files[0])})}}}function ue(e){var t=e.layers,n=e.player,r=e.option.theme;return t.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(t){e.on("controls:show",function(){t.style.display="none"}),e.on("destroy",function(){t.style.display="none"}),e.on("controls:hide",function(){t.style.display="block"}),e.on("video:timeupdate",function(){t.style.width="".concat(100*n.played,"%")})}}),{name:"miniProgressBar"}}function le(r){var i=1e4,o=0,a=0,c=0,t=null;function e(){c=a=o=0,cancelAnimationFrame(t),t=null}function n(){t||!function n(){r.isDestroy||(t=requestAnimationFrame(function(){var t=Date.now();if(c){var e=t-c;a+=e,r.player.playing||(o+=e)}c=t,r.emit("networkMonitor",o/a),i<=a&&(a=o=0),n()}))}()}return r.on("play",n),r.on("pause",e),{name:"networkMonitor",reset:e,start:n,sample:function(t){i=t}}}function fe(e){var t=e.events,n=e.player,r=e.template,i=V(function(){var t=r.$player.getBoundingClientRect();t.top+t.height<=0&&!n.pip?(n.pip=!0,e.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,e.emit("artplayerPluginAutoPip",!1))},300);return t.proxy(window,"scroll",i),{name:"autoPip"}}function pe(e){c(this,pe);var n=e.option,r=e.events.proxy,i=e.template.$video;Z.video.events.forEach(function(t){r(i,t,function(t){e.emit("video:".concat(t.type),t)})}),Object.keys(n.moreVideoAttr).forEach(function(t){i[t]=n.moreVideoAttr[t]}),n.muted&&(i.muted=n.muted),n.volume&&(i.volume=I(n.volume,0,1)),n.poster&&(i.poster=n.poster),n.autoplay&&(i.autoplay=n.autoplay),i.controls=!0;var t=n.type||T(n.url),o=n.customType[t];t&&o?(e.emit("beforeCustomType",t),o(i,n.url,e),e.emit("afterCustomType",t)):(e.emit("beforeAttachUrl",n.url),i.src=n.url,e.emit("afterAttachUrl",i.src))}var de=function(){function r(t){var e=this;c(this,r),this.art=t,this.id=0;var n=t.option;n.subtitle.url&&n.subtitleOffset&&this.add(ae),!n.isLive&&n.miniProgressBar&&this.add(ue),n.localVideo&&this.add(ce),n.localSubtitle&&this.add(se),n.networkMonitor&&this.add(le),n.autoPip&&this.add(fe),t.option.plugins.forEach(function(t){e.add(t)})}return i(r,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return S(!q(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),r}(),he=0,ye=function(){function n(t){var e;return c(this,n),(e=s(this,u(n).call(this))).option=f(F(n.option,t),Y),e.isFocus=!1,e.isDestroy=!1,e.whitelist=new X(o(e)),e.template=new J(o(e)),e.events=new Ut(o(e)),e.whitelist.state?(e.storage=new ie(o(e)),e.icons=new Nt(o(e)),e.i18n=new K(o(e)),e.notice=new Zt(o(e)),e.player=new nt(o(e)),e.layers=new Xt(o(e)),e.controls=new Dt(o(e)),e.contextmenu=new Vt(o(e)),e.subtitle=new It(o(e)),e.info=new Bt(o(e)),e.loading=new Yt(o(e)),e.hotkey=new _t(o(e)),e.mask=new Jt(o(e)),e.setting=new re(o(e)),e.plugins=new de(o(e))):e.mobile=new pe(o(e)),he+=1,e.id=he,n.instances.push(o(e)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),e}return e(n,p),i(n,[{key:"destroy",value:function(t){var e=!(01?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:document).querySelector(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function h(t,e){return t.classList.add(e)}function y(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function m(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function g(t,e,n){return t.style[e]=n,t}function b(t,e){return Object.keys(e).forEach((function(n){g(t,n,e[n])})),t}function w(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(r):r}function O(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function j(t,e){O(t).forEach((function(t){return y(t,e)})),h(t,e)}function P(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n)}var k=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},x=r((function(t){function e(n,r,i){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?t.exports=e=function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&s(i,n.prototype),i}:t.exports=e=Reflect.construct,e.apply(null,arguments)}t.exports=e})),E=function(e){function n(e,r){var i;return t(this,n),i=a(this,c(n).call(this,e)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(o(i),r||i.constructor),i.name="ArtPlayerError",i}return u(n,e),n}(r((function(t){function e(n){var r="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!k(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return x(t,arguments,c(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),s(e,t)},e(n)}t.exports=e}))(Error));function S(t,e){if(!t)throw new E(e);return t}function $(t){return"WEBVTT \r\n\r\n".concat(t.replace(/{[\s\S]*?}/g,"").replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function R(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function T(t){var e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function n(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[:.]/).map((function(t,e,n){if(e===n.length-1){if(1===t.length)return".".concat(t,"00");if(2===t.length)return".".concat(t,"0")}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===n.length-1?".".concat(t):":".concat(t)})).join("")}return"WEBVTT\n\n".concat(t.split(/\r?\n/).map((function(t){var r=t.match(e);return r?{start:n(r[1].trim()),end:n(r[2].trim()),text:r[5].replace(/{[\s\S]*?}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map((function(t){return t.trim()})).join("\n")}:null})).filter((function(t){return t})).map((function(t,e){return t?"".concat(e+1,"\n").concat(t.start," --\x3e ").concat(t.end,"\n").concat(t.text):""})).filter((function(t){return t.trim()})).join("\n\n"))}function D(t){return t.includes("?")?D(t.split("?")[0]):t.includes("#")?D(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function C(t,e){var n=document.createElement("a");n.style.display="none",n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var A=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e1?e-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function V(t,e,n){var r;function i(){for(var i=arguments.length,o=new Array(i),a=0;a0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}var U=Object.freeze({__proto__:null,query:p,queryAll:d,addClass:h,removeClass:y,hasClass:v,append:m,remove:function(t){return t.parentNode.removeChild(t)},setStyle:g,setStyles:b,getStyle:w,sublings:O,inverseClass:j,tooltip:P,ArtPlayerError:E,errorHandle:S,srtToVtt:$,vttToBlob:R,assToVtt:T,getExt:D,downloadFile:C,hasOwnProperty:q,proxyPropertys:W,mergeDeep:F,sleep:H,debounce:V,throttle:B,clamp:I,secondToTime:N});function _(t,e,n){return S("string"===e||t instanceof Element,"".concat(n.join(".")," require 'string' or 'Element' type"))}var X={container:_,url:"string|function",poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",subtitleOffset:"boolean",miniProgressBar:"boolean",localVideo:"boolean",localSubtitle:"boolean",autoPip:"boolean",networkMonitor:"boolean",plugins:["function"],whitelist:["string|function|regexp"],layers:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],contextmenu:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined"}],quality:[{default:"boolean|undefined",name:"string",url:"string"}],controls:[{disable:"boolean|undefined",name:"string|undefined",index:"number|undefined",html:_,style:"object|undefined",click:"function|undefined",mounted:"function|undefined",tooltip:"string|undefined",position:function(t,e,n){var r=["top","left","right"];return S(r.includes(t),"".concat(n.join(".")," only accept ").concat(r.toString()," as parameters"))}}],highlight:[{time:"number",text:"string"}],thumbnails:{url:"string",number:"number",width:"number",height:"number",column:"number"},subtitle:{url:"string",style:"object"},moreVideoAttr:"object",icons:"object",customType:"object"},Y={video:{propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]}},Z=function e(n){var r=this;t(this,e);var i=n.constructor.kindOf,o=n.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||o.some((function(t){switch(i(t)){case"string":return r.userAgent.indexOf(t)>-1;case"function":return t(r.userAgent);case"regexp":return t.test(r.userAgent);default:return!1}}))},J=function(){function e(n){var r=this;t(this,e),this.art=n,n.option.container instanceof Element?this.$container=n.option.container:(this.$container=p(n.option.container),S(this.$container,"No container element found by ".concat(n.option.container))),S(n.constructor.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),S(this.$container.clientWidth&&this.$container.clientHeight,"The width and height of the container cannot be 0"),n.whitelist.state?this.initDesktop():this.initMobile()}return n(e,[{key:"query",value:function(t){return p(t,this.$container)}},{key:"initDesktop",value:function(){this.$container.innerHTML='\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
Player version:
\n
3.1.18
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n
\n '),this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video"),this.$track=this.query(".artplayer-video track"),this.$subtitle=this.query(".artplayer-subtitle"),this.$danmuku=this.query(".artplayer-danmuku"),this.$bottom=this.query(".artplayer-bottom"),this.$progress=this.query(".artplayer-progress"),this.$controls=this.query(".artplayer-controls"),this.$controlsLeft=this.query(".artplayer-controls-left"),this.$controlsRight=this.query(".artplayer-controls-right"),this.$layers=this.query(".artplayer-layers"),this.$loading=this.query(".artplayer-loading"),this.$notice=this.query(".artplayer-notice"),this.$noticeInner=this.query(".artplayer-notice-inner"),this.$mask=this.query(".artplayer-mask"),this.$state=this.query(".artplayer-state"),this.$setting=this.query(".artplayer-setting"),this.$settingInner=this.query(".artplayer-setting-inner"),this.$settingBody=this.query(".artplayer-setting-body"),this.$info=this.query(".artplayer-info"),this.$infoPanel=this.query(".artplayer-info-panel"),this.$infoClose=this.query(".artplayer-info-close"),this.$pipHeader=this.query(".artplayer-pip-header"),this.$pipTitle=this.query(".artplayer-pip-title"),this.$pipClose=this.query(".artplayer-pip-close"),this.$contextmenu=this.query(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.query(".artplayer-video-player"),this.$video=this.query(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":h(this.$player,"artplayer-destroy")}}]),e}(),G={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},Q={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","Does not support fullscreen":"不支持全屏"},K=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":G,"zh-tw":Q},this.init()}return n(e,[{key:"init",value:function(){var t=this.art.option.lang.toLowerCase();this.language=this.languages[t]||{}}},{key:"get",value:function(t){return this.language[t]||t}},{key:"update",value:function(t){this.languages=F(this.languages,t),this.init()}}]),e}();var tt=r((function(t){ +/*! + * screenfull + * v5.0.0 - 2019-09-09 + * (c) Sindre Sorhus; MIT License + */ +!function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,i=n.length,o={};r1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.currentTime,u=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=s})),u&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}}),Object.defineProperty(e,"switchUrl",{value:function(a){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown";if(a!==o.$video.src){URL.revokeObjectURL(o.$video.src);var s=e.playing;return e.attachUrl(a).then((function(){i.url=a,e.playbackRate=!1,e.aspectRatio=!1,t.on("ready",(function(){e.currentTime=0})),s&&(e.play=!0),r.show("".concat(n.get("Switch video"),": ").concat(c)),t.emit("switch",a)}))}return null}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"playbackRate",{get:function(){return i.dataset.playbackRate},set:function(n){if(n){var c=[.5,.75,1,1.25,1.5,1.75,2];if(S(c.includes(n),"'playbackRate' only accept ".concat(c.toString()," as parameters")),n===i.dataset.playbackRate)return;r.playbackRate=n,i.dataset.playbackRate=n,a.show("".concat(o.get("Rate"),": ").concat(1===n?o.get("Normal"):"".concat(n,"x"))),t.emit("playbackRateChange",n)}else e.playbackRate&&(e.playbackRate=1,delete i.dataset.playbackRate,t.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{set:function(n){if(n){var r=i.dataset.playbackRate;r&&(e.playbackRate=Number(r),t.emit("playbackRateReset"))}}})}(n,this),function(t,e){var n=t.template,r=n.$video,i=n.$player,o=t.i18n,a=t.notice;Object.defineProperty(e,"aspectRatio",{get:function(){return i.dataset.aspectRatio||""},set:function(n){if(n){var c=["default","4:3","16:9"];if(S(c.includes(n),"'aspectRatio' only accept ".concat(c.toString()," as parameters")),"default"===n)e.aspectRatio=!1;else{var s=n.split(":"),u=r.videoWidth,l=r.videoHeight,f=i.clientWidth,p=i.clientHeight,d=u/l,h=s[0]/s[1];if(d>h){var y=h*l/u;g(r,"width","".concat(100*y,"%")),g(r,"height","100%"),g(r,"padding","0 ".concat((f-f*y)/2,"px"))}else{var v=u/h/l;g(r,"width","100%"),g(r,"height","".concat(100*v,"%")),g(r,"padding","".concat((p-p*v)/2,"px 0"))}}i.dataset.aspectRatio=n,a.show("".concat(o.get("Aspect ratio"),": ").concat("default"===n?o.get("Default"):n)),t.emit("aspectRatioChange",n)}else e.aspectRatio&&(g(r,"width",null),g(r,"height",null),g(r,"padding",null),delete i.dataset.aspectRatio,t.emit("aspectRatioRemove"))}}),Object.defineProperty(e,"aspectRatioReset",{set:function(n){if(n&&e.aspectRatio){var r=e.aspectRatio;e.aspectRatio=r,t.emit("aspectRatioReset")}}})}(n,this),function(t,e){var n=t.option,r=t.notice,i=t.template.$video;Object.defineProperty(e,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=i.videoWidth,t.height=i.videoHeight,t.getContext("2d").drawImage(i,0,0),t.toDataURL("image/png")}catch(t){throw r.show(t),t}}}),Object.defineProperty(e,"getScreenshotBlobUrl",{value:function(){return new Promise((function(t,e){try{var n=document.createElement("canvas");n.width=i.videoWidth,n.height=i.videoHeight,n.getContext("2d").drawImage(i,0,0),n.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){r.show(t),e(t)}}))}}),Object.defineProperty(e,"screenshot",{value:function(){var r=e.getScreenshotDataURL();r&&(C(r,"".concat(n.title||"artplayer","_").concat(N(i.currentTime),".png")),t.emit("screenshot",r))}})}(n,this),function(t,e){var n=t.i18n,r=t.notice,i=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreen:change",tt.isFullscreen)},c=function(){r.show(n.get("Does not support fullscreen"))};e.fullscreenIsEnabled&&(tt.on("change",a),tt.on("error",c),i.push((function(){tt.off("change",a),tt.off("error",c)}))),Object.defineProperty(e,"fullscreen",{get:function(){return tt.isFullscreen},set:function(n){e.fullscreenIsEnabled?n?(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.request(o).then((function(){h(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:enabled")}))):(e.fullscreenWeb&&(e.fullscreenWeb=!1),tt.exit().then((function(){y(o,"artplayer-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreen:exit")}))):c()}}),Object.defineProperty(e,"fullscreenToggle",{set:function(t){t&&(e.fullscreen=!e.fullscreen)}}),Object.defineProperty(e,"fullscreenIsEnabled",{get:function(){return tt.isEnabled}})}(n,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWeb",{get:function(){return v(n,"artplayer-web-fullscreen")},set:function(r){r?(e.fullscreen&&(e.fullscreen=!1),h(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:enabled")):(e.fullscreen&&(e.fullscreen=!1),y(n,"artplayer-web-fullscreen"),e.aspectRatioReset=!0,t.emit("fullscreenWeb:exit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{set:function(t){t&&(e.fullscreenWeb=!e.fullscreenWeb)}})}(n,this),et(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}}),Object.defineProperty(e,"loadedTime",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1):0}})}(n,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(n,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"playing",{get:function(){return!!(n.currentTime>0&&!n.paused&&!n.ended&&n.readyState>2)}})}(n,this),function(t,e){var n=t.template,r=n.$container,i=n.$player,o=n.$video;Object.defineProperty(e,"autoSize",{get:function(){return v(r,"artplayer-auto-size")},set:function(e){if(e){var n=o.videoWidth,a=o.videoHeight,c=r.getBoundingClientRect(),s=c.width,u=c.height,l=n/a,f=s/u;if(h(r,"artplayer-auto-size"),f>l){g(i,"width","".concat(u*l/s*100,"%")),g(i,"height","100%")}else{var p=s/l/u*100;g(i,"width","100%"),g(i,"height","".concat(p,"%"))}t.emit("autoSizeChange")}else y(r,"artplayer-auto-size"),g(i,"width",null),g(i,"height",null),t.emit("autoSizeRemove")}})}(n,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach((function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})})),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(n,this),function(t,e){Object.defineProperty(e,"flip",{get:function(){return t.template.$player.dataset.flip},set:function(e){if(e){var n=["normal","horizontal","vertical"];S(n.includes(e),"'flip' only accept ".concat(n.toString()," as parameters")),t.template.$player.dataset.flip=e,t.emit("flipChange",e)}else delete t.template.$player.dataset.flip,t.emit("flipRemove")}})}(n,this),W(n,this)};function rt(t,e,n,r,i,o){var a="function"==typeof r?r(t):r;if(a.disable)return{};var c=e.id,s=a.name||"".concat(o).concat(c);S(!q(e,s),"Cannot create a component that already has the same name: ".concat(o," -> ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&m(u,a.html),a.style&&b(u,a.style),a.tooltip&&P(u,a.tooltip);var l=Array.from(n.children);u.dataset.index=a.index||c;var f=l.find((function(t){return Number(t.dataset.index)>=Number(u.dataset.index)}));return f?f.insertAdjacentElement("beforebegin",u):m(n,u),a.click&&t.events.proxy(u,"click",(function(n){n.preventDefault(),a.click.call(t,e,n),t.emit("".concat(o,":click"),u)})),a.mounted&&a.mounted(u,e,t),i&&i(u,e,t),Object.defineProperty(e,s,{value:{get id(){return c},get $ref(){return u},set show(e){e?(g(u,"display","block"),t.emit("".concat(o,":show"),u)):(g(u,"display","none"),t.emit("".concat(o,":hide"),u))}}}),t.emit("".concat(o,":add"),a),e[s]}var it=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function ot(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function at(t){return function(e){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),mounted:function(t){var n=!1,i=p(".art-progress-loaded",t),c=p(".art-progress-played",t),s=p(".art-progress-highlight",t),u=p(".art-progress-indicator",t),l=p(".art-progress-tip",t);function f(t,e){"loaded"===t&&g(i,"width","".concat(100*e,"%")),"played"===t&&(g(c,"width","".concat(100*e,"%")),g(u,"left","calc(".concat(100*e,"% - ").concat(w(u,"width")/2,"px)")))}r.forEach((function(t){var e=I(t.time,0,a.duration)/a.duration*100;m(s,''))})),f("loaded",a.loaded),e.on("video:progress",(function(){f("loaded",a.loaded)})),e.on("video:timeupdate",(function(){f("played",a.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){g(l,"display","block"),n.composedPath().indexOf(s)>-1?function(n){var r=ht(e,n).width,i=n.target.dataset.text;l.innerHTML=i;var o=l.clientWidth;r<=o/2?g(l,"left",0):r>t.clientWidth-o/2?g(l,"left","".concat(t.clientWidth-o,"px")):g(l,"left","".concat(r-o/2,"px"))}(n):function(n){var r=ht(e,n),i=r.width,o=r.time;l.innerHTML=o;var a=l.clientWidth;i<=a/2?g(l,"left",0):i>t.clientWidth-a/2?g(l,"left","".concat(t.clientWidth-a,"px")):g(l,"left","".concat(i-a/2,"px"))}(n)})),o(t,"mouseout",(function(){g(l,"display","none")})),o(t,"click",(function(t){if(t.target!==u){var n=ht(e,t),r=n.second;f("played",n.percentage),a.seek=r}})),o(u,"mousedown",(function(){n=!0})),o(document,"mousemove",(function(t){if(n){var r=ht(e,t),i=r.second,o=r.percentage;h(u,"art-show-indicator"),f("played",o),a.seek=i}})),o(document,"mouseup",(function(){n&&(n=!1,y(u,"art-show-indicator"))}))}})}}function vt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function mt(t){return function(e){return function(t){for(var e=1;e'),l=m(u,'
');function f(t){var e=u.getBoundingClientRect(),n=e.left,r=e.width,i=l.getBoundingClientRect().width;return I(t.pageX-n-i/2,0,r-i/2)/(r-i)}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(i.muted||0===t)g(c,"display","none"),g(s,"display","flex"),g(l,"left","0");else{var e=((w(u,"width")||60)-w(l,"width"))*t;g(c,"display","flex"),g(s,"display","none"),g(l,"left","".concat(e,"px"))}}P(c,o.get("Mute")),g(s,"display","none"),p(i.volume),e.on("video:volumechange",(function(){p(i.volume)})),n(c,"click",(function(){i.muted=!0})),n(s,"click",(function(){i.muted=!1})),n(u,"click",(function(t){i.muted=!1,i.volume=f(t)})),n(l,"mousedown",(function(){a=!0})),n(l,"mousemove",(function(t){a&&(i.muted=!1,i.volume=f(t))})),n(document,"mouseup",(function(){a&&(a=!1)}))}})}}function jt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Pt(t){return function(e){return function(t){for(var e=1;er.clientWidth-s/2?g(t,"left","".concat(r.clientWidth-s,"px")):g(t,"left","".concat(o-s/2,"px"))}(i))})),o(r,"mouseout",(function(){g(t,"display","none")}))}})}}function Et(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function St(t){return function(e){return function(t){for(var e=1;e'.concat(s.name,"")),l=n.map((function(t,e){return'
').concat(t.name,"
")})).join(""),f=m(t,'
'.concat(l,"
"));o(t,(function(){f.style.left="-".concat(w(f,"width")/2-t.clientWidth/2,"px")})),i(f,"click",(function(t){var e=Number(t.target.dataset.index),r=n[e],i=r.url,o=r.name;i&&o&&c!==e&&(a.switchQuality(i,o),u.innerHTML=o,c=e)}))}})}}var Tt=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.art.on("ready",(function(){r.init()}))}return n(e,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(yt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(xt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(pt({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(Ot({name:"volume",disable:!1,position:"left",index:20})),this.add(bt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Rt({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(St({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(mt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(Pt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(lt({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(st({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(at({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach((function(e){t.add(e)}))}},{key:"add",value:function(t,e){var n,r="function"==typeof t?t(this.art):t,i=this.art.template,o=i.$progress,a=i.$controlsLeft,c=i.$controlsRight;switch(r.position){case"top":n=o;break;case"left":n=a;break;case"right":n=c}this.id+=1,S(r.position,"Controls option.position can not be empty");var s=rt(this.art,this,n,r,e,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||h(s.$ref,"art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,y(e,"artplayer-controls-show"),this.art.emit("controls:hide"))}}]),e}();function Dt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ct(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(n.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(t,e){var n=e.target.dataset.rate;n&&(r.playbackRate=Number(n),t.show=!1)},mounted:function(t){e.on("playbackRateChange",(function(e){var n=d("span",t).find((function(t){return Number(t.dataset.rate)===e}));n&&j(n,"current")}))}})}}function At(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Lt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e').concat(n.get("Default"),'\n 4:3\n 16:9\n '),click:function(t,e){var n=e.target.dataset.ratio;n&&(r.aspectRatio=n,t.show=!1)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("span",t).find((function(t){return t.dataset.ratio===e}));n&&j(n,"current")}))}})}}function Mt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function zt(t){return function(e){return function(t){for(var e=1;eArtPlayer 3.1.18'})}function Ft(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Ht(t){return function(e){return function(t){for(var e=1;eu+s&&(h=s-d),o+p>l+c&&(y=c-p),g(r,"left","".concat(h,"px")),g(r,"top","".concat(y,"px"))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:show")):(this.state=!1,y(e,"artplayer-contextmenu-show"),this.art.emit("contextmenu:hide"))}}]),e}(),Bt=function(){function e(n){var r=this;t(this,e),this.art=n,this.timer=null;var i=n.template,o=i.$infoPanel,a=i.$infoClose,c=n.events.proxy;this.types=d("[data-video]",o),c(a,"click",(function(){r.show=!1})),this.art.on("destroy",(function(){clearTimeout(r.timer)}))}return n(e,[{key:"readInfo",value:function(){var t=this.art.template.$video;this.types.forEach((function(e){var n=t[e.dataset.video];e.innerHTML="number"==typeof n?n.toFixed(2):n}))}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout((function(){t.readInfo(),t.loop()}),1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-info-show"),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,y(e,"artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),e}(),It=function(){function e(n){t(this,e),this.art=n,this.state=!0;var r=n.events.proxy,i=n.option.subtitle;b(n.template.$subtitle,i.style),r(this.textTrack,"cuechange",this.update.bind(this)),i.url&&this.init(i.url)}return n(e,[{key:"update",value:function(){var t=this.art.template.$subtitle;t.innerHTML="",this.activeCue&&(t.innerHTML=this.activeCue.text.split(/\r?\n/).map((function(t){return"

".concat(t,"

")})).join("")),this.art.emit("subtitle:update",t)}},{key:"switch",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unknown",r=this.art,i=r.i18n,o=r.notice;return this.init(t).then((function(t){return o.show("".concat(i.get("Switch subtitle"),": ").concat(n)),e.art.emit("subtitle:switch",t),t}))}},{key:"init",value:function(t){var e=this,n=this.art,r=n.notice,i=n.template,o=i.$subtitle,a=i.$track;return fetch(t).then((function(t){return t.text()})).then((function(e){switch(D(t)){case"srt":return R($(e));case"ass":return R(T(e));case"vtt":return R(e);default:return t}})).then((function(t){return o.innerHTML="",e.url===t?t:(URL.revokeObjectURL(e.url),a.src=t,t)})).catch((function(t){throw r.show(t),t}))}},{key:"toggle",value:function(){this.show=!this.state}},{key:"url",get:function(){return this.art.template.$track.src}},{key:"textTrack",get:function(){return this.art.template.$video.textTracks[0]}},{key:"activeCue",get:function(){return this.textTrack.activeCues[0]}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,h(e,"artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),e}();var Nt=function(){function e(n){var r=this;t(this,e),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),n.whitelist.state&&n.once("video:canplay",(function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],(function(e){e.composedPath().indexOf(n)>-1?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){h(n,"artplayer-hover"),t.emit("hoverenter")}),(function(){y(n,"artplayer-hover"),t.emit("hoverleave")}))}(n,r),function(t,e){var n=t.template,r=n.$player,i=n.$video,o=t.player,a=V((function(){h(r,"artplayer-hide-cursor"),y(r,"artplayer-hover"),t.controls.show=!1}),3e3);t.on("hoverleave",(function(){o.playing&&a()})),e.proxy(r,"mousemove",(function(e){a.clearTimeout(),y(r,"artplayer-hide-cursor"),t.controls.show=!0,!t.player.pip&&o.playing&&e.target===i&&a()}))}(n,r),function(t,e){var n=t.option,r=t.player,i=t.template.$player,o=document.createElement("object");o.setAttribute("aria-hidden","true"),o.setAttribute("tabindex",-1),o.type="text/html",o.data="about:blank";var a=r.width,c=r.height,s=B((function(){r.width===a&&r.height===c||(a=r.width,c=r.height,n.autoSize&&(t.player.fullscreen||t.player.fullscreenWeb||t.player.pip?t.player.autoSize=!1:t.player.autoSize=!0),t.player.aspectRatioReset=!0,t.emit("resize",{width:r.width,height:r.height}))}),500);e.proxy(o,"load",(function(){e.proxy(o.contentDocument.defaultView,"resize",s)})),i.appendChild(o)}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(e)?e.forEach((function(e){return r.proxy(t,e,n,i)})):(t.addEventListener(e,n,i),this.destroyEvents.push((function(){t.removeEventListener(e,n,i)})))}},{key:"hover",value:function(t,e,n){e&&this.proxy(t,"mouseenter",e),n&&this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(t){var e=this;return new Promise((function(n,r){var i;if(t instanceof HTMLImageElement)i=t;else{if("string"!=typeof t)return r(t);(i=new Image).src=t}return i.complete?n(i):(e.proxy(i,"load",(function(){return n(i)})),e.proxy(i,"error",(function(){return r(i)})),t)}))}},{key:"destroy",value:function(){this.destroyEvents.forEach((function(t){return t()}))}}]),e}(),Ut=function(){function e(n){var r=this;t(this,e),this.art=n,this.keys={},this.art.option.hotkey&&this.art.on("ready",(function(){r.add(27,(function(){n.player.fullscreenWeb&&(n.player.fullscreenWeb=!1)})),r.add(32,(function(){n.player.toggle=!0})),r.add(37,(function(){n.player.seek=n.player.currentTime-5})),r.add(38,(function(){n.player.volume+=.1})),r.add(39,(function(){n.player.seek=n.player.currentTime+5})),r.add(40,(function(){n.player.volume-=.1})),r.init()}))}return n(e,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var t=this;(0,this.art.events.proxy)(window,"keydown",(function(e){if(t.art.isFocus){var n=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==n&&"TEXTAREA"!==n&&""!==r&&"true"!==r){var i=t.keys[e.keyCode];i&&(e.preventDefault(),i.forEach((function(t){return t()})),t.art.emit("hotkey",e))}}}))}}]),e}(),_t=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.add=this.add.bind(this),this.art.on("ready",(function(){r.art.option.layers.forEach((function(t){r.add(t)}))}))}return n(e,[{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$layers;return rt(this.art,this,n,t,e,"layer")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,y(e,"artplayer-layers-hide"),this.art.emit("layers:show")):(this.state=!1,h(e,"artplayer-layers-hide"),this.art.emit("layers:hide"))}}]),e}(),Xt=function(){function e(n){t(this,e),this.art=n,m(n.template.$loading,n.icons.loading)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-loading-show"),this.art.emit("loading:show")):(this.state=!1,y(e,"artplayer-loading-show"),this.art.emit("loading:hide"))}}]),e}(),Yt=function(){function e(n){t(this,e),this.art=n,this.timer=null}return n(e,[{key:"show",value:function(t){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,i=this.art.template,o=i.$player,a=i.$noticeInner;this.state=!0,h(o,"artplayer-notice-show"),a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout((function(){e.hide()}),r)),this.art.emit("notice:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,y(t,"artplayer-notice-show"),this.art.emit("notice:hide")}}]),e}(),Zt=function(){function e(n){t(this,e),this.art=n,m(n.template.$state,n.icons.state)}return n(e,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,y(e,"artplayer-mask-show"),this.art.emit("mask:hide"))}}]),e}(),Jt=function e(n){var r=this;t(this,e);var i=Object.assign({loading:'\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 \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},n.option.icons);Object.keys(i).forEach((function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),m(e,i[t]),r[t]=e}))};function Gt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Qt(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(t,e){var n=e.target.dataset.value;n&&(r.flip=n)},mounted:function(t){e.on("flipChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function Kt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function te(t){return function(e){var n=e.i18n,r=e.player;return function(t){for(var e=1;e'.concat(n.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(t,e){var n=e.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(t){e.on("aspectRatioChange",(function(e){var n=d("button",t).find((function(t){return t.dataset.value===e}));n&&j(n.parentElement,"current")}))}})}}function ee(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ne(t){return function(e){var n=e.i18n,r=e.player,i=e.events.proxy;return function(t){for(var e=1;e\n '.concat(n.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(t){var n=p(".art-setting-range input",t),o=p(".art-subtitle-value",t);i(n,"change",(function(){var t=n.value;o.innerText=t,r.playbackRate=Number(t)})),e.on("playbackRateChange",(function(t){n.value!==t&&(n.value=t,o.innerText=t)}))}})}}var re=function(){function e(n){var r=this;t(this,e),this.id=0,this.art=n,this.state=!1,n.option.setting&&(this.art.on("ready",(function(){r.init()})),this.art.on("blur",(function(){r.show=!1})))}return n(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",(function(e){e.target===r&&(t.show=!1)})),this.add(Qt({disable:!n.flip,name:"flip"})),this.add(te({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(ne({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return rt(this.art,this,n,t,e,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(t){var e=this.art.template.$player;t?(this.state=!0,h(e,"artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,y(e,"artplayer-setting-show"),this.art.emit("setting:hide"))}}]),e}(),ie=function(){function e(n){t(this,e),this.art=n,this.name="artplayer_settings";var r=n.option,i=this.get("volume");i&&(r.volume=i)}return n(e,[{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),it({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),e}();function oe(t){var e=t.i18n,n=t.subtitle,r=t.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(e){var i=p(".art-setting-range input",e),o=p(".art-subtitle-value",e);r(i,"change",(function(){var e=i.value;o.innerText=e,t.plugins.subtitleOffset.offset(Number(e))})),t.on("subtitle:switch",(function(){i.value=0,o.innerText=0})),t.on("artplayerPluginSubtitleOffset",(function(t){n.update(),i.value!==t&&(i.value=t,o.innerText=t)}))}}}function ae(t){var e=t.constructor.utils.clamp,n=t.setting,r=t.notice,i=t.template,o=t.i18n,a=t.player;o.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),n.add(oe);var c=[];return t.on("subtitle:switch",(function(){c=[]})),{name:"subtitleOffset",offset:function(n){if(i.$track&&i.$track.track){var s=Array.from(i.$track.track.cues),u=e(n,-5,5);s.forEach((function(t,n){c[n]||(c[n]={startTime:t.startTime,endTime:t.endTime}),t.startTime=e(c[n].startTime+u,0,a.duration),t.endTime=e(c[n].endTime+u,0,a.duration)})),r.show("".concat(o.get("Subtitle offset time"),": ").concat(n,"s")),t.emit("artplayerPluginSubtitleOffset",n)}else r.show("".concat(o.get("No subtitles found"))),t.emit("artplayerPluginSubtitleOffset",0)}}}function ce(t){var e=t.events.proxy,n=t.template,r=t.player;function i(t){if(t){var e=n.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var i=URL.createObjectURL(t);r.switchUrl(i,t.name)}else S(!1,"Playback of this file format is not supported")}}return e(n.$player,"dragover",(function(t){t.preventDefault()})),e(n.$player,"drop",(function(t){t.preventDefault(),i(t.dataTransfer.files[0])})),{name:"localVideo",attach:function(t){var n=m(t,'');g(t,"position","relative"),b(n,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(n,"change",(function(){i(n.files[0])}))}}}function se(t){var e=t.events.proxy,n=t.subtitle;return{name:"localSubtitle",attach:function(t){var r=m(t,'');g(t,"position","relative"),b(r,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),e(r,"change",(function(){!function(t){if(t){var r=D(t.name);if(["ass","vtt","srt"].includes(r)){var i=new FileReader;e(i,"load",(function(e){var i=e.target.result;switch(r){case"srt":var o=R($(i));n.switch(o,t.name);break;case"ass":var a=R(T(i));n.switch(a,t.name);break;case"vtt":var c=R(i);n.switch(c,t.name)}})),i.readAsText(t)}else S(!1,"Only supports subtitle files in .ass, .vtt and .srt format")}}(r.files[0])}))}}}function ue(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"2px",background:r},mounted:function(e){t.on("controls:show",(function(){e.style.display="none"})),t.on("destroy",(function(){e.style.display="none"})),t.on("controls:hide",(function(){e.style.display="block"})),t.on("video:timeupdate",(function(){e.style.width="".concat(100*n.played,"%")}))}}),{name:"miniProgressBar"}}function le(t){var e=1e4,n=0,r=0,i=0,o=null;function a(){n=0,r=0,i=0,cancelAnimationFrame(o),o=null}function c(){o||function a(){t.isDestroy||(o=requestAnimationFrame((function(){var o=Date.now();if(i){var c=o-i;r+=c,t.player.playing||(n+=c)}i=o,t.emit("networkMonitor",n/r),r>=e&&(n=0,r=0),a()})))}()}return t.on("play",c),t.on("pause",a),{name:"networkMonitor",reset:a,start:c,sample:function(t){e=t}}}function fe(t){var e=t.events,n=t.player,r=t.template,i=V((function(){var e=r.$player.getBoundingClientRect();e.top+e.height<=0&&!n.pip?(n.pip=!0,t.emit("artplayerPluginAutoPip",!0)):n.pip&&(n.pip=!1,t.emit("artplayerPluginAutoPip",!1))}),300);return e.proxy(window,"scroll",i),{name:"autoPip"}}var pe=function(){function e(n){var r=this;t(this,e),this.art=n,this.id=0;var i=n.option;i.subtitle.url&&i.subtitleOffset&&this.add(ae),!i.isLive&&i.miniProgressBar&&this.add(ue),i.localVideo&&this.add(ce),i.localSubtitle&&this.add(se),i.networkMonitor&&this.add(le),i.autoPip&&this.add(fe),n.option.plugins.forEach((function(t){r.add(t)}))}return n(e,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art),n="";return S(!q(this,n=e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:e}),this.art.emit("plugin:add",t),this}}]),e}(),de=function e(n){t(this,e);var r=n.option,i=n.events.proxy,o=n.template.$video;Y.video.events.forEach((function(t){i(o,t,(function(t){n.emit("video:".concat(t.type),t)}))})),Object.keys(r.moreVideoAttr).forEach((function(t){o[t]=r.moreVideoAttr[t]})),r.muted&&(o.muted=r.muted),r.volume&&(o.volume=I(r.volume,0,1)),r.poster&&(o.poster=r.poster),r.autoplay&&(o.autoplay=r.autoplay),o.controls=!0;var a=r.type||D(r.url),c=r.customType[a];a&&c?(n.emit("beforeCustomType",a),c(o,r.url,n),n.emit("afterCustomType",a)):(n.emit("beforeAttachUrl",r.url),o.src=r.url,n.emit("afterAttachUrl",o.src))},he=0,ye=function(e){function r(e){var n;return t(this,r),(n=a(this,c(r).call(this))).option=l(F(r.option,e),X),n.isFocus=!1,n.isDestroy=!1,n.whitelist=new Z(o(n)),n.template=new J(o(n)),n.events=new Nt(o(n)),n.whitelist.state?(n.storage=new ie(o(n)),n.icons=new Jt(o(n)),n.i18n=new K(o(n)),n.notice=new Yt(o(n)),n.player=new nt(o(n)),n.layers=new _t(o(n)),n.controls=new Tt(o(n)),n.contextmenu=new Vt(o(n)),n.subtitle=new It(o(n)),n.info=new Bt(o(n)),n.loading=new Xt(o(n)),n.hotkey=new Ut(o(n)),n.mask=new Zt(o(n)),n.setting=new re(o(n)),n.plugins=new pe(o(n))):n.mobile=new de(o(n)),he+=1,n.id=he,r.instances.push(o(n)),console.log("%c ArtPlayer %c 3.1.18 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),n}return u(r,e),n(r,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),r.instances.splice(r.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.1.18"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Y}},{key:"utils",get:function(){return U}},{key:"scheme",get:function(){return X}},{key:"Emitter",get:function(){return f}},{key:"validator",get:function(){return l}},{key:"kindOf",get:function(){return l.kindOf}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,localVideo:!1,localSubtitle:!1,autoPip:!1,networkMonitor:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),r}(f);return Object.defineProperty(ye,"instances",{value:[]}),ye})); diff --git a/scripts/creatRollupConfig.js b/scripts/creatRollupConfig.js index 64ba91354..d7b42e9cc 100644 --- a/scripts/creatRollupConfig.js +++ b/scripts/creatRollupConfig.js @@ -9,7 +9,8 @@ const autoprefixer = require('autoprefixer'); const cssnano = require('cssnano'); const replace = require('rollup-plugin-replace'); const svgo = require('rollup-plugin-svgo'); -const { uglify } = require('rollup-plugin-uglify'); +const { sizeSnapshot } = require('rollup-plugin-size-snapshot'); +const { terser } = require('rollup-plugin-terser'); const copyAfterBuild = require('./copyAfterBuild'); const json = require('rollup-plugin-json'); @@ -41,7 +42,12 @@ module.exports = function creatRollupConfig(projectPath) { exclude: ['node_modules/**', 'packages/**/node_modules/**'], }), eslint({ - exclude: ['node_modules/**', 'packages/*/src/**/*.scss', 'packages/*/src/**/*.svg', 'packages/*/src/**/*.json'], + exclude: [ + 'node_modules/**', + 'packages/*/src/**/*.scss', + 'packages/*/src/**/*.svg', + 'packages/*/src/**/*.json', + ], }), postcss({ plugins: [ @@ -50,8 +56,8 @@ module.exports = function creatRollupConfig(projectPath) { preset: [ 'default', { - calc: false - } + calc: false, + }, ], }), ], @@ -66,10 +72,7 @@ module.exports = function creatRollupConfig(projectPath) { runtimeHelpers: true, exclude: ['node_modules/**', 'packages/**/node_modules/**'], presets: [['@babel/env', { modules: false }]], - plugins: [ - '@babel/plugin-external-helpers', - '@babel/plugin-transform-runtime', - ], + plugins: ['@babel/plugin-external-helpers', '@babel/plugin-transform-runtime'], }), svgo({ raw: true, @@ -79,8 +82,9 @@ module.exports = function creatRollupConfig(projectPath) { __ENV__: JSON.stringify(process.env.NODE_ENV || 'development'), __VERSION__: version, }), + isProd && sizeSnapshot(), isProd && - uglify({ + terser({ output: { preamble: banner, },