/*! * artplayer-react.js v3.1.13 * Github: https://github.com/zhw2590582/ArtPlayer#readme * (c) 2017-2019 Harvey Zack * Released under the MIT License. */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).ArtplayerReact=t()}(this,function(){"use strict";var a=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r.")}return t}(t);if(!be[n]){be[n]=!0;var r="";e&&e._owner&&e._owner!==q.current&&(r=" It was passed a child from "+W(e._owner.type)+"."),V(e),B(!1,'Each child in a list should have a unique "key" prop.%s%s See https://fb.me/react-warning-keys for more information.',n,r),V(null)}}}function Oe(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n",o=" Did you accidentally export a JSX literal instead of a component?"):a=typeof e,B(!1,"React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",a,o)}var c=Q.apply(this,arguments);if(null==c)return c;if(r)for(var s=2;s is not supported and will be removed in a future major release. Did you mean to render instead?"),n.Provider},set:function(e){n.Provider=e}},_currentValue:{get:function(){return n._currentValue},set:function(e){n._currentValue=e}},_currentValue2:{get:function(){return n._currentValue2},set:function(e){n._currentValue2=e}},_threadCount:{get:function(){return n._threadCount},set:function(e){n._threadCount=e}},Consumer:{get:function(){return r||B(!(r=!0),"Rendering is not supported and will be removed in a future major release. Did you mean to render instead?"),n.Consumer}}}),n.Consumer=i,n._currentRenderer=null,n._currentRenderer2=null,n},forwardRef:function(e){return null!=e&&e.$$typeof===f?k(!1,"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?k(!1,"forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&k(!1,"forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null==e||null==e.defaultProps&&null==e.propTypes||k(!1,"forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"),{$$typeof:i,render:e}},lazy:function(e){var t={$$typeof:p,_ctor:e,_status:-1,_result:null},n=void 0,r=void 0;return Object.defineProperties(t,{defaultProps:{configurable:!0,get:function(){return n},set:function(e){B(!1,"React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),n=e,Object.defineProperty(t,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){B(!1,"React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),r=e,Object.defineProperty(t,"propTypes",{enumerable:!0})}}}),t},memo:function(e,t){return he(e)||k(!1,"memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e),{$$typeof:f,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return ve().useCallback(e,t)},useContext:function(e,t){var n=ve();if(void 0!==t&&B(!1,"useContext() second argument is reserved for future use in React. Passing it is not supported. You passed: %s.%s",t,"number"==typeof t&&Array.isArray(arguments[2])?"\n\nDid you call array.map(useContext)? Calling Hooks inside a loop is not supported. Learn more at https://fb.me/rules-of-hooks":""),void 0!==e._context){var r=e._context;r.Consumer===e?B(!1,"Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&B(!1,"Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e,t)},useEffect:function(e,t){return ve().useEffect(e,t)},useImperativeHandle:function(e,t,n){return ve().useImperativeHandle(e,t,n)},useDebugValue:function(e,t){return ve().useDebugValue(e,t)},useLayoutEffect:function(e,t){return ve().useLayoutEffect(e,t)},useMemo:function(e,t){return ve().useMemo(e,t)},useReducer:function(e,t,n){return ve().useReducer(e,t,n)},useRef:function(e){return ve().useRef(e)},useState:function(e){return ve().useState(e)},Fragment:u,Profiler:r,StrictMode:n,Suspense:s,unstable_SuspenseList:l,createElement:ke,cloneElement:function(e,t,n){for(var r=function(e,t,n){!function(){if(null==e)throw O(Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+"."))}();var r=void 0,o=y({},e.props),i=e.key,a=e.ref,c=e._self,s=e._source,u=e._owner;if(null!=t){J(t)&&(a=t.ref,u=q.current),G(t)&&(i=""+t.key);var l=void 0;for(r in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)U.call(t,r)&&!Y.hasOwnProperty(r)&&(void 0===t[r]&&void 0!==l?o[r]=l[r]:o[r]=t[r])}var f=arguments.length-2;if(1==f)o.children=n;else if(1").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function ze(e){return URL.createObjectURL(new Blob([e],{type:"text/vtt"}))}function Ie(e,t){var n=document.createElement("a");Re(n,"display","none"),n.href=e,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n)}function We(n){for(var e=arguments.length,t=new Array(1\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
[x]
\n
\n
\n
\n
×
\n
\n
\n \n '),this.$player=this.$container.querySelector(".artplayer-video-player"),this.$video=this.$container.querySelector(".artplayer-video"),this.$subtitle=this.$container.querySelector(".artplayer-subtitle"),this.$danmuku=this.$container.querySelector(".artplayer-danmuku"),this.$bottom=this.$container.querySelector(".artplayer-bottom"),this.$progress=this.$container.querySelector(".artplayer-progress"),this.$controls=this.$container.querySelector(".artplayer-controls"),this.$controlsLeft=this.$container.querySelector(".artplayer-controls-left"),this.$controlsRight=this.$container.querySelector(".artplayer-controls-right"),this.$layers=this.$container.querySelector(".artplayer-layers"),this.$loading=this.$container.querySelector(".artplayer-loading"),this.$notice=this.$container.querySelector(".artplayer-notice"),this.$noticeInner=this.$container.querySelector(".artplayer-notice-inner"),this.$mask=this.$container.querySelector(".artplayer-mask"),this.$setting=this.$container.querySelector(".artplayer-setting"),this.$settingInner=this.$container.querySelector(".artplayer-setting-inner"),this.$settingBody=this.$container.querySelector(".artplayer-setting-body"),this.$info=this.$container.querySelector(".artplayer-info"),this.$infoPanel=this.$container.querySelector(".artplayer-info-panel"),this.$infoClose=this.$container.querySelector(".artplayer-info-close"),this.$pipHeader=this.$container.querySelector(".artplayer-pip-header"),this.$pipTitle=this.$container.querySelector(".artplayer-pip-title"),this.$pipClose=this.$container.querySelector(".artplayer-pip-close"),this.$contextmenu=this.$container.querySelector(".artplayer-contextmenu")}},{key:"initMobile",value:function(){this.$container.innerHTML='\n
\n \n
\n ',this.$player=this.$container.querySelector(".artplayer-video-player"),this.$video=this.$container.querySelector(".artplayer-video")}},{key:"destroy",value:function(e){e?this.$container.innerHTML="":this.$player.classList.add("artplayer-destroy")}}]),n}(),Ye={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","This does not seem to support full screen functionality":"似乎不支持全屏功能"},Xe={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","This does not seem to support full screen functionality":"似乎不支持全屏功能"},Ze=function(){function t(e){s(this,t),this.art=e,this.languages={"zh-cn":Ye,"zh-tw":Xe},this.init()}return u(t,[{key:"init",value:function(){var e=this.art.option.lang.toLowerCase();this.language=this.languages[e]||{}}},{key:"get",value:function(e){return this.language[e]||e}},{key:"update",value:function(e){this.languages=Se(this.languages,e),this.init()}}]),t}();var Je=e(function(e){var a,t,c,s,r,n;a="undefined"!=typeof window&&void 0!==window.document?window.document:{},t=e.exports,c="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,s=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=t.length,o={};n ").concat(s));var u=document.createElement("div");u.classList.value="art-".concat(i," art-").concat(i,"-").concat(s),a.html&&Ee(u,a.html),a.style&&Ce(u,a.style);var l=Array.from(e.children);u.dataset.index=a.index||c;var f=l.find(function(e){return Number(e.dataset.index)>=Number(u.dataset.index)});return f?f.insertAdjacentElement("beforebegin",u):Ee(e,u),a.click&&t.events.proxy(u,"click",function(e){e.preventDefault(),a.click.call(t,n,e),t.emit("".concat(i,":click"),u)}),a.mounted&&a.mounted(u,n,t),o&&o(u,n,t),Object.defineProperty(n,s,{value:{get id(){return c},get $ref(){return u},set show(e){e?(Re(u,"display","block"),t.emit("".concat(i,":show"),u)):(Re(u,"display","none"),t.emit("".concat(i,":hide"),u))},set remove(e){e&&($e(u),t.emit("".concat(i,":remove"),u))}}}),t.emit("".concat(i,":add"),a),n[s]}function et(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function tt(e){return function(a){return function(t){for(var e=1;e\n
\n
\n
\n
\n
\n \n '),mounted:function(i){var o=!1,n=i.querySelector(".art-progress-loaded"),r=i.querySelector(".art-progress-played"),a=i.querySelector(".art-progress-highlight"),c=i.querySelector(".art-progress-indicator"),s=i.querySelector(".art-progress-tip");function u(e,t){"loaded"===e&&Re(n,"width","".concat(100*t,"%")),"played"===e&&(Re(r,"width","".concat(100*t,"%")),Re(c,"left","calc(".concat(100*t,"% - ").concat(_e(c,"width")/2,"px)")))}t.forEach(function(e){var t=we(e.time,0,p.duration)/p.duration*100;Ee(a,''))}),u("loaded",p.loaded),l.on("video:progress",function(){u("loaded",p.loaded)}),l.on("video:timeupdate",function(){u("played",p.played)}),l.on("video:ended",function(){u("played",1)}),f(i,"mousemove",function(e){Re(s,"display","block"),-1i.clientWidth-r/2?Re(s,"left","".concat(i.clientWidth-r,"px")):Re(s,"left","".concat(t-r/2,"px"))}(e):function(e){var t=ut(l,e),n=t.width,r=t.time;s.innerHTML=r;var o=s.clientWidth;n<=o/2?Re(s,"left",0):n>i.clientWidth-o/2?Re(s,"left","".concat(i.clientWidth-o,"px")):Re(s,"left","".concat(n-o/2,"px"))}(e)}),f(i,"mouseout",function(){Re(s,"display","none")}),f(i,"click",function(e){if(e.target!==c){var t=ut(l,e),n=t.second;u("played",t.percentage),p.seek=n}}),f(c,"mousedown",function(){o=!0}),f(document,"mousemove",function(e){if(o){var t=ut(l,e),n=t.second,r=t.percentage;c.classList.add("art-show-indicator"),u("played",r),p.seek=n}}),f(document,"mouseup",function(){o&&(o=!1,c.classList.remove("art-show-indicator"))})}})}}function ft(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function pt(e){return function(a){return function(t){for(var e=1;e'),u=Ee(s,'
');function l(e){var t=s.getBoundingClientRect(),n=t.left,r=t.width,o=u.getBoundingClientRect().width;return we(e.pageX-n-o/2,0,r-o/2)/(r-o)}function f(e){var t=0d.clientWidth-i/2?Re(p,"left","".concat(d.clientWidth-i,"px")):Re(p,"left","".concat(t-i/2,"px"))}(e))}),t(d,"mouseout",function(){Re(p,"display","none")})}})}}function Ot(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function jt(e){return function(a){return function(t){for(var e=1;e'.concat(o.name,"")),u=i.quality.map(function(e,t){return'
').concat(e.name,"
")}).join(""),l=Ee(e,'
'.concat(u,"
"));r(e,function(){l.style.left="-".concat(_e(l,"width")/2-e.clientWidth/2,"px")}),n(l,"click",function(e){var t=Number(e.target.dataset.index),n=i.quality[t],r=n.url,o=n.name;r&&o&&c!==t&&(a.switchQuality(r,o),s.innerHTML=o,c=t)})}})}}var xt=function(){function n(e){var t=this;s(this,n),this.id=0,this.art=e,this.art.once("video:canplay",function(){t.init()})}return u(n,[{key:"init",value:function(){var t=this,e=this.art.option;this.add(lt({name:"progress",disable:e.isLive,position:"top",index:10})),this.add(wt({name:"thumbnails",disable:!e.thumbnails.url||e.isLive,position:"top",index:20})),this.add(ct({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(vt({name:"volume",disable:!1,position:"left",index:20})),this.add(yt({name:"time",disable:e.isLive,position:"left",index:30})),this.add(Pt({name:"quality",disable:0===e.quality.length,position:"right",index:10})),this.add(jt({name:"screenshot",disable:!e.screenshot,position:"right",index:20})),this.add(pt({name:"subtitle",disable:!e.subtitle.url,position:"right",index:30})),this.add(gt({name:"setting",disable:!e.setting,position:"right",index:40})),this.add(it({name:"pip",disable:!e.pip,position:"right",index:50})),this.add(rt({name:"fullscreenWeb",disable:!e.fullscreenWeb,position:"right",index:60})),this.add(tt({name:"fullscreen",disable:!e.fullscreen,position:"right",index:70})),e.controls.forEach(function(e){t.add(e)})}},{key:"add",value:function(e,t){var n,r="function"==typeof e?e(this.art):e,o=this.art.template,i=o.$progress,a=o.$controlsLeft,c=o.$controlsRight;switch(r.position){case"top":n=i;break;case"left":n=a;break;case"right":n=c}ge(n,"Controls option.position can not be empty"),this.id+=1;var s=Qe(this.art,this,n,r,t,"control");return r.disable||"top"===r.position||s.$ref.firstElementChild&&"I"===s.$ref.firstElementChild.tagName||s.$ref.classList.add("art-control-onlyText"),s}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,t.classList.add("artplayer-controls-show"),this.art.emit("controls:show")):(this.state=!1,t.classList.remove("artplayer-controls-show"),this.art.emit("controls:hide"))}}]),n}();function St(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Et(n){return function(e){var t=e.i18n,r=e.player;return function(t){for(var e=1;e0.5\n 0.75\n ').concat(t.get("Normal"),'\n 1.25\n 1.5\n 2.0\n '),click:function(e,t){var n=t.target.dataset.rate;n&&(r.playbackRate=Number(n),e.show=!1)},mounted:function(n){e.on("playbackRateChange",function(t){var e=Array.from(n.querySelectorAll("span")).find(function(e){return Number(e.dataset.rate)===t});e&&Ae(e,"current")})}})}}function $t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Rt(n){return function(t){var e=t.i18n,r=t.player;return function(t){for(var e=1;e').concat(e.get("Default"),'\n 4:3\n 16:9\n '),click:function(e,t){var n=t.target.dataset.ratio;n&&(r.aspectRatio=n,e.show=!1)},mounted:function(e){t.on("aspectRatioChange",function(t){Ae(Array.from(e.querySelectorAll("span")).find(function(e){return e.dataset.ratio===t}),"current")})}})}}function Ct(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 _t(e){return function(t){return function(t){for(var e=1;eArtPlayer 3.1.13'})}function Dt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function At(t){return function(e){return function(t){for(var e=1;e\n
Player version:
\n
3.1.13
\n \n '),e.push('\n
\n
Video url:
\n
'.concat(this.art.option.url,"
\n
\n ")),e.push('\n
\n
Video volume:
\n
\n
\n '),e.push('\n
\n
Video time:
\n
\n
\n '),e.push('\n
\n
Video duration:
\n
\n
\n '),e.push('\n
\n
Video resolution:
\n
\n x \n
\n
\n '),e.join("")}},{key:"readInfo",value:function(){var e=this.art.template,t=e.$infoPanel,n=e.$video;Array.from(t.querySelectorAll("[data-video]")).forEach(function(e){var t=n[e.dataset.video];e.innerHTML=void 0!==t?"number"==typeof t?t.toFixed(2):t:"unknown"})}},{key:"loop",value:function(){var e=this;this.readInfo(),this.timer=setTimeout(function(){e.readInfo(),e.loop()},1e3)}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template,n=t.$player,r=t.$infoPanel;e?(this.state=!0,n.classList.add("artplayer-info-show"),r.innerHTML||Ee(r,this.creatInfo()),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")):(this.state=!1,n.classList.remove("artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide"))}}]),t}();var zt=function(e){if(Array.isArray(e))return e};var It=function(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n};var Wt=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var Nt=function(e,t){return zt(e)||It(e,t)||Wt()},Ft=function(){function n(e){s(this,n),this.art=e,this.state=!0;var t=this.art.option.subtitle.url;t&&this.init(t)}return u(n,[{key:"init",value:function(e){var r=this,t=this.art,o=t.events.proxy,n=t.option.subtitle,i=t.template,a=i.$video,c=i.$subtitle,s=i.$track;if(Ce(c,n.style||{}),!s){var u=document.createElement("track");u.default=!0,u.kind="metadata",a.appendChild(u),this.art.template.$track=u}this.load(e).then(function(e){if(r.art.template.$track.src=e,r.art.emit("subtitle:load",e),a.textTracks&&a.textTracks[0]){var n=Nt(a.textTracks,1)[0];o(n,"cuechange",function(){var e=Nt(n.activeCues,1)[0];if(c.innerHTML="",e){var t=document.createElement("div");t.appendChild(e.getCueAsHTML()),c.innerHTML=t.innerHTML.split(/\r?\n/).map(function(e){return"

".concat(e,"

")}).join("")}r.art.emit("subtitle:update",c)})}})}},{key:"load",value:function(t){var n,r=this.art.notice;return fetch(t).then(function(e){return n=e.headers.get("Content-Type"),e.text()}).then(function(e){return/x-subrip/gi.test(n)?ze(qe(e)):t}).catch(function(e){throw r.show(e),e})}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,t.classList.remove("artplayer-subtitle-hide"),this.art.emit("subtitle:show")):(this.state=!1,t.classList.add("artplayer-subtitle-hide"),this.art.emit("subtitle:hide"))}}]),n}();function Vt(e){var n=this;s(this,Vt);var r=Object.assign({loading:'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',state:'\n \n',play:'\n \n',pause:'\n \n',volume:'\n \n \n',volumeClose:'\n \n \n',subtitle:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',fullscreen:'\n\t\n\t\n\t\n\t\n',fullscreenWeb:'\n\t\n',pip:'\n \n',prev:'\n \n',next:'\n \n'},e.option.icons);Object.keys(r).forEach(function(e){var t=document.createElement("i");t.classList.add("art-icon"),t.classList.add("art-icon-".concat(e)),Ee(t,r[e]),n[e]=t})}var Ht=function(){function n(e){var t=this;s(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),e.whitelist.state&&e.once("video:canplay",function(){!function(t,e){var n=t.template.$player;e.proxy(document,["click","contextmenu"],function(e){-1'),e.icons.state)}return u(t,[{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,t.classList.add("artplayer-mask-show"),this.art.emit("mask:show")):(this.state=!1,t.classList.remove("artplayer-mask-show"),this.art.emit("mask:hide"))}}]),t}();function Jt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Gt(n){return function(t){var e=t.i18n,r=t.player;return function(t){for(var e=1;e'.concat(e.get("Flip"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n "),click:function(e,t){var n=t.target.dataset.value;n&&(r.flip=n)},mounted:function(e){t.on("flipChange",function(t){Ae(Array.from(e.querySelectorAll("button")).find(function(e){return e.dataset.value===t}).parentElement,"current")})}})}}function Kt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function Qt(n){return function(t){var e=t.i18n,r=t.player;return function(t){for(var e=1;e'.concat(e.get("Aspect ratio"),'\n
\n
\n \n
\n
\n \n
\n
\n \n
\n
\n '),click:function(e,t){var n=t.target.dataset.value;n&&(r.aspectRatio=n)},mounted:function(e){t.on("aspectRatioChange",function(t){Ae(Array.from(e.querySelectorAll("button")).find(function(e){return e.dataset.value===t}).parentElement,"current")})}})}}function en(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 tn(t){return function(r){var e=r.i18n,o=r.player,i=r.events.proxy;return function(t){for(var e=1;e\n '.concat(e.get("Play speed"),': 1.0x\n \n
\n \n
\n '),mounted:function(e){var t=e.querySelector(".art-setting-range input"),n=e.querySelector(".art-subtitle-value");i(t,"change",function(){var e=t.value;n.innerText=e,o.playbackRate=Number(e)}),r.on("playbackRateChange",function(e){t.value!==e&&(t.value=e,n.innerText=e)})}})}}var nn=function(){function n(e){var t=this;s(this,n),this.id=0,this.art=e,this.state=!1,e.option.setting&&(this.art.once("video:canplay",function(){t.init()}),this.art.on("blur",function(){t.show=!1}))}return u(n,[{key:"init",value:function(){var t=this,e=this.art,n=e.option,r=e.template.$setting;(0,e.events.proxy)(r,"click",function(e){e.target===r&&(t.show=!1)}),this.add(Gt({disable:!n.flip,name:"flip"})),this.add(Qt({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(tn({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(e,t){this.id+=1;var n=this.art.template.$settingBody;return Qe(this.art,this,n,e,t,"setting")}},{key:"toggle",value:function(){this.show=!this.state}},{key:"show",set:function(e){var t=this.art.template.$player;e?(this.state=!0,t.classList.add("artplayer-setting-show"),this.art.emit("setting:show")):(this.state=!1,t.classList.remove("artplayer-setting-show"),this.art.emit("setting:hide"))}}]),n}(),rn=function(){function t(e){s(this,t),this.art=e,this.name="artplayer_settings",this.init()}return u(t,[{key:"init",value:function(){var e=this.art.option,t=this.get("volume");t&&(e.volume=t)}},{key:"get",value:function(e){var t=JSON.parse(window.localStorage.getItem(this.name))||{};return e?t[e]:{}}},{key:"set",value:function(e,t){var n=Object.assign({},this.get(),c({},e,t));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(e){var t=this.get();delete t[e],window.localStorage.setItem(this.name,JSON.stringify(t))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),t}();function on(r){var e=r.i18n,o=r.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n
\n '.concat(e.get("Subtitle offset time"),': 0s\n
\n
\n \n
\n '),mounted:function(e){var t=e.querySelector(".art-setting-range input"),n=e.querySelector(".art-subtitle-value");o(t,"change",function(){var e=t.value;n.innerText=e,r.plugins.subtitle.offset(Number(e))}),r.on("subtitle:switch",function(){t.value=0,n.innerText=0}),r.on("artplayerPluginSubtitle:set",function(e){t.value!==e&&(t.value=e,n.innerText=e)})}}}function an(r){var o=r.constructor.utils.clamp,e=r.setting,i=r.notice,a=r.template,c=r.i18n,s=r.player;c.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),e.add(on);var u=[];return r.on("subtitle:switch",function(){u=[]}),{name:"subtitle",offset:function(e){if(a.$track&&a.$track.track){var t=Array.from(a.$track.track.cues),n=o(e,-5,5);t.forEach(function(e,t){u[t]||(u[t]={startTime:e.startTime,endTime:e.endTime}),e.startTime=o(u[t].startTime+n,0,s.duration),e.endTime=o(u[t].endTime+n,0,s.duration)}),i.show("".concat(c.get("Subtitle offset time"),": ").concat(e,"s")),r.emit("artplayerPluginSubtitle:set",e)}else i.show("".concat(c.get("No subtitles found"))),r.emit("artplayerPluginSubtitle:set",0)}}}function cn(o){var e=o.constructor.utils,n=e.append,r=e.setStyle,i=e.setStyles,a=e.sleep,c=e.errorHandle,s=o.events.proxy,u=o.option,l=o.notice,f=o.i18n,p=o.template,d=o.player;function y(e){if(e){var t=p.$video.canPlayType(e.type);if("maybe"===t||"probably"===t){var n=URL.createObjectURL(e);d.playbackRate=!1,d.aspectRatio=!1,p.$video.src=n,a(1e3).then(function(){d.currentTime=0}),u.url=n,o.emit("switch",n),l.show(f.get("Load local video successfully"))}else{var r="".concat(f.get("Playback of this file format is not supported"),": ").concat(e.type);l.show(r,!0,3e3),c(!1,r)}}}return f.update({"zh-cn":{"Playback of this file format is not supported":"不支持播放该文件格式","Load local video successfully":"加载本地视频成功"},"zh-tw":{"Playback of this file format is not supported":"不支持播放該文件格式","Load local video successfully":"加載本地視頻成功"}}),s(p.$player,"dragover",function(e){e.preventDefault(),l.show(f.get("Load local video successfully"))}),s(p.$player,"drop",function(e){e.preventDefault(),y(e.dataTransfer.files[0])}),{name:"localPreview",attach:function(e){var t=n(e,'');r(e,"position","relative"),i(t,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),s(t,"change",function(){y(t.files[0])})}}}function sn(t){var e=t.layers,n=t.player,r=t.option.theme;return e.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"3px",background:r},mounted:function(e){t.on("controls:show",function(){e.style.display="none"}),t.on("controls:hide",function(){e.style.display="block"}),t.on("video:timeupdate",function(){e.style.width="".concat(100*n.played,"%")})}}),{name:"miniProgressBar"}}function un(t){s(this,un);var n=t.option,r=t.events.proxy,o=t.template.$video;Be.video.events.forEach(function(e){r(o,e,function(e){t.emit("video:".concat(e.type),e)})}),Object.keys(n.moreVideoAttr).forEach(function(e){o[e]=n.moreVideoAttr[e]}),n.muted&&(o.muted=n.muted),n.volume&&(o.volume=we(n.volume,0,1)),n.poster&&(o.poster=n.poster),n.autoplay&&(o.autoplay=n.autoplay),o.controls=!0;var e=n.type||Oe(n.url),i=n.customType[e];e&&i?(t.emit("beforeCustomType",e),i(o,n.url,t),t.emit("afterCustomType",e)):(t.emit("beforeAttachUrl",n.url),o.src=n.url,t.emit("afterAttachUrl",o.src))}var ln=function(){function n(e){var t=this;s(this,n),this.art=e,this.id=0,e.option.subtitle.url&&this.add(an),e.option.isLive||this.add(sn),this.add(cn),e.option.plugins.forEach(function(e){t.add(e)})}return u(n,[{key:"add",value:function(e){this.id+=1;var t=e.call(this,this.art),n="";return ge(!be(this,n=t&&t.name?t.name:e.name?e.name:"plugin".concat(this.id)),"Cannot add a plugin that already has the same name: ".concat(n)),Object.defineProperty(this,n,{value:t}),this.art.emit("plugin:add",e),this}}]),n}(),fn=0,pn=function(){function n(e){var t;return s(this,n),(t=f(this,p(n).call(this))).option=Se(n.option,e),ue(t.option,He),t.init(),console.log("%c ArtPlayer %c 3.1.13 %c https://github.com/zhw2590582/ArtPlayer","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),t}return t(n,le),u(n,[{key:"init",value:function(){this.isFocus=!1,this.isDestroy=!1,this.whitelist=new Ve(this),this.template=new Ue(this),this.events=new Ht(this),this.whitelist.state?(this.storage=new rn(this),this.icons=new Vt(this),this.i18n=new Ze(this),this.notice=new Xt(this),this.player=new Ke(this),this.layers=new Ut(this),this.controls=new xt(this),this.contextmenu=new Mt(this),this.subtitle=new Ft(this),this.info=new qt(this),this.loading=new Yt(this),this.hotkey=new Bt(this),this.mask=new Zt(this),this.setting=new nn(this),this.plugins=new ln(this)):this.mobile=new un(this),fn+=1,this.id=fn,n.instances.push(this)}},{key:"destroy",value:function(e){var t=0