Files
ArtPlayer/dist/artplayer.js
T
2019-05-13 06:07:33 +08:00

9 lines
94 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*!
* artplayer.js v3.1.8
* Github: https://github.com/zhw2590582/ArtPlayer#readme
* (c) 2017-2019 Harvey Zack
* Released under the MIT License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Artplayer=e()}(this,function(){"use strict";var a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var r=function(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t},o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function e(t,e){return t(e={exports:{}},e.exports),e.exports}var s=e(function(e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=i=function(t){return n(t)}:e.exports=i=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":n(t)},i(t)}e.exports=i});var c=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var l=function(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?c(t):e},u=e(function(e){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}e.exports=n}),d=e(function(n){function i(t,e){return n.exports=i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}n.exports=i});var f=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)};function n(){}n.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var i=this;function r(){i.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,r=n.length;i<r;i++)n[i].fn.apply(n[i].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),i=n[t],r=[];if(i&&e)for(var o=0,a=i.length;o<a;o++)i[o].fn!==e&&i[o].fn._!==e&&r.push(i[o]);return r.length?n[t]=r:delete n[t],this}};var p=n,h=n;p.TinyEmitter=h;var v=e(function(t){var e,n;e=window,n=function(){function m(t){var e=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(e)&&e}var n="undefined"==typeof console?function(){}:function(t){console.error(t)},g=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],b=g.length;function w(t){var e=getComputedStyle(t);return e||n("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}var x,k=!1;function E(t){if(function(){if(!k){k=!0;var t=document.createElement("div");t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style.boxSizing="border-box";var e=document.body||document.documentElement;e.appendChild(t);var n=w(t);x=200==Math.round(m(n.width)),E.isBoxSizeOuter=x,e.removeChild(t)}}(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var e=w(t);if("none"==e.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<b;e++)t[g[e]]=0;return t}();var n={};n.width=t.offsetWidth,n.height=t.offsetHeight;for(var i=n.isBorderBox="border-box"==e.boxSizing,r=0;r<b;r++){var o=g[r],a=e[o],s=parseFloat(a);n[o]=isNaN(s)?0:s}var c=n.paddingLeft+n.paddingRight,l=n.paddingTop+n.paddingBottom,u=n.marginLeft+n.marginRight,d=n.marginTop+n.marginBottom,f=n.borderLeftWidth+n.borderRightWidth,p=n.borderTopWidth+n.borderBottomWidth,h=i&&x,v=m(e.width);!1!==v&&(n.width=v+(h?0:c+f));var y=m(e.height);return!1!==y&&(n.height=y+(h?0:l+p)),n.innerWidth=n.width-(c+f),n.innerHeight=n.height-(l+p),n.outerWidth=n.width+u,n.outerHeight=n.height+d,n}}return E},t.exports?t.exports=n():e.getSize=n()}),y=e(function(t){var e,n;e="undefined"!=typeof window?window:o,n=function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var n=this._events=this._events||{},i=n[t]=n[t]||[];return-1==i.indexOf(e)&&i.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var n=this._onceEvents=this._onceEvents||{};return(n[t]=n[t]||{})[e]=!0,this}},e.off=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){var i=n.indexOf(e);return-1!=i&&n.splice(i,1),this}},e.emitEvent=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){n=n.slice(0),e=e||[];for(var i=this._onceEvents&&this._onceEvents[t],r=0;r<n.length;r++){var o=n[r];i&&i[o]&&(this.off(t,o),delete i[o]),o.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t},t.exports?t.exports=n():e.EvEmitter=n()}),m=e(function(t){var e,n;e=window,n=function(r,t){function e(){}var n=e.prototype=Object.create(t.prototype);n.bindStartEvent=function(t){this._bindStartEvent(t,!0)},n.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},n._bindStartEvent=function(t,e){var n=(e=void 0===e||e)?"addEventListener":"removeEventListener",i="mousedown";r.PointerEvent?i="pointerdown":"ontouchstart"in r&&(i="touchstart"),t[n](i,this)},n.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},n.getTouch=function(t){for(var e=0;e<t.length;e++){var n=t[e];if(n.identifier==this.pointerIdentifier)return n}},n.onmousedown=function(t){var e=t.button;e&&0!==e&&1!==e||this._pointerDown(t,t)},n.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},n.onpointerdown=function(t){this._pointerDown(t,t)},n._pointerDown=function(t,e){t.button||this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==e.pointerId?e.pointerId:e.identifier,this.pointerDown(t,e))},n.pointerDown=function(t,e){this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e])};var i={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]};return n._bindPostStartEvents=function(t){if(t){var e=i[t.type];e.forEach(function(t){r.addEventListener(t,this)},this),this._boundPointerEvents=e}},n._unbindPostStartEvents=function(){this._boundPointerEvents&&(this._boundPointerEvents.forEach(function(t){r.removeEventListener(t,this)},this),delete this._boundPointerEvents)},n.onmousemove=function(t){this._pointerMove(t,t)},n.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},n.ontouchmove=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerMove(t,e)},n._pointerMove=function(t,e){this.pointerMove(t,e)},n.pointerMove=function(t,e){this.emitEvent("pointerMove",[t,e])},n.onmouseup=function(t){this._pointerUp(t,t)},n.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},n.ontouchend=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerUp(t,e)},n._pointerUp=function(t,e){this._pointerDone(),this.pointerUp(t,e)},n.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e])},n._pointerDone=function(){this._pointerReset(),this._unbindPostStartEvents(),this.pointerDone()},n._pointerReset=function(){this.isPointerDown=!1,delete this.pointerIdentifier},n.pointerDone=function(){},n.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},n.ontouchcancel=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerCancel(t,e)},n._pointerCancel=function(t,e){this._pointerDone(),this.pointerCancel(t,e)},n.pointerCancel=function(t,e){this.emitEvent("pointerCancel",[t,e])},e.getPointerPoint=function(t){return{x:t.pageX,y:t.pageY}},e},t.exports?t.exports=n(e,y):e.Unipointer=n(e,e.EvEmitter)}),g=e(function(t){var e,n;e=window,n=function(o,t){function e(){}var n=e.prototype=Object.create(t.prototype);n.bindHandles=function(){this._bindHandles(!0)},n.unbindHandles=function(){this._bindHandles(!1)},n._bindHandles=function(t){for(var e=(t=void 0===t||t)?"addEventListener":"removeEventListener",n=t?this._touchActionValue:"",i=0;i<this.handles.length;i++){var r=this.handles[i];this._bindStartEvent(r,t),r[e]("click",this),o.PointerEvent&&(r.style.touchAction=n)}},n._touchActionValue="none",n.pointerDown=function(t,e){this.okayPointerDown(t)&&(this.pointerDownPointer=e,t.preventDefault(),this.pointerDownBlur(),this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e]))};var r={TEXTAREA:!0,INPUT:!0,SELECT:!0,OPTION:!0},a={radio:!0,checkbox:!0,button:!0,submit:!0,image:!0,file:!0};return n.okayPointerDown=function(t){var e=r[t.target.nodeName],n=a[t.target.type],i=!e||n;return i||this._pointerReset(),i},n.pointerDownBlur=function(){var t=document.activeElement;t&&t.blur&&t!=document.body&&t.blur()},n.pointerMove=function(t,e){var n=this._dragPointerMove(t,e);this.emitEvent("pointerMove",[t,e,n]),this._dragMove(t,e,n)},n._dragPointerMove=function(t,e){var n={x:e.pageX-this.pointerDownPointer.pageX,y:e.pageY-this.pointerDownPointer.pageY};return!this.isDragging&&this.hasDragStarted(n)&&this._dragStart(t,e),n},n.hasDragStarted=function(t){return 3<Math.abs(t.x)||3<Math.abs(t.y)},n.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e]),this._dragPointerUp(t,e)},n._dragPointerUp=function(t,e){this.isDragging?this._dragEnd(t,e):this._staticClick(t,e)},n._dragStart=function(t,e){this.isDragging=!0,this.isPreventingClicks=!0,this.dragStart(t,e)},n.dragStart=function(t,e){this.emitEvent("dragStart",[t,e])},n._dragMove=function(t,e,n){this.isDragging&&this.dragMove(t,e,n)},n.dragMove=function(t,e,n){t.preventDefault(),this.emitEvent("dragMove",[t,e,n])},n._dragEnd=function(t,e){this.isDragging=!1,setTimeout(function(){delete this.isPreventingClicks}.bind(this)),this.dragEnd(t,e)},n.dragEnd=function(t,e){this.emitEvent("dragEnd",[t,e])},n.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},n._staticClick=function(t,e){this.isIgnoringMouseUp&&"mouseup"==t.type||(this.staticClick(t,e),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400)))},n.staticClick=function(t,e){this.emitEvent("staticClick",[t,e])},e.getPointerPoint=t.getPointerPoint,e},t.exports?t.exports=n(e,m):e.Unidragger=n(e,e.Unipointer)}),b=e(function(t){var e,n;e=window,n=function(o,c,t){function n(t,e){for(var n in e)t[n]=e[n];return t}var i=o.jQuery;function e(t,e){this.element="string"==typeof t?document.querySelector(t):t,i&&(this.$element=i(this.element)),this.options=n({},this.constructor.defaults),this.option(e),this._create()}var r=e.prototype=Object.create(t.prototype);e.defaults={},r.option=function(t){n(this.options,t)};var a={relative:!0,absolute:!0,fixed:!0};function l(t,e,n){return n=n||"round",e?Math[n](t/e)*e:t}return r._create=function(){this.position={},this._getPosition(),this.startPoint={x:0,y:0},this.dragPoint={x:0,y:0},this.startPosition=n({},this.position);var t=getComputedStyle(this.element);a[t.position]||(this.element.style.position="relative"),this.on("pointerDown",this.onPointerDown),this.on("pointerMove",this.onPointerMove),this.on("pointerUp",this.onPointerUp),this.enable(),this.setHandles()},r.setHandles=function(){this.handles=this.options.handle?this.element.querySelectorAll(this.options.handle):[this.element],this.bindHandles()},r.dispatchEvent=function(t,e,n){var i=[e].concat(n);this.emitEvent(t,i),this.dispatchJQueryEvent(t,e,n)},r.dispatchJQueryEvent=function(t,e,n){var i=o.jQuery;if(i&&this.$element){var r=i.Event(e);r.type=t,this.$element.trigger(r,n)}},r._getPosition=function(){var t=getComputedStyle(this.element),e=this._getPositionCoord(t.left,"width"),n=this._getPositionCoord(t.top,"height");this.position.x=isNaN(e)?0:e,this.position.y=isNaN(n)?0:n,this._addTransformPosition(t)},r._getPositionCoord=function(t,e){if(-1==t.indexOf("%"))return parseInt(t,10);var n=c(this.element.parentNode);return n?parseFloat(t)/100*n[e]:0},r._addTransformPosition=function(t){var e=t.transform;if(0===e.indexOf("matrix")){var n=e.split(","),i=0===e.indexOf("matrix3d")?12:4,r=parseInt(n[i],10),o=parseInt(n[1+i],10);this.position.x+=r,this.position.y+=o}},r.onPointerDown=function(t,e){this.element.classList.add("is-pointer-down"),this.dispatchJQueryEvent("pointerDown",t,[e])},r.dragStart=function(t,e){this.isEnabled&&(this._getPosition(),this.measureContainment(),this.startPosition.x=this.position.x,this.startPosition.y=this.position.y,this.setLeftTop(),this.dragPoint.x=0,this.dragPoint.y=0,this.element.classList.add("is-dragging"),this.dispatchEvent("dragStart",t,[e]),this.animate())},r.measureContainment=function(){var t=this.getContainer();if(t){var e=c(this.element),n=c(t),i=this.element.getBoundingClientRect(),r=t.getBoundingClientRect(),o=n.borderLeftWidth+n.borderRightWidth,a=n.borderTopWidth+n.borderBottomWidth,s=this.relativeStartPosition={x:i.left-(r.left+n.borderLeftWidth),y:i.top-(r.top+n.borderTopWidth)};this.containSize={width:n.width-o-s.x-e.width,height:n.height-a-s.y-e.height}}},r.getContainer=function(){var t=this.options.containment;if(t)return t instanceof HTMLElement?t:"string"==typeof t?document.querySelector(t):this.element.parentNode},r.onPointerMove=function(t,e,n){this.dispatchJQueryEvent("pointerMove",t,[e,n])},r.dragMove=function(t,e,n){if(this.isEnabled){var i=n.x,r=n.y,o=this.options.grid,a=o&&o[0],s=o&&o[1];i=l(i,a),r=l(r,s),i=this.containDrag("x",i,a),r=this.containDrag("y",r,s),i="y"==this.options.axis?0:i,r="x"==this.options.axis?0:r,this.position.x=this.startPosition.x+i,this.position.y=this.startPosition.y+r,this.dragPoint.x=i,this.dragPoint.y=r,this.dispatchEvent("dragMove",t,[e,n])}},r.containDrag=function(t,e,n){if(!this.options.containment)return e;var i="x"==t?"width":"height",r=l(-this.relativeStartPosition[t],n,"ceil"),o=this.containSize[i];return o=l(o,n,"floor"),Math.max(r,Math.min(o,e))},r.onPointerUp=function(t,e){this.element.classList.remove("is-pointer-down"),this.dispatchJQueryEvent("pointerUp",t,[e])},r.dragEnd=function(t,e){this.isEnabled&&(this.element.style.transform="",this.setLeftTop(),this.element.classList.remove("is-dragging"),this.dispatchEvent("dragEnd",t,[e]))},r.animate=function(){if(this.isDragging){this.positionDrag();var t=this;requestAnimationFrame(function(){t.animate()})}},r.setLeftTop=function(){this.element.style.left=this.position.x+"px",this.element.style.top=this.position.y+"px"},r.positionDrag=function(){this.element.style.transform="translate3d( "+this.dragPoint.x+"px, "+this.dragPoint.y+"px, 0)"},r.staticClick=function(t,e){this.dispatchEvent("staticClick",t,[e])},r.setPosition=function(t,e){this.position.x=t,this.position.y=e,this.setLeftTop()},r.enable=function(){this.isEnabled=!0},r.disable=function(){this.isEnabled=!1,this.isDragging&&this.dragEnd()},r.destroy=function(){this.disable(),this.element.style.transform="",this.element.style.left="",this.element.style.top="",this.element.style.position="",this.unbindHandles(),this.$element&&this.$element.removeData("draggabilly")},r._init=function(){},i&&i.bridget&&i.bridget("draggabilly",e),e},t.exports?t.exports=n(e,v,g):e.Draggabilly=n(e,e.getSize,e.Unidragger)}),w=e(function(t,e){t.exports=function(){function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var c=Object.prototype.toString,a=function(t){if(void 0===t)return"undefined";if(null===t)return"null";var e,n,i,r,o,a=s(t);if("boolean"===a)return"boolean";if("string"===a)return"string";if("number"===a)return"number";if("symbol"===a)return"symbol";if("function"===a)return"GeneratorFunction"===l(t)?"generatorfunction":"function";if(e=t,Array.isArray?Array.isArray(e):e instanceof Array)return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(t))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(t))return"arguments";if((n=t)instanceof Date||"function"==typeof n.toDateString&&"function"==typeof n.getDate&&"function"==typeof n.setDate)return"date";if((i=t)instanceof Error||"string"==typeof i.message&&i.constructor&&"number"==typeof i.constructor.stackTraceLimit)return"error";if((r=t)instanceof RegExp||"string"==typeof r.flags&&"boolean"==typeof r.ignoreCase&&"boolean"==typeof r.multiline&&"boolean"==typeof r.global)return"regexp";switch(l(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if("function"==typeof(o=t).throw&&"function"==typeof o.return&&"function"==typeof o.next)return"generator";switch(a=c.call(t)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return a.slice(8,-1).toLowerCase().replace(/\s/g,"")};function l(t){return t.constructor?t.constructor.name:null}function o(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:["option"];for(var i in d(t,e,n),f(t,e,n),p(t,e,n),e)if(e.hasOwnProperty(i)){var r=t[i],o=e[i],a=n.concat(i);if(u(t,i,o,a))continue;d(r,o,a),f(r,o,a),p(r,o,a)}}function u(t,e,n,i){if(!Object.prototype.hasOwnProperty.call(t,e)){if(!0===n.__required__||!0===n.required)throw new TypeError("'".concat(i.join("."),"' is required"));return!0}}function d(t,e,n){var i;if("string"===a(e)?i=e:"function"===a(e)?e.___validator__=e:e.__type__?i=e.__type__:e.type&&(i=e.type),i&&"string"===a(i)){i=i.trim().toLowerCase();var r=a(t),o=r===i;if(-1<i.indexOf("|")&&(o=i.split("|").filter(Boolean).some(function(t){return r===t.trim()})),!o)throw new TypeError("'".concat(n.join("."),"' require '").concat(i,"' type, but got '").concat(r,"'"))}}function f(t,e,n){var i;if(e.___validator__?i=e.___validator__:e.validator&&(i=e.validator),"function"===a(i)){var r=i(n,t,a(t));if(!0!==r)throw new TypeError("The scheme for '".concat(n.join("."),"' validator function require return true, but got '").concat(r,"'"))}}function p(t,e,n){var i;if(e.___child__?i=e.___child__:e.child&&(i=e.child),"object"===a(i)){var r=a(t);"object"===r?o(t,i,n):"array"===r&&t.forEach(function(t,e){o(t,i,n.concat(e))})}}return o.kindOf=a,window.optionValidator=o}()});var x=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var k=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var E=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var S=function(t){return x(t)||k(t)||E()};var $=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},P=e(function(i){function r(t,e,n){return!function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?i.exports=r=function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&d(r,n.prototype),r}:i.exports=r=Reflect.construct,r.apply(null,arguments)}i.exports=r}),R=function(t){function i(t,e){var n;return a(this,i),n=l(this,u(i).call(this,t)),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(c(n),e||n.constructor),n.name="ArtPlayerError",n}return f(i,t),i}(e(function(e){function i(t){var n="function"==typeof Map?new Map:void 0;return e.exports=i=function(t){if(null===t||!$(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return P(t,arguments,u(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),d(e,t)},i(t)}e.exports=i})(Error));function T(t,e){if(!t)throw new R(e);return t}function L(t,e,n){return Math.max(Math.min(t,Math.max(e,n)),Math.min(e,n))}function O(t){return t.includes("?")?O(t.split("?")[0]):t.includes("#")?O(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function _(t){var e=Math.floor(t/3600),n=Math.floor((t-3600*e)/60),i=Math.floor(t-3600*e-60*n);return(0<e?[e,n,i]:[n,i]).map(function(t){return t<10?"0".concat(t):String(t)}).join(":")}function C(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return new Promise(function(t){return setTimeout(t,e)})}function j(i,r,o){var a;function t(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];clearTimeout(a),a=setTimeout(function(){a=null,i.apply(o,e)},r)}return t.clearTimeout=function(){clearTimeout(a)},t}function M(){for(var o=function(t){return t&&"object"===s(t)&&!Array.isArray(t)},t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.reduce(function(i,r){return Object.keys(r).forEach(function(t){var e=i[t],n=r[t];Array.isArray(e)&&Array.isArray(n)?i[t]=e.concat.apply(e,S(n)):!o(e)||!o(n)||n instanceof Element?i[t]=n:i[t]=M(e,n)}),i},{})}function A(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function z(t){return t.parentNode.removeChild(t)}function W(t,e,n){return t.style[e]=n,t}function q(e,n){return Object.keys(n).forEach(function(t){W(e,t,n[t])}),e}function D(t,e){var n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],i=window.getComputedStyle(t,null).getPropertyValue(e);return n?parseFloat(i):i}function H(e){return Array.from(e.parentElement.children).filter(function(t){return t!==e})}function B(t,e){H(t).forEach(function(t){return t.classList.remove(e)}),t.classList.add(e)}function F(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"up";t.setAttribute("data-balloon",e),t.setAttribute("data-balloon-pos",n)}function I(t){return"WEBVTT \r\n\r\n".concat(t.replace(/\{\\([ibu])\}/g,"</$1>").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"</$1>").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").concat("\r\n\r\n"))}function U(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function N(t,e){var n=document.createElement("a");W(n,"display","none"),n.href=t,n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n)}var V=Object.freeze({errorHandle:T,clamp:L,getExt:O,secondToTime:_,sleep:C,debounce:j,mergeDeep:M,append:A,remove:z,setStyle:W,setStyles:q,getStyle:D,sublings:H,inverseClass:B,tooltip:F,srtToVtt:I,vttToBlob:U,downloadFile:N});function Q(t,e,n){return T("string"===n||e instanceof Element,"".concat(t.join(".")," require 'string' or 'Element' type"))}var J={container:{validator:Q,required:!0},url:{type:"string|function",required:!0},poster:"string",title:"string",theme:"string",lang:"string",volume:"number",isLive:"boolean",muted:"boolean",autoplay:"boolean",autoSize:"boolean",loop:"boolean",flip:"boolean",playbackRate:"boolean",aspectRatio:"boolean",screenshot:"boolean",setting:"boolean",hotkey:"boolean",pip:"boolean",mutex:"boolean",fullscreen:"boolean",fullscreenWeb:"boolean",plugins:{type:"array",child:{type:"function"}},whitelist:{type:"array",child:{type:"string|function|regexp"}},layers:{type:"array",child:{type:"object|function",disable:"boolean",name:"string",index:"number",html:Q,style:"object",click:"function",mounted:"function"}},contextmenu:{type:"array",child:{type:"object|function",disable:"boolean",name:"string",index:"number",html:Q,style:"object",click:"function",mounted:"function"}},quality:{type:"array",child:{default:"boolean",name:"string",url:"string"}},controls:{type:"array",child:{type:"object|function",disable:"boolean",name:"string",index:"number",html:Q,style:"object",click:"function",mounted:"function",position:function(t,e){var n=["top","left","right"];return T(n.includes(e),"".concat(t.join(".")," only accept ").concat(n.toString()," as parameters"))}}},highlight:{type:"array",child:{type:"object",time:"number",text:"string"}},thumbnails:{type:"object",child:{url:"string",number:"number",width:"number",height:"number",column:"number"}},subtitle:{type:"object",child:{url:"string",style:"object"}},moreVideoAttr:"object",icons:"object",customType:"object"},Y={mimeCodec:{mp4:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',webm:'video/webm; codecs="vorbis, vp8"',ts:'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"'},mse:{mediaSource:{propertys:["activeSourceBuffers","duration","readyState","sourceBuffers"],methods:["addSourceBuffer","endOfStream","removeSourceBuffer","clearLiveSeekableRange","setLiveSeekableRange"],events:["sourceclose","sourceended","sourceopen"]},sourceBuffer:{propertys:["mode","updating","buffered","timestampOffset","audioTracks","videoTracks","textTracks","appendWindowStart","appendWindowEnd","trackDefaults"],methods:["appendBuffer","appendStream","abort","remove"],events:["abort","error","update","updateend","updatestart"]},sourceBufferList:{propertys:["length"],events:["addsourcebuffer","removesourcebuffer"]}},video:{propertys:["audioTracks","autoplay","buffered","controller","controls","crossOrigin","currentSrc","currentTime","defaultMuted","defaultPlaybackRate","duration","ended","error","loop","mediaGroup","muted","networkState","paused","playbackRate","played","preload","readyState","seekable","seeking","src","startDate","textTracks","videoTracks","volume"],methods:["addTextTrack","canPlayType","load","play","pause"],events:["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"]}},X=function t(e){var n=this;a(this,t);var i=e.constructor.kindOf,r=e.option.whitelist;this.userAgent=window.navigator.userAgent,this.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent),this.state=!this.isMobile||r.some(function(t){var e=!1;switch(i(t)){case"string":e=-1<n.userAgent.indexOf(t);break;case"function":e=t(n.userAgent);break;case"regexp":e=t.test(n.userAgent)}return e})},Z=function(){function n(t){var e=this;a(this,n),(this.art=t).option.container instanceof Element?this.$container=t.option.container:(this.$container=document.querySelector(t.option.container),T(this.$container,"No container element found by ".concat(t.option.container))),t.constructor.instances.some(function(t){return t.template.$container===e.$container})&&T(!1,"Cannot mount multiple instances on the same dom element"),t.whitelist.state?this.initDesktop():this.initMobile()}return r(n,[{key:"initDesktop",value:function(){this.$container.innerHTML='\n <div class="artplayer-video-player" style="--theme: '.concat(this.art.option.theme,'">\n <video class="artplayer-video"></video>\n <div class="artplayer-subtitle"></div>\n <div class="artplayer-danmuku"></div>\n <div class="artplayer-layers"></div>\n <div class="artplayer-mask"></div>\n <div class="artplayer-bottom">\n <div class="artplayer-progress"></div>\n <div class="artplayer-controls">\n <div class="artplayer-controls-left"></div>\n <div class="artplayer-controls-right"></div>\n </div>\n </div>\n <div class="artplayer-loading"></div>\n <div class="artplayer-notice">\n <div class="artplayer-notice-inner"></div>\n </div>\n <div class="artplayer-setting">\n <div class="artplayer-setting-inner">\n <div class="artplayer-setting-body"></div>\n </div>\n </div>\n <div class="artplayer-info">\n <div class="artplayer-info-panel"></div>\n <div class="artplayer-info-close">[x]</div>\n </div>\n <div class="artplayer-pip-header">\n <div class="artplayer-pip-title"></div>\n <div class="artplayer-pip-close">×</div>\n </div>\n <div class="artplayer-contextmenu"></div>\n </div>\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 <div class="artplayer-video-player">\n <video class="artplayer-video"></video>\n </div>\n ',this.$player=this.$container.querySelector(".artplayer-video-player"),this.$video=this.$container.querySelector(".artplayer-video")}},{key:"destroy",value:function(t){t?this.$container.innerHTML="":this.$player.classList.add("artplayer-destroy")}}]),n}(),G={"About author":"关于作者","Video info":"视频统计信息",Close:"关闭","Video load failed":"视频加载失败",Volume:"音量",Play:"播放",Pause:"暂停",Rate:"速度",Mute:"静音",Flip:"视频翻转",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新连接","Hide subtitle":"隐藏字幕","Show subtitle":"显示字幕","Hide danmu":"隐藏弹幕","Show danmu":"显示弹幕","Show setting":"显示设置","Hide setting":"隐藏设置",Screenshot:"截图","Play speed":"播放速度","Aspect ratio":"画面比例",Default:"默认",Normal:"正常","Switch video":"切换","Switch subtitle":"切换字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"网页全屏","Exit web fullscreen":"退出网页全屏","Mini player":"迷你播放器","This does not seem to support full screen functionality":"似乎不支持全屏功能"},K={"About author":"關於作者","Video info":"影片統計訊息",Close:"關閉","Video load failed":"影片載入失敗",Volume:"音量",Play:"播放",Pause:"暫停",Rate:"速度",Mute:"靜音",Flip:"影片翻轉",Horizontal:"水平",Vertical:"垂直",Reconnect:"重新連接","Hide subtitle":"隱藏字幕","Show subtitle":"顯示字幕","Show setting":"顯示设置","Hide setting":"隱藏设置","Hide danmu":"隱藏彈幕","Show danmu":"顯示彈幕",Screenshot:"截圖","Play speed":"播放速度","Aspect ratio":"畫面比例",Default:"默認",Normal:"正常","Switch video":"切換","Switch subtitle":"切換字幕",Fullscreen:"全屏","Exit fullscreen":"退出全屏","Web fullscreen":"網頁全屏","Exit web fullscreen":"退出網頁全屏","Mini player":"迷你播放器","This does not seem to support full screen functionality":"似乎不支持全屏功能"},tt=function(){function e(t){a(this,e),this.art=t,this.languages={"zh-cn":G,"zh-tw":K},this.init()}return r(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=M(this.languages,t),this.init()}}]),e}();var et=e(function(t){var o,e,r,a,i,n;o="undefined"!=typeof window&&void 0!==window.document?window.document:{},e=t.exports,r="undefined"!=typeof Element&&"ALLOW_KEYBOARD_INPUT"in Element,a=function(){for(var t,e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,i=e.length,r={};n<i;n++)if((t=e[n])&&t[1]in o){for(n=0;n<t.length;n++)r[e[0][n]]=t[n];return r}return!1}(),i={change:a.fullscreenchange,error:a.fullscreenerror},n={request:function(i){return new Promise(function(t){var e=a.requestFullscreen,n=function(){this.off("change",n),t()}.bind(this);i=i||o.documentElement,/ Version\/5\.1(?:\.\d+)? Safari\//.test(navigator.userAgent)?i[e]():i[e](r?Element.ALLOW_KEYBOARD_INPUT:{}),this.on("change",n)}.bind(this))},exit:function(){return new Promise(function(t){if(this.isFullscreen){var e=function(){this.off("change",e),t()}.bind(this);o[a.exitFullscreen](),this.on("change",e)}else t()}.bind(this))},toggle:function(t){return this.isFullscreen?this.exit():this.request(t)},onchange:function(t){this.on("change",t)},onerror:function(t){this.on("error",t)},on:function(t,e){var n=i[t];n&&o.addEventListener(n,e,!1)},off:function(t,e){var n=i[t];n&&o.removeEventListener(n,e,!1)},raw:a},a?(Object.defineProperties(n,{isFullscreen:{get:function(){return Boolean(o[a.fullscreenElement])}},element:{enumerable:!0,get:function(){return o[a.fullscreenElement]}},enabled:{enumerable:!0,get:function(){return Boolean(o[a.fullscreenEnabled])}}}),e?(t.exports=n,t.exports.default=n):window.screenfull=n):e?t.exports=!1:window.screenfull=!1});function nt(t,e){var n=t.template.$video;document.pictureInPictureEnabled?function(t,e){var n=t.notice,i=t.template.$video,r=t.events.proxy;i.disablePictureInPicture=!1,Object.defineProperty(e,"pipState",{get:function(){return document.pictureInPictureElement}}),Object.defineProperty(e,"pipEnabled",{value:function(){i.requestPictureInPicture().catch(function(t){n.show(t,!0,3e3),console.warn(t)})}}),Object.defineProperty(e,"pipExit",{value:function(){document.exitPictureInPicture().catch(function(t){n.show(t,!0,3e3),console.warn(t)})}}),r(i,"enterpictureinpicture",function(){t.emit("pipEnabled")}),r(i,"leavepictureinpicture",function(){t.emit("pipExit")}),t.on("destroy",function(){e.pipState&&e.pipExit()})}(t,e):n.webkitSupportsPresentationMode&&"function"==typeof n.webkitSetPresentationMode?function(t,e){var n=t.template.$video;n.webkitSetPresentationMode("inline"),Object.defineProperty(e,"pipState",{get:function(){return"picture-in-picture"===n.webkitPresentationMode}}),Object.defineProperty(e,"pipEnabled",{value:function(){n.webkitSetPresentationMode("picture-in-picture"),t.emit("pipEnabled")}}),Object.defineProperty(e,"pipExit",{value:function(){n.webkitSetPresentationMode("inline"),t.emit("pipExit")}})}(t,e):function(t,e){var n=t.option,i=t.i18n,r=t.template,o=r.$player,a=r.$pipClose,s=r.$pipTitle,c=t.events,l=c.destroyEvents,u=c.proxy,d=null,f=null;Object.defineProperty(e,"pipState",{get:function(){return o.classList.contains("artplayer-pip")}}),Object.defineProperty(e,"pipEnabled",{value:function(){e.autoSizeState&&e.autoSizeRemove(),f?d&&0!==d.x&&0!==d.y&&(W(o,"left","".concat(d.x,"px")),W(o,"top","".concat(d.y,"px"))):(f=new b(o,{handle:".artplayer-pip-header"}),A(s,n.title||i.get("Mini player")),u(a,"click",function(){e.pipExit()}),l.push(function(){f.destroy()})),o.classList.add("artplayer-pip"),e.fullscreenExit(),e.fullscreenWebExit(),e.aspectRatioRemove(),e.playbackRateRemove(),t.emit("pipEnabled")}}),Object.defineProperty(e,"pipExit",{value:function(){e.pipState&&(o.classList.remove("artplayer-pip"),d=f.position,W(o,"left",null),W(o,"top",null),e.fullscreenExit(),e.fullscreenWebExit(),e.aspectRatioRemove(),e.playbackRateRemove(),t.emit("pipExit"))}})}(t,e),Object.defineProperty(e,"pipToggle",{value:function(){e.pipState?e.pipExit():e.pipEnabled()}})}var it=function t(e){a(this,t),function(i,t){var e=i.option,r=e.type,o=e.customType,a=i.template.$video;Object.defineProperty(t,"attachUrl",{value:function(n){return C().then(function(){function e(t){var e=r||O(t),n=o[e];return e&&n?(i.loading.show(),i.emit("beforeCustomType",e),n.call(i,a,t,i),i.emit("afterCustomType",e)):(i.emit("beforeAttachUrl",t),a.src=t,i.emit("afterAttachUrl",t)),Promise.resolve(t)}if("function"!=typeof n)return e(n);var t=n.call(i);return T("function"==typeof t.then,"If url is a function, it needs to return a promise."),t.then(function(t){return i.loading.show(),e(t)})})}})}(e,this),function(e,t){var n=e.option,i=e.events.proxy,r=e.template,o=r.$player,a=r.$video,s=e.i18n,c=e.notice,l=0;i(a,"click",function(){t.toggle()}),Y.video.events.forEach(function(t){i(a,t,function(t){e.emit("video:".concat(t.type),t)})}),e.on("video:canplay",function(){l=0,e.controls.show(),e.mask.show(),e.loading.hide()}),e.on("video:ended",function(){e.controls.show(),e.mask.show(),n.loop&&(t.seek(0),t.play())}),e.on("video:error",function(){l<5?C(1e3).then(function(){l+=1,t.attachUrl(n.url),c.show("".concat(s.get("Reconnect"),": ").concat(l))}):(e.loading.hide(),e.controls.hide(),o.classList.add("artplayer-error"),C(1e3).then(function(){c.show(s.get("Video load failed"),!1),e.destroy()}))}),e.on("video:loadedmetadata",function(){n.autoSize&&t.autoSize()}),e.on("video:loadstart",function(){e.loading.show()}),e.on("video:pause",function(){e.controls.show(),e.mask.show()}),e.on("video:play",function(){e.mask.hide()}),e.on("video:playing",function(){e.mask.hide()}),e.on("video:seeked",function(){e.loading.hide()}),e.on("video:seeking",function(){e.loading.show()}),e.on("video:timeupdate",function(){e.mask.hide()}),e.on("video:waiting",function(){e.loading.show()})}(e,this),function(t,e){var n=t.option,i=t.template.$video;Object.keys(n.moreVideoAttr).forEach(function(t){i[t]=n.moreVideoAttr[t]}),n.muted&&(i.muted=n.muted),n.volume&&(i.volume=L(n.volume,0,1)),n.poster&&(i.poster=n.poster),n.autoplay&&(i.autoplay=n.autoplay),e.attachUrl(n.url)}(e,this),function(e,t){var n=e.template.$video,i=e.i18n,r=e.notice,o=e.option.mutex;Object.defineProperty(t,"play",{value:function(){var t=n.play();void 0!==t&&t.then().catch(function(t){r.show(t,!0,3e3),console.warn(t)}),o&&e.constructor.instances.filter(function(t){return t!==e}).forEach(function(t){return t.player.pause()}),r.show(i.get("Play")),e.emit("play")}})}(e,this),function(t,e){var n=t.template.$video,i=t.i18n,r=t.notice;Object.defineProperty(e,"pause",{value:function(){n.pause(),r.show(i.get("Pause")),t.emit("pause")}})}(e,this),function(t,e){Object.defineProperty(e,"toggle",{value:function(){e.playing?e.pause():e.play()}})}(0,this),function(e,n){var i=e.notice;Object.defineProperty(n,"seek",{value:function(t){n.currentTime=t,i.show("".concat(_(t)," / ").concat(_(n.duration))),e.emit("seek",t)}})}(e,this),function(e,t){var n=e.template.$video,i=e.i18n,r=e.notice,o=e.storage;Object.defineProperty(t,"volume",{get:function(){return n.volume||0},set:function(t){n.volume=L(t,0,1),r.show("".concat(i.get("Volume"),": ").concat(parseInt(100*n.volume,10))),0!==n.volume&&o.set("volume",n.volume),e.emit("volumeChange",n.volume)}}),Object.defineProperty(t,"muted",{get:function(){return n.muted},set:function(t){n.muted=t,e.emit("volumeChange",n.volume)}})}(e,this),function(e,n){Object.defineProperty(n,"currentTime",{get:function(){return e.template.$video.currentTime||0},set:function(t){e.template.$video.currentTime=L(t,0,n.duration)}})}(e,this),function(t,e){Object.defineProperty(e,"duration",{get:function(){return t.template.$video.duration||0}})}(e,this),function(r,o){var a=r.i18n,s=r.notice,c=r.option;Object.defineProperty(o,"switchQuality",{value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"unknown";if(t===c.url)return null;var n=o.currentTime,i=o.playing;return o.attachUrl(t).then(function(){c.url=t,o.playbackRateRemove(),o.aspectRatioRemove(),r.once("video:canplay",function(){o.currentTime=n}),i&&o.play(),s.show("".concat(a.get("Switch video"),": ").concat(e)),r.emit("switch",t)})}}),Object.defineProperty(o,"switchUrl",{value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"unknown";if(t===c.url)return null;var n=o.playing;return o.attachUrl(t).then(function(){c.url=t,o.playbackRateRemove(),o.aspectRatioRemove(),o.currentTime=0,n&&o.play(),s.show("".concat(a.get("Switch video"),": ").concat(e)),r.emit("switch",t)})}})}(e,this),function(n,e){var t=n.template,i=t.$video,r=t.$player,o=n.i18n,a=n.notice;Object.defineProperty(e,"playbackRateState",{get:function(){return r.dataset.playbackRate}}),Object.defineProperty(e,"playbackRate",{value:function(t){var e=[.5,.75,1,1.25,1.5,1.75,2];T(e.includes(t),"'playbackRate' only accept ".concat(e.toString()," as parameters")),t!==r.dataset.playbackRate&&(i.playbackRate=t,r.dataset.playbackRate=t,a.show("".concat(o.get("Rate"),": ").concat(1===t?o.get("Normal"):"".concat(t,"x"))),n.emit("playbackRateChange",t))}}),Object.defineProperty(e,"playbackRateRemove",{value:function(){e.playbackRateState&&(e.playbackRate(1),delete r.dataset.playbackRate,n.emit("playbackRateRemove"))}}),Object.defineProperty(e,"playbackRateReset",{value:function(){var t=r.dataset.playbackRate;t&&(e.playbackRate(Number(t)),n.emit("playbackRateReset"))}})}(e,this),function(d,f){var t=d.template,p=t.$video,h=t.$player,v=d.i18n,y=d.notice;Object.defineProperty(f,"aspectRatioState",{get:function(){return h.dataset.aspectRatio||""}}),Object.defineProperty(f,"aspectRatio",{value:function(t){var e=["default","4:3","16:9"];if(T(e.includes(t),"'aspectRatio' only accept ".concat(e.toString()," as parameters")),"default"===t)f.aspectRatioRemove();else{var n=t.split(":"),i=p.videoWidth,r=p.videoHeight,o=h.clientWidth,a=h.clientHeight,s=i/r,c=n[0]/n[1];if(c<s){var l=c*r/i;W(p,"width","".concat(100*l,"%")),W(p,"height","100%"),W(p,"padding","0 ".concat((o-o*l)/2,"px"))}else{var u=i/c/r;W(p,"width","100%"),W(p,"height","".concat(100*u,"%")),W(p,"padding","".concat((a-a*u)/2,"px 0"))}}h.dataset.aspectRatio=t,y.show("".concat(v.get("Aspect ratio"),": ").concat("default"===t?v.get("Default"):t)),d.emit("aspectRatioChange",t)}}),Object.defineProperty(f,"aspectRatioRemove",{value:function(){f.aspectRatioState&&(W(p,"width",null),W(p,"height",null),W(p,"padding",null),delete h.dataset.aspectRatio,d.emit("aspectRatioRemove"))}}),Object.defineProperty(f,"aspectRatioReset",{value:function(){var t=h.dataset.aspectRatio;t&&(f.aspectRatio(t),d.emit("aspectRatioReset"))}})}(e,this),function(e,n){var i=e.option,r=e.notice,o=e.template.$video;Object.defineProperty(n,"getScreenshotDataURL",{value:function(){try{var t=document.createElement("canvas");return t.width=o.videoWidth,t.height=o.videoHeight,t.getContext("2d").drawImage(o,0,0),t.toDataURL("image/png")}catch(t){return r.show(t),console.warn(t),null}}}),Object.defineProperty(n,"getScreenshotBlobUrl",{value:function(){return new Promise(function(e,n){try{var t=document.createElement("canvas");t.width=o.videoWidth,t.height=o.videoHeight,t.getContext("2d").drawImage(o,0,0),t.toBlob(function(t){e(URL.createObjectURL(t))})}catch(t){r.show(t),n(t)}})}}),Object.defineProperty(n,"screenshot",{value:function(){var t=n.getScreenshotDataURL();t&&(N(t,"".concat(i.title||"artplayer","_").concat(_(o.currentTime),".png")),e.emit("screenshot",t))}})}(e,this),function(t,e){var n=t.i18n,i=t.notice,r=t.events.destroyEvents,o=t.template.$player,a=function(){t.emit("fullscreen:change",et.isFullscreen)},s=function(){i.show(n.get("This does not seem to support full screen functionality"))};try{et.on("change",a),et.on("error",s),r.push(function(){et.off("change",a),et.off("error",s)})}catch(t){s()}Object.defineProperty(e,"fullscreenState",{get:function(){return et.isFullscreen}}),Object.defineProperty(e,"fullscreenEnabled",{value:function(){et.enabled?e.fullscreenState||(e.fullscreenWebExit(),et.request(o).then(function(){o.classList.add("artplayer-fullscreen"),e.aspectRatioReset(),t.emit("fullscreen:enabled")})):s()}}),Object.defineProperty(e,"fullscreenExit",{value:function(){et.enabled?e.fullscreenState&&(e.fullscreenWebExit(),et.exit().then(function(){o.classList.remove("artplayer-fullscreen"),e.aspectRatioReset(),t.emit("fullscreen:exit")})):s()}}),Object.defineProperty(e,"fullscreenToggle",{value:function(){e.fullscreenState?e.fullscreenExit():e.fullscreenEnabled()}})}(e,this),function(t,e){var n=t.template.$player;Object.defineProperty(e,"fullscreenWebState",{get:function(){return n.classList.contains("artplayer-web-fullscreen")}}),Object.defineProperty(e,"fullscreenWebEnabled",{value:function(){e.fullscreenState&&e.fullscreenExit(),n.classList.add("artplayer-web-fullscreen"),e.aspectRatioReset(),t.emit("fullscreenWeb:enabled")}}),Object.defineProperty(e,"fullscreenWebExit",{value:function(){e.fullscreenWebState&&(e.fullscreenExit(),n.classList.remove("artplayer-web-fullscreen"),e.aspectRatioReset(),t.emit("fullscreenWeb:exit"))}}),Object.defineProperty(e,"fullscreenWebToggle",{value:function(){e.fullscreenWebState?e.fullscreenWebExit():e.fullscreenWebEnabled()}})}(e,this),nt(e,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"loaded",{get:function(){return n.buffered.length?n.buffered.end(n.buffered.length-1)/n.duration:0}})}(e,this),function(t,e){Object.defineProperty(e,"played",{get:function(){return t.template.$video.currentTime/t.template.$video.duration}})}(e,this),function(t,e){var n=t.template.$video;Object.defineProperty(e,"playing",{get:function(){return!!(0<n.currentTime&&!n.paused&&!n.ended&&2<n.readyState)}})}(e,this),function(c,t){var e=c.template,l=e.$container,u=e.$player,d=e.$video;Object.defineProperty(t,"autoSizeState",{get:function(){return l.classList.contains("artplayer-auto-size")}}),Object.defineProperty(t,"autoSize",{value:function(){var t=d.videoWidth,e=d.videoHeight,n=l.getBoundingClientRect(),i=n.width,r=n.height,o=t/e,a=i/r;if(l.classList.add("artplayer-auto-size"),o<a)W(u,"width","".concat(r*o/i*100,"%")),W(u,"height","100%");else{var s=i/o/r*100;W(u,"width","100%"),W(u,"height","".concat(s,"%"))}c.emit("autoSizeChange")}}),Object.defineProperty(t,"autoSizeRemove",{value:function(){l.classList.remove("artplayer-auto-size"),W(u,"width",null),W(u,"height",null),c.emit("autoSizeRemove")}})}(e,this),function(t,e){Object.defineProperty(e,"rect",{get:function(){return t.template.$player.getBoundingClientRect()}}),["bottom","height","left","right","top","width"].forEach(function(t){Object.defineProperty(e,t,{get:function(){return e.rect[t]}})}),Object.defineProperty(e,"x",{get:function(){return e.left+window.pageXOffset}}),Object.defineProperty(e,"y",{get:function(){return e.top+window.pageYOffset}})}(e,this),function(n,t){Object.defineProperty(t,"flipState",{get:function(){return n.template.$player.dataset.flip}}),Object.defineProperty(t,"flip",{value:function(t){var e=["normal","horizontal","vertical"];T(e.includes(t),"'flip' only accept ".concat(e.toString()," as parameters")),n.template.$player.dataset.flip=t,n.emit("flipChange",t)}}),Object.defineProperty(t,"flipRemove",{value:function(){delete n.template.$player.dataset.flip,n.emit("flipRemove")}})}(e,this)};function rt(e,n,t,i,r,o){var a="function"==typeof i?i(e):i;if(a.disable)return null;var s=a.name||"".concat(o).concat(n.id),c=document.createElement("div");c.classList.value="art-".concat(o," art-").concat(o,"-").concat(s),a.html&&A(c,a.html),a.style&&q(c,a.style);var l=Array.from(t.children);c.dataset.index=a.index||n.id;var u=l.find(function(t){return Number(t.dataset.index)>=Number(c.dataset.index)});return u?u.insertAdjacentElement("beforebegin",c):A(t,c),a.click&&e.events.proxy(c,"click",function(t){t.preventDefault(),a.click.call(n,t,e),e.emit("".concat(o,":click"),c)}),a.mounted&&a.mounted(c,n,e),r&&r(c,n,e),n[s]={id:n.id,$ref:c,hide:function(){W(c,"display","none"),e.emit("".concat(o,":hide"),c)},show:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"block";W(c,"display",t),e.emit("".concat(o,":show"),c)},remove:function(){z(c),e.emit("".concat(o,":remove"),c)}},e.emit("".concat(o,":add"),a),n[s]}var ot=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var at=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(t){ot(e,t,n[t])})}return e};function st(t,e){var n=t.template.$progress,i=t.player,r=n.getBoundingClientRect().left,o=L(e.x-r,0,n.clientWidth),a=o/n.clientWidth*i.duration;return{second:a,time:_(a),width:o,percentage:L(o/n.clientWidth,0,1)}}function ct(i){return function(u){var t=u.option,e=t.highlight,n=t.theme,d=u.events.proxy,f=u.player;return at({},i,{html:'\n <div class="art-control-progress-inner">\n <div class="art-progress-loaded"></div>\n <div class="art-progress-played" style="background: '.concat(n,'"></div>\n <div class="art-progress-highlight"></div>\n <div class="art-progress-indicator" style="background: ').concat(n,'"></div>\n <div class="art-progress-tip art-tip"></div>\n </div>\n '),mounted:function(o){var r=!1,n=o.querySelector(".art-progress-loaded"),i=o.querySelector(".art-progress-played"),a=o.querySelector(".art-progress-highlight"),s=o.querySelector(".art-progress-indicator"),c=o.querySelector(".art-progress-tip");function l(t,e){"loaded"===t&&W(n,"width","".concat(100*e,"%")),"played"===t&&(W(i,"width","".concat(100*e,"%")),W(s,"left","calc(".concat(100*e,"% - ").concat(D(s,"width")/2,"px)")))}e.forEach(function(t){var e=L(t.time,0,f.duration)/f.duration*100;A(a,'<span data-text="'.concat(t.text,'" data-time="').concat(t.time,'" style="left: ').concat(e,'%"></span>'))}),l("loaded",f.loaded),u.on("video:progress",function(){l("loaded",f.loaded)}),u.on("video:timeupdate",function(){l("played",f.played)}),u.on("video:ended",function(){l("played",1)}),d(o,"mousemove",function(t){W(c,"display","block"),-1<t.composedPath().indexOf(a)?function(t){var e=st(u,t).width,n=t.target.dataset.text;c.innerHTML=n;var i=c.clientWidth;e<=i/2?W(c,"left",0):e>o.clientWidth-i/2?W(c,"left","".concat(o.clientWidth-i,"px")):W(c,"left","".concat(e-i/2,"px"))}(t):function(t){var e=st(u,t),n=e.width,i=e.time;c.innerHTML=i;var r=c.clientWidth;n<=r/2?W(c,"left",0):n>o.clientWidth-r/2?W(c,"left","".concat(o.clientWidth-r,"px")):W(c,"left","".concat(n-r/2,"px"))}(t)}),d(o,"mouseout",function(){W(c,"display","none")}),d(o,"click",function(t){if(t.target!==s){var e=st(u,t),n=e.second;l("played",e.percentage),f.seek(n)}}),d(s,"mousedown",function(){r=!0}),d(document,"mousemove",function(t){if(r){var e=st(u,t),n=e.second,i=e.percentage;s.classList.add("art-show-indicator"),l("played",i),f.seek(n)}}),d(document,"mouseup",function(){r&&(r=!1,s.classList.remove("art-show-indicator"))})}})}}function lt(t){return function(h){return at({},t,{mounted:function(f){var p=h.template.$progress,t=h.events,e=t.proxy,n=t.loadImg,i=!1,r=!1;e(p,"mousemove",function(t){i||(i=!0,n(h.option.thumbnails.url).then(function(){r=!0})),r&&(W(f,"display","block"),function(t){var e=st(h,t).width,n=h.option.thumbnails,i=n.url,r=n.height,o=n.width,a=n.number,s=n.column,c=p.clientWidth/a,l=Math.floor(e/c),u=Math.ceil(l/s)-1,d=l%s||s-1;W(f,"backgroundImage","url(".concat(i,")")),W(f,"height","".concat(r,"px")),W(f,"width","".concat(o,"px")),W(f,"backgroundPosition","-".concat(d*o,"px -").concat(u*r,"px")),e<=o/2?W(f,"left",0):e>p.clientWidth-o/2?W(f,"left","".concat(p.clientWidth-o,"px")):W(f,"left","".concat(e-o/2,"px"))}(t))}),e(p,"mouseout",function(){W(f,"display","none")})}})}}var ut=function(){function n(t){var e=this;a(this,n),this.id=0,this.art=t,this.art.once("video:canplay",function(){e.init()})}return r(n,[{key:"init",value:function(){var e=this,t=this.art.option;this.add(ct({name:"progress",disable:t.isLive,position:"top",index:10})),this.add(lt({name:"thumbnails",disable:!t.thumbnails.url||t.isLive,position:"top",index:20})),this.add(function(t){return function(l){return at({},t,{mounted:function(t){var e=l.events.proxy,n=l.icons,i=l.i18n,r=l.player,o=A(t,n.play),a=A(t,n.pause);function s(){W(o,"display","flex"),W(a,"display","none")}function c(){W(o,"display","none"),W(a,"display","flex")}F(o,i.get("Play")),F(a,i.get("Pause")),e(o,"click",function(){r.play()}),e(a,"click",function(){r.pause()}),r.playing?c():s(),l.on("video:playing",function(){c()}),l.on("video:pause",function(){s()})}})}}({name:"playAndPause",disable:!1,position:"left",index:10})),this.add(function(t){return function(f){return at({},t,{mounted:function(t){var e=f.events.proxy,n=f.icons,r=f.player,i=f.i18n,o=!1,a=A(t,n.volume),s=A(t,n.volumeClose),c=A(t,'<div class="art-volume-panel"></div>'),l=A(c,'<div class="art-volume-slider-handle"></div>');function u(t){var e=c.getBoundingClientRect(),n=e.left,i=e.width,r=l.getBoundingClientRect().width;return L(t.x-n-r/2,0,i-r/2)/(i-r)}function d(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:.7;if(r.muted||0===t)W(a,"display","none"),W(s,"display","flex"),W(l,"left","0");else{var e=D(c,"width")||60,n=D(l,"width"),i=n/2+(e-n)*t-n/2;W(a,"display","flex"),W(s,"display","none"),W(l,"left","".concat(i,"px"))}}F(a,i.get("Mute")),W(s,"display","none"),d(r.volume),f.on("video:volumechange",function(){d(r.volume)}),e(a,"click",function(){r.muted=!0}),e(s,"click",function(){r.muted=!1}),e(c,"click",function(t){r.muted=!1,r.volume=u(t)}),e(l,"mousedown",function(){o=!0}),e(l,"mousemove",function(t){o&&(r.muted=!1,r.volume=u(t))}),e(document,"mouseup",function(){o&&(o=!1)})}})}}({name:"volume",disable:!1,position:"left",index:20})),this.add(function(t){return function(i){return at({},t,{mounted:function(e){function n(){var t="".concat(_(i.player.currentTime)," / ").concat(_(i.player.duration));t!==e.innerHTML&&(e.innerHTML=t)}n(),["video:loadedmetadata","video:timeupdate","video:progress"].forEach(function(t){i.on(t,n)})}})}}({name:"time",disable:t.isLive,position:"left",index:30})),this.add(function(t){return function(r){return at({},t,{mounted:function(t){var o=r.option,e=r.events.proxy,a=r.player,s=-1,n=o.quality.find(function(t){return t.default})||o.quality[0];s=o.quality.indexOf(n);var c=A(t,'<div class="art-quality-name">'.concat(n.name,"</div>")),i=o.quality.map(function(t,e){return'<div class="art-quality-item" data-index="'.concat(e,'">').concat(t.name,"</div>")}).join("");e(A(t,'<div class="art-qualitys">'.concat(i,"</div>")),"click",function(t){var e=Number(t.target.dataset.index),n=o.quality[e],i=n.url,r=n.name;i&&r&&s!==e&&(a.switchQuality(i,r),c.innerHTML=r,s=e)})}})}}({name:"quality",disable:0===t.quality.length,position:"right",index:10})),this.add(function(t){return function(a){return at({},t,{mounted:function(t){var e=a.events.proxy,n=a.icons,i=a.i18n,r=a.player,o=A(t,n.screenshot);F(o,i.get("Screenshot")),e(o,"click",function(){r.screenshot()})}})}}({name:"screenshot",disable:!t.screenshot,position:"right",index:20})),this.add(function(t){return function(a){return at({},t,{mounted:function(t){var e=a.events.proxy,n=a.icons,i=a.i18n,r=a.subtitle,o=A(t,n.subtitle);F(o,i.get("Hide subtitle")),e(t,"click",function(){r.toggle()}),a.on("subtitle:show",function(){W(o,"opacity","1"),F(o,i.get("Hide subtitle"))}),a.on("subtitle:hide",function(){W(o,"opacity","0.8"),F(o,i.get("Show subtitle"))})}})}}({name:"subtitle",disable:!t.subtitle.url,position:"right",index:30})),this.add(function(t){return function(a){return at({},t,{mounted:function(t){var e=a.events.proxy,n=a.icons,i=a.i18n,r=a.setting,o=A(t,n.setting);F(o,i.get("Show setting")),e(t,"click",function(){r.toggle()}),a.on("setting:show",function(){W(o,"opacity","0.8"),F(o,i.get("Hide setting"))}),a.on("setting:hide",function(){W(o,"opacity","1"),F(o,i.get("Show setting"))})}})}}({name:"setting",disable:!t.setting,position:"right",index:40})),this.add(function(t){return function(o){return at({},t,{mounted:function(t){var e=o.events.proxy,n=o.icons,i=o.i18n,r=o.player;F(A(t,n.pip),i.get("Mini player")),e(t,"click",function(){r.pipEnabled()})}})}}({name:"pip",disable:!t.pip,position:"right",index:50})),this.add(function(t){return function(a){return at({},t,{mounted:function(t){var e=a.events.proxy,n=a.icons,i=a.i18n,r=a.player,o=A(t,n.fullscreenWeb);F(o,i.get("Web fullscreen")),e(t,"click",function(){r.fullscreenWebToggle()}),a.on("fullscreenWeb:enabled",function(){W(o,"opacity","0.8"),F(o,i.get("Exit web fullscreen"))}),a.on("fullscreenWeb:exit",function(){W(o,"opacity","1"),F(o,i.get("Web fullscreen"))})}})}}({name:"fullscreenWeb",disable:!t.fullscreenWeb,position:"right",index:60})),this.add(function(t){return function(a){return at({},t,{mounted:function(t){var e=a.events.proxy,n=a.icons,i=a.i18n,r=a.player,o=A(t,n.fullscreen);F(o,i.get("Fullscreen")),e(t,"click",function(){r.fullscreenToggle()}),a.on("fullscreen:enabled",function(){W(o,"opacity","0.8"),F(o,i.get("Exit fullscreen"))}),a.on("fullscreen:exit",function(){W(o,"opacity","1"),F(o,i.get("Fullscreen"))})}})}}({name:"fullscreen",disable:!t.fullscreen,position:"right",index:70})),t.controls.forEach(function(t){e.add(t)})}},{key:"add",value:function(t,e){var n,i="function"==typeof t?t(this.art):t,r=this.art.template,o=r.$progress,a=r.$controlsLeft,s=r.$controlsRight;switch(i.position){case"top":n=o;break;case"left":n=a;break;case"right":n=s}return T(n,"Controls option.position can not be empty"),this.id+=1,rt(this.art,this,n,i,e,"control")}},{key:"show",value:function(){var t=this.art.template.$player;this.state=!0,t.classList.add("artplayer-controls-show"),this.art.emit("controls:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,t.classList.remove("artplayer-controls-show"),this.art.emit("controls:hide")}}]),n}();var dt=function(){function n(t){var e=this;a(this,n),this.id=0,this.art=t,this.art.once("video:canplay",function(){e.init()}),this.art.on("blur",function(){e.hide()})}return r(n,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,i=t.template,r=i.$player,o=i.$contextmenu,a=t.events.proxy;this.add(function(e){return function(i){var t=i.i18n,n=i.player;return at({},e,{html:"\n ".concat(t.get("Play speed"),':\n <span data-rate="0.5">0.5</span>\n <span data-rate="0.75">0.75</span>\n <span data-rate="1.0" class="normal current">').concat(t.get("Normal"),'</span>\n <span data-rate="1.25">1.25</span>\n <span data-rate="1.5">1.5</span>\n <span data-rate="2.0">2.0</span>\n '),click:function(t){var e=t.target.dataset.rate;e&&(n.playbackRate(Number(e)),i.contextmenu.hide())},mounted:function(n){i.on("playbackRateChange",function(e){var t=Array.from(n.querySelectorAll("span")).find(function(t){return Number(t.dataset.rate)===e});t&&B(t,"current")})}})}}({disable:!n.playbackRate,name:"playbackRate",index:10})),this.add(function(e){return function(n){var t=n.i18n,i=n.player;return at({},e,{html:"\n ".concat(t.get("Aspect ratio"),':\n <span data-ratio="default" class="default current">').concat(t.get("Default"),'</span>\n <span data-ratio="4:3">4:3</span>\n <span data-ratio="16:9">16:9</span>\n '),click:function(t){var e=t.target.dataset.ratio;e&&(i.aspectRatio(e),n.contextmenu.hide())},mounted:function(t){n.on("aspectRatioChange",function(e){B(Array.from(t.querySelectorAll("span")).find(function(t){return t.dataset.ratio===e}),"current")})}})}}({disable:!n.aspectRatio,name:"aspectRatio",index:20})),this.add(function(e){return function(t){return at({},e,{html:t.i18n.get("Video info"),click:function(){t.info.show(),t.contextmenu.hide()}})}}({disable:!1,name:"info",index:30})),this.add(function(t){return at({},t,{html:'<a href="https://github.com/zhw2590582/artplayer" target="_blank">ArtPlayer 3.1.8</a>'})}({disable:!1,name:"version",index:40})),this.add(function(e){return function(t){return at({},e,{html:t.i18n.get("Close"),click:function(){t.contextmenu.hide()}})}}({disable:!1,name:"close",index:50})),n.contextmenu.forEach(function(t){e.add(t)}),a(r,"contextmenu",function(t){t.preventDefault(),e.show(),e.setPos(t)}),a(r,"click",function(t){t.composedPath().includes(o)||e.hide()})}},{key:"add",value:function(t,e){var n=this.art.template.$contextmenu;return this.id+=1,rt(this.art,this,n,t,e,"contextmenu")}},{key:"setPos",value:function(t){var e=this.art.template,n=e.$player,i=e.$contextmenu,r=t.clientX,o=t.clientY,a=n.getBoundingClientRect(),s=a.height,c=a.width,l=a.left,u=a.top,d=i.getBoundingClientRect(),f=d.height,p=d.width,h=r-l,v=o-u;l+c<r+p&&(h=c-p),u+s<o+f&&(v=s-f),W(i,"left","".concat(h,"px")),W(i,"top","".concat(v,"px"))}},{key:"show",value:function(){var t=this.art.template.$player;this.state=!0,t.classList.add("artplayer-contextmenu-show"),this.art.emit("contextmenu:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,t.classList.remove("artplayer-contextmenu-show"),this.art.emit("contextmenu:hide")}}]),n}(),ft=function(){function e(t){a(this,e),this.art=t,this.init()}return r(e,[{key:"init",value:function(){var t=this,e=this.art,n=e.template.$infoClose;(0,e.events.proxy)(n,"click",function(){t.hide()}),this.art.on("destroy",function(){t.timer&&clearTimeout(t.timer)})}},{key:"creatInfo",value:function(){var t=[];return t.push('\n <div class="art-info-item ">\n <div class="art-info-title">Player version:</div>\n <div class="art-info-content">3.1.8</div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video url:</div>\n <div class="art-info-content">'.concat(this.art.option.url,"</div>\n </div>\n ")),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video volume:</div>\n <div class="art-info-content" data-video="volume"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video time:</div>\n <div class="art-info-content" data-video="currentTime"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video duration:</div>\n <div class="art-info-content" data-video="duration"></div>\n </div>\n '),t.push('\n <div class="art-info-item">\n <div class="art-info-title">Video resolution:</div>\n <div class="art-info-content">\n <span data-video="videoWidth"></span> x <span data-video="videoHeight"></span>\n </div>\n </div>\n '),t.join("")}},{key:"readInfo",value:function(){var t=this.art.template,e=t.$infoPanel,n=t.$video;Array.from(e.querySelectorAll("[data-video]")).forEach(function(t){var e=n[t.dataset.video];t.innerHTML=void 0!==e?"number"==typeof e?e.toFixed(2):e:"unknown"})}},{key:"loop",value:function(){var t=this;this.readInfo(),this.timer=setTimeout(function(){t.readInfo(),t.loop()},1e3)}},{key:"show",value:function(){var t=this.art.template,e=t.$player,n=t.$infoPanel;this.state=!0,e.classList.add("artplayer-info-show"),n.innerHTML||A(n,this.creatInfo()),clearTimeout(this.timer),this.loop(),this.art.emit("info:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,t.classList.remove("artplayer-info-show"),clearTimeout(this.timer),this.art.emit("info:hide")}}]),e}();var pt=function(t){if(Array.isArray(t))return t};var ht=function(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{i||null==s.return||s.return()}finally{if(r)throw o}}return n};var vt=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var yt=function(t,e){return pt(t)||ht(t,e)||vt()},mt=function(){function n(t){a(this,n),this.art=t,this.state=!0;var e=this.art.option.subtitle.url;e&&this.init(e)}return r(n,[{key:"init",value:function(t){var i=this,e=this.art,r=e.events.proxy,n=e.option.subtitle,o=e.template,a=o.$video,s=o.$subtitle,c=o.$track;if(q(s,n.style||{}),!c){var l=document.createElement("track");l.default=!0,l.kind="metadata",a.appendChild(l),this.art.template.$track=l}this.load(t).then(function(t){if(i.art.template.$track.src=t,i.art.emit("subtitle:load",t),a.textTracks&&a.textTracks[0]){var n=yt(a.textTracks,1)[0];r(n,"cuechange",function(){var t=yt(n.activeCues,1)[0];if(s.innerHTML="",t){var e=document.createElement("div");e.appendChild(t.getCueAsHTML()),s.innerHTML=e.innerHTML.split(/\r?\n/).map(function(t){return"<p>".concat(t,"</p>")}).join("")}i.art.emit("subtitle:update",s)})}})}},{key:"load",value:function(e){var n,i=this.art.notice;return fetch(e).then(function(t){return n=t.headers.get("Content-Type"),t.text()}).then(function(t){return/x-subrip/gi.test(n)?U(I(t)):e}).catch(function(t){i.show(t),console.warn(t)})}},{key:"show",value:function(){var t=this.art.template.$player;this.state=!0,t.classList.remove("artplayer-subtitle-hide"),this.art.emit("subtitle:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,t.classList.add("artplayer-subtitle-hide"),this.art.emit("subtitle:hide")}},{key:"toggle",value:function(){this.state?this.hide():this.show()}}]),n}();var gt=e(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});e.ContentRect=function(t){if("getBBox"in t){var e=t.getBBox();return Object.freeze({height:e.height,left:0,top:0,width:e.width})}var n=window.getComputedStyle(t);return Object.freeze({height:parseFloat(n.height||"0"),left:parseFloat(n.paddingLeft||"0"),top:parseFloat(n.paddingTop||"0"),width:parseFloat(n.width||"0")})}});t(gt);gt.ContentRect;var bt=e(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){this.target=t,this.$$broadcastWidth=this.$$broadcastHeight=0}return Object.defineProperty(t.prototype,"broadcastWidth",{get:function(){return this.$$broadcastWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"broadcastHeight",{get:function(){return this.$$broadcastHeight},enumerable:!0,configurable:!0}),t.prototype.isActive=function(){var t=gt.ContentRect(this.target);return!!t&&(t.width!==this.broadcastWidth||t.height!==this.broadcastHeight)},t}();e.ResizeObservation=n});t(bt);bt.ResizeObservation;var wt=e(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){this.target=t,this.contentRect=gt.ContentRect(t)};e.ResizeObserverEntry=n});t(wt);wt.ResizeObserverEntry;var xt=e(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=[],i=function(){function t(t){this.$$observationTargets=[],this.$$activeTargets=[],this.$$skippedTargets=[];var e=function(t){if(void 0===t)return"Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.";if("function"!=typeof t)return"Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function."}(t);if(e)throw TypeError(e);this.$$callback=t,n.push(this)}return t.prototype.observe=function(t){var e=r("observe",t);if(e)throw TypeError(e);0<o(this.$$observationTargets,t)||(this.$$observationTargets.push(new bt.ResizeObservation(t)),d())},t.prototype.unobserve=function(t){var e=r("unobserve",t);if(e)throw TypeError(e);var n=o(this.$$observationTargets,t);n<0||(this.$$observationTargets.splice(n,1),p())},t.prototype.disconnect=function(){this.$$observationTargets=[],this.$$activeTargets=[]},t}();function r(t,e){return void 0===e?"Failed to execute '"+t+"' on 'ResizeObserver': 1 argument required, but only 0 present.":e instanceof window.Element?void 0:"Failed to execute '"+t+"' on 'ResizeObserver': parameter 1 is not of type 'Element'."}function o(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1}e.ResizeObserver=i;var a,s=function(i){n.forEach(function(n){n.$$activeTargets=[],n.$$skippedTargets=[],n.$$observationTargets.forEach(function(t){if(t.isActive()){var e=l(t.target);i<e?n.$$activeTargets.push(t):n.$$skippedTargets.push(t)}})})},c=function(){var r=1/0;return n.forEach(function(t){if(t.$$activeTargets.length){var i=[];t.$$activeTargets.forEach(function(t){var e=new wt.ResizeObserverEntry(t.target);i.push(e),t.$$broadcastWidth=e.contentRect.width,t.$$broadcastHeight=e.contentRect.height;var n=l(t.target);n<r&&(r=n)}),t.$$callback(i,t),t.$$activeTargets=[]}}),r},l=function(t){for(var e=0;t.parentNode;)t=t.parentNode,e+=1;return e},u=function(){var t=0;for(s(t);n.some(function(t){return!!t.$$activeTargets.length});)t=c(),s(t);n.some(function(t){return!!t.$$skippedTargets.length})&&function(){var t=new window.ErrorEvent("ResizeLoopError",{message:"ResizeObserver loop completed with undelivered notifications."});window.dispatchEvent(t)}()},d=function(){a||f()},f=function(){a=window.requestAnimationFrame(function(){u(),f()})},p=function(){a&&!n.some(function(t){return!!t.$$observationTargets.length})&&(window.cancelAnimationFrame(a),a=void 0)};e.install=function(){return window.ResizeObserver=i}});t(xt);var kt=xt.ResizeObserver;xt.install;var Et=function(){function n(t){var e=this;a(this,n),this.destroyEvents=[],this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),this.loadImg=this.loadImg.bind(this),t.once("video:canplay",function(){!function(e,t){var n=e.template.$player;t.proxy(document,["click","contextmenu"],function(t){-1<t.composedPath().indexOf(n)?(e.isFocus=!0,e.emit("focus")):(e.isFocus=!1,e.emit("blur"))})}(t,e),function(t,e){var n=t.template.$player;e.hover(n,function(){n.classList.add("artplayer-hover"),t.emit("hoverenter")},function(){n.classList.remove("artplayer-hover"),t.emit("hoverleave")})}(t,e),function(e,t){var n=e.template,i=n.$player,r=n.$video,o=e.player,a=j(function(){i.classList.add("artplayer-hide-cursor"),i.classList.remove("artplayer-hover"),e.controls.hide()},5e3);e.on("hoverleave",function(){o.playing&&a()}),t.proxy(i,"mousemove",function(t){a.clearTimeout(),i.classList.remove("artplayer-hide-cursor"),e.controls.show(),!e.player.pipState&&o.playing&&t.target===r&&a()})}(t,e),function(t,e){var n=t.option,i=t.template.$player,r=new kt(function(){n.autoSize&&(t.player.fullscreenState||t.player.fullscreenWebState||t.player.pipState?t.player.autoSizeRemove():t.player.autoSize()),t.player.aspectRatioReset(),t.emit("resize",i)});r.observe(i),e.destroyEvents.push(function(){r.unobserve(i)})}(t,e)})}return r(n,[{key:"proxy",value:function(e,t,n){var i=this,r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};Array.isArray(t)?t.forEach(function(t){return i.proxy(e,t,n,r)}):(e.addEventListener(t,n,r),this.destroyEvents.push(function(){e.removeEventListener(t,n,r)}))}},{key:"hover",value:function(t,e,n){this.proxy(t,"mouseenter",e),this.proxy(t,"mouseleave",n)}},{key:"loadImg",value:function(i){var r=this;return new Promise(function(t,e){var n;if(i instanceof HTMLImageElement)n=i;else{if("string"!=typeof i)return e(i);(n=new Image).src=i}return n.complete?t(n):(r.proxy(n,"load",function(){return t(n)}),r.proxy(n,"error",function(){return e(n)}),i)})}},{key:"destroy",value:function(){this.destroyEvents.forEach(function(t){return t()})}}]),n}(),St=function(){function n(t){var e=this;a(this,n),this.art=t,this.keys={},this.add(27,function(){t.player.fullscreenWebState&&t.player.fullscreenWebExit()}),this.add(32,function(){t.player.toggle()}),this.add(37,function(){t.player.seek(t.player.currentTime-10)}),this.add(38,function(){t.player.volume+=.05}),this.add(39,function(){t.player.seek(t.player.currentTime+10)}),this.add(40,function(){t.player.volume-=.05}),this.art.option.hotkey&&this.art.once("video:canplay",function(){e.init()})}return r(n,[{key:"add",value:function(t,e){this.keys[t]?this.keys[t].push(e):this.keys[t]=[e]}},{key:"init",value:function(){var r=this;(0,this.art.events.proxy)(window,"keydown",function(t){if(r.art.isFocus){var e=document.activeElement.tagName.toUpperCase(),n=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==n&&"true"!==n){var i=r.keys[t.keyCode];i&&(t.preventDefault(),i.forEach(function(t){return t()}),r.art.emit("hotkey",t))}}})}}]),n}(),$t=function(){function n(t){var e=this;a(this,n),this.id=0,this.art=t,this.add=this.add.bind(this),this.art.once("video:canplay",function(){e.art.option.layers.forEach(function(t){e.add(t)})})}return r(n,[{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$layers;return rt(this.art,this,n,t,e,"layer")}},{key:"show",value:function(){var t=this.art.template.$player;this.state=!0,t.classList.remove("artplayer-layers-hide"),this.art.emit("layers:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,t.classList.add("artplayer-layers-hide"),this.art.emit("layers:hide")}}]),n}(),Pt=function(){function e(t){a(this,e),A((this.art=t).template.$loading,t.icons.loading)}return r(e,[{key:"show",value:function(){var t=this.art.template.$player;this.state=!0,t.classList.add("artplayer-loading-show"),this.art.emit("loading:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,t.classList.remove("artplayer-loading-show"),this.art.emit("loading:hide")}}]),e}(),Rt=function(){function e(t){a(this,e),this.art=t,this.timer=null}return r(e,[{key:"show",value:function(t){var e=this,n=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1e3,r=this.art.template,o=r.$player,a=r.$noticeInner;this.state=!0,o.classList.add("artplayer-notice-show"),a.innerHTML=t instanceof Error?t.message.trim():t,clearTimeout(this.timer),n&&(this.timer=setTimeout(function(){e.hide()},i)),this.art.emit("notice:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,t.classList.remove("artplayer-notice-show"),this.art.emit("notice:hide")}}]),e}(),Tt=function(){function e(t){a(this,e),A(A((this.art=t).template.$mask,'<div class="art-state"></div>'),t.icons.state)}return r(e,[{key:"show",value:function(){var t=this.art.template.$player;this.state=!0,t.classList.add("artplayer-mask-show"),this.art.emit("mask:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,t.classList.remove("artplayer-mask-show"),this.art.emit("mask:hide")}}]),e}(),Lt=function t(e){var n=this;a(this,t);var i=Object.assign({loading:'<svg xmlns="http://www.w3.org/2000/svg" width="50px" height="50px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-default">\n <rect x="0" y="0" width="100" height="100" fill="none" class="bk"/>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(0 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-1s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(30 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(60 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.8333333333333334s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(90 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.75s" repeatCount="indefinite"/></rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(120 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(150 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.5833333333333334s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(180 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.5s" repeatCount="indefinite"/></rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(210 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.4166666666666667s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(240 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(270 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.25s" repeatCount="indefinite"/></rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(300 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite"/>\n </rect>\n <rect x="47" y="40" width="6" height="20" rx="5" ry="5" fill="#ffffff" transform="rotate(330 50 50) translate(0 -30)">\n <animate attributeName="opacity" from="1" to="0" dur="1s" begin="-0.08333333333333333s" repeatCount="indefinite"/>\n </rect>\n</svg>',state:'<svg xmlns="http://www.w3.org/2000/svg" height="60" width="60" style="filter: drop-shadow(0px 1px 1px black);" viewBox="0 0 24 24">\n <path d="M20,2H4C1.8,2,0,3.8,0,6v12c0,2.2,1.8,4,4,4h16c2.2,0,4-1.8,4-4V6C24,3.8,22.2,2,20,2z M15.6,12.8L10.5,16 C9.9,16.5,9,16,9,15.2V8.8C9,8,9.9,7.5,10.5,8l5.1,3.2C16.3,11.5,16.3,12.5,15.6,12.8z"/>\n</svg>',play:'<svg xmlns="http://www.w3.org/2000/svg" height="22" width="22" viewBox="0 0 22 22">\n <path d="M17.982 9.275L8.06 3.27A2.013 2.013 0 0 0 5 4.994v12.011a2.017 2.017 0 0 0 3.06 1.725l9.922-6.005a2.017 2.017 0 0 0 0-3.45z"></path>\n</svg>',pause:'<svg xmlns="http://www.w3.org/2000/svg" height="22" width="22" viewBox="0 0 22 22">\n <path d="M7 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2zM15 3a2 2 0 0 0-2 2v12a2 2 0 1 0 4 0V5a2 2 0 0 0-2-2z"></path>\n</svg>',volume:'<svg xmlns="http://www.w3.org/2000/svg" height="22" width="22" viewBox="0 0 22 22">\n <path d="M10.188 4.65L6 8H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1l4.188 3.35a.5.5 0 0 0 .812-.39V5.04a.498.498 0 0 0-.812-.39zM14.446 3.778a1 1 0 0 0-.862 1.804 6.002 6.002 0 0 1-.007 10.838 1 1 0 0 0 .86 1.806A8.001 8.001 0 0 0 19 11a8.001 8.001 0 0 0-4.554-7.222z"></path>\n <path d="M15 11a3.998 3.998 0 0 0-2-3.465v6.93A3.998 3.998 0 0 0 15 11z"></path>\n</svg>',volumeClose:'<svg xmlns="http://www.w3.org/2000/svg" height="22" width="22" viewBox="0 0 22 22">\n <path d="M15 11a3.998 3.998 0 0 0-2-3.465v2.636l1.865 1.865A4.02 4.02 0 0 0 15 11z"></path>\n <path d="M13.583 5.583A5.998 5.998 0 0 1 17 11a6 6 0 0 1-.585 2.587l1.477 1.477a8.001 8.001 0 0 0-3.446-11.286 1 1 0 0 0-.863 1.805zM18.778 18.778l-2.121-2.121-1.414-1.414-1.415-1.415L13 13l-2-2-3.889-3.889-3.889-3.889a.999.999 0 1 0-1.414 1.414L5.172 8H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h1l4.188 3.35a.5.5 0 0 0 .812-.39v-3.131l2.587 2.587-.01.005a1 1 0 0 0 .86 1.806c.215-.102.424-.214.627-.333l2.3 2.3a1.001 1.001 0 0 0 1.414-1.416zM11 5.04a.5.5 0 0 0-.813-.39L8.682 5.854 11 8.172V5.04z"></path>\n</svg>',subtitle:'<svg xmlns="http://www.w3.org/2000/svg" height="22" width="22" viewBox="0 0 48 48">\n <path d="M0 0h48v48H0z" fill="none"/>\n <path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"/>\n</svg>',screenshot:'<svg xmlns="http://www.w3.org/2000/svg" height="22" width="22" viewBox="0 0 50 50">\n\t<path d="M 19.402344 6 C 17.019531 6 14.96875 7.679688 14.5 10.011719 L 14.097656 12 L 9 12 C 6.238281 12 4 14.238281 4 17 L 4 38 C 4 40.761719 6.238281 43 9 43 L 41 43 C 43.761719 43 46 40.761719 46 38 L 46 17 C 46 14.238281 43.761719 12 41 12 L 35.902344 12 L 35.5 10.011719 C 35.03125 7.679688 32.980469 6 30.597656 6 Z M 25 17 C 30.519531 17 35 21.480469 35 27 C 35 32.519531 30.519531 37 25 37 C 19.480469 37 15 32.519531 15 27 C 15 21.480469 19.480469 17 25 17 Z M 25 19 C 20.589844 19 17 22.589844 17 27 C 17 31.410156 20.589844 35 25 35 C 29.410156 35 33 31.410156 33 27 C 33 22.589844 29.410156 19 25 19 Z "/>\n</svg>\n',setting:'<svg xmlns="http://www.w3.org/2000/svg" height="22" width="22" viewBox="0 0 22 22">\n <circle cx="11" cy="11" r="2"></circle>\n <path d="M19.164 8.861L17.6 8.6a6.978 6.978 0 0 0-1.186-2.099l.574-1.533a1 1 0 0 0-.436-1.217l-1.997-1.153a1.001 1.001 0 0 0-1.272.23l-1.008 1.225a7.04 7.04 0 0 0-2.55.001L8.716 2.829a1 1 0 0 0-1.272-.23L5.447 3.751a1 1 0 0 0-.436 1.217l.574 1.533A6.997 6.997 0 0 0 4.4 8.6l-1.564.261A.999.999 0 0 0 2 9.847v2.306c0 .489.353.906.836.986l1.613.269a7 7 0 0 0 1.228 2.075l-.558 1.487a1 1 0 0 0 .436 1.217l1.997 1.153c.423.244.961.147 1.272-.23l1.04-1.263a7.089 7.089 0 0 0 2.272 0l1.04 1.263a1 1 0 0 0 1.272.23l1.997-1.153a1 1 0 0 0 .436-1.217l-.557-1.487c.521-.61.94-1.31 1.228-2.075l1.613-.269a.999.999 0 0 0 .835-.986V9.847a.999.999 0 0 0-.836-.986zM11 15a4 4 0 1 1 0-8 4 4 0 0 1 0 8z"></path>\n</svg>',fullscreen:'<svg xmlns="http://www.w3.org/2000/svg" height="36" width="36" viewBox="0 0 36 36">\n\t<path d="m 10,16 2,0 0,-4 4,0 0,-2 L 10,10 l 0,6 0,0 z"></path>\n\t<path d="m 20,10 0,2 4,0 0,4 2,0 L 26,10 l -6,0 0,0 z"></path>\n\t<path d="m 24,24 -4,0 0,2 L 26,26 l 0,-6 -2,0 0,4 0,0 z"></path>\n\t<path d="M 12,20 10,20 10,26 l 6,0 0,-2 -4,0 0,-4 0,0 z"></path>\n</svg>',fullscreenWeb:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" height="36" width="36">\n\t<path d="m 28,11 0,14 -20,0 0,-14 z m -18,2 16,0 0,10 -16,0 0,-10 z" fill-rule="evenodd"></path>\n</svg>',pip:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36" height="32" width="32">\n <path d="M25,17 L17,17 L17,23 L25,23 L25,17 L25,17 Z M29,25 L29,10.98 C29,9.88 28.1,9 27,9 L9,9 C7.9,9 7,9.88 7,10.98 L7,25 C7,26.1 7.9,27 9,27 L27,27 C28.1,27 29,26.1 29,25 L29,25 Z M27,25.02 L9,25.02 L9,10.97 L27,10.97 L27,25.02 L27,25.02 Z"></path>\n</svg>',prev:'<svg xmlns="http://www.w3.org/2000/svg" height="36" width="36" viewBox="0 0 36 36">\n <path d="m 12,12 h 2 v 12 h -2 z m 3.5,6 8.5,6 V 12 z"></path>\n</svg>',next:'<svg xmlns="http://www.w3.org/2000/svg" height="36" width="36" viewBox="0 0 36 36">\n <path d="M 12,24 20.5,18 12,12 V 24 z M 22,12 v 12 h 2 V 12 h -2 z"></path>\n</svg>'},e.option.icons);Object.keys(i).forEach(function(t){var e=document.createElement("i");e.classList.add("art-icon"),e.classList.add("art-icon-".concat(t)),A(e,i[t]),n[t]=e})};var Ot=function(){function n(t){var e=this;a(this,n),this.id=0,this.art=t,this.state=!1,t.option.setting&&(this.art.once("video:canplay",function(){e.init()}),this.art.on("blur",function(){e.hide()}))}return r(n,[{key:"init",value:function(){var e=this,t=this.art,n=t.option,i=t.template.$setting;(0,t.events.proxy)(i,"click",function(t){t.target===i&&e.hide()}),this.add(function(i){return function(e){var t=e.i18n,n=e.player;return at({},i,{html:'\n <div class="art-setting-header">'.concat(t.get("Flip"),'</div>\n <div class="art-setting-radio">\n <div class="art-radio-item current">\n <button type="button" data-value="normal">').concat(t.get("Normal"),'</button>\n </div>\n <div class="art-radio-item">\n <button type="button" data-value="horizontal">').concat(t.get("Horizontal"),'</button>\n </div>\n <div class="art-radio-item">\n <button type="button" data-value="vertical">').concat(t.get("Vertical"),"</button>\n </div>\n </div>\n "),click:function(t){var e=t.target.dataset.value;e&&n.flip(e)},mounted:function(t){e.on("flipChange",function(e){B(Array.from(t.querySelectorAll("button")).find(function(t){return t.dataset.value===e}).parentElement,"current")})}})}}({disable:!n.flip,name:"flip"})),this.add(function(i){return function(e){var t=e.i18n,n=e.player;return at({},i,{html:'\n <div class="art-setting-header">'.concat(t.get("Aspect ratio"),'</div>\n <div class="art-setting-radio">\n <div class="art-radio-item current">\n <button type="button" data-value="default">').concat(t.get("Default"),'</button>\n </div>\n <div class="art-radio-item">\n <button type="button" data-value="4:3">4:3</button>\n </div>\n <div class="art-radio-item">\n <button type="button" data-value="16:9">16:9</button>\n </div>\n </div>\n '),click:function(t){var e=t.target.dataset.value;e&&n.aspectRatio(e)},mounted:function(t){e.on("aspectRatioChange",function(e){B(Array.from(t.querySelectorAll("button")).find(function(t){return t.dataset.value===e}).parentElement,"current")})}})}}({disable:!n.aspectRatio,name:"aspectRatio"})),this.add(function(e){return function(i){var t=i.i18n,r=i.player,o=i.events.proxy;return at({},e,{html:'\n <div class="art-setting-header">\n '.concat(t.get("Play speed"),': <span class="art-subtitle-value">1.0</span>x\n </div>\n <div class="art-setting-range">\n <input class="art-subtitle-range" value="1" type="range" min="0.5" max="2" step="0.25">\n </div>\n '),mounted:function(t){var e=t.querySelector(".art-setting-range input"),n=t.querySelector(".art-subtitle-value");o(e,"change",function(){var t=e.value;n.innerText=t,r.playbackRate(Number(t))}),i.on("playbackRateChange",function(t){e.value!==t&&(e.value=t,n.innerText=t)})}})}}({disable:!n.playbackRate,name:"playbackRate"}))}},{key:"add",value:function(t,e){this.id+=1;var n=this.art.template.$settingBody;return rt(this.art,this,n,t,e,"setting")}},{key:"show",value:function(){var t=this.art.template.$player;this.state=!0,t.classList.add("artplayer-setting-show"),this.art.emit("setting:show")}},{key:"hide",value:function(){var t=this.art.template.$player;this.state=!1,t.classList.remove("artplayer-setting-show"),this.art.emit("setting:hide")}},{key:"toggle",value:function(){this.state?this.hide():this.show()}}]),n}(),_t=function(){function e(t){a(this,e),this.art=t,this.name="artplayer_settings",this.init()}return r(e,[{key:"init",value:function(){var t=this.art.option,e=this.get("volume");e&&(t.volume=e)}},{key:"get",value:function(t){var e=JSON.parse(window.localStorage.getItem(this.name))||{};return t?e[t]:{}}},{key:"set",value:function(t,e){var n=Object.assign({},this.get(),ot({},t,e));window.localStorage.setItem(this.name,JSON.stringify(n))}},{key:"del",value:function(t){var e=this.get();delete e[t],window.localStorage.setItem(this.name,JSON.stringify(e))}},{key:"clean",value:function(){window.localStorage.removeItem(this.name)}}]),e}();function Ct(i){var t=i.i18n,r=i.events.proxy;return{title:"Subtitle",name:"subtitle",index:20,html:'\n <div class="art-setting-header">\n '.concat(t.get("Subtitle offset time"),': <span class="art-subtitle-value">0</span>s\n </div>\n <div class="art-setting-range">\n <input class="art-subtitle-range" value="0" type="range" min="-5" max="5" step="0.5">\n </div>\n '),mounted:function(t){var e=t.querySelector(".art-setting-range input"),n=t.querySelector(".art-subtitle-value");r(e,"change",function(){var t=e.value;n.innerText=t,i.plugins.subtitle.offset(Number(t))}),i.on("subtitle:switch",function(){e.value=0,n.innerText=0}),i.on("artplayerPluginSubtitle:set",function(t){e.value!==t&&(e.value=t,n.innerText=t)})}}}function jt(i){var r=i.constructor.utils.clamp,t=i.setting,o=i.notice,a=i.template,s=i.i18n,c=i.player;s.update({"zh-cn":{"Subtitle offset time":"字幕偏移时间","No subtitles found":"未发现字幕"},"zh-tw":{"Subtitle offset time":"字幕偏移時間","No subtitles found":"未發現字幕"}}),t.add(Ct);var l=[];return i.on("subtitle:switch",function(){l=[]}),{name:"subtitle",offset:function(t){if(a.$track&&a.$track.track){var e=Array.from(a.$track.track.cues),n=r(t,-5,5);e.forEach(function(t,e){l[e]||(l[e]={startTime:t.startTime,endTime:t.endTime}),t.startTime=r(l[e].startTime+n,0,c.duration),t.endTime=r(l[e].endTime+n,0,c.duration)}),o.show("".concat(s.get("Subtitle offset time"),": ").concat(t,"s")),i.emit("artplayerPluginSubtitle:set",t)}else o.show("".concat(s.get("No subtitles found"))),i.emit("artplayerPluginSubtitle:set",0)}}}function Mt(r){var t=r.constructor.utils,n=t.append,i=t.setStyle,o=t.setStyles,a=t.sleep,s=r.events.proxy,c=r.option,l=r.notice,u=r.i18n,d=r.template,f=r.player;function p(t){if(t){var e=d.$video.canPlayType(t.type);if("maybe"===e||"probably"===e){var n=URL.createObjectURL(t);f.playbackRateRemove(),f.aspectRatioRemove(),d.$video.src=n,a(1e3).then(function(){f.currentTime=0}),c.url=n,r.emit("switch",n),l.show(u.get("Load local video successfully"))}else{var i="".concat(u.get("Playback of this file format is not supported"),": ").concat(t.type);l.show(i,!0,3e3),console.warn(i)}}}return u.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(d.$player,"dragover",function(t){t.preventDefault(),l.show(u.get("Load local video successfully"))}),s(d.$player,"drop",function(t){t.preventDefault(),p(t.dataTransfer.files[0])}),{name:"localPreview",attach:function(t){var e=n(t,'<input type="file">');i(t,"position","relative"),o(e,{position:"absolute",width:"100%",height:"100%",left:"0",top:"0",opacity:"0"}),s(e,"change",function(){p(e.files[0])})}}}function At(e){var t=e.layers,n=e.player,i=e.option.theme;return t.add({name:"miniProgressBar",style:{display:"none",position:"absolute",left:0,right:0,bottom:0,height:"3px",background:i},mounted:function(t){e.on("controls:show",function(){t.style.display="none"}),e.on("controls:hide",function(){t.style.display="block"}),e.on("video:timeupdate",function(){t.style.width="".concat(100*n.played,"%")})}}),{name:"miniProgressBar"}}var zt=function(){function n(t){var e=this;a(this,n),this.art=t,this.id=0,t.option.subtitle.url&&this.add(jt),t.option.isLive||this.add(At),this.add(Mt),t.option.plugins.forEach(function(t){e.add(t)})}return r(n,[{key:"add",value:function(t){this.id+=1;var e=t.call(this,this.art);return this[e&&e.name?e.name:t.name?t.name:"plugin".concat(this.id)]=e,this.art.emit("plugin:add",t),this}}]),n}(),Wt=function t(e){a(this,t);var n=e.option,i=e.template.$video;Object.keys(n.moreVideoAttr).forEach(function(t){i[t]=n.moreVideoAttr[t]}),n.muted&&(i.muted=n.muted),n.volume&&(i.volume=L(n.volume,0,1)),n.poster&&(i.poster=n.poster),n.autoplay&&(i.autoplay=n.autoplay),i.controls=!0;var r=n.type||O(n.url),o=n.customType[r];r&&o?(e.emit("beforeCustomType",r),o(i,n.url,e),e.emit("afterCustomType",r)):(e.emit("beforeAttachUrl",n.url),i.src=n.url,e.emit("afterAttachUrl",i.src))},qt=0,Dt=function(t){function n(t){var e;return a(this,n),e=l(this,u(n).call(this)),T("function"==typeof window.Promise,"Unsupported 'Promise' method"),e.option=M(n.DEFAULTS,t),w(e.option,J),e.init(),e}return f(n,p),r(n,[{key:"init",value:function(){this.whitelist=new X(this),this.template=new Z(this),this.whitelist.state?(this.isFocus=!1,this.isDestroy=!1,this.storage=new _t(this),this.icons=new Lt(this),this.i18n=new tt(this),this.notice=new Rt(this),this.events=new Et(this),this.player=new it(this),this.layers=new $t(this),this.controls=new ut(this),this.contextmenu=new dt(this),this.subtitle=new mt(this),this.info=new ft(this),this.loading=new Pt(this),this.hotkey=new St(this),this.mask=new Tt(this),this.setting=new Ot(this),this.plugins=new zt(this)):this.mobile=new Wt(this),qt+=1,this.id=qt,n.instances.push(this)}},{key:"destroy",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];this.events&&this.events.destroy(),this.template.destroy(t),n.instances.splice(n.instances.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}],[{key:"version",get:function(){return"3.1.8"}},{key:"env",get:function(){return'"production"'}},{key:"config",get:function(){return Y}},{key:"utils",get:function(){return V}},{key:"scheme",get:function(){return J}},{key:"Emitter",get:function(){return p}},{key:"validator",get:function(){return w}},{key:"kindOf",get:function(){return w.kindOf}},{key:"Draggabilly",get:function(){return b}},{key:"DEFAULTS",get:function(){return{container:"#artplayer",url:"",poster:"",title:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,fullscreen:!1,fullscreenWeb:!1,layers:[],contextmenu:[],quality:[],controls:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,width:160,height:90,column:10},subtitle:{url:"",style:{}},moreVideoAttr:{controls:!1,preload:"auto"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}}]),n}();return Object.defineProperty(Dt,"instances",{value:[]}),Dt});