From 26fedfa3d100c46f982009aad79f6bbde6018c4b Mon Sep 17 00:00:00 2001 From: Harvey Date: Wed, 27 Apr 2022 11:14:22 +0800 Subject: [PATCH] 4.3.9 --- dist/artplayer-tool-thumbnail.js | 2 +- dist/artplayer.js | 4 ++-- .../artplayer-tool-thumbnail/dist/artplayer-tool-thumbnail.js | 2 +- packages/artplayer/dist/artplayer.js | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/artplayer-tool-thumbnail.js b/dist/artplayer-tool-thumbnail.js index be30a0569..f5e0aa5a8 100644 --- a/dist/artplayer-tool-thumbnail.js +++ b/dist/artplayer-tool-thumbnail.js @@ -5,4 +5,4 @@ * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("tiny-emitter")):"function"==typeof define&&define.amd?define(["tiny-emitter"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).ArtplayerToolThumbnail=e(t.Emitter)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return n(this,h),(t=s.call(this)).processing=!1,t.option={},t.setup(Object.assign({},h.DEFAULTS,e)),t.video=h.creatVideo(),t.duration=0,t.inputChange=t.inputChange.bind(o(t)),t.ondrop=t.ondrop.bind(o(t)),t.option.fileInput.addEventListener("change",t.inputChange),t.option.fileInput.addEventListener("dragover",h.ondragover),t.option.fileInput.addEventListener("drop",h.ondrop),t}return e=h,a=[{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,i=n.fileInput,o=n.number,r=n.width,a=n.column;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";var u=document.createElement("input");u.type="file",u.style.position="absolute",u.style.width="100%",u.style.height="100%",u.style.left="0",u.style.top="0",u.style.right="0",u.style.bottom="0",u.style.opacity="0",i.appendChild(u),this.option.fileInput=u}return["number","width","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.number=l(o,10,1e3),this.option.width=l(r,10,1e3),this.option.column=l(a,1,1e3),this}},{key:"inputChange",value:function(t){var e=this.option.fileInput.files[0];this.loadVideo(e),t.target.value=""}},{key:"loadVideo",value:function(t){if(t){var e=this.video.canPlayType(t.type);this.errorHandle("maybe"===e||"probably"===e,"Playback of this file format is not supported: ".concat(t.type));var n=URL.createObjectURL(t);this.videoUrl=n,this.file=t,this.emit("file",this.file),this.video.src=n,this.emit("video",this.video)}}},{key:"start",value:function(){var t,e=this;if(!this.video.duration)return(t=1e3,new Promise((function(e){return setTimeout(e,t)}))).then((function(){return e.start()}));var n=this.option,i=n.width,o=n.number,r=n.begin,a=n.end,u=this.video.videoHeight/this.video.videoWidth*i;this.option.height=u,this.option.begin=l(r,0,this.video.duration),this.option.end=l(a||this.video.duration,r,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=o/this.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 s=this.creatScreenshotDate(),c=this.creatCanvas(),h=c.getContext("2d");this.emit("canvas",c);var d,f=s.map((function(t,n){return function(){return new Promise((function(r){e.video.oncanplay=function(){h.drawImage(e.video,t.x,t.y,i,u),c.toBlob((function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(n+1)/o),e.video.oncanplay=null,r()}))},e.video.currentTime=t.time}))}}));return this.processing=!0,(d=f,d.reduce((function(t,e){return t.then(e)}),Promise.resolve())).then((function(){e.processing=!1,e.emit("done")})).catch((function(t){throw e.processing=!1,e.emit("error",t.message),t}))}},{key:"creatScreenshotDate",value:function(){for(var t=this.option,e=t.number,n=t.width,i=t.height,o=t.column,r=t.begin,a=this.duration/e,u=[r+a];u.length0&&void 0!==arguments[0]?arguments[0]:{};return t(this,h),(e=u.call(this)).processing=!1,e.option={},e.setup(Object.assign({},h.DEFAULTS,i)),e.video=h.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(n(e)),e.ondrop=e.ondrop.bind(n(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",h.ondragover),e.option.fileInput.addEventListener("drop",h.ondrop),e}return r=h,a=[{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,i=n.fileInput,o=n.number,r=n.width,a=n.column;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";var s=document.createElement("input");s.type="file",s.style.position="absolute",s.style.width="100%",s.style.height="100%",s.style.left="0",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.opacity="0",i.appendChild(s),this.option.fileInput=s}return["number","width","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.number=l(o,10,1e3),this.option.width=l(r,10,1e3),this.option.column=l(a,1,1e3),this}},{key:"inputChange",value:function(t){var e=this.option.fileInput.files[0];this.loadVideo(e),t.target.value=""}},{key:"loadVideo",value:function(t){if(t){var e=this.video.canPlayType(t.type);this.errorHandle("maybe"===e||"probably"===e,"Playback of this file format is not supported: ".concat(t.type));var n=URL.createObjectURL(t);this.videoUrl=n,this.file=t,this.emit("file",this.file),this.video.src=n,this.emit("video",this.video)}}},{key:"start",value:function(){var t,e=this;if(!this.video.duration)return(t=1e3,new Promise((function(e){return setTimeout(e,t)}))).then((function(){return e.start()}));var n=this.option,i=n.width,o=n.number,r=n.begin,a=n.end,s=this.video.videoHeight/this.video.videoWidth*i;this.option.height=s,this.option.begin=l(r,0,this.video.duration),this.option.end=l(a||this.video.duration,r,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=o/this.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 u=this.creatScreenshotDate(),c=this.creatCanvas(),h=c.getContext("2d");this.emit("canvas",c);var f,p=u.map((function(t,n){return function(){return new Promise((function(r){e.video.oncanplay=function(){h.drawImage(e.video,t.x,t.y,i,s),c.toBlob((function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(n+1)/o),e.video.oncanplay=null,r()}))},e.video.currentTime=t.time}))}}));return this.processing=!0,(f=p,f.reduce((function(t,e){return t.then(e)}),Promise.resolve())).then((function(){e.processing=!1,e.emit("done")})).catch((function(t){throw e.processing=!1,e.emit("error",t.message),t}))}},{key:"creatScreenshotDate",value:function(){for(var t=this.option,e=t.number,n=t.width,i=t.height,o=t.column,r=t.begin,a=this.duration/e,s=[r+a];s.length1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function b(t,e){return t.classList.add(e)}function w(t,e){return t.classList.remove(e)}function x(t,e){return t.classList.contains(e)}function O(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function k(t,e,n){return t.style[e]=n,t}function j(t,e){return Object.keys(e).forEach((function(n){k(t,n,e[n])})),t}function P(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 S(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function R(t,e){S(t).forEach((function(t){return w(t,e)})),b(t,e)}function E(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";d||(t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n))}function C(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=n.top-e<=r&&n.top+n.height+e>=0,a=n.left-e<=o+e&&n.left+n.width+e>=0;return i&&a}function $(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function z(t,e){return e.parentNode.replaceChild(t,e),t}function T(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function D(t,e,n){return D=T()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&o(i,n.prototype),i},D.apply(null,arguments)}function A(t){var e="function"==typeof Map?new Map:void 0;return A=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return D(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)},A(t)}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}var L=function(e){i(a,e);var o=M(a);function a(e,n){var i;return t(this,a),i=o.call(this,e),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r(i),n||i.constructor),i.name="ArtPlayerError",i}return n(a)}(A(Error));function F(t,e){if(!t)throw new L(e);return t}function I(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 B(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function q(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(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.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 V(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#000",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return[[e,0],[0,e],[-e,0],[0,-e],[e,e],[-e,-e],[e,-e],[-e,e]].map((function(e){return"".concat(t," ").concat(e[0],"px ").concat(e[1],"px ").concat(n,"px")})).join(",")}function H(t){return t.includes("?")?H(t.split("?")[0]):t.includes("#")?H(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function W(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)}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function J(t,e){var n,r,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),l=0;l0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function et(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var nt=Object.freeze({__proto__:null,query:y,queryAll:g,addClass:b,removeClass:w,hasClass:x,append:O,remove:function(t){return t.parentNode.removeChild(t)},setStyle:k,setStyles:j,getStyle:P,sublings:S,inverseClass:R,tooltip:E,isInViewport:C,includeFromEvent:$,replaceElement:z,ArtPlayerError:L,errorHandle:F,srtToVtt:I,vttToBlob:B,assToVtt:q,outline:V,getExt:H,download:W,def:U,has:Y,get:G,mergeDeep:Q,sleep:Z,debounce:function(t,e,n){var r;function o(){for(var o=arguments.length,i=new Array(o),a=0;a-1;case"function":return t(f);case"regexp":return t.test(f);default:return!1}}))}}]),e}(),mt=function(){function e(n){var r=this;t(this,e),this.art=n;var o=n.option,i=n.constructor,a=n.whitelist;o.container instanceof Element?this.$container=o.container:(this.$container=y(o.container),F(this.$container,"No container element found by ".concat(o.container)));var c=this.$container.tagName.toLowerCase();F("div"===c,"Unsupported container element type, only support 'div' but got '".concat(c,"'")),F(i.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=n.id,this.$original=this.$container.cloneNode(!0),a.state?this.desktop():this.mobile()}return n(e,[{key:"query",value:function(t){return y(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option;t.useSSR||(this.$container.innerHTML=e.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$miniHeader=this.query(".art-mini-header"),this.$miniTitle=this.query(".art-mini-title"),this.$miniClose=this.query(".art-mini-close"),this.$contextmenu=this.query(".art-contextmenus"),t.backdrop&&(b(this.$setting,"art-backdrop-filter"),b(this.$contextmenu,"art-backdrop-filter"),b(this.$info,"art-backdrop-filter")),d&&b(this.$player,"art-mobile")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?z(this.$original,this.$container):b(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.3.8
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),yt={"Video Info":"统计信息",Close:"关闭","Video Load Failed":"加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音","Video Flip":"画面翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide Subtitle":"隐藏字幕","Show Subtitle":"显示字幕","Show Setting":"显示设置","Hide Setting":"隐藏设置",Screenshot:"截图","Play Speed":"播放速度","Aspect Ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch Video":"切换","Switch Subtitle":"切换字幕",Fullscreen:"全屏","Exit Fullscreen":"退出全屏","Web Fullscreen":"网页全屏","Exit Web Fullscreen":"退出网页全屏","Mini Player":"迷你播放器","PIP Mode":"画中画模式","Exit PIP Mode":"退出画中画模式","PIP Not Supported":"不支持画中画模式","Fullscreen Not Supported":"不支持全屏模式","Subtitle Offset":"字幕偏移","Auto playback at":"已为您定位至"},gt={"Video Info":"統計訊息",Close:"關閉","Video Load Failed":"載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音","Video Flip":"畫面翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide Subtitle":"隱藏字幕","Show Subtitle":"顯示字幕","Show Setting":"顯示设置","Hide Setting":"隱藏设置",Screenshot:"截圖","Play Speed":"播放速度","Aspect Ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch Video":"切換","Switch Subtitle":"切換字幕",Fullscreen:"全屏","Exit Fullscreen":"退出全屏","Web Fullscreen":"網頁全屏","Exit Web Fullscreen":"退出網頁全屏","Mini Player":"迷你播放器","PIP Mode":"畫中畫模式","Exit PIP Mode":"退出畫中畫模式","PIP Not Supported":"不支持畫中畫模式","Fullscreen Not Supported":"不支持全屏模式","Subtitle Offset":"字幕偏移","Auto playback at":"已為您定位至"},bt=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":yt,"zh-tw":gt},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=Q(this.languages,t),this.init()}}]),e}();const wt=[["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"]],xt=(()=>{const t=wt[0],e={};for(const n of wt){const r=n?.[1];if(r in document){for(const[r,o]of n.entries())e[t[r]]=o;return e}}return!1})(),Ot={change:xt.fullscreenchange,error:xt.fullscreenerror};let kt={request:(t=document.documentElement,e)=>new Promise(((n,r)=>{const o=()=>{kt.off("change",o),n()};kt.on("change",o);const i=t[xt.requestFullscreen](e);i instanceof Promise&&i.then(o).catch(r)})),exit:()=>new Promise(((t,e)=>{if(!kt.isFullscreen)return void t();const n=()=>{kt.off("change",n),t()};kt.on("change",n);const r=document[xt.exitFullscreen]();r instanceof Promise&&r.then(n).catch(e)})),toggle:(t,e)=>kt.isFullscreen?kt.exit():kt.request(t,e),onchange(t){kt.on("change",t)},onerror(t){kt.on("error",t)},on(t,e){const n=Ot[t];n&&document.addEventListener(n,e,!1)},off(t,e){const n=Ot[t];n&&document.removeEventListener(n,e,!1)},raw:xt};Object.defineProperties(kt,{isFullscreen:{get:()=>Boolean(document[xt.fullscreenElement])},element:{enumerable:!0,get:()=>document[xt.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[xt.fullscreenEnabled])}}),xt||(kt={isEnabled:!1});var jt=kt;function Pt(t){var e=t.i18n,n=t.notice,r=t.template.$video;t.once("video:loadedmetadata",(function(){jt.isEnabled?function(t){var e=t.notice,n=t.template.$player;jt.on("change",(function(){return t.emit("fullscreen",jt.isFullscreen)})),U(t,"fullscreen",{get:function(){return jt.isFullscreen},set:function(r){r?jt.request(n).then((function(){b(n,"art-fullscreen"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreen",!0),e.show=""})):jt.exit().then((function(){w(n,"art-fullscreen"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreen"),e.show=""}))}})}(t):document.fullscreenEnabled||r.webkitSupportsFullscreen?function(t){var e=t.notice,n=t.template.$video;U(t,"fullscreen",{get:function(){return n.webkitDisplayingFullscreen},set:function(r){r?(n.webkitEnterFullscreen(),t.emit("fullscreen",!0),e.show=""):(n.webkitExitFullscreen(),t.emit("fullscreen"),e.show="")}})}(t):U(t,"fullscreen",{get:function(){return!1},set:function(){n.show=e.get("Fullscreen Not Supported")}}),U(t,"fullscreen",G(t,"fullscreen"))}))}function St(t){var e=t.i18n,n=t.notice,r=t.template.$video;document.pictureInPictureEnabled?function(t){var e=t.template.$video,n=t.events.proxy,r=t.notice;e.disablePictureInPicture=!1,U(t,"pip",{get:function(){return document.pictureInPictureElement},set:function(t){t?e.requestPictureInPicture().catch((function(t){throw r.show=t,t})):document.exitPictureInPicture().catch((function(t){throw r.show=t,t}))}}),n(e,"enterpictureinpicture",(function(){t.emit("pip",!0)})),n(e,"leavepictureinpicture",(function(){t.emit("pip")}))}(t):r.webkitSupportsPresentationMode?function(t){var e=t.template.$video;e.webkitSetPresentationMode("inline"),U(t,"pip",{get:function(){return"picture-in-picture"===e.webkitPresentationMode},set:function(n){n?(e.webkitSetPresentationMode("picture-in-picture"),t.emit("pip",!0)):(e.webkitSetPresentationMode("inline"),t.emit("pip"))}})}(t):U(t,"pip",{get:function(){return!1},set:function(){n.show=e.get("PIP Not Supported")}})}var Rt=n((function e(n){t(this,e),function(t){var e=t.option,n=t.template.$video;U(t,"url",{get:function(){return n.currentSrc},set:function(r){var o=e.type||H(r),i=e.customType[o];o&&i?Z().then((function(){t.loading.show=!0,i.call(t,n,r,t)})):(t.url&&t.url!==r&&t.once("video:canplay",(function(){t.isReady&&t.emit("restart")})),n.src=r,t.option.url=r,t.emit("url",r))}})}(n),function(t){var e=t.template.$video;U(t,"attr",{value:function(t,n){if(void 0===n)return e[t];e[t]=n}})}(n),function(t){var e=t.i18n,n=t.notice,r=t.option,o=t.constructor.instances,i=t.template.$video;U(t,"play",{value:function(){var a=i.play();if(a&&a.then&&a.then().catch((function(t){throw n.show=t,t})),r.mutex)for(var c=0;cd){var h=d*s/l;k(n,"width","".concat(100*h,"%")),k(n,"height","100%"),k(n,"padding","0 ".concat((u-u*h)/2,"px"))}else{var v=l/d/s;k(n,"width","100%"),k(n,"height","".concat(100*v,"%")),k(n,"padding","".concat((p-p*v)/2,"px 0"))}r.dataset.aspectRatio=e}i.show="".concat(o.get("Aspect Ratio"),": ").concat("default"===e?o.get("Default"):e),t.emit("aspectRatio",e)}}),U(t,"aspectRatioReset",{set:function(e){if(e){var n=t.aspectRatio;t.aspectRatio=n}}})}(n),function(t){var e=t.option,n=t.notice,r=t.template.$video,o=document.createElement("canvas");U(t,"getDataURL",{value:function(){return new Promise((function(t,e){try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(t){n.show=t,e(t)}}))}}),U(t,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){n.show=t,e(t)}}))}}),U(t,"screenshot",{value:function(){return t.getDataURL().then((function(n){return W(n,"".concat(e.title||"artplayer","_").concat(tt(r.currentTime),".png")),t.emit("screenshot",n),n}))}})}(n),Pt(n),function(t){var e=t.notice,n=t.template.$player;U(t,"fullscreenWeb",{get:function(){return x(n,"art-fullscreen-web")},set:function(r){r?(b(n,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreenWeb",!0),e.show=""):(w(n,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"),e.show="")}})}(n),St(n),function(t){var e=t.template.$video;U(t,"loaded",{get:function(){return t.loadedTime/e.duration}}),U(t,"loadedTime",{get:function(){return e.buffered.length?e.buffered.end(e.buffered.length-1):0}})}(n),function(t){U(t,"played",{get:function(){return t.currentTime/t.duration}})}(n),function(t){var e=t.template.$video;U(t,"playing",{get:function(){return!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)}})}(n),function(t){var e=t.template,n=e.$container,r=e.$player,o=e.$video;U(t,"autoSize",{get:function(){return x(n,"art-auto-size")},set:function(e){if(e){var i=o.videoWidth,a=o.videoHeight,c=n.getBoundingClientRect(),l=c.width,s=c.height,u=i/a,p=l/s;if(b(n,"art-auto-size"),p>u)k(r,"width","".concat(s*u/l*100,"%")),k(r,"height","100%");else{var f=l/u/s*100;k(r,"width","100%"),k(r,"height","".concat(f,"%"))}t.emit("autoSize",{width:t.width,height:t.height})}else w(n,"art-auto-size"),k(r,"width",null),k(r,"height",null),t.emit("autoSize")}})}(n),function(t){U(t,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}});for(var e=["bottom","height","left","right","top","width"],n=function(n){var r=e[n];U(t,r,{get:function(){return t.rect[r]}})},r=0;r=1?(e=[r,o],t.emit("loop",e)):(e=[],t.emit("loop"))}else e=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){e.length&&(t.currentTimee[1])&&(t.seek=e[0])}))}(n),function(t){var e=t.option,n=t.template.$poster;U(t,"poster",{get:function(){return e.poster},set:function(t){e.poster=t,k(n,"backgroundImage","url(".concat(t,")"))}})}(n),function(t){var e=t.option,n=t.template,r=n.$container,o=n.$video,i=r.style.height;U(t,"autoHeight",{get:function(){return x(r,"art-auto-height")},set:function(n){if(n){var a=r.clientWidth,c=o.videoHeight*(a/o.videoWidth);k(r,"height",c+"px"),b(r,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight",c)}else k(r,"height",i),w(r,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight")}})}(n),function(t){var e=t.option,n=t.template.$player;U(t,"theme",{get:function(){return getComputedStyle(n).getPropertyValue("--theme")},set:function(t){e.theme=t,n.style.setProperty("--theme",t)}})}(n),function(t){U(t,"title",{get:function(){return t.option.title},set:function(e){t.option.title=e}})}(n),function(t){var e=["mini","pip","fullscreen","fullscreenWeb"];!function(e){for(var n=function(n){var r=e[n];t.on(r,(function(){t[r]&&e.filter((function(t){return t!==r})).forEach((function(e){t[e]&&(t[e]=!1)}))}))},r=0;r=Number(o.dataset.index)}));return a?a.insertAdjacentElement("beforebegin",o):O(this.$parent,o),n.html&&O(o,n.html),n.style&&j(o,n.style),n.tooltip&&E(o,n.tooltip),n.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),n.click.call(e.art,e,t)})),n.selector&&["left","right"].includes(n.position)&&this.selector(n,o),n.mounted&&n.mounted.call(this.art,o),1===o.childNodes.length&&3===o.childNodes[0].nodeType&&b(o,"art-control-onlyText"),U(this,r,{value:o}),o}}},{key:"selector",value:function(t,e){var n=this,r=this.art.events,o=r.hover,i=r.proxy;b(e,"art-control-selector");var a=document.createElement("div");b(a,"art-selector-value"),O(a,t.html),e.innerText="",O(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),l=document.createElement("div");b(l,"art-selector-list"),O(l,c),O(e,l);var s=function(){var t=P(e,"width")/2-P(l,"width")/2;l.style.left="".concat(t,"px")};o(e,s),i(l,"click",(function(e){var r=(e.composedPath()||[]).find((function(t){return x(t,"art-selector-item")}));if(r){R(r,"art-current");var o=Number(r.dataset.index),i=t.selector[o]||{};if(a.innerText=r.innerText,t.onSelect){var c=t.onSelect.call(n.art,i,r,e);"string"!=typeof c&&"number"!=typeof c||(a.innerHTML=c)}s(),n.art.emit("selector",i,r)}}))}}]),e}();function zt(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(t){for(var e=1;e
',mounted:function(t){var i=!1,a=y(".art-progress-loaded",t),c=y(".art-progress-played",t),l=y(".art-progress-highlight",t),s=y(".art-progress-indicator",t),u=y(".art-progress-tip",t);k(c,"backgroundColor","var(--theme)");var p=14;function f(t,e){"loaded"===t&&k(a,"width","".concat(100*e,"%")),"played"===t&&(k(c,"width","".concat(100*e,"%")),k(s,"left","calc(".concat(100*e,"% - ").concat(p/2,"px)")))}n.indicator?(p=16,O(s,n.indicator)):j(s,{backgroundColor:"var(--theme)"}),j(s,{left:"-".concat(p/2,"px"),width:"".concat(p,"px"),height:"".concat(p,"px")});for(var d=0;d'))}f("loaded",e.loaded),e.on("video:progress",(function(){f("loaded",e.loaded)})),e.on("video:timeupdate",(function(){f("played",e.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){k(u,"display","block"),$(n,l)?function(n){var r=Vt(e,n).width,o=n.target.dataset.text;u.innerHTML=o;var i=u.clientWidth;r<=i/2?k(u,"left",0):r>t.clientWidth-i/2?k(u,"left","".concat(t.clientWidth-i,"px")):k(u,"left","".concat(r-i/2,"px"))}(n):function(n){var r=Vt(e,n),o=r.width,i=r.time;u.innerHTML=i;var a=u.clientWidth;o<=a/2?k(u,"left",0):o>t.clientWidth-a/2?k(u,"left","".concat(t.clientWidth-a,"px")):k(u,"left","".concat(o-a/2,"px"))}(n)})),o(t,"mouseout",(function(){k(u,"display","none")})),o(t,"click",(function(t){if(t.target!==s){var n=Vt(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(s,"mousedown",(function(){i=!0})),o(document,"mousemove",(function(t){if(i){var n=Vt(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(document,"mouseup",(function(){i&&(i=!1)})),o(s,"touchstart",(function(t){1===t.touches.length&&(i=!0)})),o(document,"touchmove",(function(t){if(1===t.touches.length&&i){var n=Vt(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(document,"touchend",(function(){i&&(i=!1)}))}})}}function Wt(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 Nt(t){for(var e=1;eo.clientWidth-f/2?k(t,"left","".concat(o.clientWidth-f,"px")):k(t,"left","".concat(a-f/2,"px"))}(r))})),c(o,"mouseout",(function(){k(t,"display","none")}))}})}}function te(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 ee(t){for(var e=1;e=3e3&&(n.show=!1,b(a,"art-hide-cursor"),w(a,"art-hover"))})),e.once("video:loadedmetadata",(function(){n.add(Ht({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Kt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(function(t){return function(e){return ie(ie({},t),{},{mounted:function(t){var n=O(t,''),r=O(t,'');e.on("loop",(function(o){o?(k(t,"display","block"),k(n,"left","calc(".concat(o[0]/e.duration*100,"% - ").concat(n.clientWidth,"px)")),k(r,"left","".concat(o[1]/e.duration*100,"%"))):k(t,"display","none")}))}})}}({name:"loop",disable:!1,position:"top",index:30})),n.add(function(t){return function(e){return It(It({},t),{},{mounted:function(t){var n=e.events.proxy,r=e.icons,o=e.i18n,i=O(t,r.play),a=O(t,r.pause);function c(){k(i,"display","flex"),k(a,"display","none")}function l(){k(i,"display","none"),k(a,"display","flex")}E(i,o.get("Play")),E(a,o.get("Pause")),n(i,"click",(function(){e.play()})),n(a,"click",(function(){e.pause()})),e.playing?l():c(),e.on("video:playing",(function(){l()})),e.on("video:pause",(function(){c()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(function(t){return function(e){return Yt(Yt({},t),{},{mounted:function(t){var n=e.events.proxy,r=e.icons,o=e.i18n,i=!1,a=O(t,r.volume),c=O(t,r.volumeClose),l=O(t,'
'),s=O(l,'
');function u(t){var e=l.getBoundingClientRect().left;return K(t.pageX-e-6,0,54)/48}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(e.muted||0===t)k(a,"display","none"),k(c,"display","flex"),k(s,"left","0");else{var n=48*t;k(a,"display","flex"),k(c,"display","none"),k(s,"left","".concat(n,"px"))}}E(a,o.get("Mute")),k(c,"display","none"),d&&k(l,"display","none"),p(e.volume),e.on("video:volumechange",(function(){p(e.volume)})),n(a,"click",(function(){e.muted=!0})),n(c,"click",(function(){e.muted=!1})),n(l,"click",(function(t){e.muted=!1,e.volume=u(t)})),n(s,"mousedown",(function(){i=!0})),n(t,"mousemove",(function(t){i&&(e.muted=!1,e.volume=u(t))})),n(document,"mouseup",(function(){i&&(i=!1)}))}})}}({name:"volume",disable:!1,position:"left",index:20})),n.add(function(t){return function(e){return Ut(Ut({},t),{},{mounted:function(t){function n(){var n="".concat(tt(e.currentTime)," / ").concat(tt(e.duration));n!==t.innerText&&(t.innerText=n)}n();for(var r=["video:loadedmetadata","video:timeupdate","video:progress"],o=0;o0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,n){var r=n.target.dataset.value;r&&(e.playbackRate=Number(r),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var n=g("span",t).find((function(t){return Number(t.dataset.value)===e}));n&&R(n,"art-current")}))}})}}({disable:!n.playbackRate,name:"playbackRate",index:10})),this.add(function(t){return function(e){var n=e.i18n;return pe(pe({},t),{},{html:"".concat(n.get("Aspect Ratio"),':').concat(n.get("Default"),'4:316:9'),click:function(t,n){var r=n.target.dataset.value;r&&(e.aspectRatio=r,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var n=g("span",t).find((function(t){return t.dataset.value===e}));n&&R(n,"art-current")}))}})}}({disable:!n.aspectRatio,name:"aspectRatio",index:20})),this.add(function(t){return function(e){var n=e.i18n;return de(de({},t),{},{html:"".concat(n.get("Video Flip"),':').concat(n.get("Normal"),'').concat(n.get("Horizontal"),'').concat(n.get("Vertical"),""),click:function(t,n){var r=n.target.dataset.value;r&&(e.flip=r,t.show=!1)},mounted:function(t){e.on("flip",(function(e){var n=g("span",t).find((function(t){return t.dataset.value===e}));n&&R(n,"art-current")}))}})}}({disable:!n.flip,name:"flip",index:30})),this.add(function(t){return function(e){return ve(ve({},t),{},{html:e.i18n.get("Video Info"),click:function(t){e.info.show=!0,t.show=!1}})}}({disable:!1,name:"info",index:40})),this.add(function(t){return ye(ye({},t),{},{html:'ArtPlayer 4.3.8'})}({disable:!1,name:"version",index:50})),this.add(function(t){return function(e){return be(be({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60}));for(var c=0;cs+l&&(h=l-d),r+f>u+c&&(v=c-f),j(i,{top:"".concat(v,"px"),left:"".concat(h,"px")})})),a(o,"click",(function(e){$(e,i)||(t.show=!1)})),this.art.on("blur",(function(){t.show=!1}))}}]),o}($t);function Oe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}var ke=function(e){i(o,e);var r=Oe(o);function o(e){var n;return t(this,o),(n=r.call(this,e)).name="info",e.once("video:loadedmetadata",(function(){d||n.init()})),n}return n(o,[{key:"init",value:function(){var t=this,e=this.art,n=e.events.proxy,r=e.template,o=r.$infoPanel,i=r.$infoClose,a=r.$video;n(i,"click",(function(){t.show=!1}));var c=null,l=g("[data-video]",o)||[];this.art.on("destroy",(function(){clearTimeout(c)})),function t(){for(var e=0;e".concat(et(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,r=n.i18n,o=n.notice,i=n.option,a=Pe(Pe(Pe({},i.subtitle),e),{},{url:t});return this.init(a).then((function(t){return e.name&&(o.show="".concat(r.get("Switch Subtitle"),": ").concat(e.name)),t}))}},{key:"init",value:function(t){var e=this;if(u(t,dt.subtitle),t.url){var n=this.art,r=n.notice,o=n.events.proxy,i=n.template,a=i.$subtitle,c=i.$video;if(!i.$track){var l=document.createElement("track");l.default=!0,l.kind="metadata",c.appendChild(l),this.art.template.$track=l,o(this.textTrack,"cuechange",this.update.bind(this))}return this.style(Pe({"text-shadow":V()},t.style)),F(window.fetch,"fetch not support"),fetch(t.url).then((function(t){return t.arrayBuffer()})).then((function(n){F(window.TextDecoder,"TextDecoder not support");var r=new TextDecoder(t.encoding).decode(n);switch(e.art.emit("subtitleLoad",t.url),t.type||H(t.url)){case"srt":return B(I(r));case"ass":return B(q(r));case"vtt":return B(r);default:return t.url}})).then((function(t){return a.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t,e.art.emit("subtitleSwitch",t)),t})).catch((function(t){throw r.show=t,t}))}}}]),o}($t);var Ee=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:loadedmetadata",(function(){!function(t,e){var n=t.template,r=n.$player,o=n.$video;e.proxy(document,["click","contextmenu"],(function(e){$(e,r)?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}));var i=0;e.proxy(o,"click",(function(){var e=Date.now();e-i<=300?(t.emit("dblclick"),d?t.toggle():t.fullscreen=!t.fullscreen):(t.emit("click"),d||t.toggle()),i=e}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){b(n,"art-hover"),t.emit("hover",!0)}),(function(){w(n,"art-hover"),t.emit("hover")}))}(n,r),function(t,e){var n=t.template.$player;e.proxy(n,"mousemove",(function(e){t.emit("mousemove",e)}))}(n,r),function(t,e){var n=t.notice,r=t.option,o=J((function(){t.normalSize&&(t.autoSize=r.autoSize),t.aspectRatioReset=!0,n.show="",t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){o()})),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",(function(){o()}))}(n,r),function(t,e){if(d&&!t.option.isLive){var n=t.notice,r=t.template.$video,o=!1,i=0,a=0,c=null;e.proxy(r,"touchstart",(function(e){1===e.touches.length&&(o=!0,i=e.touches[0].clientX,clearTimeout(c),c=setTimeout((function(){t.playbackRate=3}),1e3))})),e.proxy(r,"touchmove",(function(e){if(1===e.touches.length&&o&&t.duration){var c=K((e.touches[0].clientX-i)/r.clientWidth,-1,1);a=K(t.currentTime+t.duration*c,0,t.duration),n.show="".concat(tt(a)," / ").concat(tt(t.duration))}})),e.proxy(document,"touchend",(function(){o&&(a&&(t.seek=a),3===t.playbackRate&&(t.playbackRate=1),i=0,a=0,o=!1,clearTimeout(c),c=null)}))}}(n,r),function(t,e){var n=t.option,r=t.template.$container,o=J((function(){t.emit("view",C(r,50))}),200);e.proxy(window,"scroll",(function(){o()})),t.on("view",(function(e){n.autoMini&&(t.mini=!e)}))}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return r.proxy(t,e,n,o)}));t.addEventListener(e,n,o);var i=function(){return t.removeEventListener(e,n,o)};return this.destroyEvents.push(i),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 o;if(t instanceof HTMLImageElement)o=t;else{if("string"!=typeof t)return r(new L("Unable to get Image"));(o=new Image).src=t}if(o.complete)return n(o);e.proxy(o,"load",(function(){return n(o)})),e.proxy(o,"error",(function(){return r(new L("Failed to load Image: ".concat(o.src)))}))}))}},{key:"destroy",value:function(){for(var t=0;t',state:'',play:'',pause:'',check:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:'',arrowLeft:'',arrowRight:'',playbackRate:'',aspectRatio:'',config:'',lock:'',unlock:''},n.option.icons);Object.keys(o).forEach((function(t){U(r,t,{get:function(){var e=document.createElement("i");return b(e,"art-icon"),b(e,"art-icon-".concat(t)),O(e,o[t]),e}})}))}));function Be(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function qe(t,e,n){for(var r=0;r'),c=document.createElement("div");b(c,"art-setting-item-left-icon"),O(c,r.arrowLeft),O(a,c),O(a,t._parentItem.html);var l=o(i,"click",(function(){e.init(t._parentList)}));return this.events.push(l),i}},{key:"creatItem",value:function(t){var e=this,n=this.art,r=n.icons,o=n.events.proxy,i=t.selector&&t.selector.length,a=document.createElement("div");b(a,"art-setting-item"),t.default&&b(a,"art-current"),void 0!==t.value&&(a.dataset.value=t.value);var c=O(a,'
'),l=O(a,'
'),s=document.createElement("div");if(b(s,"art-setting-item-left-icon"),O(s,i?t.icon||r.config:r.check),O(c,s),O(c,t.html),i){var u=document.createElement("div");b(u,"art-setting-item-right-tooltip"),O(l,u),t._$tooltip=u;var p=t.tooltip;U(t,"tooltip",{get:function(){return u.innerHTML},set:function(t){u.innerHTML=t}}),p&&(t.tooltip=p);var f=document.createElement("div");b(f,"art-setting-item-right-icon"),O(f,r.arrowRight),O(l,f)}var d=o(a,"click",(function(n){if(i)e.init(t.selector,t.width);else if(R(a,"art-current"),t._parentList&&e.init(t._parentList),t._parentItem&&t._parentItem.onSelect){var r=t._parentItem.onSelect.call(e.art,t,a,n);t._parentItem._$tooltip&&("string"!=typeof r&&"number"!=typeof r||(t._parentItem._$tooltip.innerHTML=r))}}));return this.events.push(d),a}},{key:"add",value:function(t){"function"==typeof t?this.option.push(t(this.art)):this.option.push(t),this.cache=new Map,this.events.forEach((function(t){return t()})),this.events=[],this.$parent.innerHTML="",this.option=qe(this.option),this.init(this.option)}},{key:"init",value:function(t,e){if(this.cache.has(t)){var n=this.cache.get(t);R(n,"art-current"),k(this.$parent,"width","".concat(n.dataset.width,"px"))}else{var r=document.createElement("div");b(r,"art-setting-panel"),t[0]&&t[0]._parentItem&&O(r,this.creatHeader(t[0]));for(var o=0;o10&&delete e[r[0]],e[t.option.url]=t.currentTime,n.set("times",e)})),t.on("ready",(function(){var o=(n.get("times")||{})[t.option.url];o&&(t.seek=o,k(r,"display","none"),t.notice.show="".concat(e.get("Auto playback at")," ").concat(tt(o)))})),{name:"autoPlayback",get times(){return n.get("times")||{}},clear:function(){return n.del("times")}}}function _e(t){var e=t.layers,n=t.icons,r=t.template.$player;return e.add({name:"lock",mounted:function(e){var r=O(e,n.lock),o=O(e,n.unlock);k(r,"display","none"),t.on("lock",(function(t){t?(k(r,"display","inline-flex"),k(o,"display","none")):(k(r,"display","none"),k(o,"display","inline-flex"))}))},click:function(){x(r,"art-lock")?(w(r,"art-lock"),t.emit("lock",!1)):(b(r,"art-lock"),t.emit("lock",!0))}}),{name:"lock",get state(){return x(r,"art-lock")}}}var Ue=function(){function e(n){t(this,e),this.art=n,this.id=0;var r=n.option;!r.isLive&&r.miniProgressBar&&this.add(We),r.lock&&d&&this.add(_e),r.autoPlayback&&this.add(Ne);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.isEnd||(this.art.switchUrl(e.url),this.art.once("video:timeupdate",(function(){t.art.emit("ads:start",e)})),this.art.once("video:ended",(function(){var e=t.next;e?(t.index+=1,t.play(e)):t.end()})))}},{key:"end",value:function(){this.isEnd||(this.isEnd=!0,this.playing=!1,this.art.option.url=this.urlCache,this.art.switchUrl(this.urlCache),this.art.emit("ads:end"))}}]),e}(),Ye=n((function e(n){t(this,e);for(var r=n.option,o=n.events.proxy,i=n.template.$video,a=0;a0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),Ze.splice(Ze.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return Ze}},{key:"version",get:function(){return"4.3.8"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"1650895994387"}},{key:"config",get:function(){return ht}},{key:"utils",get:function(){return nt}},{key:"scheme",get:function(){return dt}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return mt.html}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!0,autoPlayback:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:h?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),a}(p);return console.log("%c ArtPlayer %c 4.3.8 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),Je})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artplayer=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function b(t,e){return t.classList.add(e)}function w(t,e){return t.classList.remove(e)}function x(t,e){return t.classList.contains(e)}function O(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function k(t,e,n){return t.style[e]=n,t}function j(t,e){return Object.keys(e).forEach((function(n){k(t,n,e[n])})),t}function P(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 E(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function S(t,e){E(t).forEach((function(t){return w(t,e)})),b(t,e)}function T(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";d||(t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n))}function R(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=n.top-e<=r&&n.top+n.height+e>=0,a=n.left-e<=o+e&&n.left+n.width+e>=0;return i&&a}function C(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function I(t,e){return e.parentNode.replaceChild(t,e),t}function $(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function A(t,e,n){return A=$()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&o(i,n.prototype),i},A.apply(null,arguments)}function D(t){var e="function"==typeof Map?new Map:void 0;return D=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return A(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)},D(t)}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}var L=function(e){i(a,e);var o=M(a);function a(e,n){var i;return t(this,a),i=o.call(this,e),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r(i),n||i.constructor),i.name="ArtPlayerError",i}return n(a)}(D(Error));function z(t,e){if(!t)throw new L(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 N(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function B(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(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.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 F(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#000",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return[[e,0],[0,e],[-e,0],[0,-e],[e,e],[-e,-e],[e,-e],[-e,e]].map((function(e){return"".concat(t," ").concat(e[0],"px ").concat(e[1],"px ").concat(n,"px")})).join(",")}function H(t){return t.includes("?")?H(t.split("?")[0]):t.includes("#")?H(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function W(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)}function V(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function J(t,e){var n,r,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),l=0;l0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function et(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var nt=Object.freeze({__proto__:null,query:m,queryAll:g,addClass:b,removeClass:w,hasClass:x,append:O,remove:function(t){return t.parentNode.removeChild(t)},setStyle:k,setStyles:j,getStyle:P,sublings:E,inverseClass:S,tooltip:T,isInViewport:R,includeFromEvent:C,replaceElement:I,ArtPlayerError:L,errorHandle:z,srtToVtt:_,vttToBlob:N,assToVtt:B,outline:F,getExt:H,download:W,def:U,has:Z,get:G,mergeDeep:X,sleep:Q,debounce:function(t,e,n){var r;function o(){for(var o=arguments.length,i=new Array(o),a=0;a-1;case"function":return t(f);case"regexp":return t.test(f);default:return!1}}))}}]),e}(),yt=function(){function e(n){var r=this;t(this,e),this.art=n;var o=n.option,i=n.constructor,a=n.whitelist;o.container instanceof Element?this.$container=o.container:(this.$container=m(o.container),z(this.$container,"No container element found by ".concat(o.container)));var c=this.$container.tagName.toLowerCase();z("div"===c,"Unsupported container element type, only support 'div' but got '".concat(c,"'")),z(i.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=n.id,this.$original=this.$container.cloneNode(!0),a.state?this.desktop():this.mobile()}return n(e,[{key:"query",value:function(t){return m(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option;t.useSSR||(this.$container.innerHTML=e.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$miniHeader=this.query(".art-mini-header"),this.$miniTitle=this.query(".art-mini-title"),this.$miniClose=this.query(".art-mini-close"),this.$contextmenu=this.query(".art-contextmenus"),t.backdrop&&(b(this.$setting,"art-backdrop-filter"),b(this.$contextmenu,"art-backdrop-filter"),b(this.$info,"art-backdrop-filter")),d&&b(this.$player,"art-mobile")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?I(this.$original,this.$container):b(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.3.9
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),mt={"Video Info":"统计信息",Close:"关闭","Video Load Failed":"加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音","Video Flip":"画面翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide Subtitle":"隐藏字幕","Show Subtitle":"显示字幕","Show Setting":"显示设置","Hide Setting":"隐藏设置",Screenshot:"截图","Play Speed":"播放速度","Aspect Ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch Video":"切换","Switch Subtitle":"切换字幕",Fullscreen:"全屏","Exit Fullscreen":"退出全屏","Web Fullscreen":"网页全屏","Exit Web Fullscreen":"退出网页全屏","Mini Player":"迷你播放器","PIP Mode":"画中画模式","Exit PIP Mode":"退出画中画模式","PIP Not Supported":"不支持画中画模式","Fullscreen Not Supported":"不支持全屏模式","Subtitle Offset":"字幕偏移","Auto playback at":"已为您定位至"},gt={"Video Info":"統計訊息",Close:"關閉","Video Load Failed":"載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音","Video Flip":"畫面翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide Subtitle":"隱藏字幕","Show Subtitle":"顯示字幕","Show Setting":"顯示设置","Hide Setting":"隱藏设置",Screenshot:"截圖","Play Speed":"播放速度","Aspect Ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch Video":"切換","Switch Subtitle":"切換字幕",Fullscreen:"全屏","Exit Fullscreen":"退出全屏","Web Fullscreen":"網頁全屏","Exit Web Fullscreen":"退出網頁全屏","Mini Player":"迷你播放器","PIP Mode":"畫中畫模式","Exit PIP Mode":"退出畫中畫模式","PIP Not Supported":"不支持畫中畫模式","Fullscreen Not Supported":"不支持全屏模式","Subtitle Offset":"字幕偏移","Auto playback at":"已為您定位至"},bt=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":mt,"zh-tw":gt},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=X(this.languages,t),this.init()}}]),e}();var wt={exports:{}};!function(t){!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,o=n.length,i={};rd){var h=d*s/l;k(n,"width","".concat(100*h,"%")),k(n,"height","100%"),k(n,"padding","0 ".concat((u-u*h)/2,"px"))}else{var v=l/d/s;k(n,"width","100%"),k(n,"height","".concat(100*v,"%")),k(n,"padding","".concat((p-p*v)/2,"px 0"))}r.dataset.aspectRatio=e}i.show="".concat(o.get("Aspect Ratio"),": ").concat("default"===e?o.get("Default"):e),t.emit("aspectRatio",e)}}),U(t,"aspectRatioReset",{set:function(e){if(e){var n=t.aspectRatio;t.aspectRatio=n}}})}(n),function(t){var e=t.option,n=t.notice,r=t.template.$video,o=document.createElement("canvas");U(t,"getDataURL",{value:function(){return new Promise((function(t,e){try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(t){n.show=t,e(t)}}))}}),U(t,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){n.show=t,e(t)}}))}}),U(t,"screenshot",{value:function(){return t.getDataURL().then((function(n){return W(n,"".concat(e.title||"artplayer","_").concat(tt(r.currentTime),".png")),t.emit("screenshot",n),n}))}})}(n),Ot(n),function(t){var e=t.notice,n=t.template.$player;U(t,"fullscreenWeb",{get:function(){return x(n,"art-fullscreen-web")},set:function(r){r?(b(n,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreenWeb",!0),e.show=""):(w(n,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"),e.show="")}})}(n),kt(n),function(t){var e=t.template.$video;U(t,"loaded",{get:function(){return t.loadedTime/e.duration}}),U(t,"loadedTime",{get:function(){return e.buffered.length?e.buffered.end(e.buffered.length-1):0}})}(n),function(t){U(t,"played",{get:function(){return t.currentTime/t.duration}})}(n),function(t){var e=t.template.$video;U(t,"playing",{get:function(){return!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)}})}(n),function(t){var e=t.template,n=e.$container,r=e.$player,o=e.$video;U(t,"autoSize",{get:function(){return x(n,"art-auto-size")},set:function(e){if(e){var i=o.videoWidth,a=o.videoHeight,c=n.getBoundingClientRect(),l=c.width,s=c.height,u=i/a,p=l/s;if(b(n,"art-auto-size"),p>u)k(r,"width","".concat(s*u/l*100,"%")),k(r,"height","100%");else{var f=l/u/s*100;k(r,"width","100%"),k(r,"height","".concat(f,"%"))}t.emit("autoSize",{width:t.width,height:t.height})}else w(n,"art-auto-size"),k(r,"width",null),k(r,"height",null),t.emit("autoSize")}})}(n),function(t){U(t,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}});for(var e=["bottom","height","left","right","top","width"],n=function(n){var r=e[n];U(t,r,{get:function(){return t.rect[r]}})},r=0;r=1?(e=[r,o],t.emit("loop",e)):(e=[],t.emit("loop"))}else e=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){e.length&&(t.currentTimee[1])&&(t.seek=e[0])}))}(n),function(t){var e=t.option,n=t.template.$poster;U(t,"poster",{get:function(){return e.poster},set:function(t){e.poster=t,k(n,"backgroundImage","url(".concat(t,")"))}})}(n),function(t){var e=t.option,n=t.template,r=n.$container,o=n.$video,i=r.style.height;U(t,"autoHeight",{get:function(){return x(r,"art-auto-height")},set:function(n){if(n){var a=r.clientWidth,c=o.videoHeight*(a/o.videoWidth);k(r,"height",c+"px"),b(r,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight",c)}else k(r,"height",i),w(r,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight")}})}(n),function(t){var e=t.option,n=t.template.$player;U(t,"theme",{get:function(){return getComputedStyle(n).getPropertyValue("--theme")},set:function(t){e.theme=t,n.style.setProperty("--theme",t)}})}(n),function(t){U(t,"title",{get:function(){return t.option.title},set:function(e){t.option.title=e}})}(n),function(t){var e=["mini","pip","fullscreen","fullscreenWeb"];!function(e){for(var n=function(n){var r=e[n];t.on(r,(function(){t[r]&&e.filter((function(t){return t!==r})).forEach((function(e){t[e]&&(t[e]=!1)}))}))},r=0;r=Number(o.dataset.index)}));return a?a.insertAdjacentElement("beforebegin",o):O(this.$parent,o),n.html&&O(o,n.html),n.style&&j(o,n.style),n.tooltip&&T(o,n.tooltip),n.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),n.click.call(e.art,e,t)})),n.selector&&["left","right"].includes(n.position)&&this.selector(n,o),n.mounted&&n.mounted.call(this.art,o),1===o.childNodes.length&&3===o.childNodes[0].nodeType&&b(o,"art-control-onlyText"),U(this,r,{value:o}),o}}},{key:"selector",value:function(t,e){var n=this,r=this.art.events,o=r.hover,i=r.proxy;b(e,"art-control-selector");var a=document.createElement("div");b(a,"art-selector-value"),O(a,t.html),e.innerText="",O(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),l=document.createElement("div");b(l,"art-selector-list"),O(l,c),O(e,l);var s=function(){var t=P(e,"width")/2-P(l,"width")/2;l.style.left="".concat(t,"px")};o(e,s),i(l,"click",(function(e){var r=(e.composedPath()||[]).find((function(t){return x(t,"art-selector-item")}));if(r){S(r,"art-current");var o=Number(r.dataset.index),i=t.selector[o]||{};if(a.innerText=r.innerText,t.onSelect){var c=t.onSelect.call(n.art,i,r,e);"string"!=typeof c&&"number"!=typeof c||(a.innerHTML=c)}s(),n.art.emit("selector",i,r)}}))}}]),e}();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 Rt(t){for(var e=1;e
',mounted:function(t){var i=!1,a=m(".art-progress-loaded",t),c=m(".art-progress-played",t),l=m(".art-progress-highlight",t),s=m(".art-progress-indicator",t),u=m(".art-progress-tip",t);k(c,"backgroundColor","var(--theme)");var p=e.constructor.INDICATOR_SIZE;function f(t,e){"loaded"===t&&k(a,"width","".concat(100*e,"%")),"played"===t&&(k(c,"width","".concat(100*e,"%")),k(s,"left","calc(".concat(100*e,"% - ").concat(p/2,"px)")))}n.indicator?(p=e.constructor.INDICATOR_SIZE_ICON,O(s,n.indicator)):j(s,{backgroundColor:"var(--theme)"}),d&&(p=e.constructor.INDICATOR_SIZE_MOBILE,n.indicator&&(p=e.constructor.INDICATOR_SIZE_MOBILE_ICON)),j(s,{left:"-".concat(p/2,"px"),width:"".concat(p,"px"),height:"".concat(p,"px")});for(var h=0;h'))}f("loaded",e.loaded),e.on("video:progress",(function(){f("loaded",e.loaded)})),e.on("video:timeupdate",(function(){f("played",e.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){k(u,"display","block"),C(n,l)?function(n){var r=_t(e,n).width,o=n.target.dataset.text;u.innerHTML=o;var i=u.clientWidth;r<=i/2?k(u,"left",0):r>t.clientWidth-i/2?k(u,"left","".concat(t.clientWidth-i,"px")):k(u,"left","".concat(r-i/2,"px"))}(n):function(n){var r=_t(e,n),o=r.width,i=r.time;u.innerHTML=i;var a=u.clientWidth;o<=a/2?k(u,"left",0):o>t.clientWidth-a/2?k(u,"left","".concat(t.clientWidth-a,"px")):k(u,"left","".concat(o-a/2,"px"))}(n)})),o(t,"mouseout",(function(){k(u,"display","none")})),o(t,"click",(function(t){if(t.target!==s){var n=_t(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(s,"mousedown",(function(){i=!0})),o(document,"mousemove",(function(t){if(i){var n=_t(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(document,"mouseup",(function(){i&&(i=!1)})),function(t,e,n){if(d&&!t.option.isLive){var r=t.plugins,o=t.template.$progress,i=t.events.proxy,a=!1;i(e,"touchstart",(function(t){1===t.touches.length&&(a=!0)})),i(document,"touchmove",(function(e){if(1===e.touches.length&&a){var i=r.autoOrientation&&r.autoOrientation.state,c=o.getBoundingClientRect(),l=c.left,s=c.top,u=e.touches[0],p=u.clientX,f=u.clientY,d=K(p-l,0,o.clientWidth),h=K(f-s,0,o.clientWidth),v=i?h:d,y=d/o.clientWidth*t.duration,m=h/o.clientWidth*t.duration,g=i?m:y,b=K(v/o.clientWidth,0,1);n("played",b),t.seek=g}})),i(document,"touchend",(function(){a&&(a=!1)}))}}(e,s,f)}})}}function Bt(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){for(var e=1;eo.clientWidth-f/2?k(t,"left","".concat(o.clientWidth-f,"px")):k(t,"left","".concat(a-f/2,"px"))}(r))})),c(o,"mouseout",(function(){k(t,"display","none")}))}})}}function Qt(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 Jt(t){for(var e=1;e=a.CONTROL_HIDE_TIME&&(n.show=!1,b(l,"art-hide-cursor"),w(l,"art-hover"))})),e.once("video:loadedmetadata",(function(){n.add(Nt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Xt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive||d,position:"top",index:20})),n.add(function(t){return function(e){return ne(ne({},t),{},{mounted:function(t){var n=O(t,''),r=O(t,'');e.on("loop",(function(o){o?(k(t,"display","block"),k(n,"left","calc(".concat(o[0]/e.duration*100,"% - ").concat(n.clientWidth,"px)")),k(r,"left","".concat(o[1]/e.duration*100,"%"))):k(t,"display","none")}))}})}}({name:"loop",disable:!1,position:"top",index:30})),n.add(function(t){return function(e){return Mt(Mt({},t),{},{mounted:function(t){var n=e.events.proxy,r=e.icons,o=e.i18n,i=O(t,r.play),a=O(t,r.pause);function c(){k(i,"display","flex"),k(a,"display","none")}function l(){k(i,"display","none"),k(a,"display","flex")}T(i,o.get("Play")),T(a,o.get("Pause")),n(i,"click",(function(){e.play()})),n(a,"click",(function(){e.pause()})),e.playing?l():c(),e.on("video:playing",(function(){l()})),e.on("video:pause",(function(){c()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(function(t){return function(e){return qt(qt({},t),{},{mounted:function(t){var n=e.events.proxy,r=e.icons,o=e.i18n,i=!1,a=e.constructor.VOLUME_PANEL_WIDTH,c=e.constructor.VOLUME_HANDLE_WIDTH,l=O(t,r.volume),s=O(t,r.volumeClose),u=O(t,'
'),p=O(u,'
');function f(t){var e=u.getBoundingClientRect().left;return K(t.pageX-e-c/2,0,a-c/2)/(a-c)}function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(e.muted||0===t)k(l,"display","none"),k(s,"display","flex"),k(p,"left","0");else{var n=(a-c)*t;k(l,"display","flex"),k(s,"display","none"),k(p,"left","".concat(n,"px"))}}T(l,o.get("Mute")),k(s,"display","none"),d&&k(u,"display","none"),h(e.volume),e.on("video:volumechange",(function(){h(e.volume)})),n(l,"click",(function(){e.muted=!0})),n(s,"click",(function(){e.muted=!1})),n(u,"click",(function(t){e.muted=!1,e.volume=f(t)})),n(p,"mousedown",(function(){i=!0})),n(t,"mousemove",(function(t){i&&(e.muted=!1,e.volume=f(t))})),n(document,"mouseup",(function(){i&&(i=!1)}))}})}}({name:"volume",disable:!1,position:"left",index:20})),n.add(function(t){return function(e){return Wt(Wt({},t),{},{mounted:function(t){function n(){var n="".concat(tt(e.currentTime)," / ").concat(tt(e.duration));n!==t.innerText&&(t.innerText=n)}n();for(var r=["video:loadedmetadata","video:timeupdate","video:progress"],o=0;o0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,n){var r=n.target.dataset.value;r&&(e.playbackRate=Number(r),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var n=g("span",t).find((function(t){return Number(t.dataset.value)===e}));n&&S(n,"art-current")}))}})}}({disable:!n.playbackRate,name:"playbackRate",index:10})),this.add(function(t){return function(e){var n=e.i18n;return le(le({},t),{},{html:"".concat(n.get("Aspect Ratio"),':').concat(n.get("Default"),'4:316:9'),click:function(t,n){var r=n.target.dataset.value;r&&(e.aspectRatio=r,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var n=g("span",t).find((function(t){return t.dataset.value===e}));n&&S(n,"art-current")}))}})}}({disable:!n.aspectRatio,name:"aspectRatio",index:20})),this.add(function(t){return function(e){var n=e.i18n;return ue(ue({},t),{},{html:"".concat(n.get("Video Flip"),':').concat(n.get("Normal"),'').concat(n.get("Horizontal"),'').concat(n.get("Vertical"),""),click:function(t,n){var r=n.target.dataset.value;r&&(e.flip=r,t.show=!1)},mounted:function(t){e.on("flip",(function(e){var n=g("span",t).find((function(t){return t.dataset.value===e}));n&&S(n,"art-current")}))}})}}({disable:!n.flip,name:"flip",index:30})),this.add(function(t){return function(e){return fe(fe({},t),{},{html:e.i18n.get("Video Info"),click:function(t){e.info.show=!0,t.show=!1}})}}({disable:!1,name:"info",index:40})),this.add(function(t){return he(he({},t),{},{html:'ArtPlayer 4.3.9'})}({disable:!1,name:"version",index:50})),this.add(function(t){return function(e){return ye(ye({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60}));for(var c=0;cs+l&&(h=l-d),r+f>u+c&&(v=c-f),j(i,{top:"".concat(v,"px"),left:"".concat(h,"px")})})),a(o,"click",(function(e){C(e,i)||(t.show=!1)})),this.art.on("blur",(function(){t.show=!1}))}}]),o}(St);function be(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}var we=function(e){i(o,e);var r=be(o);function o(e){var n;return t(this,o),(n=r.call(this,e)).name="info",e.once("video:loadedmetadata",(function(){d||n.init()})),n}return n(o,[{key:"init",value:function(){var t=this,e=this.art,n=e.constructor,r=e.events.proxy,o=e.template,i=o.$infoPanel,a=o.$infoClose,c=o.$video;r(a,"click",(function(){t.show=!1}));var l=null,s=g("[data-video]",i)||[];this.art.on("destroy",(function(){clearTimeout(l)})),function t(){for(var e=0;e".concat(et(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,r=n.i18n,o=n.notice,i=n.option,a=Oe(Oe(Oe({},i.subtitle),e),{},{url:t});return this.init(a).then((function(t){return e.name&&(o.show="".concat(r.get("Switch Subtitle"),": ").concat(e.name)),t}))}},{key:"init",value:function(t){var e=this;if(u(t,dt.subtitle),t.url){var n=this.art,r=n.notice,o=n.events.proxy,i=n.template,a=i.$subtitle,c=i.$video;if(!i.$track){var l=document.createElement("track");l.default=!0,l.kind="metadata",c.appendChild(l),this.art.template.$track=l,o(this.textTrack,"cuechange",this.update.bind(this))}return this.style(Oe({"text-shadow":F()},t.style)),z(window.fetch,"fetch not support"),fetch(t.url).then((function(t){return t.arrayBuffer()})).then((function(n){z(window.TextDecoder,"TextDecoder not support");var r=new TextDecoder(t.encoding).decode(n);switch(e.art.emit("subtitleLoad",t.url),t.type||H(t.url)){case"srt":return N(_(r));case"ass":return N(B(r));case"vtt":return N(r);default:return t.url}})).then((function(t){return a.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t,e.art.emit("subtitleSwitch",t)),t})).catch((function(t){throw r.show=t,t}))}}}]),o}(St);var Pe=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:loadedmetadata",(function(){!function(t,e){var n=t.constructor,r=t.template,o=r.$player,i=r.$video;e.proxy(document,["click","contextmenu"],(function(e){C(e,o)?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}));var a=0;e.proxy(i,"click",(function(){var e=Date.now();e-a<=n.DB_CLICE_TIME?(t.emit("dblclick"),d?t.toggle():t.fullscreen=!t.fullscreen):(t.emit("click"),d||t.toggle()),a=e}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){b(n,"art-hover"),t.emit("hover",!0)}),(function(){w(n,"art-hover"),t.emit("hover")}))}(n,r),function(t,e){var n=t.template.$player;e.proxy(n,"mousemove",(function(e){t.emit("mousemove",e)}))}(n,r),function(t,e){var n=t.notice,r=t.option,o=J((function(){t.normalSize&&(t.autoSize=r.autoSize),t.aspectRatioReset=!0,n.show="",t.emit("resize")}),t.constructor.RESIZE_TIME);e.proxy(window,["orientationchange","resize"],(function(){o()})),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",(function(){o()}))}(n,r),function(t,e){if(d&&!t.option.isLive){var n=t.notice,r=t.plugins,o=t.constructor,i=t.template.$video,a=!1,c=0,l=0,s=0,u=null;e.proxy(i,"touchstart",(function(e){if(1===e.touches.length){a=!0;var n=e.touches[0],r=n.clientX,i=n.clientY;c=r,l=i,clearTimeout(u),u=setTimeout((function(){t.playbackRate=o.MOBILE_AUTO_PLAYBACKRATE}),o.MOBILE_AUTO_PLAYBACKRATE_TIME)}})),e.proxy(i,"touchmove",(function(e){if(1===e.touches.length&&a){var o=r.autoOrientation&&r.autoOrientation.state,i=e.touches[0],u=i.clientX,p=i.clientY,f=K((u-c)/t.width,-1,1),d=K((p-l)/t.height,-1,1);t.duration&&(s=K(o?t.currentTime+t.duration*d:t.currentTime+t.duration*f,0,t.duration),n.show="".concat(tt(s)," / ").concat(tt(t.duration)))}})),e.proxy(document,"touchend",(function(){a&&(s&&(t.seek=s),3===t.playbackRate&&(t.playbackRate=1),c=0,l=0,s=0,a=!1,clearTimeout(u),u=null)}))}}(n,r),function(t,e){var n=t.option,r=t.constructor,o=t.template.$container,i=J((function(){t.emit("view",R(o,r.SCROLL_GAP))}),r.SCROLL_TIME);e.proxy(window,"scroll",(function(){i()})),t.on("view",(function(e){n.autoMini&&(t.mini=!e)}))}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return r.proxy(t,e,n,o)}));t.addEventListener(e,n,o);var i=function(){return t.removeEventListener(e,n,o)};return this.destroyEvents.push(i),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 o;if(t instanceof HTMLImageElement)o=t;else{if("string"!=typeof t)return r(new L("Unable to get Image"));(o=new Image).src=t}if(o.complete)return n(o);e.proxy(o,"load",(function(){return n(o)})),e.proxy(o,"error",(function(){return r(new L("Failed to load Image: ".concat(o.src)))}))}))}},{key:"destroy",value:function(){for(var t=0;t',state:'',play:'',pause:'',check:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:'',arrowLeft:'',arrowRight:'',playbackRate:'',aspectRatio:'',config:'',lock:'',unlock:''},n.option.icons);Object.keys(o).forEach((function(t){U(r,t,{get:function(){var e=document.createElement("i");return b(e,"art-icon"),b(e,"art-icon-".concat(t)),O(e,o[t]),e}})}))}));function Le(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function ze(t,e,n){for(var r=0;r'),c=document.createElement("div");b(c,"art-setting-item-left-icon"),O(c,r.arrowLeft),O(a,c),O(a,t._parentItem.html);var l=o(i,"click",(function(){e.init(t._parentList)}));return this.events.push(l),i}},{key:"creatItem",value:function(t){var e=this,n=this.art,r=n.icons,o=n.events.proxy,i=t.selector&&t.selector.length,a=document.createElement("div");b(a,"art-setting-item"),t.default&&b(a,"art-current");var c=O(a,'
'),l=O(a,'
'),s=document.createElement("div");b(s,"art-setting-item-left-icon"),O(s,i?t.icon||r.config:r.check),O(c,s),t._$icon=s,U(t,"icon",{get:function(){return s.innerHTML},set:function(t){"string"!=typeof t&&"number"!=typeof t||(s.innerHTML=t)}});var u=document.createElement("div");if(b(u,"art-setting-item-left-text"),O(u,t.html||""),O(c,u),t._$html=u,U(t,"html",{get:function(){return u.innerHTML},set:function(t){"string"!=typeof t&&"number"!=typeof t||(u.innerHTML=t)}}),i){var p=document.createElement("div");b(p,"art-setting-item-right-tooltip"),O(p,t.tooltip||""),O(l,p),t._$tooltip=p,U(t,"tooltip",{get:function(){return p.innerHTML},set:function(t){"string"!=typeof t&&"number"!=typeof t||(p.innerHTML=t)}});var f=document.createElement("div");b(f,"art-setting-item-right-icon"),O(f,r.arrowRight),O(l,f)}var d=o(a,"click",(function(n){if(i)e.init(t.selector,t.width);else if(S(a,"art-current"),t._parentList&&e.init(t._parentList),t._parentItem&&t._parentItem.onSelect){var r=t._parentItem.onSelect.call(e.art,t,a,n);t._parentItem._$tooltip&&("string"!=typeof r&&"number"!=typeof r||(t._parentItem._$tooltip.innerHTML=r))}}));return this.events.push(d),a}},{key:"init",value:function(t,e){if(this.cache.has(t)){var n=this.cache.get(t);S(n,"art-current"),k(this.$parent,"width","".concat(n.dataset.width,"px"))}else{var r=document.createElement("div");b(r,"art-setting-panel"),t[0]&&t[0]._parentItem&&O(r,this.creatHeader(t[0]));for(var o=0;oc&&su)&&setTimeout((function(){k(o,"width","".concat(u,"px")),k(o,"height","".concat(s,"px")),k(o,"transform-origin","0 0"),k(o,"transform","rotate(90deg) translate(0, -".concat(s,"px)")),b(o,"art-auto-orientation")}),n.MOBILE_AUTO_ORIENTATION_TIME)}else x(o,"art-auto-orientation")&&(k(o,"width",null),k(o,"height",null),k(o,"transform",null),k(o,"transform-origin",null),w(o,"art-auto-orientation"),t.aspectRatioReset=!0,t.autoSize=e.autoSize,t.notice.show="")})),{name:"autoOrientation",get state(){return x(o,"art-auto-orientation")}}}function He(t){var e=t.i18n,n=t.storage,r=t.constructor,o=t.template.$poster;return t.on("video:timeupdate",(function(){var e=n.get("times")||{},o=Object.keys(e);o.length>r.AUTO_PLAYBACK_MAX&&delete e[o[0]],e[t.option.url]=t.currentTime,n.set("times",e)})),t.on("ready",(function(){var r=(n.get("times")||{})[t.option.url];r&&(t.seek=r,k(o,"display","none"),t.notice.show="".concat(e.get("Auto playback at")," ").concat(tt(r)))})),{name:"autoPlayback",get times(){return n.get("times")||{}},clear:function(){return n.del("times")}}}function We(t){var e=t.layers,n=t.icons,r=t.template.$player;return e.add({name:"lock",mounted:function(e){var r=O(e,n.lock),o=O(e,n.unlock);k(r,"display","none"),t.on("lock",(function(t){t?(k(r,"display","inline-flex"),k(o,"display","none")):(k(r,"display","none"),k(o,"display","inline-flex"))}))},click:function(){x(r,"art-lock")?(w(r,"art-lock"),t.emit("lock",!1)):(b(r,"art-lock"),t.emit("lock",!0))}}),{name:"lock",get state(){return x(r,"art-lock")}}}var Ve=function(){function e(n){t(this,e),this.art=n,this.id=0;var r=n.option;!r.isLive&&r.miniProgressBar&&this.add(Be),r.lock&&d&&this.add(We),r.autoPlayback&&this.add(He),r.autoOrientation&&d&&this.add(Fe);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.isEnd||(this.art.switchUrl(e.url),this.art.once("video:timeupdate",(function(){t.art.emit("ads:start",e)})),this.art.once("video:ended",(function(){var e=t.next;e?(t.index+=1,t.play(e)):t.end()})))}},{key:"end",value:function(){this.isEnd||(this.isEnd=!0,this.playing=!1,this.art.option.url=this.urlCache,this.art.switchUrl(this.urlCache),this.art.emit("ads:end"))}}]),e}(),Ue=n((function e(n){t(this,e);for(var r=n.option,o=n.events.proxy,i=n.template.$video,a=0;a0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),Ge.splice(Ge.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return Ge}},{key:"version",get:function(){return"4.3.9"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"1651029214759"}},{key:"config",get:function(){return ht}},{key:"utils",get:function(){return nt}},{key:"scheme",get:function(){return dt}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return yt.html}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!0,autoPlayback:!1,autoOrientation:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:h?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),a}(p);return Xe.NOTICE_TIME=2e3,Xe.SETTING_WIDTH=250,Xe.SETTING_ITEM_WIDTH=200,Xe.INDICATOR_SIZE=14,Xe.INDICATOR_SIZE_ICON=16,Xe.INDICATOR_SIZE_MOBILE=18,Xe.INDICATOR_SIZE_MOBILE_ICON=20,Xe.VOLUME_PANEL_WIDTH=60,Xe.VOLUME_HANDLE_WIDTH=12,Xe.RESIZE_TIME=500,Xe.SCROLL_TIME=200,Xe.SCROLL_GAP=50,Xe.AUTO_PLAYBACK_MAX=10,Xe.RECONNECT_TIME_MAX=5,Xe.RECONNECT_SLEEP_TIME=1e3,Xe.CONTROL_HIDE_TIME=3e3,Xe.DB_CLICE_TIME=300,Xe.MOBILE_AUTO_PLAYBACKRATE=3,Xe.MOBILE_AUTO_PLAYBACKRATE_TIME=1e3,Xe.MOBILE_AUTO_ORIENTATION_TIME=100,Xe.INFO_LOOP_TIME=1e3,console.log("%c ArtPlayer %c 4.3.9 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),Xe})); diff --git a/packages/artplayer-tool-thumbnail/dist/artplayer-tool-thumbnail.js b/packages/artplayer-tool-thumbnail/dist/artplayer-tool-thumbnail.js index be30a0569..f5e0aa5a8 100644 --- a/packages/artplayer-tool-thumbnail/dist/artplayer-tool-thumbnail.js +++ b/packages/artplayer-tool-thumbnail/dist/artplayer-tool-thumbnail.js @@ -5,4 +5,4 @@ * Released under the MIT License. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("tiny-emitter")):"function"==typeof define&&define.amd?define(["tiny-emitter"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).ArtplayerToolThumbnail=e(t.Emitter)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return n(this,h),(t=s.call(this)).processing=!1,t.option={},t.setup(Object.assign({},h.DEFAULTS,e)),t.video=h.creatVideo(),t.duration=0,t.inputChange=t.inputChange.bind(o(t)),t.ondrop=t.ondrop.bind(o(t)),t.option.fileInput.addEventListener("change",t.inputChange),t.option.fileInput.addEventListener("dragover",h.ondragover),t.option.fileInput.addEventListener("drop",h.ondrop),t}return e=h,a=[{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,i=n.fileInput,o=n.number,r=n.width,a=n.column;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";var u=document.createElement("input");u.type="file",u.style.position="absolute",u.style.width="100%",u.style.height="100%",u.style.left="0",u.style.top="0",u.style.right="0",u.style.bottom="0",u.style.opacity="0",i.appendChild(u),this.option.fileInput=u}return["number","width","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.number=l(o,10,1e3),this.option.width=l(r,10,1e3),this.option.column=l(a,1,1e3),this}},{key:"inputChange",value:function(t){var e=this.option.fileInput.files[0];this.loadVideo(e),t.target.value=""}},{key:"loadVideo",value:function(t){if(t){var e=this.video.canPlayType(t.type);this.errorHandle("maybe"===e||"probably"===e,"Playback of this file format is not supported: ".concat(t.type));var n=URL.createObjectURL(t);this.videoUrl=n,this.file=t,this.emit("file",this.file),this.video.src=n,this.emit("video",this.video)}}},{key:"start",value:function(){var t,e=this;if(!this.video.duration)return(t=1e3,new Promise((function(e){return setTimeout(e,t)}))).then((function(){return e.start()}));var n=this.option,i=n.width,o=n.number,r=n.begin,a=n.end,u=this.video.videoHeight/this.video.videoWidth*i;this.option.height=u,this.option.begin=l(r,0,this.video.duration),this.option.end=l(a||this.video.duration,r,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=o/this.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 s=this.creatScreenshotDate(),c=this.creatCanvas(),h=c.getContext("2d");this.emit("canvas",c);var d,f=s.map((function(t,n){return function(){return new Promise((function(r){e.video.oncanplay=function(){h.drawImage(e.video,t.x,t.y,i,u),c.toBlob((function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(n+1)/o),e.video.oncanplay=null,r()}))},e.video.currentTime=t.time}))}}));return this.processing=!0,(d=f,d.reduce((function(t,e){return t.then(e)}),Promise.resolve())).then((function(){e.processing=!1,e.emit("done")})).catch((function(t){throw e.processing=!1,e.emit("error",t.message),t}))}},{key:"creatScreenshotDate",value:function(){for(var t=this.option,e=t.number,n=t.width,i=t.height,o=t.column,r=t.begin,a=this.duration/e,u=[r+a];u.length0&&void 0!==arguments[0]?arguments[0]:{};return t(this,h),(e=u.call(this)).processing=!1,e.option={},e.setup(Object.assign({},h.DEFAULTS,i)),e.video=h.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(n(e)),e.ondrop=e.ondrop.bind(n(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",h.ondragover),e.option.fileInput.addEventListener("drop",h.ondrop),e}return r=h,a=[{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,i=n.fileInput,o=n.number,r=n.width,a=n.column;if(this.errorHandle(i instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==i.tagName||"file"!==i.type){i.style.position="relative";var s=document.createElement("input");s.type="file",s.style.position="absolute",s.style.width="100%",s.style.height="100%",s.style.left="0",s.style.top="0",s.style.right="0",s.style.bottom="0",s.style.opacity="0",i.appendChild(s),this.option.fileInput=s}return["number","width","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.number=l(o,10,1e3),this.option.width=l(r,10,1e3),this.option.column=l(a,1,1e3),this}},{key:"inputChange",value:function(t){var e=this.option.fileInput.files[0];this.loadVideo(e),t.target.value=""}},{key:"loadVideo",value:function(t){if(t){var e=this.video.canPlayType(t.type);this.errorHandle("maybe"===e||"probably"===e,"Playback of this file format is not supported: ".concat(t.type));var n=URL.createObjectURL(t);this.videoUrl=n,this.file=t,this.emit("file",this.file),this.video.src=n,this.emit("video",this.video)}}},{key:"start",value:function(){var t,e=this;if(!this.video.duration)return(t=1e3,new Promise((function(e){return setTimeout(e,t)}))).then((function(){return e.start()}));var n=this.option,i=n.width,o=n.number,r=n.begin,a=n.end,s=this.video.videoHeight/this.video.videoWidth*i;this.option.height=s,this.option.begin=l(r,0,this.video.duration),this.option.end=l(a||this.video.duration,r,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=o/this.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 u=this.creatScreenshotDate(),c=this.creatCanvas(),h=c.getContext("2d");this.emit("canvas",c);var f,p=u.map((function(t,n){return function(){return new Promise((function(r){e.video.oncanplay=function(){h.drawImage(e.video,t.x,t.y,i,s),c.toBlob((function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(n+1)/o),e.video.oncanplay=null,r()}))},e.video.currentTime=t.time}))}}));return this.processing=!0,(f=p,f.reduce((function(t,e){return t.then(e)}),Promise.resolve())).then((function(){e.processing=!1,e.emit("done")})).catch((function(t){throw e.processing=!1,e.emit("error",t.message),t}))}},{key:"creatScreenshotDate",value:function(){for(var t=this.option,e=t.number,n=t.width,i=t.height,o=t.column,r=t.begin,a=this.duration/e,s=[r+a];s.length1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function b(t,e){return t.classList.add(e)}function w(t,e){return t.classList.remove(e)}function x(t,e){return t.classList.contains(e)}function O(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function k(t,e,n){return t.style[e]=n,t}function j(t,e){return Object.keys(e).forEach((function(n){k(t,n,e[n])})),t}function P(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 S(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function R(t,e){S(t).forEach((function(t){return w(t,e)})),b(t,e)}function E(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";d||(t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n))}function C(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=n.top-e<=r&&n.top+n.height+e>=0,a=n.left-e<=o+e&&n.left+n.width+e>=0;return i&&a}function $(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function z(t,e){return e.parentNode.replaceChild(t,e),t}function T(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function D(t,e,n){return D=T()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&o(i,n.prototype),i},D.apply(null,arguments)}function A(t){var e="function"==typeof Map?new Map:void 0;return A=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return D(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)},A(t)}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}var L=function(e){i(a,e);var o=M(a);function a(e,n){var i;return t(this,a),i=o.call(this,e),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r(i),n||i.constructor),i.name="ArtPlayerError",i}return n(a)}(A(Error));function F(t,e){if(!t)throw new L(e);return t}function I(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 B(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function q(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(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.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 V(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#000",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return[[e,0],[0,e],[-e,0],[0,-e],[e,e],[-e,-e],[e,-e],[-e,e]].map((function(e){return"".concat(t," ").concat(e[0],"px ").concat(e[1],"px ").concat(n,"px")})).join(",")}function H(t){return t.includes("?")?H(t.split("?")[0]):t.includes("#")?H(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function W(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)}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function J(t,e){var n,r,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),l=0;l0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function et(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var nt=Object.freeze({__proto__:null,query:y,queryAll:g,addClass:b,removeClass:w,hasClass:x,append:O,remove:function(t){return t.parentNode.removeChild(t)},setStyle:k,setStyles:j,getStyle:P,sublings:S,inverseClass:R,tooltip:E,isInViewport:C,includeFromEvent:$,replaceElement:z,ArtPlayerError:L,errorHandle:F,srtToVtt:I,vttToBlob:B,assToVtt:q,outline:V,getExt:H,download:W,def:U,has:Y,get:G,mergeDeep:Q,sleep:Z,debounce:function(t,e,n){var r;function o(){for(var o=arguments.length,i=new Array(o),a=0;a-1;case"function":return t(f);case"regexp":return t.test(f);default:return!1}}))}}]),e}(),mt=function(){function e(n){var r=this;t(this,e),this.art=n;var o=n.option,i=n.constructor,a=n.whitelist;o.container instanceof Element?this.$container=o.container:(this.$container=y(o.container),F(this.$container,"No container element found by ".concat(o.container)));var c=this.$container.tagName.toLowerCase();F("div"===c,"Unsupported container element type, only support 'div' but got '".concat(c,"'")),F(i.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=n.id,this.$original=this.$container.cloneNode(!0),a.state?this.desktop():this.mobile()}return n(e,[{key:"query",value:function(t){return y(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option;t.useSSR||(this.$container.innerHTML=e.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$miniHeader=this.query(".art-mini-header"),this.$miniTitle=this.query(".art-mini-title"),this.$miniClose=this.query(".art-mini-close"),this.$contextmenu=this.query(".art-contextmenus"),t.backdrop&&(b(this.$setting,"art-backdrop-filter"),b(this.$contextmenu,"art-backdrop-filter"),b(this.$info,"art-backdrop-filter")),d&&b(this.$player,"art-mobile")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?z(this.$original,this.$container):b(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.3.8
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),yt={"Video Info":"统计信息",Close:"关闭","Video Load Failed":"加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音","Video Flip":"画面翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide Subtitle":"隐藏字幕","Show Subtitle":"显示字幕","Show Setting":"显示设置","Hide Setting":"隐藏设置",Screenshot:"截图","Play Speed":"播放速度","Aspect Ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch Video":"切换","Switch Subtitle":"切换字幕",Fullscreen:"全屏","Exit Fullscreen":"退出全屏","Web Fullscreen":"网页全屏","Exit Web Fullscreen":"退出网页全屏","Mini Player":"迷你播放器","PIP Mode":"画中画模式","Exit PIP Mode":"退出画中画模式","PIP Not Supported":"不支持画中画模式","Fullscreen Not Supported":"不支持全屏模式","Subtitle Offset":"字幕偏移","Auto playback at":"已为您定位至"},gt={"Video Info":"統計訊息",Close:"關閉","Video Load Failed":"載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音","Video Flip":"畫面翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide Subtitle":"隱藏字幕","Show Subtitle":"顯示字幕","Show Setting":"顯示设置","Hide Setting":"隱藏设置",Screenshot:"截圖","Play Speed":"播放速度","Aspect Ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch Video":"切換","Switch Subtitle":"切換字幕",Fullscreen:"全屏","Exit Fullscreen":"退出全屏","Web Fullscreen":"網頁全屏","Exit Web Fullscreen":"退出網頁全屏","Mini Player":"迷你播放器","PIP Mode":"畫中畫模式","Exit PIP Mode":"退出畫中畫模式","PIP Not Supported":"不支持畫中畫模式","Fullscreen Not Supported":"不支持全屏模式","Subtitle Offset":"字幕偏移","Auto playback at":"已為您定位至"},bt=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":yt,"zh-tw":gt},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=Q(this.languages,t),this.init()}}]),e}();const wt=[["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"]],xt=(()=>{const t=wt[0],e={};for(const n of wt){const r=n?.[1];if(r in document){for(const[r,o]of n.entries())e[t[r]]=o;return e}}return!1})(),Ot={change:xt.fullscreenchange,error:xt.fullscreenerror};let kt={request:(t=document.documentElement,e)=>new Promise(((n,r)=>{const o=()=>{kt.off("change",o),n()};kt.on("change",o);const i=t[xt.requestFullscreen](e);i instanceof Promise&&i.then(o).catch(r)})),exit:()=>new Promise(((t,e)=>{if(!kt.isFullscreen)return void t();const n=()=>{kt.off("change",n),t()};kt.on("change",n);const r=document[xt.exitFullscreen]();r instanceof Promise&&r.then(n).catch(e)})),toggle:(t,e)=>kt.isFullscreen?kt.exit():kt.request(t,e),onchange(t){kt.on("change",t)},onerror(t){kt.on("error",t)},on(t,e){const n=Ot[t];n&&document.addEventListener(n,e,!1)},off(t,e){const n=Ot[t];n&&document.removeEventListener(n,e,!1)},raw:xt};Object.defineProperties(kt,{isFullscreen:{get:()=>Boolean(document[xt.fullscreenElement])},element:{enumerable:!0,get:()=>document[xt.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[xt.fullscreenEnabled])}}),xt||(kt={isEnabled:!1});var jt=kt;function Pt(t){var e=t.i18n,n=t.notice,r=t.template.$video;t.once("video:loadedmetadata",(function(){jt.isEnabled?function(t){var e=t.notice,n=t.template.$player;jt.on("change",(function(){return t.emit("fullscreen",jt.isFullscreen)})),U(t,"fullscreen",{get:function(){return jt.isFullscreen},set:function(r){r?jt.request(n).then((function(){b(n,"art-fullscreen"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreen",!0),e.show=""})):jt.exit().then((function(){w(n,"art-fullscreen"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreen"),e.show=""}))}})}(t):document.fullscreenEnabled||r.webkitSupportsFullscreen?function(t){var e=t.notice,n=t.template.$video;U(t,"fullscreen",{get:function(){return n.webkitDisplayingFullscreen},set:function(r){r?(n.webkitEnterFullscreen(),t.emit("fullscreen",!0),e.show=""):(n.webkitExitFullscreen(),t.emit("fullscreen"),e.show="")}})}(t):U(t,"fullscreen",{get:function(){return!1},set:function(){n.show=e.get("Fullscreen Not Supported")}}),U(t,"fullscreen",G(t,"fullscreen"))}))}function St(t){var e=t.i18n,n=t.notice,r=t.template.$video;document.pictureInPictureEnabled?function(t){var e=t.template.$video,n=t.events.proxy,r=t.notice;e.disablePictureInPicture=!1,U(t,"pip",{get:function(){return document.pictureInPictureElement},set:function(t){t?e.requestPictureInPicture().catch((function(t){throw r.show=t,t})):document.exitPictureInPicture().catch((function(t){throw r.show=t,t}))}}),n(e,"enterpictureinpicture",(function(){t.emit("pip",!0)})),n(e,"leavepictureinpicture",(function(){t.emit("pip")}))}(t):r.webkitSupportsPresentationMode?function(t){var e=t.template.$video;e.webkitSetPresentationMode("inline"),U(t,"pip",{get:function(){return"picture-in-picture"===e.webkitPresentationMode},set:function(n){n?(e.webkitSetPresentationMode("picture-in-picture"),t.emit("pip",!0)):(e.webkitSetPresentationMode("inline"),t.emit("pip"))}})}(t):U(t,"pip",{get:function(){return!1},set:function(){n.show=e.get("PIP Not Supported")}})}var Rt=n((function e(n){t(this,e),function(t){var e=t.option,n=t.template.$video;U(t,"url",{get:function(){return n.currentSrc},set:function(r){var o=e.type||H(r),i=e.customType[o];o&&i?Z().then((function(){t.loading.show=!0,i.call(t,n,r,t)})):(t.url&&t.url!==r&&t.once("video:canplay",(function(){t.isReady&&t.emit("restart")})),n.src=r,t.option.url=r,t.emit("url",r))}})}(n),function(t){var e=t.template.$video;U(t,"attr",{value:function(t,n){if(void 0===n)return e[t];e[t]=n}})}(n),function(t){var e=t.i18n,n=t.notice,r=t.option,o=t.constructor.instances,i=t.template.$video;U(t,"play",{value:function(){var a=i.play();if(a&&a.then&&a.then().catch((function(t){throw n.show=t,t})),r.mutex)for(var c=0;cd){var h=d*s/l;k(n,"width","".concat(100*h,"%")),k(n,"height","100%"),k(n,"padding","0 ".concat((u-u*h)/2,"px"))}else{var v=l/d/s;k(n,"width","100%"),k(n,"height","".concat(100*v,"%")),k(n,"padding","".concat((p-p*v)/2,"px 0"))}r.dataset.aspectRatio=e}i.show="".concat(o.get("Aspect Ratio"),": ").concat("default"===e?o.get("Default"):e),t.emit("aspectRatio",e)}}),U(t,"aspectRatioReset",{set:function(e){if(e){var n=t.aspectRatio;t.aspectRatio=n}}})}(n),function(t){var e=t.option,n=t.notice,r=t.template.$video,o=document.createElement("canvas");U(t,"getDataURL",{value:function(){return new Promise((function(t,e){try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(t){n.show=t,e(t)}}))}}),U(t,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){n.show=t,e(t)}}))}}),U(t,"screenshot",{value:function(){return t.getDataURL().then((function(n){return W(n,"".concat(e.title||"artplayer","_").concat(tt(r.currentTime),".png")),t.emit("screenshot",n),n}))}})}(n),Pt(n),function(t){var e=t.notice,n=t.template.$player;U(t,"fullscreenWeb",{get:function(){return x(n,"art-fullscreen-web")},set:function(r){r?(b(n,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreenWeb",!0),e.show=""):(w(n,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"),e.show="")}})}(n),St(n),function(t){var e=t.template.$video;U(t,"loaded",{get:function(){return t.loadedTime/e.duration}}),U(t,"loadedTime",{get:function(){return e.buffered.length?e.buffered.end(e.buffered.length-1):0}})}(n),function(t){U(t,"played",{get:function(){return t.currentTime/t.duration}})}(n),function(t){var e=t.template.$video;U(t,"playing",{get:function(){return!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)}})}(n),function(t){var e=t.template,n=e.$container,r=e.$player,o=e.$video;U(t,"autoSize",{get:function(){return x(n,"art-auto-size")},set:function(e){if(e){var i=o.videoWidth,a=o.videoHeight,c=n.getBoundingClientRect(),l=c.width,s=c.height,u=i/a,p=l/s;if(b(n,"art-auto-size"),p>u)k(r,"width","".concat(s*u/l*100,"%")),k(r,"height","100%");else{var f=l/u/s*100;k(r,"width","100%"),k(r,"height","".concat(f,"%"))}t.emit("autoSize",{width:t.width,height:t.height})}else w(n,"art-auto-size"),k(r,"width",null),k(r,"height",null),t.emit("autoSize")}})}(n),function(t){U(t,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}});for(var e=["bottom","height","left","right","top","width"],n=function(n){var r=e[n];U(t,r,{get:function(){return t.rect[r]}})},r=0;r=1?(e=[r,o],t.emit("loop",e)):(e=[],t.emit("loop"))}else e=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){e.length&&(t.currentTimee[1])&&(t.seek=e[0])}))}(n),function(t){var e=t.option,n=t.template.$poster;U(t,"poster",{get:function(){return e.poster},set:function(t){e.poster=t,k(n,"backgroundImage","url(".concat(t,")"))}})}(n),function(t){var e=t.option,n=t.template,r=n.$container,o=n.$video,i=r.style.height;U(t,"autoHeight",{get:function(){return x(r,"art-auto-height")},set:function(n){if(n){var a=r.clientWidth,c=o.videoHeight*(a/o.videoWidth);k(r,"height",c+"px"),b(r,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight",c)}else k(r,"height",i),w(r,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight")}})}(n),function(t){var e=t.option,n=t.template.$player;U(t,"theme",{get:function(){return getComputedStyle(n).getPropertyValue("--theme")},set:function(t){e.theme=t,n.style.setProperty("--theme",t)}})}(n),function(t){U(t,"title",{get:function(){return t.option.title},set:function(e){t.option.title=e}})}(n),function(t){var e=["mini","pip","fullscreen","fullscreenWeb"];!function(e){for(var n=function(n){var r=e[n];t.on(r,(function(){t[r]&&e.filter((function(t){return t!==r})).forEach((function(e){t[e]&&(t[e]=!1)}))}))},r=0;r=Number(o.dataset.index)}));return a?a.insertAdjacentElement("beforebegin",o):O(this.$parent,o),n.html&&O(o,n.html),n.style&&j(o,n.style),n.tooltip&&E(o,n.tooltip),n.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),n.click.call(e.art,e,t)})),n.selector&&["left","right"].includes(n.position)&&this.selector(n,o),n.mounted&&n.mounted.call(this.art,o),1===o.childNodes.length&&3===o.childNodes[0].nodeType&&b(o,"art-control-onlyText"),U(this,r,{value:o}),o}}},{key:"selector",value:function(t,e){var n=this,r=this.art.events,o=r.hover,i=r.proxy;b(e,"art-control-selector");var a=document.createElement("div");b(a,"art-selector-value"),O(a,t.html),e.innerText="",O(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),l=document.createElement("div");b(l,"art-selector-list"),O(l,c),O(e,l);var s=function(){var t=P(e,"width")/2-P(l,"width")/2;l.style.left="".concat(t,"px")};o(e,s),i(l,"click",(function(e){var r=(e.composedPath()||[]).find((function(t){return x(t,"art-selector-item")}));if(r){R(r,"art-current");var o=Number(r.dataset.index),i=t.selector[o]||{};if(a.innerText=r.innerText,t.onSelect){var c=t.onSelect.call(n.art,i,r,e);"string"!=typeof c&&"number"!=typeof c||(a.innerHTML=c)}s(),n.art.emit("selector",i,r)}}))}}]),e}();function zt(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(t){for(var e=1;e
',mounted:function(t){var i=!1,a=y(".art-progress-loaded",t),c=y(".art-progress-played",t),l=y(".art-progress-highlight",t),s=y(".art-progress-indicator",t),u=y(".art-progress-tip",t);k(c,"backgroundColor","var(--theme)");var p=14;function f(t,e){"loaded"===t&&k(a,"width","".concat(100*e,"%")),"played"===t&&(k(c,"width","".concat(100*e,"%")),k(s,"left","calc(".concat(100*e,"% - ").concat(p/2,"px)")))}n.indicator?(p=16,O(s,n.indicator)):j(s,{backgroundColor:"var(--theme)"}),j(s,{left:"-".concat(p/2,"px"),width:"".concat(p,"px"),height:"".concat(p,"px")});for(var d=0;d'))}f("loaded",e.loaded),e.on("video:progress",(function(){f("loaded",e.loaded)})),e.on("video:timeupdate",(function(){f("played",e.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){k(u,"display","block"),$(n,l)?function(n){var r=Vt(e,n).width,o=n.target.dataset.text;u.innerHTML=o;var i=u.clientWidth;r<=i/2?k(u,"left",0):r>t.clientWidth-i/2?k(u,"left","".concat(t.clientWidth-i,"px")):k(u,"left","".concat(r-i/2,"px"))}(n):function(n){var r=Vt(e,n),o=r.width,i=r.time;u.innerHTML=i;var a=u.clientWidth;o<=a/2?k(u,"left",0):o>t.clientWidth-a/2?k(u,"left","".concat(t.clientWidth-a,"px")):k(u,"left","".concat(o-a/2,"px"))}(n)})),o(t,"mouseout",(function(){k(u,"display","none")})),o(t,"click",(function(t){if(t.target!==s){var n=Vt(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(s,"mousedown",(function(){i=!0})),o(document,"mousemove",(function(t){if(i){var n=Vt(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(document,"mouseup",(function(){i&&(i=!1)})),o(s,"touchstart",(function(t){1===t.touches.length&&(i=!0)})),o(document,"touchmove",(function(t){if(1===t.touches.length&&i){var n=Vt(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(document,"touchend",(function(){i&&(i=!1)}))}})}}function Wt(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 Nt(t){for(var e=1;eo.clientWidth-f/2?k(t,"left","".concat(o.clientWidth-f,"px")):k(t,"left","".concat(a-f/2,"px"))}(r))})),c(o,"mouseout",(function(){k(t,"display","none")}))}})}}function te(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 ee(t){for(var e=1;e=3e3&&(n.show=!1,b(a,"art-hide-cursor"),w(a,"art-hover"))})),e.once("video:loadedmetadata",(function(){n.add(Ht({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Kt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive,position:"top",index:20})),n.add(function(t){return function(e){return ie(ie({},t),{},{mounted:function(t){var n=O(t,''),r=O(t,'');e.on("loop",(function(o){o?(k(t,"display","block"),k(n,"left","calc(".concat(o[0]/e.duration*100,"% - ").concat(n.clientWidth,"px)")),k(r,"left","".concat(o[1]/e.duration*100,"%"))):k(t,"display","none")}))}})}}({name:"loop",disable:!1,position:"top",index:30})),n.add(function(t){return function(e){return It(It({},t),{},{mounted:function(t){var n=e.events.proxy,r=e.icons,o=e.i18n,i=O(t,r.play),a=O(t,r.pause);function c(){k(i,"display","flex"),k(a,"display","none")}function l(){k(i,"display","none"),k(a,"display","flex")}E(i,o.get("Play")),E(a,o.get("Pause")),n(i,"click",(function(){e.play()})),n(a,"click",(function(){e.pause()})),e.playing?l():c(),e.on("video:playing",(function(){l()})),e.on("video:pause",(function(){c()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(function(t){return function(e){return Yt(Yt({},t),{},{mounted:function(t){var n=e.events.proxy,r=e.icons,o=e.i18n,i=!1,a=O(t,r.volume),c=O(t,r.volumeClose),l=O(t,'
'),s=O(l,'
');function u(t){var e=l.getBoundingClientRect().left;return K(t.pageX-e-6,0,54)/48}function p(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(e.muted||0===t)k(a,"display","none"),k(c,"display","flex"),k(s,"left","0");else{var n=48*t;k(a,"display","flex"),k(c,"display","none"),k(s,"left","".concat(n,"px"))}}E(a,o.get("Mute")),k(c,"display","none"),d&&k(l,"display","none"),p(e.volume),e.on("video:volumechange",(function(){p(e.volume)})),n(a,"click",(function(){e.muted=!0})),n(c,"click",(function(){e.muted=!1})),n(l,"click",(function(t){e.muted=!1,e.volume=u(t)})),n(s,"mousedown",(function(){i=!0})),n(t,"mousemove",(function(t){i&&(e.muted=!1,e.volume=u(t))})),n(document,"mouseup",(function(){i&&(i=!1)}))}})}}({name:"volume",disable:!1,position:"left",index:20})),n.add(function(t){return function(e){return Ut(Ut({},t),{},{mounted:function(t){function n(){var n="".concat(tt(e.currentTime)," / ").concat(tt(e.duration));n!==t.innerText&&(t.innerText=n)}n();for(var r=["video:loadedmetadata","video:timeupdate","video:progress"],o=0;o0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,n){var r=n.target.dataset.value;r&&(e.playbackRate=Number(r),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var n=g("span",t).find((function(t){return Number(t.dataset.value)===e}));n&&R(n,"art-current")}))}})}}({disable:!n.playbackRate,name:"playbackRate",index:10})),this.add(function(t){return function(e){var n=e.i18n;return pe(pe({},t),{},{html:"".concat(n.get("Aspect Ratio"),':').concat(n.get("Default"),'4:316:9'),click:function(t,n){var r=n.target.dataset.value;r&&(e.aspectRatio=r,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var n=g("span",t).find((function(t){return t.dataset.value===e}));n&&R(n,"art-current")}))}})}}({disable:!n.aspectRatio,name:"aspectRatio",index:20})),this.add(function(t){return function(e){var n=e.i18n;return de(de({},t),{},{html:"".concat(n.get("Video Flip"),':').concat(n.get("Normal"),'').concat(n.get("Horizontal"),'').concat(n.get("Vertical"),""),click:function(t,n){var r=n.target.dataset.value;r&&(e.flip=r,t.show=!1)},mounted:function(t){e.on("flip",(function(e){var n=g("span",t).find((function(t){return t.dataset.value===e}));n&&R(n,"art-current")}))}})}}({disable:!n.flip,name:"flip",index:30})),this.add(function(t){return function(e){return ve(ve({},t),{},{html:e.i18n.get("Video Info"),click:function(t){e.info.show=!0,t.show=!1}})}}({disable:!1,name:"info",index:40})),this.add(function(t){return ye(ye({},t),{},{html:'ArtPlayer 4.3.8'})}({disable:!1,name:"version",index:50})),this.add(function(t){return function(e){return be(be({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60}));for(var c=0;cs+l&&(h=l-d),r+f>u+c&&(v=c-f),j(i,{top:"".concat(v,"px"),left:"".concat(h,"px")})})),a(o,"click",(function(e){$(e,i)||(t.show=!1)})),this.art.on("blur",(function(){t.show=!1}))}}]),o}($t);function Oe(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}var ke=function(e){i(o,e);var r=Oe(o);function o(e){var n;return t(this,o),(n=r.call(this,e)).name="info",e.once("video:loadedmetadata",(function(){d||n.init()})),n}return n(o,[{key:"init",value:function(){var t=this,e=this.art,n=e.events.proxy,r=e.template,o=r.$infoPanel,i=r.$infoClose,a=r.$video;n(i,"click",(function(){t.show=!1}));var c=null,l=g("[data-video]",o)||[];this.art.on("destroy",(function(){clearTimeout(c)})),function t(){for(var e=0;e".concat(et(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,r=n.i18n,o=n.notice,i=n.option,a=Pe(Pe(Pe({},i.subtitle),e),{},{url:t});return this.init(a).then((function(t){return e.name&&(o.show="".concat(r.get("Switch Subtitle"),": ").concat(e.name)),t}))}},{key:"init",value:function(t){var e=this;if(u(t,dt.subtitle),t.url){var n=this.art,r=n.notice,o=n.events.proxy,i=n.template,a=i.$subtitle,c=i.$video;if(!i.$track){var l=document.createElement("track");l.default=!0,l.kind="metadata",c.appendChild(l),this.art.template.$track=l,o(this.textTrack,"cuechange",this.update.bind(this))}return this.style(Pe({"text-shadow":V()},t.style)),F(window.fetch,"fetch not support"),fetch(t.url).then((function(t){return t.arrayBuffer()})).then((function(n){F(window.TextDecoder,"TextDecoder not support");var r=new TextDecoder(t.encoding).decode(n);switch(e.art.emit("subtitleLoad",t.url),t.type||H(t.url)){case"srt":return B(I(r));case"ass":return B(q(r));case"vtt":return B(r);default:return t.url}})).then((function(t){return a.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t,e.art.emit("subtitleSwitch",t)),t})).catch((function(t){throw r.show=t,t}))}}}]),o}($t);var Ee=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:loadedmetadata",(function(){!function(t,e){var n=t.template,r=n.$player,o=n.$video;e.proxy(document,["click","contextmenu"],(function(e){$(e,r)?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}));var i=0;e.proxy(o,"click",(function(){var e=Date.now();e-i<=300?(t.emit("dblclick"),d?t.toggle():t.fullscreen=!t.fullscreen):(t.emit("click"),d||t.toggle()),i=e}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){b(n,"art-hover"),t.emit("hover",!0)}),(function(){w(n,"art-hover"),t.emit("hover")}))}(n,r),function(t,e){var n=t.template.$player;e.proxy(n,"mousemove",(function(e){t.emit("mousemove",e)}))}(n,r),function(t,e){var n=t.notice,r=t.option,o=J((function(){t.normalSize&&(t.autoSize=r.autoSize),t.aspectRatioReset=!0,n.show="",t.emit("resize")}),500);e.proxy(window,["orientationchange","resize"],(function(){o()})),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",(function(){o()}))}(n,r),function(t,e){if(d&&!t.option.isLive){var n=t.notice,r=t.template.$video,o=!1,i=0,a=0,c=null;e.proxy(r,"touchstart",(function(e){1===e.touches.length&&(o=!0,i=e.touches[0].clientX,clearTimeout(c),c=setTimeout((function(){t.playbackRate=3}),1e3))})),e.proxy(r,"touchmove",(function(e){if(1===e.touches.length&&o&&t.duration){var c=K((e.touches[0].clientX-i)/r.clientWidth,-1,1);a=K(t.currentTime+t.duration*c,0,t.duration),n.show="".concat(tt(a)," / ").concat(tt(t.duration))}})),e.proxy(document,"touchend",(function(){o&&(a&&(t.seek=a),3===t.playbackRate&&(t.playbackRate=1),i=0,a=0,o=!1,clearTimeout(c),c=null)}))}}(n,r),function(t,e){var n=t.option,r=t.template.$container,o=J((function(){t.emit("view",C(r,50))}),200);e.proxy(window,"scroll",(function(){o()})),t.on("view",(function(e){n.autoMini&&(t.mini=!e)}))}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return r.proxy(t,e,n,o)}));t.addEventListener(e,n,o);var i=function(){return t.removeEventListener(e,n,o)};return this.destroyEvents.push(i),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 o;if(t instanceof HTMLImageElement)o=t;else{if("string"!=typeof t)return r(new L("Unable to get Image"));(o=new Image).src=t}if(o.complete)return n(o);e.proxy(o,"load",(function(){return n(o)})),e.proxy(o,"error",(function(){return r(new L("Failed to load Image: ".concat(o.src)))}))}))}},{key:"destroy",value:function(){for(var t=0;t',state:'',play:'',pause:'',check:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:'',arrowLeft:'',arrowRight:'',playbackRate:'',aspectRatio:'',config:'',lock:'',unlock:''},n.option.icons);Object.keys(o).forEach((function(t){U(r,t,{get:function(){var e=document.createElement("i");return b(e,"art-icon"),b(e,"art-icon-".concat(t)),O(e,o[t]),e}})}))}));function Be(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function qe(t,e,n){for(var r=0;r'),c=document.createElement("div");b(c,"art-setting-item-left-icon"),O(c,r.arrowLeft),O(a,c),O(a,t._parentItem.html);var l=o(i,"click",(function(){e.init(t._parentList)}));return this.events.push(l),i}},{key:"creatItem",value:function(t){var e=this,n=this.art,r=n.icons,o=n.events.proxy,i=t.selector&&t.selector.length,a=document.createElement("div");b(a,"art-setting-item"),t.default&&b(a,"art-current"),void 0!==t.value&&(a.dataset.value=t.value);var c=O(a,'
'),l=O(a,'
'),s=document.createElement("div");if(b(s,"art-setting-item-left-icon"),O(s,i?t.icon||r.config:r.check),O(c,s),O(c,t.html),i){var u=document.createElement("div");b(u,"art-setting-item-right-tooltip"),O(l,u),t._$tooltip=u;var p=t.tooltip;U(t,"tooltip",{get:function(){return u.innerHTML},set:function(t){u.innerHTML=t}}),p&&(t.tooltip=p);var f=document.createElement("div");b(f,"art-setting-item-right-icon"),O(f,r.arrowRight),O(l,f)}var d=o(a,"click",(function(n){if(i)e.init(t.selector,t.width);else if(R(a,"art-current"),t._parentList&&e.init(t._parentList),t._parentItem&&t._parentItem.onSelect){var r=t._parentItem.onSelect.call(e.art,t,a,n);t._parentItem._$tooltip&&("string"!=typeof r&&"number"!=typeof r||(t._parentItem._$tooltip.innerHTML=r))}}));return this.events.push(d),a}},{key:"add",value:function(t){"function"==typeof t?this.option.push(t(this.art)):this.option.push(t),this.cache=new Map,this.events.forEach((function(t){return t()})),this.events=[],this.$parent.innerHTML="",this.option=qe(this.option),this.init(this.option)}},{key:"init",value:function(t,e){if(this.cache.has(t)){var n=this.cache.get(t);R(n,"art-current"),k(this.$parent,"width","".concat(n.dataset.width,"px"))}else{var r=document.createElement("div");b(r,"art-setting-panel"),t[0]&&t[0]._parentItem&&O(r,this.creatHeader(t[0]));for(var o=0;o10&&delete e[r[0]],e[t.option.url]=t.currentTime,n.set("times",e)})),t.on("ready",(function(){var o=(n.get("times")||{})[t.option.url];o&&(t.seek=o,k(r,"display","none"),t.notice.show="".concat(e.get("Auto playback at")," ").concat(tt(o)))})),{name:"autoPlayback",get times(){return n.get("times")||{}},clear:function(){return n.del("times")}}}function _e(t){var e=t.layers,n=t.icons,r=t.template.$player;return e.add({name:"lock",mounted:function(e){var r=O(e,n.lock),o=O(e,n.unlock);k(r,"display","none"),t.on("lock",(function(t){t?(k(r,"display","inline-flex"),k(o,"display","none")):(k(r,"display","none"),k(o,"display","inline-flex"))}))},click:function(){x(r,"art-lock")?(w(r,"art-lock"),t.emit("lock",!1)):(b(r,"art-lock"),t.emit("lock",!0))}}),{name:"lock",get state(){return x(r,"art-lock")}}}var Ue=function(){function e(n){t(this,e),this.art=n,this.id=0;var r=n.option;!r.isLive&&r.miniProgressBar&&this.add(We),r.lock&&d&&this.add(_e),r.autoPlayback&&this.add(Ne);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.isEnd||(this.art.switchUrl(e.url),this.art.once("video:timeupdate",(function(){t.art.emit("ads:start",e)})),this.art.once("video:ended",(function(){var e=t.next;e?(t.index+=1,t.play(e)):t.end()})))}},{key:"end",value:function(){this.isEnd||(this.isEnd=!0,this.playing=!1,this.art.option.url=this.urlCache,this.art.switchUrl(this.urlCache),this.art.emit("ads:end"))}}]),e}(),Ye=n((function e(n){t(this,e);for(var r=n.option,o=n.events.proxy,i=n.template.$video,a=0;a0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),Ze.splice(Ze.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return Ze}},{key:"version",get:function(){return"4.3.8"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"1650895994387"}},{key:"config",get:function(){return ht}},{key:"utils",get:function(){return nt}},{key:"scheme",get:function(){return dt}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return mt.html}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!0,autoPlayback:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:h?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),a}(p);return console.log("%c ArtPlayer %c 4.3.8 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),Je})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Artplayer=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return Array.from(e.querySelectorAll(t))}function b(t,e){return t.classList.add(e)}function w(t,e){return t.classList.remove(e)}function x(t,e){return t.classList.contains(e)}function O(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function k(t,e,n){return t.style[e]=n,t}function j(t,e){return Object.keys(e).forEach((function(n){k(t,n,e[n])})),t}function P(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 E(t){return Array.from(t.parentElement.children).filter((function(e){return e!==t}))}function S(t,e){E(t).forEach((function(t){return w(t,e)})),b(t,e)}function T(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"up";d||(t.setAttribute("aria-label",e),t.setAttribute("data-balloon-pos",n))}function R(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=t.getBoundingClientRect(),r=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,i=n.top-e<=r&&n.top+n.height+e>=0,a=n.left-e<=o+e&&n.left+n.width+e>=0;return i&&a}function C(t,e){return t.composedPath&&t.composedPath().indexOf(e)>-1}function I(t,e){return e.parentNode.replaceChild(t,e),t}function $(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function A(t,e,n){return A=$()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&o(i,n.prototype),i},A.apply(null,arguments)}function D(t){var e="function"==typeof Map?new Map:void 0;return D=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return A(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)},D(t)}function M(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}var L=function(e){i(a,e);var o=M(a);function a(e,n){var i;return t(this,a),i=o.call(this,e),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r(i),n||i.constructor),i.name="ArtPlayerError",i}return n(a)}(D(Error));function z(t,e){if(!t)throw new L(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 N(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function B(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(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t.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 F(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#000",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return[[e,0],[0,e],[-e,0],[0,-e],[e,e],[-e,-e],[e,-e],[-e,e]].map((function(e){return"".concat(t," ").concat(e[0],"px ").concat(e[1],"px ").concat(n,"px")})).join(",")}function H(t){return t.includes("?")?H(t.split("?")[0]):t.includes("#")?H(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function W(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)}function V(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(e){return setTimeout(e,t)}))}function J(t,e){var n,r,o=!1;return function i(){for(var a=arguments.length,c=new Array(a),l=0;l0?[e,n,r]:[n,r]).map((function(t){return t<10?"0".concat(t):String(t)})).join(":")}function et(t){return t.replace(/[&<>'"]/g,(function(t){return{"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t}))}var nt=Object.freeze({__proto__:null,query:m,queryAll:g,addClass:b,removeClass:w,hasClass:x,append:O,remove:function(t){return t.parentNode.removeChild(t)},setStyle:k,setStyles:j,getStyle:P,sublings:E,inverseClass:S,tooltip:T,isInViewport:R,includeFromEvent:C,replaceElement:I,ArtPlayerError:L,errorHandle:z,srtToVtt:_,vttToBlob:N,assToVtt:B,outline:F,getExt:H,download:W,def:U,has:Z,get:G,mergeDeep:X,sleep:Q,debounce:function(t,e,n){var r;function o(){for(var o=arguments.length,i=new Array(o),a=0;a-1;case"function":return t(f);case"regexp":return t.test(f);default:return!1}}))}}]),e}(),yt=function(){function e(n){var r=this;t(this,e),this.art=n;var o=n.option,i=n.constructor,a=n.whitelist;o.container instanceof Element?this.$container=o.container:(this.$container=m(o.container),z(this.$container,"No container element found by ".concat(o.container)));var c=this.$container.tagName.toLowerCase();z("div"===c,"Unsupported container element type, only support 'div' but got '".concat(c,"'")),z(i.instances.every((function(t){return t.template.$container!==r.$container})),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=n.id,this.$original=this.$container.cloneNode(!0),a.state?this.desktop():this.mobile()}return n(e,[{key:"query",value:function(t){return m(t,this.$container)}},{key:"desktop",value:function(){var t=this.art.option;t.useSSR||(this.$container.innerHTML=e.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$miniHeader=this.query(".art-mini-header"),this.$miniTitle=this.query(".art-mini-title"),this.$miniClose=this.query(".art-mini-close"),this.$contextmenu=this.query(".art-contextmenus"),t.backdrop&&(b(this.$setting,"art-backdrop-filter"),b(this.$contextmenu,"art-backdrop-filter"),b(this.$info,"art-backdrop-filter")),d&&b(this.$player,"art-mobile")}},{key:"mobile",value:function(){this.$container.innerHTML='
',this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video")}},{key:"destroy",value:function(t){t?I(this.$original,this.$container):b(this.$player,"art-destroy")}}],[{key:"html",get:function(){return'
Player version:
4.3.9
Video url:
Video volume:
Video time:
Video duration:
Video resolution:
x
[x]
xD7
'}}]),e}(),mt={"Video Info":"统计信息",Close:"关闭","Video Load Failed":"加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音","Video Flip":"画面翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide Subtitle":"隐藏字幕","Show Subtitle":"显示字幕","Show Setting":"显示设置","Hide Setting":"隐藏设置",Screenshot:"截图","Play Speed":"播放速度","Aspect Ratio":"画面比例",Default:"默认",Normal:"正常",Open:"打开","Switch Video":"切换","Switch Subtitle":"切换字幕",Fullscreen:"全屏","Exit Fullscreen":"退出全屏","Web Fullscreen":"网页全屏","Exit Web Fullscreen":"退出网页全屏","Mini Player":"迷你播放器","PIP Mode":"画中画模式","Exit PIP Mode":"退出画中画模式","PIP Not Supported":"不支持画中画模式","Fullscreen Not Supported":"不支持全屏模式","Subtitle Offset":"字幕偏移","Auto playback at":"已为您定位至"},gt={"Video Info":"統計訊息",Close:"關閉","Video Load Failed":"載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音","Video Flip":"畫面翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide Subtitle":"隱藏字幕","Show Subtitle":"顯示字幕","Show Setting":"顯示设置","Hide Setting":"隱藏设置",Screenshot:"截圖","Play Speed":"播放速度","Aspect Ratio":"畫面比例",Default:"默認",Normal:"正常",Open:"打開","Switch Video":"切換","Switch Subtitle":"切換字幕",Fullscreen:"全屏","Exit Fullscreen":"退出全屏","Web Fullscreen":"網頁全屏","Exit Web Fullscreen":"退出網頁全屏","Mini Player":"迷你播放器","PIP Mode":"畫中畫模式","Exit PIP Mode":"退出畫中畫模式","PIP Not Supported":"不支持畫中畫模式","Fullscreen Not Supported":"不支持全屏模式","Subtitle Offset":"字幕偏移","Auto playback at":"已為您定位至"},bt=function(){function e(n){t(this,e),this.art=n,this.languages={"zh-cn":mt,"zh-tw":gt},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=X(this.languages,t),this.init()}}]),e}();var wt={exports:{}};!function(t){!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,o=n.length,i={};rd){var h=d*s/l;k(n,"width","".concat(100*h,"%")),k(n,"height","100%"),k(n,"padding","0 ".concat((u-u*h)/2,"px"))}else{var v=l/d/s;k(n,"width","100%"),k(n,"height","".concat(100*v,"%")),k(n,"padding","".concat((p-p*v)/2,"px 0"))}r.dataset.aspectRatio=e}i.show="".concat(o.get("Aspect Ratio"),": ").concat("default"===e?o.get("Default"):e),t.emit("aspectRatio",e)}}),U(t,"aspectRatioReset",{set:function(e){if(e){var n=t.aspectRatio;t.aspectRatio=n}}})}(n),function(t){var e=t.option,n=t.notice,r=t.template.$video,o=document.createElement("canvas");U(t,"getDataURL",{value:function(){return new Promise((function(t,e){try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),t(o.toDataURL("image/png"))}catch(t){n.show=t,e(t)}}))}}),U(t,"getBlobUrl",{value:function(){return new Promise((function(t,e){try{o.width=r.videoWidth,o.height=r.videoHeight,o.getContext("2d").drawImage(r,0,0),o.toBlob((function(e){t(URL.createObjectURL(e))}))}catch(t){n.show=t,e(t)}}))}}),U(t,"screenshot",{value:function(){return t.getDataURL().then((function(n){return W(n,"".concat(e.title||"artplayer","_").concat(tt(r.currentTime),".png")),t.emit("screenshot",n),n}))}})}(n),Ot(n),function(t){var e=t.notice,n=t.template.$player;U(t,"fullscreenWeb",{get:function(){return x(n,"art-fullscreen-web")},set:function(r){r?(b(n,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=!1,t.emit("resize"),t.emit("fullscreenWeb",!0),e.show=""):(w(n,"art-fullscreen-web"),t.aspectRatioReset=!0,t.autoSize=t.option.autoSize,t.emit("resize"),t.emit("fullscreenWeb"),e.show="")}})}(n),kt(n),function(t){var e=t.template.$video;U(t,"loaded",{get:function(){return t.loadedTime/e.duration}}),U(t,"loadedTime",{get:function(){return e.buffered.length?e.buffered.end(e.buffered.length-1):0}})}(n),function(t){U(t,"played",{get:function(){return t.currentTime/t.duration}})}(n),function(t){var e=t.template.$video;U(t,"playing",{get:function(){return!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)}})}(n),function(t){var e=t.template,n=e.$container,r=e.$player,o=e.$video;U(t,"autoSize",{get:function(){return x(n,"art-auto-size")},set:function(e){if(e){var i=o.videoWidth,a=o.videoHeight,c=n.getBoundingClientRect(),l=c.width,s=c.height,u=i/a,p=l/s;if(b(n,"art-auto-size"),p>u)k(r,"width","".concat(s*u/l*100,"%")),k(r,"height","100%");else{var f=l/u/s*100;k(r,"width","100%"),k(r,"height","".concat(f,"%"))}t.emit("autoSize",{width:t.width,height:t.height})}else w(n,"art-auto-size"),k(r,"width",null),k(r,"height",null),t.emit("autoSize")}})}(n),function(t){U(t,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}});for(var e=["bottom","height","left","right","top","width"],n=function(n){var r=e[n];U(t,r,{get:function(){return t.rect[r]}})},r=0;r=1?(e=[r,o],t.emit("loop",e)):(e=[],t.emit("loop"))}else e=[],t.emit("loop")}}),t.on("video:timeupdate",(function(){e.length&&(t.currentTimee[1])&&(t.seek=e[0])}))}(n),function(t){var e=t.option,n=t.template.$poster;U(t,"poster",{get:function(){return e.poster},set:function(t){e.poster=t,k(n,"backgroundImage","url(".concat(t,")"))}})}(n),function(t){var e=t.option,n=t.template,r=n.$container,o=n.$video,i=r.style.height;U(t,"autoHeight",{get:function(){return x(r,"art-auto-height")},set:function(n){if(n){var a=r.clientWidth,c=o.videoHeight*(a/o.videoWidth);k(r,"height",c+"px"),b(r,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight",c)}else k(r,"height",i),w(r,"art-auto-height"),t.autoSize=e.autoSize,t.emit("autoHeight")}})}(n),function(t){var e=t.option,n=t.template.$player;U(t,"theme",{get:function(){return getComputedStyle(n).getPropertyValue("--theme")},set:function(t){e.theme=t,n.style.setProperty("--theme",t)}})}(n),function(t){U(t,"title",{get:function(){return t.option.title},set:function(e){t.option.title=e}})}(n),function(t){var e=["mini","pip","fullscreen","fullscreenWeb"];!function(e){for(var n=function(n){var r=e[n];t.on(r,(function(){t[r]&&e.filter((function(t){return t!==r})).forEach((function(e){t[e]&&(t[e]=!1)}))}))},r=0;r=Number(o.dataset.index)}));return a?a.insertAdjacentElement("beforebegin",o):O(this.$parent,o),n.html&&O(o,n.html),n.style&&j(o,n.style),n.tooltip&&T(o,n.tooltip),n.click&&this.art.events.proxy(o,"click",(function(t){t.preventDefault(),n.click.call(e.art,e,t)})),n.selector&&["left","right"].includes(n.position)&&this.selector(n,o),n.mounted&&n.mounted.call(this.art,o),1===o.childNodes.length&&3===o.childNodes[0].nodeType&&b(o,"art-control-onlyText"),U(this,r,{value:o}),o}}},{key:"selector",value:function(t,e){var n=this,r=this.art.events,o=r.hover,i=r.proxy;b(e,"art-control-selector");var a=document.createElement("div");b(a,"art-selector-value"),O(a,t.html),e.innerText="",O(e,a);var c=t.selector.map((function(t,e){return'
').concat(t.html,"
")})).join(""),l=document.createElement("div");b(l,"art-selector-list"),O(l,c),O(e,l);var s=function(){var t=P(e,"width")/2-P(l,"width")/2;l.style.left="".concat(t,"px")};o(e,s),i(l,"click",(function(e){var r=(e.composedPath()||[]).find((function(t){return x(t,"art-selector-item")}));if(r){S(r,"art-current");var o=Number(r.dataset.index),i=t.selector[o]||{};if(a.innerText=r.innerText,t.onSelect){var c=t.onSelect.call(n.art,i,r,e);"string"!=typeof c&&"number"!=typeof c||(a.innerHTML=c)}s(),n.art.emit("selector",i,r)}}))}}]),e}();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 Rt(t){for(var e=1;e
',mounted:function(t){var i=!1,a=m(".art-progress-loaded",t),c=m(".art-progress-played",t),l=m(".art-progress-highlight",t),s=m(".art-progress-indicator",t),u=m(".art-progress-tip",t);k(c,"backgroundColor","var(--theme)");var p=e.constructor.INDICATOR_SIZE;function f(t,e){"loaded"===t&&k(a,"width","".concat(100*e,"%")),"played"===t&&(k(c,"width","".concat(100*e,"%")),k(s,"left","calc(".concat(100*e,"% - ").concat(p/2,"px)")))}n.indicator?(p=e.constructor.INDICATOR_SIZE_ICON,O(s,n.indicator)):j(s,{backgroundColor:"var(--theme)"}),d&&(p=e.constructor.INDICATOR_SIZE_MOBILE,n.indicator&&(p=e.constructor.INDICATOR_SIZE_MOBILE_ICON)),j(s,{left:"-".concat(p/2,"px"),width:"".concat(p,"px"),height:"".concat(p,"px")});for(var h=0;h'))}f("loaded",e.loaded),e.on("video:progress",(function(){f("loaded",e.loaded)})),e.on("video:timeupdate",(function(){f("played",e.played)})),e.on("video:ended",(function(){f("played",1)})),o(t,"mousemove",(function(n){k(u,"display","block"),C(n,l)?function(n){var r=_t(e,n).width,o=n.target.dataset.text;u.innerHTML=o;var i=u.clientWidth;r<=i/2?k(u,"left",0):r>t.clientWidth-i/2?k(u,"left","".concat(t.clientWidth-i,"px")):k(u,"left","".concat(r-i/2,"px"))}(n):function(n){var r=_t(e,n),o=r.width,i=r.time;u.innerHTML=i;var a=u.clientWidth;o<=a/2?k(u,"left",0):o>t.clientWidth-a/2?k(u,"left","".concat(t.clientWidth-a,"px")):k(u,"left","".concat(o-a/2,"px"))}(n)})),o(t,"mouseout",(function(){k(u,"display","none")})),o(t,"click",(function(t){if(t.target!==s){var n=_t(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(s,"mousedown",(function(){i=!0})),o(document,"mousemove",(function(t){if(i){var n=_t(e,t),r=n.second;f("played",n.percentage),e.seek=r}})),o(document,"mouseup",(function(){i&&(i=!1)})),function(t,e,n){if(d&&!t.option.isLive){var r=t.plugins,o=t.template.$progress,i=t.events.proxy,a=!1;i(e,"touchstart",(function(t){1===t.touches.length&&(a=!0)})),i(document,"touchmove",(function(e){if(1===e.touches.length&&a){var i=r.autoOrientation&&r.autoOrientation.state,c=o.getBoundingClientRect(),l=c.left,s=c.top,u=e.touches[0],p=u.clientX,f=u.clientY,d=K(p-l,0,o.clientWidth),h=K(f-s,0,o.clientWidth),v=i?h:d,y=d/o.clientWidth*t.duration,m=h/o.clientWidth*t.duration,g=i?m:y,b=K(v/o.clientWidth,0,1);n("played",b),t.seek=g}})),i(document,"touchend",(function(){a&&(a=!1)}))}}(e,s,f)}})}}function Bt(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){for(var e=1;eo.clientWidth-f/2?k(t,"left","".concat(o.clientWidth-f,"px")):k(t,"left","".concat(a-f/2,"px"))}(r))})),c(o,"mouseout",(function(){k(t,"display","none")}))}})}}function Qt(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 Jt(t){for(var e=1;e=a.CONTROL_HIDE_TIME&&(n.show=!1,b(l,"art-hide-cursor"),w(l,"art-hover"))})),e.once("video:loadedmetadata",(function(){n.add(Nt({name:"progress",disable:i.isLive,position:"top",index:10})),n.add(Xt({name:"thumbnails",disable:!i.thumbnails.url||i.isLive||d,position:"top",index:20})),n.add(function(t){return function(e){return ne(ne({},t),{},{mounted:function(t){var n=O(t,''),r=O(t,'');e.on("loop",(function(o){o?(k(t,"display","block"),k(n,"left","calc(".concat(o[0]/e.duration*100,"% - ").concat(n.clientWidth,"px)")),k(r,"left","".concat(o[1]/e.duration*100,"%"))):k(t,"display","none")}))}})}}({name:"loop",disable:!1,position:"top",index:30})),n.add(function(t){return function(e){return Mt(Mt({},t),{},{mounted:function(t){var n=e.events.proxy,r=e.icons,o=e.i18n,i=O(t,r.play),a=O(t,r.pause);function c(){k(i,"display","flex"),k(a,"display","none")}function l(){k(i,"display","none"),k(a,"display","flex")}T(i,o.get("Play")),T(a,o.get("Pause")),n(i,"click",(function(){e.play()})),n(a,"click",(function(){e.pause()})),e.playing?l():c(),e.on("video:playing",(function(){l()})),e.on("video:pause",(function(){c()}))}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),n.add(function(t){return function(e){return qt(qt({},t),{},{mounted:function(t){var n=e.events.proxy,r=e.icons,o=e.i18n,i=!1,a=e.constructor.VOLUME_PANEL_WIDTH,c=e.constructor.VOLUME_HANDLE_WIDTH,l=O(t,r.volume),s=O(t,r.volumeClose),u=O(t,'
'),p=O(u,'
');function f(t){var e=u.getBoundingClientRect().left;return K(t.pageX-e-c/2,0,a-c/2)/(a-c)}function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.7;if(e.muted||0===t)k(l,"display","none"),k(s,"display","flex"),k(p,"left","0");else{var n=(a-c)*t;k(l,"display","flex"),k(s,"display","none"),k(p,"left","".concat(n,"px"))}}T(l,o.get("Mute")),k(s,"display","none"),d&&k(u,"display","none"),h(e.volume),e.on("video:volumechange",(function(){h(e.volume)})),n(l,"click",(function(){e.muted=!0})),n(s,"click",(function(){e.muted=!1})),n(u,"click",(function(t){e.muted=!1,e.volume=f(t)})),n(p,"mousedown",(function(){i=!0})),n(t,"mousemove",(function(t){i&&(e.muted=!1,e.volume=f(t))})),n(document,"mouseup",(function(){i&&(i=!1)}))}})}}({name:"volume",disable:!1,position:"left",index:20})),n.add(function(t){return function(e){return Wt(Wt({},t),{},{mounted:function(t){function n(){var n="".concat(tt(e.currentTime)," / ").concat(tt(e.duration));n!==t.innerText&&(t.innerText=n)}n();for(var r=["video:loadedmetadata","video:timeupdate","video:progress"],o=0;o0.50.75').concat(n.get("Normal"),'1.251.52.0'),click:function(t,n){var r=n.target.dataset.value;r&&(e.playbackRate=Number(r),t.show=!1)},mounted:function(t){e.on("playbackRate",(function(e){var n=g("span",t).find((function(t){return Number(t.dataset.value)===e}));n&&S(n,"art-current")}))}})}}({disable:!n.playbackRate,name:"playbackRate",index:10})),this.add(function(t){return function(e){var n=e.i18n;return le(le({},t),{},{html:"".concat(n.get("Aspect Ratio"),':').concat(n.get("Default"),'4:316:9'),click:function(t,n){var r=n.target.dataset.value;r&&(e.aspectRatio=r,t.show=!1)},mounted:function(t){e.on("aspectRatio",(function(e){var n=g("span",t).find((function(t){return t.dataset.value===e}));n&&S(n,"art-current")}))}})}}({disable:!n.aspectRatio,name:"aspectRatio",index:20})),this.add(function(t){return function(e){var n=e.i18n;return ue(ue({},t),{},{html:"".concat(n.get("Video Flip"),':').concat(n.get("Normal"),'').concat(n.get("Horizontal"),'').concat(n.get("Vertical"),""),click:function(t,n){var r=n.target.dataset.value;r&&(e.flip=r,t.show=!1)},mounted:function(t){e.on("flip",(function(e){var n=g("span",t).find((function(t){return t.dataset.value===e}));n&&S(n,"art-current")}))}})}}({disable:!n.flip,name:"flip",index:30})),this.add(function(t){return function(e){return fe(fe({},t),{},{html:e.i18n.get("Video Info"),click:function(t){e.info.show=!0,t.show=!1}})}}({disable:!1,name:"info",index:40})),this.add(function(t){return he(he({},t),{},{html:'ArtPlayer 4.3.9'})}({disable:!1,name:"version",index:50})),this.add(function(t){return function(e){return ye(ye({},t),{},{html:e.i18n.get("Close"),click:function(t){t.show=!1}})}}({disable:!1,name:"close",index:60}));for(var c=0;cs+l&&(h=l-d),r+f>u+c&&(v=c-f),j(i,{top:"".concat(v,"px"),left:"".concat(h,"px")})})),a(o,"click",(function(e){C(e,i)||(t.show=!1)})),this.art.on("blur",(function(){t.show=!1}))}}]),o}(St);function be(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}var we=function(e){i(o,e);var r=be(o);function o(e){var n;return t(this,o),(n=r.call(this,e)).name="info",e.once("video:loadedmetadata",(function(){d||n.init()})),n}return n(o,[{key:"init",value:function(){var t=this,e=this.art,n=e.constructor,r=e.events.proxy,o=e.template,i=o.$infoPanel,a=o.$infoClose,c=o.$video;r(a,"click",(function(){t.show=!1}));var l=null,s=g("[data-video]",i)||[];this.art.on("destroy",(function(){clearTimeout(l)})),function t(){for(var e=0;e".concat(et(t),"

")})).join(""),this.art.emit("subtitleUpdate",this.activeCue.text))}},{key:"switch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.art,r=n.i18n,o=n.notice,i=n.option,a=Oe(Oe(Oe({},i.subtitle),e),{},{url:t});return this.init(a).then((function(t){return e.name&&(o.show="".concat(r.get("Switch Subtitle"),": ").concat(e.name)),t}))}},{key:"init",value:function(t){var e=this;if(u(t,dt.subtitle),t.url){var n=this.art,r=n.notice,o=n.events.proxy,i=n.template,a=i.$subtitle,c=i.$video;if(!i.$track){var l=document.createElement("track");l.default=!0,l.kind="metadata",c.appendChild(l),this.art.template.$track=l,o(this.textTrack,"cuechange",this.update.bind(this))}return this.style(Oe({"text-shadow":F()},t.style)),z(window.fetch,"fetch not support"),fetch(t.url).then((function(t){return t.arrayBuffer()})).then((function(n){z(window.TextDecoder,"TextDecoder not support");var r=new TextDecoder(t.encoding).decode(n);switch(e.art.emit("subtitleLoad",t.url),t.type||H(t.url)){case"srt":return N(_(r));case"ass":return N(B(r));case"vtt":return N(r);default:return t.url}})).then((function(t){return a.innerHTML="",e.url===t||(URL.revokeObjectURL(e.url),e.art.template.$track.src=t,e.art.emit("subtitleSwitch",t)),t})).catch((function(t){throw r.show=t,t}))}}}]),o}(St);var Pe=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:loadedmetadata",(function(){!function(t,e){var n=t.constructor,r=t.template,o=r.$player,i=r.$video;e.proxy(document,["click","contextmenu"],(function(e){C(e,o)?(t.isFocus=!0,t.emit("focus")):(t.isFocus=!1,t.emit("blur"))}));var a=0;e.proxy(i,"click",(function(){var e=Date.now();e-a<=n.DB_CLICE_TIME?(t.emit("dblclick"),d?t.toggle():t.fullscreen=!t.fullscreen):(t.emit("click"),d||t.toggle()),a=e}))}(n,r),function(t,e){var n=t.template.$player;e.hover(n,(function(){b(n,"art-hover"),t.emit("hover",!0)}),(function(){w(n,"art-hover"),t.emit("hover")}))}(n,r),function(t,e){var n=t.template.$player;e.proxy(n,"mousemove",(function(e){t.emit("mousemove",e)}))}(n,r),function(t,e){var n=t.notice,r=t.option,o=J((function(){t.normalSize&&(t.autoSize=r.autoSize),t.aspectRatioReset=!0,n.show="",t.emit("resize")}),t.constructor.RESIZE_TIME);e.proxy(window,["orientationchange","resize"],(function(){o()})),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",(function(){o()}))}(n,r),function(t,e){if(d&&!t.option.isLive){var n=t.notice,r=t.plugins,o=t.constructor,i=t.template.$video,a=!1,c=0,l=0,s=0,u=null;e.proxy(i,"touchstart",(function(e){if(1===e.touches.length){a=!0;var n=e.touches[0],r=n.clientX,i=n.clientY;c=r,l=i,clearTimeout(u),u=setTimeout((function(){t.playbackRate=o.MOBILE_AUTO_PLAYBACKRATE}),o.MOBILE_AUTO_PLAYBACKRATE_TIME)}})),e.proxy(i,"touchmove",(function(e){if(1===e.touches.length&&a){var o=r.autoOrientation&&r.autoOrientation.state,i=e.touches[0],u=i.clientX,p=i.clientY,f=K((u-c)/t.width,-1,1),d=K((p-l)/t.height,-1,1);t.duration&&(s=K(o?t.currentTime+t.duration*d:t.currentTime+t.duration*f,0,t.duration),n.show="".concat(tt(s)," / ").concat(tt(t.duration)))}})),e.proxy(document,"touchend",(function(){a&&(s&&(t.seek=s),3===t.playbackRate&&(t.playbackRate=1),c=0,l=0,s=0,a=!1,clearTimeout(u),u=null)}))}}(n,r),function(t,e){var n=t.option,r=t.constructor,o=t.template.$container,i=J((function(){t.emit("view",R(o,r.SCROLL_GAP))}),r.SCROLL_TIME);e.proxy(window,"scroll",(function(){i()})),t.on("view",(function(e){n.autoMini&&(t.mini=!e)}))}(n,r)}))}return n(e,[{key:"proxy",value:function(t,e,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(Array.isArray(e))return e.map((function(e){return r.proxy(t,e,n,o)}));t.addEventListener(e,n,o);var i=function(){return t.removeEventListener(e,n,o)};return this.destroyEvents.push(i),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 o;if(t instanceof HTMLImageElement)o=t;else{if("string"!=typeof t)return r(new L("Unable to get Image"));(o=new Image).src=t}if(o.complete)return n(o);e.proxy(o,"load",(function(){return n(o)})),e.proxy(o,"error",(function(){return r(new L("Failed to load Image: ".concat(o.src)))}))}))}},{key:"destroy",value:function(){for(var t=0;t',state:'',play:'',pause:'',check:'',volume:'',volumeClose:'',subtitle:'',screenshot:'\t',setting:'',fullscreen:'\t\t\t\t',fullscreenWeb:'\t',pip:'',arrowLeft:'',arrowRight:'',playbackRate:'',aspectRatio:'',config:'',lock:'',unlock:''},n.option.icons);Object.keys(o).forEach((function(t){U(r,t,{get:function(){var e=document.createElement("i");return b(e,"art-icon"),b(e,"art-icon-".concat(t)),O(e,o[t]),e}})}))}));function Le(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function ze(t,e,n){for(var r=0;r'),c=document.createElement("div");b(c,"art-setting-item-left-icon"),O(c,r.arrowLeft),O(a,c),O(a,t._parentItem.html);var l=o(i,"click",(function(){e.init(t._parentList)}));return this.events.push(l),i}},{key:"creatItem",value:function(t){var e=this,n=this.art,r=n.icons,o=n.events.proxy,i=t.selector&&t.selector.length,a=document.createElement("div");b(a,"art-setting-item"),t.default&&b(a,"art-current");var c=O(a,'
'),l=O(a,'
'),s=document.createElement("div");b(s,"art-setting-item-left-icon"),O(s,i?t.icon||r.config:r.check),O(c,s),t._$icon=s,U(t,"icon",{get:function(){return s.innerHTML},set:function(t){"string"!=typeof t&&"number"!=typeof t||(s.innerHTML=t)}});var u=document.createElement("div");if(b(u,"art-setting-item-left-text"),O(u,t.html||""),O(c,u),t._$html=u,U(t,"html",{get:function(){return u.innerHTML},set:function(t){"string"!=typeof t&&"number"!=typeof t||(u.innerHTML=t)}}),i){var p=document.createElement("div");b(p,"art-setting-item-right-tooltip"),O(p,t.tooltip||""),O(l,p),t._$tooltip=p,U(t,"tooltip",{get:function(){return p.innerHTML},set:function(t){"string"!=typeof t&&"number"!=typeof t||(p.innerHTML=t)}});var f=document.createElement("div");b(f,"art-setting-item-right-icon"),O(f,r.arrowRight),O(l,f)}var d=o(a,"click",(function(n){if(i)e.init(t.selector,t.width);else if(S(a,"art-current"),t._parentList&&e.init(t._parentList),t._parentItem&&t._parentItem.onSelect){var r=t._parentItem.onSelect.call(e.art,t,a,n);t._parentItem._$tooltip&&("string"!=typeof r&&"number"!=typeof r||(t._parentItem._$tooltip.innerHTML=r))}}));return this.events.push(d),a}},{key:"init",value:function(t,e){if(this.cache.has(t)){var n=this.cache.get(t);S(n,"art-current"),k(this.$parent,"width","".concat(n.dataset.width,"px"))}else{var r=document.createElement("div");b(r,"art-setting-panel"),t[0]&&t[0]._parentItem&&O(r,this.creatHeader(t[0]));for(var o=0;oc&&su)&&setTimeout((function(){k(o,"width","".concat(u,"px")),k(o,"height","".concat(s,"px")),k(o,"transform-origin","0 0"),k(o,"transform","rotate(90deg) translate(0, -".concat(s,"px)")),b(o,"art-auto-orientation")}),n.MOBILE_AUTO_ORIENTATION_TIME)}else x(o,"art-auto-orientation")&&(k(o,"width",null),k(o,"height",null),k(o,"transform",null),k(o,"transform-origin",null),w(o,"art-auto-orientation"),t.aspectRatioReset=!0,t.autoSize=e.autoSize,t.notice.show="")})),{name:"autoOrientation",get state(){return x(o,"art-auto-orientation")}}}function He(t){var e=t.i18n,n=t.storage,r=t.constructor,o=t.template.$poster;return t.on("video:timeupdate",(function(){var e=n.get("times")||{},o=Object.keys(e);o.length>r.AUTO_PLAYBACK_MAX&&delete e[o[0]],e[t.option.url]=t.currentTime,n.set("times",e)})),t.on("ready",(function(){var r=(n.get("times")||{})[t.option.url];r&&(t.seek=r,k(o,"display","none"),t.notice.show="".concat(e.get("Auto playback at")," ").concat(tt(r)))})),{name:"autoPlayback",get times(){return n.get("times")||{}},clear:function(){return n.del("times")}}}function We(t){var e=t.layers,n=t.icons,r=t.template.$player;return e.add({name:"lock",mounted:function(e){var r=O(e,n.lock),o=O(e,n.unlock);k(r,"display","none"),t.on("lock",(function(t){t?(k(r,"display","inline-flex"),k(o,"display","none")):(k(r,"display","none"),k(o,"display","inline-flex"))}))},click:function(){x(r,"art-lock")?(w(r,"art-lock"),t.emit("lock",!1)):(b(r,"art-lock"),t.emit("lock",!0))}}),{name:"lock",get state(){return x(r,"art-lock")}}}var Ve=function(){function e(n){t(this,e),this.art=n,this.id=0;var r=n.option;!r.isLive&&r.miniProgressBar&&this.add(Be),r.lock&&d&&this.add(We),r.autoPlayback&&this.add(He),r.autoOrientation&&d&&this.add(Fe);for(var o=0;o0&&void 0!==arguments[0]?arguments[0]:{};this.isEnd||(this.art.switchUrl(e.url),this.art.once("video:timeupdate",(function(){t.art.emit("ads:start",e)})),this.art.once("video:ended",(function(){var e=t.next;e?(t.index+=1,t.play(e)):t.end()})))}},{key:"end",value:function(){this.isEnd||(this.isEnd=!0,this.playing=!1,this.art.option.url=this.urlCache,this.art.switchUrl(this.urlCache),this.art.emit("ads:end"))}}]),e}(),Ue=n((function e(n){t(this,e);for(var r=n.option,o=n.events.proxy,i=n.template.$video,a=0;a0&&void 0!==arguments[0])||arguments[0];this.events.destroy(),this.template.destroy(t),Ge.splice(Ge.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"instances",get:function(){return Ge}},{key:"version",get:function(){return"4.3.9"}},{key:"env",get:function(){return"production"}},{key:"build",get:function(){return"1651029214759"}},{key:"config",get:function(){return ht}},{key:"utils",get:function(){return nt}},{key:"scheme",get:function(){return dt}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return u}},{key:"kindOf",get:function(){return u.kindOf}},{key:"html",get:function(){return yt.html}},{key:"option",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!0,autoPlayback:!1,autoOrientation:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:h?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),a}(p);return Xe.NOTICE_TIME=2e3,Xe.SETTING_WIDTH=250,Xe.SETTING_ITEM_WIDTH=200,Xe.INDICATOR_SIZE=14,Xe.INDICATOR_SIZE_ICON=16,Xe.INDICATOR_SIZE_MOBILE=18,Xe.INDICATOR_SIZE_MOBILE_ICON=20,Xe.VOLUME_PANEL_WIDTH=60,Xe.VOLUME_HANDLE_WIDTH=12,Xe.RESIZE_TIME=500,Xe.SCROLL_TIME=200,Xe.SCROLL_GAP=50,Xe.AUTO_PLAYBACK_MAX=10,Xe.RECONNECT_TIME_MAX=5,Xe.RECONNECT_SLEEP_TIME=1e3,Xe.CONTROL_HIDE_TIME=3e3,Xe.DB_CLICE_TIME=300,Xe.MOBILE_AUTO_PLAYBACKRATE=3,Xe.MOBILE_AUTO_PLAYBACKRATE_TIME=1e3,Xe.MOBILE_AUTO_ORIENTATION_TIME=100,Xe.INFO_LOOP_TIME=1e3,console.log("%c ArtPlayer %c 4.3.9 %c https://artplayer.org","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),Xe}));