/*! * artplayer.js v5.4.0 * Github: https://github.com/zhw2590582/ArtPlayer * (c) 2017-2026 Harvey Zhao * Released under the MIT License. */ !function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.Artplayer=e(),define(function(){return t.Artplayer})):(t="undefined"!==typeof globalThis?globalThis:t||self).Artplayer=e()}(this,function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,r={exports:{}};var a=(e||(e=1,r.exports=function(){function t(e){return(t="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})(e)}var e=Object.prototype.toString,r=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var o=t(r);if("boolean"===o)return"boolean";if("string"===o)return"string";if("number"===o)return"number";if("symbol"===o)return"symbol";if("function"===o)return"GeneratorFunction"===a(r)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(r))return"array";if(function(t){return!(!t.constructor||"function"!=typeof t.constructor.isBuffer)&&t.constructor.isBuffer(t)}(r))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(e){if(-1!==e.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(r))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(r))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(r))return"regexp";switch(a(r)){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(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(r))return"generator";switch(o=e.call(r)){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 o.slice(8,-1).toLowerCase().replace(/\s/g,"")};function a(t){return t.constructor?t.constructor.name:null}function o(t,e){var a=2=1,p=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(s)||d,h="undefined"!==typeof window&&"undefined"!==typeof document;function u(t,e=document){return e.querySelector(t)}function m(t,e=document){return Array.from(e.querySelectorAll(t))}function f(t,e){return t.classList.add(e)}function g(t,e){return t.classList.remove(e)}function v(t,e){return t.classList.contains(e)}function y(t,e){return e instanceof Element?t.appendChild(e):t.insertAdjacentHTML("beforeend",String(e)),t.lastElementChild||t.lastChild}function b(t){return t.parentNode.removeChild(t)}function w(t,e,r){return t.style[e]=r,t}function x(t,e){for(const r in e)w(t,r,e[r]);return t}function k(t){return Array.from(t.parentElement.children).filter(e=>e!==t)}function $(t,e){k(t).forEach(t=>g(t,e)),f(t,e)}function T(t,e,r="top"){p||(t.setAttribute("aria-label",e),f(t,"hint--rounded"),f(t,`hint--${r}`))}function E(t,e=0){const r=t.getBoundingClientRect(),a=window.innerHeight||document.documentElement.clientHeight,o=window.innerWidth||document.documentElement.clientWidth,n=r.top-e<=a&&r.top+r.height+e>=0,i=r.left-e<=o+e&&r.left+r.width+e>=0;return n&&i}function C(t,e){return R(t).includes(e)}function z(t,e){return e.parentNode.replaceChild(t,e),t}function L(t){return document.createElement(t)}function S(t="",e=""){const r=L("i");return f(r,"art-icon"),f(r,`art-icon-${t}`),y(r,e),r}function M(t,e){let r=document.getElementById(t);r||(r=document.createElement("style"),r.id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(r)}):(document.head||document.documentElement).appendChild(r)),r.textContent=e}function I(){const t=document.createElement("div");return t.style.display="flex","flex"===t.style.display}function P(t){return t.getBoundingClientRect()}function A(t,e){return new Promise((r,a)=>{const o=new Image;o.onload=function(){if(e&&1!==e){const n=document.createElement("canvas"),i=n.getContext("2d");n.width=o.width*e,n.height=o.height*e,i.drawImage(o,0,0,n.width,n.height),n.toBlob(e=>{const o=URL.createObjectURL(e),n=new Image;n.onload=function(){r(n)},n.onerror=function(){URL.revokeObjectURL(o),a(new Error(`Image load failed: ${t}`))},n.src=o})}else r(o)},o.onerror=function(){a(new Error(`Image load failed: ${t}`))},o.src=t})}function R(t){if(t.composedPath)return t.composedPath();const e=[];let r=t.target;for(;r;)e.push(r),r=r.parentNode;return e.includes(window)||void 0===window||e.push(window),e}class O extends Error{constructor(t,e){super(t),"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,e||this.constructor),this.name="ArtPlayerError"}}function _(t,e){if(!t)throw new O(e);return t}function V(t){return t.includes("?")?V(t.split("?")[0]):t.includes("#")?V(t.split("#")[0]):t.trim().toLowerCase().split(".").pop()}function Y(t,e){const r=document.createElement("a");r.style.display="none",r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function D(t,e,r){return Math.max(Math.min(t,Math.max(e,r)),Math.min(e,r))}function N(t){return t.charAt(0).toUpperCase()+t.slice(1)}function F(t){if(!t)return"00:00";const e=Math.floor(t/3600),r=Math.floor((t-3600*e)/60),a=Math.floor(t-3600*e-60*r);return(e>0?[e,r,a]:[r,a]).map(t=>t<10?`0${t}`:String(t)).join(":")}function B(t){return t.replace(/[&<>'"]/g,t=>({"&":"&","<":"<",">":">","'":"'",'"':"""}[t]||t))}const H=Object.defineProperty,{hasOwnProperty:W}=Object.prototype;function j(t,e){return W.call(t,e)}function U(t,e){return Object.getOwnPropertyDescriptor(t,e)}function q(...t){const e=t=>t&&"object"===typeof t&&!Array.isArray(t);return t.reduce((t,r)=>(Object.keys(r).forEach(a=>{const o=t[a],n=r[a];Array.isArray(o)&&Array.isArray(n)?t[a]=o.concat(...n):e(o)&&e(n)?t[a]=q(o,n):t[a]=n}),t),{})}function X(t){return"WEBVTT \r\n\r\n".concat((e=t,e.replace(/(\d\d:\d\d:\d\d)[,.](\d+)/g,(t,e,r)=>{let a=r.slice(0,3);return 1===r.length&&(a=`${r}00`),2===r.length&&(a=`${r}0`),`${e},${a}`})).replace(/\{\\([ibu])\}/g,"").replace(/\{\\([ibu])1\}/g,"<$1>").replace(/\{([ibu])\}/g,"<$1>").replace(/\{\/([ibu])\}/g,"").replace(/(\d\d:\d\d:\d\d),(\d\d\d)/g,"$1.$2").replace(/\{[\s\S]*?\}/g,"").concat("\r\n\r\n"));var e}function G(t){return URL.createObjectURL(new Blob([t],{type:"text/vtt"}))}function K(t){const e=new RegExp("Dialogue:\\s\\d,(\\d+:\\d\\d:\\d\\d.\\d\\d),(\\d+:\\d\\d:\\d\\d.\\d\\d),([^,]*),([^,]*),(?:[^,]*,){4}([\\s\\S]*)$","i");function r(t=""){return t.split(/[:.]/).map((t,e,r)=>{if(e===r.length-1){if(1===t.length)return`.${t}00`;if(2===t.length)return`.${t}0`}else if(1===t.length)return(0===e?"0":":0")+t;return 0===e?t:e===r.length-1?`.${t}`:`:${t}`}).join("")}return`WEBVTT\n\n${t.split(/\r?\n/).map(t=>{const a=t.match(e);return a?{start:r(a[1].trim()),end:r(a[2].trim()),text:a[5].replace(/\{[\s\S]*?\}/g,"").replace(/(\\N)/g,"\n").trim().split(/\r?\n/).map(t=>t.trim()).join("\n")}:null}).filter(t=>t).map((t,e)=>t?`${e+1}\n${t.start} --\x3e ${t.end}\n${t.text}`:"").filter(t=>t.trim()).join("\n\n")}`}function Z(t=0){return new Promise(e=>setTimeout(e,t))}function J(t,e){let r;return function(...a){clearTimeout(r),r=setTimeout(()=>(r=null,t.apply(this,a)),e)}}function Q(t,e){let r=!1;return function(...a){r||(t.apply(this,a),r=!0,setTimeout(()=>{r=!1},e))}}const tt=Object.freeze(Object.defineProperty({__proto__:null,ArtPlayerError:O,addClass:f,append:y,assToVtt:K,capitalize:N,clamp:D,createElement:L,debounce:J,def:H,download:Y,errorHandle:_,escape:B,get:U,getComposedPath:R,getExt:V,getIcon:S,getRect:P,getStyle:function(t,e,r=!0){const a=window.getComputedStyle(t,null).getPropertyValue(e);return r?Number.parseFloat(a):a},has:j,hasClass:v,includeFromEvent:C,inverseClass:$,isBrowser:h,isIOS:c,isIOS13:d,isInViewport:E,isMobile:p,isSafari:l,loadImg:A,mergeDeep:q,query:u,queryAll:m,remove:b,removeClass:g,replaceElement:z,secondToTime:F,setStyle:w,setStyleText:M,setStyles:x,siblings:k,sleep:Z,srtToVtt:X,supportsFlex:I,throttle:Q,tooltip:T,unescape:function(t){const e={"&":"&","<":"<",">":">","'":"'",""":'"'},r=new RegExp(`(${Object.keys(e).join("|")})`,"g");return t.replace(r,t=>e[t]||t)},userAgent:s,vttToBlob:G},Symbol.toStringTag,{value:"Module"})),et="array",rt="boolean",at="string",ot="number",nt="object",it="function";function st(t,e,r){return _(e===at||e===ot||t instanceof Element,`${r.join(".")} require '${at}' or 'Element' type`)}const lt={html:st,disable:`?${rt}`,name:`?${at}`,index:`?${ot}`,style:`?${nt}`,click:`?${it}`,mounted:`?${it}`,tooltip:`?${at}|${ot}`,width:`?${ot}`,selector:`?${et}`,onSelect:`?${it}`,switch:`?${rt}`,onSwitch:`?${it}`,range:`?${et}`,onRange:`?${it}`,onChange:`?${it}`},ct={id:at,container:st,url:at,poster:at,type:at,theme:at,lang:at,volume:ot,isLive:rt,muted:rt,autoplay:rt,autoSize:rt,autoMini:rt,loop:rt,flip:rt,playbackRate:rt,aspectRatio:rt,screenshot:rt,setting:rt,hotkey:rt,pip:rt,mutex:rt,backdrop:rt,fullscreen:rt,fullscreenWeb:rt,subtitleOffset:rt,miniProgressBar:rt,useSSR:rt,playsInline:rt,lock:rt,gesture:rt,fastForward:rt,autoPlayback:rt,autoOrientation:rt,airplay:rt,proxy:`?${it}`,plugins:[it],layers:[lt],contextmenu:[lt],settings:[lt],controls:[{...lt,position:(t,e,r)=>{const a=["top","left","right"];return _(a.includes(t),`${r.join(".")} only accept ${a.toString()} as parameters`)}}],quality:[{default:`?${rt}`,html:at,url:at}],highlight:[{time:ot,text:at}],thumbnails:{url:at,number:ot,column:ot,width:ot,height:ot,scale:ot},subtitle:{url:at,name:at,type:at,style:nt,escape:rt,encoding:at,onVttLoad:it},moreVideoAttr:nt,i18n:nt,icons:nt,cssVar:nt,customType:nt};class dt{constructor(t){this.id=0,this.art=t,this.cache=new Map,this.add=this.add.bind(this),this.remove=this.remove.bind(this),this.update=this.update.bind(this)}get show(){return v(this.art.template.$player,`art-${this.name}-show`)}set show(t){const{$player:e}=this.art.template,r=`art-${this.name}-show`;t?f(e,r):g(e,r),this.art.emit(this.name,t)}toggle(){this.show=!this.show}add(t){const e="function"===typeof t?t(this.art):t;if(e.html=e.html||"",o(e,lt),!this.$parent||!this.name||e.disable)return;const r=e.name||`${this.name}${this.id}`;_(!this.cache.has(r),`Can't add an existing [${r}] to the [${this.name}]`),this.id+=1;const a=L("div");f(a,`art-${this.name}`),f(a,`art-${this.name}-${r}`);const n=Array.from(this.$parent.children);a.dataset.index=e.index||this.id;const i=n.find(t=>Number(t.dataset.index)>=Number(a.dataset.index));i?i.insertAdjacentElement("beforebegin",a):y(this.$parent,a),e.html&&y(a,e.html),e.style&&x(a,e.style),e.tooltip&&T(a,e.tooltip);const s=[];if(e.click){const t=this.art.events.proxy(a,"click",t=>{t.preventDefault(),e.click.call(this.art,this,t)});s.push(t)}return e.selector&&["left","right"].includes(e.position)&&this.selector(e,a,s),this[r]=a,this.cache.set(r,{$ref:a,events:s,option:e}),e.mounted&&e.mounted.call(this.art,a),a}remove(t){_(this.cache.has(t),`Can't find [${t}] from the [${this.name}]`);const e=this.cache.get(t);e.option.beforeUnmount&&e.option.beforeUnmount.call(this.art,e.$ref);for(const r of e.events)this.art.events.remove(r);this.cache.delete(t),delete this[t],b(e.$ref)}update(t){if(this.cache.has(t.name)){const e=this.cache.get(t.name);t=Object.assign(e.option,t),this.remove(t.name)}return this.add(t)}}class pt extends dt{constructor(t){super(t),this.name="contextmenu",this.$parent=t.template.$contextmenu,p||this.init()}init(){const{option:t,proxy:e,template:{$player:r,$contextmenu:a}}=this.art;t.playbackRate&&this.add(function(t){return e=>{const{i18n:r,constructor:{PLAYBACK_RATE:a}}=e,o=a.map(t=>`${1===t?r.get("Normal"):t.toFixed(1)}`).join("");return{...t,html:`${r.get("Play Speed")}: ${o}`,click:(t,r)=>{const{value:a}=r.target.dataset;a&&(e.playbackRate=Number(a),t.show=!1)},mounted:t=>{const r=u('[data-value="1"]',t);r&&$(r,"art-current"),e.on("video:ratechange",()=>{const r=m("span",t).find(t=>Number(t.dataset.value)===e.playbackRate);r&&$(r,"art-current")})}}}}({name:"playbackRate",index:10})),t.aspectRatio&&this.add(function(t){return e=>{const{i18n:r,constructor:{ASPECT_RATIO:a}}=e,o=a.map(t=>`${"default"===t?r.get("Default"):t}`).join("");return{...t,html:`${r.get("Aspect Ratio")}: ${o}`,click:(t,r)=>{const{value:a}=r.target.dataset;a&&(e.aspectRatio=a,t.show=!1)},mounted:t=>{const r=u('[data-value="default"]',t);r&&$(r,"art-current"),e.on("aspectRatio",e=>{const r=m("span",t).find(t=>t.dataset.value===e);r&&$(r,"art-current")})}}}}({name:"aspectRatio",index:20})),t.flip&&this.add(function(t){return e=>{const{i18n:r,constructor:{FLIP:a}}=e,o=a.map(t=>`${r.get(N(t))}`).join("");return{...t,html:`${r.get("Video Flip")}: ${o}`,click:(t,r)=>{const{value:a}=r.target.dataset;a&&(e.flip=a.toLowerCase(),t.show=!1)},mounted:t=>{const r=u('[data-value="normal"]',t);r&&$(r,"art-current"),e.on("flip",e=>{const r=m("span",t).find(t=>t.dataset.value===e);r&&$(r,"art-current")})}}}}({name:"flip",index:30})),this.add(function(t){return e=>({...t,html:e.i18n.get("Video Info"),click:t=>{e.info.show=!0,t.show=!1}})}({name:"info",index:40})),this.add(function(t){const e=h?location.href:"";return{...t,html:`ArtPlayer ${n}`}}({name:"version",index:50})),this.add(function(t){return e=>({...t,html:e.i18n.get("Close"),click:t=>{t.show=!1}})}({name:"close",index:60}));for(let o=0;o{if(!this.art.constructor.CONTEXTMENU)return;t.preventDefault(),this.show=!0;const e=t.clientX,o=t.clientY,{height:n,width:i,left:s,top:l}=P(r),{height:c,width:d}=P(a);let p=e-s,h=o-l;e+d>s+i&&(p=i-d),o+c>l+n&&(h=n-c),x(a,{top:`${h}px`,left:`${p}px`})}),e(r,"click",t=>{C(t,a)||(this.show=!1)}),this.art.on("blur",()=>{this.show=!1})}}function ht(t,e){const{$progress:r}=t.template,{left:a}=P(r),o=D((p?e.touches[0].clientX:e.clientX)-a,0,r.clientWidth),n=o/r.clientWidth*t.duration;return{second:n,time:F(n),width:o,percentage:D(o/r.clientWidth,0,1)}}function ut(t,e){if(t.isRotate){const r=e.touches[0].clientY/t.height,a=r*t.duration;t.emit("setBar","played",r,e),t.seek=a}else{const{second:r,percentage:a}=ht(t,e);t.emit("setBar","played",a,e),t.seek=r}}function mt(t){return e=>{const{icons:r,option:a,proxy:o}=e,{$player:n,$progress:i}=e.template;return{...t,html:'\n
\n
\n
\n
\n
\n
\n
00:00
\n
\n ',mounted:t=>{let s=null,l=!1;const c=u(".art-progress-hover",t),d=u(".art-progress-loaded",t),h=u(".art-progress-played",t),m=u(".art-progress-highlight",t),v=u(".art-progress-indicator",t),b=u(".art-progress-tip",t);function x(r,a){const{width:o,time:n}=a||ht(e,r);b.textContent=n||"00:00";const i=b.clientWidth;o<=i/2?w(b,"left",0):o>t.clientWidth-i/2?w(b,"left",t.clientWidth-i+"px"):w(b,"left",o-i/2+"px")}r.indicator?y(v,r.indicator):w(v,"backgroundColor","var(--art-theme)"),e.on("setBar",function(r,a,o){const i="played"===r&&o&&p;if("loaded"===r&&w(d,"width",100*a+"%"),"hover"===r&&(w(c,"width",100*a+"%"),C(o,m)?function(r){const{width:a}=ht(e,r),{text:o}=r.target.dataset;b.textContent=o;const n=b.clientWidth;a<=n/2?w(b,"left",0):a>t.clientWidth-n/2?w(b,"left",t.clientWidth-n+"px"):w(b,"left",a-n/2+"px")}(o):x(o),0===a?g(n,"art-progress-hover"):f(n,"art-progress-hover")),"played"===r&&(w(h,"width",100*a+"%"),w(v,"left",100*a+"%")),i){f(n,"art-progress-hover");x(o,{width:t.clientWidth*a,time:F(a*e.duration)}),clearTimeout(s),s=setTimeout(()=>{g(n,"art-progress-hover")},500)}}),e.on("video:loadedmetadata",function(){m.textContent="";for(let t=0;t`;y(m,n)}}),e.constructor.USE_RAF?e.on("raf",()=>{e.emit("setBar","played",e.played),e.emit("setBar","loaded",e.loaded)}):(e.on("video:timeupdate",()=>{e.emit("setBar","played",e.played)}),e.on("video:progress",()=>{e.emit("setBar","loaded",e.loaded)}),e.on("video:ended",()=>{e.emit("setBar","played",1)})),e.emit("setBar","loaded",e.loaded||0),p||(o(i,"click",t=>{t.target!==v&&ut(e,t)}),o(i,"mousemove",t=>{const{percentage:r}=ht(e,t);e.emit("setBar","hover",r,t)}),o(i,"mouseleave",t=>{e.emit("setBar","hover",0,t)}),o(i,"mousedown",t=>{l=0===t.button}),e.on("document:mousemove",t=>{if(l){const{second:r,percentage:a}=ht(e,t);e.emit("setBar","played",a,t),e.seek=r}}),e.on("document:mouseup",()=>{l&&(l=!1)}))}}}}class ft extends dt{constructor(t){super(t),this.isHover=!1,this.name="control",this.timer=Date.now();const{constructor:e}=t,{$player:r,$bottom:a}=this.art.template;t.on("mousemove",()=>{p||(this.show=!0)}),t.on("click",()=>{p?this.toggle():this.show=!0}),t.on("document:mousemove",t=>{this.isHover=C(t,a)}),t.on("video:timeupdate",()=>{!t.setting.show&&!this.isHover&&!t.isInput&&t.playing&&this.show&&Date.now()-this.timer>=e.CONTROL_HIDE_TIME&&(this.show=!1)}),t.on("control",t=>{t?(g(r,"art-hide-cursor"),f(r,"art-hover"),this.timer=Date.now()):(f(r,"art-hide-cursor"),g(r,"art-hover"))}),this.init()}init(){const{option:t}=this.art;t.isLive||this.add(mt({name:"progress",position:"top",index:10})),this.add({name:"thumbnails",position:"top",index:20}),this.add(function(t){return e=>({...t,mounted:t=>{const{proxy:r,icons:a,i18n:o}=e,n=y(t,a.play),i=y(t,a.pause);function s(){w(n,"display","flex"),w(i,"display","none")}function l(){w(n,"display","none"),w(i,"display","flex")}T(n,o.get("Play")),T(i,o.get("Pause")),r(n,"click",()=>{e.play()}),r(i,"click",()=>{e.pause()}),e.playing?l():s(),e.on("video:playing",()=>{l()}),e.on("video:pause",()=>{s()})}})}({name:"playAndPause",position:"left",index:10})),this.add(function(t){return e=>({...t,mounted:t=>{const{proxy:r,icons:a}=e,o=y(t,a.volume),n=y(t,a.volumeClose),i=y(t,'
'),s=y(i,'
'),l=y(s,'
'),c=y(s,'
'),d=y(c,'
'),h=y(d,'
'),u=y(c,'
');function m(t){const{top:e,height:r}=P(c);return 1-(t.clientY-e)/r}function f(){if(e.muted||0===e.volume)w(o,"display","none"),w(n,"display","flex"),w(u,"top","100%"),w(h,"top","100%"),l.textContent=0;else{const t=100*e.volume;w(o,"display","flex"),w(n,"display","none"),w(u,"top",100-t+"%"),w(h,"top",100-t+"%"),l.textContent=Math.floor(t)}}if(f(),e.on("video:volumechange",f),r(o,"click",()=>{e.muted=!0}),r(n,"click",()=>{e.muted=!1}),p)w(i,"display","none");else{let t=!1;r(c,"mousedown",r=>{t=0===r.button,e.volume=m(r)}),e.on("document:mousemove",r=>{t&&(e.muted=!1,e.volume=m(r))}),e.on("document:mouseup",()=>{t&&(t=!1)})}}})}({name:"volume",position:"left",index:20})),t.isLive||this.add(function(t){return e=>({...t,style:p?{fontSize:"12px",padding:"0 5px"}:{cursor:"auto",padding:"0 10px"},mounted:t=>{function r(){const r=`${F(e.currentTime)} / ${F(e.duration)}`;r!==t.textContent&&(t.textContent=r)}r();const a=["video:loadedmetadata","video:timeupdate","video:progress"];for(let o=0;o{this.art.quality=t.quality}),t.screenshot&&!p&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("Screenshot"),mounted:t=>{const{proxy:r,icons:a}=e;y(t,a.screenshot),r(t,"click",()=>{e.screenshot()})}})}({name:"screenshot",position:"right",index:20})),t.setting&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("Show Setting"),mounted:t=>{const{proxy:r,icons:a,i18n:o}=e;y(t,a.setting),r(t,"click",()=>{e.setting.toggle(),e.setting.resize()}),e.on("setting",e=>{T(t,o.get(e?"Hide Setting":"Show Setting"))})}})}({name:"setting",position:"right",index:30})),t.pip&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("PIP Mode"),mounted:t=>{const{proxy:r,icons:a,i18n:o}=e;y(t,a.pip),r(t,"click",()=>{e.pip=!e.pip}),e.on("pip",e=>{T(t,o.get(e?"Exit PIP Mode":"PIP Mode"))})}})}({name:"pip",position:"right",index:40})),t.airplay&&window.WebKitPlaybackTargetAvailabilityEvent&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("AirPlay"),mounted:t=>{const{proxy:r,icons:a}=e;y(t,a.airplay),r(t,"click",()=>e.airplay())}})}({name:"airplay",position:"right",index:50})),t.fullscreenWeb&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("Web Fullscreen"),mounted:t=>{const{proxy:r,icons:a,i18n:o}=e,n=y(t,a.fullscreenWebOn),i=y(t,a.fullscreenWebOff);w(i,"display","none"),r(t,"click",()=>{e.fullscreenWeb=!e.fullscreenWeb}),e.on("fullscreenWeb",e=>{e?(T(t,o.get("Exit Web Fullscreen")),w(n,"display","none"),w(i,"display","inline-flex")):(T(t,o.get("Web Fullscreen")),w(n,"display","inline-flex"),w(i,"display","none"))})}})}({name:"fullscreenWeb",position:"right",index:60})),t.fullscreen&&this.add(function(t){return e=>({...t,tooltip:e.i18n.get("Fullscreen"),mounted:t=>{const{proxy:r,icons:a,i18n:o}=e,n=y(t,a.fullscreenOn),i=y(t,a.fullscreenOff);w(i,"display","none"),r(t,"click",()=>{e.fullscreen=!e.fullscreen}),e.on("fullscreen",e=>{e?(T(t,o.get("Exit Fullscreen")),w(n,"display","none"),w(i,"display","inline-flex")):(T(t,o.get("Fullscreen")),w(n,"display","inline-flex"),w(i,"display","none"))})}})}({name:"fullscreen",position:"right",index:70}));for(let e=0;et.selector}),H(e,"$control_item",{get:()=>r}),H(e,"$control_value",{get:()=>o})}const i=a(n,"click",async e=>{const r=R(e),a=t.selector.find(t=>t.$control_item===r.find(e=>t.$control_item===e));this.check(a),t.onSelect&&(o.innerHTML=await t.onSelect.call(this.art,a,a.$control_item,e))});r.push(i)}}function gt(t,e,r,a){const o=e-a,n=r-t;let i=0;if(Math.abs(n)<2&&Math.abs(o)<2)return i;const s=function(t,e){return 180*Math.atan2(e,t)/Math.PI}(n,o);return s>=-45&&s<45?i=4:s>=45&&s<135?i=1:s>=-135&&s<-45?i=2:(s>=135&&s<=180||s>=-180&&s<-135)&&(i=3),i}class vt{constructor(t){this.destroyEvents=new Set,this.proxy=this.proxy.bind(this),this.hover=this.hover.bind(this),function(t,e){const{constructor:r,template:{$player:a,$video:o}}=t;function n(e){C(e,a)?(t.isInput="INPUT"===e.target.tagName,t.isFocus=!0,t.emit("focus",e)):(t.isInput=!1,t.isFocus=!1,t.emit("blur",e))}t.on("document:click",n),t.on("document:contextmenu",n);let i=[];e.proxy(o,"click",e=>{const a=Date.now();i.push(a);const{MOBILE_CLICK_PLAY:o,DBCLICK_TIME:n,MOBILE_DBCLICK_PLAY:s,DBCLICK_FULLSCREEN:l}=r,c=i.filter(t=>a-t<=n);switch(c.length){case 1:t.emit("click",e),p?!t.isLock&&o&&t.toggle():t.toggle(),i=c;break;case 2:t.emit("dblclick",e),p?!t.isLock&&s&&t.toggle():l&&(t.fullscreen=!t.fullscreen),i=[];break;default:i=[]}})}(t,this),function(t,e){const{$player:r}=t.template;e.hover(r,e=>{f(r,"art-hover"),t.emit("hover",!0,e)},e=>{g(r,"art-hover"),t.emit("hover",!1,e)})}(t,this),function(t,e){const{$player:r}=t.template;e.proxy(r,"mousemove",e=>{t.emit("mousemove",e)})}(t,this),function(t,e){const{option:r,constructor:a}=t;t.on("resize",()=>{const{aspectRatio:e,notice:a}=t;"standard"===t.state&&r.autoSize&&t.autoSize(),t.aspectRatio=e,a.show=""});const o=J(()=>t.emit("resize"),a.RESIZE_TIME);t.on("window:orientationchange",()=>o()),t.on("window:resize",()=>o()),screen&&screen.orientation&&screen.orientation.onchange&&e.proxy(screen.orientation,"change",()=>o())}(t,this),function(t,e){if(p&&!t.option.isLive){const{$video:r,$progress:a}=t.template;let o=null,n=!1,i=0,s=0,l=0;const c=e=>{if(1===e.touches.length&&!t.isLock){o===a&&ut(t,e),n=!0;const{pageX:r,pageY:c}=e.touches[0];i=r,s=c,l=t.currentTime}},d=e=>{if(1===e.touches.length&&n&&t.duration){const{pageX:a,pageY:n}=e.touches[0],c=gt(i,s,a,n),d=[3,4].includes(c),p=[1,2].includes(c);if(d&&!t.isRotate||p&&t.isRotate){const c=D((a-i)/t.width,-1,1),d=D((n-s)/t.height,-1,1),p=t.isRotate?d:c,h=o===r?t.constructor.TOUCH_MOVE_RATIO:1,u=D(l+t.duration*p*h,0,t.duration);t.seek=u,t.emit("setBar","played",D(u/t.duration,0,1),e),t.notice.show=`${F(u)} / ${F(t.duration)}`}}},p=()=>{n&&(i=0,s=0,l=0,n=!1,o=null)};t.option.gesture&&(e.proxy(r,"touchstart",t=>{o=r,c(t)}),e.proxy(r,"touchmove",d)),e.proxy(a,"touchstart",t=>{o=a,c(t)}),e.proxy(a,"touchmove",d),t.on("document:touchend",p)}}(t,this),function(t){const{option:e,constructor:r,template:{$container:a}}=t,o=Q(()=>{t.emit("view",E(a,r.SCROLL_GAP))},r.SCROLL_TIME);t.on("window:scroll",()=>o()),t.on("view",r=>{e.autoMini&&(t.mini=!r)})}(t),function(t,e){const r=["click","mouseup","keydown","touchend","touchmove","mousemove","pointerup","contextmenu","pointermove","visibilitychange","webkitfullscreenchange"],a=["resize","scroll","orientationchange"],o=[];function n(n={}){for(let t=0;t{const a=n.document||i.ownerDocument||document,s=e.proxy(a,r,e=>{t.emit(`document:${r}`,e)});o.push(s)}),a.forEach(r=>{const a=n.window||i.ownerDocument?.defaultView||window,s=e.proxy(a,r,e=>{t.emit(`window:${r}`,e)});o.push(s)})}n(),e.bindGlobalEvents=n}(t,this),function(t){if(t.constructor.USE_RAF){let e=null;!function r(){t.playing&&t.emit("raf"),t.isDestroy||(e=requestAnimationFrame(r))}(),t.on("destroy",()=>{cancelAnimationFrame(e)})}}(t)}proxy(t,e,r,a={}){if(Array.isArray(e))return e.map(e=>this.proxy(t,e,r,a));t.addEventListener(e,r,a);const o=()=>t.removeEventListener(e,r,a);return this.destroyEvents.add(o),o}hover(t,e,r){e&&this.proxy(t,"mouseenter",e),r&&this.proxy(t,"mouseleave",r)}remove(t){if(this.destroyEvents.has(t))try{t()}catch(e){console.warn("Failed to remove event listener:",e)}finally{this.destroyEvents.delete(t)}}destroy(){for(const e of this.destroyEvents)try{e()}catch(t){console.warn("Failed to destroy event listener:",t)}this.destroyEvents.clear()}}class yt{constructor(t){this.art=t,this.keys={},p||this.init()}init(){const{constructor:t}=this.art;this.art.option.hotkey&&(this.add("Escape",()=>{this.art.fullscreenWeb&&(this.art.fullscreenWeb=!1)}),this.add("Space",()=>{this.art.toggle()}),this.add("ArrowLeft",()=>{this.art.backward=t.SEEK_STEP}),this.add("ArrowUp",()=>{this.art.volume+=t.VOLUME_STEP}),this.add("ArrowRight",()=>{this.art.forward=t.SEEK_STEP}),this.add("ArrowDown",()=>{this.art.volume-=t.VOLUME_STEP})),this.art.on("document:keydown",t=>{if(this.art.isFocus){const e=document.activeElement.tagName.toUpperCase(),r=document.activeElement.getAttribute("contenteditable");if("INPUT"!==e&&"TEXTAREA"!==e&&""!==r&&"true"!==r&&!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.shiftKey){const e=this.keys[t.code];if(e){t.preventDefault();for(let r=0;r\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',state:'\n\n\n',play:'\n \n',pause:'\n \n',check:'\n\n',volume:'\n \n \n',volumeClose:'\n \n \n',screenshot:'\n\t\n\n',setting:'\n \n \n',pip:'\n\n',arrowLeft:'\n \n',arrowRight:'\n \n',playbackRate:'',aspectRatio:'',config:'',lock:'\n\n\n\n\n',flip:'\n\n\n\n\n\n',unlock:'\n\n\n',fullscreenOff:'\n\n\n\n\n',fullscreenOn:'\n\n\n\n\n',fullscreenWebOff:'\n\n\n\n\n',fullscreenWebOn:'\n\n\n\n\n',switchOn:'\n\n\n \n',switchOff:'\n\n\n \n\n',error:'\n\n\n\n\n',close:'\n\n\n\n\n',airplay:'\n \n \n \n \n\n',...t.option.icons};for(const r in e)H(this,r,{get:()=>S(r,e[r])})}}class kt extends dt{constructor(t){super(t),this.name="info",p||this.init()}init(){const{proxy:t,constructor:e,template:{$infoPanel:r,$infoClose:a,$video:o}}=this.art;t(a,"click",()=>{this.show=!1});let n=null;const i=m("[data-video]",r)||[];this.art.on("destroy",()=>clearTimeout(n)),function t(){for(let e=0;e{w(o,"display","none"),w(n,"display",null)}),a.proxy(e.$state,"click",()=>t.play())}}class Ct{constructor(t){this.art=t,this.timer=null,t.on("destroy",()=>this.destroy())}destroy(){this.timer&&(clearTimeout(this.timer),this.timer=null)}set show(t){const{constructor:e,template:{$player:r,$noticeInner:a}}=this.art;t?(a.textContent=t instanceof Error?t.message.trim():t,f(r,"art-notice-show"),clearTimeout(this.timer),this.timer=setTimeout(()=>{a.textContent="",g(r,"art-notice-show")},e.NOTICE_TIME)):g(r,"art-notice-show")}get show(){const{template:{$player:t}}=this.art;return t.classList.contains("art-notice-show")}}const zt=[["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"]],Lt=(()=>{if("undefined"===typeof document)return!1;const t=zt[0],e={};for(const r of zt){if(r[1]in document){for(const[a,o]of r.entries())e[t[a]]=o;return e}}return!1})(),St={change:Lt.fullscreenchange,error:Lt.fullscreenerror},Mt={request:(t=document.documentElement,e)=>new Promise((r,a)=>{const o=()=>{Mt.off("change",o),r()};Mt.on("change",o);const n=t[Lt.requestFullscreen](e);n instanceof Promise&&n.then(o).catch(a)}),exit:()=>new Promise((t,e)=>{if(!Mt.isFullscreen)return void t();const r=()=>{Mt.off("change",r),t()};Mt.on("change",r);const a=document[Lt.exitFullscreen]();a instanceof Promise&&a.then(r).catch(e)}),toggle:(t,e)=>Mt.isFullscreen?Mt.exit():Mt.request(t,e),onchange(t){Mt.on("change",t)},onerror(t){Mt.on("error",t)},on(t,e){const r=St[t];r&&document.addEventListener(r,e,!1)},off(t,e){const r=St[t];r&&document.removeEventListener(r,e,!1)},raw:Lt};function It(t){const{i18n:e,notice:r,template:{$video:a,$player:o}}=t;t.once("video:loadedmetadata",()=>{var n;Mt.isEnabled?(n=t,Mt.on("change",()=>{n.emit("fullscreen",Mt.isFullscreen),Mt.isFullscreen?(n.state="fullscreen",f(o,"art-fullscreen")):g(o,"art-fullscreen"),n.emit("resize")}),Mt.on("error",t=>{n.emit("fullscreenError",t)}),H(n,"fullscreen",{get:()=>Mt.isFullscreen,async set(t){t?await Mt.request(o):await Mt.exit()}})):a.webkitSupportsFullscreen?(t=>{t.on("document:webkitfullscreenchange",()=>{t.emit("fullscreen",t.fullscreen),t.emit("resize")}),H(t,"fullscreen",{get:()=>document.fullscreenElement===a,set(e){e?(t.state="fullscreen",a.webkitEnterFullscreen()):a.webkitExitFullscreen()}})})(t):H(t,"fullscreen",{get:()=>!1,set(){r.show=e.get("Fullscreen Not Supported")}}),H(t,"fullscreen",U(t,"fullscreen"))})}function Pt(t){const{icons:e,proxy:r,storage:a,template:{$player:o,$video:n}}=t;let i=!1,s=0,l=0;function c(){const{$mini:e}=t.template;e&&(g(o,"art-mini"),w(e,"display","none"),o.prepend(n),t.emit("mini",!1))}function d(e,r){t.playing?(w(e,"display","none"),w(r,"display","flex")):(w(e,"display","flex"),w(r,"display","none"))}function p(){const{$mini:e}=t.template,r=P(e),o=window.innerHeight-r.height-50,n=window.innerWidth-r.width-50;a.set("top",o),a.set("left",n),w(e,"top",`${o}px`),w(e,"left",`${n}px`)}H(t,"mini",{get:()=>v(o,"art-mini"),set(h){if(h){t.state="mini",f(o,"art-mini");const h=function(){const{$mini:o}=t.template;if(o)return y(o,n),w(o,"display","flex");{const o=L("div");f(o,"art-mini-popup"),y(document.body,o),t.template.$mini=o,y(o,n);const p=y(o,'
');y(p,e.close),r(p,"click",c);const h=y(o,'
'),u=y(h,e.play),m=y(h,e.pause);return r(u,"click",()=>t.play()),r(m,"click",()=>t.pause()),d(u,m),t.on("video:playing",()=>d(u,m)),t.on("video:pause",()=>d(u,m)),t.on("video:timeupdate",()=>d(u,m)),r(o,"mousedown",t=>{i=0===t.button,s=t.pageX,l=t.pageY}),t.on("document:mousemove",t=>{if(i){f(o,"art-mini-dragging");const e=t.pageX-s,r=t.pageY-l;w(o,"transform",`translate(${e}px, ${r}px)`)}}),t.on("document:mouseup",()=>{if(i){i=!1,g(o,"art-mini-dragging");const t=P(o);a.set("left",t.left),a.set("top",t.top),w(o,"left",`${t.left}px`),w(o,"top",`${t.top}px`),w(o,"transform",null)}}),o}}(),u=a.get("top"),m=a.get("left");"number"===typeof u&&"number"===typeof m?(w(h,"top",`${u}px`),w(h,"left",`${m}px`),E(h)||p()):p(),t.emit("mini",!0)}else c()}})}function At(t){const{i18n:e,notice:r,template:{$video:a}}=t;document.pictureInPictureEnabled?function(t){const{template:{$video:e},proxy:r,notice:a}=t;e.disablePictureInPicture=!1,H(t,"pip",{get:()=>document.pictureInPictureElement,set(r){r?(t.state="pip",e.requestPictureInPicture().catch(t=>{throw a.show=t,t})):document.exitPictureInPicture().catch(t=>{throw a.show=t,t})}}),r(e,"enterpictureinpicture",()=>{t.emit("pip",!0)}),r(e,"leavepictureinpicture",()=>{t.emit("pip",!1)})}(t):a.webkitSupportsPresentationMode?function(t){const{$video:e}=t.template;e.webkitSetPresentationMode("inline"),H(t,"pip",{get:()=>"picture-in-picture"===e.webkitPresentationMode,set(r){r?(t.state="pip",e.webkitSetPresentationMode("picture-in-picture"),t.emit("pip",!0)):(e.webkitSetPresentationMode("inline"),t.emit("pip",!1))}})}(t):H(t,"pip",{get:()=>!1,set(){r.show=e.get("PIP Not Supported")}})}function Rt(t){const{option:e,template:{$progress:r,$video:a}}=t;let o=null,n=!1,i=null;t.on("setBar",async(o,s,l)=>{const c=t.controls?.thumbnails,{url:d,scale:h}=e.thumbnails;if(!c||!d)return;if("hover"===o||"played"===o&&l&&p){if(i||n||(n=!0,i=await A(d,h),n=!1),!i)return;const o=r.clientWidth*s;o>0&&or.clientWidth-h/2?w(n,"left",r.clientWidth-h+"px"):w(n,"left",o-h/2+"px")}(o)}}),H(t,"thumbnails",{get:()=>t.option.thumbnails,set(e){e.url&&!t.option.isLive&&(t.option.thumbnails=e,clearTimeout(o),o=null,n=!1,i=null)}})}Object.defineProperties(Mt,{isFullscreen:{get:()=>Boolean(document[Lt.fullscreenElement])},element:{enumerable:!0,get:()=>document[Lt.fullscreenElement]},isEnabled:{enumerable:!0,get:()=>Boolean(document[Lt.fullscreenEnabled])}});class Ot{constructor(t){!function(t){const{option:e,template:{$video:r}}=t;H(t,"url",{get:()=>r.src,async set(a){if(a){const o=t.url,n=e.type||V(a),i=e.customType[n];n&&i?(await Z(),t.loading.show=!0,i.call(t,r,a,t)):(URL.revokeObjectURL(o),r.src=a),o!==t.url&&(t.option.url=a,t.isReady&&o&&t.once("video:canplay",()=>{t.emit("restart",a)}))}else await Z(),t.loading.show=!0}})}(t),function(t){const{template:{$video:e}}=t;H(t,"attr",{value(t,r){if(void 0===r)return e[t];e[t]=r}})}(t),function(t){const{i18n:e,notice:r,option:a,constructor:{instances:o},template:{$video:n}}=t;H(t,"play",{async value(){const i=await n.play();if(r.show=e.get("Play"),t.emit("play"),a.mutex)for(let e=0;et.playing?t.pause():t.play()})}(t),function(t){const{notice:e}=t;H(t,"seek",{set(r){t.currentTime=r,t.duration&&(e.show=`${F(t.currentTime)} / ${F(t.duration)}`),t.emit("seek",t.currentTime,r)}}),H(t,"forward",{set(e){t.seek=t.currentTime+e}}),H(t,"backward",{set(e){t.seek=t.currentTime-e}})}(t),function(t){const{template:{$video:e},i18n:r,notice:a,storage:o}=t;H(t,"volume",{get:()=>e.volume||0,set:t=>{e.volume=D(t,0,1),a.show=`${r.get("Volume")}: ${Number.parseInt(100*e.volume,10)}`,0!==e.volume&&o.set("volume",e.volume)}}),H(t,"muted",{get:()=>e.muted,set:r=>{e.muted=r,t.emit("muted",r)}})}(t),function(t){const{$video:e}=t.template;H(t,"currentTime",{get:()=>e.currentTime||0,set:r=>{r=Number.parseFloat(r),Number.isNaN(r)||(e.currentTime=D(r,0,t.duration))}})}(t),function(t){H(t,"duration",{get:()=>{const{duration:e}=t.template.$video;return e===1/0?0:e||0}})}(t),function(t){function e(e,r){return new Promise((a,o)=>{if(e===t.url)return void a();const{playing:n,aspectRatio:i,playbackRate:s}=t;t.pause(),t.url=e,t.notice.show="";const l={error:e=>{t.off("video:canplay",l.canplay),t.off("video:loadedmetadata",l.metadata),o(e)},metadata:()=>{t.currentTime=r},canplay:async()=>{t.off("video:error",l.error),t.playbackRate=s,t.aspectRatio=i,n&&await t.play(),t.notice.show="",a()}};t.once("video:error",l.error),t.once("video:loadedmetadata",l.metadata),t.once("video:canplay",l.canplay)})}H(t,"switchQuality",{value:r=>e(r,t.currentTime)}),H(t,"switchUrl",{value:t=>e(t,0)}),H(t,"switch",{set:t.switchUrl})}(t),function(t){const{template:{$video:e},i18n:r,notice:a}=t;H(t,"playbackRate",{get:()=>e.playbackRate,set(o){if(o){if(o===e.playbackRate)return;e.playbackRate=o,a.show=`${r.get("Rate")}: ${1===o?r.get("Normal"):`${o}x`}`}else t.playbackRate=1}})}(t),function(t){const{i18n:e,notice:r,template:{$video:a,$player:o}}=t;H(t,"aspectRatio",{get:()=>o.dataset.aspectRatio||"default",set(n){if(n||(n="default"),"default"===n)w(a,"width",null),w(a,"height",null),w(a,"margin",null),delete o.dataset.aspectRatio;else{const t=n.split(":").map(Number),{clientWidth:e,clientHeight:r}=o,i=e/r,s=t[0]/t[1];i>s?(w(a,"width",s*r+"px"),w(a,"height","100%"),w(a,"margin","0 auto")):(w(a,"width","100%"),w(a,"height",e/s+"px"),w(a,"margin","auto 0")),o.dataset.aspectRatio=n}r.show=`${e.get("Aspect Ratio")}: ${"default"===n?e.get("Default"):n}`,t.emit("aspectRatio",n)}})}(t),function(t){const{notice:e,template:{$video:r}}=t,a=L("canvas");H(t,"getDataURL",{value:()=>new Promise((t,o)=>{try{a.width=r.videoWidth,a.height=r.videoHeight,a.getContext("2d").drawImage(r,0,0),t(a.toDataURL("image/png"))}catch(n){e.show=n,o(n)}})}),H(t,"getBlobUrl",{value:()=>new Promise((t,o)=>{try{a.width=r.videoWidth,a.height=r.videoHeight,a.getContext("2d").drawImage(r,0,0),a.toBlob(e=>{t(URL.createObjectURL(e))})}catch(n){e.show=n,o(n)}})}),H(t,"screenshot",{value:async e=>{const a=await t.getDataURL();return Y(a,`${e||`artplayer_${F(r.currentTime)}`}.png`),t.emit("screenshot",a),a}})}(t),It(t),function(t){const{constructor:e,template:{$container:r,$player:a}}=t;let o="";H(t,"fullscreenWeb",{get:()=>v(a,"art-fullscreen-web"),set(n){n?(o=a.style.cssText,e.FULLSCREEN_WEB_IN_BODY&&y(document.body,a),t.state="fullscreenWeb",w(a,"width","100%"),w(a,"height","100%"),f(a,"art-fullscreen-web"),t.emit("fullscreenWeb",!0)):(e.FULLSCREEN_WEB_IN_BODY&&y(r,a),o&&(a.style.cssText=o,o=""),g(a,"art-fullscreen-web"),t.emit("fullscreenWeb",!1)),t.emit("resize")}})}(t),At(t),function(t){const{$video:e}=t.template;H(t,"loaded",{get:()=>t.loadedTime/e.duration}),H(t,"loadedTime",{get:()=>e.buffered.length?e.buffered.end(e.buffered.length-1):0})}(t),function(t){H(t,"played",{get:()=>t.currentTime/t.duration})}(t),function(t){const{$video:e}=t.template;H(t,"playing",{get:()=>"boolean"===typeof e.playing?e.playing:!!(e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2)})}(t),function(t){const{$container:e,$player:r,$video:a}=t.template;H(t,"autoSize",{value(){const{videoWidth:o,videoHeight:n}=a,{width:i,height:s}=P(e),l=o/n;if(i/s>l)w(r,"width",s*l/i*100+"%"),w(r,"height","100%");else{const t=i/l/s*100;w(r,"width","100%"),w(r,"height",`${t}%`)}t.emit("autoSize",{width:t.width,height:t.height})}})}(t),function(t){H(t,"rect",{get:()=>P(t.template.$player)});const e=["bottom","height","left","right","top","width"];for(let r=0;rt.rect[a]})}H(t,"x",{get:()=>t.left+window.pageXOffset}),H(t,"y",{get:()=>t.top+window.pageYOffset})}(t),function(t){const{template:{$player:e},i18n:r,notice:a}=t;H(t,"flip",{get:()=>e.dataset.flip||"normal",set(o){o||(o="normal"),"normal"===o?delete e.dataset.flip:e.dataset.flip=o,a.show=`${r.get("Video Flip")}: ${r.get(N(o))}`,t.emit("flip",o)}})}(t),Pt(t),function(t){const{template:{$poster:e}}=t;H(t,"poster",{get:()=>{try{return e.style.backgroundImage.match(/"(.*)"/)[1]}catch{return""}},set(t){w(e,"backgroundImage",`url(${t})`)}})}(t),function(t){const{template:{$container:e,$video:r}}=t;H(t,"autoHeight",{value(){const{clientWidth:a}=e,{videoHeight:o,videoWidth:n}=r,i=o*(a/n);w(e,"height",`${i}px`),t.emit("autoHeight",i)}})}(t),function(t){const{$player:e}=t.template;H(t,"cssVar",{value:(t,r)=>r?e.style.setProperty(t,r):getComputedStyle(e).getPropertyValue(t)})}(t),function(t){H(t,"theme",{get:()=>t.cssVar("--art-theme"),set(e){t.cssVar("--art-theme",e)}})}(t),function(t){H(t,"type",{get:()=>t.option.type,set(e){t.option.type=e}})}(t),function(t){const e=["mini","pip","fullscreen","fullscreenWeb"];H(t,"state",{get:()=>e.find(e=>t[e])||"standard",set(r){for(let a=0;aa.$track?.offset||0,set(o){const{cues:n}=t.subtitle;if(!a.$track||0===n.length)return;const i=D(o,-10,10);a.$track.offset=i;for(let e=0;e{switch(t.availability){case"available":n=!0;break;case"not-available":n=!1}}):n=!1,H(t,"airplay",{value(){n?(o.webkitShowPlaybackTargetPicker(),t.emit("airplay")):r.show=e.get("AirPlay Not Available")}})}(t),function(t){H(t,"quality",{set(e){const{controls:r,notice:a,i18n:o}=t,n=e.find(t=>t.default)||e[0];r.update({name:"quality",position:"right",index:10,style:{marginRight:"10px"},html:n?.html||"",selector:e,onSelect:async e=>(await t.switchQuality(e.url),a.show=`${o.get("Switch Video")}: ${e.html}`,e.html)})}})}(t),Rt(t),function(t){const{i18n:e,notice:r,option:a,constructor:o,proxy:n,template:{$player:s,$video:l,$poster:c}}=t;let d=0;for(let p=0;p{t.emit(`video:${e.type}`,e)});t.on("video:canplay",()=>{d=0,t.loading.show=!1}),t.once("video:canplay",()=>{t.loading.show=!1,t.controls.show=!0,t.mask.show=!0,t.isReady=!0,t.emit("ready")}),t.on("video:ended",()=>{a.loop?(t.seek=0,t.play(),t.controls.show=!1,t.mask.show=!1):(t.controls.show=!0,t.mask.show=!0)}),t.on("video:error",async n=>{d{t.emit("resize"),p&&(t.loading.show=!1,t.controls.show=!0,t.mask.show=!0)}),t.on("video:loadstart",()=>{t.loading.show=!0,t.mask.show=!1,t.controls.show=!0}),t.on("video:pause",()=>{t.controls.show=!0,t.mask.show=!0}),t.on("video:play",()=>{t.mask.show=!1,w(c,"display","none")}),t.on("video:playing",()=>{t.mask.show=!1}),t.on("video:progress",()=>{t.playing&&(t.loading.show=!1)}),t.on("video:seeked",()=>{t.loading.show=!1,t.mask.show=!0}),t.on("video:seeking",()=>{t.loading.show=!0,t.mask.show=!1}),t.on("video:timeupdate",()=>{t.mask.show=!1}),t.on("video:waiting",()=>{t.loading.show=!0,t.mask.show=!1})}(t),function(t){const{option:e,storage:r,template:{$video:a,$poster:o}}=t;for(const i in e.moreVideoAttr)t.attr(i,e.moreVideoAttr[i]);e.muted&&(t.muted=e.muted),e.volume&&(a.volume=D(e.volume,0,1));const n=r.get("volume");"number"===typeof n&&(a.volume=D(n,0,1)),e.poster&&w(o,"backgroundImage",`url(${e.poster})`),e.autoplay&&(a.autoplay=e.autoplay),e.playsInline&&(a.playsInline=!0,a["webkit-playsinline"]=!0),e.theme&&(e.cssVar["--art-theme"]=e.theme);for(const i in e.cssVar)t.cssVar(i,e.cssVar[i]);t.url=e.url}(t)}}function _t(t){const{notice:e,constructor:r,template:{$player:a,$video:o}}=t,n="art-auto-orientation",i="art-auto-orientation-fullscreen";let s=!1;function l(){const{videoWidth:t,videoHeight:e}=o,r=document.documentElement.clientWidth,a=document.documentElement.clientHeight;return t>e&&ra}return t.on("fullscreenWeb",e=>{if(e){if(l()){const e=Number(r.AUTO_ORIENTATION_TIME??0);setTimeout(()=>{t.fullscreenWeb&&!v(a,n)&&function(){const e=document.documentElement.clientWidth,r=document.documentElement.clientHeight;w(a,"width",`${r}px`),w(a,"height",`${e}px`),w(a,"transform-origin","0 0"),w(a,"transform",`rotate(90deg) translate(0, -${e}px)`),f(a,n),t.isRotate=!0,t.emit("resize")}()},e)}}else v(a,n)&&(w(a,"width",""),w(a,"height",""),w(a,"transform-origin",""),w(a,"transform",""),g(a,n),t.isRotate=!1,t.emit("resize"))}),t.on("fullscreen",async t=>{const r=!!screen?.orientation?.lock;if(t){if(r&&l())try{const t=screen.orientation.type.startsWith("portrait")?"landscape":"portrait";await screen.orientation.lock(t),s=!0,f(a,i)}catch(o){s=!1,e.show=o}}else if(v(a,i)&&g(a,i),r&&s){try{screen.orientation.unlock()}catch{}s=!1}}),{name:"autoOrientation",get state(){return v(a,n)}}}function Vt(t){const{i18n:e,icons:r,storage:a,constructor:o,proxy:n,template:{$poster:i}}=t,s=t.layers.add({name:"auto-playback",html:'\n
\n
\n
\n '}),l=u(".art-auto-playback-last",s),c=u(".art-auto-playback-jump",s),d=u(".art-auto-playback-close",s);y(d,r.close);let p=null;function h(){const r=(a.get("times")||{})[t.option.id||t.option.url];clearTimeout(p),w(s,"display","none"),r&&r>=o.AUTO_PLAYBACK_MIN&&(w(s,"display","flex"),l.textContent=`${e.get("Last Seen")} ${F(r)}`,c.textContent=e.get("Jump Play"),n(d,"click",()=>{w(s,"display","none")}),n(c,"click",()=>{t.seek=r,t.play(),w(i,"display","none"),w(s,"display","none")}),t.once("video:timeupdate",()=>{p=setTimeout(()=>{w(s,"display","none")},o.AUTO_PLAYBACK_TIMEOUT)}))}return t.on("video:timeupdate",()=>{if(t.playing){const e=a.get("times")||{},r=Object.keys(e);r.length>o.AUTO_PLAYBACK_MAX&&delete e[r[0]],e[t.option.id||t.option.url]=t.currentTime,a.set("times",e)}}),t.on("ready",h),t.on("restart",h),{name:"auto-playback",get times(){return a.get("times")||{}},clear:()=>a.del("times"),delete(t){const e=a.get("times")||{};return delete e[t],a.set("times",e),e}}}function Yt(t){const{constructor:e,proxy:r,template:{$player:a,$video:o}}=t;let n=null,i=!1,s=1;const l=()=>{clearTimeout(n),i&&(i=!1,t.playbackRate=s,g(a,"art-fast-forward"))};return r(o,"touchstart",r=>{1===r.touches.length&&t.playing&&!t.isLock&&(n=setTimeout(()=>{i=!0,s=t.playbackRate,t.playbackRate=e.FAST_FORWARD_VALUE,f(a,"art-fast-forward")},e.FAST_FORWARD_TIME))}),t.on("document:touchmove",l),t.on("document:touchend",l),{name:"fastForward",get state(){return v(a,"art-fast-forward")}}}function Dt(t){const{layers:e,icons:r,template:{$player:a}}=t;function o(){return v(a,"art-lock")}function n(){f(a,"art-lock"),t.isLock=!0,t.emit("lock",!0)}function i(){g(a,"art-lock"),t.isLock=!1,t.emit("lock",!1)}return e.add({name:"lock",mounted(e){const a=y(e,r.lock),o=y(e,r.unlock);w(a,"display","none"),t.on("lock",t=>{t?(w(a,"display","inline-flex"),w(o,"display","none")):(w(a,"display","none"),w(o,"display","inline-flex"))})},click(){o()?i():n()}}),{name:"lock",get state(){return o()},set state(t){t?n():i()}}}function Nt(t){return t.on("control",e=>{e?g(t.template.$player,"art-mini-progress-bar"):f(t.template.$player,"art-mini-progress-bar")}),{name:"mini-progress-bar"}}class Ft{constructor(t){this.art=t,this.id=0;const{option:e}=t;e.miniProgressBar&&!e.isLive&&this.add(Nt),e.lock&&p&&this.add(Dt),e.autoPlayback&&!e.isLive&&this.add(Vt),e.autoOrientation&&p&&this.add(_t),e.fastForward&&p&&!e.isLive&&this.add(Yt);for(let r=0;rthis.next(t,e)):this.next(t,e)}next(t,e){const r=e&&e.name||t.name||`plugin${this.id}`;return _(!j(this,r),`Cannot add a plugin that already has the same name: ${r}`),H(this,r,{value:e}),this}}class Bt extends dt{constructor(t){super(t);const{option:e,controls:r,template:{$setting:a}}=t;this.name="setting",this.$parent=a,this.id=0,this.active=null,this.cache=new Map,this.option=[...this.builtin,...e.settings],e.setting&&(this.format(),this.render(),t.on("blur",()=>{this.show&&(this.show=!1,this.render())}),t.on("focus",t=>{const e=C(t,r.setting),a=C(t,this.$parent);!this.show||e||a||(this.show=!1,this.render())}),t.on("resize",()=>this.resize()))}get builtin(){const t=[],{option:e}=this.art;return e.playbackRate&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:a,PLAYBACK_RATE:o}}=t;function n(t){return 1===t?e.get("Normal"):t.toFixed(1)}function i(){const e=t.setting.find(`playback-rate-${t.playbackRate}`);t.setting.check(e)}return{width:a,name:"playback-rate",html:e.get("Play Speed"),tooltip:n(t.playbackRate),icon:r.playbackRate,selector:o.map(e=>({value:e,name:`playback-rate-${e}`,default:e===t.playbackRate,html:n(e)})),onSelect:e=>(t.playbackRate=e.value,e.html),mounted:()=>{i(),t.on("video:ratechange",()=>i())}}}(this.art)),e.aspectRatio&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:a,ASPECT_RATIO:o}}=t;function n(t){return"default"===t?e.get("Default"):t}function i(){const e=t.setting.find(`aspect-ratio-${t.aspectRatio}`);t.setting.check(e)}return{width:a,name:"aspect-ratio",html:e.get("Aspect Ratio"),icon:r.aspectRatio,tooltip:n(t.aspectRatio),selector:o.map(e=>({value:e,name:`aspect-ratio-${e}`,default:e===t.aspectRatio,html:n(e)})),onSelect:e=>(t.aspectRatio=e.value,e.html),mounted:()=>{i(),t.on("aspectRatio",()=>i())}}}(this.art)),e.flip&&t.push(function(t){const{i18n:e,icons:r,constructor:{SETTING_ITEM_WIDTH:a,FLIP:o}}=t;function n(t){return e.get(N(t))}function i(){const e=t.setting.find(`flip-${t.flip}`);t.setting.check(e)}return{width:a,name:"flip",html:e.get("Video Flip"),tooltip:n(t.flip),icon:r.flip,selector:o.map(e=>({value:e,name:`flip-${e}`,default:e===t.flip,html:n(e)})),onSelect:e=>(t.flip=e.value,e.html),mounted:()=>{i(),t.on("flip",()=>i())}}}(this.art)),e.subtitleOffset&&t.push(function(t){const{i18n:e,icons:r,constructor:a}=t;return{width:a.SETTING_ITEM_WIDTH,name:"subtitle-offset",html:e.get("Subtitle Offset"),icon:r.subtitle,tooltip:"0s",range:[0,-10,10,.1],onChange:e=>(t.subtitleOffset=e.range[0],`${e.range[0]}s`),mounted:(e,r)=>{t.on("subtitleOffset",t=>{r.$range.value=t,r.tooltip=`${t}s`})}}}(this.art)),t}traverse(t,e=this.option){for(let r=0;r{e.default=e===t,e.default&&e.$item&&$(e.$item,"art-current")},t.$option),this.render(t.$parents))}format(t=this.option,e,r,a=[]){for(let o=0;oe}),H(n,"$parents",{get:()=>r}),H(n,"$option",{get:()=>t});const a=[];H(n,"$events",{get:()=>a}),H(n,"$formatted",{get:()=>!0})}this.format(n.selector||[],n,t,a)}this.option=t}find(t=""){let e=null;return this.traverse(r=>{r.name===t&&(e=r)}),e}resize(){const{controls:t,constructor:{SETTING_WIDTH:e,SETTING_ITEM_HEIGHT:r},template:{$player:a,$setting:o}}=this.art;if(t.setting&&this.show){const n=this.active[0]?.$parent?.width||e,{left:i,width:s}=P(t.setting),{left:l,width:c}=P(a),d=i-l+s/2-n/2;if(w(o,"height",`${this.active===this.option?this.active.length*r:(this.active.length+1)*r}px`),w(o,"width",`${n}px`),this.art.isRotate||p)return;d+n>c?(w(o,"left",null),w(o,"right",null)):(w(o,"left",`${d}px`),w(o,"right","auto"))}}inactivate(t){for(let e=0;e'),s=L("div");f(s,"art-setting-item-left-icon"),y(s,a),y(i,s),y(i,t.$parent.html);const l=r(n,"click",()=>this.render(t.$parents));t.$parent.$events.push(l),y(e,n)}createItem(t,e=!1){if(!this.cache.has(t.$option))return;const r=this.cache.get(t.$option),a=t.$item;let o="selector";j(t,"switch")&&(o="switch"),j(t,"range")&&(o="range"),j(t,"onClick")&&(o="button");const{icons:n,proxy:i,constructor:s}=this.art,l=L("div");f(l,"art-setting-item"),w(l,"height",`${s.SETTING_ITEM_HEIGHT}px`),l.dataset.name=t.name||"",l.dataset.value=t.value||"";const c=y(l,'
'),d=y(l,'
'),p=L("div");switch(f(p,"art-setting-item-left-icon"),o){case"button":case"switch":case"range":y(p,t.icon||n.config);break;case"selector":t.selector?.length?y(p,t.icon||n.config):y(p,n.check)}y(c,p),H(t,"$icon",{configurable:!0,get:()=>p}),H(t,"icon",{configurable:!0,get:()=>p.innerHTML,set(t){p.innerHTML="",y(p,t)}});const h=L("div");f(h,"art-setting-item-left-text"),y(h,t.html||""),y(c,h),H(t,"$html",{configurable:!0,get:()=>h}),H(t,"html",{configurable:!0,get:()=>h.innerHTML,set(t){h.innerHTML="",y(h,t)}});const u=L("div");switch(f(u,"art-setting-item-right-tooltip"),y(u,t.tooltip||""),y(d,u),H(t,"$tooltip",{configurable:!0,get:()=>u}),H(t,"tooltip",{configurable:!0,get:()=>u.innerHTML,set(t){u.innerHTML="",y(u,t)}}),o){case"switch":{const e=L("div");f(e,"art-setting-item-right-icon");const r=y(e,n.switchOn),a=y(e,n.switchOff);w(t.switch?a:r,"display","none"),y(d,e),H(t,"$switch",{configurable:!0,get:()=>e});let o=t.switch;H(t,"switch",{configurable:!0,get:()=>o,set(t){o=t,t?(w(a,"display","none"),w(r,"display",null)):(w(a,"display",null),w(r,"display","none"))}});break}case"range":{const e=L("div");f(e,"art-setting-item-right-icon");const r=y(e,'');r.value=t.range[0],r.min=t.range[1],r.max=t.range[2],r.step=t.range[3],f(r,"art-setting-range"),y(d,e),H(t,"$range",{configurable:!0,get:()=>r});let a=[...t.range];H(t,"range",{configurable:!0,get:()=>a,set(t){a=[...t],r.value=t[0],r.min=t[1],r.max=t[2],r.step=t[3]}})}break;case"selector":if(t.selector?.length){const t=L("div");f(t,"art-setting-item-right-icon"),y(t,n.arrowRight),y(d,t)}}switch(o){case"switch":if(t.onSwitch){const e=i(l,"click",async e=>{t.switch=await t.onSwitch.call(this.art,t,l,e)});t.$events.push(e)}break;case"range":if(t.$range){if(t.onRange){const e=i(t.$range,"change",async e=>{t.range[0]=t.$range.valueAsNumber,t.tooltip=await t.onRange.call(this.art,t,l,e)});t.$events.push(e)}if(t.onChange){const e=i(t.$range,"input",async e=>{t.range[0]=t.$range.valueAsNumber,t.tooltip=await t.onChange.call(this.art,t,l,e)});t.$events.push(e)}}break;case"selector":{const e=i(l,"click",async e=>{t.selector?.length?this.render(t.selector):(this.check(t),t.$parent.onSelect&&(t.$parent.tooltip=await t.$parent.onSelect.call(this.art,t,l,e)))});t.$events.push(e),t.default&&f(l,"art-current")}break;case"button":if(t.onClick){const e=i(l,"click",async e=>{t.tooltip=await t.onClick.call(this.art,t,l,e)});t.$events.push(e)}}H(t,"$item",{configurable:!0,get:()=>l}),e?z(l,a):y(r,l),t.mounted&&setTimeout(()=>t.mounted.call(this.art,t.$item,t),0)}render(t=this.option){if(this.active=t,this.cache.has(t)){$(this.cache.get(t),"art-current")}else{const e=L("div");this.cache.set(t,e),f(e,"art-setting-panel"),y(this.$parent,e),$(e,"art-current"),t[0]?.$parent&&this.createHeader(t[0]);for(let r=0;rnull,this.init(t.option.subtitle);let e=!1;t.on("video:timeupdate",()=>{if(!this.url)return;const t=this.art.template.$video.webkitDisplayingFullscreen;"boolean"===typeof t&&t!==e&&(e=t,this.createTrack(t?"subtitles":"metadata",this.url))})}get url(){return this.art.template.$track.src}set url(t){this.switch(t)}get textTrack(){return this.art.template.$video?.textTracks?.[0]}get activeCues(){return this.textTrack?Array.from(this.textTrack.activeCues):[]}get cues(){return this.textTrack?Array.from(this.textTrack.cues):[]}style(t,e){const{$subtitle:r}=this.art.template;return"object"===typeof t?x(r,t):w(r,t,e)}update(){const{option:{subtitle:t},template:{$subtitle:e}}=this.art;e.innerHTML="",this.activeCues.length&&(this.art.emit("subtitleBeforeUpdate",this.activeCues),e.innerHTML=this.activeCues.map((e,r)=>e.text.split(/\r?\n/).filter(t=>t.trim()).map(e=>`
\n ${t.escape?B(e):e}\n
`).join("")).join(""),this.art.emit("subtitleAfterUpdate",this.activeCues))}async switch(t,e={}){const{i18n:r,notice:a,option:o}=this.art,n={...o.subtitle,...e,url:t},i=await this.init(n);return e.name&&(a.show=`${r.get("Switch Subtitle")}: ${e.name}`),i}createTrack(t,e){const{template:r,proxy:a,option:o}=this.art,{$video:n,$track:i}=r,s=L("track");s.default=!0,s.kind=t,s.src=e,s.label=o.subtitle.name||"Artplayer",s.track.mode="hidden",s.onload=()=>{this.art.emit("subtitleLoad",this.cues,this.option)},this.art.events.remove(this.destroyEvent),i.onload=null,b(i),y(n,s),r.$track=s,this.destroyEvent=a(this.textTrack,"cuechange",()=>this.update())}async init(t){const{notice:e,template:{$subtitle:r}}=this.art;return this.textTrack?(o(t,ct.subtitle),t.url?(this.option=t,this.style(t.style),fetch(t.url).then(t=>t.arrayBuffer()).then(e=>{const r=new TextDecoder(t.encoding).decode(e);switch(t.type||V(t.url)){case"srt":{const e=X(r);return G(t.onVttLoad(e))}case"ass":{const e=K(r);return G(t.onVttLoad(e))}case"vtt":return G(t.onVttLoad(r));default:return t.url}}).then(t=>(r.innerHTML="",this.url===t||(URL.revokeObjectURL(this.url),this.createTrack("metadata",t)),t)).catch(t=>{throw r.innerHTML="",e.show=t,t})):void 0):null}}class Ut{constructor(t){this.art=t;const{option:e,constructor:r}=t;e.container instanceof Element?this.$container=e.container:(this.$container=u(e.container),_(this.$container,`No container element found by ${e.container}`)),_(I(),"The current browser does not support flex layout");const a=this.$container.tagName.toLowerCase();_("div"===a,`Unsupported container element type, only support 'div' but got '${a}'`),_(r.instances.every(t=>t.template.$container!==this.$container),"Cannot mount multiple instances on the same dom element"),this.query=this.query.bind(this),this.$container.dataset.artId=t.id,this.init()}static get html(){return`\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Player version:
\n
${n}
\n
\n
\n
Video url:
\n
\n
\n
\n
Video volume:
\n
\n
\n
\n
Video time:
\n
\n
\n
\n
Video duration:
\n
\n
\n
\n
Video resolution:
\n
\n x \n
\n
\n
\n
[x]
\n
\n
\n
\n `}query(t){return u(t,this.$container)}init(){const{option:t}=this.art;if(t.useSSR||(this.$container.innerHTML=Ut.html),this.$player=this.query(".art-video-player"),this.$video=this.query(".art-video"),this.$track=this.query("track"),this.$poster=this.query(".art-poster"),this.$subtitle=this.query(".art-subtitle"),this.$danmuku=this.query(".art-danmuku"),this.$bottom=this.query(".art-bottom"),this.$progress=this.query(".art-progress"),this.$controls=this.query(".art-controls"),this.$controlsLeft=this.query(".art-controls-left"),this.$controlsCenter=this.query(".art-controls-center"),this.$controlsRight=this.query(".art-controls-right"),this.$layer=this.query(".art-layers"),this.$loading=this.query(".art-loading"),this.$notice=this.query(".art-notice"),this.$noticeInner=this.query(".art-notice-inner"),this.$mask=this.query(".art-mask"),this.$state=this.query(".art-state"),this.$setting=this.query(".art-settings"),this.$info=this.query(".art-info"),this.$infoPanel=this.query(".art-info-panel"),this.$infoClose=this.query(".art-info-close"),this.$contextmenu=this.query(".art-contextmenus"),t.proxy){const e=t.proxy.call(this.art,this.art);_(e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement,"Function 'option.proxy' needs to return 'HTMLVideoElement' or 'HTMLCanvasElement'"),z(e,this.$video),e.className="art-video",this.$video=e}t.backdrop&&f(this.$player,"art-backdrop"),p&&f(this.$player,"art-mobile")}destroy(t){t?this.$container.innerHTML="":f(this.$player,"art-destroy")}}class qt{on(t,e,r){const a=this.e||(this.e={});return(a[t]||(a[t]=[])).push({fn:e,ctx:r}),this}once(t,e,r){const a=this;function o(...n){a.off(t,o),e.apply(r,n)}return o._=e,this.on(t,o,r)}emit(t,...e){const r=((this.e||(this.e={}))[t]||[]).slice();for(let a=0;ae.call(this,this)),Kt.DEBUG){const t=t=>console.log(`[ART.${this.id}] -> ${t}`);t(`Version@${Kt.version}`);for(let e=0;et(`Event@${e.type}`))}Gt.push(this)}static get instances(){return Gt}static get version(){return n}static get config(){return i}static get utils(){return tt}static get scheme(){return ct}static get Emitter(){return qt}static get validator(){return o}static get kindOf(){return o.kindOf}static get html(){return Ut.html}static get option(){return{id:"",container:"#artplayer",url:"",poster:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!1,gesture:!0,fastForward:!1,autoPlayback:!1,autoOrientation:!1,airplay:!1,proxy:void 0,layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],thumbnails:{url:"",number:60,column:10,width:0,height:0,scale:1},subtitle:{url:"",type:"",style:{},name:"",escape:!0,encoding:"utf-8",onVttLoad:t=>t},moreVideoAttr:{controls:!1,preload:l?"auto":"metadata"},i18n:{},icons:{},cssVar:{},customType:{},lang:navigator?.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}get video(){return this.template.$video}reset(){this.video.removeAttribute("src"),this.video.load()}destroy(t=!0){Kt.REMOVE_SRC_WHEN_DESTROY&&this.reset(),this.events.destroy(),this.template.destroy(t),Gt.splice(Gt.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}return Kt.STYLE=Wt,Kt.DEBUG=!1,Kt.CONTEXTMENU=!0,Kt.NOTICE_TIME=2e3,Kt.SETTING_WIDTH=250,Kt.SETTING_ITEM_WIDTH=200,Kt.SETTING_ITEM_HEIGHT=35,Kt.RESIZE_TIME=200,Kt.SCROLL_TIME=200,Kt.SCROLL_GAP=50,Kt.AUTO_PLAYBACK_MAX=10,Kt.AUTO_PLAYBACK_MIN=5,Kt.AUTO_PLAYBACK_TIMEOUT=3e3,Kt.RECONNECT_TIME_MAX=5,Kt.RECONNECT_SLEEP_TIME=1e3,Kt.CONTROL_HIDE_TIME=3e3,Kt.DBCLICK_TIME=300,Kt.DBCLICK_FULLSCREEN=!0,Kt.MOBILE_DBCLICK_PLAY=!0,Kt.MOBILE_CLICK_PLAY=!1,Kt.AUTO_ORIENTATION_TIME=200,Kt.INFO_LOOP_TIME=1e3,Kt.FAST_FORWARD_VALUE=3,Kt.FAST_FORWARD_TIME=1e3,Kt.TOUCH_MOVE_RATIO=.5,Kt.VOLUME_STEP=.1,Kt.SEEK_STEP=5,Kt.PLAYBACK_RATE=[.5,.75,1,1.25,1.5,2],Kt.ASPECT_RATIO=["default","4:3","16:9"],Kt.FLIP=["normal","horizontal","vertical"],Kt.FULLSCREEN_WEB_IN_BODY=!0,Kt.LOG_VERSION=!0,Kt.USE_RAF=!1,Kt.REMOVE_SRC_WHEN_DESTROY=!0,h&&(M("artplayer-style",Wt),setTimeout(()=>{Kt.LOG_VERSION&&console.log(`%c ArtPlayer %c ${Kt.version} %c https://artplayer.org`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729","")},100)),Kt});